2
* tplay - buffered audio player
4
* (c) 1997 ilkka karvinen <ik@iki.fi>
6
* Copyright under the GNU GENERAL PUBLIC LICENSE
7
* (see the file COPYING in this directory)
17
#include "tplayfunctions.h"
19
DWORD read_big_endian_long(char * buf)
21
DWORD byte0, byte1, byte2, byte3;
22
unsigned char* buffer=(unsigned char*) buf;
24
byte0 = (DWORD) buffer[0];
25
byte1 = (DWORD) buffer[1];
26
byte2 = (DWORD) buffer[2];
27
byte3 = (DWORD) buffer[3];
28
return (byte0 << 24 | byte1 << 16 | byte2 << 8 | byte3);
31
void write_big_endian_long(char * buf, DWORD value)
33
unsigned char* buffer=(unsigned char*) buf;
34
buffer[0] = (unsigned char) (value >> 24 & 0xFF);
35
buffer[1] = (unsigned char) (value >> 16 & 0xFF);
36
buffer[2] = (unsigned char) (value >> 8 & 0xFF);
37
buffer[3] = (unsigned char) (value & 0xFF);
40
DWORD read_little_endian_long(char* buf) {
41
DWORD byte0, byte1, byte2, byte3;
42
unsigned char* buffer=(unsigned char*) buf;
44
byte0 = (DWORD) buffer[0];
45
byte1 = (DWORD) buffer[1];
46
byte2 = (DWORD) buffer[2];
47
byte3 = (DWORD) buffer[3];
48
return (byte3 << 24 | byte2 << 16 | byte1 << 8 | byte0);
51
WORD read_little_endian_word(char * buf)
54
unsigned char* buffer=(unsigned char*) buf;
56
byte0 = (WORD) buffer[0];
57
byte1 = (WORD) buffer[1];
58
return (byte1 << 8 | byte0);
61
void errprintf(char *fmt,...)
66
vfprintf(stderr, fmt, ap);
71
void die(const char *str)
73
fprintf(stderr, "%s: \n", str);
77
void errdie(const char *str)
79
fprintf(stderr, "Error: %s\n", str);