SPU: Add audio dumping support

This commit is contained in:
Connor McLaughlin
2020-03-15 22:04:17 +10:00
parent 198a64eb5e
commit 8e20d0d4ff
6 changed files with 113 additions and 4 deletions

View File

@ -7,6 +7,11 @@
class StateWrapper;
namespace Common
{
class WAVWriter;
}
class System;
class TimingEvent;
class DMA;
@ -42,6 +47,15 @@ public:
// Executes the SPU, generating any pending samples.
void GeneratePendingSamples();
/// Returns true if currently dumping audio.
ALWAYS_INLINE bool IsDumpingAudio() const { return static_cast<bool>(m_dump_writer); }
/// Starts dumping audio to file.
bool StartDumpingAudio(const char* filename);
/// Stops dumping audio to file, if started.
bool StopDumpingAudio();
private:
static constexpr u32 RAM_SIZE = 512 * 1024;
static constexpr u32 RAM_MASK = RAM_SIZE - 1;
@ -284,7 +298,9 @@ private:
DMA* m_dma = nullptr;
InterruptController* m_interrupt_controller = nullptr;
std::unique_ptr<TimingEvent> m_tick_event;
std::unique_ptr<Common::WAVWriter> m_dump_writer;
u32 m_tick_counter = 0;
TickCount m_ticks_carry = 0;
SPUCNT m_SPUCNT = {};
SPUSTAT m_SPUSTAT = {};
@ -309,8 +325,6 @@ private:
u32 m_noise_mode_register = 0;
u32 m_pitch_modulation_enable_register = 0;
TickCount m_ticks_carry = 0;
std::array<Voice, NUM_VOICES> m_voices{};
std::array<u8, NUM_VOICES> m_voice_key_on_off_delay{};
std::array<u8, RAM_SIZE> m_ram{};