2 * See Licensing and Copyright notice in naev.h
11 * Private sound header, do not use outside of the sound subsystem.
16 #endif /* USE_OPENAL */
19 #include "SDL_mixer.h"
20 #endif /* USE_SDLMIX */
26 #define VOICE_LOOPING (1<<10) /* voice loops */
27 #define VOICE_STATIC (1<<11) /* voice isn't relative */
30 #define MUSIC_FADEOUT_DELAY 1000 /**< Time it takes to fade out. */
31 #define MUSIC_FADEIN_DELAY 2000 /**< Time it takes to fade in. */
37 * @brief Contains a sound buffer.
39 typedef struct alSound_
{
40 char *name
; /**< Buffer's name. */
41 double length
; /**< Length of the buffer. */
49 ALuint buf
; /**< Buffer data. */
50 } al
; /**< For OpenAL backend. */
51 #endif /* USE_OPENAL */
55 } mix
; /**< For SDL_mixer backend. */
56 #endif /* USE_SDLMIX */
57 } u
; /**< For backend. */
62 * @typedef voice_state_t
63 * @brief The state of a voice.
66 typedef enum voice_state_
{
67 VOICE_STOPPED
, /**< Voice is stopped. */
68 VOICE_PLAYING
, /**< Voice is playing. */
69 VOICE_FADEOUT
, /**< Voice is fading out. */
70 VOICE_DESTROY
/**< Voice should get destroyed asap. */
77 * @brief Represents a voice in the game.
79 * A voice would be any object that is creating sound.
81 typedef struct alVoice_
{
82 struct alVoice_
*prev
; /**< Linked list previous member. */
83 struct alVoice_
*next
; /**< Linked list next member. */
85 int id
; /**< Identifier of the voice. */
87 voice_state_t state
; /**< Current state of the sound. */
88 unsigned int flags
; /**< Voice flags. */
96 ALfloat pos
[3]; /**< Position of the voice. */
97 ALfloat vel
[3]; /**< Velocity of the voice. */
98 ALuint source
; /**< Source current in use. */
99 ALuint buffer
; /**< Buffer attached to the voice. */
100 } al
; /**< For OpenAL backend. */
101 #endif /* USE_OPENAL */
104 int channel
; /**< Channel sound is playing on. */
105 } mix
; /**< For SDL_mixer backend. */
106 #endif /* USE_SDLMIX */
107 } u
; /**< For backend. */
114 extern alVoice
*voice_active
; /**< Active voices. */
120 void voice_lock (void);
121 void voice_unlock (void);
122 alVoice
* voice_new (void);
123 int voice_add( alVoice
* v
);
124 alVoice
* voice_get( int id
);
127 #endif /* SOUND_PRIV_H */