Package net.paulhertz.pixelaudio.voices

# Class PlaybackInfo

java.lang.Object
net.paulhertz.pixelaudio.voices.PlaybackInfo

public class PlaybackInfo extends Object
Holds information about a triggered playback event. Returned by PASharedBufferSampler.play().

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `final float`
  `bufferReadSamples`
  Actual number of buffer samples traversed (pitch-dependent).
  `final float`
  `durationMS`
  Duration in milliseconds.
  `final int`
  `eventSamples`
  Duration in output samples (pitch-independent).
  `final boolean`
  `looping`
  Whether this event loops indefinitely.
  `final float`
  `startMS`
  Absolute start time in milliseconds (optional).
  `final long`
  `startSample`
  Absolute start time of the event, in samples (optional).
  `final float`
  `stopMS`
  Absolute stop time in milliseconds (optional).
  `final long`
  `stopSample`
  Absolute stop time of the event, in samples (optional).
  `final long`
  `voiceId`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `PlaybackInfo(long voiceId, int eventSamples, float bufferReadSamples, float durationMS, boolean looping, long startSample, float sampleRate)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static int`
  `computeVoiceDuration(int samplePos, int sampleLen, int bufferLen, float pitch, ADSRParams env, boolean looping, float sampleRate)`
  Computes total playback duration (in output samples, pitch-independent).
  `String`
  `toString()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### voiceId

    public final long voiceId

  - ### eventSamples

    public final int eventSamples
    Duration in output samples (pitch-independent).

  - ### durationMS

    public final float durationMS
    Duration in milliseconds.

  - ### bufferReadSamples

    public final float bufferReadSamples
    Actual number of buffer samples traversed (pitch-dependent).

  - ### looping

    public final boolean looping
    Whether this event loops indefinitely.

  - ### startSample

    public final long startSample
    Absolute start time of the event, in samples (optional).

  - ### stopSample

    public final long stopSample
    Absolute stop time of the event, in samples (optional).

  - ### startMS

    public final float startMS
    Absolute start time in milliseconds (optional).

  - ### stopMS

    public final float stopMS
    Absolute stop time in milliseconds (optional).

- ## Constructor Details

  - ### PlaybackInfo

    public PlaybackInfo(long voiceId, int eventSamples, float bufferReadSamples, float durationMS, boolean looping, long startSample, float sampleRate)

- ## Method Details

  - ### computeVoiceDuration

    public static int computeVoiceDuration(int samplePos, int sampleLen, int bufferLen, float pitch, ADSRParams env, boolean looping, float sampleRate)
    Computes total playback duration (in output samples, pitch-independent). Envelope stage times are assumed to be in seconds.
    Returns:
      duration in output samples (int), or Integer.MAX_VALUE if looping.

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`