class GBTiles::GBT::Export::ASM::Channels::Pulse
Public Class Methods
new(channel_number)
click to toggle source
Calls superclass method
GBTiles::GBT::Export::ASM::Channel::new
# File lib/gbtiles/gbt/export/asm/channels/pulse.rb, line 13 def initialize(channel_number) super(channel_number) end
Public Instance Methods
convert()
click to toggle source
# File lib/gbtiles/gbt/export/asm/channels/pulse.rb, line 21 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/pulse.rb, line 58 def convert_note_new instrument = sample_number & 3 # Volume effect if effect_number == 0xC then return [ (1 << 7) | note_index, (instrument << 4) | convert_volume ] end # Other effects begin converted = convert_effect return [ (1 << 7) | note_index, (1 << 7) | (instrument << 4) | converted[:number], converted[:params] ] rescue Exception => e throw "Pulse - Invalid command: #{e}" end end
convert_note_not_new()
click to toggle source
# File lib/gbtiles/gbt/export/asm/channels/pulse.rb, line 29 def convert_note_not_new instrument = sample_number & 3 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) | (instrument << 4) | converted[:number], converted[:params] ] rescue Exception => e # Silence end return [0] end
is_pulse?()
click to toggle source
# File lib/gbtiles/gbt/export/asm/channels/pulse.rb, line 17 def is_pulse? true end