[Csnd] Error Printing and opcode termination
Date | 2025-03-20 13:16 |
From | Philipp Neumann <0000119f78f3a4f9-dmarc-request@LISTSERV.HEANET.IE> |
Subject | [Csnd] Error Printing and opcode termination |
Hello everybody, I’m working on some UDOs and instruments for algorithmic purposes. I’m used to checking the input of algorithms to ensure they are usable and meet the conditions of the code. In Lisp, I use error printing for this use case. Is there an equivalent in Csound that allows me to check input variables to UDOs and interrupt the program with a proper error message? All the best, Philipp Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here |
Date | 2025-03-20 13:25 |
From | Rory Walsh |
Subject | Re: [Csnd] Error Printing and opcode termination |
I guess you could use exitnow to return as soon as an error occurs? On Thu, 20 Mar 2025 at 13:16, Philipp Neumann <0000119f78f3a4f9-dmarc-request@listserv.heanet.ie> wrote: Hello everybody, |
Date | 2025-03-20 14:04 |
From | Steven Yi |
Subject | Re: [Csnd] Error Printing and opcode termination |
I wrote an assert UDO that's in the unit tests for csound: https://github.com/csound/csound/blob/23540c213447c6b7c8c68eccc9d7853d506a028b/tests/commandline/udo/pass_by_ref.csd#L19 I had been meaning to make this more of a developed UDO library but haven't done so yet, but the general idea works. On Thu, Mar 20, 2025 at 9:22 AM Rory Walsh <rorywalsh@ear.ie> wrote:
|
Date | 2025-03-24 09:17 |
From | Philipp Neumann <0000119f78f3a4f9-dmarc-request@LISTSERV.HEANET.IE> |
Subject | Re: [Csnd] Error Printing and opcode termination |
Thank you both! I will use exitnow for this. Philipp > Am 20.03.2025 um 15:04 schrieb Steven Yi |
Date | 2025-03-24 10:35 |
From | Eduardo Moguillansky |
Subject | Re: [Csnd] Error Printing and opcode termination |
An alternative to just exiting the csound process is to throw an error and terminate the current event. See https://csound-plugins.github.io/csound-plugins/opcodes/initerror.html or https://csound-plugins.github.io/csound-plugins/opcodes/throwerror.html On Mon, Mar 24, 2025 at 10:17 AM Philipp Neumann <0000119f78f3a4f9-dmarc-request@listserv.heanet.ie> wrote: Thank you both! |