Skip to content

Add clip_slot properties and proposal for new properties organization.#182

Open
PhotonicVelocity wants to merge 6 commits intoideoforms:masterfrom
PhotonicVelocity:feat/add_clip_slot_properties
Open

Add clip_slot properties and proposal for new properties organization.#182
PhotonicVelocity wants to merge 6 commits intoideoforms:masterfrom
PhotonicVelocity:feat/add_clip_slot_properties

Conversation

@PhotonicVelocity
Copy link

@PhotonicVelocity PhotonicVelocity commented Jan 29, 2026

Proposed Update to Module Definitions

Summary

I would like to propose replacing the old methods / properties_r / properties_rw list setup with a dictionary‑based registry in clip_slot.py. The new structure keeps all available enpoints in a single place to easilly parse and update. It makes behavior explicit per endpoint and allows fine‑grained control over methods, getters, setters, and listeners - allowing custom callers where needed or simple aliases for endpoint consistency. It aligns the API with a consistent verb naming scheme (e.g., create/midi_clip, delete/clip, set/fire_button).

Why move to a dictionary

The previous design relied on separate lists and implicit behavior (e.g., every property got listeners, even when the Live API doesn’t support them). And every method that wasn't a direct call needed a custom handler, even if it was just to make a nicer endpoint name. The new dictionary setup:

  • Makes the intended behavior explicit per endpoint (alias, caller, get, set, listen).
  • Avoids auto‑registering unsupported listeners.
  • Cleanly supports alias endpoints and custom callers without extra passthrough functions.
  • Provides a single source of truth for which endpoints are enabled.

Dictionary Structures

Methods

methods = {
    "method_1":     {"alias": 0, "caller": 1},                      # Normal method
    "verb/object":  {"alias": 1, "caller": "module_verb_object"},   # Alias to normal method
    "method_2":     {"alias": 0, "caller": "module_method_2"},      # Method with custom caller
    "method_3":     {"alias": 0, "caller": None}                    # Disabled
}
  • alias: 1/True when the endpoint is just an alternate name for another internal method.
  • caller:
    • 1/True → use the endpoint name as the internal method name
    • "method_name" → call a custom helper (or alias target)
    • None/0 → disabled - but good to have in list with a comment to know what's still to be done

Properties

properties = {
    "property_1":       {"get": 1, "set": 0, "listen": 1},                  # Get/Listen only
    "property_2":       {"get": 1, "set": 1, "listen": 1},                  # Get/Set/Listen
    "property_3":       {"get": 1, "set": 1, "listen": 0},                  # Get/Set only
    "property_4":       {"custom_get", "set": 0, "listen": "custom_get"}    # Custom getter
    "property_5":       {"get": 0, "set": 0, "listen": "bang"}              # Listen only
}
  • get / set / listen:
    • 1 → standard handler (_get_property, _set_property, _start_listen)
    • "func_name" → custom handler function
    • 0 / None → disabled
    • listen only: "bang" tells the listen handler to just return a boolean when fired for properties with no getter.

Naming scheme

Endpoints now follow a verb/object pattern where possible:

  • create/midi_clip, create/audio_clip
  • delete/clip

Back‑compat endpoints are retained for existing clients (create_clip, delete_clip).

Handler Registration

Adding handlers can now be done with a single block at the end of the module. The block reads the dictionaires and adds handlers based on the definitions there.

Updates to Clip Slot

Methods added / changed

Added (new endpoints)

  • /live/clip_slot/create/midi_clip (alias → create_clip)
  • /live/clip_slot/create/audio_clip (alias → create_audio_clip)
  • /live/clip_slot/delete/clip (alias → delete_clip)
  • /live/clip_slot/duplicate_to (custom caller → duplicate_clip_to)
  • /live/clip_slot/set/fire_button (alias → set_fire_button_state)

Back‑compat retained

  • /live/clip_slot/create_clip
  • /live/clip_slot/delete_clip

Properties and listeners

Properties included

All non‑object properties from the Live API are exposed with the correct getter/setter/listener flags:

  • has_clip, has_stop_button, is_group_slot, is_playing, is_recording, is_triggered, will_record_on_start
  • color, color_index, controls_other_clips, playing_status (group‑track slots only)

Skipped (for now)

  • canonical_parent
  • clip

These return parent/child objects and are not very useful at the moment. We always target a clip slot with a track index, and we always target a clip with a track and slot index.

Tests and fixtures

New test support

A silent_audio_file fixture was added in tests/__init__.py to generate a silent WAV file in the tests directory. It works on macOS and Windows and both the .wav and .wav.asd files can be removed by a test afterward.

Endpoint coverage

Tests now exercise the entire clip slot surface area:

  • Creation (MIDI + audio)
  • Deletion
  • Duplication
  • Fire/stop + fire button state
  • Get/set/listen endpoints across all properties with supported listeners
    • For most properties, the test just ensures that there are no errors raised when calling

ClipSlot API coverage summary

  • All standard properties (non‑object) are exposed and tested.
  • All documented listener‑capable properties are exposed and tested.
  • Only object‑returning properties (canonical_parent, clip) are intentionally skipped, with rationale documented above.

Checklist

  • The title is descriptive and summarises the new changes
  • The code and any comments are consistent with the current code style
  • For any new or modified API endpoints, I have added appropriate documentation to README.md
  • For any new or modified API endpoints, I have added unit tests covering the new functionality
  • I have verified that all unit tests pass (see CONTRIBUTING.md for guidance)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant