class GBTiles::GBT::Export::ASM::Channels::Wav
Public Class Methods
new()
click to toggle source
Calls superclass method
GBTiles::GBT::Export::ASM::Channel::new
# File lib/gbtiles/gbt/export/asm/channels/wav.rb, line 12 def initialize super(3) end
Public Instance Methods
convert()
click to toggle source
# File lib/gbtiles/gbt/export/asm/channels/wav.rb, line 35 def convert if sample_period == 0 then convert_note_not_new else convert_note_new end end
convert_note_new()
click to toggle source
# File lib/gbtiles/gbt/export/asm/channels/wav.rb, line 71 def convert_note_new instrument = (sample_number - 8) & 15 # Volume effect if effect_number == 0xC then return [ (1 << 7) | note_index, (convert_volume << 4) | instrument ] end # Other effects begin converted = convert_effect if (converted[:number] > 7) then throw "Invalid command: only 0-7 allowed in this mode" end return [ (1 << 7) | note_index, (1 << 7) | (converted_num << 4) | instrument, converted_params ] rescue Exception => e throw "Wav - Invalid command: #{e}" end end
convert_note_not_new()
click to toggle source
# File lib/gbtiles/gbt/export/asm/channels/wav.rb, line 43 def convert_note_not_new if is_empty_effect? then return [0] end # Volume effect if effect_number == 0xC then return [ (1 << 5) | convert_volume ] end # Other effects begin converted = convert_effect return [ (1 << 6) | converted[:number], converted[:params] ] rescue Exception => e # Silence end return [0] end
convert_volume()
click to toggle source
Calls superclass method
GBTiles::GBT::Export::ASM::Channel#convert_volume
# File lib/gbtiles/gbt/export/asm/channels/wav.rb, line 20 def convert_volume case super when 0..3 return 0 when 4..7 return 3 when 8..11 return 2 when 12..15 return 1 else return 1 end end
is_wav?()
click to toggle source
# File lib/gbtiles/gbt/export/asm/channels/wav.rb, line 16 def is_wav? true end