| 19 | namespace im = ImGui; |
| 20 | |
| 21 | SpectralTest::SpectralTest() |
| 22 | { |
| 23 | mSubTests = { |
| 24 | "sine", |
| 25 | "sine (no output)", |
| 26 | "sample", |
| 27 | }; |
| 28 | |
| 29 | auto ctx = audio::master(); |
| 30 | |
| 31 | auto format = audio::MonitorSpectralNode::Format().fftSize( FFT_SIZE ).windowSize( WINDOW_SIZE ).windowType( WINDOW_TYPE ); |
| 32 | mMonitorSpectralNode = ctx->makeNode( new audio::MonitorSpectralNode( format ) ); |
| 33 | mMonitorSpectralNode->setAutoEnabled(); |
| 34 | |
| 35 | mGen = ctx->makeNode( new audio::GenSineNode() ); |
| 36 | //mGen = ctx->makeNode( new audio::GenTriangleNode() ); |
| 37 | mGen->setFreq( 440.0f ); |
| 38 | |
| 39 | mSourceFile = audio::load( app::loadAsset( "tone440L220R.mp3" ), ctx->getSampleRate() ); |
| 40 | |
| 41 | mGain = ctx->makeNode( new audio::GainNode() ); |
| 42 | mGain->setValue( 0.6f ); |
| 43 | |
| 44 | auto audioBuffer = mSourceFile->loadBuffer(); |
| 45 | CI_LOG_V( "loaded source buffer, frames: " << audioBuffer->getNumFrames() ); |
| 46 | |
| 47 | mPlayerNode = ctx->makeNode( new audio::BufferPlayerNode( audioBuffer ) ); |
| 48 | |
| 49 | setupSubTest( "sine" ); |
| 50 | |
| 51 | CI_LOG_V( "MonitorSpectralNode fftSize: " << mMonitorSpectralNode->getFftSize() << ", windowSize: " << mMonitorSpectralNode->getWindowSize() ); |
| 52 | } |
| 53 | |
| 54 | void SpectralTest::setupSubTest( const string &testName ) |
| 55 | { |
nothing calls this directly
no test coverage detected