Audio handler include header. More...

#include <SDL.h>
#include <SDL_mixer.h>
Include dependency graph for Audio.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  Audio_t
 Audio mixer handle data. More...
 
struct  Music_t
 Music handle data. More...
 

Typedefs

typedef struct Audio_t Audio
 Audio mixer handle type.
 
typedef struct Music_t Music
 Music handle type.
 

Functions

void Audio_Free (Audio *pstAudio)
 Free audio mixer. More...
 
void Audio_FreeMusic (Music *pstMusic)
 Free/Unload music file. More...
 
Sint8 Audio_Init (Audio **pstAudio)
 Initialise audio mixer. More...
 
Sint8 Audio_InitMusic (const char *pacFileName, const Sint8 s8Loops, Music **pstMusic)
 Initialise music file. More...
 
Sint8 Audio_PlayMusic (const Uint16 u16FadeInMs, const Music *pstMusic)
 Play music file. More...
 

Detailed Description

Audio handler include header.

Function Documentation

◆ Audio_Free()

void Audio_Free ( Audio pstAudio)

Free audio mixer.

Frees up allocated memory and de-initialises audio mixer

Parameters
pstAudioPointer to audio mixer handle

◆ Audio_FreeMusic()

void Audio_FreeMusic ( Music pstMusic)

Free/Unload music file.

Frees up allocated memory and unloads music file

Parameters
pstMusicPointer to loaded music file handle

◆ Audio_Init()

Sint8 Audio_Init ( Audio **  pstAudio)

Initialise audio mixer.

Initialises audio mixer required to play any sound whatsoever

Parameters
pstAudioPointer to audio mixer handle
Returns
Error code
Return values
0OK

-1: Error

◆ Audio_InitMusic()

Sint8 Audio_InitMusic ( const char *  pacFileName,
const Sint8  s8Loops,
Music **  pstMusic 
)

Initialise music file.

Loads music file into memory

Parameters
pacFileNamePath to music file
s8LoopsLoops to play, -1 to loop endlessly
pstMusicPointer to music file handle
Returns
Error code
Return values
0OK
-1Error

◆ Audio_PlayMusic()

Sint8 Audio_PlayMusic ( const Uint16  u16FadeInMs,
const Music pstMusic 
)

Play music file.

Plays previously loaded music file

Parameters
u16FadeInMsFade-in time in milliseconds
pstMusicPointer to music file handle
Returns
Error code
Return values
0OK
-1Error