| 109 | } |
| 110 | |
| 111 | void SamplePlayerTest::setupFilePlayerNode() |
| 112 | { |
| 113 | bool loopEnabled = mSamplePlayerNode ? mSamplePlayerNode->isLoopEnabled() : false; |
| 114 | double loopBegin = mSamplePlayerNode ? mSamplePlayerNode->getLoopBeginTime() : 0.0; |
| 115 | double loopEnd = mSamplePlayerNode ? mSamplePlayerNode->getLoopEndTime() : 0.0; |
| 116 | |
| 117 | mGain->disconnectAllInputs(); |
| 118 | |
| 119 | auto ctx = audio::master(); |
| 120 | |
| 121 | // mSourceFile->setMaxFramesPerRead( 8192 ); |
| 122 | mSamplePlayerNode = ctx->makeNode( new audio::FilePlayerNode( mSourceFile->clone(), mLoadAsync ) ); |
| 123 | |
| 124 | // TODO: it is pretty surprising when you recreate mMonitor here without checking if there has already been one added. |
| 125 | // - user will no longer see the old mMonitor, but the context still owns a reference to it, so another gets added each time we call this method. |
| 126 | if( ! mMonitor ) |
| 127 | mMonitor = ctx->makeNode( new audio::MonitorNode( audio::MonitorNode::Format().windowSize( 1024 ) ) ); |
| 128 | |
| 129 | // when these connections are called, some (GainNode and Pan) will already be connected, but this is okay, they should silently no-op. |
| 130 | |
| 131 | // or connect in series (it is added to the Context's 'auto pulled list') |
| 132 | mSamplePlayerNode >> mGain >> mPan >> ctx->getOutput(); |
| 133 | mPan >> mMonitor; |
| 134 | |
| 135 | mSamplePlayerNode->setLoopEnabled( loopEnabled ); |
| 136 | mSamplePlayerNode->setLoopBeginTime( loopBegin ); |
| 137 | mSamplePlayerNode->setLoopEndTime( loopEnd ); |
| 138 | } |
| 139 | |
| 140 | void SamplePlayerTest::setupBufferRecorderNode() |
| 141 | { |
nothing calls this directly
no test coverage detected