jdxi_editor.midi.playback.activity

Playback activity

Whether any transport (the MIDI File Player’s or the Pattern Editor’s) is playing. Editors use it to hold back device requests (RQ1) while playback is sending MIDI, and to make them once it stops.

Example

>>> activity = playback_activity()
>>> activity.playing_changed.connect(lambda playing: print(playing))
>>> activity.is_playing
False
>>> refresher = DeviceRefresher(editor.data_request, editor.isVisible, parent=editor)
>>> refresher.schedule()  # after a parameter change on the JD-Xi

Attributes

REFRESH_DELAY_MS

_activity

Classes

PlaybackActivity

Which transports are playing.

DeviceRefresher

Asks the JD-Xi for an editor's values so its UI follows parameter changes

Functions

playback_activity() → PlaybackActivity

The application's PlaybackActivity.

Module Contents

jdxi_editor.midi.playback.activity.REFRESH_DELAY_MS = 400[source]
class jdxi_editor.midi.playback.activity.PlaybackActivity(parent: PySide6.QtCore.QObject | None = None)[source]

Bases: PySide6.QtCore.QObject

Which transports are playing.

Signals:
playing_changed(bool): True when the first transport starts playing,

False when the last one stops or pauses

playing_changed[source]
_playing: set[int][source]
property is_playing: bool[source]
set_playing(source: object, playing: bool) → None[source]

source (a transport) has started (True) or stopped/paused (False).

jdxi_editor.midi.playback.activity._activity: PlaybackActivity | None = None[source]
jdxi_editor.midi.playback.activity.playback_activity() → PlaybackActivity[source]

The application’s PlaybackActivity.

class jdxi_editor.midi.playback.activity.DeviceRefresher(request: Callable[[], None], is_wanted: Callable[[], bool] = lambda : ..., delay_ms: int = REFRESH_DELAY_MS, parent: PySide6.QtCore.QObject | None = None)[source]

Bases: PySide6.QtCore.QObject

Asks the JD-Xi for an editor’s values so its UI follows parameter changes made on the instrument: once a burst of changes has settled, and never while playback is sending MIDI (it asks once playback stops instead).

_request[source]
_is_wanted[source]
_pending = False[source]
_timer[source]
property is_pending: bool[source]

A request is waiting for playback to stop.

schedule(*_args) → None[source]

A parameter changed: request after delay_ms without further changes.

request_now() → None[source]

Request straight away (e.g. the editor was shown), unless playing.

_refresh() → None[source]
_on_playing_changed(playing: bool) → None[source]