diff options
Diffstat (limited to 'drivers/alsa')
-rw-r--r-- | drivers/alsa/audio_driver_alsa.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/alsa/audio_driver_alsa.cpp b/drivers/alsa/audio_driver_alsa.cpp index 400ce31bf7..48e694dd3a 100644 --- a/drivers/alsa/audio_driver_alsa.cpp +++ b/drivers/alsa/audio_driver_alsa.cpp @@ -60,7 +60,7 @@ Error AudioDriverALSA::init_device() { fprintf(stderr, "ALSA ERR: %s\n", snd_strerror(status)); \ if (pcm_handle) { \ snd_pcm_close(pcm_handle); \ - pcm_handle = NULL; \ + pcm_handle = nullptr; \ } \ ERR_FAIL_COND_V(m_cond, ERR_CANT_OPEN); \ } @@ -98,7 +98,7 @@ Error AudioDriverALSA::init_device() { status = snd_pcm_hw_params_set_channels(pcm_handle, hwparams, 2); CHECK_FAIL(status < 0); - status = snd_pcm_hw_params_set_rate_near(pcm_handle, hwparams, &mix_rate, NULL); + status = snd_pcm_hw_params_set_rate_near(pcm_handle, hwparams, &mix_rate, nullptr); CHECK_FAIL(status < 0); // In ALSA the period size seems to be the one that will determine the actual latency @@ -113,12 +113,12 @@ Error AudioDriverALSA::init_device() { status = snd_pcm_hw_params_set_buffer_size_near(pcm_handle, hwparams, &buffer_size); CHECK_FAIL(status < 0); - status = snd_pcm_hw_params_set_period_size_near(pcm_handle, hwparams, &period_size, NULL); + status = snd_pcm_hw_params_set_period_size_near(pcm_handle, hwparams, &period_size, nullptr); CHECK_FAIL(status < 0); print_verbose("Audio buffer frames: " + itos(period_size) + " calculated latency: " + itos(period_size * 1000 / mix_rate) + "ms"); - status = snd_pcm_hw_params_set_periods_near(pcm_handle, hwparams, &periods, NULL); + status = snd_pcm_hw_params_set_periods_near(pcm_handle, hwparams, &periods, nullptr); CHECK_FAIL(status < 0); status = snd_pcm_hw_params(pcm_handle, hwparams); @@ -262,11 +262,11 @@ Array AudioDriverALSA::get_device_list() { if (snd_device_name_hint(-1, "pcm", &hints) < 0) return list; - for (void **n = hints; *n != NULL; n++) { + for (void **n = hints; *n != nullptr; n++) { char *name = snd_device_name_get_hint(*n, "NAME"); char *desc = snd_device_name_get_hint(*n, "DESC"); - if (name != NULL && !strncmp(name, "plughw", 6)) { + if (name != nullptr && !strncmp(name, "plughw", 6)) { if (desc) { list.push_back(String(name) + ";" + String(desc)); } else { @@ -274,9 +274,9 @@ Array AudioDriverALSA::get_device_list() { } } - if (desc != NULL) + if (desc != nullptr) free(desc); - if (name != NULL) + if (name != nullptr) free(name); } snd_device_name_free_hint(hints); @@ -314,7 +314,7 @@ void AudioDriverALSA::finish_device() { if (pcm_handle) { snd_pcm_close(pcm_handle); - pcm_handle = NULL; + pcm_handle = nullptr; } } @@ -325,15 +325,15 @@ void AudioDriverALSA::finish() { Thread::wait_to_finish(thread); memdelete(thread); - thread = NULL; + thread = nullptr; } finish_device(); } AudioDriverALSA::AudioDriverALSA() : - thread(NULL), - pcm_handle(NULL), + thread(nullptr), + pcm_handle(nullptr), device_name("Default"), new_device("Default") { } |