From 3d3eed26ab8dc1e17a0d0459e8ddbefdf712df66 Mon Sep 17 00:00:00 2001 From: rnlf Date: Tue, 24 Jan 2017 22:17:21 +0100 Subject: [PATCH] Fixed: Crash on real hardware due to wrong direction setting in DMA transfer :3 --- src/soundblaster.c | 2 +- src/wav.h | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 src/wav.h diff --git a/src/soundblaster.c b/src/soundblaster.c index 8950b1a..67ee174 100644 --- a/src/soundblaster.c +++ b/src/soundblaster.c @@ -57,7 +57,7 @@ // DMA -#define DMA_DIRECTION_READ_FROM_MEMORY 0x04 +#define DMA_DIRECTION_READ_FROM_MEMORY 0x08 #define DMA_TRANSFER_MODE_BLOCK 0x80 diff --git a/src/wav.h b/src/wav.h new file mode 100644 index 0000000..86dc202 --- /dev/null +++ b/src/wav.h @@ -0,0 +1,36 @@ +/** + * Copyright (c) 2015 rxi + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the MIT license. See LICENSE for details. + */ + + +#ifndef WAV_H +#define WAV_H + +#include +#include + +typedef struct { + const void *data; + int bitdepth; + int samplerate; + int channels; + size_t length; +} wav_t; + +enum { + WAV_ESUCCESS = 0, + WAV_EFAILURE = -1, + WAV_EBADHEADER = -2, + WAV_EBADFMT = -3, + WAV_ENOFMT = -4, + WAV_ENODATA = -5, + WAV_ENOSUPPORT = -6 +}; + +int wav_read(wav_t *w, const void *data, size_t len); +const char *wav_strerror(int err); + +#endif