mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2025-02-03 09:44:26 -05:00
AudioThread: re-apply consistent formating
This commit is contained in:
parent
fc1c1c3b4d
commit
033bbd07df
@ -201,7 +201,8 @@ static int audioCallback(void *outputBuffer, void * /* inputBuffer */, unsigned
|
||||
}
|
||||
srcmix->audioQueuePtr++;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
for (int i = 0, iMax = srcmix->currentInput->channels * nBufferFrames; i < iMax; i++) {
|
||||
|
||||
if (srcmix->audioQueuePtr >= srcmix->currentInput->data.size()) {
|
||||
@ -400,7 +401,8 @@ void AudioThread::setupDevice(int deviceId) {
|
||||
|
||||
if (deviceSampleRate.find(parameters.deviceId) != deviceSampleRate.end()) {
|
||||
sampleRate = deviceSampleRate[parameters.deviceId];
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
std::cout << "Error, device sample rate wasn't initialized?" << std::endl;
|
||||
return;
|
||||
// sampleRate = AudioThread::getDefaultAudioSampleRate();
|
||||
@ -417,12 +419,14 @@ void AudioThread::setupDevice(int deviceId) {
|
||||
deviceController[parameters.deviceId]->bindThread(this);
|
||||
deviceController[parameters.deviceId]->attachControllerThread(new std::thread(&AudioThread::threadMain, deviceController[parameters.deviceId]));
|
||||
|
||||
} else if (deviceController[parameters.deviceId] == this) {
|
||||
}
|
||||
else if (deviceController[parameters.deviceId] == this) {
|
||||
|
||||
//Attach callback
|
||||
dac.openStream(¶meters, NULL, RTAUDIO_FLOAT32, sampleRate, &nBufferFrames, &audioCallback, (void *)this, &opts);
|
||||
dac.startStream();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
//we are a bound thread, add ourselves to the controller deviceController[parameters.deviceId].
|
||||
//beware, we must take the controller mutex, because the audio callback may use the list of bounded
|
||||
//threads at that moment:
|
||||
@ -432,7 +436,8 @@ void AudioThread::setupDevice(int deviceId) {
|
||||
}
|
||||
active = true;
|
||||
|
||||
} catch (RtAudioError& e) {
|
||||
}
|
||||
catch (RtAudioError& e) {
|
||||
e.printMessage();
|
||||
return;
|
||||
}
|
||||
@ -461,7 +466,8 @@ void AudioThread::setInitOutputDevice(int deviceId, int sampleRate) {
|
||||
if (deviceSampleRate.find(parameters.deviceId) != deviceSampleRate.end()) {
|
||||
sampleRate = deviceSampleRate[deviceId];
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
deviceSampleRate[deviceId] = sampleRate;
|
||||
}
|
||||
this->sampleRate = sampleRate;
|
||||
@ -522,7 +528,8 @@ void AudioThread::run() {
|
||||
std::lock_guard<std::recursive_mutex> lock(deviceController[parameters.deviceId]->getMutex());
|
||||
|
||||
deviceController[parameters.deviceId]->removeThread(this);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// 'this' is a controller thread:
|
||||
try {
|
||||
if (dac.isStreamOpen()) {
|
||||
@ -531,7 +538,8 @@ void AudioThread::run() {
|
||||
}
|
||||
dac.closeStream();
|
||||
}
|
||||
} catch (RtAudioError& e) {
|
||||
}
|
||||
catch (RtAudioError& e) {
|
||||
e.printMessage();
|
||||
}
|
||||
}
|
||||
@ -571,7 +579,8 @@ void AudioThread::setActive(bool state) {
|
||||
|
||||
if (state && !active && inputQueue) {
|
||||
matchingControllerThread->bindThread(this);
|
||||
} else if (!state && active) {
|
||||
}
|
||||
else if (!state && active) {
|
||||
matchingControllerThread->removeThread(this);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user