gbaconv

A set of tools aimed at GameBoy Advance developers
Log | Files | Refs | README | LICENSE

commit 2e38a41b0915c7d2e35e6155d6d19ca354011524
parent 300556e1e829f68f9a3365f1f0162fc96e925a08
Author: Frederic Cambus <fred@statdns.com>
Date:   Thu, 21 Feb 2019 22:02:17 +0100

Introduce a WAVE_HEADER_LENGTH macro to define the length of the WAVE header.

Diffstat:
Mwav2gba.c | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/wav2gba.c b/wav2gba.c @@ -17,6 +17,8 @@ #include <string.h> #include <sys/stat.h> +#define WAVE_HEADER_LENGTH 44 + FILE *input_file; char *input_file_buffer; int input_file_size; @@ -73,7 +75,7 @@ int main(int argc, char *argv[]) { fclose(input_file); /* Check that the file is a valid 8-bit MONO WAV */ - memcpy(&wave_header, input_file_buffer, 44); + memcpy(&wave_header, input_file_buffer, WAVE_HEADER_LENGTH); if (wave_header.channels != 1) { printf("ERROR: Input File is not MONO\n\n"); @@ -98,7 +100,7 @@ int main(int argc, char *argv[]) { fprintf(output_file, "const s8 %s[] = {\n", argv[3]); for (loop = 0; loop < input_file_size; loop++) { - fprintf(output_file, "0x%x,", input_file_buffer[44+loop]+128); + fprintf(output_file, "0x%x,", input_file_buffer[WAVE_HEADER_LENGTH+loop]+128); } fseek(output_file, ftell(output_file)-1, 0);