示例#1
0
void DeviceTestApp::setupNoise()
{
    mGen = audio::master()->makeNode( new audio::GenNoiseNode() );

    mGen->connect( mGain );
    mGen->enable();
}
示例#2
0
void DeviceTestApp::setupSine()
{
    mGen = audio::master()->makeNode( new audio::GenSineNode() );
    mGen->setFreq( 440 );

    mGen->connect( mGain );
    mGen->enable();
}
示例#3
0
void DeviceTestApp::setupSendStereo()
{
    auto ctx = audio::master();
    ctx->disconnectAllNodes();

    auto router = ctx->makeNode( new audio::ChannelRouterNode( audio::Node::Format().channels( mOutputDeviceNode->getNumChannels()	) ) );
    auto upmix = ctx->makeNode( new audio::Node( audio::Node::Format().channels( 2 ) ) );

    int channelIndex = mSendChannelInput.getValue();
    CI_LOG_V( "routing input to channel: " << channelIndex );

    mGen >> upmix >> mGain >> router->route( 0, channelIndex );
    router >> mMonitor >> ctx->getOutput();

    mGen->enable();
}
示例#4
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();
}
示例#5
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();
}
void NodeSubclassingApp::setup()
{
	auto ctx = audio::master();

	// We create an audio graph that demonstrates the CustomTremeloNode bing used in combination with cinder-defined Node's.
	mGenNode = ctx->makeNode( new audio::GenOscNode( audio::WaveformType::SQUARE, 220 ) );
	mMonitorNode = ctx->makeNode( new audio::MonitorNode );
	auto gain = ctx->makeNode( new audio::GainNode( 0.2f ) );

	// Here we make our custom Node. For the sake of demonstration, its channel count is forced to stereo.
	mCustomTremeloNode = ctx->makeNode( new CustomTremoloNode( audio::Node::Format().channels( 2 ) ) );

	mGenNode >> mCustomTremeloNode >> mMonitorNode >> gain >> ctx->getOutput();

	// Turn on the GenNode and fire up the Context.
	mGenNode->enable();
	ctx->enable();

	console() << "\naudio graph:\n" << ctx->printGraphToString() << endl;
}