DataTree refactoring, load/save functions almost ready

This commit is contained in:
Charles J. Cliffe
2015-01-09 20:56:43 -05:00
parent 7c68f142ed
commit faa87fcd10
4 changed files with 248 additions and 190 deletions
+15 -13
View File
@@ -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;
}