Files
wxWidgets/utils/wxMMedia2/lib/converter.def
Guilhem Lavaux 8b33ae2d5a Inserted "stdio catch" in wxExecute. The activation is controlled by wxProcess.
Completed some TODO in wxMMedia (wxSoundUlaw, ...)
Reworked the PCM converted: it should be simpler to add converters now and it is
cleaner.
Implemented status information in wxVideoWindows but it doesn't work on my
Win98SE (UNSUPPORTED_FUNCTION)
Changed *ERR into *ERROR
Added a TODO: we must detect the best format in wxSoundWindows


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6311 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2000-02-27 10:44:49 +00:00

40 lines
1.6 KiB
Modula-2

#define DEFINE_CONV(name, input_type, output_type, convert) \
static void Convert_##name##(const void *buf_in, void *buf_out, wxUint32 len) \
{\
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) { \
src = *t_buf_in++; \
*t_buf_out++ = convert; \
len -= sizeof(input_type); \
} \
}
// TODO: define converters for all other formats (32, 24)
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(24_8, wxUint32, wxUint8, (wxUint8)(src >> 16))
//DEFINE_CONV(24_8_sig, wxUint32, wxUint8, (wxUint8)((src >> 16) ^ 0x80))
//DEFINE_CONV(32_8, wxUint32, wxUint8, (wxUint8)(src >> 24))
DEFINE_CONV(16_sign, wxUint16, wxUint16, (src ^ 0x8000))
DEFINE_CONV(16_swap, wxUint16, wxUint16, (((src & 0xff) << 8) | ((src >> 8) & 0xff)))
// Problem.
DEFINE_CONV(16_swap_16_sign, wxUint16, wxUint16, ((((src & 0xff) << 8) | ((src >> 8) & 0xff)) ^ 0x80))
// DEFINE_CONV(16_sign_16_swap, wxUint16, wxUint16, ((((src & 0xff) << 8) | ((src >> 8) & 0xff)) ^ 0x8000))
DEFINE_CONV(16_swap_16_sign_swap, wxUint16, wxUint16, (src ^ 0x80))