Streamed OggVorbis Player

BlitzMax Forums/BlitzMax Programming/Streamed OggVorbis Player

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I love OpenAL and the politics of OggVorbis but the modules of BRL for both not ^^
So I write my own modules and player and the result is TOggVorbis. With this class you can play streamed OggVorbis Songs. The advantage of this class is:
- no long loading times(BRL version need up to 30 seconds for one song)
- no dissipation of memory(BRL version need the same memory as the song in wav format)
- seeking

http://vertex.dreamfall.at/openal/openal102.zip
http://vertex.dreamfall.at/openal/oggvorbis.zip

The class interface:
TOggVorbis
 Method Play()
 Method SetVolume(Volume:Float)
  - from 0.0 till 1.0
 Method State:Int()
  - STATE_INITIAL
  - STATE_PLAYING
  - STATE_PAUSED
  - STATE_STOPPED
 Method Stop()
 Method Pause()
 Method Length:Long()
  - in milliseconds
 Method Seek(Milliseconds:Long)
 Method Position:Long()
  - decode position in milliseconds
 Method Decode()
 Function Load:TOggVorbis(URL:OBject)


An little example:
SuperStrict

Framework Vertex.OpenAL
Import "OggVorbis.bmx"

Global Device  : Byte Ptr, ..
       Context : Byte Ptr, ..
       Song    : TOggVorbis

Device = alcOpenDevice(Null)
Context = alcCreateContext(Device, Null)
alcMakeContextCurrent(Context)

Song = TOggVorbis.Load("The Dandy Warhols - Bohemian like you.ogg")
Song.Play()
While Song.State() = STATE_PLAYING
	Song.Decode()
	Delay(10)
Wend

alcMakeContextCurrent(Null)
alcDestroyContext(Context)
alcCloseDevice(Device)
End


Need only 1-2% CPU usage.
The OggVorbis loader is alike of the BRL version but not the same(I have try it without a wrapper.c file but this seeming not possible with BMax :( )

cu olli