I'll give you a gander of the code I'm using.
I wanted to point out that if you change the frame rate constant to a lower number, you will noticed the gap better. That is to simulate when the game is maxing out the computer's performance.
I'll keep away from OpenAL in the meantime because I'm still learning.
SuperStrict Const FRAME_RATE:Int = 10 Graphics (320,240,,FRAME_RATE) Global newmusic:BGM = New BGM 'new BGM object newmusic.setup() 'allocates and loads the samples While Not KeyDown(KEY_ESCAPE) DrawText("press ESC to quit",0,0) Flip Cls newmusic.update() Wend '------------------------------------------------------------------------ '------------------------------------------------------------------------ Type BGM Field music1intro:TAudioSample = LoadAudioSample("<intro wav goes here>") 'intro music Field music1loop:TAudioSample = LoadAudioSample("<looping wav goes here>") 'looping music Field musicContainer:TSound 'intro storage Field musicContainer2:TSound 'loop storage Field looping:Int = False 'if the song wants to loop or not Field musicChannel:TChannel = AllocChannel() 'allocate a channel for the music to play '------------------------------------------------------------------------ Method setup() 'loads the samples into the sound objects musicContainer = LoadSound(music1intro) 'stores the intro sample into a sound object musicContainer2 = LoadSound(music1loop,True) 'stores the looping sample into a sound object EndMethod '------------------------------------------------------------------------ Method update() 'updates the music to check if the intro has finished playing If musiccontainer And musiccontainer2 And Not musicchannel.playing() Then If Not looping Then PlaySound(musicContainer,musicchannel) 'plays intro looping = True Else PlaySound(musicContainer2,musicchannel) 'plays loop EndIf EndIf EndMethod End Type
I wanted to point out that if you change the frame rate constant to a lower number, you will noticed the gap better. That is to simulate when the game is maxing out the computer's performance.
I'll keep away from OpenAL in the meantime because I'm still learning.