lib/mml2wav/command.rb in mml2wav-0.0.3 vs lib/mml2wav/command.rb in mml2wav-0.0.4

- old
+ new

@@ -8,11 +8,13 @@ new(arguments).run end def initialize(arguments) @options = parse_options(arguments) - @sounds = ARGF.readlines.join(" ") + channel_delimiter = @options[:channel_delimiter] || "," + channels = ARGF.readlines.join.split(/#{channel_delimiter}/) + @sounds = channels.reject {|channel| channel.empty? } end def run Wave.write(@sounds, @options) end @@ -32,9 +34,17 @@ options[:sampling_rate] = rate end parser.on("--bpm=BPM", "Specify BPM (beats per minute)", Integer) do |bpm| options[:bpm] = bpm + end + parser.on("--octave_reverse", + "Reverse octave sign (><) effects") do |boolean| + options[:octave_reverse] = boolean + end + parser.on("--channel_delimiter=DELIMITER", + "Specify channel delimiter") do |delimiter| + options[:channel_delimiter] = delimiter end parser.parse!(arguments) unless File.pipe?('/dev/stdin') || IO.select([ARGF], nil, nil, 0) puts(parser.help)