GAME / UNITY SIMULATOR
Simulate the behaviour of a game or interactive audio app and its use of the Manhattan API, by modelling the events and associated C# / C++ function calls it may perform.
Add new event

  • MANHATTAN API REFERENCE
  • Set() - change a variable or other property
    usage: Set(variable, value);

    Changes a specific value in the music - a labelled variable, cell property, or other musical attribute.

    The argument variable is a string identifying the value to change, and value is number to set (in floating-point - though most times this will be a whole number between 0 and 255).

    Set("MyVar", 23);
    The above example sets the value (.param cell property) of the cell labelled "MyVar" to 23 ('17' in hex), similar to the Manhattan code: @MyVar = 23

    For named variables, this method is slightly faster than using Code() to perform the same operation.

  • Code() - execute a Manhattan code expression
    usage: Code(expression);

    Sends the specified code expression (as a string argument) to Manhattan for immediate execution. This function supports the full functionality of the Manhattan language - changing values, controlling playback, adjusting synthesis, channel mixing, etc.

    Similar to a code block in a cell, the expression can include multiple lines, separated by carriage returns or semi-colons (';') - it is not associated with a specific cell, but will default to the first cell in the pattern ([1:0]) if left unspecified.

    Code("play(Melody)");

    The code is executed immediately, without waiting for musical boundaries like beats or bars.

    To sync game events with the music, place your code in a labelled pattern cell (e.g. "EnemyDeath") and use Set() or Code() to set a flag (i.e. variable), signalling that the code is waiting to run. Now use a macro (i.e. 0xx to 9xx) to check the flag regularly (i.e. at specific rows, every beat, etc.) and trigger the code when needed - i.e. @EnemyDeath.run().

  • Run() - execute existing code in the pattern
    usage: Run(address);

    Runs the code block contained in the specified address or labelled cell. Unlike Code(), it runs in cell hosting the code.

    Run() shares many use cases with Code(), but is tailored for pre-planned actions handled primarily in Manhattan, and simply triggered by the Game or Unity. The following code executes the code block in the cell labelled "EnemySpawned":

    Run("EnemySpawned");

    This is functionally equivalent to the Manhattan code: @EnemySpawned.run() - but slightly faster than using Code() for the same operation.

    The code is executed immediately, without waiting for musical boundaries like beats or bars.


  • EXAMPLES
    (click to expand)