示例#1
0
void D3DCore_Impl::Channel_SlideTo(HCHANNEL chn, float time, int volume, int pan, float pitch)
{
	if(!m_pADevice) return;

	bool existChannel = false;
	for( Channel* I = channels; I != NULL; I = I->next )
		if( I->Handler == chn )
		{
			existChannel = true;
			break;
		}


	if(!existChannel)
	{
		for( CStreamList* I = streams; I != NULL; I = I->next )
			if( I->hstream == chn )
			{
				existChannel = true;
				break;
			}
	}

	if(existChannel)
	{
		Slide* nSlide = new Slide;
		nSlide->chn = (OutputStream*)chn;
		nSlide->time = time;

		OutputStream* OStream = (OutputStream*)chn;

		nSlide->dVolume = 0.0f;
		if( volume != -1 )
		{
			float OldVolume = OStream->getVolume();
			float NewVolume = volume*1.0f;
			if( volume == -2 ) NewVolume = 0.0f;
			nSlide->dVolume = (NewVolume - OldVolume)/time;
		}

		nSlide->dPan = 0.0f;
		if(pan != -101)
		{
			float OldPan = OStream->getPan();
			float NewPan = pan/100.0f;
			nSlide->dPan = (NewPan - OldPan)/time;
		}
			
		nSlide->dPitch = 0.0f;
		if(pan != -101)
		{
			float OldPitch = OStream->getPitchShift();
			float NewPitch = pitch;
			nSlide->dPan = (NewPitch - OldPitch)/time;
		}

		nSlide->next = slides;
		slides = nSlide;		
	}
}
示例#2
0
void D3DCore_Impl::Channel_Slide_Update( float dt )
{
	Slide *I =  slides, *Prev =  0;
	while( I != NULL )
	{
		OutputStream* OStream = (*I).chn;
		(*I).time -= dt;

		float NewVolume = OStream->getVolume() + ((*I).dVolume * dt);
		float NewPan = OStream->getPan() + ((*I).dPan * dt);
		float NewPitch = OStream->getPitchShift() + ((*I).dPitch * dt);

		OStream->setVolume( NewVolume );
		OStream->setPan( NewPan );
		OStream->setPitchShift( NewPitch );

		if( (*I).time <= 0.0f )
		{
			if(Prev)
			{
				Prev->next=I->next;
				delete I;
				I = Prev->next;
			}
			else
			{
				slides=I->next;
				delete I;
				I = slides;
			}			
		}
		else
		{
			Prev = I;
			I = I->next;
		}
	}
}
示例#3
0
static int wrap_getPan(lua_State* L) {
  lua_settop(L, 1);
  OutputStream* self = luaAudiere_checkOutputStream(L, 1);
  lua_pushnumber(L, self->getPan());
  return 1;
}