]> git.saurik.com Git - wxWidgets.git/blobdiff - utils/wxMMedia2/lib/sndesd.cpp
added demo for bitmaps of different size
[wxWidgets.git] / utils / wxMMedia2 / lib / sndesd.cpp
index 79cb1f10b3b6686ac68c33c02323c506b4c2f581..39713d3dd9b0be0e1e77b38d7942a454e7081137 100644 (file)
@@ -28,8 +28,9 @@ wxSoundStreamESD::wxSoundStreamESD(const wxString& hostname)
 {
   wxSoundFormatPcm pcm_default;
 
-  m_fd = esd_monitor_stream(ESD_MONO | ESD_BITS8 | ESD_RECORD, 22050, 
-                            hostname.mb_str(), MY_ESD_NAME);
+  m_fd = esd_play_stream(ESD_PLAY | ESD_STREAM | ESD_MONO | ESD_BITS8, 22050, 
+//                            hostname.mb_str(), MY_ESD_NAME);
+                            NULL, MY_ESD_NAME);
 
   if (m_fd == -1) {
     m_snderror = wxSOUND_INVDEV;
@@ -44,6 +45,7 @@ wxSoundStreamESD::wxSoundStreamESD(const wxString& hostname)
 
   m_snderror = wxSOUND_NOERR;
   m_esd_stop = TRUE;
+  m_q_filled = TRUE;
 }
 
 wxSoundStreamESD::~wxSoundStreamESD()
@@ -52,11 +54,11 @@ wxSoundStreamESD::~wxSoundStreamESD()
     esd_close(m_fd);
 }
 
-wxSoundStream& wxSoundStreamESD::Read(void *buffer, size_t len)
+wxSoundStream& wxSoundStreamESD::Read(void *buffer, wxUint32 len)
 {
   int ret;
 
-  m_lastcount = (size_t)ret = read(m_fd, buffer, len);
+  m_lastcount = (wxUint32)ret = read(m_fd, buffer, len);
 
   if (ret < 0)
     m_snderror = wxSOUND_IOERR;
@@ -66,17 +68,19 @@ wxSoundStream& wxSoundStreamESD::Read(void *buffer, size_t len)
   return *this;
 }
 
-wxSoundStream& wxSoundStreamESD::Write(const void *buffer, size_t len)
+wxSoundStream& wxSoundStreamESD::Write(const void *buffer, wxUint32 len)
 {
   int ret;
 
-  m_lastcount = (size_t)ret = write(m_fd, buffer, len);
+  m_lastcount = (wxUint32)ret = write(m_fd, buffer, len);
 
   if (ret < 0)
     m_snderror = wxSOUND_IOERR;
   else
     m_snderror = wxSOUND_NOERR;
 
+  m_q_filled = TRUE;
+
   return *this;
 }
 
@@ -109,7 +113,7 @@ bool wxSoundStreamESD::SetSoundFormat(const wxSoundFormatBase& format)
 
   m_snderror = wxSOUND_NOERR;
   if (*pcm_format != format) {
-    m_snderror = wxSOUND_NOTEXACT;
+    m_snderror = wxSOUND_NOEXACT;
     return FALSE;
   }
   return TRUE;
@@ -136,6 +140,7 @@ static void _wxSound_OSS_CBack(gpointer data, int source,
 
 void wxSoundStreamESD::WakeUpEvt(int evt)
 {
+  m_q_filled = FALSE;
   OnSoundEvent(evt);
 }
 
@@ -154,11 +159,11 @@ bool wxSoundStreamESD::StartProduction(int evt)
 
   if (evt == wxSOUND_OUTPUT) {
     flag |= ESD_PLAY | ESD_STREAM;
-    m_fd = esd_play_stream(flag, pcm->GetSampleRate(), m_hostname.mb_str(),
+    m_fd = esd_play_stream(flag, pcm->GetSampleRate(), NULL,
                           MY_ESD_NAME);
   } else {
     flag |= ESD_RECORD | ESD_STREAM;
-    m_fd = esd_record_stream(flag, pcm->GetSampleRate(), m_hostname.mb_str(),
+    m_fd = esd_record_stream(flag, pcm->GetSampleRate(), NULL,
                              MY_ESD_NAME);
   }
 
@@ -170,6 +175,7 @@ bool wxSoundStreamESD::StartProduction(int evt)
 #endif
 
   m_esd_stop = FALSE;
+  m_q_filled = FALSE;
 
   return TRUE;
 }
@@ -182,6 +188,7 @@ bool wxSoundStreamESD::StopProduction()
   gdk_input_remove(m_tag);
   esd_close(m_fd);
   m_esd_stop = TRUE;
+  m_q_filled = TRUE;
   return TRUE;
 }