#include "buffer_tree.h"
#include "error.h"
#include "check_wav.h"
+#include "portable_io.h"
/** Length of a standard wav header. */
#define WAV_HEADER_LEN 44
cwc->state = CWS_HAVE_HEADER;
/* Only set those values which have not already been set. */
cwc->channels = (unsigned)a[22];
- cwc->sample_rate = a[24] + (a[25] << 8) + (a[26] << 16) + (a[27] << 24);
- bps = a[34] + ((unsigned)a[35] << 8);
+ cwc->sample_rate = read_u32(a + 24);
+ bps = read_u16(a + 34);
if (bps != 8 && bps != 16) {
PARA_WARNING_LOG("%u bps not supported, assuming 16\n",
bps);