Skip to content

Dynamically add / remove sources from fallback operator #3394

Answered by smimram
danbo asked this question in Q&A
Discussion options

You must be logged in to vote

I have just modified native.fallback (the alternative implementation of fallback using source.dynamic so that it accepts getters for sources: you can now pass a reference for the list of source. The PR is #3398 and it shall be merged once the tests pass.

You can also have a look at the implementation of native.fallback which is basically what you want here. Suppose that you have sources, which is a reference to a list of sources (which you can thus modify dynamically). You can then create a source s which will play the first available one by

sources = ref([sine()]) # can be modified later on
def ready_sources() = list.find(default=fail, source.is_ready, !sources) end
s = source.dynamic(re…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@Moonbase59
Comment options

@smimram
Comment options

Answer selected by smimram
Comment options

You must be logged in to vote
1 reply
@danbo
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants