summaryrefslogtreecommitdiff
path: root/library/sound.cpp
authoreilers <eilers>2003-08-08 14:45:49 (UTC)
committer eilers <eilers>2003-08-08 14:45:49 (UTC)
commit14d394e6c107b037a09a31a92605034fe50f7813 (patch) (unidiff)
tree800699cf4dc9681c3eb023340634dd6a15fd04c8 /library/sound.cpp
parentdbc6ea35f5535a1f69deb7ebbafc0f721721dbf2 (diff)
downloadopie-14d394e6c107b037a09a31a92605034fe50f7813.zip
opie-14d394e6c107b037a09a31a92605034fe50f7813.tar.gz
opie-14d394e6c107b037a09a31a92605034fe50f7813.tar.bz2
Merged branches from BRANCH_1_0
Diffstat (limited to 'library/sound.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/sound.cpp31
1 files changed, 27 insertions, 4 deletions
diff --git a/library/sound.cpp b/library/sound.cpp
index 1ff3b3f..c8704f9 100644
--- a/library/sound.cpp
+++ b/library/sound.cpp
@@ -106,7 +106,7 @@ public:
106 QSound ( Resource::findSound ( name )), 106 QSound ( Resource::findSound ( name )),
107 filename ( Resource::findSound ( name )) 107 filename ( Resource::findSound ( name ))
108 { 108 {
109 loopsleft=0; 109 loopsleft=0;
110 ms = WAVsoundDuration(filename); 110 ms = WAVsoundDuration(filename);
111 } 111 }
112 112
@@ -128,10 +128,10 @@ public:
128 loopsleft = 0; 128 loopsleft = 0;
129 return; 129 return;
130 } 130 }
131 } 131 }
132 play(); 132 play();
133 } 133 }
134 134
135 bool isFinished ( ) const 135 bool isFinished ( ) const
136 { 136 {
137 return ( loopsleft == 0 ); 137 return ( loopsleft == 0 );
@@ -145,6 +145,9 @@ private:
145 145
146#endif 146#endif
147 147
148/*! Opens a wave sound file \a name for playing
149 * Resource is used for finding the file
150 **/
148Sound::Sound(const QString& name) 151Sound::Sound(const QString& name)
149{ 152{
150#ifndef QT_NO_SOUND 153#ifndef QT_NO_SOUND
@@ -152,6 +155,7 @@ Sound::Sound(const QString& name)
152#endif 155#endif
153} 156}
154 157
158/*! Destroys the sound */
155Sound::~Sound() 159Sound::~Sound()
156{ 160{
157#ifndef QT_NO_SOUND 161#ifndef QT_NO_SOUND
@@ -159,6 +163,7 @@ Sound::~Sound()
159#endif 163#endif
160} 164}
161 165
166/*! Play the sound once */
162void Sound::play() 167void Sound::play()
163{ 168{
164#ifndef QT_NO_SOUND 169#ifndef QT_NO_SOUND
@@ -166,6 +171,7 @@ void Sound::play()
166#endif 171#endif
167} 172}
168 173
174/*! Play the sound, repeatedly until stop() is called */
169void Sound::playLoop() 175void Sound::playLoop()
170{ 176{
171#ifndef QT_NO_SOUND 177#ifndef QT_NO_SOUND
@@ -174,6 +180,7 @@ void Sound::playLoop()
174#endif 180#endif
175} 181}
176 182
183/*! Do not repeat the sound after it finishes. This will end a playLoop() */
177void Sound::stop() 184void Sound::stop()
178{ 185{
179#ifndef QT_NO_SOUND 186#ifndef QT_NO_SOUND
@@ -190,9 +197,25 @@ bool Sound::isFinished() const
190#endif 197#endif
191} 198}
192 199
200/*! Sounds the audible system alarm. This is used for applications such
201 as Calendar when it needs to alarm the user of an event.
202*/
193void Sound::soundAlarm() 203void Sound::soundAlarm()
194{ 204{
195#ifndef QT_NO_COP 205#ifndef QT_NO_COP
196 QCopEnvelope( "QPE/TaskBar", "soundAlarm()" ); 206 QCopEnvelope( "QPE/TaskBar", "soundAlarm()" );
197#endif 207#endif
198} 208}
209
210
211/*! \class Sound
212 \brief The Sound class plays WAVE sound files and can invoke the audible alarm.
213
214 The Sound class is constructed with the .wav music file name. The Sound
215 class retrieves the sound file from the shared Resource class. This class
216 ties together QSound and the available sound resources.
217
218 To sound an audible system alarm, call the static method soundAlarm()
219
220 \ingroup qtopiaemb
221*/