Skip to content

Solve possible long-lived allocator issue vs synthio #8082

@jepler

Description

@jepler

CircuitPython version

8.2.0-beta.1

Code/REPL

# see forum thread

Behavior

when some synthio objects (particularly the Synthesizer itself?) are imported, synthio breaks.

these objects refer to each other in complicated ways, e.g., AudioOut -> Synthesizer -> Note -> LFO

If one of these objects is moved (made long-lived) it would break the relationships.

At the same time, Notes in particular are not conceptually "long lived", so the usual thing we've done (e.g., with UART, which frequently is pointed to by an interrupt handler object) of initially allocating as long-lived is not a great solution.

This may be a cause of https://forums.adafruit.com/viewtopic.php?t=202163 -- I saw and ignored something similar during testing.

A workaround that still lets the "create audio player", "create synthesizer" object etc code to be re-used is to place a FUNCTION for creating the object in the import, instead of creating the object itself there.

Description

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions