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


Java Visualizer.setCaptureSize方法代码示例

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


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

示例1: VisualizerController

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

import android.media.audiofx.Visualizer; //导入方法依赖的package包/类
public VisualizerWrapper(@NonNull Context context, int audioSessionId, @NonNull final OnFftDataCaptureListener onFftDataCaptureListener) {
       mediaPlayer = MediaPlayer.create(context, R.raw.av_workaround_1min);
	visualizer = new Visualizer(audioSessionId);
       visualizer.setEnabled(false);
	visualizer.setCaptureSize(Visualizer.getCaptureSizeRange()[1]);
       captureRate = Visualizer.getMaxCaptureRate();
       captureListener = new Visualizer.OnDataCaptureListener() {
           @Override
           public void onWaveFormDataCapture(Visualizer visualizer, byte[] waveform, int samplingRate) {

           }

           @Override
           public void onFftDataCapture(Visualizer visualizer, byte[] fft, int samplingRate) {
               boolean allZero = Utils.allElementsAreZero(fft);
               if (lastZeroArrayTimestamp  == 0) {
                   if (allZero) {
                       lastZeroArrayTimestamp = System.currentTimeMillis();
                   }
               } else  {
                   if (!allZero) {
                       lastZeroArrayTimestamp = 0;
                   } else if (System.currentTimeMillis() - lastZeroArrayTimestamp >= WAIT_UNTIL_HACK) {
                       setEnabled(true);
                       lastZeroArrayTimestamp = 0;
                   }
               }
               onFftDataCaptureListener.onFftDataCapture(fft);
           }
       };
       visualizer.setEnabled(true);
}
 
开发者ID:Cleveroad,项目名称:WaveInApp,代码行数:33,代码来源:VisualizerWrapper.java

示例3: run

import android.media.audiofx.Visualizer; //导入方法依赖的package包/类
@Override
public void run()  {
    try {
        mVisualizer = new Visualizer(0);
        mVisualizer.setEnabled(false);
        mVisualizer.setCaptureSize(66);
        mVisualizer.setDataCaptureListener(mVisualizerListener,
                Visualizer.getMaxCaptureRate(), false, true);
        mVisualizer.setEnabled(true);
    } catch (Throwable e){
            if (areWeInsideSystemUI){
                LLog.e(e);
            } else e.printStackTrace();
    }
}
 
开发者ID:Lawiusz,项目名称:xposed_lockscreen_visualizer,代码行数:16,代码来源:VisualizerView.java

示例4: linkPlayer

import android.media.audiofx.Visualizer; //导入方法依赖的package包/类
public void linkPlayer(int sessionId){
    Timber.d("linkPlayer, session id: %d", sessionId);
    visualizer = new Visualizer(sessionId);
    if(!visualizer.getEnabled()){
        visualizer.setCaptureSize(Visualizer.getCaptureSizeRange()[1]);
    }
    visualizer.setDataCaptureListener(dataCaptureListener, Visualizer.getMaxCaptureRate() / 2, true, true);
    visualizer.setEnabled(true);
}
 
开发者ID:linroid,项目名称:Sky31Radio,代码行数:10,代码来源:EqualizerView.java

示例5: VisualizerController

import android.media.audiofx.Visualizer; //导入方法依赖的package包/类
public VisualizerController(Context context, MediaPlayer mediaPlayer) {
     try {
audioSessionId = mediaPlayer.getAudioSessionId();
         visualizer = new Visualizer(audioSessionId);
     } catch (Throwable x) {
         LOG.warn("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:MadMarty,项目名称:madsonic-5.5,代码行数:16,代码来源:VisualizerController.java

示例6: startMusic

import android.media.audiofx.Visualizer; //导入方法依赖的package包/类
private Bitmap startMusic() {
	mMediaPlayer = MediaPlayer.create(this, R.raw.hyperfun);
	mMediaPlayer.setLooping(true);
	mAudioSession = mMediaPlayer.getAudioSessionId();
	mMediaPlayer.start();
	mVisualizer = new Visualizer(mAudioSession);
	mVisualizer.setDataCaptureListener(this, Visualizer.getMaxCaptureRate() / 2, true, true);
	mVisualizer.setCaptureSize(Visualizer.getCaptureSizeRange()[1] / 2);
	Bitmap visualizerBitmap = Bitmap.createBitmap(Visualizer.getCaptureSizeRange()[1] / 2, 2, Bitmap.Config.RGB_565)
			.copy(Bitmap.Config.RGB_565, true);
	visualizerBitmap.eraseColor(Color.BLACK);
	mVisualizer.setScalingMode(Visualizer.SCALING_MODE_AS_PLAYED);
	mVisualizer.setEnabled(true);
	return visualizerBitmap;
}
 
开发者ID:ErikHellman,项目名称:ShaderDroid,代码行数:16,代码来源:ShaderDroidMain.java

示例7: VisualizerShadowChanger

import android.media.audiofx.Visualizer; //导入方法依赖的package包/类
private VisualizerShadowChanger(int audioSessionId) {
    mVisualizer = new Visualizer(audioSessionId);
    mVisualizer.setEnabled(false);
    mVisualizer.setCaptureSize(Visualizer.getCaptureSizeRange()[1]);
    mVisualizer.setDataCaptureListener(this, Visualizer.getMaxCaptureRate(), false, true);
}
 
开发者ID:RajneeshSingh007,项目名称:MusicX-music-player,代码行数:7,代码来源:VisualizerShadowChanger.java

示例8: VisualizerShadowChanger

import android.media.audiofx.Visualizer; //导入方法依赖的package包/类
private VisualizerShadowChanger(int audioSessionId) {
    mVisualizer = new Visualizer(audioSessionId);
    mVisualizer.setCaptureSize(Visualizer.getCaptureSizeRange()[1]);
    mVisualizer.setDataCaptureListener(this, Visualizer.getMaxCaptureRate(), false, true);
}
 
开发者ID:Cleveroad,项目名称:PlayWidget,代码行数:6,代码来源:VisualizerShadowChanger.java


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