Example #1
0
void SamplePlayerNodeTestApp::setup()
{
	mUnderrunFade = mOverrunFade = mRecorderOverrunFade = 0;
	mSamplePlayerNodeEnabledState = false;

	printSupportedExtensions();

	setSourceFile( loadResource( INITIAL_AUDIO_RES ) );

	auto ctx = audio::master();

	mPan = ctx->makeNode( new audio::Pan2dNode() );
//	mPan->setStereoInputModeEnabled( false );

	mGain = ctx->makeNode( new audio::GainNode() );
	mGain->setValue( 0.6f );

	mGain >> mPan >> ctx->getOutput();

	setupBufferPlayerNode();
//	setupFilePlayerNode();

	setupUI();

	ctx->enable();
	mEnableSamplePlayerNodeButton.setEnabled( true );

	CI_LOG_V( "context samplerate: " << ctx->getSampleRate() );
}
Example #2
0
void DeviceTestApp::setup()
{
    console() << audio::Device::printDevicesToString();

    auto ctx = audio::master();

    mMonitor = ctx->makeNode( new audio::MonitorNode( audio::MonitorNode::Format().windowSize( 1024 ) ) );
    mGain = ctx->makeNode( new audio::GainNode() );
    mGain->setValue( 0.4f );

    mGain->connect( mMonitor );

    setOutputDevice( audio::Device::getDefaultOutput() );
    setInputDevice( audio::Device::getDefaultInput() );
    //setInputDevice( audio::Device::getDefaultInput(), 1 ); // force mono input

    //setupMultiChannelDevice( "PreSonus FIREPOD (1431)" );
//	setupMultiChannelDeviceWindows( "MOTU Analog (MOTU Audio Wave for 64 bit)" );

    mRecorder = ctx->makeNode( new audio::BufferRecorderNode( RECORD_SECONDS * ctx->getSampleRate() ) );
    mRecorder->setEnabled( false );
    mGain >> mRecorder;


//	setupInputPulled();
//	setupIOClean();

    PRINT_GRAPH( ctx );

    setupUI();

    CI_LOG_V( "Context samplerate: " << ctx->getSampleRate() );
}
Example #3
0
void ParamTestApp::setup()
{
	auto ctx = audio::master();
	mGain = ctx->makeNode( new audio::GainNode() );
	mGain->setValue( 0.8f );

	mPan = ctx->makeNode( new audio::Pan2dNode() );

	mGen = ctx->makeNode( new audio::GenSineNode() );
//	mGen = ctx->makeNode( new audio::GenTriangleNode() );
//	mGen = ctx->makeNode( new audio::GenPhasorNode() );
	mGen = ctx->makeNode( new audio::GenPulseNode );

	mGen->setFreq( 220 );

	mLowPass = ctx->makeNode( new audio::FilterLowPassNode() );

	setupBasic();

	setupUI();

	PRINT_GRAPH( ctx );

	testApply();
//	testApply2();
//	connectProcessor();
}
Example #4
0
void SamplePlayerNodeTestApp::processDrag( Vec2i pos )
{
	if( mGainSlider.hitTest( pos ) )
		mGain->setValue( mGainSlider.mValueScaled );
	else if( mPanSlider.hitTest( pos ) )
		mPan->setPos( mPanSlider.mValueScaled );
	else if( mLoopBeginSlider.hitTest( pos ) )
		mSamplePlayerNode->setLoopBeginTime( mLoopBeginSlider.mValueScaled );
	else if( mLoopEndSlider.hitTest( pos ) )
		mSamplePlayerNode->setLoopEndTime( mLoopEndSlider.mValueScaled );
	else if( pos.y > getWindowCenter().y )
		seek( pos.x );
}
Example #5
0
void WebAudioApp::setup()
{

  Context::setMaster( new ContextWebAudio, new DeviceManagerWebAudio );

  auto ctx = audio::master();
  mGen = ctx->makeNode( new audio::GenSineNode );
  mGain = ctx->makeNode( new audio::GainNode );

  mGen->setFreq( 220 );
  mGain->setValue( 0.5f );

  // connections can be made this way or with connect(). The master Context's getOutput() is the speakers by default.
  mGen >> mGain >> ctx->getOutput();
  mGen->enable();
  ctx->enable();
}
Example #6
0
void NodeBasic::setup()
{
	// You use the audio::Context to make new audio::Node instances (audio::master() is the speaker-facing Context).
	auto ctx = audio::master();
	mGen = ctx->makeNode( new audio::GenSineNode );
	mGain = ctx->makeNode( new audio::GainNode );

	mGen->setFreq( 220 );
	mGain->setValue( 0.5f );

	// connections can be made this way or with connect(). The master Context's getOutput() is the speakers by default.
	mGen >> mGain >> ctx->getOutput();

	// Node's need to be enabled to process audio. EffectNode's are enabled by default, while NodeSource's (like Gen) need to be switched on.
	mGen->enable();

	// Context also must be started. Starting and stopping this controls the entire DSP graph.
	ctx->enable();
}
Example #7
0
void SamplePlayerNodeTestApp::processDrag( ivec2 pos )
{
	if( mGainSlider.hitTest( pos ) )
		mGain->setValue( mGainSlider.mValueScaled );
	else if( mPanSlider.hitTest( pos ) ) {
#if TEST_STEREO_INPUT_PANNING
		mPan->getParamPos()->applyRamp( mPanSlider.mValueScaled, 0.6f );
#else
		mPan->setPos( mPanSlider.mValueScaled );
#endif
	}
	else if( mLoopBeginSlider.hitTest( pos ) )
		mSamplePlayerNode->setLoopBeginTime( mLoopBeginSlider.mValueScaled );
	else if( mLoopEndSlider.hitTest( pos ) )
		mSamplePlayerNode->setLoopEndTime( mLoopEndSlider.mValueScaled );
	else if( mTriggerDelaySlider.hitTest( pos ) ) {
	}
	else if( pos.y > getWindowCenter().y )
		seek( pos.x );
}
void NodeEffectsTestApp::makeNodes()
{
	auto ctx = audio::master();

	mGain = ctx->makeNode( new audio::GainNode );
	mGain->setValue( 0.25f );

	mPan = ctx->makeNode( new audio::Pan2dNode );

	CI_LOG_V( "gen button enabled: " << mGenButton.mEnabled );
	auto genFmt = audio::Node::Format().autoEnable();
	if( mGenButton.mEnabled )
		mGen = ctx->makeNode( new audio::GenSineNode( 220, genFmt ) );
	else
		mGen = ctx->makeNode( new audio::GenNoiseNode( genFmt ) );

	mLowPass = ctx->makeNode( new audio::FilterLowPassNode() );
	mLowPass->setCutoffFreq( 400 );
//	mLowPass = ctx->makeNode( new audio::FilterHighPassNode() );

	mDelay = ctx->makeNode( new audio::DelayNode );
	mDelay->setDelaySeconds( 0.5f );
//	mDelay->setDelaySeconds( 100.0f / (float)ctx->getSampleRate() );
}
Example #9
0
void NodeBasic::mouseDrag( MouseEvent event )
{
	mGen->setFreq( event.getPos().x );
	mGain->setValue( 1.0f - (float)event.getPos().y / (float)getWindowHeight() );
}