Call Dsp::GetSamples from SNES SetSamples
This commit is contained in:
@@ -45,16 +45,6 @@ uint16_t GetHeaderOffset(const Memory& memory) {
|
|||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void audio_callback(void* userdata, uint8_t* stream, int len) {
|
|
||||||
auto* apu = static_cast<audio::Apu*>(userdata);
|
|
||||||
auto* buffer = reinterpret_cast<int16_t*>(stream);
|
|
||||||
|
|
||||||
for (int i = 0; i < len / 2; i++) { // Assuming 16-bit samples
|
|
||||||
buffer[i] = apu->GetNextSample(); // This function should be implemented in
|
|
||||||
// APU to fetch the next sample
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
RomInfo SNES::ReadRomHeader(uint32_t offset) {
|
RomInfo SNES::ReadRomHeader(uint32_t offset) {
|
||||||
@@ -134,9 +124,6 @@ void SNES::Init(Rom& rom) {
|
|||||||
// Initialize APU
|
// Initialize APU
|
||||||
apu_.Init();
|
apu_.Init();
|
||||||
|
|
||||||
// Initialize SDL_Mixer to play the audio samples
|
|
||||||
// Mix_HookMusic(audio_callback, &apu);
|
|
||||||
|
|
||||||
// Disable interrupts and rendering
|
// Disable interrupts and rendering
|
||||||
memory_.WriteByte(0x4200, 0x00); // NMITIMEN
|
memory_.WriteByte(0x4200, 0x00); // NMITIMEN
|
||||||
memory_.WriteByte(0x420C, 0x00); // HDMAEN
|
memory_.WriteByte(0x420C, 0x00); // HDMAEN
|
||||||
@@ -350,7 +337,7 @@ void SNES::LoadState(const std::string& path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SNES::SetSamples(int16_t* sample_data, int wanted_samples) {
|
void SNES::SetSamples(int16_t* sample_data, int wanted_samples) {
|
||||||
// Set the samples in the apu
|
apu_.dsp().GetSamples(sample_data, wanted_samples, pal_timing_);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace emu
|
} // namespace emu
|
||||||
|
|||||||
@@ -71,10 +71,6 @@ class SNES : public DirectMemoryAccess {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void WriteToRegister(uint16_t address, uint8_t value) {
|
|
||||||
memory_.WriteByte(address, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Components of the SNES
|
// Components of the SNES
|
||||||
MemoryImpl memory_;
|
MemoryImpl memory_;
|
||||||
ClockImpl clock_;
|
ClockImpl clock_;
|
||||||
@@ -99,6 +95,7 @@ class SNES : public DirectMemoryAccess {
|
|||||||
|
|
||||||
// Other private member variables
|
// Other private member variables
|
||||||
bool running_ = false;
|
bool running_ = false;
|
||||||
|
bool pal_timing_ = false;
|
||||||
int scanline;
|
int scanline;
|
||||||
int cpu_mode_ = 0;
|
int cpu_mode_ = 0;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user