• R/O
  • SSH
  • HTTPS

qrobosdk: コミット


コミットメタ情報

リビジョン1957 (tree)
日時2011-07-28 08:13:30
作者satofumi

ログメッセージ

fixed audio class API

変更サマリ

差分

--- trunk/libs/lua/luabindAudio.cpp (revision 1956)
+++ trunk/libs/lua/luabindAudio.cpp (revision 1957)
@@ -8,6 +8,9 @@
88 */
99
1010 #include "luabindAudio.h"
11+#include "LuaHandler.h"
12+#include "Audio.h"
13+#include "BackMusic.h"
1114 #include "SoundEffect.h"
1215 #include <luabind/luabind.hpp>
1316
@@ -19,10 +22,28 @@
1922 {
2023 module(L)
2124 [
25+ class_<Audio>("Audio")
26+ .def(constructor<>())
27+ .def("what", &Audio::what)
28+ .def("initialize", &Audio::initialize)
29+ .def("isInitialized", &Audio::isInitialized),
30+
31+ class_<BackMusic>("BackMusic")
32+ .def(constructor<>())
33+ .def("setVolume", &BackMusic::setVolume)
34+ .def("play", &BackMusic::play)
35+ .def("stop", &BackMusic::stop)
36+ .def("isPlaying", &BackMusic::isPlaying),
37+
2238 class_<SoundEffect>("SoundEffect")
2339 .def(constructor<const char*>())
40+ .def("setDefaultVolume", &SoundEffect::setDefaultVolume)
41+ .def("setVolume", &SoundEffect::setVolume)
2442 .def("play", &SoundEffect::play)
2543 .def("updatePosition", &SoundEffect::updatePosition)
2644 .def("isPlaying", &SoundEffect::isPlaying)
2745 ];
46+
47+ LuaHandler::registerValue(L, "BackMusic_Instantly", BackMusic::Instantly);
48+ LuaHandler::registerValue(L, "BackMusic_Infinity", BackMusic::Infinity);
2849 }
--- trunk/libs/lua/luabindGui.cpp (revision 1956)
+++ trunk/libs/lua/luabindGui.cpp (revision 1957)
@@ -224,7 +224,12 @@
224224 .def("release", (void(Menu::*)(void))&Menu::release)
225225 .def("index", &Menu::index)
226226 .def("isClicked", &Menu::isClicked)
227- .def("clickedId", &Menu::clickedId),
227+ .def("clickedId", &Menu::clickedId)
228+ .def("clickedIndex", &Menu::clickedIndex)
229+ .def("registerIconLabel", &Menu::registerIconLabel)
230+ .def("unregisterIconLabel", &Menu::unregisterIconLabel)
231+ .def("setIconOffset", &Menu::setIconOffset)
232+ .def("connectPressedEvent", &Menu::connectPressedEvent),
228233
229234 class_<ChatMessage, Component>("ChatMessage")
230235 .def(constructor<Font&, const Rect<long>&>())
--- trunk/libs/gui/Menu.h (revision 1956)
+++ trunk/libs/gui/Menu.h (revision 1957)
@@ -12,7 +12,6 @@
1212
1313 #include "Component.h"
1414 #include <boost/signals.hpp>
15-#include <boost/integer_traits.hpp>
1615
1716
1817 namespace qrk
--- trunk/libs/audio/sdl_mixer/SdlMixerInit.h (revision 1956)
+++ trunk/libs/audio/sdl_mixer/SdlMixerInit.h (revision 1957)
@@ -28,11 +28,9 @@
2828 SdlMixerInit(void);
2929 ~SdlMixerInit(void);
3030
31-
3231 //! システムの初期化
3332 bool initialize(void);
3433
35-
3634 bool isInitialized(void);
3735 };
3836 }
--- trunk/libs/audio/sdl_mixer/Audio.cpp (revision 1956)
+++ trunk/libs/audio/sdl_mixer/Audio.cpp (revision 1957)
@@ -16,7 +16,7 @@
1616 using namespace std;
1717
1818
19-struct Audio::pImpl : public SdlMixerInit
19+struct Audio::pImpl : private SdlMixerInit
2020 {
2121 string error_message_;
2222
@@ -24,6 +24,18 @@
2424 pImpl(void) : error_message_(Mix_GetError())
2525 {
2626 }
27+
28+
29+ bool initialize(void)
30+ {
31+ return SdlMixerInit::initialize();
32+ }
33+
34+
35+ bool isInitialized(void)
36+ {
37+ return SdlMixerInit::isInitialized();
38+ }
2739 };
2840
2941
--- trunk/libs/audio/sdl_mixer/BackMusic.cpp (revision 1956)
+++ trunk/libs/audio/sdl_mixer/BackMusic.cpp (revision 1957)
@@ -38,3 +38,36 @@
3838 BackMusic::~BackMusic(void)
3939 {
4040 }
41+
42+
43+void BackMusic::setVolume(size_t percent)
44+{
45+ (void)percent;
46+ // !!!
47+}
48+
49+
50+bool BackMusic::play(const char* file_path, int fade_in_msec,
51+ int play_times, int fade_out_msec)
52+{
53+ (void)file_path;
54+ (void)fade_in_msec;
55+ (void)play_times;
56+ (void)fade_out_msec;
57+ // !!!
58+ return false;
59+}
60+
61+
62+void BackMusic::stop(int fade_out_msec)
63+{
64+ (void)fade_out_msec;
65+ // !!!
66+}
67+
68+
69+bool BackMusic::isPlaying(void) const
70+{
71+ // !!!
72+ return false;
73+}
--- trunk/libs/audio/sdl_mixer/SoundEffect.cpp (revision 1956)
+++ trunk/libs/audio/sdl_mixer/SoundEffect.cpp (revision 1957)
@@ -89,6 +89,13 @@
8989 }
9090
9191
92+void SoundEffect::setDefaultVolume(size_t percent)
93+{
94+ (void)percent;
95+ // !!!
96+}
97+
98+
9299 void SoundEffect::setVolume(size_t percent)
93100 {
94101 if (! pimpl->audio_.isInitialized()) {
@@ -127,7 +134,7 @@
127134 }
128135
129136
130-bool SoundEffect::isPlaying(void)
137+bool SoundEffect::isPlaying(void) const
131138 {
132139 if (! pimpl->audio_.isInitialized()) {
133140 return false;
--- trunk/libs/audio/BackMusic.h (revision 1956)
+++ trunk/libs/audio/BackMusic.h (revision 1957)
@@ -10,17 +10,36 @@
1010 $Id$
1111 */
1212
13+#include <cstddef>
1314
15+
1416 namespace qrk
1517 {
1618 class BackMusic
1719 {
1820 public:
21+ enum {
22+ Instantly = -1,
23+ Infinity = -1,
24+ };
25+
1926 BackMusic(void);
2027 ~BackMusic(void);
2128
22- // !!!
29+ void setVolume(size_t percent);
2330
31+ /*!
32+ \brief 曲を再生する
33+
34+ 他の曲を再生中の場合、再生中の曲を fade_out_msec の時間をかけて fade out してから指定した曲の再生を開始する。
35+ */
36+ bool play(const char* file_path, int fade_in_msec = Instantly,
37+ int play_times = Infinity, int fade_out_msec = Instantly);
38+
39+ void stop(int fade_out_msec = Instantly);
40+
41+ bool isPlaying(void) const;
42+
2443 private:
2544 BackMusic(const BackMusic& rhs);
2645 BackMusic& operator = (const BackMusic& rhs);
--- trunk/libs/audio/SoundEffect.h (revision 1956)
+++ trunk/libs/audio/SoundEffect.h (revision 1957)
@@ -23,11 +23,12 @@
2323 explicit SoundEffect(const char* play_file);
2424 ~SoundEffect(void);
2525
26+ void setDefaultVolume(size_t percent);
2627 void setVolume(size_t percent);
2728
2829 void play(float x = 0.0, float y = 0.0, float z = 0.1);
2930 void updatePosition(float x, float y, float z = 0.1);
30- bool isPlaying(void);
31+ bool isPlaying(void) const;
3132
3233 private:
3334 SoundEffect(void);
--- trunk/libs/audio/open_al/SoundEffect.cpp (revision 1956)
+++ trunk/libs/audio/open_al/SoundEffect.cpp (revision 1957)
@@ -232,7 +232,7 @@
232232 }
233233
234234
235-bool SoundEffect::isPlaying(void)
235+bool SoundEffect::isPlaying(void) const
236236 {
237237 if (! pimpl->initialized_) {
238238 return false;
--- trunk/programs/ScipPlayer/ScipPlayerWindow.cpp (revision 1956)
+++ trunk/programs/ScipPlayer/ScipPlayerWindow.cpp (revision 1957)
@@ -334,6 +334,10 @@
334334 con_.setReadData("BM\r00P\r\r");
335335 led_on_ = true;
336336 }
337+ if (! first_line.compare(1, 1, "E")) {
338+ fprintf(stderr, "set intensity mode.\n");
339+ urg_.setCaptureMode(IntensityCapture);
340+ }
337341
338342 } else {
339343 // Mx データの読み出し
旧リポジトリブラウザで表示