Correctly returning the sample rate

This commit is contained in:
WolverinDEV 2021-03-27 21:29:47 +01:00
parent 768e9b7bbb
commit b475b6db45
3 changed files with 5 additions and 6 deletions

View File

@ -11,8 +11,7 @@ namespace tc::audio::pa {
class PortAudioPlayback : public AudioDevicePlayback {
public:
static constexpr auto kChannelCount{2};
static constexpr auto kSampleRate{44100};
static constexpr auto kTimeSpan{0.01};
static constexpr auto kSampleRate{48000};
explicit PortAudioPlayback(PaDeviceIndex index, const PaDeviceInfo* info);
virtual ~PortAudioPlayback();
@ -35,7 +34,7 @@ namespace tc::audio::pa {
class PortAudioRecord : public AudioDeviceRecord {
public:
static constexpr auto kChannelCount{2};
static constexpr auto kSampleRate{44100};
static constexpr auto kSampleRate{48000};
explicit PortAudioRecord(PaDeviceIndex index, const PaDeviceInfo* info);
virtual ~PortAudioRecord();

View File

@ -63,7 +63,7 @@ bool PortAudioPlayback::impl_start(std::string &error) {
nullptr,
&parameters,
(double) kSampleRate,
(unsigned long) (kSampleRate * kTimeSpan),
paFramesPerBufferUnspecified,
paClipOff,
proxied_write_callback,
this
@ -100,7 +100,7 @@ void PortAudioPlayback::impl_stop() {
}
size_t PortAudioPlayback::sample_rate() const {
return (size_t) this->info->defaultSampleRate;
return (size_t) kSampleRate;
}
void PortAudioPlayback::write_callback(void *output, unsigned long frameCount,

View File

@ -98,7 +98,7 @@ void PortAudioRecord::impl_stop() {
}
size_t PortAudioRecord::sample_rate() const {
return (size_t) this->info->defaultSampleRate;
return kSampleRate;
}
void PortAudioRecord::read_callback(const void *input, unsigned long frameCount,