MaxMod. Starting Streaming from begining?

BlitzMax Forums/BlitzMax Programming/MaxMod. Starting Streaming from begining?

I'm using MaxMod to stream my ogg music. I've looked at the docs and the samples but can't seem to find how I would Resume a Stream from the begining after I stop it using StopStream.

Basically when I'm in the game and I go back to the title screen I want the music to start from the begining.

How do I do this with MaxMod?

Thanks :)

Have you tried freeing the stream and creating a new one?

I haven't used Maxmod for a while now but I *think* that's how you'd need to do it.

Thanks, but I can't seem to get it to work.

When I free the stream then re-init it by declaring it again "Stream:TAudioStream = StreamMusic(Music)", it still plays it from the same position.

If I use "If StreamIsPLaying", Stop it, free it, null it and then create it again ity makes no difference.

Doing this also - "If not Stream notify "blah" ", to test if the stream is alive seems to do nothing.

If someone has some example code on how I could achieve this it would be appreciated.

:)

Does this butchered example which comes with Maxmod work?
Strict
Import REDi.MaxMod
'Import SID.SIDStream

Graphics 640,480,0
InitMaxModStream()
Local musicfile:String=RequestFile("Select music to play...",MusicExtensions())
Local Music:TMusic = LoadMusic(musicfile) 
If Not Music RuntimeError "Unable to open music"
If Not Music Notify "Unable to open music"
Local Stream:TAudioStream = StreamMusic(Music)
If Not Stream Notify "Unable to open stream"
PlayStream(Stream)

Local Volume# = 1
Repeat

	Cls
	DrawText "Press Escape to Stop...",10,10
	DrawText "Length        = "+Music.Geti(MM_LENGTH)		,10,35
	DrawText "Play Position = "+Music.Geti(MM_POSITION)		,10,50
	DrawText "Format        = "+Music.Geti(MM_FORMAT)		,10,65
	DrawText "SampleRate    = "+Music.Geti(MM_SAMPLERATE)	,10,80
	DrawText "Time          = "+Music.Geti(MM_TIME)			,10,95
	DrawText "Loop          = "+Music.Geti(MM_LOOP)			,10,110
	DrawText "Interpolation = "+Music.Geti(MM_INTERPOLATION),10,125
	DrawText "Gain          = "+Music.Getf(MM_GAIN)			,10,140
	
	DrawText "Is Playing    = "+StreamIsPlaying(Stream)		,10,160
	DrawText "Stream Volume = "+GetStreamVolume(Stream)		,10,175

	DrawText "Sequence      = "+Music.Geti(MM_SEQUENCE)		,10,250
	DrawText "Pattern       = "+Music.Geti(MM_PATTERN)		,10,265
	DrawText "Line          = "+Music.Geti(MM_LINE)			,10,280
	DrawText "Tick          = "+Music.Geti(MM_TICK)			,10,295
	DrawText "Tempo         = "+Music.Geti(MM_TEMPO)		,10,310
	DrawText "Speed         = "+Music.Geti(MM_SPEED)		,10,325

	If KeyHit(KEY_SPACE) Then Stream.Pause
	If KeyDown(KEY_Q) Then Volume:+0.01 ; SetStreamVolume(Stream,Volume)
	If KeyDown(KEY_A) Then Volume:-0.01 ; SetStreamVolume(Stream,Volume)
	If KeyHit(KEY_S) 
		StopStream(Stream)
		FreeMusic(music)
	EndIf
	If KeyHit(KEY_P)
		Local Music:TMusic = LoadMusic(musicfile) 
		Stream:TAudioStream = StreamMusic(Music)
		If Not Stream Notify "Unable to open stream"
		PlayStream(Stream)
	EndIf

	Flip

Until KeyDown(KEY_ESCAPE) Or AppTerminate()

StopStream(Stream)
FreeStream(Stream)


Hi tonyg. I have this example file but this one you've posted is different.

I can see it loading the music again, something which I'm not doing. I'm just trying to create a new stream.

Will test it out.

Thanks. :)

Amon, yep it's a highly customised version tailored to meet your specific needs :)

it's a highly customised version


Ahh Yeah. I can tell. Really good stuff. ;)