-
Notifications
You must be signed in to change notification settings - Fork 2
/
SoundTask.cpp
69 lines (57 loc) · 1.25 KB
/
SoundTask.cpp
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
// SoundTask.cpp: implementation of the CSoundTask class.
//
//////////////////////////////////////////////////////////////////////
#include "engine.h"
///////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
/*CSoundTask::CSoundTask()
{
}
CSoundTask::~CSoundTask()
{
}
bool CSoundTask::Start()
{
if(FALSE==FSOUND_Init(44100, 32, 0))return false;
return true;
}
void CSoundTask::OnSuspend()
{
//pause all channels, storing the pause state in the isPaused array
//once the states are stored we can use FSOUND_ALL to pause all channels the easy way
int chCount=FSOUND_GetMaxChannels();
isPaused=new CMMDynamicBlob<bool>(chCount);
for(int i=0;i<chCount;i++)
{
if(FSOUND_IsPlaying(i))
{
isPaused[i]=true;
}else{
isPaused[i]=false;
}
}
FSOUND_SetPaused(FSOUND_ALL,TRUE);
}
void CSoundTask::Update()
{
//we don't need to do anything, FMOD does it all for us :)
}
void CSoundTask::OnResume()
{
//unpause all the flagged channels
if(isPaused)
{
int chCount=FSOUND_GetMaxChannels();
for(int i=0;i<chCount;i++)
{
if(isPaused[i])FSOUND_SetPaused(i,FALSE);
}
isPaused=0;
}
}
void CSoundTask::Stop()
{
FSOUND_Close();
}
*/