mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-20 13:23:45 -07:00
Added GetSampleRate function
This commit is contained in:
parent
9cf537eaff
commit
3dc33b6f84
4 changed files with 19 additions and 18 deletions
|
@ -11,5 +11,6 @@ namespace Ship {
|
|||
virtual int Buffered(void) = 0;
|
||||
virtual int GetDesiredBuffered(void) = 0;
|
||||
virtual void Play(const uint8_t* buf, uint32_t len) = 0;
|
||||
constexpr int GetSampleRate() const { return 44100; }
|
||||
};
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ namespace Ship
|
|||
// Create stream
|
||||
pa_sample_spec ss;
|
||||
ss.format = PA_SAMPLE_S16LE;
|
||||
ss.rate = 32000;
|
||||
ss.rate = this->GetSampleRate();
|
||||
ss.channels = 2;
|
||||
|
||||
pa_buffer_attr attr;
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace Ship {
|
|||
}
|
||||
SDL_AudioSpec want, have;
|
||||
SDL_zero(want);
|
||||
want.freq = 44000;
|
||||
want.freq = this->GetSampleRate();
|
||||
want.format = AUDIO_S16;
|
||||
want.channels = 2;
|
||||
want.samples = 1024;
|
||||
|
|
|
@ -30,8 +30,8 @@ namespace Ship {
|
|||
WAVEFORMATEX desired;
|
||||
desired.wFormatTag = WAVE_FORMAT_PCM;
|
||||
desired.nChannels = 2;
|
||||
desired.nSamplesPerSec = 44100;
|
||||
desired.nAvgBytesPerSec = 44100 * 2 * 2;
|
||||
desired.nSamplesPerSec = this->GetSampleRate();
|
||||
desired.nAvgBytesPerSec = desired.nSamplesPerSec * 2 * 2;
|
||||
desired.nBlockAlign = 4;
|
||||
desired.wBitsPerSample = 16;
|
||||
desired.cbSize = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue