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
    Actual number of buffer samples traversed (pitch-dependent).
    final float
    Duration in milliseconds.
    final int
    Duration in output samples (pitch-independent).
    final boolean
    Whether this event loops indefinitely.
    final float
    Absolute start time in milliseconds (optional).
    final long
    Absolute start time of the event, in samples (optional).
    final float
    Absolute stop time in milliseconds (optional).
    final long
    Absolute stop time of the event, in samples (optional).
    final long
     
  • 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).
     

    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