]> git.saurik.com Git - wxWidgets.git/blob - interface/sound.h
make it callable from any path
[wxWidgets.git] / interface / sound.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: sound.h
3 // Purpose: documentation for wxSound class
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @class wxSound
11 @wxheader{sound.h}
12
13 This class represents a short sound (loaded from Windows WAV file), that
14 can be stored in memory and played. Currently this class is implemented
15 on Windows and Unix (and uses either
16 Open Sound System or
17 Simple DirectMedia Layer).
18
19 @library{wxadv}
20 @category{FIXME}
21 */
22 class wxSound : public wxObject
23 {
24 public:
25 //@{
26 /**
27 Constructs a wave object from a file or, under Windows, from a Windows
28 resource. Call IsOk() to determine whether this
29 succeeded.
30
31 @param fileName
32 The filename or Windows resource.
33
34 @param isResource
35 @true if fileName is a resource, @false if it is a filename.
36 */
37 wxSound();
38 wxSound(const wxString& fileName, bool isResource = @false);
39 //@}
40
41 /**
42 Destroys the wxSound object.
43 */
44 ~wxSound();
45
46 /**
47 Constructs a wave object from a file or resource.
48
49 @param fileName
50 The filename or Windows resource.
51
52 @param isResource
53 @true if fileName is a resource, @false if it is a filename.
54
55 @returns @true if the call was successful, @false otherwise.
56 */
57 bool Create(const wxString& fileName, bool isResource = @false);
58
59 /**
60 Returns @true if the object contains a successfully loaded file or resource,
61 @false otherwise.
62 */
63 #define bool IsOk() /* implementation is private */
64
65 /**
66 Returns @true if a sound is played at the moment.
67
68 This method is currently not implemented under Windows.
69 */
70 static bool IsPlaying();
71
72 //@{
73 /**
74 Plays the sound file. If another sound is playing, it will be interrupted.
75 Returns @true on success, @false otherwise. Note that in general it is
76 possible
77 to delete the object which is being asynchronously played any time after
78 calling this function and the sound would continue playing, however this
79 currently doesn't work under Windows for sound objects loaded from memory data.
80
81 The possible values for @e flags are:
82
83 wxSOUND_SYNC
84
85
86 @c Play will block and wait until the sound is
87 replayed.
88
89 wxSOUND_ASYNC
90
91
92 Sound is played asynchronously,
93 @c Play returns immediately
94
95 wxSOUND_ASYNC | wxSOUND_LOOP
96
97
98 Sound is played asynchronously
99 and loops until another sound is played,
100 Stop() is called or the program terminates.
101
102 The static form is shorthand for this code:
103 */
104 bool Play(unsigned flags = wxSOUND_ASYNC);
105 static bool Play(const wxString& filename,
106 unsigned flags = wxSOUND_ASYNC);
107 //@}
108
109 /**
110 If a sound is played, this function stops it.
111 */
112 static void Stop();
113 };