Skip to content

Commit 86a80da

Browse files
committed
review fixes
1 parent 8020ddb commit 86a80da

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

src/soundio/portaudioenumerator.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ void PortAudioEnumerator::initialize() {
4646
return;
4747
}
4848

49+
m_devices.clear();
50+
m_jackSampleRate = mixxx::audio::SampleRate();
51+
4952
#if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)
5053
setJACKName();
5154
#endif
@@ -301,7 +304,13 @@ void PortAudioEnumerator::setJACKName() const {
301304

302305
std::vector<std::string> PortAudioEnumerator::getAPIs() const {
303306
std::vector<std::string> apiList;
304-
for (PaHostApiIndex i = 0; i < Pa_GetHostApiCount(); i++) {
307+
308+
int apiCount = Pa_GetHostApiCount();
309+
if (apiCount < 0) {
310+
return std::vector<std::string>{};
311+
}
312+
313+
for (PaHostApiIndex i = 0; i < apiCount; i++) {
305314
const PaHostApiInfo* api = Pa_GetHostApiInfo(i);
306315
if (api && QString(api->name) != "skeleton implementation") {
307316
apiList.push_back(api->name);
@@ -331,6 +340,7 @@ QList<mixxx::audio::SampleRate> PortAudioEnumerator::getJackSampleRates() const
331340

332341
void PortAudioEnumerator::terminate() {
333342
PaError err = paNoError;
343+
334344
if (m_initialized) {
335345
err = Pa_Terminate();
336346
if (err == paNoError) {

src/soundio/sounddeviceenumerator.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#pragma once
22

33
#include <QObject>
4+
#include <string>
5+
#include <vector>
46

57
#include "soundio/sounddevice.h"
68

0 commit comments

Comments
 (0)