mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 22:29:39 -06:00
Do not directly store input sample rate, rather just store a divisor for that sample rate, with it using a fixed dividend of 54000000 * 2.
This should reduce (but not completely eliminate) gradual audio desyncs in dumps. This also allows for accurate sample rates for the GameCube. Completely eliminating gradual audio desyncs will require resampling to an integer sample rate, as nothing seems to support a non-integer sample rate.
This commit is contained in:
@ -30,24 +30,28 @@ public:
|
||||
WaveFileWriter(WaveFileWriter&&) = delete;
|
||||
WaveFileWriter& operator=(WaveFileWriter&&) = delete;
|
||||
|
||||
bool Start(const std::string& filename, unsigned int HLESampleRate);
|
||||
bool Start(const std::string& filename, u32 sample_rate_divisor);
|
||||
void Stop();
|
||||
|
||||
void SetSkipSilence(bool skip) { skip_silence = skip; }
|
||||
void AddStereoSamplesBE(const short* sample_data, u32 count, int sample_rate, int l_volume,
|
||||
int r_volume); // big endian
|
||||
// big endian
|
||||
void AddStereoSamplesBE(const short* sample_data, u32 count, u32 sample_rate_divisor,
|
||||
int l_volume, int r_volume);
|
||||
u32 GetAudioSize() const { return audio_size; }
|
||||
|
||||
private:
|
||||
static constexpr size_t BUFFER_SIZE = 32 * 1024;
|
||||
|
||||
File::IOFile file;
|
||||
bool skip_silence = false;
|
||||
u32 audio_size = 0;
|
||||
std::array<short, BUFFER_SIZE> conv_buffer{};
|
||||
void Write(u32 value);
|
||||
void Write4(const char* ptr);
|
||||
|
||||
File::IOFile file;
|
||||
std::string basename;
|
||||
int current_sample_rate;
|
||||
int file_index = 0;
|
||||
u32 file_index = 0;
|
||||
u32 audio_size = 0;
|
||||
|
||||
u32 current_sample_rate_divisor;
|
||||
std::array<short, BUFFER_SIZE> conv_buffer{};
|
||||
|
||||
bool skip_silence = false;
|
||||
};
|
||||
|
Reference in New Issue
Block a user