SDLGameEngine

SgeSound

Sound and music. More...

Data Structures

struct  SGESOUND

Functions

void sgeSetDefaultSampleRate (int rate)
 set the sample rate of the audio device
int sgeGetDefaultSampleRate (void)
 get the sample rate of the audio device
void sgeSetVolume (int volume)
 set the global playing volume
int sgeGetVolume (void)
SGESOUNDsgeSoundNew (SGEFILE *f, const char *name)
 create a sound from a sge data archive
void sgeSoundDestroy (SGESOUND *m)
 destroy a sound struct and free memory
void sgeSoundPlay (SGESOUND *m, int loop, int fadeinms)
 play a sound
void sgeSoundStop (SGESOUND *m, int fadeoutms)
 stop a sound
int sgeSoundIsPlaying (SGESOUND *m)
 check if a sound is playing

Variables

int SGESOUND::channel
 channel the sound is playing

Detailed Description

Sound and music.

Functions to play sound effects and music.


Function Documentation

int sgeGetDefaultSampleRate ( void  )

get the sample rate of the audio device

Returns:
the rate in kHz

Definition at line 17 of file sgesound.c.

int sgeGetVolume ( void  )

brief get the current global volume return the current volume

Definition at line 28 of file sgesound.c.

void sgeSetDefaultSampleRate ( int  rate)

set the sample rate of the audio device

Parameters:
ratethe rate in kHz

Use before sgeInit

Definition at line 13 of file sgesound.c.

void sgeSetVolume ( int  volume)

set the global playing volume

Parameters:
volumethe new volume

The maximum volume is MIX_MAX_VOLUME

Definition at line 23 of file sgesound.c.

void sgeSoundDestroy ( SGESOUND m)

destroy a sound struct and free memory

Parameters:
mpointer to SGESOUND

Definition at line 41 of file sgesound.c.

int sgeSoundIsPlaying ( SGESOUND m)

check if a sound is playing

Parameters:
mpointer to SGESOUND
Returns:
0 if sound is not playing or the channel number the sound is playing

Definition at line 72 of file sgesound.c.

SGESOUND* sgeSoundNew ( SGEFILE f,
const char *  name 
)

create a sound from a sge data archive

Parameters:
fa pointer to a opened SGEFILE
namethe file name in the archive

Definition at line 32 of file sgesound.c.

void sgeSoundPlay ( SGESOUND m,
int  loop,
int  fadeinms 
)

play a sound

Parameters:
mpointer to SGESOUND
loopYES/NO if the sound should be played looping
fadeinmsFade the volume in over n miliseconds

Definition at line 49 of file sgesound.c.

void sgeSoundStop ( SGESOUND m,
int  fadeoutms 
)

stop a sound

Parameters:
mpointer to SGESOUND
fadeoutmsFade the volume out over n miliseconds

Definition at line 60 of file sgesound.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines