#include "sndfile.h"
#include "sndcpcm.h"
#include "sndulaw.h"
+#include "sndg72x.h"
// --------------------------------------------------------------------------
// Sound codec router
delete m_router;
}
-wxSoundStream& wxSoundRouterStream::Read(void *buffer, size_t len)
+wxSoundStream& wxSoundRouterStream::Read(void *buffer, wxUint32 len)
{
if (m_router) {
m_router->Read(buffer, len);
return *this;
}
-wxSoundStream& wxSoundRouterStream::Write(const void *buffer, size_t len)
+wxSoundStream& wxSoundRouterStream::Write(const void *buffer, wxUint32 len)
{
if (m_router) {
m_router->Write(buffer, len);
m_router = new wxSoundStreamUlaw(*m_sndio);
m_router->SetSoundFormat(format);
break;
+ case wxSOUND_G72X:
+ m_router = new wxSoundStreamG72X(*m_sndio);
+ m_router->SetSoundFormat(format);
+ break;
}
wxSoundStream::SetSoundFormat(m_router->GetSoundFormat());
return TRUE;
if (!PrepareToPlay())
return FALSE;
+ m_state = wxSOUND_FILE_PLAYING;
+
if (!StartProduction(wxSOUND_OUTPUT))
return FALSE;
- m_state = wxSOUND_FILE_PLAYING;
return TRUE;
}
m_len = m_sndformat->GetBytesFromTime(time);
+ m_state = wxSOUND_FILE_RECORDING;
if (!StartProduction(wxSOUND_INPUT))
return FALSE;
- m_state = wxSOUND_FILE_RECORDING;
return TRUE;
}
return TRUE;
}
-wxSoundStream& wxSoundFileStream::Read(void *buffer, size_t len)
+wxSoundStream& wxSoundFileStream::Read(void *buffer, wxUint32 len)
{
m_lastcount = GetData(buffer, len);
return *this;
}
-wxSoundStream& wxSoundFileStream::Write(const void *buffer, size_t len)
+wxSoundStream& wxSoundFileStream::Write(const void *buffer, wxUint32 len)
{
m_lastcount = PutData(buffer, len);
return *this;
void wxSoundFileStream::OnSoundEvent(int evt)
{
- size_t len = m_sndio->GetBestSize();
+ wxUint32 len = m_sndio->GetBestSize();
char *buffer;
- buffer = new char[m_sndio->GetBestSize()];
+ buffer = new char[len];
wxSoundStream::OnSoundEvent(evt);
- switch(evt) {
- case wxSOUND_INPUT:
- if (len > m_len)
- len = m_len;
-
- len = m_codec.Read(buffer, len).GetLastAccess();
- PutData(buffer, len);
- m_len -= len;
- if (m_len == 0) {
- Stop();
- return;
+ while (!m_sndio->QueueFilled()) {
+ switch(evt) {
+ case wxSOUND_INPUT:
+ if (len > m_len)
+ len = m_len;
+
+ len = m_codec.Read(buffer, len).GetLastAccess();
+ PutData(buffer, len);
+ m_len -= len;
+ if (m_len == 0) {
+ Stop();
+ return;
+ }
+ break;
+ case wxSOUND_OUTPUT:
+ len = GetData(buffer, len);
+ if (len == 0) {
+ Stop();
+ return;
+ }
+ m_codec.Write(buffer, len);
+ break;
}
- break;
- case wxSOUND_OUTPUT:
- len = GetData(buffer, len);
- if (len == 0) {
- Stop();
- return;
- }
- m_codec.Write(buffer, len);
- break;
}
delete[] buffer;
}