- if(!audio_device || !m_sound_enabled)
- return;
-
- Mix_Chunk* chunk = preload_sound(sound);
- if(chunk == 0) {
- std::cerr << "Sound '" << sound << "' not found.\n";
- return;
- }
-
- // TODO make sure this formula is good
- float distance
- = pos2.x- pos.x;
- int loud = int(255.0/float(1600) * fabsf(distance));
- if(loud > 255)
- return;
-
- int chan = Mix_PlayChannel(-1, chunk, 0);
- if(chan < 0)
- return;
- Mix_SetDistance(chan, loud);
-
- // very bad way to do this...
- if(distance > 100)
- Mix_SetPanning(chan, 230, 24);
- else if(distance < -100)
- Mix_SetPanning(chan, 24, 230);
-}
-
-// Register a sound effect function - basti_
-
-void
-SoundManager::register_effect(int channel,Mix_EffectFunc_t f,
- Mix_EffectDone_t d,void * arg) {
-
- if(!audio_device || !m_sound_enabled)