@@ -21,6 +21,8 @@ package contents.soundControll
21
21
private static var lastPlayingMusic: String ;
22
22
23
23
private static var lastMusicVolume: Number ;
24
+
25
+ private static var muted: Boolean = false ;
24
26
25
27
/**2 sound id to swap musics smoothly*/
26
28
private static var currentSoundId: uint ,
@@ -59,7 +61,7 @@ package contents.soundControll
59
61
var soundPose: Number = SoundPlayer. getPlayedPrecent(currentSoundId);
60
62
pauseMusic();
61
63
SoundMixer . stopAll ();
62
- SoundPlayer. addSound(lastPlayingMusic,currentSoundId,true ,lastMusicVolume);
64
+ SoundPlayer. addSound(lastPlayingMusic,currentSoundId,true ,muted ? 0 : lastMusicVolume);
63
65
if (firstSoundPlaying)
64
66
{
65
67
startMusic(soundPose);
@@ -75,10 +77,11 @@ package contents.soundControll
75
77
else
76
78
{
77
79
SaffronLogger. log ("soundPose : " + soundPlayingFrom);
78
- SoundPlayer. play (currentSoundId,true ,true ,soundPlayingFrom);
79
80
}
81
+ SoundPlayer. play (currentSoundId,true ,true ,soundPlayingFrom);
80
82
lastMusicState. data . state = true ;
81
83
lastMusicState. flush ();
84
+ if (muted )SoundPlayer. volumeContril(currentSoundId,0 );
82
85
}
83
86
84
87
public static function pauseMusic ():void
@@ -90,17 +93,19 @@ package contents.soundControll
90
93
91
94
public static function muteMusic ():void
92
95
{
96
+ muted = true ;
93
97
SoundPlayer. volumeContril(currentSoundId,0 );
94
98
}
95
99
96
100
public static function unMuteMusit ():void
97
101
{
102
+ muted = false
98
103
SoundPlayer. volumeContril(currentSoundId,1 );
99
104
}
100
105
101
106
public static function changeVolume (volume :Number ):void
102
107
{
103
- SoundPlayer. volumeContril(currentSoundId,volume );
108
+ SoundPlayer. volumeContril(currentSoundId,muted ? 0 : volume );
104
109
}
105
110
106
111
/**This will change the current playing music ( not tested yet )*/
@@ -115,7 +120,7 @@ package contents.soundControll
115
120
volume = Contents. homePage. musicVolume ;
116
121
}
117
122
lastMusicVolume = volume ;
118
- if (musicURL== '' || lastPlayingMusic == musicURL)
123
+ if (muted == false && ( musicURL== '' || lastPlayingMusic == musicURL) )
119
124
{
120
125
SaffronLogger. log ("Music is duplicated on ContentSoundManager.changeMainMusic : " + musicURL);
121
126
SoundPlayer. volumeContril(currentSoundId,volume );
@@ -128,13 +133,15 @@ package contents.soundControll
128
133
SaffronLogger. log ("Pause the sound : " + currentSoundId);
129
134
SoundPlayer. pause (currentSoundId);
130
135
SaffronLogger. log ("Add the sound : " + otherSoundId);
131
- SoundPlayer. addSound(musicURL,otherSoundId,true ,volume );
136
+ SoundPlayer. addSound(musicURL,otherSoundId,true ,muted ? 0 : volume );
132
137
if (lastPlayingMusic== null || musicWasPlaying)
133
138
{
134
139
SaffronLogger. log ("lastPlayingMusic : " + lastPlayingMusic);
135
140
SaffronLogger. log ("musicWasPlaying : " + musicWasPlaying);
136
141
SoundPlayer. play (otherSoundId);
142
+
137
143
}
144
+ if (muted )SoundPlayer. volumeContril(currentSoundId,0 );
138
145
139
146
lastPlayingMusic = musicURL ;
140
147
0 commit comments