-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsampleio.h
77 lines (65 loc) · 1.48 KB
/
sampleio.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
// 'sampleio' Class Header
// Author: M.D.Snellgrove
// Date: 17/3/2002
// History:
// Changes by M Snellgrove 25/7/2003
// Conditional Compilation for OpenAL
// Option definitions
#define AUDIO_NOAUDIO 0
#define AUDIO_SDLMIXER 1
#define AUDIO_OPENAL 2
// Check compiler flags
#ifdef AP_AUDIO_SDLMIXER
#define AP_AUDIO AUDIO_SDLMIXER
#endif
#ifdef AP_AUDIO_OPENAL
#define AP_AUDIO AUDIO_OPENAL
#endif
#ifndef AP_AUDIO
#define AP_AUDIO AUDIO_NOAUDIO
#endif
// Noaudio definitions
#if AP_AUDIO==AUDIO_NOAUDIO
typedef int ALuint;
typedef bool ALboolean;
#endif
// SDL Mixer audio definitions
#if AP_AUDIO==AUDIO_SDLMIXER
#include <SDL_mixer.h>
typedef Mix_Chunk* ALuint;
typedef bool ALboolean;
#endif
// OpenAL includes
#if AP_AUDIO==AUDIO_OPENAL
#include <AL/al.h>
#include <AL/alc.h>
#include <AL/alut.h>
#endif
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
// Class header
class sampleio{
private:
int numsamples;
int numsources;
int numpool;
ALuint* sources;
// Mix_Chunk** sources;
bool initdone;
ALuint* samples;
int poolcount;
void psource(int source, int sample, bool loop);
ALboolean sourceisplaying(ALuint);
public:
sampleio();
void init(int, char[][255], int, int);
void close();
void update();
void channel(int, int);
void loop(int, int);
void play(int);
void stop(int);
void volume(int, double);
};