Stay organized with collections
    
    
      
      Save and categorize content based on your preferences.
    
  
  
    
  
  
  
  
    
    
    
  
  
    
    
    
    PlaybackParams
    class PlaybackParams : Parcelable
    
    Structure for common playback params. Used by AudioTrackAudioTrack.getPlaybackParams() and AudioTrack.setPlaybackParams(PlaybackParams) to control playback behavior. 
     audio fallback mode: select out-of-range parameter handling. 
    
 
     pitch: increases or decreases the tonal frequency of the audio content. It is expressed as a multiplicative factor, where normal pitch is 1.0f. 
     speed: increases or decreases the time to play back a set of audio or video frames. It is expressed as a multiplicative factor, where normal speed is 1.0f. 
     Different combinations of speed and pitch may be used for audio playback; some common ones: 
     
      -  Pitch equals 1.0f. Speed change will be done with pitch preserved, often called timestretching.
-  Pitch equals speed. Speed change will be done by resampling, similar to AudioTrack.setPlaybackRate(int).
Summary
    
    
      
        
          | Inherited constants | 
        
          | From class Parcelable
                
                  
                    | Int | CONTENTS_FILE_DESCRIPTOR
                         Descriptor bit used with describeContents(): indicates that the Parcelable object's flattened representation includes a file descriptor. |  
                    | Int | PARCELABLE_WRITE_RETURN_VALUE
                         Flag for use with writeToParcel: the object being written is a return value, that is the result of a function such as "Parcelable someFunction()", "void someFunction(out Parcelable)", or "void someFunction(inout Parcelable)". Some implementations may want to release resources at this point. |  | 
      
    
    
    
    
    Constants
    
      AUDIO_FALLBACK_MODE_DEFAULT
      
      static val AUDIO_FALLBACK_MODE_DEFAULT: Int
      Value: 0
     
    
      AUDIO_FALLBACK_MODE_FAIL
      
      static val AUDIO_FALLBACK_MODE_FAIL: Int
      Value: 2
     
    
      AUDIO_FALLBACK_MODE_MUTE
      
      static val AUDIO_FALLBACK_MODE_MUTE: Int
      Value: 1
     
    Public constructors
    
      PlaybackParams
      
      PlaybackParams()
     
    Public methods
    
      allowDefaults
      
      fun allowDefaults(): PlaybackParams!
      Allows defaults to be returned for properties not set. Otherwise a java.lang.IllegalArgumentException exception is raised when getting those properties which have defaults but have never been set.
      
     
    
      describeContents
      
      fun describeContents(): Int
      
     
    
      getAudioFallbackMode
      
      fun getAudioFallbackMode(): Int
      Retrieves the audio fallback mode.
      
      
        
          
            | Exceptions | 
          
            | java.lang.IllegalStateException | if the audio fallback mode is not set. | 
        
      
     
    
      getPitch
      
      fun getPitch(): Float
      Retrieves the pitch factor.
      
      
        
          
            | Exceptions | 
          
            | java.lang.IllegalStateException | if pitch is not set. | 
        
      
     
    
      getSpeed
      
      fun getSpeed(): Float
      Retrieves the speed factor.
      
      
        
          
            | Exceptions | 
          
            | java.lang.IllegalStateException | if speed is not set. | 
        
      
     
    
      setAudioFallbackMode
      
      fun setAudioFallbackMode(audioFallbackMode: Int): PlaybackParams!
      Sets the audio fallback mode.
      
      
     
    
      setPitch
      
      fun setPitch(pitch: Float): PlaybackParams!
      Sets the pitch factor.
      
      
      
        
          
            | Exceptions | 
          
            | java.lang.IllegalArgumentException | if the pitch is negative. | 
        
      
     
    
    
    Properties
    
  
  
  
    
  
 
  
    
      
      
    
    
      
    
    
  
       
    
    
      
    
  
  
  Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
  Last updated 2025-02-10 UTC.
  
  
  
    
      [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[]]