当前位置: 首页>>代码示例>>Java>>正文


Java Equalizer类代码示例

本文整理汇总了Java中android.media.audiofx.Equalizer的典型用法代码示例。如果您正苦于以下问题:Java Equalizer类的具体用法?Java Equalizer怎么用?Java Equalizer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Equalizer类属于android.media.audiofx包,在下文中一共展示了Equalizer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: EqualizerController

import android.media.audiofx.Equalizer; //导入依赖的package包/类
public EqualizerController(Context context, MediaPlayer mediaPlayer)
{
	this.context = context;

	try
	{
		if (mediaPlayer == null)
		{
			return;
		}

		audioSessionId = mediaPlayer.getAudioSessionId();
		equalizer = new Equalizer(0, audioSessionId);
	}
	catch (Throwable x)
	{
		equalizer = null;
		Log.w(TAG, "Failed to create equalizer.", x);
	}
}
 
开发者ID:ultrasonic,项目名称:ultrasonic,代码行数:21,代码来源:EqualizerController.java

示例2: getEqualizer

import android.media.audiofx.Equalizer; //导入依赖的package包/类
public Equalizer getEqualizer()
{
	if (released)
	{
		released = false;

		try
		{
			equalizer = new Equalizer(0, audioSessionId);
		}
		catch (Throwable x)
		{
			equalizer = null;
			Log.w(TAG, "Failed to create equalizer.", x);
		}
	}

	return equalizer;
}
 
开发者ID:ultrasonic,项目名称:ultrasonic,代码行数:20,代码来源:EqualizerController.java

示例3: EqualizerSettings

import android.media.audiofx.Equalizer; //导入依赖的package包/类
public EqualizerSettings(Equalizer equalizer)
{
	enabled = equalizer.getEnabled();
	bandLevels = new short[equalizer.getNumberOfBands()];

	for (short i = 0; i < equalizer.getNumberOfBands(); i++)
	{
		bandLevels[i] = equalizer.getBandLevel(i);
	}

	try
	{
		preset = equalizer.getCurrentPreset();
	}
	catch (Exception x)
	{
		preset = -1;
	}
}
 
开发者ID:ultrasonic,项目名称:ultrasonic,代码行数:20,代码来源:EqualizerController.java

示例4: isEqualizerSupported

import android.media.audiofx.Equalizer; //导入依赖的package包/类
public static boolean isEqualizerSupported() {
    int noOfBands = 0;
    int noOfPresents = 0;
    try {
        Equalizer equalizer = new Equalizer(0, 0);
        noOfBands = equalizer.getNumberOfBands();
        noOfPresents = equalizer.getNumberOfPresets();
        equalizer.release();
        equalizer = null;
    } catch (Exception e) {

    }

    return noOfBands > 0 && noOfPresents > 0 && !isHTC();

}
 
开发者ID:reyanshmishra,项目名称:Rey-MusicPlayer,代码行数:17,代码来源:MusicUtils.java

示例5: initEq

