static int wrap_setPan(lua_State* L) { lua_settop(L, 2); OutputStream* self = luaAudiere_checkOutputStream(L, 1); float pan = float(luaL_checknumber(L, 2)); self->setPan(pan); return 0; }
void D3DCore_Impl::Channel_SetPanning(HCHANNEL chn, int pan) { if(!m_pADevice) return; OutputStream* OStream = (OutputStream*)chn; for( Channel* I = channels; I != NULL; I = I->next ) { if( I->Handler == chn ) { OStream->setPan( pan/100.0f ); return; } } //Recorrer los stream for( CStreamList* I = streams; I != NULL; I = I->next ) { if( I->hstream == chn ) { OStream->setPan( pan/100.0f ); return; } } }
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; } } }
HCHANNEL D3DCore_Impl::Effect_PlayEx(HEFFECT eff, int volume, int pan, float pitch, bool loop) { if(m_pADevice && eff != 0) { SampleSource* SSource = (SampleSource*)eff; OutputStream* OStream = OpenSound( m_pADevice, SSource, false ); OStream->setVolume( m_VolFX * (volume/100.0f) ); OStream->setPan( pan/100.0f ); OStream->setPitchShift( pitch ); OStream->setRepeat( loop ); OStream->play(); OStream->ref(); // EffectChannelList.insert((HCHANNEL)OStream); Channel* chn = new Channel; chn->Handler = (HCHANNEL)OStream; chn->Type = CT_EFFECT; chn->next = channels; channels = chn; return (HCHANNEL)OStream; } else return 0; }