Ewing,
I have this similar code in every module.lua (each chapter. I am using Director and its clean function at the end of each module) and I still having problem with sounds. The idea is to load them in every single chapter, use them and unload them. But even when I using this mechanism the error continues.
Therefore, if you have any sample or guideline code to load/unload sounds when you have different levels/chapters or when you are unable to load all of them at the beginning of the application, that would be great.
For your reference, a, b and c sounds are only 12Kb in .caf format. Speech are in mp3 and they are 340Kb. I’ve also used them as .caf. they were around 850Kb each.
During it execution, sometimes speeches are not reproduced. Exiting from this chapter(screen) backs to a intermediate menu with a background music loaded as Stream. Same mechanism than here. But, sometimes that music stop sounding. I’ve also noted that after the execution of speech sound, the 59Testing error: Invalid Operation appears on the terminal screen of Corona Simulator.
here is the code:
local aSound = audio.loadSound( “a.caf” )
local bSound = audio.loadSound( “b.caf” )
local cSound = audio.loadSound( “c.caf” )
local chA,chB,chC,chD=1,1,1,1
…
if (langage==“1”) then
narrative=audio.loadStream ( “FrenchSpeech.mp3” )
else
narrative=audio.loadStream ( “EnglishSpeech.mp3” )
end
chC=audio.play (cSound)
chSpeech=audio.play ( narrative)
clean = function (event)
if audio.isChannelActive ( chSpeech ) or audio.isChannelPlaying ( chSpeech ) then audio.stop(chSpeed) end
audio.dispose ( aSound)
audio.dispose ( bSound)
audio.dispose ( cSound)
audio.stop(chSpeech)
audio.dispose (narrative)
narrative=nil
aSound=nil
bSound=nil
cSound=nil
tapSound=nil
chA,chB,chC,chD=nil,nil,nil,nil
end
[import]uid: 3022 topic_id: 14854 reply_id: 57540[/import]