# Module `mididings.engine`

This module contains functions to query or control the state of the mididings event processing engine from Python code.

switch_scene(scene, subscene=None)

  Switch to the given scene number.

switch_subscene(subscene)

  Switch to the given subscene number.

current_scene()

  Return the current scene number.

current_subscene()

  Return the current subscene number.

scenes()

  Return a dictionary of all scenes. Keys are scene numbers, values are tuples containing the scene name and a (possibly empty) list of subscene names.

output_event(ev)

  Send an event directly to an output port, completely bypassing any other event processing.

in_ports()

  Return a list of the configured input port names.

out_ports()

  Return a list of the configured output port names.

time()

  Return the time in seconds (floating point) since some unspecified starting point. Unlike Python’s `time.time()`, this clock is guaranteed to be monotonic.

get_client_name()

  Return actual client name

get_client_id()

  Return client id

active()

  Return `True` if the mididings engine is active (the `run()` function is running).

restart()

  Restart the mididings script by terminating the current process, and then running the same Python interpreter with the same arguments again. This will not work properly if `run()` is not the last call in your script, or if you’re running mididings in an interactive Python interpreter.

quit()

  Terminate mididings by making the `run()` function return.

process_file(infile, outfile, patch)

  Process a MIDI file, using pysmf.