當前位置: 首頁>>代碼示例>>Java>>正文


Java AudioTrack.PLAYSTATE_PLAYING屬性代碼示例

本文整理匯總了Java中android.media.AudioTrack.PLAYSTATE_PLAYING屬性的典型用法代碼示例。如果您正苦於以下問題:Java AudioTrack.PLAYSTATE_PLAYING屬性的具體用法?Java AudioTrack.PLAYSTATE_PLAYING怎麽用?Java AudioTrack.PLAYSTATE_PLAYING使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在android.media.AudioTrack的用法示例。


在下文中一共展示了AudioTrack.PLAYSTATE_PLAYING屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: isSpeaking

/**
 * 判斷當前合成引擎是否處於朗讀狀態
 *
 * @return true=是
 */
public boolean isSpeaking() {
    boolean result = false;
    try {
        result = synthesizer.isSpeaking() || pcmPlayer.getPlayState() == AudioTrack.PLAYSTATE_PLAYING;
    } catch (Exception e) {
        e.printStackTrace();
    }
    Log.i(TAG, "isSpeaking>>" + Boolean.toString(result));
    return result;
}
 
開發者ID:LingjuAI,項目名稱:AssistantBySDK,代碼行數:15,代碼來源:IflySynthesizer.java

示例2: audioTrackWrite

private void audioTrackWrite(byte[] audioData, int offsetInBytes, int sizeInBytes) {
  if (mAudioTrack != null && mAudioTrack.getPlayState() == AudioTrack.PLAYSTATE_PLAYING) {
    int written;
    while (sizeInBytes > 0) {
      written = sizeInBytes > mAudioTrackBufferSize ? mAudioTrackBufferSize : sizeInBytes;
      mAudioTrack.write(audioData, offsetInBytes, written);
      sizeInBytes -= written;
      offsetInBytes += written;
    }
  }
}
 
開發者ID:coding-dream,項目名稱:TPlayer,代碼行數:11,代碼來源:MediaPlayer.java

示例3: stopPlayer

public void stopPlayer() {
    
    if (!mIsPlayStarted) {
        return;
    }
    
    if (mAudioTrack.getPlayState() == AudioTrack.PLAYSTATE_PLAYING) {
        mAudioTrack.stop();                        
    }
    
    mAudioTrack.release();
    mIsPlayStarted = false;
       
    Log.d(TAG, "Stop audio player success !");
}
 
開發者ID:ThinkKeep,項目名稱:EvilsLive,代碼行數:15,代碼來源:AudioPlayer.java

示例4: isSpeaking

@Override
public boolean isSpeaking() {

    if (audioTrack != null && audioTrack.getState() == AudioTrack.STATE_INITIALIZED) {
        if (DEBUG) {
            MyLog.i(CLS_NAME, "isSpeaking: audioTrack STATE_INITIALIZED");
        }

        if (audioTrack.getPlayState() == AudioTrack.PLAYSTATE_PLAYING
                || audioTrack.getPlayState() == AudioTrack.PLAYSTATE_PAUSED) {
            if (DEBUG) {
                MyLog.i(CLS_NAME, "isSpeaking: audioTrack PLAYSTATE_PLAYING/PLAYSTATE_PAUSED");
            }
            return true;
        } else {
            if (DEBUG) {
                MyLog.i(CLS_NAME, "isSpeaking: audioTrack not playing");
            }
        }
    }

    final boolean speakingSuper = super.isSpeaking();

    if (DEBUG) {
        MyLog.i(CLS_NAME, "isSpeaking: speakingSuper " + speakingSuper);
    }

    return speakingSuper;
}
 
開發者ID:brandall76,項目名稱:Saiy-PS,代碼行數:29,代碼來源:SaiyTextToSpeech.java

示例5: 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

示例6: 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

示例7: startAudioProcessing

public void startAudioProcessing(){
	queueThread.start();
	
	//while ( queueThread.isAlive() && ! m_line.isActive() ){
	while ( queueThread.isAlive() && audioTrack.getPlayState() != AudioTrack.PLAYSTATE_PLAYING){
		Thread.yield();
	}

	/* Initialize the seconds time offset now that the line is running. */
	secondsTimeOffset = 2208988800.0 +  System.currentTimeMillis() * 1e-3;
}
 
開發者ID:SergioChan,項目名稱:Android-Airplay-Server,代碼行數:11,代碼來源:AudioOutputQueue.java

示例8: audioTrackWrite

private void audioTrackWrite(byte[] audioData, int offsetInBytes, int sizeInBytes) {
    if (mAudioTrack != null && mAudioTrack.getPlayState() == AudioTrack.PLAYSTATE_PLAYING) {
        int written;
        while (sizeInBytes > 0) {
            written = sizeInBytes > mAudioTrackBufferSize ? mAudioTrackBufferSize : sizeInBytes;
            mAudioTrack.write(audioData, offsetInBytes, written);
            sizeInBytes -= written;
            offsetInBytes += written;
        }
    }
}
 
開發者ID:WangZhiYao,項目名稱:VideoDemo,代碼行數:11,代碼來源:MediaPlayer.java

示例9: interrupt

/**
 * Interrupt the audioStream.
 */
public void interrupt() {
  if (audioTrack != null) {
    if (audioTrack.getState() == AudioTrack.STATE_INITIALIZED || audioTrack.getState() == AudioTrack.PLAYSTATE_PLAYING) {
      audioTrack.pause();
    }
    audioTrack.flush();
    audioTrack.release();
  }
}
 
開發者ID:watson-developer-cloud,項目名稱:android-sdk,代碼行數:12,代碼來源:StreamPlayer.java

示例10: isRunning

@Override
public boolean isRunning() {
	return (this.audioTrack != null && this.audioTrack.getPlayState() == AudioTrack.PLAYSTATE_PLAYING);
}
 
開發者ID:axlecho,項目名稱:tuxguitar,代碼行數:4,代碼來源:TGSourceDataLine.java

示例11: isActive

@Override
public boolean isActive() {
	return (this.audioTrack != null && this.audioTrack.getPlayState() == AudioTrack.PLAYSTATE_PLAYING);
}
 
開發者ID:axlecho,項目名稱:tuxguitar,代碼行數:4,代碼來源:TGSourceDataLine.java

示例12: audioTrackStart

private void audioTrackStart() {
  if (mAudioTrack != null && mAudioTrack.getState() == AudioTrack.STATE_INITIALIZED && mAudioTrack.getPlayState() != AudioTrack.PLAYSTATE_PLAYING)
    mAudioTrack.play();
}
 
開發者ID:coding-dream,項目名稱:TPlayer,代碼行數:4,代碼來源:MediaPlayer.java

示例13: isPlaying

public boolean isPlaying() {
  return mAudioTrack.getPlayState() == AudioTrack.PLAYSTATE_PLAYING;
}
 
開發者ID:XueyanLiu,項目名稱:miku,代碼行數:3,代碼來源:AudioSamplePlayer.java

示例14: isPlaying

public boolean isPlaying() {
    return mAudioTrack.getPlayState() == AudioTrack.PLAYSTATE_PLAYING;
}
 
開發者ID:g-marsh,項目名稱:MediaPlayer-GregMods,代碼行數:3,代碼來源:AudioPlayback.java

示例15: isPlaying

@Override
public boolean isPlaying() {
    return audioTrack.getPlayState() == AudioTrack.PLAYSTATE_PLAYING;
}
 
開發者ID:StylingAndroid,項目名稱:ChristmasVoice,代碼行數:4,代碼來源:AudioPlayer.java


注:本文中的android.media.AudioTrack.PLAYSTATE_PLAYING屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。