Blame toonz/sources/sound/tsioutils.cpp
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "tcommon.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Campbell Barton |
8c6c57 |
#include "tsioutils.h"
|
|
Campbell Barton |
8c6c57 |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------------------
|
|
justburner |
9369f1 |
void swapAndCopy16Bits(const short *srcBuffer, short *dstBuffer,
|
|
Shinya Kitaoka |
120a6e |
TINT32 sampleCount) {
|
|
justburner |
9369f1 |
const short *srcSample = srcBuffer;
|
|
Shinya Kitaoka |
120a6e |
short *dstSample = dstBuffer;
|
|
Shinya Kitaoka |
120a6e |
|
|
justburner |
9369f1 |
const short *endSrcSample = srcSample + sampleCount;
|
|
Shinya Kitaoka |
120a6e |
while (srcSample < endSrcSample) *dstSample++ = swapShort(*srcSample++);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
justburner |
9369f1 |
|
|
justburner |
9369f1 |
//------------------------------------------------------------------------------
|
|
justburner |
9369f1 |
void swapAndCopy32Bits(const TINT32 *srcBuffer, TINT32 *dstBuffer,
|
|
justburner |
9369f1 |
TINT32 sampleCount) {
|
|
justburner |
9369f1 |
const TINT32 *srcSample = srcBuffer;
|
|
justburner |
9369f1 |
TINT32 *dstSample = dstBuffer;
|
|
justburner |
9369f1 |
|
|
justburner |
9369f1 |
const TINT32 *endSrcSample = srcSample + sampleCount;
|
|
justburner |
9369f1 |
while (srcSample < endSrcSample) *dstSample++ = swapTINT32(*srcSample++);
|
|
justburner |
9369f1 |
}
|
|
justburner |
9369f1 |
|
|
justburner |
9369f1 |
//------------------------------------------------------------------------------
|
|
justburner |
9369f1 |
void swapAndCopy24Bits(const void *srcBuffer, void *dstBuffer,
|
|
justburner |
9369f1 |
TINT32 sampleCount) {
|
|
justburner |
9369f1 |
const UCHAR *srcData = (const UCHAR *)srcBuffer;
|
|
justburner |
9369f1 |
UCHAR *dstData = (UCHAR *)dstBuffer;
|
|
justburner |
9369f1 |
if (sampleCount <= 0) return;
|
|
justburner |
9369f1 |
while (--sampleCount) {
|
|
justburner |
9369f1 |
dstData[0] = srcData[2];
|
|
justburner |
9369f1 |
dstData[1] = srcData[1];
|
|
justburner |
9369f1 |
dstData[2] = srcData[0];
|
|
justburner |
9369f1 |
srcData += 3;
|
|
justburner |
9369f1 |
dstData += 3;
|
|
justburner |
9369f1 |
}
|
|
justburner |
9369f1 |
}
|