rename value to other in SoundChannel#===

This commit is contained in:
Matthew Berry 2022-07-13 19:05:59 -07:00
parent 1a40e281ed
commit dfdd319ca9
11 changed files with 20 additions and 20 deletions

View file

@ -30,7 +30,7 @@ module GB
end end
# Used so that channels can be matched with case..when statements # Used so that channels can be matched with case..when statements
abstract def ===(value) abstract def ===(other)
# Calculate the frequency timer # Calculate the frequency timer
abstract def frequency_timer : UInt32 abstract def frequency_timer : UInt32

View file

@ -9,8 +9,8 @@ module GB
RANGE = 0xFF10..0xFF14 RANGE = 0xFF10..0xFF14
def ===(value) : Bool def ===(other) : Bool
value.is_a?(Int) && RANGE.includes?(value) other.is_a?(Int) && RANGE.includes?(other)
end end
@wave_duty_position = 0 @wave_duty_position = 0

View file

@ -9,8 +9,8 @@ module GB
RANGE = 0xFF16..0xFF19 RANGE = 0xFF16..0xFF19
def ===(value) : Bool def ===(other) : Bool
value.is_a?(Int) && RANGE.includes?(value) other.is_a?(Int) && RANGE.includes?(other)
end end
@wave_duty_position = 0 @wave_duty_position = 0

View file

@ -3,8 +3,8 @@ module GB
RANGE = 0xFF1A..0xFF1E RANGE = 0xFF1A..0xFF1E
WAVE_RAM_RANGE = 0xFF30..0xFF3F WAVE_RAM_RANGE = 0xFF30..0xFF3F
def ===(value) : Bool def ===(other) : Bool
value.is_a?(Int) && RANGE.includes?(value) || WAVE_RAM_RANGE.includes?(value) other.is_a?(Int) && RANGE.includes?(other) || WAVE_RAM_RANGE.includes?(other)
end end
@wave_ram = Bytes.new(WAVE_RAM_RANGE.size) { |idx| idx & 1 == 0 ? 0x00_u8 : 0xFF_u8 } @wave_ram = Bytes.new(WAVE_RAM_RANGE.size) { |idx| idx & 1 == 0 ? 0x00_u8 : 0xFF_u8 }

View file

@ -2,8 +2,8 @@ module GB
class Channel4 < VolumeEnvelopeChannel class Channel4 < VolumeEnvelopeChannel
RANGE = 0xFF20..0xFF23 RANGE = 0xFF20..0xFF23
def ===(value) : Bool def ===(other) : Bool
value.is_a?(Int) && RANGE.includes?(value) other.is_a?(Int) && RANGE.includes?(other)
end end
@lfsr : UInt16 = 0x0000 @lfsr : UInt16 = 0x0000

View file

@ -30,7 +30,7 @@ module GBA
end end
# Used so that channels can be matched with case..when statements # Used so that channels can be matched with case..when statements
abstract def ===(value) abstract def ===(other)
# Calculate the frequency timer # Calculate the frequency timer
abstract def frequency_timer : UInt32 abstract def frequency_timer : UInt32

View file

@ -9,8 +9,8 @@ module GBA
RANGE = 0x60..0x67 RANGE = 0x60..0x67
def ===(value) : Bool def ===(other) : Bool
value.is_a?(Int) && RANGE.includes?(value) other.is_a?(Int) && RANGE.includes?(other)
end end
@wave_duty_position = 0 @wave_duty_position = 0

View file

@ -9,8 +9,8 @@ module GBA
RANGE = 0x68..0x6F RANGE = 0x68..0x6F
def ===(value) : Bool def ===(other) : Bool
value.is_a?(Int) && RANGE.includes?(value) other.is_a?(Int) && RANGE.includes?(other)
end end
@wave_duty_position = 0 @wave_duty_position = 0

View file

@ -3,8 +3,8 @@ module GBA
RANGE = 0x70..0x77 RANGE = 0x70..0x77
WAVE_RAM_RANGE = 0x90..0x9F WAVE_RAM_RANGE = 0x90..0x9F
def ===(value) : Bool def ===(other) : Bool
value.is_a?(Int) && RANGE.includes?(value) || WAVE_RAM_RANGE.includes?(value) other.is_a?(Int) && RANGE.includes?(other) || WAVE_RAM_RANGE.includes?(other)
end end
@wave_ram = Array(Bytes).new 2, Bytes.new(WAVE_RAM_RANGE.size) { |idx| idx & 1 == 0 ? 0x00_u8 : 0xFF_u8 } @wave_ram = Array(Bytes).new 2, Bytes.new(WAVE_RAM_RANGE.size) { |idx| idx & 1 == 0 ? 0x00_u8 : 0xFF_u8 }

View file

@ -2,8 +2,8 @@ module GBA
class Channel4 < VolumeEnvelopeChannel class Channel4 < VolumeEnvelopeChannel
RANGE = 0x78..0x7F RANGE = 0x78..0x7F
def ===(value) : Bool def ===(other) : Bool
value.is_a?(Int) && RANGE.includes?(value) other.is_a?(Int) && RANGE.includes?(other)
end end
@lfsr : UInt16 = 0x0000 @lfsr : UInt16 = 0x0000

View file

@ -8,8 +8,8 @@ module GBA
@timers : Array(Proc(UInt16)) @timers : Array(Proc(UInt16))
@latches = Array(Int16).new 2, 0 @latches = Array(Int16).new 2, 0
def ===(value) : Bool def ===(other) : Bool
value.is_a?(Int) && RANGE.includes?(value) other.is_a?(Int) && RANGE.includes?(other)
end end
def initialize(@gba : GBA, @control : Reg::SOUNDCNT_H) def initialize(@gba : GBA, @control : Reg::SOUNDCNT_H)