Dim MyTunes as map
Mytunes.Initialize
dim aBeeper as Beeper = CreateBeeper(Tune1) '<-- Tune1 is just a number you could hardcode here, but using an array defined at the top is better IMHO
MyTune.Put("Beep1", aBeeper) '<-- use descriptive names instead of Beep1,Beep2..
dim aBeeper as Beeper = CreateBeeper(Tune2)
MyTune.Put("Beep2", aBeeper) '<-- instead of descriptive names you could use the Tune as the key, if you like so
...
'when it's time to play you call PlayTune("Beep1")
'on program exit release all the Beepers (maybe not strictly necessary but a clean up habit is better IMHO)
Sub CreateBeeper(Tune) as Beeper
dim a Beepr as beeper
aBeeper.Initialize(300, 500 + (Tune * 100))
return aBeeper
end sub
Sub PlayTune( aTune as string)
dim aBeeper = MyTunes.get(aTune)
aBeeper.Beep
Sleep(300 + 10)
Return