Class SampleBufferDouble

    • Method Detail

      • createWithByteBuffer

        public static SampleBufferType createWithByteBuffer​(int channels,
                                                            long frames,
                                                            double sample_rate,
                                                            java.util.function.LongFunction<java.nio.ByteBuffer> create)
        Create a sample buffer.
        Parameters:
        channels - The number of channels per frame
        frames - The number of frames in the buffer
        create - A function that allocates a byte buffer for the samples
        sample_rate - The sample rate in hz
        Returns:
        A new sample buffer
      • createWithDirectBuffer

        public static SampleBufferType createWithDirectBuffer​(int channels,
                                                              long frames,
                                                              double sample_rate)
        Create a sample buffer. The underlying buffer will be allocated using direct memory.
        Parameters:
        channels - The number of channels per frame
        frames - The number of frames in the buffer
        sample_rate - The sample rate in hz
        Returns:
        A new sample buffer
      • createWithHeapBuffer

        public static SampleBufferType createWithHeapBuffer​(int channels,
                                                            long frames,
                                                            double sample_rate)
        Create a sample buffer. The underlying buffer will be heap-allocated.
        Parameters:
        channels - The number of channels per frame
        frames - The number of frames in the buffer
        sample_rate - The sample rate in hz
        Returns:
        A new sample buffer
      • frameSetAll

        public void frameSetAll​(long index,
                                double value)
                         throws java.lang.IllegalArgumentException
        Description copied from interface: SampleBufferType
        Set the value of frame index. If the underlying buffer contains more than one channel, then the given value is inserted into all channels in the frame.
        Specified by:
        frameSetAll in interface SampleBufferType
        Parameters:
        index - The frame index
        value - The input
        Throws:
        java.lang.IllegalArgumentException
      • frameSetExact

        public void frameSetExact​(long index,
                                  double c0,
                                  double c1)
                           throws java.lang.IllegalArgumentException
        Description copied from interface: SampleBufferType
        Set the value of frame index.
        Specified by:
        frameSetExact in interface SampleBufferType
        Parameters:
        index - The frame index
        c0 - The input for channel 0
        c1 - The input for channel 1
        Throws:
        java.lang.IllegalArgumentException - If channels() != 2
      • frameSetExact

        public void frameSetExact​(long index,
                                  double c0)
                           throws java.lang.IllegalArgumentException
        Description copied from interface: SampleBufferType
        Set the value of frame index.
        Specified by:
        frameSetExact in interface SampleBufferType
        Parameters:
        index - The frame index
        c0 - The input for channel 0
        Throws:
        java.lang.IllegalArgumentException - If channels() != 1
      • frameSetExact

        public void frameSetExact​(long index,
                                  double[] value)
                           throws java.lang.IllegalArgumentException
        Description copied from interface: SampleBufferType
        Set the value of frame index. The input value is assumed to contain one sample for each of the channels in the frame.
        Specified by:
        frameSetExact in interface SampleBufferType
        Parameters:
        index - The frame index
        value - The input
        Throws:
        java.lang.IllegalArgumentException - If value.length != channels()
      • frameGetExact

        public void frameGetExact​(long index,
                                  double[] output)
                           throws java.lang.IllegalArgumentException
        Description copied from interface: SampleBufferReadableType
        Get the value of frame index.
        Specified by:
        frameGetExact in interface SampleBufferReadableType
        Parameters:
        index - The frame index
        output - The output
        Throws:
        java.lang.IllegalArgumentException - If output.length != channels()
      • frameGetExact

        public double frameGetExact​(long index)
                             throws com.io7m.jranges.RangeCheckException
        Description copied from interface: SampleBufferReadableType
        Get the value of frame index.
        Specified by:
        frameGetExact in interface SampleBufferReadableType
        Parameters:
        index - The frame index
        Returns:
        The value in the frame
        Throws:
        com.io7m.jranges.RangeCheckException