Using the latest build I’m trying to play a single, large MP3 using loadStream. I’ll post the code at the end, but when I first Play, Pause, Stop and then Play again, I get no audio. I usually get this error from the dispose() call thrown in the console:
[lua]ALmixer_FreeData: alDeleteBuffers failed. Invalid Operation[/lua]
I should note that I am not using the Stop() function and wonder if I should.
When I restart the simulator, I get this upon exit, as long as music has played:
[lua]Copyright © 2009-2010 A n s c a , I n c .
Version: 2.0.0
Build: 2010.243
The file sandbox for this project is located at the following folder:
(/Users/eudoxus/Library/Application Support/Corona Simulator/SBiPhone2-6E0352BFCB68434713694818FC028F80)
Corona Simulator(28551,0xa0bff540) malloc: *** error for object 0x5a61f4: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
Corona Simulator(28551,0xa0bff540) malloc: *** error for object 0x59d084: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
Corona Simulator(28551,0xa0bff540) malloc: *** error for object 0x59d080: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
Corona Simulator(28551,0xa0bff540) malloc: *** error for object 0x5e9fa4: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
Corona Simulator(28551,0xa0bff540) malloc: *** error for object 0x5e9fa0: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
Corona Simulator(28551,0xa0bff540) malloc: *** error for object 0x5a6284: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
Corona Simulator(28551,0xa0bff540) malloc: *** error for object 0x5a63b4: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
/Applications/Corona.243/Corona Terminal: line 9: 28551 Bus error “$path/Corona Simulator.app/Contents/MacOS/Corona Simulator” $*
logout
[Process completed][/lua]
[lua]module(…, package.seeall)
– shows and manages the main menu
function newOptions( controller, gamestate )
local options = {}
options.class = “options”
options.controller = controller
options.gamestate = gamestate
– option values
options.sound = true
options.music = true
options.mode = true
options.help = true
– the music being played, nil if none
options.backgroundmusic = nil
options.FadeTime = 500
– music files
options.tunes = {
“align.mp3”,
“frog.mp3”,
“inawhile.mp3”,
“lull.mp3”
}
– load options from state file
– TODO
– save options to state file
– TODO
– music file completion listener
function musicFinished( event )
print(‘complete music’)
– start a different tune if necessary
if (options.gamestate.playState and options.music) then
options:start()
end
end
– music controls, not game controls
function options:start()
print(‘options start’)
– if music is on then choose a tune and play it
options:play()
end
function stopped( event )
print(‘options stopped’,1)
– cleanup
print(options.backgroundmusic)
audio.dispose( options.backgroundmusic )
print(‘options stopped’,2)
options.backgroundmusic = nil
print(‘options stopped’,3)
end
function options:stop()
print(‘options stop’)
– stop the music playing
if (options.music and options.backgroundmusic) then
– fade out and stop
audio.fadeOut( { channel=1, time=options.FadeTime } )
timer.performWithDelay( options.FadeTime, stopped, 1 )
end
end
function options:play()
print(‘options play’,options.music,options.backgroundmusic)
– is music allowed
if (options.gamestate.playState and options.music) then
– is music already playing
if (options.backgroundmusic) then
– play and fade in
print(‘options fade in’)
audio.resume( options.backgroundmusic )
audio.fade( { channel=1, time=options.FadeTime, volume=1 } )
else
– select tune, stream and fade in
options.backgroundmusic = audio.loadStream( options.tunes[math.random(1, #options.tunes)] )
– play the music
audio.play( options.backgroundmusic, { channel=1, fadein=options.FadeTime, onComplete=musicFinished } )
end
else
– music not allowed, stop if playing
options:stop()
end
end
function paused( event )
print(‘options paused’)
audio.pause( options.backgroundmusic )
end
function options:pause()
print(‘options pause’,options.music)
– pause the music
if (options.music) then
audio.fade( { channel=1, time=options.FadeTime, volume=0 } )
timer.performWithDelay( options.FadeTime, paused, 1 )
end
end
return options
end[/lua]
matt [import]uid: 8271 topic_id: 5067 reply_id: 305067[/import]