Class ShadowAudioTrack

    • Field Detail

      • DEFAULT_MIN_BUFFER_SIZE

        protected static final int DEFAULT_MIN_BUFFER_SIZE
        See Also:
        Constant Field Values
    • Constructor Detail

      • ShadowAudioTrack

        public ShadowAudioTrack()
    • Method Detail

      • setMinBufferSize

        public static void setMinBufferSize​(int bufferSize)
        In the real class, the minimum buffer size is estimated from audio sample rate and other factors. We do not provide such estimation in native_get_min_buff_size(int, int, int), instead letting users set the minimum for the expected audio sample. Usually higher sample rate requires bigger buffer size.
      • native_get_FCC_8

        @Implementation(minSdk=24,
                        maxSdk=28)
        protected static int native_get_FCC_8()
      • native_get_min_buff_size

        @Implementation
        protected static int native_get_min_buff_size​(int sampleRateInHz,
                                                      int channelConfig,
                                                      int audioFormat)
        Returns a predefined or default minimum buffer size. Audio format and config are neglected.
      • native_write_byte

        @Implementation(minSdk=23)
        protected final int native_write_byte​(byte[] audioData,
                                              int offsetInBytes,
                                              int sizeInBytes,
                                              int format,
                                              boolean isBlocking)
        Always return the number of bytes to write. This method returns immedidately even with AudioTrack.WRITE_BLOCKING
      • write

        @Implementation(minSdk=21)
        protected int write​(ByteBuffer audioData,
                            int sizeInBytes,
                            int writeMode)
        Always return the number of bytes to write except with invalid parameters. Assumes AudioTrack is already initialized (object properly created). Do not block even if AudioTrack in offload mode is in STOPPING play state. This method returns immediately even with AudioTrack.WRITE_BLOCKING
      • getPlaybackHeadPosition

        @Implementation
        protected int getPlaybackHeadPosition()
      • flush

        @Implementation
        protected void flush()
      • resetTest

        @Resetter
        public static void resetTest()