GameApi
28
Library used by GameApi Builder tool
Loading...
Searching...
No Matches
music.h
Go to the documentation of this file.
1
// html5_mixer
2
//
3
// Copyright (c) 2021 David Apollo (77db70f775fa0b590889c45371a70a1d23e99869d4565976a5207c11606fb6aa)
4
//
5
// Permission is hereby granted, free of charge, to any person obtaining a copy
6
// of this software and associated documentation files (the "Software"), to deal
7
// in the Software without restriction, including without limitation the rights
8
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
// copies of the Software, and to permit persons to whom the Software is
10
// furnished to do so, subject to the following conditions:
11
//
12
// The above copyright notice and this permission notice shall be included in all
13
// copies or substantial portions of the Software.
14
//
15
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
// SOFTWARE.
22
23
#ifndef HTML5_MUSIC_H_
24
#define HTML5_MUSIC_H_
25
26
#include "
prerequisites.h
"
27
28
#ifndef HTML5_MIXER
29
#define HTML5_MIXER
30
#endif
31
32
#ifndef MUSIC_HTML5
33
#define MUSIC_HTML5
34
#endif
35
36
typedef
enum
37
{
38
MIX_MUSIC_HTML5
,
39
MIX_MUSIC_CMD
,
40
MIX_MUSIC_WAVE
,
41
MIX_MUSIC_MODPLUG
,
42
MIX_MUSIC_MIKMOD
,
43
MIX_MUSIC_FLUIDSYNTH
,
44
MIX_MUSIC_TIMIDITY
,
45
MIX_MUSIC_NATIVEMIDI
,
46
MIX_MUSIC_OGG
,
47
MIX_MUSIC_MPG123
,
48
MIX_MUSIC_MAD
,
49
MIX_MUSIC_SMPEG
,
50
MIX_MUSIC_FLAC
,
51
MIX_MUSIC_LAST
52
}
Mix_MusicAPI
;
53
54
55
/* Music API implementation */
56
57
typedef
struct
58
{
59
const
char
*
tag
;
60
Mix_MusicAPI
api
;
61
Mix_MusicType
type
;
62
SDL_bool
loaded
;
63
SDL_bool
opened
;
64
65
/* Load the library */
66
int (*
Load
)(void);
67
68
/* Initialize for the audio output */
69
int (*
Open
)(
const
SDL_AudioSpec
*spec);
70
71
/* Create a music object from an SDL_RWops stream
72
* If the function returns NULL, 'src' will be freed if needed by the caller.
73
*/
74
void
*(*CreateFromRW)(
SDL_RWops
*
src
,
int
freesrc);
75
76
/* Create a music object from a file, if SDL_RWops are not supported */
77
void
*(*CreateFromFile)(
const
char
*file);
78
79
/* Set the volume */
80
void (*
SetVolume
)(
void
*music,
int
volume);
81
82
/* Start playing music from the beginning with an optional loop count */
83
int (*
Play
)(
void
*music,
int
play_count);
84
85
/* Returns SDL_TRUE if music is still playing */
86
SDL_bool
(*
IsPlaying
)(
void
*music);
87
88
/* Get music data, returns the number of bytes left */
89
int (*
GetAudio
)(
void
*music,
void
*
data
,
int
bytes);
90
91
/* Seek to a play position (in seconds) */
92
int (*
Seek
)(
void
*music,
double
position);
93
94
/* Pause playing music */
95
void (*
Pause
)(
void
*music);
96
97
/* Resume playing music */
98
void (*
Resume
)(
void
*music);
99
100
/* Stop playing music */
101
void (*
Stop
)(
void
*music);
102
103
/* Delete a music object */
104
void (*
Delete
)(
void
*music);
105
106
/* Close the library and clean up */
107
void (*
Close
)(void);
108
109
/* Unload the library */
110
void (*
Unload
)(void);
111
112
}
Mix_MusicInterface
;
113
114
struct
_Mix_Music
{
115
Mix_MusicInterface
*
interface
;
116
void
*
context
;
117
118
SDL_bool
playing
;
119
Mix_Fading
fading
;
120
int
fade_step
;
121
int
fade_steps
;
122
};
123
124
extern
void
run_music_finished_hook
(
void
);
125
126
#endif
// #ifndef HTML5_MUSIC_H_
data
lazy data
Definition
meshpage.php:1583
src
tag src
Definition
meshpage.php:1786
Mix_MusicAPI
Mix_MusicAPI
Definition
music.h:37
MIX_MUSIC_OGG
@ MIX_MUSIC_OGG
Definition
music.h:46
MIX_MUSIC_MIKMOD
@ MIX_MUSIC_MIKMOD
Definition
music.h:42
MIX_MUSIC_FLUIDSYNTH
@ MIX_MUSIC_FLUIDSYNTH
Definition
music.h:43
MIX_MUSIC_MAD
@ MIX_MUSIC_MAD
Definition
music.h:48
MIX_MUSIC_LAST
@ MIX_MUSIC_LAST
Definition
music.h:51
MIX_MUSIC_TIMIDITY
@ MIX_MUSIC_TIMIDITY
Definition
music.h:44
MIX_MUSIC_WAVE
@ MIX_MUSIC_WAVE
Definition
music.h:40
MIX_MUSIC_HTML5
@ MIX_MUSIC_HTML5
Definition
music.h:38
MIX_MUSIC_SMPEG
@ MIX_MUSIC_SMPEG
Definition
music.h:49
MIX_MUSIC_NATIVEMIDI
@ MIX_MUSIC_NATIVEMIDI
Definition
music.h:45
MIX_MUSIC_CMD
@ MIX_MUSIC_CMD
Definition
music.h:39
MIX_MUSIC_MPG123
@ MIX_MUSIC_MPG123
Definition
music.h:47
MIX_MUSIC_FLAC
@ MIX_MUSIC_FLAC
Definition
music.h:50
MIX_MUSIC_MODPLUG
@ MIX_MUSIC_MODPLUG
Definition
music.h:41
run_music_finished_hook
void run_music_finished_hook(void)
Definition
music.c:129
prerequisites.h
Mix_Fading
Mix_Fading
Definition
prerequisites.h:403
Mix_MusicType
Mix_MusicType
Definition
prerequisites.h:410
SDL_bool
SDL_bool
Definition
prerequisites.h:155
Mix_MusicInterface
Definition
music.h:58
Mix_MusicInterface::Seek
int(* Seek)(void *music, double position)
Definition
music.h:92
Mix_MusicInterface::loaded
SDL_bool loaded
Definition
music.h:62
Mix_MusicInterface::opened
SDL_bool opened
Definition
music.h:63
Mix_MusicInterface::Open
int(* Open)(const SDL_AudioSpec *spec)
Definition
music.h:69
Mix_MusicInterface::Close
void(* Close)(void)
Definition
music.h:107
Mix_MusicInterface::Pause
void(* Pause)(void *music)
Definition
music.h:95
Mix_MusicInterface::Delete
void(* Delete)(void *music)
Definition
music.h:104
Mix_MusicInterface::GetAudio
int(* GetAudio)(void *music, void *data, int bytes)
Definition
music.h:89
Mix_MusicInterface::Resume
void(* Resume)(void *music)
Definition
music.h:98
Mix_MusicInterface::type
Mix_MusicType type
Definition
music.h:61
Mix_MusicInterface::api
Mix_MusicAPI api
Definition
music.h:60
Mix_MusicInterface::Stop
void(* Stop)(void *music)
Definition
music.h:101
Mix_MusicInterface::Play
int(* Play)(void *music, int play_count)
Definition
music.h:83
Mix_MusicInterface::IsPlaying
SDL_bool(* IsPlaying)(void *music)
Definition
music.h:86
Mix_MusicInterface::Unload
void(* Unload)(void)
Definition
music.h:110
Mix_MusicInterface::Load
int(* Load)(void)
Definition
music.h:66
Mix_MusicInterface::tag
const char * tag
Definition
music.h:59
Mix_MusicInterface::SetVolume
void(* SetVolume)(void *music, int volume)
Definition
music.h:80
SDL_AudioSpec
Definition
prerequisites.h:381
SDL_RWops
Definition
prerequisites.h:187
_Mix_Music
Definition
music.h:114
_Mix_Music::context
void * context
Definition
music.h:116
_Mix_Music::interface
Mix_MusicInterface * interface
Definition
music.h:115
_Mix_Music::fade_step
int fade_step
Definition
music.h:120
_Mix_Music::fading
Mix_Fading fading
Definition
music.h:119
_Mix_Music::fade_steps
int fade_steps
Definition
music.h:121
_Mix_Music::playing
SDL_bool playing
Definition
music.h:118
music.h
Generated by
1.15.0