Java Code Examples for android.media.audiofx.AudioEffect#Descriptor

The following examples show how to use android.media.audiofx.AudioEffect#Descriptor . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AudioRecordJNI.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example 2
Source File: AudioRecordJNI.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example 3
Source File: Util.java    From RetroMusicPlayer with GNU General Public License v3.0 5 votes vote down vote up
public static boolean hasEqualizer() {
    for (AudioEffect.Descriptor effect : AudioEffect.queryEffects()) {
        if (EQUALIZER_UUID.equals(effect.type)) {
            return true;
        }
    }
    return false;
}
 
Example 4
Source File: GaplessPlayer.java    From odyssey with GNU General Public License v3.0 5 votes vote down vote up
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);
    }
}
 
Example 5
Source File: EqualizerVolumePanel.java    From Noyze with Apache License 2.0 5 votes vote down vote up
/** @see android.media.audiofx.AudioEffect.Descriptor#uuid */
protected boolean hasFeature(UUID uuid) {
    // Build of array of UUIDs to search through.
    if (null == uuids || uuids.length == 0) {
        uuids = new UUID[descriptors.length];
        int i = -1;
        for (AudioEffect.Descriptor descriptor : descriptors)
            uuids[++i] = descriptor.uuid;
    }
    return (Arrays.binarySearch(uuids, uuid) >= 0);
}
 
Example 6
Source File: EqualizerVolumePanel.java    From Noyze with Apache License 2.0 5 votes vote down vote up
/** @see android.media.audiofx.AudioEffect.Descriptor#name */
protected String[] getDescriptorNames() {
    // Build of array of UUIDs to search through.
    String[] names = new String[descriptors.length];
    int i = -1;
    for (AudioEffect.Descriptor descriptor : descriptors)
        names[++i] = descriptor.name;
    return names;
}
 
Example 7
Source File: Util.java    From Jockey with Apache License 2.0 5 votes vote down vote up
/**
 * Checks whether the current device is capable of instantiating and using an
 * {@link android.media.audiofx.Equalizer}
 * @return True if an Equalizer may be used at runtime
 */
public static boolean hasEqualizer() {
    for (AudioEffect.Descriptor effect : AudioEffect.queryEffects()) {
        if (EQUALIZER_UUID.equals(effect.type)) {
            return true;
        }
    }
    return false;
}
 
Example 8
Source File: EqualizerVolumePanel.java    From Noyze with Apache License 2.0 5 votes vote down vote up
/** @see android.media.audiofx.AudioEffect.Descriptor#uuid */
protected boolean hasFeature(UUID uuid) {
    // Build of array of UUIDs to search through.
    if (null == uuids || uuids.length == 0) {
        uuids = new UUID[descriptors.length];
        int i = -1;
        for (AudioEffect.Descriptor descriptor : descriptors)
            uuids[++i] = descriptor.uuid;
    }
    return (Arrays.binarySearch(uuids, uuid) >= 0);
}
 
Example 9
Source File: EqualizerVolumePanel.java    From Noyze with Apache License 2.0 5 votes vote down vote up
/** @see android.media.audiofx.AudioEffect.Descriptor#name */
protected String[] getDescriptorNames() {
    // Build of array of UUIDs to search through.
    String[] names = new String[descriptors.length];
    int i = -1;
    for (AudioEffect.Descriptor descriptor : descriptors)
        names[++i] = descriptor.name;
    return names;
}
 
Example 10
Source File: EqualizerVolumePanel.java    From Noyze with Apache License 2.0 4 votes vote down vote up
/** @see android.media.audiofx.AudioEffect.Descriptor */
protected boolean hasFeature(AudioEffect.Descriptor descriptor) {
    return (Arrays.binarySearch(descriptors, descriptor) >= 0);
}
 
Example 11
Source File: EqualizerVolumePanel.java    From Noyze with Apache License 2.0 4 votes vote down vote up
/** @see android.media.audiofx.AudioEffect.Descriptor */
protected boolean hasFeature(AudioEffect.Descriptor descriptor) {
    return (Arrays.binarySearch(descriptors, descriptor) >= 0);
}