• R/O
  • SSH
  • HTTPS

qrobosdk: コミット


コミットメタ情報

リビジョン1965 (tree)
日時2011-08-13 21:02:33
作者satofumi

ログメッセージ

fixed SoundEffect::setMute() implementation

変更サマリ

差分

--- trunk/libs/lua/luabindAudio.cpp (revision 1964)
+++ trunk/libs/lua/luabindAudio.cpp (revision 1965)
@@ -30,6 +30,7 @@
3030
3131 class_<BackMusic>("BackMusic")
3232 .def(constructor<>())
33+ .def("setMute", &BackMusic::setMute)
3334 .def("setVolume", &BackMusic::setVolume)
3435 .def("play", &BackMusic::play)
3536 .def("stop", &BackMusic::stop)
@@ -37,6 +38,7 @@
3738
3839 class_<SoundEffect>("SoundEffect")
3940 .def(constructor<const char*>())
41+ .def("setMute", &SoundEffect::setMute)
4042 .def("setMasterVolume", &SoundEffect::setMasterVolume)
4143 .def("setVolume", &SoundEffect::setVolume)
4244 .def("play", &SoundEffect::play)
--- trunk/libs/audio/Volume.h (revision 1964)
+++ trunk/libs/audio/Volume.h (nonexistent)
@@ -1,27 +0,0 @@
1-#ifndef QRK_VOLUME_H
2-#define QRK_VOLUME_H
3-
4-/*!
5- \file
6- \brief ボリューム管理
7-
8- \author Satofumi KAMIMURA
9-
10- $Id$
11-*/
12-
13-#include <cstddef>
14-
15-
16-namespace qrk
17-{
18- class BackMusic;
19- class SoundEffect;
20-
21-
22- void setBaseVolume(size_t percent);
23- void setBaseVolume(BackMusic* sound_effect, size_t percent);
24- void setBaseVolume(SoundEffect* sound_effect, size_t percent);
25-}
26-
27-#endif /* !QRK_VOLUME_H */
Deleted: svn:keywords
## -1 +0,0 ##
-Id Date Author Rev URL
\ No newline at end of property
--- trunk/libs/audio/sdl_mixer/Volume.cpp (revision 1964)
+++ trunk/libs/audio/sdl_mixer/Volume.cpp (nonexistent)
@@ -1,35 +0,0 @@
1-/*!
2- \file
3- \brief ボリューム管理
4-
5- \author Satofumi KAMIMURA
6-
7- $Id$
8-*/
9-
10-#include "Volume.h"
11-
12-using namespace qrk;
13-
14-
15-void qrk::setBaseVolume(size_t percent)
16-{
17- static_cast<void>(percent);
18- // !!!
19-}
20-
21-
22-void qrk::setBaseVolume(BackMusic* back_music, size_t percent)
23-{
24- static_cast<void>(back_music);
25- static_cast<void>(percent);
26- // !!!
27-}
28-
29-
30-void qrk::setBaseVolume(SoundEffect* sound_effect, size_t percent)
31-{
32- static_cast<void>(sound_effect);
33- static_cast<void>(percent);
34- // !!!
35-}
Deleted: svn:keywords
## -1 +0,0 ##
-Id Date Author Rev URL
\ No newline at end of property
--- trunk/libs/audio/sdl_mixer/BackMusic.cpp (revision 1964)
+++ trunk/libs/audio/sdl_mixer/BackMusic.cpp (revision 1965)
@@ -120,7 +120,6 @@
120120
121121 void BackMusic::setMute(bool is_mute)
122122 {
123- pimpl->is_mute_ = is_mute;
124123 if (is_mute) {
125124 int saved_mix_volume = pimpl->mix_volume_;
126125 setVolume(0);
@@ -129,6 +128,7 @@
129128 // ミュートする前の音量で再生を再開する
130129 setVolume(pimpl->mix_volume_);
131130 }
131+ pimpl->is_mute_ = is_mute;
132132 }
133133
134134
--- trunk/libs/audio/sdl_mixer/SoundEffect.cpp (revision 1964)
+++ trunk/libs/audio/sdl_mixer/SoundEffect.cpp (revision 1965)
@@ -116,7 +116,7 @@
116116 (percent_ / 100.0) *
117117 (master_percent_ / 100.0));
118118 first_mix_volume_ = mix_volume;
119- if (isPlaying() && !is_mute_) {
119+ if (isPlaying()) {
120120 Mix_Volume(channel_id_, mix_volume);
121121 }
122122 }
@@ -141,13 +141,16 @@
141141
142142 void SoundEffect::setMute(bool is_mute)
143143 {
144- pimpl->is_mute_ = is_mute;
145144 if (is_mute) {
145+ int saved_master_percent = pimpl->master_percent_;
146146 Mix_Volume(-1, 0);
147+ setMasterVolume(0);
148+ pimpl->master_percent_ = saved_master_percent;
147149 } else {
148150 // ミュートする前の音量で再生を再開する
149151 setMasterVolume(pimpl->master_percent_);
150152 }
153+ pimpl->is_mute_ = is_mute;
151154 }
152155
153156
@@ -181,6 +184,10 @@
181184 static_cast<void>(y);
182185 static_cast<void>(z);
183186
187+ if (pimpl->is_mute_) {
188+ return;
189+ }
190+
184191 // !!! 余力があれば SDL_mixer の Effect を適用してもよい
185192
186193 if (!pimpl->audio_.isInitialized()) {
--- trunk/libs/audio/sdl_mixer/Makefile (revision 1964)
+++ trunk/libs/audio/sdl_mixer/Makefile (revision 1965)
@@ -26,7 +26,6 @@
2626 $(AUDIO_SDL_LIB)(SdlMixerInit.o) \
2727 $(AUDIO_SDL_LIB)(SdlCdromInit.o) \
2828 $(AUDIO_SDL_LIB)(Audio.o) \
29- $(AUDIO_SDL_LIB)(Volume.o) \
3029 $(AUDIO_SDL_LIB)(SoundEffect.o) \
3130 $(AUDIO_SDL_LIB)(BackMusic.o) \
3231 $(AUDIO_SDL_LIB)(CdPlayer.o) \
--- trunk/libs/audio/open_al/Volume.cpp (revision 1964)
+++ trunk/libs/audio/open_al/Volume.cpp (nonexistent)
@@ -1,13 +0,0 @@
1-/*!
2- \file
3- \brief ボリューム管理
4-
5- \author Satofumi KAMIMURA
6-
7- $Id$
8-*/
9-
10-#include "Volume.h"
11-
12-
13-// !!!
Deleted: svn:keywords
## -1 +0,0 ##
-Id Date Author Rev URL
\ No newline at end of property
--- trunk/libs/audio/open_al/Makefile (revision 1964)
+++ trunk/libs/audio/open_al/Makefile (revision 1965)
@@ -23,7 +23,6 @@
2323 ######################################################################
2424 $(AUDIO_AL_LIB) : \
2525 $(AUDIO_AL_LIB)(Audio.o) \
26- $(AUDIO_AL_LIB)(Volume.o) \
2726 $(AUDIO_AL_LIB)(SoundEffect.o) \
2827
2928 # DO NOT DELETE
旧リポジトリブラウザで表示