-
Notifications
You must be signed in to change notification settings - Fork 2
/
midiplay.h
60 lines (44 loc) · 1.38 KB
/
midiplay.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
// midiplay
// Copyright 2022 by Steve Clark
#ifndef __MIDIPLAY_H__
#define __MIDIPLAY_H__
// comment this line if the score time is not required
#define MP_TIME
// Midiplay_Init
// samplerate The samplerate of the audio output stream
void Midiplay_Init(int);
// Midiplay_Load
// data Memory pointer to the music data
// size Size of the music data in bytes
// Returns 1 on success, 0 on failure
int Midiplay_Load(void *, int);
// Midiplay_Play
// playing 0 = pause, 1 = play
void Midiplay_Play(int);
// Midiplay_Volume
// volume Range 0 to 127, 0 = minimum, 127 = maximum
void Midiplay_SetVolume(int);
// Midiplay_Output
// buffer Pointer to pre-allocated buffer
// length Length of buffer
// Music is rendered as stereo 16bit signed samples
void Midiplay_Output(short *, int);
// Midiplay_IsPlaying
// Returns 0 if not playing
// Paused/looping music will still return 1
int Midiplay_IsPlaying(void);
// Midiplay_Time
// Returns time in 1/10ths second
// Calling this immediately after Midiplay_Load returns the length of the music
// Calling this while Midiplay_IsPlaying returns the current position
#ifdef MP_TIME
int Midiplay_Time(void);
#endif
// Midiplay_Loop
// Changes looping mode (0 = once, 1 = repeating)
void Midiplay_Loop(int);
// Midiplay_Restart
// Restarts playback to beginning of music
void Midiplay_Restart(void);
#endif
// midiplay