Skip to content

FR: stop sample playback #329

Description

@positron96

Doesn't seem that people have asked this before, but is there a way to not play a sample on boot?

I'm trying to use Mozzi to play sound effects on a diorama, for this I need to start samples based on events/timers, etc.
Sample.start works well for this as it resets sample position to 0 (and it will effectively start playing from the beginning), but also all the samples start playing right at the start of the sketch!

If there isn't a way to do this, this is a feature request to add a "Sample.stop" method. After calling it, Sample.next() should return 0. Quick look at the source shows that it should be possible to implement it by moving sample position to the end of the sample, this will also support proper functioning of isPlaying function, etc. If the implementation is that simple, I can provide a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions