Class CueList


  • public class CueList
    extends Object
    Provides information about each memory point, hot cue, and loop stored for a track.
    Author:
    James Elliott
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  CueList.Entry
      Breaks out information about each entry in the cue list.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      List<CueList.Entry> entries
      The entries present in the cue list, sorted into order by increasing position, with hot cues coming after ordinary memory points if both are at the same position (as often seems to happen).
      List<ByteBuffer> rawExtendedTags
      The bytes from which the Kaitai Struct tags holding the nxs2 cue list information (which can include DJ-assigned comment text for each cue) were parsed from an extended ANLZ file.
      Message rawMessage
      The message holding the cue list information as it was read over the network.
      List<ByteBuffer> rawTags
      The bytes from which the Kaitai Struct tags holding cue list information were parsed from an ANLZ file.
      static Comparator<CueList.Entry> SORT_COMPARATOR
      The comparator used for sorting the cue list entries during construction, which orders them by position within the track, with hot cues coming after ordinary memory points if both exist at the same position.
      static Comparator<CueList.Entry> TIME_ONLY_COMPARATOR
      A comparator for sorting or searching entries that considers only their position within the track, and not whether they are a hot cue.
    • Constructor Summary

      Constructors 
      Constructor Description
      CueList​(List<ByteBuffer> rawTags)
      Constructor for when recreating from files containing the raw tag bytes if there were no nxs2-style extended cue tags.
      CueList​(List<ByteBuffer> rawTags, List<ByteBuffer> rawExtendedTags)
      Constructor for when recreating from files containing the raw tag bytes and raw nxs2-style cue comment tag bytes.
      CueList​(Message message)
      Constructor when reading from the network or a file.
      CueList​(RekordboxAnlz anlzFile)
      Constructor for when reading from a rekordbox track analysis file.
    • Field Detail

      • rawMessage

        public final Message rawMessage
        The message holding the cue list information as it was read over the network. This can be used to analyze fields that have not yet been reliably understood, and is also used for storing the cue list in a file. This will be null if the cue list was not obtained from a dbserver query.
      • rawTags

        public final List<ByteBuffer> rawTags
        The bytes from which the Kaitai Struct tags holding cue list information were parsed from an ANLZ file. Will be null if the cue list was obtained from a dbserver query.
      • rawExtendedTags

        public final List<ByteBuffer> rawExtendedTags
        The bytes from which the Kaitai Struct tags holding the nxs2 cue list information (which can include DJ-assigned comment text for each cue) were parsed from an extended ANLZ file. Will be null if the cue list was obtained from a dbserver query, and empty if there were no nxs2 cue tags available in the analysis data.
      • entries

        public final List<CueList.Entry> entries
        The entries present in the cue list, sorted into order by increasing position, with hot cues coming after ordinary memory points if both are at the same position (as often seems to happen).
      • TIME_ONLY_COMPARATOR

        public static final Comparator<CueList.Entry> TIME_ONLY_COMPARATOR
        A comparator for sorting or searching entries that considers only their position within the track, and not whether they are a hot cue.
      • SORT_COMPARATOR

        public static final Comparator<CueList.Entry> SORT_COMPARATOR
        The comparator used for sorting the cue list entries during construction, which orders them by position within the track, with hot cues coming after ordinary memory points if both exist at the same position. This often happens, and moving hot cues to the end ensures the waveform display components identify that position as a hot cue, which is important information.
    • Constructor Detail

      • CueList

        public CueList​(RekordboxAnlz anlzFile)
        Constructor for when reading from a rekordbox track analysis file. Finds the cues sections and translates them into the objects Beat Link uses to represent them.
        Parameters:
        anlzFile - the recordbox analysis file corresponding to that track
      • CueList

        public CueList​(List<ByteBuffer> rawTags)
        Constructor for when recreating from files containing the raw tag bytes if there were no nxs2-style extended cue tags. Included for backwards compatibility.
        Parameters:
        rawTags - the un-parsed ANLZ file tags holding the cue list entries
      • CueList

        public CueList​(List<ByteBuffer> rawTags,
                       List<ByteBuffer> rawExtendedTags)
        Constructor for when recreating from files containing the raw tag bytes and raw nxs2-style cue comment tag bytes.
        Parameters:
        rawTags - the un-parsed ANLZ file tags holding the cue list entries
        rawExtendedTags - the un-parsed extended ANLZ file tags holding the nxs2-style commented cue list entries
      • CueList

        public CueList​(Message message)
        Constructor when reading from the network or a file.
        Parameters:
        message - the response holding the cue list information, in either original nexus or extended nxs2 format
    • Method Detail

      • getHotCueCount

        public int getHotCueCount()
        Return the number of entries in the cue list that represent hot cues.
        Returns:
        the number of cue list entries that are hot cues
      • getMemoryPointCount

        public int getMemoryPointCount()
        Return the number of entries in the cue list that represent ordinary memory points, rather than hot cues. The memory points can also be loops.
        Returns:
        the number of cue list entries other than hot cues
      • findEntryBefore

        public CueList.Entry findEntryBefore​(long milliseconds)
        Returns the entry whose track position comes most closely before the specified number of milliseconds, if any. If there is a cue which falls exactly at the specified time, it will be returned (and it will also be returned by findEntryAfter(long)). If there is more than one entry at the exact time as the one that is returned, the one chosen will be unpredictable. All times are rounded to half frame units, because that is the resolution at which cues are stored.
        Parameters:
        milliseconds - the time of interest within the track
        Returns:
        the cue whose start time is closest to the specified time but not after it
      • findEntryAfter

        public CueList.Entry findEntryAfter​(long milliseconds)
        Returns the entry whose track position comes most closely after the specified number of milliseconds, if any. If there is a cue which falls exactly at the specified time, it will be returned (and it will also be returned by findEntryBefore(long)). If there is more than one entry at the exact time as the one that is returned, the one chosen will be unpredictable. All times are rounded to half frame units, because that is the resolution at which cues are stored.
        Parameters:
        milliseconds - the time of interest within the track
        Returns:
        the cue whose start time is closest to the specified time but not before it
      • findRekordboxColor

        public static Color findRekordboxColor​(int colorCode)
        Look up the color that rekordbox would use to display a cue. The colors in this table correspond to the 4x4 grids that are available inside the hot cue configuration interface.
        Parameters:
        colorCode - the color index found in the cue
        Returns:
        the corresponding color or null if the index is not recognized
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object