1QSound(3qt) QSound(3qt)
2
3
4
6 QSound - Access to the platform audio facilities
7
9 #include <qsound.h>
10
11 Inherits QObject.
12
13 Public Members
14 QSound ( const QString & filename, QObject * parent = 0, const char *
15 name = 0 )
16 ~QSound ()
17 int loops () const
18 int loopsRemaining () const
19 void setLoops ( int l )
20 QString fileName () const
21 bool isFinished () const
22
23 Public Slots
24 void play ()
25 void stop ()
26
27 Static Public Members
28 bool isAvailable ()
29 void play ( const QString & filename )
30 bool available ()
31
33 The QSound class provides access to the platform audio facilities.
34
35 Qt provides the most commonly required audio operation in GUI
36 applications: asynchronously playing a sound file. This is most easily
37 accomplished with a single call:
38
39 QSound::play("mysounds/bells.wav");
40
41 A second API is provided in which a QSound object is created from a
42 sound file and is played later:
43
44 QSound bells("mysounds/bells.wav");
45 bells.play();
46
47 Sounds played using the second model may use more memory but play more
48 immediately than sounds played using the first model, depending on the
49 underlying platform audio facilities.
50
51 On Microsoft Windows the underlying multimedia system is used; only
52 WAVE format sound files are supported.
53
54 On X11 the Network Audio System is used if available, otherwise all
55 operations work silently. NAS supports WAVE and AU files.
56
57 On Macintosh, ironically, we use QT (QuickTime) for sound, this means
58 all QuickTime formats are supported by Qt/Mac.
59
60 On Qt/Embedded, a built-in mixing sound server is used, which accesses
61 /dev/dsp directly. Only the WAVE format is supported.
62
63 The availability of sound can be tested with QSound::isAvailable().
64
65 See also Multimedia Classes.
66
69 name = 0 )
70 Constructs a QSound that can quickly play the sound in a file named
71 filename.
72
73 This may use more memory than the static play function.
74
75 The parent and name arguments (default 0) are passed on to the QObject
76 constructor.
77
79 Destroys the sound object. If the sound is not finished playing stop()
80 is called on it.
81
82 See also stop() and isFinished().
83
85 Returns TRUE if sound support is available; otherwise returns FALSE.
86
88 Returns the filename associated with the sound.
89
91 Returns TRUE if sound facilities exist on the platform; otherwise
92 returns FALSE. An application may choose either to notify the user if
93 sound is crucial to the application or to operate silently without
94 bothering the user.
95
96 If no sound is available, all QSound operations work silently and
97 quickly.
98
100 Returns TRUE if the sound has finished playing; otherwise returns
101 FALSE.
102
103 Warning: On Windows this function always returns TRUE for unlooped
104 sounds.
105
107 Returns the number of times the sound will play.
108
110 Returns the number of times the sound will loop. This value decreases
111 each time the sound loops.
112
114 Plays the sound in a file called filename.
115
116 Example: sound/sound.cpp.
117
119 This is an overloaded member function, provided for convenience. It
120 behaves essentially like the above function.
121
122 Starts the sound playing. The function returns immediately. Depending
123 on the platform audio facilities, other sounds may stop or may be mixed
124 with the new sound.
125
126 The sound can be played again at any time, possibly mixing or replacing
127 previous plays of the sound.
128
130 Sets the sound to repeat l times when it is played. Passing the value
131 -1 will cause the sound to loop indefinitely.
132
133 See also loops().
134
136 Stops the sound playing.
137
138 On Windows the current loop will finish if a sound is played in a loop.
139
140 See also play().
141
142
144 http://doc.trolltech.com/qsound.html
145 http://www.trolltech.com/faq/tech.html
146
148 Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
149 license file included in the distribution for a complete license
150 statement.
151
153 Generated automatically from the source code.
154
156 If you find a bug in Qt, please report it as described in
157 http://doc.trolltech.com/bughowto.html. Good bug reports help us to
158 help you. Thank you.
159
160 The definitive Qt documentation is provided in HTML format; it is
161 located at $QTDIR/doc/html and can be read using Qt Assistant or with a
162 web browser. This man page is provided as a convenience for those users
163 who prefer man pages, although this format is not officially supported
164 by Trolltech.
165
166 If you find errors in this manual page, please report them to qt-
167 bugs@trolltech.com. Please include the name of the manual page
168 (qsound.3qt) and the Qt version (3.3.8).
169
170
171
172Trolltech AS 2 February 2007 QSound(3qt)