import android.media.audiofx.Equalizer; //导入依赖的package包/类
public static void initEq(int audioID) {
    EndEq();
    try {
        equalizer = new Equalizer(0, audioID);
        preset = (short) Extras.getInstance().saveEq().getInt(SAVE_PRESET, 0);
        if (preset < equalizer.getNumberOfPresets()){
            usePreset(preset);
        }else {
            for (short b = 0; b < equalizer.getNumberOfBands(); b++) {
                short level = (short) Extras.getInstance().saveEq().getInt(BAND_LEVEL + b, 0);
                setBandLevel(b, level);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:RajneeshSingh007,项目名称:MusicX-music-player,代码行数:18,代码来源:Equalizers.java

示例6: restoreEqualizer

import android.media.audiofx.Equalizer; //导入依赖的package包/类
private void restoreEqualizer() {
    mEqualizer = new Equalizer(Integer.MAX_VALUE, mSessionId);

    synchronized (SETTINGS_LOCK) {
        final EffectsProto.EqualizerSettings proto = mEqualizerSettings;
        if (proto.curPreset != 0
                || proto.numBands != 0
                || proto.bandValues.length != 0) {
            final Equalizer.Settings settings = new Equalizer.Settings();
            settings.curPreset = (short) proto.curPreset;
            settings.numBands = (short) proto.numBands;
            settings.bandLevels = new short[proto.bandValues.length];
            for (int i = 0; i < settings.bandLevels.length; i++) {
                settings.bandLevels[i] = (short) proto.bandValues[i];
            }

            try {
                mEqualizer.setProperties(settings);
            } catch (IllegalArgumentException e) {
                Log.wtf(TAG, "Failed restoring equalizer settings", e);
            }
        }
    }

    mEqualizer.setEnabled(true);
}
 
开发者ID:Doctoror,项目名称:PainlessMusicPlayer,代码行数:27,代码来源:AudioEffects.java

示例7: saveEqualizerSettings

import android.media.audiofx.Equalizer; //导入依赖的package包/类
void saveEqualizerSettings(@NonNull final Equalizer.Settings settings) {
    synchronized (SETTINGS_LOCK) {
        final EffectsProto.EqualizerSettings proto = mEqualizerSettings;
        proto.curPreset = settings.curPreset;
        proto.numBands = settings.numBands;

        final short[] bandLevels = settings.bandLevels;
        proto.bandValues = new int[bandLevels != null ? bandLevels.length : 0];
        if (bandLevels != null) {
            for (int i = 0; i < bandLevels.length; i++) {
                proto.bandValues[i] = bandLevels[i];
            }
        }
    }

    persistEqualizerSettingsAsync();
}
 
开发者ID:Doctoror,项目名称:PainlessMusicPlayer,代码行数:18,代码来源:AudioEffects.java

示例8: release

import android.media.audiofx.Equalizer; //导入依赖的package包/类
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();
    }
}
 
开发者ID:Tombarr,项目名称:Noyze,代码行数:15,代码来源:EqualizerVolumePanel.java

示例9: ImmutablePreferenceStore

import android.media.audiofx.Equalizer; //导入依赖的package包/类
public ImmutablePreferenceStore(ReadOnlyPreferenceStore preferencesStore) {
    mShowFirstStart = preferencesStore.showFirstStart();
    mAllowLogging = preferencesStore.allowLogging();
    mUseMobileNetwork = preferencesStore.useMobileNetwork();
    mOpenNowPlayingOnNewQueue = preferencesStore.openNowPlayingOnNewQueue();
    mEnableNowPlayingGestures = preferencesStore.enableNowPlayingGestures();
    mDefaultPage = preferencesStore.getDefaultPage();
    mPrimaryColor = preferencesStore.getPrimaryColor();
    mAccentColor = preferencesStore.getAccentColor();
    mBaseColor = preferencesStore.getBaseColor();
    mIconColor = preferencesStore.getIconColor();
    mResumeOnHeadphonesConnect = preferencesStore.resumeOnHeadphonesConnect();
    mShuffled = preferencesStore.isShuffled();
    mPreviousSleepTimerDurationMillis = preferencesStore.getLastSleepTimerDuration();
    mRepeatMode = preferencesStore.getRepeatMode();
    mEqualizerPresetId = preferencesStore.getEqualizerPresetId();
    mEqualizerEnabled = preferencesStore.getEqualizerEnabled();

    Equalizer.Settings eqSettings = preferencesStore.getEqualizerSettings();
    if (eqSettings != null) {
        mEqualizerSettings = eqSettings.toString();
    } else {
        mEqualizerSettings = null;
    }
}
 
开发者ID:marverenic,项目名称:Jockey,代码行数:26,代码来源:ImmutablePreferenceStore.java

示例10: EqualizerController

import android.media.audiofx.Equalizer; //导入依赖的package包/类
public EqualizerController(Context context, MediaPlayer mediaPlayer) {
     this.context = context;
     try {
audioSessionId = mediaPlayer.getAudioSessionId();
         equalizer = new Equalizer(0, audioSessionId);
     } catch (Throwable x) {
         LOG.warn("Failed to create equalizer.", x);
     }
 }
 
开发者ID:MadMarty,项目名称:madsonic-5.5,代码行数:10,代码来源:EqualizerController.java

示例11: getEqualizer

import android.media.audiofx.Equalizer; //导入依赖的package包/类
public Equalizer getEqualizer() {
if(released) {
	released = false;
	try {
		equalizer = new Equalizer(0, audioSessionId);
	} catch (Throwable x) {
		equalizer = null;
		LOG.warn("Failed to create equalizer.", x);
	}
}
      return equalizer;
  }
 
开发者ID:MadMarty,项目名称:madsonic-5.5,代码行数:13,代码来源:EqualizerController.java

示例12: EqualizerSettings

import android.media.audiofx.Equalizer; //导入依赖的package包/类
public EqualizerSettings(Equalizer equalizer) {
    enabled = equalizer.getEnabled();
    bandLevels = new short[equalizer.getNumberOfBands()];
    for (short i = 0; i < equalizer.getNumberOfBands(); i++) {
        bandLevels[i] = equalizer.getBandLevel(i);
    }
    try {
        preset = equalizer.getCurrentPreset();
    } catch (Exception x) {
        preset = -1;
    }
}
 
开发者ID:MadMarty,项目名称:madsonic-5.5,代码行数:13,代码来源:EqualizerController.java

示例13: apply

import android.media.audiofx.Equalizer; //导入依赖的package包/类
public void apply(Equalizer equalizer)
{
	for (short i = 0; i < bandLevels.length; i++)
	{
		equalizer.setBandLevel(i, bandLevels[i]);
	}

	if (preset >= 0 && preset < equalizer.getNumberOfPresets())
	{
		equalizer.usePreset(preset);
	}

	equalizer.setEnabled(enabled);
}
 
开发者ID:ultrasonic,项目名称:ultrasonic,代码行数:15,代码来源:EqualizerController.java

示例14: EqualizerHelper

import android.media.audiofx.Equalizer; //导入依赖的package包/类
public EqualizerHelper(int audioSessionId1, boolean equalizerEnabled) throws RuntimeException {

        mEqualizer = new Equalizer(0, audioSessionId1);
        mEqualizer.setEnabled(equalizerEnabled);

        mVirtualizer = new Virtualizer(0, audioSessionId1);
        mVirtualizer.setEnabled(equalizerEnabled);

        mBassBoost = new BassBoost(0, audioSessionId1);
        mBassBoost.setEnabled(equalizerEnabled);

        mPresetReverb = new PresetReverb(0, audioSessionId1);
        mPresetReverb.setEnabled(equalizerEnabled);
    }
 
开发者ID:reyanshmishra,项目名称:Rey-MusicPlayer,代码行数:15,代码来源:EqualizerHelper.java

示例15: init

import android.media.audiofx.Equalizer; //导入依赖的package包/类
private void init() {
	equalizer = new Equalizer(0, audioSessionId);
	bass = new BassBoost(0, audioSessionId);
	if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
		loudnessAvailable = true;
		loudnessEnhancerController = new LoudnessEnhancerController(context, audioSessionId);
	}
}
 
开发者ID:nvllsvm,项目名称:Audinaut,代码行数:9,代码来源:EqualizerController.java


注:本文中的android.media.audiofx.Equalizer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。