speaker-test: move existing endian macros up in the file

This is necessary for a later patch removing the various endianness checks
sprinkled throughout the code.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
This commit is contained in:
Dan McGee 2009-05-10 02:47:39 +02:00 committed by Jaroslav Kysela
parent 21d3717c3f
commit 8b0db35f63

View file

@ -68,6 +68,16 @@ enum {
#define MAX_CHANNELS 16 #define MAX_CHANNELS 16
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define COMPOSE_ID(a,b,c,d) ((a) | ((b)<<8) | ((c)<<16) | ((d)<<24))
#define LE_SHORT(v) (v)
#define LE_INT(v) (v)
#else
#define COMPOSE_ID(a,b,c,d) ((d) | ((c)<<8) | ((b)<<16) | ((a)<<24))
#define LE_SHORT(v) bswap_16(v)
#define LE_INT(v) bswap_32(v)
#endif
static char *device = "default"; /* playback device */ static char *device = "default"; /* playback device */
static snd_pcm_format_t format = SND_PCM_FORMAT_S16; /* sample format */ static snd_pcm_format_t format = SND_PCM_FORMAT_S16; /* sample format */
static unsigned int rate = 48000; /* stream rate */ static unsigned int rate = 48000; /* stream rate */
@ -520,16 +530,6 @@ struct wave_header {
} chunk; } chunk;
}; };
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define COMPOSE_ID(a,b,c,d) ((a) | ((b)<<8) | ((c)<<16) | ((d)<<24))
#define LE_SHORT(v) (v)
#define LE_INT(v) (v)
#else
#define COMPOSE_ID(a,b,c,d) ((d) | ((c)<<8) | ((b)<<16) | ((a)<<24))
#define LE_SHORT(v) bswap_16(v)
#define LE_INT(v) bswap_32(v)
#endif
#define WAV_RIFF COMPOSE_ID('R','I','F','F') #define WAV_RIFF COMPOSE_ID('R','I','F','F')
#define WAV_WAVE COMPOSE_ID('W','A','V','E') #define WAV_WAVE COMPOSE_ID('W','A','V','E')
#define WAV_FMT COMPOSE_ID('f','m','t',' ') #define WAV_FMT COMPOSE_ID('f','m','t',' ')