Skip to content

Commit 7df52f2

Browse files
author
natural-law
committed
issue #168
1 parent 09e9638 commit 7df52f2

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

CocosDenshion/CocosDenshion.vcproj

-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
UsePrecompiledHeader="0"
5050
WarningLevel="3"
5151
DebugInformationFormat="4"
52-
DisableSpecificWarnings="4251"
5352
/>
5453
<Tool
5554
Name="VCManagedResourceCompilerTool"

CocosDenshion/SimpleAudioEngine/SimpleAudioEngine.cpp

+9-7
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ SimpleAudioEngine::SimpleAudioEngine()
2323
, m_bWillPlayBackgroundMusic(false)
2424
, m_pEffects(NULL)
2525
{
26-
m_EffectPlayers.resize(0);
26+
//m_pEffectPlayers->resize(0);
27+
m_pEffectPlayers = new PlayerArray();
2728
}
2829

2930
SimpleAudioEngine::~SimpleAudioEngine()
@@ -100,7 +101,7 @@ void SimpleAudioEngine::SetEffectsVolume(int volume)
100101
{
101102
PlayerArrayIterator iter;
102103

103-
for (iter = m_EffectPlayers.begin(); iter != m_EffectPlayers.end(); ++iter)
104+
for (iter = m_pEffectPlayers->begin(); iter != m_pEffectPlayers->end(); ++iter)
104105
{
105106
if (*iter)
106107
{
@@ -220,9 +221,9 @@ void SimpleAudioEngine::playPreloadedEffect(int nSoundId)
220221
SoundPlayer* pPlayer = pElement->pPlayer;
221222
if (!pPlayer)
222223
{
223-
// find the not playing player in m_EffectPlayers
224+
// find the not playing player in m_pEffectPlayers
224225
PlayerArrayIterator iter;
225-
for (iter = m_EffectPlayers.begin(); iter != m_EffectPlayers.end(); ++iter)
226+
for (iter = m_pEffectPlayers->begin(); iter != m_pEffectPlayers->end(); ++iter)
226227
{
227228
if ((*iter) && !(*iter)->IsPlaying())
228229
{
@@ -235,7 +236,7 @@ void SimpleAudioEngine::playPreloadedEffect(int nSoundId)
235236
if (!pPlayer)
236237
{
237238
pPlayer = new SoundPlayer();
238-
m_EffectPlayers.push_back(pPlayer);
239+
m_pEffectPlayers->push_back(pPlayer);
239240

240241
// set the player volume
241242
pPlayer->SetVolumeValue(m_nEffectsVolume);
@@ -262,13 +263,14 @@ void SimpleAudioEngine::removeAllEffectPlayers()
262263
{
263264
PlayerArrayIterator iter;
264265

265-
for (iter = m_EffectPlayers.begin(); iter != m_EffectPlayers.end(); ++iter)
266+
for (iter = m_pEffectPlayers->begin(); iter != m_pEffectPlayers->end(); ++iter)
266267
{
267268
if (*iter)
268269
{
269270
delete *iter;
270271
}
271272
}
272273

273-
m_EffectPlayers.clear();
274+
m_pEffectPlayers->clear();
275+
delete m_pEffectPlayers;
274276
}

CocosDenshion/SimpleAudioEngine/SimpleAudioEngine.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class EXPORT_DLL SimpleAudioEngine
102102
bool m_bWillPlayBackgroundMusic;
103103

104104
SoundPlayer m_obBackPlayer;
105-
PlayerArray m_EffectPlayers;
105+
PlayerArray* m_pEffectPlayers;
106106

107107
// use hash map to save the effects loaded
108108
typedef struct _hashElement

TestAudioEngine/TestAudioEngine.vcproj

+1-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
UsePrecompiledHeader="0"
5151
WarningLevel="3"
5252
DebugInformationFormat="4"
53-
DisableSpecificWarnings="4251"
5453
ForcedIncludeFiles=""
5554
/>
5655
<Tool
@@ -97,7 +96,7 @@
9796
/>
9897
<Tool
9998
Name="VCPostBuildEventTool"
100-
CommandLine="mkdir d:\Work7\NEWPLUS\TDA_DATA\UserData&#x0D;&#x0A;mkdir d:\Work7\NEWPLUS\TDA_DATA\UserData&#x0D;&#x0A;copy .\Res\sounds\background.mp3 D:\Work7\NEWPLUS\TDA_DATA\UserData&#x0D;&#x0A;copy .\Res\sounds\Effect1.mp3 D:\Work7\NEWPLUS\TDA_DATA\UserData&#x0D;&#x0A;copy .\Res\sounds\Effect2.mp3 D:\Work7\NEWPLUS\TDA_DATA\UserData"
99+
CommandLine="mkdir d:\Work7\NEWPLUS\TDA_DATA\UserData&#x0D;&#x0A;mkdir d:\Work7\NEWPLUS\TDA_DATA\UserData&#x0D;&#x0A;copy .\Res\sounds\background.mp3 D:\Work7\NEWPLUS\TDA_DATA\UserData&#x0D;&#x0A;copy .\Res\sounds\Effect1.mp3 D:\Work7\NEWPLUS\TDA_DATA\UserData&#x0D;&#x0A;copy .\Res\sounds\Effect2.mp3 D:\Work7\NEWPLUS\TDA_DATA\UserData&#x0D;&#x0A;"
101100
/>
102101
</Configuration>
103102
<Configuration

0 commit comments

Comments
 (0)