Merge branch 'main/rendor-staging' into fixes
[ryzomcore.git] / nel / src / 3d / particle_system_sound_user.cpp
blob5916bc964fe116fab3f82d7cbcffcd7dfdd8c4d0
1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #include "std3d.h"
21 //#include "nel/3d/u_particle_system_sound.h" we don't include this to avoid a link with NLSOUND
22 #include "nel/3d/particle_system.h"
23 #include "nel/3d/u_ps_sound_interface.h"
24 #include "nel/3d/u_ps_sound_impl.h"
26 #ifdef DEBUG_NEW
27 #define new DEBUG_NEW
28 #endif
30 namespace NL3D
33 void assignSoundServerToPS(UPSSoundServer *soundServer)
35 CParticleSystem::registerSoundServer(soundServer);
36 } // NL3D
39 /// init the particle system sound with the given AudioMixer
40 void UParticleSystemSound::setPSSound(NLSOUND::UAudioMixer *audioMixer)
42 static CPSSoundServImpl soundServer;
43 soundServer.init(audioMixer);
44 if (audioMixer)
46 assignSoundServerToPS(&soundServer);
48 else
50 assignSoundServerToPS(NULL);
55 void CPSSoundInstanceImpl::release(void)
57 if (!_Spawned) // remove this source from the audio mixer if it hasn't been spawned
59 if (_SoundServImpl->getAudioMixer())
61 // _SoundServImpl->getAudioMixer()->removeSource(_Source);
62 delete _Source;
65 else
67 if (_Source) // tells this spawned source not to notify us when it ends
69 _Source->unregisterSpawnCallBack();
72 delete this;
79 /* End of particle_system_sound_user.cpp */