Skip to content

Pin disconnection from the mixer #50

Closed
@microbit-carlos

Description

@microbit-carlos

Current implementation

  • Executing stop() from audio/music/speech disconnects the pin from the mixer
  • When audio/music/speech finish playing their sound they automatically disconnect their pin from the mixer
  • Issue: This automation will stop other sound-making modules that were playing sound asynchronously
    • So a short pitch will stop a long sound expression from finishing

Current proposition

  • When audio/music/speech finish playing their sound they do not disconnect their pin from the mixer
  • This allows other sound-making modules to continue playing sound asynchronously
  • Issue: This means the pins stay locked into "sound mode"
    • So if the user want's to use the pin for something else they'll see an exception
      • This won't happen very often, as that means the user has to physically disconnect a speaker from the pin and plug something else
    • To unlock the pin for something else they need to call the stop() function from audio/music/speech

Ideal implementation

  • When audio/music/speech finish playing their sound they let other sound-producing module continue
  • The pin is automatically unlocked when all sound is finished
    • In the current MicroPython implementation this might require:
      • Some additional state to be stored and checked when switching the pin mode
        • Or the state to be cleared via CODAL "sound finished" events
      • Some kind of reference-count-like implementation for sound on the pin objects, to check when switching the pin mode
    • @finneyj is this something that MicroPython could check directly from CODAL?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions