| 71 | } |
| 72 | |
| 73 | void SamplePlayerTest::setupBufferPlayerNode() |
| 74 | { |
| 75 | auto bufferPlayer = audio::master()->makeNode( new audio::BufferPlayerNode() ); |
| 76 | |
| 77 | auto loadFn = [bufferPlayer, this] { |
| 78 | bufferPlayer->loadBuffer( mSourceFile->clone() ); |
| 79 | CI_LOG_I( "loaded source buffer, frames: " << bufferPlayer->getBuffer()->getNumFrames() ); |
| 80 | }; |
| 81 | |
| 82 | auto connectFn = [bufferPlayer, this] { |
| 83 | bool loopEnabled = mSamplePlayerNode ? mSamplePlayerNode->isLoopEnabled() : false; |
| 84 | |
| 85 | mGain->disconnectAllInputs(); |
| 86 | mSamplePlayerNode = bufferPlayer; |
| 87 | mSamplePlayerNode >> mGain >> mPan >> audio::master()->getOutput(); |
| 88 | |
| 89 | mSamplePlayerNode->setLoopEnabled( loopEnabled ); |
| 90 | mSamplePlayerNode->setLoopBeginTime( 0 ); |
| 91 | mSamplePlayerNode->setLoopEndTime( mSamplePlayerNode->getNumSeconds() ); |
| 92 | }; |
| 93 | |
| 94 | if( mLoadAsync ) { |
| 95 | mWaveformPlot.clear(); |
| 96 | mAsyncLoadFuture = std::async( [=] { |
| 97 | loadFn(); |
| 98 | app::App::get()->dispatchAsync( [=] { |
| 99 | mWaveformPlot.load( bufferPlayer->getBuffer(), app::getWindowBounds() ); |
| 100 | connectFn(); |
| 101 | } ); |
| 102 | } ); |
| 103 | } |
| 104 | else { |
| 105 | loadFn(); |
| 106 | mWaveformPlot.load( bufferPlayer->getBuffer(), app::getWindowBounds() ); |
| 107 | connectFn(); |
| 108 | }; |
| 109 | } |
| 110 | |
| 111 | void SamplePlayerTest::setupFilePlayerNode() |
| 112 | { |
nothing calls this directly
no test coverage detected