![]() I/System.out: AudioSystem stream 9 STREAM_TTSĭ/: After 1st: 12ītw, if you want to research related C sourse code you can look at android_media_ToneGenerator.cpp, ToneGenerator.h, ToneGenerator.cpp AudioService. I/System.out: AudioSystem stream 8 STREAM_DTMFĭ/: After 1st: 26 ![]() I/System.out: AudioSystem stream 7 STREAM_SYSTEM_ENFORCEDĭ/: After 1st: 324 I/System.out: AudioSystem stream 6 STREAM_BLUETOOTH_SCOĭ/: After 1st: 332 So, use the handler with the same millis as for tone generator. I/System.out: AudioSystem stream 5 STREAM_NOTIFICATIONĭ/: After 1st: 16 You have to release the tone generator after it is finished. I/System.out: AudioSystem stream 4 STREAM_ALARM I/System.out: AudioSystem stream 3 STREAM_MUSICĭ/: After 1st: 19 I/System.out: AudioSystem stream 2 STREAM_RINGĭ/: After 1st: 28 I/System.out: AudioSystem stream 1 STREAM_SYSTEMĭ/: After 1st: 17 Java ToneGenerator.stopTone - 10 examples found. I/System.out: AudioSystem stream 0 STREAM_VOICE_CALLĭ/: After 1st: 325 Output: I/System.out: AudioSystem stream -1 STREAM_DEFAULT Log.d(TAG,"After 1st: " + (System.currentTimeMillis() - startTime)) Tone Call-Waiting Tone Pstn Disconnect Tone Default Ring Cadence Table 21. MDTMFPlayer.startTone(ToneGenerator.TONE_DTMF_0) In a Thread started by OnClickListener.onClick(): long startTime = System.currentTimeMillis() In the constructor: mDTMFPlayer = new ToneGenerator(AudioManager.STREAM_VOICE_CALL, TONE_RELATIVE_VOLUME) ![]() This is then looped for the desired time. Minimal example playing a middle A (440Hz) tone for 1000ms: new ToneGenerator ().play (440, 1000) The API works by generating a single wave and then filling a minimal sample with copies. ![]() But on the first call, it blocks for a long period of time. I'm calling ToneGenerator.startTone() repeatedly to issue short bursts of sound. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |