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


Java LoudnessEnhancer类代码示例

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


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

示例1: LoudnessEnhancerController

import android.media.audiofx.LoudnessEnhancer; //导入依赖的package包/类
public LoudnessEnhancerController(Context context, int audioSessionId) {
	this.context = context;
	try {
		this.audioSessionId = audioSessionId;
		enhancer = new LoudnessEnhancer(audioSessionId);
	} catch (Throwable x) {
		Log.w(TAG, "Failed to create enhancer", x);
	}
}
 
开发者ID:popeen,项目名称:Popeens-DSub,代码行数:10,代码来源:LoudnessEnhancerController.java

示例2: create

import android.media.audiofx.LoudnessEnhancer; //导入依赖的package包/类
@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;
}
 
开发者ID:KishanV,项目名称:Android-Music-Player,代码行数:12,代码来源:LoudnessEnhancerCompatKitKat.java

示例3: initLoudnessEnhancer

import android.media.audiofx.LoudnessEnhancer; //导入依赖的package包/类
public static void initLoudnessEnhancer(int audioID) {
    EndLoudnessEnhancer();
    try {
        loudnessEnhancer = new LoudnessEnhancer(audioID);
        int loud = Extras.getInstance().saveEq().getInt(LOUD_BOOST, 0);
        if (loud > 0) {
            setLoudnessEnhancerGain(loud);
        }else {
            setLoudnessEnhancerGain(0);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:RajneeshSingh007,项目名称:MusicX-music-player,代码行数:15,代码来源:Loud.java

示例4: getTargetGain

import android.media.audiofx.LoudnessEnhancer; //导入依赖的package包/类
@Override
public float getTargetGain(AudioEffect effect) {
    return ((LoudnessEnhancer) effect).getTargetGain();
}
 
开发者ID:KishanV,项目名称:Android-Music-Player,代码行数:5,代码来源:LoudnessEnhancerCompatKitKat.java

示例5: setTargetGain

import android.media.audiofx.LoudnessEnhancer; //导入依赖的package包/类
@Override
public void setTargetGain(AudioEffect effect, int gainmB) {
    ((LoudnessEnhancer) effect).setTargetGain(gainmB);
}
 
开发者ID:KishanV,项目名称:Android-Music-Player,代码行数:5,代码来源:LoudnessEnhancerCompatKitKat.java

示例6: musicHandler

import android.media.audiofx.LoudnessEnhancer; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.KITKAT)
public musicHandler(musicPlayer Gh) {
	mEvent = new Event("PLayer");
	this.Gh = Gh;
	loadStartup();
	mediaplayer = new MediaPlayer();
	mediaplayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
		@Override
		public void onPrepared(MediaPlayer mp) {
			if(needPlay){
				isPrepared = true;
				play(needId);
			}else{
				isPrepared = true;
				if(needStop){
					needStop = false;
				}else{
					mediaplayer.start();
				}
				mediaplayer.setOnCompletionListener(OC);
				mEvent.trigger(playerEvents.SONG_CHANGED);
			}
		}
	});

	needStop = true;
	playByNumber(0);

	EQs = new EqlizerSettings(Gh.getBaseContext());

	bass = new BassBoost(0, mediaplayer.getAudioSessionId());
	bass.setEnabled(true);


	equlizer = new Equalizer(0, mediaplayer.getAudioSessionId());
	equlizer.setEnabled(true);

	virtualizer = new Virtualizer(0, mediaplayer.getAudioSessionId());
	virtualizer.setEnabled(true);

	if(android.os.Build.VERSION.SDK_INT >= 19){
		loudness = new LoudnessEnhancer(  mediaplayer.getAudioSessionId());
		loudness.setEnabled(true);
	}else{
		loudness = null;
	}


	setEQs(EQs.isOn);


	setBass(EQs.BASS);
	setTrable(EQs.TRABLE);
	setVoice(EQs.VOICE);
	setVirtualizer(EQs.VIRCHULIZER);
	setLoudnessEnhancer(EQs.LOUDNESS);
	mEvent.trigger(playerEvents.EQ_CHANGED);
	mEvent.trigger(playerEvents.PLAYER_COMPLETE);

}
 
开发者ID:KishanV,项目名称:Android-Music-Player,代码行数:61,代码来源:musicHandler.java

示例7: onCreate

import android.media.audiofx.LoudnessEnhancer; //导入依赖的package包/类
@SuppressLint("NewApi")
	@Override
	public void onCreate() {
		t0 = System.currentTimeMillis();
		SpeakerBoost.log("Creating service at "+t0);
		options = PreferenceManager.getDefaultSharedPreferences(this);
		
		settings = new Settings(this, true);
		settings.load(options);
		if (!settings.haveEqualizer()) {
			settings.boostValue = 0;
			settings.save(options);

			if (19 <= Build.VERSION.SDK_INT) {
				Boolean have = false;
				for (AudioEffect.Descriptor d : AudioEffect.queryEffects()) {
					if (d.uuid.equals(LoudnessEnhancer.EFFECT_TYPE_LOUDNESS_ENHANCER)) {
						have = true;
						break;
					}
				}
				if (!have) {
					Toast.makeText(this,  "Your device doesn't support the LoudnessEnhancer effect that SpeakerBoost needs.", Toast.LENGTH_LONG).show();
				}
				else {
					Toast.makeText(this, "Error: Try later or reboot", Toast.LENGTH_LONG).show();
				}
			}
			else {
				Toast.makeText(this, "Error: Try later or reboot", Toast.LENGTH_LONG).show();
			}
			SpeakerBoost.log("Error setting up equalizer");
		}
		else {
//			Toast.makeText(this, "Equalizer activated", 5000).show();
			SpeakerBoost.log("Success setting up equalizer");
		}

		if (Options.getNotify(options) != Options.NOTIFY_NEVER) {
	        Notification n = new Notification(
					R.drawable.equalizeron,
					"SpeakerBoost", 
					System.currentTimeMillis());
			Intent i = new Intent(this, SpeakerBoost.class);
		  	i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
			n.flags = Notification.FLAG_NO_CLEAR | Notification.FLAG_ONGOING_EVENT; 
			n.setLatestEventInfo(this, "SpeakerBoost", 
					settings.describe(), 
					PendingIntent.getActivity(this, 0, i, 0));
			SpeakerBoost.log("notify from service "+n.toString());
	
			startForeground(SpeakerBoost.NOTIFICATION_ID, n);
		}
		else {			
		}
		
		if (settings.isEqualizerActive())
			settings.setEqualizer();
		else
			settings.disableEqualizer();
		
//		if (settings.override) {
//	        Runnable logRunnable = new Runnable(){
//	        	@Override
//	        	public void run() {
//	                interruptReader = false;
//					monitorLog();
//				}};  
//			logThread = new Thread(logRunnable);
//			
//			logThread.start();
//		}
	}
 
开发者ID:arpruss,项目名称:speakerboost,代码行数:74,代码来源:SpeakerBoostService.java


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