2 |
* * |
* * |
3 |
* libgig - C++ cross-platform Gigasampler format file access library * |
* libgig - C++ cross-platform Gigasampler format file access library * |
4 |
* * |
* * |
5 |
* Copyright (C) 2003-2006 by Christian Schoenebeck * |
* Copyright (C) 2003-2009 by Christian Schoenebeck * |
6 |
* <cuse@users.sourceforge.net> * |
* <cuse@users.sourceforge.net> * |
7 |
* * |
* * |
8 |
* This library is free software; you can redistribute it and/or modify * |
* This library is free software; you can redistribute it and/or modify * |
28 |
#include <string> |
#include <string> |
29 |
#include <sstream> |
#include <sstream> |
30 |
|
|
31 |
|
#if defined(WIN32) && !HAVE_CONFIG_H |
32 |
|
# include "../win32/libgig_private.h" // like config.h, automatically generated by Dev-C++ |
33 |
|
# define PACKAGE "libgig" |
34 |
|
# define VERSION VER_STRING // VER_STRING defined in libgig_private.h |
35 |
|
#endif // WIN32 |
36 |
|
|
37 |
#include "RIFF.h" |
#include "RIFF.h" |
38 |
|
|
39 |
// *************** Helper Functions ************** |
// *************** Helper Functions ************** |
86 |
* @param WordSize - size of the data words (in bytes) |
* @param WordSize - size of the data words (in bytes) |
87 |
*/ |
*/ |
88 |
inline void SwapMemoryArea(void* pData, unsigned long AreaSize, uint WordSize) { |
inline void SwapMemoryArea(void* pData, unsigned long AreaSize, uint WordSize) { |
89 |
|
if (!AreaSize) return; // AreaSize==0 would cause a segfault here |
90 |
switch (WordSize) { // TODO: unefficient |
switch (WordSize) { // TODO: unefficient |
91 |
case 1: { |
case 1: { |
92 |
uint8_t* pDst = (uint8_t*) pData; |
uint8_t* pDst = (uint8_t*) pData; |
129 |
memcpy((uint8_t*) pData + lo, (uint8_t*) pData + hi, WordSize); |
memcpy((uint8_t*) pData + lo, (uint8_t*) pData + hi, WordSize); |
130 |
memcpy((uint8_t*) pData + hi, pCache, WordSize); |
memcpy((uint8_t*) pData + hi, pCache, WordSize); |
131 |
} |
} |
132 |
delete[] pCache; |
if (pCache) delete[] pCache; |
133 |
break; |
break; |
134 |
} |
} |
135 |
} |
} |