Im managed to write around it and now im getting much better playback.
-
I dropped all mp3 files from 128kbps to 96kbps, that sorted it stuttering when OpenFeint was holding up the cpu.
-
In my config.lua I added “audioPlayFrequency = 44100” and every file is now at that freq
-
The other places it happened in the game were at times of high cpu load, usually restarting a level or when the player dies. Both these occasions did a lot in 1 cpu cycle, reset levels, destroyed objects, played game over music and sfx.
I moved the music changed over to the last thing that happened in the loop and I also put a gap between loading the track to the channel, rewinding it and then playing it.
[code]
– Start Music
local function startBackgroundMusic()
– Play Music
if settingMusic == “on” and gamePaused == false and not audio.isChannelActive( 1 ) and backgroundMusicTrack ~= false then
– Play Track
audio.play( backgroundMusicTrack , { channel = 1 , loops = -1 } )
end
end
– Stop Music
local function stopBackgroundMusic()
– Check If Channel Active
if audio.isChannelActive( 1 ) then
– Stop Audio
audio.stop( 1 )
end
end
– Play Music
function playBackgroundMusic( gameMode )
– Game Paused
gamePaused = false
– Stop Music
stopBackgroundMusic()
– Arcade
if gameMode == “arcade” then
backgroundMusicTrack = assetTable[“backgroundMusicArcade”].sound
– Time Attack
elseif gameMode == “timeAttack” then
backgroundMusicTrack = assetTable[“backgroundMusicTimeAttack”].sound
– Menu
else
backgroundMusicTrack = assetTable[“backgroundMusicMenu”].sound
end
– Rewind Track
audio.rewind( backgroundMusicTrack )
– Start Music
timer.performWithDelay( 100 , startBackgroundMusic )
end
[/code] [import]uid: 5354 topic_id: 13534 reply_id: 53360[/import]