Iphone packager and sampledataevent supported?

I want to know, has anyone successfully implemented audio recording using adobe iphone packager?

I am trying to do this recently, but the sound does not play smoothly. I also tried various buffer sizes, but this was also unsuccessful.

function sampleDataHandler(e:SampleDataEvent):void
{


 var l:Number;
 var r:Number;
 var len = soundFactory.extract(buffer,bufferSize);

 if (len < bufferSize)
 {
  soundFactory.extract(buffer,bufferSize-len,0);
 }

 buffer.position = 0;

 for (var i:int=0; i<bufferSize; ++i)
 {
  l = buffer.readFloat();
  r = buffer.readFloat();
  e.data.writeFloat(l);
  e.data.writeFloat(r);
 }

 buffer.clear()
}

I also tried just to create a simple sine wave in case something is wrong with mp3 decoding, but that also failed.

function sampleDataHandler(e:SampleDataEvent):void
{
 for (var c:int=0; c<bufferSize; c++)
 {
 event.data.writeFloat(Math.sin((Number(c+event.position)/Math.PI/2))*0.25);
 event.data.writeFloat(Math.sin((Number(c+event.position)/Math.PI/2))*0.25);
 }

}
+3
source share
1 answer

this is currently impossible

0
source

Source: https://habr.com/ru/post/1773829/


All Articles