Fix WAV playback

Signed-off-by: Mahyar Koshkouei <deltabeard@users.noreply.github.com>
This commit is contained in:
Mahyar Koshkouei
2017-01-11 23:19:29 +00:00
parent 06ad05e332
commit fcf538031f
3 changed files with 7 additions and 4 deletions

View File

@@ -17,7 +17,6 @@
#include "all.h"
#include "main.h"
#include "opus.h"
#include "playback.h"
int main(int argc, char **argv)

View File

@@ -17,6 +17,7 @@ int playFile(const char* file)
ndspWaveBuf waveBuf[2];
bool playing = true;
bool lastbuf = false;
int ret;
printf("Here: %d\n", __LINE__);
@@ -54,8 +55,11 @@ int playFile(const char* file)
buffer2 = linearAlloc(decoder.buffSize * sizeof(int16_t));
printf("Here: %d\n", __LINE__);
if((*decoder.init)(file) != 0)
if((ret = (*decoder.init)(file)) != 0)
{
printf("Error initialising decoder: %d\n", ret);
goto out;
}
printf("Here: %d\n", __LINE__);

View File

@@ -95,7 +95,7 @@ uint32_t rateWav(void)
*/
uint8_t channelWav(void)
{
return (header[23]<<8) + (header[22]);
return channels;
}
/**
@@ -106,7 +106,7 @@ uint8_t channelWav(void)
*/
uint64_t readWav(void* buffer)
{
return fread(buffer, 1, buffSize, pWav) / channels;
return fread(buffer, 1, buffSize, pWav) / sizeof(int16_t);
}
/**