1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-07-05 22:50:23 +00:00

Updated Ogg Vorbis decoder and fixed some .ogg files not playing at correct speed.

This commit is contained in:
Luke Ceddia 2015-07-26 22:06:52 +10:00
parent d70ed2d42e
commit f2bd84b5c5
3 changed files with 10921 additions and 10769 deletions

File diff suppressed because it is too large Load diff

View file

@ -12,35 +12,35 @@
#endif #endif
snd_sequence_struct *snd_decode_ogg(uint8 *buffer,int32 bytes){ snd_sequence_struct *snd_decode_ogg(uint8 *buffer,int32 bytes){
int result; int result;
int channels; int channels;
short *out; int samplerate;
result=stb_vorbis_decode_memory((unsigned char *)buffer,bytes,&channels,&out); short *out;
if (result==-1) return NULL; result=stb_vorbis_decode_memory((unsigned char *)buffer,bytes,&channels,&samplerate,&out);
//extern int stb_vorbis_decode_memory(unsigned char *mem, int len, int *channels, short **output); if (result==-1) return NULL;
// decode an entire file and output the data interleaved into a malloc()ed //extern int stb_vorbis_decode_memory(unsigned char *mem, int len, int *channels, int *sample_rate, short **output);
// buffer stored in *output. The return value is the number of samples // decode an entire file and output the data interleaved into a malloc()ed
// decoded, or -1 if the file could not be opened or was not an ogg vorbis file. // buffer stored in *output. The return value is the number of samples
// When you're done with it, just free() the pointer returned in *output. // decoded, or -1 if the file could not be opened or was not an ogg vorbis file.
// When you're done with it, just free() the pointer returned in *output.
//attach to new sequence
static int32 seq_handle; seq_handle=list_add(snd_sequences); //attach to new sequence
static snd_sequence_struct *seq; seq=(snd_sequence_struct*)list_get(snd_sequences,seq_handle); static int32 seq_handle; seq_handle=list_add(snd_sequences);
memset(seq,0,sizeof(snd_sequence_struct)); static snd_sequence_struct *seq; seq=(snd_sequence_struct*)list_get(snd_sequences,seq_handle);
seq->references=1; memset(seq,0,sizeof(snd_sequence_struct));
seq->references=1;
seq->channels=channels;
seq->sample_rate=44100; seq->channels=channels;
seq->bits_per_sample=16; seq->sample_rate=samplerate;
seq->endian=0;//native seq->bits_per_sample=16;
seq->is_unsigned=0; seq->endian=0;//native
seq->data=(uint8*)out; seq->is_unsigned=0;
seq->data_size=result*2*channels; seq->data=(uint8*)out;
seq->data_size=result*2*channels;
return seq;
return seq;
} }

File diff suppressed because it is too large Load diff