-
Notifications
You must be signed in to change notification settings - Fork 5
/
SoundSystem.h
46 lines (37 loc) · 1.25 KB
/
SoundSystem.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
#pragma once
#include "cumino.h"
#ifdef USE_FMOD
#include "fmod/api/inc/fmod.h"
#include "fmod/api/inc/fmod_errors.h"
inline void FMOD_ERRCHECK(FMOD_RESULT result){
if (result != FMOD_OK){
assertmsg( false, "FMOD error! (%d) %s\n", result, FMOD_ErrorString(result) );
}
}
#endif
class Sound;
class RemoteHead;
class SoundSystem {
public:
int id_gen;
Sound *sounds[1024];
RemoteHead *remote_head;
#ifdef USE_FMOD
FMOD_SYSTEM *sys;
#endif
#if defined(USE_UNTZ) || defined(USE_OPENAL) || defined(__linux__) || defined(USE_MOYAIAL)
void *sys; // not used
#endif
SoundSystem();
Sound *newSound( const char *path, float vol=1 );
Sound *newSoundFromMemory( float *sample, int sample_num );
Sound *newSoundFromMemoryVirtual(float *samples, int samples_num );
void append( Sound*s );
Sound *getById( int id );
void setRemoteHead(RemoteHead*rh);
void setVolume(float v);
void (*soundPlayCallback)(Sound *sound, float defvol, float vol );
void (*soundStopCallback)(Sound *sound);
static void setOnMixDoneCallback( void (*cb)(int16_t *samples, int numFrames, int numChannels, int freq ) );
static void setOnBeforeMixCallback( void (*cb)(int16_t *samples, int numFrames, int numChannels, int freq ) );
};