Cabbage Logo
Back to Cabbage Site

Help with selecting which audio I take in

I’m trying to allow Cabbage/Csound to take in stereo audio from either external in (soundflower) or from an external wav audio file via diskin2.

I want to assign a checkbox within Cabbage to flip between one or the other, with only one being on at any given time.

I am having no luck with if/else statements so far. My latest attempt is included in the section of code below. It is probably the wrong way to go about it.

(‘gaFilePlayer1Out’ is the output from the sound file from earlier in code)
If statement attempt.csd (2.6 KB)

I may just leave this option out altogether, but any suggestions here would be much appreciated:)

Thanks!

M

Try this one:
SwitchInputs.csd (926 Bytes)
I’m not a big fan of the goto statements in Csound. I think code that branches using then and endif is easer to read. The issue with your code is that when Csound is branched to ‘onlysoundflower’, it will continue reading the code all the way too and including your onlydiskin block. Using branched if/else statements together with endif is far easier to maintain. If you wish to conitnue using goto then you need a way to prevent a block of code being read depending on the value of toggle.

Thanks for that example Rory. That has worked:) I see my error now.