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


Java MediaPlayer.getAudioSessionId方法代码示例

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


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

示例1: VisualizerController

import android.media.MediaPlayer; //导入方法依赖的package包/类
public VisualizerController(MediaPlayer mediaPlayer)
{
	try
	{
		if (mediaPlayer == null)
		{
			return;
		}

		audioSessionId = mediaPlayer.getAudioSessionId();
		visualizer = new Visualizer(audioSessionId);
	}
	catch (Throwable x)
	{
		Log.w(TAG, "Failed to create visualizer.", x);
	}

	if (visualizer != null)
	{
		int[] captureSizeRange = Visualizer.getCaptureSizeRange();
		int captureSize = Math.max(PREFERRED_CAPTURE_SIZE, captureSizeRange[0]);
		captureSize = Math.min(captureSize, captureSizeRange[1]);
		visualizer.setCaptureSize(captureSize);
	}
}
 
开发者ID:ultrasonic,项目名称:ultrasonic,代码行数:26,代码来源:VisualizerController.java

示例2: EqualizerController

import android.media.MediaPlayer; //导入方法依赖的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

示例3: musicHandler

import android.media.MediaPlayer; //导入方法依赖的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


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