android - Recording Audio and Playing Audio at the same time -


in application recording input microphone , @ point playing sound (while recording still going). recorder "stops" record (mrec.stop() may still used), logcat entry seems be:

    07-03 18:40:34.811: info/audiohardwarealsa(2179): output standby called!!. turn off pcm device. 

i testing on 2 phones, 1 samsung galaxy s , 1 samsung galaxy 3. on galaxy s works expected (which recording still takes place). difference between 2 phones besides specs galaxy s has 2.2.1 , galaxy 3 2.2 figured, workaround initialize mediarecorder again, makes application stutter, not wanted.

here more information how mediaplayer , mediarecorder set up:

    void init()     {       mp = mediaplayer.create(getcontext(), r.raw.pop);       mrec = new mediarecorder();       mrec.setaudiosource(mediarecorder.audiosource.mic);       mrec.setoutputformat(mediarecorder.outputformat.three_gpp);       mrec.setaudioencoder(mediarecorder.audioencoder.amr_nb);       [..]       mrec.setoutputfile(audiofile.getabsolutepath());       mrec.prepare();       mrec.start();     } 

    void event()     {       mp.start();     } 

why recording "stop"? there way halt stop? desired behaviour? how can find out what's wrong?

any tips appreciated.

try using native basic player , recorder ... these accessible thorough audiotrack class , other related apis audio format. using them can record , play pcm audio data in chunks or buffer (explicit byte arrays) , use loop write buffer want. may allow recoding , playing simultaneously

good luck


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -