2 terminatorX - realtime audio scratching software
3 Copyright (C) 1999 Alexander König
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 Description: swap byte order for big endian systems/audiohardware.
25 #if defined (BIG_ENDIAN_MACHINE) || defined(BIG_ENDIAN_AUDIO) || defined (TEST_ENDIAN)
29 void swap16(int16_t * val)
40 void swap32(int32_t * val)
43 This one is very inefficient but it wont be
44 called from performace critical areas so
60 void swapbuffer(int16_t *buffer, int samples)
69 for (i=0; i<samples; i++)
80 /* The following main() is just for testing */
84 #include <netinet/in.h>
86 int main(int argc, char **argv)
89 int32_t t32=0x12345678;
91 int16_t buffer[8]={0x1234, 0x5678, 0x9ABC, 0xDEF0, 10, 20, 30, 0};
95 printf("16: %4x\n", (int) t16);
97 printf("16: %4x\n", (int) t16);
99 printf("16: %4x\n", (int) t16);
101 printf("16: %4x\n", (int) t16);
103 printf("16: %4x\n", (int) t16);
105 printf("32: %8x\n", (int) t32);
107 printf("32: %8x\n", (int) t32);
109 printf("32: %8x\n", (int) t32);
111 printf("32: %8x\n", (int) t32);
113 printf("32: %8x\n", (int) t32);
116 for (i=0; i<8; i++) printf("%4hx ", buffer[i]);
117 swapbuffer(buffer, 8);
119 for (i=0; i<8; i++) printf("%4hx ", buffer[i]);
120 swapbuffer(buffer, 8);
122 for (i=0; i<8; i++) printf("%4hx ", buffer[i]);