| 160 | // ----------------------------------------------------------------------- |
| 161 | |
| 162 | void SpectralTest::updateUI() |
| 163 | { |
| 164 | if( mSpectrumPlot.getScaleDecibels() ) { |
| 165 | if( im::Button( "decibels scale" ) ) { |
| 166 | mSpectrumPlot.enableScaleDecibels( false ); |
| 167 | } |
| 168 | } |
| 169 | else { |
| 170 | if( im::Button( "linear scale" ) ) { |
| 171 | mSpectrumPlot.enableScaleDecibels( true ); |
| 172 | } |
| 173 | } |
| 174 | im::SameLine(); |
| 175 | im::Text( "Spectral centroid: %0.3f", mMonitorSpectralNode->getSpectralCentroid() ); |
| 176 | |
| 177 | float gain = mGain->getValue(); |
| 178 | if( im::SliderFloat( "gain", &gain, 0, 1 ) ) { |
| 179 | mGain->getParam()->applyRamp( gain, 0.3f ); |
| 180 | } |
| 181 | float smoothing = mMonitorSpectralNode->getSmoothingFactor(); |
| 182 | if( im::SliderFloat( "spectral smoothing", &smoothing, 0, 1 ) ) { |
| 183 | mMonitorSpectralNode->setSmoothingFactor( smoothing ); |
| 184 | } |
| 185 | |
| 186 | im::Checkbox( "playing", &mPlaybackEnabled ); |
| 187 | |
| 188 | im::Separator(); |
| 189 | |
| 190 | if( mSubTests[mCurrentSubTest] == "sample" ) { |
| 191 | mPlayerNode->setEnabled( mPlaybackEnabled ); |
| 192 | im::Text( "Sample" ); |
| 193 | bool loopEnabled = mPlayerNode->isLoopEnabled(); |
| 194 | if( im::Checkbox( "loop", &loopEnabled ) ) { |
| 195 | mPlayerNode->setLoopEnabled( loopEnabled ); |
| 196 | } |
| 197 | im::SameLine(); |
| 198 | if( im::Button( "reset" ) ) { |
| 199 | mPlayerNode->seek( 0 ); |
| 200 | } |
| 201 | |
| 202 | float readPos = (float)mPlayerNode->getReadPositionTime(); |
| 203 | if( im::SliderFloat( "read pos (s)", &readPos, 0, mPlayerNode->getNumSeconds() ) ) { |
| 204 | mPlayerNode->seekToTime( readPos ); |
| 205 | } |
| 206 | |
| 207 | } |
| 208 | else { |
| 209 | mGen->setEnabled( mPlaybackEnabled ); |
| 210 | im::Text( "Gen" ); |
| 211 | float genFreq = mGen->getFreq(); |
| 212 | if( im::SliderFloat( "Gen Freqency", &genFreq, -200, 1200 ) ) { |
| 213 | mGen->getParamFreq()->applyRamp( genFreq, 0.05f ); |
| 214 | } |
| 215 | } |
| 216 | |
| 217 | |
| 218 | im::Separator(); |
| 219 | if( im::ListBox( "sub-tests", &mCurrentSubTest, mSubTests, mSubTests.size() ) ) { |
nothing calls this directly
no test coverage detected