开发者

Adobe Air + iphone microphone problem: low volume after SampleDataEvent.SAMPLE_DATA event

I am developing and iPhone app with Adobe Air 2.6 using Flash CS 5.5. I am trying to capture microphone input and then playback an mp3 file. The problem is now, that once I capture the microphone data with the SampleDat开发者_如何学PythonaEvent.SAMPLE_DATA event, the volume of the playback mechanism seems to be decreased significantly.

To reproduce:

  1. playback a (remote) mp3 file and the volume is ok
  2. get the microphone and add the event listener (see code below), the listener function does not even need any code for this problem to occur.
  3. same as step 1 (playback remote mp3) and the volume is very low.

    // add the event listener
    _microphone.addEventListener(SampleDataEvent.SAMPLE_DATA, onSampleData);
    
    private function onSampleData(event:SampleDataEvent):void
    {
        //while(event.data.bytesAvailable > 0) {
        //    _buffer.writeFloat(event.data.readFloat());
        //}
    }
    
    // call this before playing back the mp3
    _microphone.removeEventListener(SampleDataEvent.SAMPLE_DATA, onSampleData);
    

When testing with the Flash IDE, the problem does NOT occur and everything works as expected. Tested on iPhone 3GS with iOS 4.3.3.

If anybody experienced this problem I would greatly appreciate your insights.

UPDATE:

I think it is not an AIR problem per se. After using the iOS Microphone the whole app almost mutes itself, that is also the case for the typing on the virtual keyboard (which does not come from AIR). Doesn't really help me but maybe somebody knows how to shut down the microphone in an app so that speaker levels get back to normal?

UPDATE 2:

Here you can see a running example from Adobe http://tv.adobe.com/watch/adc-presents/developing-for-ios-with-air-for-mobile-26/, note that the speaker volume of the iphone in the live demo is really low too. So that must be a pretty huge bug then, making the microphone on the iPhone unusable.


download and use AIR 3 sdk

then set

SoundMixer.useSpeakerphoneForVoice = true;
SoundMixer.audioPlaybackMode = AudioPlaybackMode.MEDIA;

and your problem should be solved

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