Class: GBTiles::GBT::Export::ASM::Channels::Noise
- Inherits:
-
GBTiles::GBT::Export::ASM::Channel
- Object
- GBTiles::GBT::Export::ASM::Channel
- GBTiles::GBT::Export::ASM::Channels::Noise
- Defined in:
- lib/gbtiles/gbt/export/asm/channels/noise.rb
Constant Summary
Constants inherited from GBTiles::GBT::Export::ASM::Channel
GBTiles::GBT::Export::ASM::Channel::NOTES
Instance Attribute Summary
Attributes inherited from GBTiles::GBT::Export::ASM::Channel
Instance Method Summary collapse
- #convert ⇒ Object
- #convert_note_new ⇒ Object
- #convert_note_not_new ⇒ Object
-
#initialize ⇒ Noise
constructor
A new instance of Noise.
- #is_noise? ⇒ Boolean
Methods inherited from GBTiles::GBT::Export::ASM::Channel
#convert_effect, #convert_speed, #convert_volume, #data, #data=, #effect_number, #effect_param, #effect_param_1, #effect_param_2, #effect_param_as_bcd, #is_empty_effect?, #is_pulse?, #is_wav?, #note_index, #sample_number, #sample_period
Methods included from Effects
#effect_arpeggio, #effect_break_and_set_step, #effect_cut_note, #effect_jump, #effect_pan, #effect_speed, #effect_volume
Constructor Details
#initialize ⇒ Noise
Returns a new instance of Noise.
12 13 14 |
# File 'lib/gbtiles/gbt/export/asm/channels/noise.rb', line 12 def initialize super(4) end |
Instance Method Details
#convert ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/gbtiles/gbt/export/asm/channels/noise.rb', line 20 def convert if sample_period == 0 then convert_note_not_new else convert_note_new end end |
#convert_note_new ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/gbtiles/gbt/export/asm/channels/noise.rb', line 55 def convert_note_new instrument = (sample_number - 16) & 0x1F # Volume effect if effect_number == 0xC then return [ (1 << 7) | instrument, convert_volume ] end # Other effects begin converted = convert_effect return [ (1 << 7) | instrument, (1 << 7) | converted[:number], converted[:params] ] rescue Exception => e throw "Noise - Invalid command: #{e}" end end |
#convert_note_not_new ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/gbtiles/gbt/export/asm/channels/noise.rb', line 28 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 |
#is_noise? ⇒ Boolean
16 17 18 |
# File 'lib/gbtiles/gbt/export/asm/channels/noise.rb', line 16 def is_noise? true end |