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
53
54
55/* Music API implementation */
56
57typedef struct
58{
59 const char *tag;
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
113
123
124extern void run_music_finished_hook(void);
125
126#endif // #ifndef HTML5_MUSIC_H_
lazy data
Definition meshpage.php:1583
tag src
Definition meshpage.php:1786
Mix_MusicAPI
Definition music.h:37
@ MIX_MUSIC_OGG
Definition music.h:46
@ MIX_MUSIC_MIKMOD
Definition music.h:42
@ MIX_MUSIC_FLUIDSYNTH
Definition music.h:43
@ MIX_MUSIC_MAD
Definition music.h:48
@ MIX_MUSIC_LAST
Definition music.h:51
@ MIX_MUSIC_TIMIDITY
Definition music.h:44
@ MIX_MUSIC_WAVE
Definition music.h:40
@ MIX_MUSIC_HTML5
Definition music.h:38
@ MIX_MUSIC_SMPEG
Definition music.h:49
@ MIX_MUSIC_NATIVEMIDI
Definition music.h:45
@ MIX_MUSIC_CMD
Definition music.h:39
@ MIX_MUSIC_MPG123
Definition music.h:47
@ MIX_MUSIC_FLAC
Definition music.h:50
@ MIX_MUSIC_MODPLUG
Definition music.h:41
void run_music_finished_hook(void)
Definition music.c:129
Mix_Fading
Definition prerequisites.h:403
Mix_MusicType
Definition prerequisites.h:410
SDL_bool
Definition prerequisites.h:155
Definition music.h:58
int(* Seek)(void *music, double position)
Definition music.h:92
SDL_bool loaded
Definition music.h:62
SDL_bool opened
Definition music.h:63
int(* Open)(const SDL_AudioSpec *spec)
Definition music.h:69
void(* Close)(void)
Definition music.h:107
void(* Pause)(void *music)
Definition music.h:95
void(* Delete)(void *music)
Definition music.h:104
int(* GetAudio)(void *music, void *data, int bytes)
Definition music.h:89
void(* Resume)(void *music)
Definition music.h:98
Mix_MusicType type
Definition music.h:61
Mix_MusicAPI api
Definition music.h:60
void(* Stop)(void *music)
Definition music.h:101
int(* Play)(void *music, int play_count)
Definition music.h:83
SDL_bool(* IsPlaying)(void *music)
Definition music.h:86
void(* Unload)(void)
Definition music.h:110
int(* Load)(void)
Definition music.h:66
const char * tag
Definition music.h:59
void(* SetVolume)(void *music, int volume)
Definition music.h:80
Definition prerequisites.h:381
Definition prerequisites.h:187
Definition music.h:114
void * context
Definition music.h:116
Mix_MusicInterface * interface
Definition music.h:115
int fade_step
Definition music.h:120
Mix_Fading fading
Definition music.h:119
int fade_steps
Definition music.h:121
SDL_bool playing
Definition music.h:118