Warning: audio error: alBufferData failed: Invalid Value

I’m using Composer to build a narrated book app and once you have the book read to you and start flipping back through the pages, the narration stops. The simulator shows the following for each page once the audio stop working:

 

 

 

Warning: audio error: alBufferData failed: Invalid Value

 

Warning: audio error: Play failed: Unknown Internal ErrorWarning: audio error: alBufferData failed: Invalid Operation

 

Warning: audio error: Could not get data for streamed PlayChannel: Warning: audio error: alBufferData failed: Invalid Operation

 

Warning: audio error: Could not get data for streamed PlayChannel: 

 

 

It should be noted that the narration is on channel 1, other sounds on other channels continue to work. Each page disposes of the narration like the following:

 

 

function scene:hide( event ) 

   if event.phase == “will” then 

          if audio.isChannelActive ( 1 ) then 

             audio.stop(1); 

          end 

          audio.dispose(readMeFile); readMeFile = nil; 

   

elseif event.phase == “did” then 

          composer.test = nil 

   end 

end  

I thought maybe it was because I was using an older version of Corona, so I updated to Version 2014.2188 (2014.3.4). However, this didn’t help. Any ideas would be greatly appreciated!

Is readMeFile in scope when you try and dispose it?

Yeah, readMeFile is the narration audio file on channel 1 that’s playing on each lua page. 

Can you post some code where you’re creating the audio?

*** represents where other code (image placement, variables, etc.) not related to sound is.

local allAudios = {} 

***

function scene:create( event )  

    – view is not yet visible  

    local sceneGroup = self.view

***

allAudios.readMeFile = audio.loadStream( composer.audioDir…“page2.mp3” ) 

     local a = audio.getDuration( allAudios.readMeFile ); 

     if (a > tonumber(composer.kAutoPlay)*1000 ) then composer.kAutoPlay = a + 1000; end; 

***

end

function scene:show( event ) 

   local sceneGroup = self.view 

***

if (composer.readMe == 1) then 

         audio.setVolume(1, { channel=1} ); 

         audio.play( allAudios.readMeFile, { channel=1, loops=0} ); 

    end 

***

end

function scene:hide( event ) 

   if event.phase == “will” then 

          if audio.isChannelActive ( 1 ) then 

             audio.stop(1); 

          end 

          audio.dispose(readMeFile); readMeFile = nil

***

  end

end

Hi Corona folks,

I’m getting same error, in my case when I repeatedly load the same page. I’m using the old Director class not Composer. I thought I’d chime in since since it appears that the problem (presuming it’s the same issue) is not confined to Composer.

For the time being, my only “solution” is to make the app suspend when it’s closed, so the user can have a fresh start when they reopen the app.

you play:  audio.play( allAudios.readMeFile , { channel=1, loops=0} );

Yet you dispose:  audio.dispose( readMeFile ); readMeFile = nil

Am I reading this wrong?

Hey Rob,

I think that might be it! I changed it, but was still getting errors, but then I saw that some of the sound effects that were in the audio tablet also weren’t being disposed of by their full directory.

jbtellez, maybe you have the same thing?

The code was based off of some that was generated by the beta version of the new Kwik, so I’m going to let Alex know ASAP.

Hi GP and Rob,

In my case I also wasn’t disposing audio properly so audio.play was getting called on an audio that hadn’t fully loaded. Using loadSound vs loadStream was one workaround, but proper disposal did the trick better. I’m using Kwik too, by the way, but the problem was all mine :wink:

Is readMeFile in scope when you try and dispose it?

Yeah, readMeFile is the narration audio file on channel 1 that’s playing on each lua page. 

Can you post some code where you’re creating the audio?

*** represents where other code (image placement, variables, etc.) not related to sound is.

local allAudios = {} 

***

function scene:create( event )  

    – view is not yet visible  

    local sceneGroup = self.view

***

allAudios.readMeFile = audio.loadStream( composer.audioDir…“page2.mp3” ) 

     local a = audio.getDuration( allAudios.readMeFile ); 

     if (a > tonumber(composer.kAutoPlay)*1000 ) then composer.kAutoPlay = a + 1000; end; 

***

end

function scene:show( event ) 

   local sceneGroup = self.view 

***

if (composer.readMe == 1) then 

         audio.setVolume(1, { channel=1} ); 

         audio.play( allAudios.readMeFile, { channel=1, loops=0} ); 

    end 

***

end

function scene:hide( event ) 

   if event.phase == “will” then 

          if audio.isChannelActive ( 1 ) then 

             audio.stop(1); 

          end 

          audio.dispose(readMeFile); readMeFile = nil

***

  end

end

Hi Corona folks,

I’m getting same error, in my case when I repeatedly load the same page. I’m using the old Director class not Composer. I thought I’d chime in since since it appears that the problem (presuming it’s the same issue) is not confined to Composer.

For the time being, my only “solution” is to make the app suspend when it’s closed, so the user can have a fresh start when they reopen the app.

you play:  audio.play( allAudios.readMeFile , { channel=1, loops=0} );

Yet you dispose:  audio.dispose( readMeFile ); readMeFile = nil

Am I reading this wrong?

Hey Rob,

I think that might be it! I changed it, but was still getting errors, but then I saw that some of the sound effects that were in the audio tablet also weren’t being disposed of by their full directory.

jbtellez, maybe you have the same thing?

The code was based off of some that was generated by the beta version of the new Kwik, so I’m going to let Alex know ASAP.

Hi GP and Rob,

In my case I also wasn’t disposing audio properly so audio.play was getting called on an audio that hadn’t fully loaded. Using loadSound vs loadStream was one workaround, but proper disposal did the trick better. I’m using Kwik too, by the way, but the problem was all mine :wink:

Just wondering how you fixed your audio.play getting called on a loadStream that had not fully loaded. I am having the same

problems.

Warning: audio error: Could not get data for streamed PlayChannel: Warning: audio error: alBufferData failed: Invalid Operation

I am trying to dispose of audio on scene changes in Storyboard