Ejemplo n.º 1
0
void LightingPresets::Reset() {
	wxRadioButton* presetsOffButton =
		dynamic_cast<wxRadioButton*>(wxWindow::FindWindowById(ID_PRESETS_OFF, this));
	wxCHECK_RET( presetsOffButton != NULL, _T("Unable to find lighting presets off radio button"));
	presetsOffButton->SetValue(true);
	
	wxCommandEvent resetEvent(wxEVT_COMMAND_RADIOBUTTON_SELECTED, ID_PRESETS_OFF);
	this->OnSelectLightingPreset(resetEvent);
}
Ejemplo n.º 2
0
void CDoorPanel::Reset( const bool bEnteringGameMode )
{
	m_fLastVisibleDistanceCheckTime = 0.0f;
	m_bHasDelayedStateEvent = false;

	SDoorPanelResetEvent resetEvent( bEnteringGameMode );
	StateMachineHandleEventBehavior( resetEvent );

	SetStateById( GetInitialBehaviorStateId() );
}
Ejemplo n.º 3
0
void VoxPlayer::stop()
{
    resetEvent();

    if(Thread::isRunning())
    {
        if(g_main.isExit())
            Thread::kill(SIGHUP);

        Thread::stop(true);
    }
}
Ejemplo n.º 4
0
//-----------------------------------------------------------------------------
void LLFFTSound::stopSound()
{
	if(!m_bInitialized || !m_bPlaying)
		return;

#ifdef _WINDOWS
	BASS_ChannelStop(m_dChannel);
#endif
	m_bPlaying = false;

	// reset events queue
	resetEvent();
}
Ejemplo n.º 5
0
VkResult Event::reset()
{
    return resetEvent();
}
Ejemplo n.º 6
0
void EventObjWrapper::resetEventWrapper(void)
{
	resetEvent(*eventObj);
}
Ejemplo n.º 7
0
PINOperationEventImpl::~PINOperationEventImpl(void)
{
	resetEvent(true);
}
Ejemplo n.º 8
0
//-----------------------------------------------------------------------------
void LLFFTSound::update(float addedTime)
{
	if(!m_bInitialized || !m_bPlaying)
		return;

#ifdef _WINDOWS
	
	// update current waveform level
#if BASSVERSION == 0x204
	DWORD pos = BASS_ChannelGetPosition(m_dChannel, BASS_POS_BYTE);
	if (pos == BASS_ChannelGetLength(m_dChannel, BASS_POS_BYTE))
#else
	DWORD pos = BASS_ChannelGetPosition(m_dChannel);
	if (pos == BASS_ChannelGetLength(m_dChannel))
#endif
	{
		m_fCurrLevelLeft = 0.0f;
		m_fCurrLevelRight = 0.0f;
		m_bPlaying = false;
		BASS_ChannelStop(m_dChannel);
		// reset bands values
		for (int i=0; i< BANDS; i++)
			m_fBands[i] = 0.0f;

		// reset events queue
		resetEvent();
	}
	else
	{
		// update lever for each channel
		DWORD level = BASS_ChannelGetLevel(m_dChannel);
		m_fCurrLevelLeft = ((double)LOWORD(level) / 32768);		// range 0 to 1: left channel is low word
		m_fCurrLevelRight = ((double)HIWORD(level) / 32768);	// range 0 to 1: right channel is high word

		// update band spectrum
		float fft[1024];
		BASS_ChannelGetData(m_dChannel,fft,BASS_DATA_FFT2048); // get the FFT data

		int b0=0;
		int x,y;
#define FFTCAP 256.0f

		for (x=0; x<BANDS; x++) {
			float sum=0;
			int sc,b1 = pow(2,x*10.0/(BANDS-1));
			if (b1>1023) b1=1023;
			if (b1<=b0) b1=b0+1; // make sure it uses at least 1 FFT bin
			sc = 10 + b1 - b0;
			
			for (;b0<b1;b0++) sum+=fft[1+b0];
			
			y=(sqrt(sum/log10((double)sc))*1.7*FFTCAP)-4; // scale it
			
			if (y>FFTCAP) y=FFTCAP; // cap it
			
			// store band value
			m_fBands[x] = y;	
			m_fBands[x] /= FFTCAP;	// normalized band value (0.0 - 1.0)
		}

		// check event associated with this sound file: use pos variable to detect timing...
		float elapsedTime = BASS_ChannelBytes2Seconds(m_dChannel,pos); 

		if (m_iNumEvents && !m_bEventDone)
		{
			if (elapsedTime > 0.0f)
			{
				// there is possibility that multiple events have the same timestamp...
				// should do some kind of iteration.
				bool running = true;
				while(running)
				{
					if (m_fNextEventTime < elapsedTime)
					{
						// execute callback function
						i_CharacterEventCallback.execute(m_vEventVec[m_iNextEvent]);

						// move to next event
						m_iNextEvent++;
						if (m_iNextEvent == m_iNumEvents)
						{
							// reached the last event
							m_iNextEvent = 0;
							m_bEventDone = true;
							running = false;
						}
						m_fNextEventTime = m_vEventVec[m_iNextEvent]->eTime;

					}
					else
						running = false;
				}
			}
		}


	}
#endif
}
/**
*
* DoTestStepL
* This method tests the controllers reset function
*
*/
TVerdict CTestStepResetController::DoTestStepL( void )
	{
	__MM_HEAP_MARK;
	
	TVerdict result = EPass;
	
	_LIT( KTestPlay, "Reset Test");
	Log( KTestPlay );
	
	_LIT( KTestStepReset, "This test checks a controller reset");
	Log( KTestStepReset );
	
	// [ audio file to play ]
	_LIT(KTestWavFile, "newmail.wav");
	SetReadFileNameL( KTestWavFile );
	
   	TInt errorCode = iController.Open(KUidCustomTestAudioPlugin, iPriority);
	User::LeaveIfError( errorCode );
	
	//[ok lets reset the controller from it initial state]
	errorCode = iController.Reset();
	User::LeaveIfError( errorCode );
	//[ search for reset event ]
	TMMFEvent resetEvent( KResetTestId, KErrNone);
	result = SearchForEvent( resetEvent );
	if( result == EFail )
		{
		return result;
		}
	
	//[ lets try a second reset ]
	errorCode = iController.Reset();
	User::LeaveIfError( errorCode );
	//[ search for reset event ]
	result = SearchForEvent( resetEvent );
	if( result == EFail )
		{
		return result;
		}
	
	//[ add data source and sink and prime the controller ]
    errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig());
	User::LeaveIfError( errorCode );
	
	errorCode =	iController.AddDataSink(KUidMmfAudioOutput, KNullDesC8);
    User::LeaveIfError( errorCode );
	
	//[ok lets reset the controller from it initial state]
	errorCode = iController.Reset();
	User::LeaveIfError( errorCode );
	
	//[ search for reset event ]
	result = SearchForEvent( resetEvent );
	if( result == EFail )
		{
		return result;
		}
	
	//[ lets try a second reset ]
	errorCode = iController.Reset();
	User::LeaveIfError( errorCode );
	//[ search for reset event ]
	result = SearchForEvent( resetEvent );
	if( result == EFail )
		{
		return result;
		}

	//[ add data source and sink and prime the controller ]
    errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig());
	User::LeaveIfError( errorCode );
	
	errorCode =	iController.AddDataSink(KUidMmfAudioOutput, KNullDesC8);
    User::LeaveIfError( errorCode );
	
	errorCode =	iController.Prime();
	User::LeaveIfError( errorCode );
	
	// [ wait for and process the return event from the audio output ]
	TMMFEvent primeEvent( KPrimeTestId, KErrNone);
	result = SearchForEvent( primeEvent );
	if( result == EFail )
		{
		return result;
		}
	
	//[ lets reset again in the primed state ]
	errorCode = iController.Reset();
	User::LeaveIfError( errorCode );
	
	//[ search for reset event ]
	result = SearchForEvent( resetEvent );
	if( result == EFail )
		{
		return result;
		}
	
	// [ get back to primed state ]
	//[ add data source and sink and prime the controller ]
    errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig());
	User::LeaveIfError( errorCode );
	
	errorCode =	iController.AddDataSink(KUidMmfAudioOutput, KNullDesC8);
    User::LeaveIfError( errorCode );
	
	errorCode =	iController.Prime();
	User::LeaveIfError( errorCode );
	result = SearchForEvent( primeEvent );
	if( result == EFail )
		{
		return result;
		}

    User::LeaveIfError( iController.Play() );
	
	// note this test does not wait around 
	// to detect that the audio has been played
	// [ now process the confirmation event that play has reached audio output
	//   this is the raison detre of the test ]
	TMMFEvent playEvent( KPlayTestId, KErrNone );
	result = SearchForEvent( playEvent );
	if( result == EFail )
		{
		return result;
		}
	
	//[ lets reset again in the primed state ]
	errorCode = iController.Reset();
	User::LeaveIfError( errorCode );
	
	//[ search for reset event ]
	result = SearchForEvent( resetEvent );
	if( result == EFail )
		{
		return result;
		}

	errorCode = iController.Reset();
	User::LeaveIfError( errorCode );
	
	//[ search for reset event ]
	result = SearchForEvent( resetEvent );
	if( result == EFail )
		{
		return result;
		}

	//[ ensure the controller is unloaded so that it does 
	// not interfere with the following test ]
	// There is error in this code and the stop followed by reset
	// ensure the controller resources are released.
	iController.Stop();
	iController.Reset();
	iController.Close();  
	
	__MM_HEAP_MARKEND;
	   
	// [test steps return a result]
	return result;
	}
Ejemplo n.º 10
0
ApplSelOperationEventImpl::~ApplSelOperationEventImpl(void)
{
	resetEvent(true);
}