mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2026-06-02 06:04:39 -04:00
DataTree refactoring, load/save functions almost ready
This commit is contained in:
+15
-13
@@ -10,8 +10,8 @@ std::map<int, std::thread *> AudioThread::deviceThread;
|
||||
#endif
|
||||
|
||||
AudioThread::AudioThread(AudioThreadInputQueue *inputQueue, DemodulatorThreadCommandQueue* threadQueueNotify) :
|
||||
currentInput(NULL), inputQueue(inputQueue), audioQueuePtr(0), underflowCount(0), terminated(false), active(false), outputDevice(-1), gain(1.0), threadQueueNotify(
|
||||
threadQueueNotify) {
|
||||
currentInput(NULL), inputQueue(inputQueue), audioQueuePtr(0), underflowCount(0), terminated(false), active(false), outputDevice(-1), gain(
|
||||
1.0), threadQueueNotify(threadQueueNotify) {
|
||||
#ifdef __APPLE__
|
||||
boundThreads = new std::vector<AudioThread *>;
|
||||
#endif
|
||||
@@ -368,7 +368,7 @@ void AudioThread::threadMain() {
|
||||
return;
|
||||
}
|
||||
|
||||
setupDevice((outputDevice.load() == -1)?(dac.getDefaultOutputDevice()):outputDevice.load());
|
||||
setupDevice((outputDevice.load() == -1) ? (dac.getDefaultOutputDevice()) : outputDevice.load());
|
||||
|
||||
std::cout << "Audio thread started." << std::endl;
|
||||
|
||||
@@ -391,24 +391,27 @@ void AudioThread::threadMain() {
|
||||
deviceController[parameters.deviceId]->removeThread(this);
|
||||
} else {
|
||||
try {
|
||||
dac.stopStream();
|
||||
dac.closeStream();
|
||||
if (dac.isStreamOpen()) {
|
||||
if (dac.isStreamRunning()) {
|
||||
dac.stopStream();
|
||||
}
|
||||
dac.closeStream();
|
||||
}
|
||||
} catch (RtAudioError& e) {
|
||||
e.printMessage();
|
||||
}
|
||||
}
|
||||
#else
|
||||
try {
|
||||
// Stop the stream
|
||||
dac.stopStream();
|
||||
dac.closeStream();
|
||||
if (dac.isStreamOpen()) {
|
||||
if (dac.isStreamRunning()) {
|
||||
dac.stopStream();
|
||||
}
|
||||
dac.closeStream();
|
||||
}
|
||||
} catch (RtAudioError& e) {
|
||||
e.printMessage();
|
||||
}
|
||||
|
||||
if (dac.isStreamOpen()) {
|
||||
dac.closeStream();
|
||||
}
|
||||
#endif
|
||||
|
||||
std::cout << "Audio thread done." << std::endl;
|
||||
@@ -454,7 +457,6 @@ void AudioThread::setActive(bool state) {
|
||||
active = state;
|
||||
}
|
||||
|
||||
|
||||
AudioThreadCommandQueue *AudioThread::getCommandQueue() {
|
||||
return &cmdQueue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user