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


Java AudioTrack.PLAYSTATE_STOPPED属性代码示例

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


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

示例1: stopListening

/**
 * 打断(停止)唤醒,调用该方法后马上停止录音,但不保证完全打断唤醒,完全打断可能会有延迟
 */
public void stopListening(){
	Log.i(TAG, "stopListening");
	if(isListening())
	try{
		stopRecord();
		if(at.getPlayState()!= AudioTrack.PLAYSTATE_STOPPED){
			stopInterrupt.set(true);
		}
	}catch(Exception e){
		e.printStackTrace();
	}
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:15,代码来源:WakeupEngineBase.java

示例2: shutdown

@Override
public void shutdown() {

    if (audioTrack != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        switch (audioTrack.getPlayState()) {
            case AudioTrack.PLAYSTATE_PLAYING:
                if (DEBUG) {
                    MyLog.i(CLS_NAME, "stop: PLAYSTATE_PLAYING");
                }
                audioTrack.stop(true);
                audioTrack.flush();
                audioTrack.release();
            case AudioTrack.PLAYSTATE_PAUSED:
                if (DEBUG) {
                    MyLog.i(CLS_NAME, "stop: PLAYSTATE_PAUSED");
                }
                audioTrack.stop(true);
                audioTrack.flush();
                audioTrack.release();
            case AudioTrack.PLAYSTATE_STOPPED:
                if (DEBUG) {
                    MyLog.i(CLS_NAME, "stop: PLAYSTATE_STOPPED");
                }
                audioTrack.flush();
                audioTrack.release();
                break;
        }
    }

    super.shutdown();
}
 
开发者ID:brandall76,项目名称:Saiy-PS,代码行数:31,代码来源:SaiyTextToSpeech.java

示例3: stop

@Override
public int stop() {

    if (audioTrack != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        switch (audioTrack.getPlayState()) {
            case AudioTrack.PLAYSTATE_PLAYING:
                if (DEBUG) {
                    MyLog.i(CLS_NAME, "stop: PLAYSTATE_PLAYING");
                }
                audioTrack.stop(true);
                return SUCCESS;
            case AudioTrack.PLAYSTATE_PAUSED:
                if (DEBUG) {
                    MyLog.i(CLS_NAME, "stop: PLAYSTATE_PAUSED");
                }
                audioTrack.stop(true);
                return SUCCESS;
            case AudioTrack.PLAYSTATE_STOPPED:
                if (DEBUG) {
                    MyLog.i(CLS_NAME, "stop: PLAYSTATE_STOPPED");
                }
                break;
        }
    }

    try {
        return super.stop();
    } catch (final NullPointerException e) {
        if (DEBUG) {
            MyLog.w(CLS_NAME, "stop: NullPointerException");
            e.printStackTrace();
        }
    }

    return ERROR;
}
 
开发者ID:brandall76,项目名称:Saiy-PS,代码行数:36,代码来源:SaiyTextToSpeech.java

示例4: startAudioTrack

private void startAudioTrack() {
    if (mAudioTrack.getPlayState() == AudioTrack.PLAYSTATE_STOPPED) {
        ArrayList<AudioPatch> patches = new ArrayList<AudioPatch>();
        mAudioManager.listAudioPatches(patches);
        mAudioTrack.play();
    }
}
 
开发者ID:KobeMing,项目名称:FMRadio,代码行数:7,代码来源:FmService.java


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