SDLGameEngine

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

Data Structures | Functions | Variables

# 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)
SGESOUND * | sgeSoundNew (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:

  rate | the rate in kHz

Use before sgeInit

Definition at line 13 of file sgesound.c.

void sgeSetVolume | ( | int | volume | ) |

set the global playing volume

Parameters:

  volume | the 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:

  m | pointer to SGESOUND

Definition at line 41 of file sgesound.c.

int sgeSoundIsPlaying | ( | SGESOUND * | m | ) |

check if a sound is playing

Parameters:

  m | pointer 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:

  f | a pointer to a opened SGEFILE
  name | the 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:

  m | pointer to SGESOUND
  loop | YES/NO if the sound should be played looping
  fadeinms | Fade the volume in over n miliseconds

Definition at line 49 of file sgesound.c.

void sgeSoundStop | ( | SGESOUND * | m,
|  | int | fadeoutms
| ) |  |

stop a sound

Parameters:

  m | pointer to SGESOUND
  fadeoutms | Fade the volume out over n miliseconds

Definition at line 60 of file sgesound.c.

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines