HomeForumSourceResearchGuide
Sign in to contribute to source. how it works
Component media.audio.Decoder:oggvorbis by barry
expand copy to clipboardexpand
// https://github.com/xiph/vorbis/blob/master/examples/decoder_example.c

interface OGGVorbisLib {
	int newDecoder(byte encoded[], int channels, int sampleRate)
	int4[] decode(int handle, int frames)
	void destroyDecoder(int handle)
}

component provides Decoder:oggvorbis requires native OGGVorbisLib lib {

	int handle

	Decoder:Decoder(AudioFormat format, byte encoded[])
		{
		handle = lib.newDecoder(encoded, format.channels, format.sampleRate)
		}
	
	int4[] Decoder:decode(int frames)
		{
		return lib.decode(handle, frames)
		}
}
Revision history
To propose a new revision to this entity, use dana source put -uc your/new/version.dn -n media.audio.Decoder:oggvorbis -m "reason for update" -u yourUsername
Version 1 (this version) by barry
Notes for this version: Adds audio decoder for OGG Vorbis files