1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-07-03 12:21:20 +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
snd_sequence_struct *snd_decode_ogg(uint8 *buffer,int32 bytes){
int result;
int channels;
short *out;
result=stb_vorbis_decode_memory((unsigned char *)buffer,bytes,&channels,&out);
if (result==-1) return NULL;
//extern int stb_vorbis_decode_memory(unsigned char *mem, int len, int *channels, short **output);
// decode an entire file and output the data interleaved into a malloc()ed
// buffer stored in *output. The return value is the number of samples
// 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);
static snd_sequence_struct *seq; seq=(snd_sequence_struct*)list_get(snd_sequences,seq_handle);
memset(seq,0,sizeof(snd_sequence_struct));
seq->references=1;
seq->channels=channels;
seq->sample_rate=44100;
seq->bits_per_sample=16;
seq->endian=0;//native
seq->is_unsigned=0;
seq->data=(uint8*)out;
seq->data_size=result*2*channels;
return seq;
int result;
int channels;
int samplerate;
short *out;
result=stb_vorbis_decode_memory((unsigned char *)buffer,bytes,&channels,&samplerate,&out);
if (result==-1) return NULL;
//extern int stb_vorbis_decode_memory(unsigned char *mem, int len, int *channels, int *sample_rate, short **output);
// decode an entire file and output the data interleaved into a malloc()ed
// buffer stored in *output. The return value is the number of samples
// 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);
static snd_sequence_struct *seq; seq=(snd_sequence_struct*)list_get(snd_sequences,seq_handle);
memset(seq,0,sizeof(snd_sequence_struct));
seq->references=1;
seq->channels=channels;
seq->sample_rate=samplerate;
seq->bits_per_sample=16;
seq->endian=0;//native
seq->is_unsigned=0;
seq->data=(uint8*)out;
seq->data_size=result*2*channels;
return seq;
}

File diff suppressed because it is too large Load diff