snes9x/apu/bapu/dsp/dsp.cpp
Brandon Wright 10a521e39c byuu APU now being used. Nothing works yet.
Sync is broken, but the new SMP will handle ratios now.
Save states need to be redone without serializer.
No SPC dumping.
2011-06-18 05:31:44 -05:00

54 lines
845 B
C++
Executable File

#include <snes/snes.hpp>
#define DSP_CPP
namespace SNES {
DSP dsp;
#include "SPC_DSP.cpp"
void DSP::step(unsigned clocks) {
clock += clocks;
}
void DSP::synchronize_smp() {
while(clock >= 0) smp.enter();
}
void DSP::enter() {
spc_dsp.run(1);
step(24);
}
uint8 DSP::read(uint8 addr) {
return spc_dsp.read(addr);
}
void DSP::write(uint8 addr, uint8 data) {
spc_dsp.write(addr, data);
}
void DSP::power() {
spc_dsp.init(smp.apuram);
spc_dsp.reset();
}
void DSP::reset() {
spc_dsp.soft_reset();
}
void DSP::channel_enable(unsigned channel, bool enable) {
channel_enabled[channel & 7] = enable;
unsigned mask = 0;
for(unsigned i = 0; i < 8; i++) {
if(channel_enabled[i] == false) mask |= 1 << i;
}
spc_dsp.mute_voices(mask);
}
DSP::DSP() {
for(unsigned i = 0; i < 8; i++) channel_enabled[i] = true;
}
}