C64: Fix voume based audio sampling, fix some state bugs
This commit is contained in:
parent
df8edae97e
commit
06201a1c4f
|
@ -34,7 +34,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
|
|||
});
|
||||
}
|
||||
|
||||
if (tapeDriveEnabled)
|
||||
if (tapeDriveEnabled && (_board.TapeDrive.TapeDataDomain != null))
|
||||
{
|
||||
domains.AddRange(new[]
|
||||
{
|
||||
|
|
|
@ -32,7 +32,8 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Cassette
|
|||
|
||||
public override void SyncState(Serializer ser)
|
||||
{
|
||||
_tape.SyncState(ser);
|
||||
|
||||
if (_tape != null) { _tape.SyncState(ser); }
|
||||
}
|
||||
|
||||
public void Insert(Tape tape)
|
||||
|
@ -46,6 +47,19 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Cassette
|
|||
}
|
||||
|
||||
// Exposed for memory domains, should not be used for actual emulation implementation
|
||||
public override byte[] TapeDataDomain => _tape.TapeDataDomain;
|
||||
public override byte[] TapeDataDomain
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_tape != null)
|
||||
{
|
||||
return _tape.TapeDataDomain;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -138,12 +138,13 @@
|
|||
|
||||
// we want to only flush the filter when the filter is actually changed, that way
|
||||
// the FFT will not be impacted by small sample sizes from other changes
|
||||
if (addr == 15 || addr == 16 || addr==17)
|
||||
if ((addr == 0x15) || (addr == 0x16) || (addr == 0x17))
|
||||
{
|
||||
Flush(true);
|
||||
}
|
||||
else if (addr==18)
|
||||
else if (addr == 0x18)
|
||||
{
|
||||
|
||||
// note: we only want to flush the filter here if the filter components are changing
|
||||
bool temp1 = (val & 0x10) != 0;
|
||||
bool temp2 = (val & 0x20) != 0;
|
||||
|
|
|
@ -49,8 +49,8 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
|
|||
{
|
||||
_mixer = _outputBuffer_not_filtered[i] + _outputBuffer_filtered[i];
|
||||
_mixer = _mixer >> 7;
|
||||
_mixer = (_mixer * _volume) >> 4;
|
||||
_mixer -= _volume << 8;
|
||||
_mixer = (_mixer * _volume_at_sample_time[i]) >> 4;
|
||||
_mixer -= _volume_at_sample_time[i] << 8;
|
||||
|
||||
if (_mixer > 0x7FFF)
|
||||
{
|
||||
|
|
|
@ -41,6 +41,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
|
|||
private short[] _outputBuffer;
|
||||
private int[] _outputBuffer_filtered;
|
||||
private int[] _outputBuffer_not_filtered;
|
||||
private int[] _volume_at_sample_time;
|
||||
private int _outputBufferIndex;
|
||||
private int filter_index;
|
||||
private int last_filtered_value;
|
||||
|
@ -93,6 +94,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
|
|||
|
||||
_outputBuffer_filtered = new int[sampleRate];
|
||||
_outputBuffer_not_filtered = new int[sampleRate];
|
||||
_volume_at_sample_time = new int[sampleRate];
|
||||
}
|
||||
|
||||
// ------------------------------------
|
||||
|
@ -190,6 +192,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
|
|||
{
|
||||
_outputBuffer_not_filtered[_outputBufferIndex] = temp_not_filtered;
|
||||
_outputBuffer_filtered[_outputBufferIndex] = temp_filtered;
|
||||
_volume_at_sample_time[_outputBufferIndex] = _volume;
|
||||
_outputBufferIndex++;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue