-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathSound.h
More file actions
executable file
·73 lines (70 loc) · 1.35 KB
/
Sound.h
File metadata and controls
executable file
·73 lines (70 loc) · 1.35 KB
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
#pragma once
#ifdef NO_FMOD
#ifdef USE_SDL2
#include <SDL2/SDL_mixer.h>
#else
#include <SDL/SDL_mixer.h>
#endif
#else
#include <fmod.h>
#endif
#include <stdio.h>
class Sound
{
public:
virtual bool Load(char* sound, bool loop)=0;
virtual int Play()=0;//returns channel
virtual void Stop(int channel)=0;
virtual void Discard()=0;
void Volume(int channel,int vol);
};
class Sample : public Sound
{
public:
#ifdef NO_FMOD
Sample(){ pSample = 0; pLoop = 1; name=NULL; }
~Sample() { Discard(); }
#else
Sample(){pSample = 0;}
#endif
// ~Sample(){ Discard(); }
bool Load(char* sound, bool loop);
int Play();
void Play(int channel);
void Stop(int channel);
void Discard();
void SetFrequency(int channel,int frequency);
void SetDefaults(int deffreq, int defvol, int defpan, int defpri, int varfreq, int varvol, int varpan);
private:
#ifdef NO_FMOD
Mix_Chunk* pSample;
int pLoop;
char* name;
#else
FSOUND_SAMPLE* pSample;
#endif
};
class Stream : public Sound
{
public:
#ifdef NO_FMOD
Stream(){ pStream = 0; pLoop = 1; }
~Stream() { Discard(); }
#else
Stream(){pStream = 0;}
#endif
// ~Stream(){ Discard(); }
bool Load(char* sound, bool loop);
int Play();
void Play(int channel);
void Stop(int channel);
void Discard();
void Seek(int ms, int channel);
private:
#ifdef NO_FMOD
Mix_Music* pStream;
int pLoop;
#else
FSOUND_STREAM* pStream;
#endif
};