]>
git.saurik.com Git - wxWidgets.git/blob - contrib/src/mmedia/sndbase.cpp
1 // --------------------------------------------------------------------------
5 // Author: Guilhem Lavaux <lavaux@easynet.fr> (C) 1999, 2000
7 // --------------------------------------------------------------------------
9 #pragma implementation "sndbase.cpp"
12 #include <wx/wxprec.h>
13 #include "wx/mmedia/sndbase.h"
16 // ---------------------------------------------------------------------------
18 // ---------------------------------------------------------------------------
20 wxSoundFormatBase::wxSoundFormatBase()
24 wxSoundFormatBase::~wxSoundFormatBase()
28 wxSoundFormatBase
*wxSoundFormatBase::Clone() const
33 bool wxSoundFormatBase::operator!=(const wxSoundFormatBase
& frmt2
) const
35 return (GetType() != frmt2
.GetType());
38 // ---------------------------------------------------------------------------
40 // ---------------------------------------------------------------------------
42 wxSoundStream::wxSoundStream()
46 // Reset all variables to their neutral value.
49 m_snderror
= wxSOUND_NOERROR
;
55 wxSoundStream::~wxSoundStream()
61 // --------------------------------------------------------------------------
62 // SetSoundFormat(const wxSoundFormatBase& format) is one of the most
63 // important function of the wxSoundStream class. It prepares the stream to
64 // receive or send the data in a strict format. Normally, the sound stream
65 // should be ready to accept any format it is asked to manage but in certain
66 // cases, it really cannot: in that case it returns FALSE. To have more
67 // details in the functionnalities of SetSoundFormat see
68 // wxSoundRouterStream::SetSoundFormat()
69 // --------------------------------------------------------------------------
70 bool wxSoundStream::SetSoundFormat(const wxSoundFormatBase
& format
)
72 // delete the previous prepared format
76 // create a new one by cloning the format passed in parameter
77 m_sndformat
= format
.Clone();
82 // --------------------------------------------------------------------------
83 // Register(int evt, ...) registers the callback for a specified async event.
84 // Warning ! Only one callback by event is supported. It means that if you
85 // call twice this function the previous registered callback is absolutely
87 // --------------------------------------------------------------------------
88 void wxSoundStream::SetCallback(int evt
, wxSoundCallback cbk
, void *cdata
)
106 // --------------------------------------------------------------------------
107 // OnSoundEvent(int evt) is called either when the driver is ready to receive
108 // a new block to play or when the driver has a new recorded buffer. You
109 // must be careful here and try not to spend a lot of time: this is a
110 // real-time call. In the case, an "event handler" was specified previously,
111 // it called him before everything.
112 // --------------------------------------------------------------------------
113 void wxSoundStream::OnSoundEvent(int evt
)
118 m_handler
->OnSoundEvent(evt
);
133 m_callback
[c
](this, evt
, m_cdata
[c
]);