]> git.saurik.com Git - wxWidgets.git/commitdiff
* Updated README
authorGuilhem Lavaux <lavaux@easynet.fr>
Sat, 12 Feb 2000 12:11:23 +0000 (12:11 +0000)
committerGuilhem Lavaux <lavaux@easynet.fr>
Sat, 12 Feb 2000 12:11:23 +0000 (12:11 +0000)
* Recoded converters (in a cleaner way)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5980 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

utils/wxMMedia2/README
utils/wxMMedia2/lib/converter.def
utils/wxMMedia2/lib/sndbase.cpp
utils/wxMMedia2/lib/sndcpcm.cpp
utils/wxMMedia2/lib/sndoss.cpp
utils/wxMMedia2/lib/sndwin.cpp
utils/wxMMedia2/lib/vidwin.cpp

index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..c77db4f392d6b7f984005eaf6f6137b08ab6854c 100644 (file)
@@ -0,0 +1,39 @@
+--------------------------------------------------------------------------
+| wxMultimedia (c) 1998, 1999, 2000 Guilhem Lavaux
+| wxWindows license
+--------------------------------------------------------------------------
+
+This is the wxMultimedia package. It intends to be a portable way to access
+some multimedia component on variable system. For the moment, I implemented
+sound, video and CD access.
+
+Sound features:
+  * low level/OSS style access to the sound card. You can open/setup the
+    parameters of the sound card then write/read directly to/from it.
+  * mid level codecs: compressors and sound codec are supported. For the
+    moment there is a support for G711/G721/G723 and MULAW formats (as well
+    PCM).
+  * high level format: WAV file format is supported in read/write and AIFF
+    format in read only
+
+
+Sound bugs:
+  * it seems there are still some bugs in the recording code on Windows
+    on Cygwin B20.1 (to be verified)
+  * wave files created with wxSoundWave have some problem with Windows Media
+    Player (not windows recorder)
+Video features:
+  * high level video file playing: on Unix you can play (through xanim) video
+    files directly into your application
+  * MPEG video file to be supported through SMPEG as soon as I have some free
+    time
+
+Video bugs:
+  * Recode windows port
+
+CD features:
+  * standard access to the CDAUDIO interface
+
+CD bugs:
+
index b5279cc03f857fdd0a6499ec3c84a19beb2c50d7..21157955f997d39dec62f0d901d1b37106bea904 100644 (file)
-#define DEFINE_CONV_8(name) \
-static void Convert_##name##_8(const char *buf_in, char *buf_out, wxUint32 len) \
+#define DEFINE_CONV(name, input_type, output_type, convert) \
+static void Convert_##name##(const char *buf_in, char *buf_out, wxUint32 len) \
 {\
 {\
-  wxUint16 val; \
+  register input_type src; \
+  register const input_type *t_buf_in = (input_type *)buf_in; \
+  register output_type *t_buf_out = (output_type *)buf_out; \
 \
   while (len > 0) { \
 \
   while (len > 0) { \
-    val = *buf_in++; \
-    len--;
-
-#if SWAP_BYTES==0
-
-#define DEFINE_CONV_16(name) \
-static void Convert_##name##_16_no(const char *buf_in, char *buf_out, wxUint32 len) \
-{\
-  wxUint16 val; \
-\
-  while (len > 0) { \
-    val = *(wxUint16 *)(buf_in); \
-    buf_in += 2; \
-    len -= 2;
-
-#else
-
-#define DEFINE_CONV_16(name) \
-static void Convert_##name##_16_yes(const char *buf_in, char *buf_out, wxUint32 len) \
-{\
-  wxUint16 val; \
-\
-  while (len > 0) { \
-    val = *(wxUint16 *)(buf_in); \
-    val = wxUINT16_SWAP_ALWAYS(val); \
-    buf_in += 2; \
-    len -= 2;
-
-#endif
-
-#define END_CONV } }
-
-#define PUT16 *((wxUint16 *)buf_out) = val, buf_out += 2;
-#define PUT16_SWAP *((wxUint16 *)buf_out) = wxUINT16_SWAP_ALWAYS(val), buf_out += 2;
-#define PUT8 *buf_out++ = val;
-#define CHANGE16_SIGN val ^= 0x8000;
-#define CHANGE8_SIGN val ^= 0x80;
-#define REDUCE16_TO_8 val /= 256;
-#define AUGMENT8_TO_16 val *= 256;
-
-DEFINE_CONV_16(16to8)
-REDUCE16_TO_8
-PUT8
-END_CONV
-
-DEFINE_CONV_16(16to8_U2S)
-CHANGE16_SIGN
-REDUCE16_TO_8
-PUT8
-END_CONV
-
-DEFINE_CONV_16(U2S)
-CHANGE16_SIGN
-PUT16
-END_CONV
-
-DEFINE_CONV_16(U2S_SWAP)
-CHANGE16_SIGN
-PUT16_SWAP
-END_CONV
-
-#if SWAP_BYTES == 0
-
-DEFINE_CONV_16(SWAP)
-PUT16_SWAP
-END_CONV
-
-DEFINE_CONV_8(U2S)
-CHANGE8_SIGN
-PUT8
-END_CONV
-
-DEFINE_CONV_8(8to16)
-AUGMENT8_TO_16
-PUT16
-END_CONV
-
-DEFINE_CONV_8(8to16_SWAP)
-AUGMENT8_TO_16
-PUT16_SWAP
-END_CONV
-
-DEFINE_CONV_8(8to16_U2S)
-CHANGE8_SIGN
-AUGMENT8_TO_16
-PUT16
-END_CONV
-
-DEFINE_CONV_8(8to16_U2S_SWAP)
-CHANGE8_SIGN
-AUGMENT8_TO_16
-PUT16_SWAP
-END_CONV
-
-#endif
-
-#undef DEFINE_CONV_16
-#undef DEFINE_CONV_8
-#undef END_CONV
-#undef CHANGE16_SIGN
-#undef CHANGE8_SIGN
-#undef PUT16_SWAP
-#undef PUT16
-#undef PUT8
+    src = *t_buf_in++; \
+    *t_buf_out++ = convert; \
+    len--; \
+  } \
+}
+
+DEFINE_CONV(8_8_sign, wxUint8, wxUint8, (src ^ 0x80))
+
+DEFINE_CONV(8_16, wxUint8, wxUint16, (((wxUint16)src) << 8))
+DEFINE_CONV(8_16_swap, wxUint8, wxUint16, (src))
+DEFINE_CONV(8_16_sign, wxUint8, wxUint16, (((wxUint16)(src ^ 0x80)) << 8))
+DEFINE_CONV(8_16_sign_swap, wxUint8, wxUint16, (src ^ 0x80))
+
+DEFINE_CONV(16_8, wxUint16, wxUint8, (wxUint8)(src >> 8))
+DEFINE_CONV(16_8_sign, wxUint16, wxUint8, (wxUint8)((src >> 8) ^ 0x80))
+DEFINE_CONV(16_swap_8, wxUint16, wxUint8, (wxUint8)(src & 0xff))
+DEFINE_CONV(16_swap_8_sign, wxUint16, wxUint8, (wxUint8)((src & 0xff) ^ 0x80))
+
+DEFINE_CONV(16_sign, wxUint16, wxUint16, (src ^ 0x8000))
+DEFINE_CONV(16_swap, wxUint16, wxUint16, (((src & 0xff) << 8) | ((src >> 8) & 0xff)))
+DEFINE_CONV(16_swap_16_sign, wxUint16, wxUint16, ((((src & 0xff) << 8) | ((src >> 8) & 0xff)) ^ 0x8000))
+DEFINE_CONV(16_sign_16_swap, wxUint16, wxUint16, ((((src & 0xff) << 8) | ((src >> 8) & 0xff)) ^ 0x80))
+DEFINE_CONV(16_swap_16_sign_swap, wxUint16, wxUint16, (src ^ 0x80))
index 95a51c7179c8eef486386aedaeeca4ebe29165f9..be6d6d59c7a9f0e35098a47558dd975383e63dab 100644 (file)
@@ -2,7 +2,7 @@
 // Name: sndbase.cpp
 // Purpose:
 // Date: 08/11/1999
 // Name: sndbase.cpp
 // Purpose:
 // Date: 08/11/1999
-// Author: Guilhem Lavaux <lavaux@easynet.fr> (C) 1999
+// Author: Guilhem Lavaux <lavaux@easynet.fr> (C) 1999, 2000
 // CVSID: $Id$
 // --------------------------------------------------------------------------
 #ifdef __GNUG__
 // CVSID: $Id$
 // --------------------------------------------------------------------------
 #ifdef __GNUG__
index 27dba75dfdebf2c0817a8477586c7fd9a32f1d4c..1c4bf098523c8b304236e28e7d1cc0f835b61e6e 100644 (file)
@@ -2,7 +2,7 @@
 // Name: sndcpcm.cpp
 // Purpose:
 // Date: 08/11/1999
 // Name: sndcpcm.cpp
 // Purpose:
 // Date: 08/11/1999
-// Author: Guilhem Lavaux <lavaux@easynet.fr> (C) 1999
+// Author: Guilhem Lavaux <lavaux@easynet.fr> (C) 1999, 2000
 // CVSID: $Id$
 // --------------------------------------------------------------------------
 #ifdef __GNUG__
 // CVSID: $Id$
 // --------------------------------------------------------------------------
 #ifdef __GNUG__
@@ -26,72 +26,49 @@ wxSoundStreamPcm::~wxSoundStreamPcm()
 }
 
 
 }
 
 
-#define SWAP_BYTES 0
 #include "converter.def"
 #include "converter.def"
-#undef SWAP_BYTES
 
 
-#define SWAP_BYTES 1
-#include "converter.def"
-#undef SWAP_BYTES
-
-wxSoundStreamPcm::ConverterType s_convert_out_16_to_8[] = {
-  Convert_16to8_16_no,
-  Convert_16to8_U2S_16_no,
+wxSoundStreamPcm::ConverterType s_converters[] = {
+  NULL,
+  Convert_8_8_sign,                    /* 8 -> 8 sign */
+  NULL,
   NULL,
   NULL,
   NULL,
   NULL,
-  Convert_16to8_U2S_16_yes,
-  Convert_16to8_16_yes
-};
-
-wxSoundStreamPcm::ConverterType s_convert_out_16[] = {
   NULL,
   NULL,
-  Convert_U2S_16_no,
-  Convert_U2S_SWAP_16_no,
-  Convert_U2S_SWAP_16_yes,
-  Convert_U2S_16_yes,
-  Convert_SWAP_16_no
-};
 
 
-wxSoundStreamPcm::ConverterType s_convert_out_8[] = {
+  Convert_8_16,                                /* 8 -> 16 */
+  Convert_8_16_sign,                   /* 8 -> 16 sign */
+  Convert_8_16_swap,                   /* 8 -> 16 swapped */
+  Convert_8_16_sign_swap,              /* 8 -> 16 sign swapped */
+  NULL,
   NULL,
   NULL,
-  Convert_U2S_8,
-  Convert_U2S_8,
-  Convert_U2S_8,
-  Convert_U2S_8,
-  NULL
-/*,
-  Convert_U2S_S2M_8,
-  Convert_U2S_S2M_8,
-  Convert_U2S_S2M_8,
-  Convert_U2S_S2M_8,
-  Convert_S2M_8 */
-};
 
 
-wxSoundStreamPcm::ConverterType s_convert_in_8_to_16[] = {
-  Convert_8to16_8,
-  Convert_8to16_U2S_8,
-  Convert_8to16_U2S_SWAP_8,
+  Convert_16_8,                                /* 16 -> 8 */
+  Convert_16_8_sign,                   /* 16 -> 8 sign */
+  Convert_16_swap_8,                   /* 16 swapped -> 8 */
+  Convert_16_swap_8_sign,              /* 16 swapped -> 8 sign */
   NULL,
   NULL,
   NULL,
   NULL,
-  Convert_8to16_SWAP_8
-};
 
 
-wxSoundStreamPcm::ConverterType *s_convert_in_16 = s_convert_out_16;
+  NULL,                                        /* 16 -> 16 */
+  Convert_16_sign,                     /* 16 -> 16 sign */
+  Convert_16_swap,                     /* 16 swapped -> 16 */
+  Convert_16_swap_16_sign,             /* 16 swapped -> 16 sign */
+  Convert_16_sign_16_swap,             /* 16 sign -> 16 swapped */
+  Convert_16_swap_16_sign_swap         /* 16 swapped -> 16 sign swapped */
+};
 
 
-wxSoundStreamPcm::ConverterType *s_convert_in_8 = s_convert_out_8;
+#define CONVERT_BPS 0
+#define CONVERT_SIGN 1
+#define CONVERT_SWAP 2
+#define CONVERT_SIGN_SWAP 3
+#define CONVERT_SWAP_SIGN 4
+#define CONVERT_SWAP_SIGN_SWAP 5
 
 
-#define CONVERTER 0
-#define CONVERTER_SIGN 1
-#define CONVERTER_SIGN_SWAP 2
-#define CONVERTER_SWAP_SIGN_SWAP 3
-#define CONVERTER_SWAP_SIGN 4
-#define CONVERTER_SWAP 5
-#define CONVERTER_SIGN_STEREO_MONO 6
-#define CONVERTER_SIGN_SWAP_STEREO_MONO 7
-#define CONVERTER_SWAP_SIGN_SWAP_STEREO_MONO 8
-#define CONVERTER_SWAP_SIGN_STEREO_MONO 9
-#define CONVERTER_SWAP_STEREO_MONO 10
-#define CONVERTER_STEREO_MONO 11
+#define CONVERT_BASE_8_8 0
+#define CONVERT_BASE_8_16 6
+#define CONVERT_BASE_16_8 12 
+#define CONVERT_BASE_16_16 18
 
 //
 // TODO: Read() and Write() aren't really safe. If you give it a buffer which
 
 //
 // TODO: Read() and Write() aren't really safe. If you give it a buffer which
@@ -178,14 +155,19 @@ bool wxSoundStreamPcm::SetSoundFormat(const wxSoundFormatBase& format)
   m_16_to_8 = FALSE;
   if (pcm_format->GetBPS() != pcm_format2->GetBPS()) {
     m_16_to_8 = TRUE;
   m_16_to_8 = FALSE;
   if (pcm_format->GetBPS() != pcm_format2->GetBPS()) {
     m_16_to_8 = TRUE;
-    current_table_out = s_convert_out_16_to_8;
-    current_table_in  = s_convert_in_8_to_16;
+    if (pcm_format2->GetBPS() == 8) {
+      current_table_out = &s_converters[CONVERT_BASE_16_8];
+      current_table_in  = &s_converters[CONVERT_BASE_8_16];
+    } else {
+      current_table_out = &s_converters[CONVERT_BASE_8_16];
+      current_table_in  = &s_converters[CONVERT_BASE_16_8];
+    }
   } else if (pcm_format->GetBPS() == 16) {
   } else if (pcm_format->GetBPS() == 16) {
-    current_table_out = s_convert_out_16;
-    current_table_in  = s_convert_in_16;
+    current_table_out = &s_converters[CONVERT_BASE_16_16];
+    current_table_in  = &s_converters[CONVERT_BASE_16_16];
   } else {
   } else {
-    current_table_out = s_convert_out_8;
-    current_table_in  = s_convert_in_8;
+    current_table_out = &s_converters[CONVERT_BASE_8_8];
+    current_table_in  = &s_converters[CONVERT_BASE_8_8];
   }
 
   change_sign = (pcm_format2->Signed() != pcm_format->Signed());
   }
 
   change_sign = (pcm_format2->Signed() != pcm_format->Signed());
@@ -199,22 +181,25 @@ bool wxSoundStreamPcm::SetSoundFormat(const wxSoundFormatBase& format)
 
   if (pcm_format->GetOrder() == OTHER_ORDER &&
       pcm_format2->GetOrder() == OTHER_ORDER && change_sign) 
 
   if (pcm_format->GetOrder() == OTHER_ORDER &&
       pcm_format2->GetOrder() == OTHER_ORDER && change_sign) 
-    index = CONVERTER_SWAP_SIGN_SWAP;
+    index = CONVERT_SWAP_SIGN_SWAP;
 
   else if (pcm_format->GetOrder() == OTHER_ORDER &&
            pcm_format2->GetOrder() == MY_ORDER && change_sign) 
 
   else if (pcm_format->GetOrder() == OTHER_ORDER &&
            pcm_format2->GetOrder() == MY_ORDER && change_sign) 
-    index = CONVERTER_SWAP_SIGN;
+    index = CONVERT_SWAP_SIGN;
 
   else if (pcm_format->GetOrder() == MY_ORDER &&
            pcm_format->GetOrder() == OTHER_ORDER && change_sign)
 
   else if (pcm_format->GetOrder() == MY_ORDER &&
            pcm_format->GetOrder() == OTHER_ORDER && change_sign)
-    index = CONVERTER_SIGN_SWAP;
+    index = CONVERT_SIGN_SWAP;
+
+  else if (change_sign)
+    index = CONVERT_SIGN;
 
   else if (!change_sign &&
            pcm_format->GetOrder() != pcm_format2->GetOrder())
 
   else if (!change_sign &&
            pcm_format->GetOrder() != pcm_format2->GetOrder())
-    index = CONVERTER_SWAP;
+    index = CONVERT_SWAP;
 
   else
 
   else
-    index = CONVERTER;
+    index = CONVERT_BPS;
 
   m_function_out = current_table_out[index];
   m_function_in  = current_table_in[index];
 
   m_function_out = current_table_out[index];
   m_function_in  = current_table_in[index];
index 875d19b1678cfd5a496e8d18b0131ce95567a588..cf276aca35070a502197ce3f41477c706aac7cd7 100644 (file)
@@ -2,7 +2,7 @@
 // Name: sndoss.cpp
 // Purpose:
 // Date: 08/11/1999
 // Name: sndoss.cpp
 // Purpose:
 // Date: 08/11/1999
-// Author: Guilhem Lavaux <lavaux@easynet.fr> (C) 1999
+// Author: Guilhem Lavaux <lavaux@easynet.fr> (C) 1999, 2000
 // CVSID: $Id$
 // --------------------------------------------------------------------------
 #ifdef __GNUG__
 // CVSID: $Id$
 // --------------------------------------------------------------------------
 #ifdef __GNUG__
index 0d070fce806c899cc251c054202b6cadac30b9e7..f09231ee0d6813f096069b4ff95b1014fadd6635 100644 (file)
@@ -2,7 +2,7 @@
 // Name: sndwin.cpp
 // Purpose:
 // Date: 08/11/1999
 // Name: sndwin.cpp
 // Purpose:
 // Date: 08/11/1999
-// Author: Guilhem Lavaux <lavaux@easynet.fr> (C) 1999
+// Author: Guilhem Lavaux <lavaux@easynet.fr> (C) 1999, 2000
 // CVSID: $Id$
 // --------------------------------------------------------------------------
 #include <wx/wxprec.h>
 // CVSID: $Id$
 // --------------------------------------------------------------------------
 #include <wx/wxprec.h>
index a8e83b2decb41ed08c26b7d58d58975252c55a4f..5340a0f293af1e5ea839a6073d0caccc5c9fdd7d 100644 (file)
@@ -4,7 +4,7 @@
 // Author:     Guilhem Lavaux
 // Created:    February 1998
 // Updated:
 // Author:     Guilhem Lavaux
 // Created:    February 1998
 // Updated:
-// Copyright:  (C) 1998, Guilhem Lavaux
+// Copyright:  (C) 1998, 1999, 2000 Guilhem Lavaux
 // License:    wxWindows license
 ////////////////////////////////////////////////////////////////////////////////
 
 // License:    wxWindows license
 ////////////////////////////////////////////////////////////////////////////////