]> git.saurik.com Git - wxWidgets.git/blobdiff - utils/wxMMedia/snduss.cpp
Fixed gtk 1.0.6 corruped menu entry names.
[wxWidgets.git] / utils / wxMMedia / snduss.cpp
index 9a03817bedc3dced341ff122dca241a6826afb55..a0947d150407fc1400dc2485cf5c902c669a5c7d 100644 (file)
@@ -49,7 +49,8 @@ wxUssSound::~wxUssSound()
       m_sleep_cond.Signal();
       m_sleep_mtx.Unlock();
     }
-    Join();
+    while (IsAlive())
+      Yield();
   }
 
   if (m_fd != -1)
@@ -106,8 +107,6 @@ bool wxUssSound::DoInput(wxSndBuffer *buf)
   wxSoundCodec *codec = buf->GetCurrentCodec();
 
   m_sndbuf->ResetBuffer();
-  codec->SetInStream(m_sndbuf);
-  codec->InitIO(m_ussformat);
 
   bufsize = codec->Available();
   if (bufsize > m_max_bufsize)
@@ -152,11 +151,21 @@ bool wxUssSound::InitBuffer(wxSndBuffer *buf)
   }
 
   codec = buf->GetCurrentCodec();
-  codec->SetOutStream(m_sndbuf);
-  codec->InitIO(m_ussformat);
-  // TODO: We need more tests here.
-  codec->InitMode((m_mode == wxSND_OUTPUT) ? wxSoundCodec::DECODING : wxSoundCodec::ENCODING);
-
+  switch (m_mode) {
+  case wxSND_INPUT:
+    codec->SetInStream(m_sndbuf);
+    codec->InitIO(m_ussformat);
+    codec->InitMode(wxSoundCodec::ENCODING);
+    break;
+  case wxSND_OUTPUT:
+    codec->SetOutStream(m_sndbuf);
+    codec->InitIO(m_ussformat);
+    codec->InitMode(wxSoundCodec::DECODING);
+    break;
+  case wxSND_DUPLEX:
+  case wxSND_OTHER_IO:
+    break; 
+  }
   return TRUE;
 }
 
@@ -196,6 +205,7 @@ void *wxUssSound::Entry()
     }
     buf->HardUnlock();
     continue;
+
   sound_clean_buffer:
     buf->GetCurrentCodec()->ExitMode();
     delete node;