-
-
Notifications
You must be signed in to change notification settings - Fork 182
/
Copy pathAudio.h
84 lines (66 loc) · 1.85 KB
/
Audio.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
* Copyright (c) scott.cgi All Rights Reserved.
*
* This source code belongs to project Mojoc, which is a pure C Game Engine hosted on GitHub.
* The Mojoc Game Engine is licensed under the MIT License, and will continue to be iterated with coding passion.
*
* License : https://github.com/scottcgi/Mojoc/blob/master/LICENSE
* GitHub : https://github.com/scottcgi/Mojoc
* CodeStyle: https://github.com/scottcgi/Mojoc/blob/master/Docs/CodeStyle.md
*
* Since : 2017-2-16
* Update : 2019-1-7
* Author : scott.cgi
*/
#ifndef AUDIO_H
#define AUDIO_H
#include <stdbool.h>
/**
* Play one audio file.
*/
typedef struct AudioPlayer AudioPlayer;
/**
* Manage and control all AudioPlayers.
*/
struct AAudio
{
/**
* Init audio engine.
*/
void (*Init) (void);
/**
* Destroy audio engine.
*/
void (*Release) (void);
/**
* Every frame update by loop.
*/
void (*Update) (float deltaSeconds);
/**
* Pause all looping AudioPlayer.
*/
void (*SetLoopPause) (void);
/**
* Resume all looping AudioPlayer.
*/
void (*SetLoopResume)(void);
/**
* AudioPlayer will cache by relativeFilePath.
*
* relativeFilePath:
* Android: assets
* IOS : NSBundle
*/
AudioPlayer* (*GetPlayer) (const char* relativeFilePath);
/**
* The volume range in [0.0, 1.0].
*/
void (*SetVolume) (AudioPlayer* player, float volume);
void (*SetLoop) (AudioPlayer* player, bool isLoop);
void (*Play) (AudioPlayer* player);
void (*Pause) (AudioPlayer* player);
void (*Stop) (AudioPlayer* player);
bool (*IsPlaying) (AudioPlayer* player);
};
extern struct AAudio AAudio[1];
#endif