コード例 #1
0
//*************************************************************************
void BeatDetectorApp::NextFile()
{
	roto = 0;
	if(mTrack && mTrack->isPlaying())
	{
		mTrack->enablePcmBuffering(false);
		mTrack->stop();
	}

#ifdef WIN32
	time_t now;
	time(&now);
	int time_int = (int)now;
#else
	timeval now;
	gettimeofday(&now, NULL);
	int time_int = now.tv_sec;
#endif

	Rand r;
	r.seed(time_int);
	int rand_file = r.nextInt(m_FileList.size());
	path my_path = m_FileList[rand_file].path();
	m_CurrentFile = my_path.string();
	
	if(!write_frames)
	{
		mAudioSource = audio::load(m_CurrentFile);
		mTrack = audio::Output::addTrack(mAudioSource, false);
		mTrack->enablePcmBuffering(true);
		mTrack->play();		
	}
	//rot_inc = r.nextFloat(1.5f, 30.0f);
}
コード例 #2
0
// Set up
void KissFileSampleApp::setup()
{

	// Set up window
	setWindowSize(600, 600);

	// Set up OpenGL
	gl::enableAlphaBlending();
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	glEnable(GL_BLEND);
	glEnable(GL_LINE_SMOOTH);
	glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);

	// Set line color
	gl::color(Color(1, 1, 1));
	
	// Load and play audio
	mAudioSource = audio::load(loadResource(RES_SAMPLE));
	mTrack = audio::Output::addTrack(mAudioSource, false);
	mTrack->enablePcmBuffering(true);
	mTrack->play();

	// Set init flag
	mFftInit = false;

}
コード例 #3
0
// Called on exit
void KissFileSampleApp::quit() 
{

	// Stop track
	mTrack->enablePcmBuffering(false);
	mTrack->stop();

}
コード例 #4
0
void SoundScapingApp::setup() {
   setFullScreen(true);
    
    //add the audio track the default audio output
	//mTrack = audio::Output::addTrack( audio::load( loadResource( "../resources/drums.mp3", 129, "MP3" )));
    mTrack = audio::Output::addTrack( audio::load( loadResource( "../resources/MakeLight.m4a", 129, "M4A" )));
	
	//you must enable enable PCM buffering on the track to be able to call getPcmBuffer on it later
	mTrack->enablePcmBuffering( true );
    
    bandCount = 50;;
    cumlFFT = std::vector<float>(bandCount, 0.0f);

}
コード例 #5
0
void RoboticaProjectApp::setup()
{
    
    
    
    bandCount = 12;
    
    particleImg = new gl::Texture( loadImage( loadResource( RES_PARTICLE ) ) );
    
    //add the audio track the default audio output
	mTrack = audio::Output::addTrack( audio::load( loadResource( RES_WOLFGANG ) ) );
    mTrack.get()->setLooping(true);
    
    audio::Output::setVolume(2);
	//you must enable enable PCM buffering on the track to be able to call getPcmBuffer on it later
	mTrack->enablePcmBuffering( true );

    particleC = new ParticleController(getWindowSize(), bandCount);
    
}
コード例 #6
0
//*************************************************************************
void BeatDetectorApp::quit() 
{
	// Stop track
	mTrack->enablePcmBuffering(false);
	mTrack->stop();
}