android-audiomanager

What triggers (or generates) KeyEvent.ACTION_MULTIPLE?

与世无争的帅哥 提交于 2019-12-04 17:35:44
问题 The documentation for KeyEvent.ACTION_MULTIPLE says: "multiple duplicate key events have occurred in a row, or a complex string is being delivered. If the key code is not {#link KEYCODE_UNKNOWN then the {#link getRepeatCount() method returns the number of times the given key code should be executed. Otherwise, if the key code is KEYCODE_UNKNOWN, then this is a sequence of characters as returned by getCharacters()." But it doesn't say how to actually generate that event. I tried (rapidly)

Changing the Vibrate settings in Jelly Bean, Android

烂漫一生 提交于 2019-12-04 17:18:59
I am looking for how we change the vibrate settings in Jelly Bean. I found that all the pre-JB vibrate settings have been deprecated, but don't see any new AudioManager.[change the vibrate settings] code anywhere. There is a setting "Vibrate when ringing" which I would like to know how to play with. Thanks for you help. house In android4.1 you can use this to control "vibrate & ringing" Settings.System.putInt(mContentResolver, Settings.System.VIBRATE_WHEN_RINGING, enable ? 1 : 0); From the Documentation: This method is deprecated. Applications should maintain their own vibrate policy based on

How to create oscilloscope for audio on android

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-04 15:59:04
i am creating an app for audio recording with oscilloscope. i did the audio recording with the following code now i add oscilloscopse as shown in the figure.my requirement is oscilloscope's wave should be zigzac according to the user's voice tone. i have tried long time but i could not find solution. i do not have any idea to implement the oscilloscope. please help me how to do it and please provide some sample code snippets. thanks. audio recording code: recorder = new AudioRecord(MediaRecorder.AudioSource.MIC,RECORDER_SAMPLERATE, RECORDER_CHANNELS,RECORDER_AUDIO_ENCODING, bufferSize);

How to turn on speaker for incoming call programmatically in Android L?

独自空忆成欢 提交于 2019-12-04 15:40:20
问题 I want to accept an incoming call using answering phone's GUI (Phone's GUI) of my phone in Android 5.0. I found a way that needs to make an activity which use to send some action to open the Phone's GUI. I was successful to turn on the Phone's GUI for an incoming call. The issue is how can I turn on the speaker for the Phone's GUI. I tried the code but it does not turn on. Could you help me to solve that issue in Android L audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);

I want change the volume of ringertonevolume

微笑、不失礼 提交于 2019-12-04 14:46:43
问题 i used this code to adjust volume but it didn't work int volume=23; audio.setStreamVolume(AudioManager.STREAM_RING,volume, AudioManager.FLAG_PLAY_SOUND|AudioManager.FLAG_ALLOW_RINGER_MODES);} 回答1: you should not just set the volume to 23 instead you should first make a call to getStreamMaxVolume(StreamType) to get the max volume possible for the StreamType which in this case is the ringer's volume. for example, to set the ringer's volume to max you do this! audioManager.setStreamVolume

How to provide customized vibration on specific incoming calls

六月ゝ 毕业季﹏ 提交于 2019-12-04 08:56:12
问题 The program functions like this: the user has a list of phone numbers, for which the cellphone could vibrate upon an incoming call only when no other system-wide application would provide vibration (such as in mute mode). I know that this is somehow against the rules, for that an application should respect the users' settings, but the application is limited to some certain users with this need. I have tried two ways but neither of them are satisfying: Listen to the telephony state and

Unable to retrieve AudioTrack pointer for write()

久未见 提交于 2019-12-04 07:32:04
I am trying to implement AudioTrack to retrieve audio in my android device for incoming call from IAX but facing exception after some while . private void writeBuff(short[] buf) { try { if (this.track == null) { Log.w("IAX2Audio", "write() without an AudioTrack"); return; } int written = 0; while (written < buf.length) { if (this.track != null) { int res; res = this.track.write(buf, written, buf.length - written); switch (res) { case AudioTrack.ERROR_INVALID_OPERATION: Log.e("IAX2Audio", "Invalid write()"); return; case AudioTrack.ERROR_BAD_VALUE: Log.e("IAX2Audio", "Bad arguments to write()")

How to Sync Sounds using SoundPool

时光怂恿深爱的人放手 提交于 2019-12-04 05:28:42
I have been trying to get a few sounds to play at the same time; currently i'm using a shared instance of SoundPool. I would like 1, 2 or 3 sounds to be played at the exact same time with no lag. When calling SoundPool.play(...) X number of times in succession, the sounds are played in that order as one might think. what is the proper what to achieve this where i can prepare all of the sounds to be played at the same time and then play them as one? Sudo Code: SoundPool _soundPool = new SoundPool(10, AudioManager.STREAM_MUSIC, 0); _soundPool.load(_context, soundId1, 1); _soundPool.load(_context

Changing ringer profile when receiving sms

丶灬走出姿态 提交于 2019-12-03 20:52:39
Hello there i'm newbie in Android development I'm trying to make an app that changes the ringer profile when receive a specific sms, also i can change it by the buttons on the layout (the buttons are working good), but the sms way isn't working i tried as shown below MainActivity.java package com.example.test; import android.media.AudioManager; import android.os.Bundle; import android.app.Activity; import android.content.Context; import android.view.Menu; import android.view.View; import android.widget.Button; import android.widget.TextView; public class MainActivity extends Activity { private

Android - How to get list of AudioManager / AudioSystem parameters

落爺英雄遲暮 提交于 2019-12-03 11:24:15
问题 AudioManager has a setParameters method that accepts a Key-Value pair in string representation ("parameter_name=parameter_value"). Internally, it calls native AudioSystem.setParameters . The only way to get a parameter value is if you know its name, by calling AudioManager.getParameters method which calls the corresponding native method in `AudioSystem'. Is there a way (using reflection or other techniques) to get a list of supported parameters (of course the result will be dependent on the