MTek-GDL 0.100.4-muffintrap
Loading...
Searching...
No Matches
mgdl-sound.h
Go to the documentation of this file.
1#pragma once
2
3#include "mgdl-types.h"
4#include <mgdl/mgdl-openal.h>
5
6#ifdef __cplusplus
7#include <cstdlib>
8#else
9#include <stdlib.h>
10#endif
11
12#ifndef GEKKO
13#include <sndfile.h>
14#endif
15
16enum SoundStatus
17{
18 Stopped,
19 Playing,
20 Paused,
21 Initial
22};
23
24typedef enum SoundStatus SoundStatus;
25
27
30struct Sound
31{
32 #ifdef GEKKO
33
34 short format;
35 u16 freq;
36 void *sData;
37 short voiceNumber; // ASND voice number
38
39 #else // PC Platform
40
41 SNDFILE* sndfile;
42 ALuint buffer, source;
43
44 #endif
45
46 sizetype sSize; // Size in bytes
47
48 float secondsOffset; // This is mainly to allow chaning the play position on Ogg on Wii for debug purposes
49 bool isLooping;
50};
51typedef struct Sound Sound;
52
53#ifdef __cplusplus
54extern "C"
55{
56#endif
57
62Sound* Sound_Create(void);
63
65
78Sound* Sound_Load(const char* filename);
79
81
85void Sound_DeleteData(Sound* sound);
86
88
91void Sound_Play(Sound* sound);
92
94
100void Sound_PlayEx(Sound* sound, float pitchOffset, float volumePercent) ;
101
103
107void Sound_Stop(Sound* sound ) ;
108
109
111
114void Sound_SetPaused(Sound* sound, bool pause) ;
115void Sound_SetLooping(Sound* sound, bool looping) ;
116bool Sound_GetLooping(Sound* sound );
117
119
124float Sound_GetElapsedSeconds(Sound* sound ) ;
125void Sound_SetElapsedSeconds(Sound* sound, float elapsed) ;
126
127
129
134SoundStatus Sound_GetStatus(Sound* sound ) ;
135
136#ifdef __cplusplus
137}
138#endif
void Sound_PlayEx(Sound *sound, float pitchOffset, float volumePercent)
Plays a sound with extended paramters.
Definition pc-sound.cpp:82
void Sound_SetPaused(Sound *sound, bool pause)
Pauses the playback of the sound.
Definition pc-sound.cpp:91
Sound * Sound_Load(const char *filename)
Loads a sound file.
Definition pc-sound.cpp:7
void Sound_DeleteData(Sound *sound)
Deletes the sound data stored in the object.
Definition pc-sound.cpp:71
void Sound_Stop(Sound *sound)
Stops the playback of the sound.
Definition pc-sound.cpp:87
SoundStatus Sound_GetStatus(Sound *sound)
Get if the voice is playing or not.
Definition pc-sound.cpp:125
float Sound_GetElapsedSeconds(Sound *sound)
Get elapsed playback time in seconds.
Definition pc-sound.cpp:119
Sound * Sound_Create(void)
Allocates a new Sound with empty variables.
Definition pc-sound.cpp:60
void Sound_Play(Sound *sound)
Plays a sound.
Definition pc-sound.cpp:77
Library types, macros, defines and enums header.
Sound handling struct.
Definition mgdl-sound.h:31