예제 #1
0
//--------------------------------------------------------------
void ofApp::keyPressed  (int key){
    switch(key){
        case OF_KEY_LEFT:
            updateAudio(-1);
            break;
        case OF_KEY_RIGHT:
            updateAudio(1);
            break;
    }
}
예제 #2
0
void AudioPlayer::notify(OEComponent *sender, int notification, void *data)
{
    if (notification == AUDIO_BUFFER_WILL_RENDER)
    {
        audioBuffer = (AudioBuffer *) data;
        audioBufferFrame = 0;
    }
    else
        updateAudio(true);
}
예제 #3
0
void audioHook() // 2us excluding updateAudio()
{
//setPin13High();
#if (USE_AUDIO_INPUT==true)
		if (!input_buffer.isEmpty()) 
			audio_input = input_buffer.read();
#endif

	if (!output_buffer.isFull()) {
		#if (STEREO_HACK == true)
		updateAudio(); // in hacked version, this returns void
		output_buffer.write((unsigned int) (audio_out_1 + AUDIO_BIAS));
		output_buffer2.write((unsigned int) (audio_out_2 + AUDIO_BIAS));
		#else
		output_buffer.write((unsigned int) (updateAudio() + AUDIO_BIAS));
		#endif

	}
//setPin13Low();
}
void ControllerFallingMode::updateNote(float dt)
{
	updateAudio();
	setCurTime(dt);
	moveNotesInField();
	setTopTime();
	drawNewNotes();
	//resizeLongNotes();
	removeOldNotes();
	autoPlay();
}
예제 #5
0
void audioHook() // 2us excluding updateAudio()
{
//setPin13High();
#if (USE_AUDIO_INPUT==true)
		if (!input_buffer.isEmpty()) 
			audio_input = input_buffer.read();
#endif

	if (!output_buffer.isFull()) {
		output_buffer.write((unsigned int) (updateAudio() + AUDIO_BIAS));

	}
//setPin13Low();
}
예제 #6
0
bool AudioPlayer::postMessage(OEComponent *sender, int message, void *data)
{
    updateAudio(false);
    
    switch (message)
    {
        case AUDIOPLAYER_PLAY:
            playing = true;
            
            break;
            
        case AUDIOPLAYER_PAUSE:
            playing = false;
            
            break;
            
        case AUDIOPLAYER_STOP:
            frameIndex = 0;
            playing = false;
            
            src_reset(srcState);
            
            break;
            
        case AUDIOPLAYER_SET_SOUND:
            sound = (OESound *)data;
            
            return true;
            
        case AUDIOPLAYER_SET_LOOP:
            loop = *((bool *)data);
            
            return true;
            
        case AUDIOPLAYER_SET_VOLUME:
            volume = *((float *)data);
            
            return true;
            
        case AUDIOPLAYER_IS_PLAYING:
            *((bool *)data) = playing;
            
            return true;
    }
    
    return false;
}
예제 #7
0
파일: ofApp.cpp 프로젝트: GoofyGoober/words
//--------------------------------------------------------------
void ofApp::update(){
  blur.setRotation(PI);
  updateAudio();
  if(ofGetFrameRate() < limitFramerate)
    words.frameRateTooLow();

  if(!screamForClean)
    blurValue = scaledVol * blurMultiplier;
  else
  {
    if(scaledVol < scaledVolumeLimitScremForClean)
    {
      blurValue += speedDisappear;;
    }
    else
    {
      blurValue -= .1;
    }
  }
  blurValue = ofClamp(blurValue, 0, 5);
  blur.setScale(blurValue);
}
예제 #8
0
bool CMusicRoomHandler::update() {
	uint currentTicks =  g_system->getMillis();

	if (!_startTicks) {
		start();
		_startTicks = currentTicks;
	} else if (!_soundStartTicks && currentTicks >= (_startTicks + 3000)) {
		if (_waveFile) {
			CProximity prox;
			prox._channelVolume = _volume;
			_soundHandle = _soundManager->playSound(*_waveFile, prox);
		}

		_soundStartTicks = currentTicks;
	}

	if (_instrumentsActive > 0) {
		updateAudio();
		updateInstruments();
	}

	return !_audioBuffer->isFinished();
}
예제 #9
0
void GameStateConfigBase::update() {
	updateAudio();
	updateInterface();
	updateMods();
}
예제 #10
0
//--------------------------------------------------------------
void GrafPlayerApp::update(){

	dt  = ofGetElapsedTimef()-lastTime;
	lastTime  = ofGetElapsedTimef();
	
	
	bool bTrans = false;
	
	if( mode == PLAY_MODE_LOAD )
	{
		loadTags();
		if(bUseAudio)audio.update();
	}
	else if( mode == PLAY_MODE_PLAY && tags.size() > 0 )
	{
		
		//---- set drawing data for render
		if( drawer.bSetupDrawer )
			drawer.setup( &tags[currentTagID], tags[currentTagID].distMax );

		//---- update tag playing state
		if( !myTagPlayer.bDonePlaying )					
		{
			myTagPlayer.update(&tags[currentTagID]);	// normal play, update tag
		
		}else if( !myTagPlayer.bPaused && myTagPlayer.bDonePlaying && waitTimer > 0)			   
		{
			waitTimer -= dt;	// pause time after drawn, before fades out
		}
		else if ( !myTagPlayer.bPaused && myTagPlayer.bDonePlaying && (drawer.alpha > 0 || particleDrawer.alpha > 0))			  		
		{
			updateTransition(0);
			bTrans = true;
		}
		else if (  !myTagPlayer.bPaused && myTagPlayer.bDonePlaying )							
		{
			resetPlayer(1);	// setup for next tag
		}
	
		
		//---------- AUDIO applied
		if( bUseAudio) updateAudio();
		
		
		//--------- ARCHITECTURE
		if( bUseArchitecture ) updateArchitecture();
		
		
		//--------- PARTICLES
		updateParticles();
			
		
		//--------- TAG ROTATION + POSITION
		if(bRotating && !myTagPlayer.bPaused ) rotationY += panel.getValueF("ROT_SPEED")*dt;
		
		// update pos / vel
		tags[currentTagID].position.x += tagPosVel.x;
		tags[currentTagID].position.y += tagPosVel.y;
		
		tagPosVel.x -= .1*tagPosVel.x;
		tagPosVel.y -= .1*tagPosVel.y;
		
		if(!bTrans)
		{
		tags[currentTagID].rotation_o = tags[currentTagID].rotation;
		tags[currentTagID].position_o = tags[currentTagID].position;
		}

	}
	
	
	
	// controls
	if( bShowPanel ) updateControlPanel();
	
	
}
예제 #11
0
void Agent::tick() {
	// sanity checks to stop ticks on dead agents
	LifeAssert la(this);
	if (dying) return;
	
	if (sound) {
		// if the sound is no longer playing...
		if (sound->getState() != SS_PLAY) {
			// ...release our reference to it
			sound.reset();
		} else {
			// otherwise, reposition audio
			updateAudio(sound);
		}
	}

	// don't tick paused agents
	if (paused) return;

	// CA updates
	if (emitca_index != -1 && emitca_amount != 0.0f) {
		assert(0 <= emitca_index && emitca_index <= 19);
		shared_ptr<Room> r = world.map.roomAt(x, y);
		if (r) {
			r->catemp[emitca_index] += emitca_amount;
			/*if (r->catemp[emitca_index] <= 0.0f) r->catemp[emitca_index] = 0.0f;
			else if (r->catemp[emitca_index] >= 1.0f) r->catemp[emitca_index] = 1.0f;*/
		}
	}

	// TODO: this might be in the wrong place - note that parts are ticked *before* Agent::tick is called
	if (rotatable() && spritesperrotation != 0 && numberrotations > 1) {
		SpritePart *p = dynamic_cast<SpritePart *>(part(0));
		if (p) {
			// change base according to our SPIN and the ROTN settings
			unsigned int rotation = 0;
			rotation = (spin - (0.5f / numberrotations)) * numberrotations; // TODO: verify correctness
			p->setBase(spritesperrotation * rotation);
		}
	}

	// tick the physics engine
	physicsTick();
	if (dying) return; // in case we were autokilled

	// update the timer if needed, and then queue a timer event if necessary
	if (timerrate) {
		tickssincelasttimer++;
		if (tickssincelasttimer == timerrate) {
			queueScript(9); // TODO: include this?
			tickssincelasttimer = 0;
		}
		assert(timerrate > tickssincelasttimer);
	}

	// tick the agent VM
	if (vm) vmTick();

	// some silly hack to handle delayed voices
	tickVoices();
}
예제 #12
0
파일: Blobs02.cpp 프로젝트: MrMdR/julapy
void Blobs02 :: update()
{
	updateAudio();
	updateBox2d();
}