summaryrefslogtreecommitdiff
path: root/drivers/rtaudio/audio_driver_rtaudio.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rtaudio/audio_driver_rtaudio.cpp')
-rw-r--r--drivers/rtaudio/audio_driver_rtaudio.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/rtaudio/audio_driver_rtaudio.cpp b/drivers/rtaudio/audio_driver_rtaudio.cpp
index 7de3ff192e..ae5fdd28b6 100644
--- a/drivers/rtaudio/audio_driver_rtaudio.cpp
+++ b/drivers/rtaudio/audio_driver_rtaudio.cpp
@@ -107,14 +107,13 @@ Error AudioDriverRtAudio::init() {
options.numberOfBuffers = 4;
parameters.firstChannel = 0;
- mix_rate = GLOBAL_DEF("audio/mix_rate", 44100);
+ mix_rate = GLOBAL_DEF("audio/mix_rate", DEFAULT_MIX_RATE);
- int latency = GLOBAL_DEF("audio/output_latency", 25);
- // calculate desired buffer_size
- unsigned int buffer_size = closest_power_of_2(latency * mix_rate / 1000);
+ int latency = GLOBAL_DEF("audio/output_latency", DEFAULT_OUTPUT_LATENCY);
+ unsigned int buffer_frames = closest_power_of_2(latency * mix_rate / 1000);
if (OS::get_singleton()->is_stdout_verbose()) {
- print_line("audio buffer size: " + itos(buffer_size));
+ print_line("audio buffer frames: " + itos(buffer_frames) + " calculated latency: " + itos(buffer_frames * 1000 / mix_rate) + "ms");
}
short int tries = 2;
@@ -127,7 +126,7 @@ Error AudioDriverRtAudio::init() {
};
try {
- dac->openStream(&parameters, NULL, RTAUDIO_SINT32, mix_rate, &buffer_size, &callback, this, &options);
+ dac->openStream(&parameters, NULL, RTAUDIO_SINT32, mix_rate, &buffer_frames, &callback, this, &options);
active = true;
break;
@@ -199,7 +198,7 @@ AudioDriverRtAudio::AudioDriverRtAudio() {
active = false;
mutex = NULL;
dac = NULL;
- mix_rate = 44100;
+ mix_rate = DEFAULT_MIX_RATE;
speaker_mode = SPEAKER_MODE_STEREO;
}