} params_thread;
void Game::fireSound(int sound) {
- float gLoc[3]={0,0,0};
- float vel[3]={0,0,0};
- PlaySoundEx( sound, samp[sound], NULL, true);
- OPENAL_3D_SetAttributes(channels[sound], gLoc, vel);
- OPENAL_SetVolume(channels[sound], 256);
- OPENAL_SetPaused(channels[sound], false);
+ emit_sound_at(sound);
}
void Game::inputText(char* str, int* charselected, int* nb_chars) {
#include "Animation.h"
bool visibleloading = 0;
-int channels[100] = {0};
float volume = 0;
bool ismotionblur = 0;
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#include "Quaternions.h"
#include "Sounds.h"
#include "openal_wrapper.h"
int footstepsound, footstepsound2, footstepsound3, footstepsound4;
+int channels[100];
+
static const char *sound_data[sounds_count] = {
#define DECLARE_SOUND(id, filename) filename,
#include "Sounds.def"
OPENAL_Stream_SetMode(samp[i], OPENAL_LOOP_NORMAL);
}
+void
+emit_sound_at(int soundid, const XYZ &pos, float vol)
+{
+ PlaySoundEx (soundid, samp[soundid], NULL, true);
+ OPENAL_3D_SetAttributes_ (channels[soundid], pos, NULL);
+ OPENAL_SetVolume (channels[soundid], vol);
+ OPENAL_SetPaused (channels[soundid], false);
+}
+
extern void loadAllSounds();
+extern void emit_sound_at(int soundid, const XYZ &pos = XYZ(), float vol = 256.f);
+
extern int footstepsound, footstepsound2, footstepsound3, footstepsound4;
#endif
#include <stdlib.h>
#include <string.h>
+#include "Quaternions.h"
#include "openal_wrapper.h"
#include "Sounds.h"
return true;
}
+AL_API signed char OPENAL_3D_SetAttributes_(int channel, const XYZ &pos, const float *vel)
+{
+ if (!initialized) return false;
+ if ((channel < 0) || (channel >= num_channels)) return false;
+
+ set_channel_position(channel, pos.x, pos.y, -pos.z);
+
+ return true;
+}
+
AL_API signed char OPENAL_Init(int mixrate, int maxsoftwarechannels, unsigned int flags)
{
if (initialized) return false;
AL_API void OPENAL_3D_Listener_SetAttributes(const float *pos, const float *vel, float fx, float fy, float fz, float tx, float ty, float tz);
AL_API signed char OPENAL_3D_SetAttributes(int channel, const float *pos, const float *vel);
+AL_API signed char OPENAL_3D_SetAttributes_(int channel, const XYZ &pos, const float *vel);
AL_API signed char OPENAL_Init(int mixrate, int maxsoftwarechannels, unsigned int flags);
AL_API void OPENAL_Close();
AL_API OPENAL_SAMPLE *OPENAL_Sample_Load(int index, const char *name_or_data, unsigned int mode, int offset, int length);
AL_API signed char OPENAL_Stream_SetMode(OPENAL_STREAM *stream, unsigned int mode);
AL_API void OPENAL_Update();
AL_API signed char OPENAL_SetOutput(int outputtype);
+void PlaySoundEx(int chan, OPENAL_SAMPLE *sptr, OPENAL_DSPUNIT *dsp, signed char startpaused);
#ifdef __cplusplus
}