moonlander.library

## Class Moonlander

- java.lang.Object
- - moonlander.library.Moonlander

-     public class Moonlander
      extends java.lang.Object

  Moonlander

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `VERSION`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Moonlander(processing.core.PApplet parent, moonlander.library.Controller controller)` Initializes library and tries to load syncdata.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `changeLogLevel(java.util.logging.Level logLevel)`
    `double` | `getCurrentRow()` Returns current (fractional) row.
    `double` | `getCurrentTime()` Returns current time in seconds.
    `int` | `getIntValue(java.lang.String name)` Returns int value of a track.
    `Track` | `getTrack(java.lang.String name)`
    `double` | `getValue(java.lang.String name)` Returns value of a track.
    `static Moonlander` | `initWithSoundtrack(processing.core.PApplet applet, java.lang.String filename, int beatsPerMinute, int rowsPerBeat)` Shortcut to initializing Rocket connection with given soundtrack file (uses MinimController).
    `boolean` | `start()` Shortcut for starting Moonlander with sane defaults.
    `boolean` | `start(java.lang.String host, int port, java.lang.String filePath)` Fires up the connection to Rocket, or in case of connection failure, loads data from given XML syncfile.
    `void` | `update()` Handle communication and controller updates.
    `static java.lang.String` | `version()` Returns the version of the library.

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

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### VERSION

          public static final java.lang.String VERSION

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### Moonlander

          public Moonlander(processing.core.PApplet parent,
                            moonlander.library.Controller controller)

      Initializes library and tries to load syncdata. First, a connection to GNU Rocket is attempted using given host and port; if connection fails, tries to load sync data from the given filepath. If both fail, no initial data is loaded.
      Parameters:
        `host` -
        `port` -
        `filePath` - path to Rocket's XML-file
        `debug` - if true, output debug data to stdout

  - ### Method Detail

    - #### initWithSoundtrack

          public static Moonlander initWithSoundtrack(processing.core.PApplet applet,
                                                      java.lang.String filename,
                                                      int beatsPerMinute,
                                                      int rowsPerBeat)

      Shortcut to initializing Rocket connection with given soundtrack file (uses MinimController).

    - #### changeLogLevel

          public void changeLogLevel(java.util.logging.Level logLevel)

    - #### start

          public boolean start(java.lang.String host,
                               int port,
                               java.lang.String filePath)

      Fires up the connection to Rocket, or in case of connection failure, loads data from given XML syncfile. If both connectors fail, a message is logged with level SEVERE. Use changeLogLevel() to see more fine grained output if you need to investigate.
      Returns:
        true if connector was initialized, otherwise false.

    - #### start

          public boolean start()

      Shortcut for starting Moonlander with sane defaults. Rocket is assumed to be running at localhost:1338. If connection fails, syncdata is loaded from a file called 'syncdata.rocket' instead.

    - #### update

          public void update()

      Handle communication and controller updates. This method must be called for every frame.

    - #### getTrack

          public Track getTrack(java.lang.String name)

    - #### getValue

          public double getValue(java.lang.String name)

      Returns value of a track.
      Parameters:
        `name` - track's name

    - #### getIntValue

          public int getIntValue(java.lang.String name)

      Returns int value of a track. Practically same as (int)Moonlander.getValue(...) - just makes your code nicer to look at as no casts required!

    - #### getCurrentTime

          public double getCurrentTime()

      Returns current time in seconds.

    - #### getCurrentRow

          public double getCurrentRow()

      Returns current (fractional) row.

    - #### version

          public static java.lang.String version()

      Returns the version of the library.
      Returns:
        String

Processing library Moonlander by Antti Hirvonen. (c) 2018