void AudioComponent::beginCallbacks() { restartDevice(); std::cout << std::endl << "Adding audio callback." << std::endl; deviceManager.addAudioCallback(graphPlayer); isPlaying = true; }
void AudioComponent::beginCallbacks() { if (!isPlaying) { //const MessageManagerLock mmLock; // MessageManagerLock mml (Thread::getCurrentThread()); // if (mml.lockWasGained()) // { // std::cout << "AUDIO COMPONENT GOT THAT LOCK!" << std::endl; // } else { // std::cout << "AUDIO COMPONENT COULDN'T GET THE LOCK...RETURNING." << std::endl; // return; // } // MessageManager* mm = MessageManager::getInstance(); // if (mm->isThisTheMessageThread()) // std::cout << "THIS IS THE MESSAGE THREAD -- AUDIO COMPONENT" << std::endl; // else // std::cout << "NOT THE MESSAGE THREAD -- AUDIO COMPONENT" << std::endl; restartDevice(); int64 ms = Time::getCurrentTime().toMilliseconds(); while (Time::getCurrentTime().toMilliseconds() - ms < 100) { // pause to let things finish up } std::cout << std::endl << "Adding audio callback." << std::endl; deviceManager.addAudioCallback(graphPlayer); isPlaying = true; } else { std::cout << "beginCallbacks was called while acquisition was active." << std::endl; } //int64 ms = Time::getCurrentTime().toMilliseconds(); //while(Time::getCurrentTime().toMilliseconds() - ms < 100) //{ // pause to let things finish up // } }