Changing the Station

Blitz3D Forums/Blitz3D Programming/Changing the Station

Rook Zimbabwe(Posted 2004) [#1]
I decided to offer the ability to change the music (OGG files) in the Registered version of my game. This is what I am using. I post it here because of a concern and a question.

My concern is memory usage... will this load both sounds? The OGG files aren't large (about 230k and they loop) but???

The question is: Is there a better way to do this?

If KeyHit(2)=True Then 
	If soundflag >1
	StopChannel play_annoy
		play_annoy=PlaySound(annoy1)
	ResumeChannel play_annoy
		soundflag=1
	EndIf
EndIf
If KeyHit(3)=True Then 
	If soundflag <2 Or soundflag >2
	StopChannel play_annoy
		play_annoy=PlaySound(annoy2)
	ResumeChannel play_annoy
		soundflag=2
	EndIf
EndIf
If KeyHit(4)=True Then 
	If soundflag <3 Or soundflag >3
	StopChannel play_annoy
		play_annoy=PlaySound(annoy3)
	ResumeChannel play_annoy
		soundflag=3
	EndIf
EndIf


A little while later I got this to control volume...
If musicflag=1 Then ChannelVolume play_annoy,0.4 Else ChannelVolume play_annoy,0
Obviously I have a soundflag and a musicflag SOUNDflag tracks which OGG file is playing and MUSICflag says *TURN SOUND ON OR OFF* by pressing M. I didn't show that because anyone reading this should be able to figure out how to check for M being pressed and modify musicflag.

Any ideas out there? Is this the simplest way?
-RZ


SabataRH(Posted 2004) [#2]
Theres some sound streaming code in the arcs..
You can stream a tune from the HD or inet addy. No load times so there won't be a noticable pause and you won't have to swamp the resources by loading 10 ogg's.


Rook Zimbabwe(Posted 2004) [#3]
Thats what I want... looking for streaming now... could not for the life of me remember that word... senility I guess!