audio memory leak

All of the latter post I agreed with. I was getting the same crash (music stop working/playing) by using loadStream for long music as recommended by the docs. Changed it to loadSound and it is working. Only downfall is that the initial start up takes longer. But, since I am using all of the sounds for the “life time” of the app, when I progress from level to level, performance is back on pace.

[import]uid: 66859 topic_id: 14854 reply_id: 56763[/import]

Telling us if the behavior broke between 606 and 608 as I requested in the other thread would go a long way in helping us know if those changes were related or a different batch.

And sending us a simple reproducible example would be a tremendous help.
One way to get around the watch dog timer that kills your app on long loads is to use timer.performWithDelay to break up your loads. Load a few files, then call performWithDelay with a short interval (0 might work) to load the next set. This resets Apple’s watch dog timer.

[import]uid: 7563 topic_id: 14854 reply_id: 56767[/import]

Ok, I just downloaded 606 and 608. It works fine with 606, but I get the same 59Testing error: Invalid Operation with 608.

I did try a performWithDelay on the sound a while back, but I think I did it for all the sound loads rather than breaking them up into a series of chunks. But the time to load was also a problem. With loadSound, it took 63 seconds for the app to start up on NOOK Color. Using loadStream, it took about 10-15 seconds.

I know, I’ll probably have to bite the bullet and switch my code around at some point to only load sounds for the current chapter of our graphic novel app. But that presents other issues, like delays between chapters, etc.

I’ll see about sending you a sample. I’ll submit it with a new bug report. [import]uid: 9905 topic_id: 14854 reply_id: 56774[/import]

From my side, same errors and conditions. I have more than 40 speech clips, 6 music and 30 sound effects aprox. I was using audio.loadStream for speech and music. I have many chapters of the ebook where only sounds, effects and music related to that chapter are loaded and dispose, however I have the same 59Testing error: Invalid Operation.

I will try changing to loadSound all my loads. I think the only impact would be on chapter loading, but at least it can works.

On the other hand, when you say long sound file have to be loaded with loadStream, how long they have to be? or which is the minimal size in Mb in uncompressed sound file that could be loaded with loadSound.

Current sounds at any given application time are only 3-4 (meaning 1 music or speech, 2-3 sound effects).

Flavio [import]uid: 3022 topic_id: 14854 reply_id: 57528[/import]

If you are calling dispose after you are done and not keeping dozens of file handles open, this implies this is a different issue.

I still don’t have a simple isolated reproducible test case. (hint)
‘Long’ sounds is a rule of thumb left to you.
Watch
http://www.youtube.com/watch?v=6QQAzhwalPI
at 1 hour 33 min, for the math and some explanation.
In our implementation, small sounds using loadStream that happen to fit in a single buffer automatically get loaded as loadSound behind the scenes as an optimization.

[import]uid: 7563 topic_id: 14854 reply_id: 57538[/import]

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]

And this is another message when I play the application for a long time:
Error with unqueue: Invalid Value, buffer id is 0Error with unqueue: Invalid Value, buffer id is 055Tbesting 8rror: Unknown Internal Error
[import]uid: 3022 topic_id: 14854 reply_id: 57542[/import]

Hi - hope its OK to pick up on an old thread. I’m also a Kwik user. Is it possible to stop audio in Kwik?

I’ve got a page with ‘Page Read’ me audio and a separate ‘play audio’. I want the ‘play audio’ to be stoppable via a button. I tried the Kwik Mute/Unmute feature but the audio continues silently - at on point all audio seemed to stop after that, so I had to refresh the simulator?

Have you been able to get a channel to stop audio, and clear the memory?
[import]uid: 94653 topic_id: 14854 reply_id: 105368[/import]