]> git.saurik.com Git - wxWidgets.git/blobdiff - contrib/src/mmedia/sndesd.cpp
Typos fixed and further clarification of the Python situation on Panther
[wxWidgets.git] / contrib / src / mmedia / sndesd.cpp
index 74a55b63c2de06f283c9bd3fa05f51a49bd6a887..f149f430518322a7885482020152b9bdfe872564 100644 (file)
@@ -32,6 +32,7 @@
 // System headers
 // --------------------------------------------------------------------------
 
+#ifdef HAVE_ESD_H
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
@@ -39,6 +40,7 @@
 #ifdef __WXGTK__
 #include <gdk/gdk.h>
 #endif
+#endif
 
 // --------------------------------------------------------------------------
 
 
 wxSoundStreamESD::wxSoundStreamESD(const wxString& hostname)
 {
+#ifndef HAVE_ESD_H
+    m_snderror = wxSOUND_INVDEV;
+    return;
+#else
     wxSoundFormatPcm pcm_default;
     
     // First, we make some basic test: is there ESD on this computer ?
@@ -85,12 +91,15 @@ wxSoundStreamESD::wxSoundStreamESD(const wxString& hostname)
     m_esd_ok   = TRUE;
     m_fd_output= -1;
     m_fd_input = -1;
+#endif // defined HAVE_ESD_H
 }
 
 wxSoundStreamESD::~wxSoundStreamESD()
 {
+#ifdef HAVE_ESD_H
     if (!m_esd_stop)
         StopProduction();
+#endif // defined HAVE_ESD_H
 }
 
 // --------------------------------------------------------------------------
@@ -99,6 +108,10 @@ wxSoundStreamESD::~wxSoundStreamESD()
 
 wxSoundStream& wxSoundStreamESD::Read(void *buffer, wxUint32 len)
 {
+#ifndef HAVE_ESD_H
+    m_snderror = wxSOUND_INVDEV;
+    return *this;
+#else
     int ret;
     
     if (m_esd_stop) {
@@ -114,6 +127,7 @@ wxSoundStream& wxSoundStreamESD::Read(void *buffer, wxUint32 len)
         m_snderror = wxSOUND_NOERROR;
     
     return *this;
+#endif // defined HAVE_ESD_H
 }
 
 // --------------------------------------------------------------------------
@@ -121,6 +135,10 @@ wxSoundStream& wxSoundStreamESD::Read(void *buffer, wxUint32 len)
 // --------------------------------------------------------------------------
 wxSoundStream& wxSoundStreamESD::Write(const void *buffer, wxUint32 len)
 {
+#ifndef HAVE_ESD_H
+    m_snderror = wxSOUND_INVDEV;
+    return *this;
+#else
     int ret;
 
     if (m_esd_stop) {
@@ -139,6 +157,7 @@ wxSoundStream& wxSoundStreamESD::Write(const void *buffer, wxUint32 len)
     m_q_filled = TRUE;
     
     return *this;
+#endif // defined HAVE_ESD_H
 }
 
 // --------------------------------------------------------------------------
@@ -147,6 +166,10 @@ wxSoundStream& wxSoundStreamESD::Write(const void *buffer, wxUint32 len)
 // --------------------------------------------------------------------------
 bool wxSoundStreamESD::SetSoundFormat(const wxSoundFormatBase& format)
 {
+#ifndef HAVE_ESD_H
+    m_snderror = wxSOUND_INVDEV;
+    return FALSE;
+#else
     wxSoundFormatPcm *pcm_format;
     
     if (format.GetType() != wxSOUND_PCM) {
@@ -178,13 +201,14 @@ bool wxSoundStreamESD::SetSoundFormat(const wxSoundFormatBase& format)
         return FALSE;
     }
     return TRUE;
+#endif // defined HAVE_ESD_H
 }
 
 // --------------------------------------------------------------------------
 // _wxSound_OSS_CBack (internal): it is called when the driver (ESD) is
 // ready for a next buffer.
 // --------------------------------------------------------------------------
-#ifdef __WXGTK__
+#if defined(__WXGTK__) && defined(HAVE_ESD_H)
 static void _wxSound_OSS_CBack(gpointer data, int source,
                                GdkInputCondition condition)
 {
@@ -219,6 +243,10 @@ void wxSoundStreamESD::WakeUpEvt(int evt)
 // --------------------------------------------------------------------------
 bool wxSoundStreamESD::StartProduction(int evt)
 {
+#ifndef HAVE_ESD_H
+    m_snderror = wxSOUND_INVDEV;
+    return FALSE;
+#else
     wxSoundFormatPcm *pcm;
     int flag = 0;
 
@@ -262,6 +290,7 @@ bool wxSoundStreamESD::StartProduction(int evt)
     m_q_filled = FALSE;
     
     return TRUE;
+#endif // defined HAVE_ESD_H
 }
 
 // --------------------------------------------------------------------------
@@ -269,6 +298,10 @@ bool wxSoundStreamESD::StartProduction(int evt)
 // --------------------------------------------------------------------------
 bool wxSoundStreamESD::StopProduction()
 {
+#ifndef HAVE_ESD_H
+    m_snderror = wxSOUND_INVDEV;
+    return FALSE;
+#else
     if (m_esd_stop)
         return FALSE;
     
@@ -290,6 +323,7 @@ bool wxSoundStreamESD::StopProduction()
     m_esd_stop = TRUE;
     m_q_filled = TRUE;
     return TRUE;
+#endif // defined HAVE_ESD_H
 }
 
 //
@@ -297,6 +331,10 @@ bool wxSoundStreamESD::StopProduction()
 //
 void wxSoundStreamESD::DetectBest(wxSoundFormatPcm *pcm)
 {
+#ifndef HAVE_ESD_H
+    m_snderror = wxSOUND_INVDEV;
+    return;
+#else
     wxSoundFormatPcm best_pcm;
 
     // We change neither the number of channels nor the sample rate
@@ -316,4 +354,6 @@ void wxSoundStreamESD::DetectBest(wxSoundFormatPcm *pcm)
     
     // Finally recopy the new format
     *pcm = best_pcm;
+#endif // defined HAVE_ESD_H
 }
+