virtual void Run()
	{
		while ( !g_Audio.FInitialized ) {}

		clPtr<AudioSource> Src = new AudioSource();

		Src->BindWaveform( new OggProvider( LoadFileAsBlob( "test.ogg" ) ) );
		// TODO: try Src->BindWaveform( new ModPlugProvider( LoadFileAsBlob( "test.it" ) ) );
		Src->Play();

		FPendingExit = false;

		double Seconds = Env_GetSeconds();

		while ( !IsPendingExit() )
		{
			float DeltaSeconds = static_cast<float>( Env_GetSeconds() - Seconds );
			Src->Update( DeltaSeconds );
			Seconds = Env_GetSeconds();
		}

		Src = NULL;

		g_Audio.Exit( true );

		exit( 0 );
	}
void GestureHandler_SendMotion( int ContactID, eMotionFlag Flag, LVector2 Pos, bool Pressed )
{
	// reset the current gesture
	if ( ContactID == L_MOTION_START )
	{
		FMotionDataValid = false;
		FMotionData.Clear();

		return;
	}
	else
	{
		// complete the current gesture
		if ( ContactID == L_MOTION_END )
		{
			FMotionDataValid = true;

			UpdateGesture();

			g_Responder->Event_UpdateGesture( FMotionData );

			if ( sMotionData* P = FPrevMotionData.prev( 0 ) )
			{
				if ( P->GetNumTouchPoints() != FMotionData.GetNumTouchPoints() )
				{
					FPrevMotionData.push_back( FMotionData );
				}
			}
			else
			{
				FPrevMotionData.push_back( FMotionData );
			}
		}
		// add a point to the current gesture
		else
		{
			if ( Pressed )
			{
				FMotionData.AddTouchPoint( sTouchPoint( ContactID, Pos, L_MOTION_DOWN, Env_GetSeconds() ) );
			}

			switch ( Flag )
			{
				case L_MOTION_MOVE:
					g_Responder->Event_PointerMoved( ContactID, Pos );
					break;

				case L_MOTION_UP:
				case L_MOTION_DOWN:
					g_Responder->Event_PointerChanged( ContactID, Pos, Flag == L_MOTION_DOWN );
					break;
			}
		}
	}
}
Esempio n. 3
0
void clAudioThread::Run()
{
	if ( !LoadAL() ) { return; }

	// We should use actual device name if the default does not work
	FDevice = alcOpenDevice( nullptr );

	FContext = alcCreateContext( FDevice, nullptr );

	alcMakeContextCurrent( FContext );

	FInitialized = true;

	double Seconds = Env_GetSeconds();

	while ( !IsPendingExit() )
	{
		float DeltaSeconds = static_cast<float>( Env_GetSeconds() - Seconds );

		{
			tthread::lock_guard<tthread::mutex> Lock( FMutex );

			for ( auto i = FActiveSources.begin(); i != FActiveSources.end(); i++ )
			{
				( *i )->Update( DeltaSeconds );
			}
		}

		Seconds = Env_GetSeconds();

		Env_Sleep( 100 );
	}

	alcDestroyContext( FContext );
	alcCloseDevice( FDevice );

	UnloadAL();
}
Esempio n. 4
0
void GestureHandler_SendMotion( int ContactID, eMotionFlag Flag, LVector2 Pos, bool Pressed )
{
    if ( ContactID > -1 )
    {
        g_MousePos = Pos;
        g_MouseTime = Env_GetSeconds();

        if ( Flag == L_MOTION_DOWN )
        {
            g_Flow->FFlinger->OnTouch( true );
        }

        if ( Flag == L_MOTION_UP )
        {
            g_Flow->FFlinger->OnTouch( false );
        }
    }
}