Removed wxMMedia
Added wxMMedia2: it should work on linux (wave read/write, aiff read only) I begin to write windows driver now Added some file to filelist.txt Make configure build wxMMedia2 makefiles git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3381 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
109
utils/wxMMedia2/lib/sndbase.cpp
Normal file
109
utils/wxMMedia2/lib/sndbase.cpp
Normal file
@@ -0,0 +1,109 @@
|
||||
// --------------------------------------------------------------------------
|
||||
// Name: sndbase.cpp
|
||||
// Purpose:
|
||||
// Date: 08/11/1999
|
||||
// Author: Guilhem Lavaux <lavaux@easynet.fr> (C) 1999
|
||||
// CVSID: $Id$
|
||||
// --------------------------------------------------------------------------
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "sndbase.cpp"
|
||||
#endif
|
||||
|
||||
#include "sndbase.h"
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// wxSoundFormatBase
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
wxSoundFormatBase::wxSoundFormatBase()
|
||||
{
|
||||
}
|
||||
|
||||
wxSoundFormatBase::~wxSoundFormatBase()
|
||||
{
|
||||
}
|
||||
|
||||
wxSoundFormatBase *wxSoundFormatBase::Clone() const
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool wxSoundFormatBase::operator!=(const wxSoundFormatBase& frmt2) const
|
||||
{
|
||||
return (GetType() != frmt2.GetType());
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// wxSoundStream
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
wxSoundStream::wxSoundStream()
|
||||
{
|
||||
int i;
|
||||
|
||||
m_sndformat = NULL;
|
||||
m_handler = NULL;
|
||||
m_snderror = wxSOUND_NOERR;
|
||||
m_lastcount = 0;
|
||||
for (i=0;i<2;i++)
|
||||
m_callback[i] = NULL;
|
||||
}
|
||||
|
||||
wxSoundStream::~wxSoundStream()
|
||||
{
|
||||
if (m_sndformat)
|
||||
delete m_sndformat;
|
||||
}
|
||||
|
||||
// SetSoundFormat returns TRUE when the format can be handled.
|
||||
bool wxSoundStream::SetSoundFormat(const wxSoundFormatBase& format)
|
||||
{
|
||||
if (m_sndformat)
|
||||
delete m_sndformat;
|
||||
|
||||
m_sndformat = format.Clone();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Register a callback for a specified async event.
|
||||
void wxSoundStream::Register(int evt, wxSoundCallback cbk, char *cdata)
|
||||
{
|
||||
int c;
|
||||
|
||||
switch (evt) {
|
||||
case wxSOUND_INPUT:
|
||||
c = 0;
|
||||
break;
|
||||
case wxSOUND_OUTPUT:
|
||||
c = 1;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
m_callback[c] = cbk;
|
||||
m_cdata[c] = cdata;
|
||||
}
|
||||
|
||||
void wxSoundStream::OnSoundEvent(int evt)
|
||||
{
|
||||
int c;
|
||||
|
||||
if (m_handler) {
|
||||
m_handler->OnSoundEvent(evt);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (evt) {
|
||||
case wxSOUND_INPUT:
|
||||
c = 0;
|
||||
break;
|
||||
case wxSOUND_OUTPUT:
|
||||
c = 1;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
if (m_callback[c])
|
||||
m_callback[c](this, evt, m_cdata[c]);
|
||||
}
|
Reference in New Issue
Block a user