下面列出了怎么用android.media.audiofx.AudioEffect的API类实例代码及写法,或者点击链接到github查看源代码。
public void pause() {
if (D) Log.d(TAG, "Pausing playback");
synchronized (this) {
mPlayerHandler.removeMessages(FADEUP);
if (mIsSupposedToBePlaying) {
final Intent intent = new Intent(
AudioEffect.ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION);
intent.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, getAudioSessionId());
intent.putExtra(AudioEffect.EXTRA_PACKAGE_NAME, getPackageName());
sendBroadcast(intent);
mPlayer.pause();
notifyChange(META_CHANGED);
setIsSupposedToBePlaying(false, true);
}
}
}
private static boolean isGoodAudioEffect(AudioEffect effect){
Pattern globalImpl=makeNonEmptyRegex("adsp_good_impls"), globalName=makeNonEmptyRegex("adsp_good_names");
AudioEffect.Descriptor desc=effect.getDescriptor();
VLog.d(effect.getClass().getSimpleName()+": implementor="+desc.implementor+", name="+desc.name);
if(globalImpl!=null && globalImpl.matcher(desc.implementor).find()){
return true;
}
if(globalName!=null && globalName.matcher(desc.name).find()){
return true;
}
if(effect instanceof AcousticEchoCanceler){
Pattern impl=makeNonEmptyRegex("aaec_good_impls"), name=makeNonEmptyRegex("aaec_good_names");
if(impl!=null && impl.matcher(desc.implementor).find())
return true;
if(name!=null && name.matcher(desc.name).find())
return true;
}
if(effect instanceof NoiseSuppressor){
Pattern impl=makeNonEmptyRegex("ans_good_impls"), name=makeNonEmptyRegex("ans_good_names");
if(impl!=null && impl.matcher(desc.implementor).find())
return true;
if(name!=null && name.matcher(desc.name).find())
return true;
}
return false;
}
private static boolean isGoodAudioEffect(AudioEffect effect){
Pattern globalImpl=makeNonEmptyRegex("adsp_good_impls"), globalName=makeNonEmptyRegex("adsp_good_names");
AudioEffect.Descriptor desc=effect.getDescriptor();
VLog.d(effect.getClass().getSimpleName()+": implementor="+desc.implementor+", name="+desc.name);
if(globalImpl!=null && globalImpl.matcher(desc.implementor).find()){
return true;
}
if(globalName!=null && globalName.matcher(desc.name).find()){
return true;
}
if(effect instanceof AcousticEchoCanceler){
Pattern impl=makeNonEmptyRegex("aaec_good_impls"), name=makeNonEmptyRegex("aaec_good_names");
if(impl!=null && impl.matcher(desc.implementor).find())
return true;
if(name!=null && name.matcher(desc.name).find())
return true;
}
if(effect instanceof NoiseSuppressor){
Pattern impl=makeNonEmptyRegex("ans_good_impls"), name=makeNonEmptyRegex("ans_good_names");
if(impl!=null && impl.matcher(desc.implementor).find())
return true;
if(name!=null && name.matcher(desc.name).find())
return true;
}
return false;
}
private static boolean isAcousticEchoCancelerExcludedByUUID() {
if (Build.VERSION.SDK_INT < 18)
return false;
for (Descriptor d : getAvailableEffects()) {
if (d.type.equals(AudioEffect.EFFECT_TYPE_AEC)
&& d.uuid.equals(AOSP_ACOUSTIC_ECHO_CANCELER)) {
return true;
}
}
return false;
}
private static boolean isNoiseSuppressorExcludedByUUID() {
if (Build.VERSION.SDK_INT < 18)
return false;
for (Descriptor d : getAvailableEffects()) {
if (d.type.equals(AudioEffect.EFFECT_TYPE_NS) && d.uuid.equals(AOSP_NOISE_SUPPRESSOR)) {
return true;
}
}
return false;
}
private boolean effectTypeIsVoIP(UUID type) {
if (Build.VERSION.SDK_INT < 18)
return false;
return (AudioEffect.EFFECT_TYPE_AEC.equals(type) && isAcousticEchoCancelerSupported())
|| (AudioEffect.EFFECT_TYPE_NS.equals(type) && isNoiseSuppressorSupported());
}
private boolean effectTypeIsVoIP(UUID type) {
if (Build.VERSION.SDK_INT < 18)
return false;
return (AudioEffect.EFFECT_TYPE_AEC.equals(type) && isAcousticEchoCancelerSupported())
|| (AudioEffect.EFFECT_TYPE_NS.equals(type) && isNoiseSuppressorSupported());
}
private static Descriptor[] getAvailableEffects() {
if (cachedEffects != null) {
return cachedEffects;
}
// The caching is best effort only - if this method is called from several
// threads in parallel, they may end up doing the underlying OS call
// multiple times. It's normally only called on one thread so there's no
// real need to optimize for the multiple threads case.
cachedEffects = AudioEffect.queryEffects();
return cachedEffects;
}
@Override
public void onDestroy() {
// Check that we're not being destroyed while something is still playing.
if (isPlaying()) {
Log.e(LOGTAG, "Service being destroyed while still playing.");
}
// release all MediaPlayer resources, including the native player and wakelocks
Intent i = new Intent(AudioEffect.ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION);
i.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, getAudioSessionId());
i.putExtra(AudioEffect.EXTRA_PACKAGE_NAME, getPackageName());
sendBroadcast(i);
mPlayer.release();
mPlayer = null;
mAudioManager.abandonAudioFocus(mAudioFocusListener);
//mAudioManager.unregisterRemoteControlClient(mRemoteControlClient);
// make sure there aren't any other messages coming
mDelayedStopHandler.removeCallbacksAndMessages(null);
mMediaplayerHandler.removeCallbacksAndMessages(null);
if (mCursor != null) {
mCursor.close();
mCursor = null;
}
unregisterReceiver(mIntentReceiver);
if (mUnmountReceiver != null) {
unregisterReceiver(mUnmountReceiver);
mUnmountReceiver = null;
}
mWakeLock.release();
mWorker.quit();
super.onDestroy();
}
/**
* @param player The {@link MediaPlayer} to use
* @param path The path of the file, or the http/rtsp URL of the stream
* you want to play
* @return True if the <code>player</code> has been prepared and is
* ready to play, false otherwise
*/
private boolean setDataSourceImpl(@NonNull final MediaPlayer player, @NonNull final String path) {
if (context == null) {
return false;
}
try {
player.reset();
player.setOnPreparedListener(null);
if (path.startsWith("content://")) {
player.setDataSource(context, Uri.parse(path));
} else {
player.setDataSource(path);
}
player.setAudioStreamType(AudioManager.STREAM_MUSIC);
player.prepare();
} catch (Exception e) {
return false;
}
player.setOnCompletionListener(this);
player.setOnErrorListener(this);
final Intent intent = new Intent(AudioEffect.ACTION_OPEN_AUDIO_EFFECT_CONTROL_SESSION);
intent.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, getAudioSessionId());
intent.putExtra(AudioEffect.EXTRA_PACKAGE_NAME, context.getPackageName());
intent.putExtra(AudioEffect.EXTRA_CONTENT_TYPE, AudioEffect.CONTENT_TYPE_MUSIC);
context.sendBroadcast(intent);
return true;
}
public static void openEqualizer(@NonNull final Activity activity) {
final int sessionId = MusicPlayerRemote.getAudioSessionId();
if (sessionId == AudioEffect.ERROR_BAD_VALUE) {
Toast.makeText(activity, activity.getResources().getString(R.string.no_audio_ID), Toast.LENGTH_LONG).show();
} else {
try {
final Intent effects = new Intent(AudioEffect.ACTION_DISPLAY_AUDIO_EFFECT_CONTROL_PANEL);
effects.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, sessionId);
effects.putExtra(AudioEffect.EXTRA_CONTENT_TYPE, AudioEffect.CONTENT_TYPE_MUSIC);
activity.startActivityForResult(effects, 0);
} catch (@NonNull final ActivityNotFoundException notFound) {
Toast.makeText(activity, activity.getResources().getString(R.string.no_equalizer), Toast.LENGTH_SHORT).show();
}
}
}
/**
* @param player The {@link MediaPlayer} to use
* @param path The path of the file, or the http/rtsp URL of the stream
* you want to play
* @return True if the <code>player</code> has been prepared and is
* ready to play, false otherwise
*/
private boolean setDataSourceImpl(@NonNull final MediaPlayer player, @NonNull final String path) {
if (context == null) {
return false;
}
try {
player.reset();
player.setOnPreparedListener(null);
if (path.startsWith("content://")) {
player.setDataSource(context, Uri.parse(path));
} else {
player.setDataSource(path);
}
player.setAudioStreamType(AudioManager.STREAM_MUSIC);
player.prepare();
} catch (Exception e) {
return false;
}
player.setOnCompletionListener(this);
player.setOnErrorListener(this);
final Intent intent = new Intent(AudioEffect.ACTION_OPEN_AUDIO_EFFECT_CONTROL_SESSION);
intent.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, getAudioSessionId());
intent.putExtra(AudioEffect.EXTRA_PACKAGE_NAME, context.getPackageName());
intent.putExtra(AudioEffect.EXTRA_CONTENT_TYPE, AudioEffect.CONTENT_TYPE_MUSIC);
context.sendBroadcast(intent);
return true;
}
public static void openEqualizer(@NonNull final Activity activity) {
final int sessionId = MusicPlayerRemote.getAudioSessionId();
if (sessionId == AudioEffect.ERROR_BAD_VALUE) {
Toasty.error(activity, activity.getResources().getString(R.string.no_audio_ID)).show();
} else {
try {
final Intent effects = new Intent(AudioEffect.ACTION_DISPLAY_AUDIO_EFFECT_CONTROL_PANEL);
effects.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, sessionId);
effects.putExtra(AudioEffect.EXTRA_CONTENT_TYPE, AudioEffect.CONTENT_TYPE_MUSIC);
activity.startActivityForResult(effects, 0);
} catch (@NonNull final ActivityNotFoundException notFound) {
Toasty.error(activity, activity.getResources().getString(R.string.no_equalizer)).show();
}
}
}
private void release(AudioEffect effect) {
if (null != effect) {
effect.setControlStatusListener(null);
effect.setEnableStatusListener(null);
if (effect instanceof Equalizer) {
((Equalizer) effect).setParameterListener(null);
} else if (effect instanceof BassBoost) {
((BassBoost) effect).setParameterListener(null);
} else if (effect instanceof Virtualizer) {
((Virtualizer) effect).setParameterListener(null);
}
effect.release();
}
}
@Override
public void onEnableStatusChange(AudioEffect effect, boolean enabled) {
final IAudioEffect ieffect = mRefEffect.get();
final IAudioEffect.OnEnableStatusChangeListener listener = mListener;
if (ieffect != null && listener != null) {
listener.onEnableStatusChange(ieffect, enabled);
}
}
public static void openEqualizer(@NonNull final Activity activity) {
final int sessionId = MusicPlayerRemote.getAudioSessionId();
if (sessionId == AudioEffect.ERROR_BAD_VALUE) {
Toast.makeText(activity, activity.getResources().getString(R.string.no_audio_ID), Toast.LENGTH_LONG).show();
} else {
try {
final Intent effects = new Intent(AudioEffect.ACTION_DISPLAY_AUDIO_EFFECT_CONTROL_PANEL);
effects.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, sessionId);
effects.putExtra(AudioEffect.EXTRA_CONTENT_TYPE, AudioEffect.CONTENT_TYPE_MUSIC);
activity.startActivityForResult(effects, 0);
} catch (@NonNull final ActivityNotFoundException notFound) {
Toast.makeText(activity, activity.getResources().getString(R.string.no_equalizer), Toast.LENGTH_SHORT).show();
}
}
}
@Override
public AudioEffect create(int audioSession) {
try {
return new LoudnessEnhancer(audioSession);
} catch (RuntimeException e) {
// NOTE: some devices doesn't support LoudnessEnhancer class and may throw an exception
// (ME176C throws IllegalArgumentException)
Log.w(TAG, "Failed to instantiate loudness enhancer class", e);
}
return null;
}
@Override
public void onDestroy() {
// Check that we're not being destroyed while something is still playing.
if (isPlaying()) {
Log.e(LOGTAG, "Service being destroyed while still playing.");
}
// release all MediaPlayer resources, including the native player and wakelocks
Intent i = new Intent(AudioEffect.ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION);
i.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, getAudioSessionId());
i.putExtra(AudioEffect.EXTRA_PACKAGE_NAME, getPackageName());
sendBroadcast(i);
mPlayer.release();
mPlayer = null;
mAudioManager.abandonAudioFocus(mAudioFocusListener);
//mAudioManager.unregisterRemoteControlClient(mRemoteControlClient);
// make sure there aren't any other messages coming
mDelayedStopHandler.removeCallbacksAndMessages(null);
mMediaplayerHandler.removeCallbacksAndMessages(null);
if (mCursor != null) {
mCursor.close();
mCursor = null;
}
unregisterReceiver(mIntentReceiver);
if (mUnmountReceiver != null) {
unregisterReceiver(mUnmountReceiver);
mUnmountReceiver = null;
}
mWakeLock.release();
super.onDestroy();
}
/**
* @param player The {@link MediaPlayer} to use
* @param path The path of the file, or the http/rtsp URL of the stream
* you want to play
* @return True if the <code>player</code> has been prepared and is
* ready to play, false otherwise
*/
private boolean setDataSourceImpl(@NonNull final MediaPlayer player, @NonNull final String path) {
if (context == null) {
return false;
}
try {
player.reset();
player.setOnPreparedListener(null);
if (path.startsWith("content://")) {
player.setDataSource(context, Uri.parse(path));
} else {
player.setDataSource(path);
}
player.setAudioStreamType(AudioManager.STREAM_MUSIC);
player.prepare();
} catch (Exception e) {
return false;
}
player.setOnCompletionListener(this);
player.setOnErrorListener(this);
final Intent intent = new Intent(AudioEffect.ACTION_OPEN_AUDIO_EFFECT_CONTROL_SESSION);
intent.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, getAudioSessionId());
intent.putExtra(AudioEffect.EXTRA_PACKAGE_NAME, context.getPackageName());
intent.putExtra(AudioEffect.EXTRA_CONTENT_TYPE, AudioEffect.CONTENT_TYPE_MUSIC);
context.sendBroadcast(intent);
return true;
}
public static boolean hasEqualizer() {
for (AudioEffect.Descriptor effect : AudioEffect.queryEffects()) {
if (EQUALIZER_UUID.equals(effect.type)) {
return true;
}
}
return false;
}
/**
* @param player The {@link MediaPlayer} to use
* @param path The path of the file, or the http/rtsp URL of the stream
* you want to play
* @return True if the <code>player</code> has been prepared and is
* ready to play, false otherwise
*/
private boolean setDataSourceImpl(@NonNull final MediaPlayer player, @NonNull final String path) {
if (context == null) {
return false;
}
try {
player.reset();
player.setOnPreparedListener(null);
if (path.startsWith("content://")) {
player.setDataSource(context, Uri.parse(path));
} else {
player.setDataSource(path);
}
player.setAudioStreamType(AudioManager.STREAM_MUSIC);
player.prepare();
} catch (Exception e) {
return false;
}
player.setOnCompletionListener(this);
player.setOnErrorListener(this);
final Intent intent = new Intent(AudioEffect.ACTION_OPEN_AUDIO_EFFECT_CONTROL_SESSION);
intent.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, getAudioSessionId());
intent.putExtra(AudioEffect.EXTRA_PACKAGE_NAME, context.getPackageName());
intent.putExtra(AudioEffect.EXTRA_CONTENT_TYPE, AudioEffect.CONTENT_TYPE_MUSIC);
context.sendBroadcast(intent);
return true;
}
private boolean hasEqualizer() {
final Intent effects = new Intent(AudioEffect.ACTION_DISPLAY_AUDIO_EFFECT_CONTROL_PANEL);
if (getActivity() != null) {
PackageManager pm = getActivity().getPackageManager();
ResolveInfo ri = pm.resolveActivity(effects, 0);
return ri != null;
}
return false;
}
public static void openEqualizer(@NonNull final Activity activity) {
final int sessionId = MusicPlayerRemote.getAudioSessionId();
if (sessionId == AudioEffect.ERROR_BAD_VALUE) {
Toast.makeText(activity, activity.getResources().getString(R.string.no_audio_ID), Toast.LENGTH_LONG).show();
} else {
try {
final Intent effects = new Intent(AudioEffect.ACTION_DISPLAY_AUDIO_EFFECT_CONTROL_PANEL);
effects.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, sessionId);
effects.putExtra(AudioEffect.EXTRA_CONTENT_TYPE, AudioEffect.CONTENT_TYPE_MUSIC);
activity.startActivityForResult(effects, 0);
} catch (@NonNull final ActivityNotFoundException notFound) {
Toast.makeText(activity, activity.getResources().getString(R.string.no_equalizer), Toast.LENGTH_SHORT).show();
}
}
}
@Override
public void onDestroy() {
if (D) Log.d(TAG, "Destroying service");
super.onDestroy();
// Remove any sound effects
final Intent audioEffectsIntent = new Intent(
AudioEffect.ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION);
audioEffectsIntent.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, getAudioSessionId());
audioEffectsIntent.putExtra(AudioEffect.EXTRA_PACKAGE_NAME, getPackageName());
sendBroadcast(audioEffectsIntent);
mAlarmManager.cancel(mShutdownIntent);
mPlayerHandler.removeCallbacksAndMessages(null);
if (TimberUtils.isJellyBeanMR2())
mHandlerThread.quitSafely();
else mHandlerThread.quit();
mPlayer.release();
mPlayer = null;
mAudioManager.abandonAudioFocus(mAudioFocusListener);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
mSession.release();
getContentResolver().unregisterContentObserver(mMediaStoreObserver);
closeCursor();
unregisterReceiver(mIntentReceiver);
if (mUnmountReceiver != null) {
unregisterReceiver(mUnmountReceiver);
mUnmountReceiver = null;
}
mWakeLock.release();
}
@Override
public void onDestroy() {
super.onDestroy();
instance = null;
if (currentPlaying != null) currentPlaying.setPlaying(false);
lifecycleSupport.onDestroy();
Intent i = new Intent(AudioEffect.ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION);
i.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, audioSessionId);
i.putExtra(AudioEffect.EXTRA_PACKAGE_NAME, getPackageName());
sendBroadcast(i);
mediaPlayer.release();
if (nextMediaPlayer != null) {
nextMediaPlayer.release();
}
mediaPlayerLooper.quit();
shufflePlayBuffer.shutdown();
effectsController.release();
if (bufferTask != null) {
bufferTask.cancel();
bufferTask = null;
}
if (nextPlayingTask != null) {
nextPlayingTask.cancel();
nextPlayingTask = null;
}
if (proxy != null) {
proxy.stop();
proxy = null;
}
Notifications.hidePlayingNotification(this, this, handler);
Notifications.hideDownloadingNotification(this, this, handler);
unregisterReceiver(audioNoisyReceiver);
}
/**
* Respond to clicks on actionbar options
*/
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_search:
onSearchRequested();
break;
case R.id.action_settings:
startActivityForResult(new Intent(this, SettingsHolder.class),0);
break;
case R.id.action_eqalizer:
final Intent intent = new Intent(AudioEffect.ACTION_DISPLAY_AUDIO_EFFECT_CONTROL_PANEL);
if (getPackageManager().resolveActivity(intent, 0) == null) {
startActivity(new Intent(this, SimpleEq.class));
}
else{
intent.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, MusicUtils.getCurrentAudioId());
startActivity(intent);
}
break;
case R.id.action_shuffle_all:
shuffleAll();
break;
default:
return super.onOptionsItemSelected(item);
}
return true;
}
/**
* Stops media playback
*/
synchronized void stop() {
stopReleaseTask();
// Check if a player exists otherwise there is nothing to do.
if (mCurrentMediaPlayer != null) {
// Check if the player for the next song exists already
if (mNextMediaPlayer != null) {
// Remove the next player from the currently playing one.
mCurrentMediaPlayer.setNextMediaPlayer(null);
// Release the MediaPlayer, not usable after this command
mNextMediaPlayer.release();
// Reset variables to clean internal state
mNextMediaPlayer = null;
mSecondPrepared = false;
mSecondPreparing = false;
}
// Check if the currently active player is ready
if (mCurrentPrepared) {
/*
* Signal android desire to close audio effect session
*/
Intent audioEffectIntent = new Intent(AudioEffect.ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION);
audioEffectIntent.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, mCurrentMediaPlayer.getAudioSessionId());
audioEffectIntent.putExtra(AudioEffect.EXTRA_PACKAGE_NAME, mPlaybackService.getPackageName());
mPlaybackService.sendBroadcast(audioEffectIntent);
if (BuildConfig.DEBUG) {
Log.v(TAG, "Closing effect for session: " + mCurrentMediaPlayer.getAudioSessionId());
}
}
// Release the current player
mCurrentMediaPlayer.release();
// Reset variables to clean internal state
mCurrentMediaPlayer = null;
mCurrentPrepared = false;
}
}
private void dumpAudioEffectsState() {
AudioEffect.Descriptor[] effects = AudioEffect.queryEffects();
Log.v(TAG, "Found audio effects: " + effects.length);
for (AudioEffect.Descriptor effect : effects) {
Log.v(TAG, "AudioEffect: " + effect.name + " connect mode: " + effect.connectMode + " implementor: " + effect.implementor);
}
}
/**
* @param player The {@link MediaPlayer} to use
* @param path The path of the file, or the http/rtsp URL of the stream
* you want to play
* @return True if the <code>player</code> has been prepared and is
* ready to play, false otherwise
*/
private boolean setDataSourceImpl(@NonNull final MediaPlayer player, @NonNull final String path) {
if (context == null) {
return false;
}
try {
player.reset();
player.setOnPreparedListener(null);
if (path.startsWith("content://")) {
player.setDataSource(context, Uri.parse(path));
} else {
player.setDataSource(path);
}
player.setAudioStreamType(AudioManager.STREAM_MUSIC);
player.prepare();
} catch (Exception e) {
return false;
}
player.setOnCompletionListener(this);
player.setOnErrorListener(this);
final Intent intent = new Intent(AudioEffect.ACTION_OPEN_AUDIO_EFFECT_CONTROL_SESSION);
intent.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, getAudioSessionId());
intent.putExtra(AudioEffect.EXTRA_PACKAGE_NAME, context.getPackageName());
intent.putExtra(AudioEffect.EXTRA_CONTENT_TYPE, AudioEffect.CONTENT_TYPE_MUSIC);
context.sendBroadcast(intent);
return true;
}
public static void openEqualizer(@NonNull final Activity activity) {
final int sessionId = MusicPlayerRemote.getAudioSessionId();
if (sessionId == AudioEffect.ERROR_BAD_VALUE) {
Toast.makeText(activity, activity.getResources().getString(R.string.no_audio_ID), Toast.LENGTH_LONG).show();
} else {
try {
final Intent effects = new Intent(AudioEffect.ACTION_DISPLAY_AUDIO_EFFECT_CONTROL_PANEL);
effects.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, sessionId);
effects.putExtra(AudioEffect.EXTRA_CONTENT_TYPE, AudioEffect.CONTENT_TYPE_MUSIC);
activity.startActivityForResult(effects, 0);
} catch (@NonNull final ActivityNotFoundException notFound) {
Toast.makeText(activity, activity.getResources().getString(R.string.no_equalizer), Toast.LENGTH_SHORT).show();
}
}
}