-rw-r--r-- | library/sound.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/library/sound.cpp b/library/sound.cpp index 602fcf0..1ff3b3f 100644 --- a/library/sound.cpp +++ b/library/sound.cpp | |||
@@ -108,4 +108,5 @@ public: | |||
108 | { | 108 | { |
109 | loopsleft=0; | 109 | loopsleft=0; |
110 | ms = WAVsoundDuration(filename); | ||
110 | } | 111 | } |
111 | 112 | ||
@@ -115,5 +116,4 @@ public: | |||
115 | loopsleft = loopcnt; | 116 | loopsleft = loopcnt; |
116 | 117 | ||
117 | int ms = WAVsoundDuration(filename); | ||
118 | if ( ms ) | 118 | if ( ms ) |
119 | startTimer(ms > 50 ? ms-50 : 0); // 50 for latency | 119 | startTimer(ms > 50 ? ms-50 : 0); // 50 for latency |
@@ -124,8 +124,10 @@ public: | |||
124 | { | 124 | { |
125 | if (loopsleft >= 0) { | 125 | if (loopsleft >= 0) { |
126 | if (--loopsleft <= 0) | 126 | if ( --loopsleft <= 0 ) { |
127 | killTimer (e->timerId()); | 127 | killTimer (e->timerId()); |
128 | loopsleft = 0; | ||
128 | return; | 129 | return; |
129 | } | 130 | } |
131 | } | ||
130 | play(); | 132 | play(); |
131 | } | 133 | } |
@@ -139,5 +141,7 @@ private: | |||
139 | QString filename; | 141 | QString filename; |
140 | int loopsleft; | 142 | int loopsleft; |
143 | int ms; | ||
141 | }; | 144 | }; |
145 | |||
142 | #endif | 146 | #endif |
143 | 147 | ||
@@ -159,5 +163,4 @@ void Sound::play() | |||
159 | { | 163 | { |
160 | #ifndef QT_NO_SOUND | 164 | #ifndef QT_NO_SOUND |
161 | d->killTimers(); | ||
162 | d->playLoop(1); | 165 | d->playLoop(1); |
163 | #endif | 166 | #endif |
@@ -183,4 +186,6 @@ bool Sound::isFinished() const | |||
183 | #ifndef QT_NO_SOUND | 186 | #ifndef QT_NO_SOUND |
184 | return d->isFinished(); | 187 | return d->isFinished(); |
188 | #else | ||
189 | return true; | ||
185 | #endif | 190 | #endif |
186 | } | 191 | } |