Browse Source

Updated Examples.

woollybah 6 years ago
parent
commit
86e5dc1ddb

+ 1 - 0
.gitignore

@@ -20,3 +20,4 @@
 *.arm64.i
 .bmx/
 *.i2
+*.exe

+ 9 - 7
audio.mod/doc/allocchannel.bmx

@@ -1,11 +1,13 @@
 'AllocChannel.bmx
 
-timer=createtimer(20)
+SuperStrict
 
-sound=LoadSound ("shoot.wav")
-channel=AllocChannel()
+Local timer:TTimer = CreateTimer(20)
 
-for i=1 to 20
-	waittimer timer
-	playsound sound,channel
-next
+Local sound:TSound = LoadSound ("shoot.wav")
+Local channel:TChannel = AllocChannel()
+
+For Local i:Int = 1 To 20
+	WaitTimer timer
+	PlaySound sound,channel
+Next

+ 7 - 5
audio.mod/doc/channelplaying.bmx

@@ -1,10 +1,12 @@
 ' channelplaying.bmx
 
-sound = LoadSound ("shoot.wav")
+SuperStrict
+
+Local sound:TSound = LoadSound ("shoot.wav")
 
 Input "Hit return to begin channelplaying test, use ctrl-C to exit"
 
-channel=playsound (sound)
-while true
-	print "ChannelPlaying(channel)="+ChannelPlaying(channel)
-wend
+Local channel:TChannel = PlaySound (sound)
+While True
+	Print "ChannelPlaying(channel)="+ChannelPlaying(channel)
+Wend

+ 4 - 2
audio.mod/doc/cuesound.bmx

@@ -2,8 +2,10 @@ Rem
 CueSound example
 End Rem
 
-sound=LoadSound("shoot.wav")
-channel=CueSound(sound)
+SuperStrict
+
+Local sound:TSound = LoadSound("shoot.wav")
+Local channel:TChannel = CueSound(sound)
 
 Input "Press return key to play cued sound"
 

+ 3 - 1
audio.mod/doc/loadsound.bmx

@@ -2,7 +2,9 @@ Rem
 Load and Play a small example wav file.
 End Rem
 
-sound=LoadSound("shoot.wav")
+SuperStrict
+
+Local sound:TSound = LoadSound("shoot.wav")
 PlaySound sound
 
 Input "Press any key to continue"

+ 3 - 1
audio.mod/doc/playsound.bmx

@@ -2,7 +2,9 @@ Rem
 Load and Play a small example wav file with looping.
 End Rem
 
-sound=LoadSound("shoot.wav",true)
+SuperStrict
+
+Local sound:TSound = LoadSound("shoot.wav",True)
 PlaySound sound
 
 Input "Press any key to continue"

+ 6 - 4
audio.mod/doc/setchanneldepth.bmx

@@ -1,15 +1,17 @@
 ' setchanneldepth.bmx
 
+SuperStrict
+
 Graphics 640, 480
 
-channel = AllocChannel ()
-sound = LoadSound ("shoot.wav") ' Use a short sample...
+Local channel:TChannel = AllocChannel ()
+Local sound:TSound = LoadSound ("shoot.wav") ' Use a short sample...
 
 Repeat
 	If MouseHit(1) PlaySound sound,channel
 	
-	pan# = MouseX () / (640 / 2.0) - 1
-	depth# = MouseY () / (480 /2.0) -1
+	Local pan# = MouseX () / (640 / 2.0) - 1
+	Local depth# = MouseY () / (480 /2.0) -1
 	
 	SetChannelPan channel,pan
 	SetChannelDepth channel,depth

+ 6 - 4
audio.mod/doc/setchannelpan.bmx

@@ -1,15 +1,17 @@
 ' setchannelpan.bmx
 
+SuperStrict
+
 Graphics 640, 480
 
-channel = AllocChannel ()
-sound = LoadSound ("shoot.wav") ' Use a short sample...
+Local channel:TChannel = AllocChannel ()
+Local sound:TSound = LoadSound ("shoot.wav") ' Use a short sample...
 
 Repeat
 	If MouseHit(1) PlaySound sound,channel
 	
-	pan# = MouseX () / (GraphicsWidth () / 2.0) - 1
-	vol# = 1 - MouseY () / 480.0
+	Local pan# = MouseX () / (GraphicsWidth () / 2.0) - 1
+	Local vol# = 1 - MouseY () / 480.0
 	SetChannelPan channel, pan
 	SetChannelVolume channel, vol*2
 

+ 6 - 4
audio.mod/doc/setchannelrate.bmx

@@ -1,12 +1,14 @@
 ' setchannelrate.bmx
 
-timer=CreateTimer(20)
+SuperStrict
 
-sound = LoadSound ("shoot.wav",True)
-channel=CueSound(sound)
+Local timer:TTimer = CreateTimer(20)
+
+Local sound:TSound = LoadSound ("shoot.wav",True)
+Local channel:TChannel = CueSound(sound)
 ResumeChannel channel
 
-For rate#=1.0 To 4 Step 0.01
+For Local rate#=1.0 To 4 Step 0.01
 	WaitTimer timer
 	SetChannelRate channel,rate
 Next

+ 6 - 4
audio.mod/doc/setchannelvolume.bmx

@@ -1,12 +1,14 @@
 ' setchannelvolume.bmx
 
-timer=CreateTimer(20)
+SuperStrict
 
-sound = LoadSound ("shoot.wav")
+Local timer:TTimer = CreateTimer(20)
 
-For volume#=.1 To 2 Step .05
+Local sound:TSound = LoadSound ("shoot.wav")
+
+For Local volume#=.1 To 2 Step .05
 	WaitTimer timer
-	channel=CueSound(sound)
+	Local channel:TChannel = CueSound(sound)
 	SetChannelVolume channel,volume
 	ResumeChannel channel
 Next

+ 5 - 3
audio.mod/doc/stopchannel.bmx

@@ -2,10 +2,12 @@ Rem
 StopChannel example
 End Rem
 
-sound=LoadSound("shoot.wav",true)
-channel=PlaySound(sound)
+SuperStrict
 
-print "channel="+channel
+Local sound:TSound = LoadSound("shoot.wav",True)
+Local channel:TChannel = PlaySound(sound)
+
+Print "channel="+channel
 
 Input "Press return key to stop sound"
 

+ 4 - 2
audiosample.mod/doc/createaudiosample.bmx

@@ -1,9 +1,11 @@
 ' createaudiosample.bmx
 
+SuperStrict
+
 Local sample:TAudioSample=CreateAudioSample( 32,11025,SF_MONO8 )
 
-For Local k=0 Until 32
-        sample.samples[k]=Sin(k*360/32)*127.5+127.5
+For Local k:Int = 0 Until 32
+	sample.samples[k]=Sin(k*360/32)*127.5+127.5
 Next
 
 Local sound:TSound=LoadSound( sample,True )