Package wellen

Class Track

java.lang.Object
wellen.Track
All Implemented Interfaces:
DSPNodeOutputSignal, Loopable

public class Track extends Object implements DSPNodeOutputSignal, Loopable
a Track allows to compose complex compositional and DSP configurations. a Track may be added to other Tracks.

Track must implement the method void output(Signal) which delivers an audio signal and it may implement the method void beat(int) which can be used to receive beat events. a Track may manage a collection of child Tracks. each child track processes audio signals which are accumulated by the track. furthermore, Track calls its child tracks void beat(int) method.

if a class is derived from Track and update(int) is overridden make sure to call beat(int) to preserve internal functionality and update for child Tracks. similarly, make sure to call Signal output_signal_update() if Signal output_signal() is overridden.

Track may handle other mono or stereo Tracks. if a Track outputs a mono signal the output is positioned via panning ( see Track pan() ). if a Track outputs a stereo signal the output ignores panning and just uses the signal unchanged. if a Track outputs more than channels than a stereo signal all additional channels are ignored.

  • Field Details

    • VERBOSE

      public static boolean VERBOSE
    • ID

      public final int ID
  • Constructor Details

    • Track

      public Track()
    • Track

      public Track(float volume, int in_point, int out_point)
  • Method Details

    • println

      public static void println(String s)
    • run_test

      public static void run_test()
    • tracks

      public ArrayList<Track> tracks()
    • add_track

      public void add_track(Track track)
    • track

      public Track track(int index)
      Parameters:
      index - index of track as stored in track(). note that this not to be confused with the final field .ID in Track which refers to a unique ID for each track ever created.
      Returns:
      track stored at index
    • beat

      public void beat(int beat_absolute, int beat_relative)
      triggered by update mechanism. this method can be overridden to implement custom behavior.
      Parameters:
      beat_absolute - current absolute beat count
      beat_relative - current relative beat count
    • update

      public void update(int beat_absolute, int beat_relative)
      updates everything related to beat functionality including internal mechanisms and child tracks. this method also calls this object's own beat(int) method. the order in which methods are called is as follows:

      • beat(int)
      • child beat(int)
      • child update(int)
      Parameters:
      beat_absolute - current absolute beat count. by default this is the global beat count that is passed to the very first Track in the composition.
      beat_relative - current relative beat count
    • update

      public void update(int beat)
    • output_signal

      public Signal output_signal()
      callback method that accumulates audio signals from child tracks and if applicable maps mono signals into stereo space. this method can be overridden to implement custom behavior, however, if doing so make sure to call Signal output_signal_update() to collect signals from child tracks.
      Specified by:
      output_signal in interface DSPNodeOutputSignal
      Returns:
      Signal of this track
    • output_signal_update

      public Signal output_signal_update()
    • pan

      public Pan pan()
    • get_volume

      public float get_volume()
      Returns:
      track volume with 0.0 being no output and 1.0 being 100%
    • set_volume

      public void set_volume(float volume)
      volume of track with 0.0 being no output and 1.0 being 100% of the signal output. note, that this value is interpreted by parent Tracks.
      Parameters:
      volume - track volume with 0.0 being no output and 1.0 being 100%
    • get_in_point

      public int get_in_point()
      Specified by:
      get_in_point in interface Loopable
    • set_in_point

      public void set_in_point(int in_point)
      Parameters:
      in_point - in point in beats. included in length count i.e an in point of 2 and an out point of 5 will * result in a duration of 4 beats ( 2, 3, 4, 5 ).
    • get_out_point

      public int get_out_point()
      Specified by:
      get_out_point in interface Loopable
    • set_out_point

      public void set_out_point(int out_point)
      Parameters:
      out_point - out point in beats. included in length count i.e an in point of 2 and an out point of 5 will result in a duration of 4 beats ( 2, 3, 4, 5 ).
    • set_in_out_point

      public void set_in_out_point(int in_point, int out_point)
    • get_length

      public int get_length()
    • set_length

      public void set_length(int length)
      set length of a track loop. setting the length affects outpoint. e.g given an inpoint of 3, setting the length to 2 will set output to 4. note that outpoint is inclusive i.e a pattern from in- to outpoint of 3, 4, 5, … is generated.
      Parameters:
      length - set length of loop
    • get_loop

      public int get_loop()
      Specified by:
      get_loop in interface Loopable
    • set_loop

      public void set_loop(int loop)
    • get_relative_position

      public int get_relative_position(int absolut_position)
    • get_loop_count

      public int get_loop_count(int absolut_position)