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