Cleanup of wavefile loader

This commit is contained in:
rnlf
2017-01-22 20:46:17 +01:00
parent b23d4f020e
commit 65c79c1c43
2 changed files with 23 additions and 1 deletions

View File

@@ -1,3 +1,10 @@
/**
* Copyright (c) 2017 rnlf
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the MIT license. See LICENSE for details.
*/
#include <string.h>
#include "filesystem.h"
#include "wavefile.h"
@@ -33,6 +40,11 @@ char const* wavefile_load(source_t *source, char const *filename) {
char const *err = 0;
uint8_t *waveData = filesystem_read(filename, &fileSize);
if(waveData == NULL) {
err = "Could not read WAV file";
goto fail;
}
waveheader_t const* header = (waveheader_t const*)waveData;
if(header->chunkId != RIFF_CHUNK_ID

View File

@@ -1,5 +1,15 @@
#pragma once
/**
* Copyright (c) 2017 rnlf
*
* 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 WAVEFILE_H
#define WAVEFILE_H
#include "source.h"
char const* wavefile_load(source_t *source, char const *filename);
#endif