]> git.saurik.com Git - wxWidgets.git/blobdiff - utils/wxMMedia/sndpcm.cpp
fixed somebody's poorly done StreamSize-->GetSize transition
[wxWidgets.git] / utils / wxMMedia / sndpcm.cpp
index acf37b661b2ef77927e6b85b2754de687b4cd84c..f40fcadedc46cfad51b06b75691168c6b285ef8a 100644 (file)
@@ -1,3 +1,12 @@
+////////////////////////////////////////////////////////////////////////////////
+// Name:       sndpcm.cpp
+// Purpose:    wxMMedia
+// Author:     Guilhem Lavaux
+// Created:    1998
+// Updated:    1999
+// Copyright:  (C) 1997, 1998, 1999, Guilhem Lavaux
+// License:    wxWindows license
+////////////////////////////////////////////////////////////////////////////////
 #ifdef __GNUG__
 #pragma implementation "sndpcm.h"
 #endif
@@ -38,10 +47,8 @@ wxSoundDataFormat wxSoundPcmCodec::GetPreferredFormat(int codec) const
 
 void wxSoundPcmCodec::Decode()
 {
-  InitMode(DECODING);
   if (m_io_format == m_orig_format) {
     CopyToOutput();
-    ExitMode();
     return;
   }
 
@@ -58,7 +65,6 @@ void wxSoundPcmCodec::Decode()
   default:
     break;
   }
-  ExitMode();
 }
 
 // ---------------------------------------------------------------------------
@@ -109,9 +115,11 @@ void wxSoundPcmCodec::InputSwapAndSign16()
   } else {
     while (StreamOk()) {
       temp = GET();
+      temp2 = GET();
       PUT(temp ^ signer1);
       if (!StreamOk()) {
         m_in_sound->WriteBack(temp);
+        m_in_sound->WriteBack(temp2);
         break;
       }
       PUT(GET() ^ signer2);
@@ -167,6 +175,7 @@ void wxSoundPcmCodec::OutputSwapAndSign16()
       PUT(temp ^ signer1);
       if (!StreamOk()) {
         m_in_sound->WriteBack(temp);
+        m_in_sound->WriteBack(temp2);
         break;
       }
       PUT(temp2 ^ signer2);
@@ -179,10 +188,8 @@ void wxSoundPcmCodec::OutputSwapAndSign16()
 
 void wxSoundPcmCodec::Encode()
 {
-  InitMode(ENCODING);
   if (m_io_format == m_orig_format) {
     CopyToOutput();
-    ExitMode();
     return;
   }
 
@@ -199,5 +206,4 @@ void wxSoundPcmCodec::Encode()
   default:
     break;
   }
-  ExitMode();
 }