diff options
author | Chris Apers | 2004-05-25 14:23:17 +0000 |
---|---|---|
committer | Chris Apers | 2004-05-25 14:23:17 +0000 |
commit | 819bfde9cf90afee539b9b33b09c68c2e049cecb (patch) | |
tree | 903d79d9172594a0adc7faa8ee190d28e3f97932 /backends/PalmOS/Src/snd_stream.cpp | |
parent | 530fd01fa365f5f9fa35d193ccbe33d7d4a51ce9 (diff) | |
download | scummvm-rg350-819bfde9cf90afee539b9b33b09c68c2e049cecb.tar.gz scummvm-rg350-819bfde9cf90afee539b9b33b09c68c2e049cecb.tar.bz2 scummvm-rg350-819bfde9cf90afee539b9b33b09c68c2e049cecb.zip |
Sound FX support
svn-id: r13882
Diffstat (limited to 'backends/PalmOS/Src/snd_stream.cpp')
-rw-r--r-- | backends/PalmOS/Src/snd_stream.cpp | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/backends/PalmOS/Src/snd_stream.cpp b/backends/PalmOS/Src/snd_stream.cpp new file mode 100644 index 0000000000..ae4d3f8020 --- /dev/null +++ b/backends/PalmOS/Src/snd_stream.cpp @@ -0,0 +1,50 @@ +#ifndef COMPILE_STREAMSND +# include "stdafx.h" +# include "palm.h" +#else +# include "ARMNative.h" +# include <endianutils.h> +#endif + +#ifndef ByteSwap32 +#define ByteSwap32(x) x +#else +#define READ_LE_UINT32(x) *x +#endif + +Err sndCallback(void* UserDataP, SndStreamRef stream, void* bufferP, UInt32 *bufferSizeP) { + SoundDataType *snd = (SoundDataType *)UserDataP; + UInt32 size = *bufferSizeP; + +#ifdef COMPILE_STREAMSND + // endian + snd->set = ByteSwap32(snd->set); + snd->size = ByteSwap32(snd->size); +#endif + + if (snd->set && snd->size) { + UInt32 *dst = (UInt32 *)bufferP; + UInt32 *src = (UInt32 *)ByteSwap32(snd->dataP); + + size = (snd->size / 16); + while (size--) { + *dst++ = READ_LE_UINT32(src++); + *dst++ = READ_LE_UINT32(src++); + *dst++ = READ_LE_UINT32(src++); + *dst++ = READ_LE_UINT32(src++); + } + snd->set = false; + + } else { + snd->size = size; + MemSet(bufferP, size, 0); + } + +#ifdef COMPILE_STREAMSND + // endian + snd->set = ByteSwap32(snd->set); + snd->size = ByteSwap32(snd->size); +#endif + + return errNone; +}
\ No newline at end of file |