コード例 #1
0
ファイル: plane.cpp プロジェクト: DaniBarca/PlaneGame
Plane::Plane(std::string meshdir, std::string texturedir, Vector3 position)
: MovingObject(meshdir, texturedir, position, false){
	this->speed        = 0;
	this->acceleration = 50;
	this->deceleration = 5;
	this->max_speed	   = 200;
	this->min_speed	   = 50;
	this->std_speed    = 5;
	this->roll         = 3;
	this->v_roll       = 2;
	this->h_roll       = 1;
	this->friction     = 0.01;

	numBullets   = 10000;
	bulletsShoot = 0;

	cadencia = 0.25;

	name_ = "Plane " + id;

	motor = BASS_SampleLoad(false,"..\\..\\data\\sound\\motor.mp3",0,0,3,BASS_SAMPLE_LOOP);
	motorSampleChannel = BASS_SampleGetChannel(motor,false);
	BASS_ChannelPlay(motorSampleChannel,true);
	BASS_ChannelSetAttribute(motorSampleChannel,BASS_ATTRIB_VOL,0.5);
	BASS_ChannelSet3DAttributes(motorSampleChannel,BASS_3DMODE_NORMAL,1,500,360,360,0.1);

	bullet = BASS_SampleLoad(false,"..\\..\\data\\sound\\shot.mp3",0,0,3,0);
	bulletSampleChannel = BASS_SampleGetChannel(bullet,false);
	BASS_ChannelSetAttribute(bulletSampleChannel,BASS_ATTRIB_VOL,0.7);
	BASS_ChannelSet3DAttributes(bulletSampleChannel,BASS_3DMODE_NORMAL,0,500,360,360,0.1);
}
コード例 #2
0
bool CClientSound::Play3D ( const SString& strPath, const CVector& vecPosition, bool bLoop )
{
    long lFlags = BASS_STREAM_AUTOFREE | BASS_SAMPLE_3D | BASS_SAMPLE_MONO;
    if ( bLoop )
        lFlags |= BASS_SAMPLE_LOOP;

    // Try to load the sound file
    if (
        ( m_pSound = BASS_StreamCreateFile ( false, strPath, 0, 0, lFlags ) )
     || ( m_pSound = BASS_MusicLoad ( false, strPath, 0, 0, lFlags, 0) )
        )
    {
        m_b3D = true;
        m_strPath = strPath;
        m_vecPosition = vecPosition;
        BASS_3DVECTOR pos ( vecPosition.fX, vecPosition.fY, vecPosition.fZ );
        BASS_ChannelSet3DPosition ( m_pSound, &pos, NULL, NULL );
        BASS_ChannelSet3DAttributes ( m_pSound, BASS_3DMODE_NORMAL, 1.0f, 0.5f, 360, 360, 1.0f );
        BASS_ChannelPlay ( m_pSound, false );
        BASS_ChannelGetAttribute ( m_pSound, BASS_ATTRIB_FREQ, &m_fDefaultFrequency );
        return true;
    }
    g_pCore->GetConsole()->Printf ( "BASS ERROR %d in Play3D  path = %s", BASS_ErrorGetCode(), strPath.c_str() );
    return false;
}
コード例 #3
0
void CClientSound::ThreadCallback ( HSTREAM pSound )
{
    if ( pSound )
    {
        m_pSound = pSound;
        if ( m_b3D )
        {
            BASS_3DVECTOR pos ( m_vecPosition.fX, m_vecPosition.fY, m_vecPosition.fZ );
            BASS_ChannelSet3DPosition ( pSound, &pos, NULL, NULL );
            BASS_ChannelSet3DAttributes ( pSound, BASS_3DMODE_NORMAL, 1.0f, 0.5f, 360, 360, 1.0f );
        }
        // Set a Callback function for download finished
        BASS_ChannelSetSync ( pSound, BASS_SYNC_DOWNLOAD, 0, &DownloadSync, this );
        BASS_ChannelGetAttribute ( pSound, BASS_ATTRIB_FREQ, &m_fDefaultFrequency );
        BASS_ChannelPlay ( pSound, false );
    }
    else
        g_pCore->GetConsole()->Printf ( "BASS ERROR %d in PlayStream  b3D = %s  path = %s", BASS_ErrorGetCode(), m_b3D ? "true" : "false", m_strPath.c_str() );
    
    // Call onClientSoundStream LUA event
    CLuaArguments Arguments;
    Arguments.PushBoolean ( pSound ? true : false );
    Arguments.PushNumber ( GetLength () );
    this->CallEvent ( "onClientSoundStream", Arguments, true );
}
コード例 #4
0
ファイル: BassSound3D.cpp プロジェクト: 183amir/kge
		// play
		void BassSound3D::Play()
		{
			m_channel = BASS_SampleGetChannel(m_handle, FALSE);

			if (m_looping)
			{
				BASS_ChannelFlags(m_channel, BASS_SAMPLE_LOOP, BASS_SAMPLE_LOOP);
			}
			else
			{
				BASS_ChannelFlags(m_channel, 0, BASS_SAMPLE_LOOP);
			}

			BASS_ChannelSetAttribute(m_channel, BASS_ATTRIB_VOL, m_volume);

			BASS_ChannelSet3DAttributes(m_channel, -1, m_minDistance, m_maxDistance, -1, -1, -1);

			BASS_3DVECTOR pos(m_Position.x, m_Position.y, m_Position.z);
			BASS_3DVECTOR vel(m_velocity.x, m_velocity.y, m_velocity.z);
			BASS_ChannelSet3DPosition(m_channel, &pos, NULL, &vel);

			BASS_Apply3D();

			BASS_ChannelPlay(m_channel, FALSE);
		}
コード例 #5
0
ファイル: BassSound3D.cpp プロジェクト: 183amir/kge
		// SetMinMaxDistance
		void BassSound3D::SetMinMaxDistance(float _min, float _max /*= 10000.0f*/)
		{
			m_minDistance = _min;
			m_maxDistance = _max;

			BASS_ChannelSet3DAttributes(m_channel, -1, m_minDistance, m_maxDistance, -1, -1, -1);
			BASS_Apply3D();
		}