Logging Csound Messages via Csound API with Swift
| Date | 2016-01-13 04:59 |
| From | Casey Mongoven |
| Subject | Logging Csound Messages via Csound API with Swift |
Hey All,
What I would like to do is log Csound messages to an NSTextView in a Cocoa
application. I know I can use csoundSetMessageCallback to set a callback
function in C. But I am having difficulty understanding how I could route
these messages to Swift. Has anyone done anything like this? I have looked
into many options such as using "tail" and "fopen()" to look at a log
written by the csound callback function but haven't had much luck. Another
option would be to have the callback function write to a text file and have
this constantly monitored in swift and updated ... is that a better option?
Casey
--
View this message in context: http://csound.1045644.n5.nabble.com/Logging-Csound-Messages-via-Csound-API-with-Swift-tp5746255.html
Sent from the Csound - General mailing list archive at Nabble.com.
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 | 2016-01-13 14:05 |
| From | Rory Walsh |
| Subject | Re: Logging Csound Messages via Csound API with Swift |
There are a few other methods that you can use that will simply return the messages as string. Andres put me on to them some time back, and I find them better than the callback approach. Check the various getMessage functions here: I use them in the following way, where csoundOuput is a string variable. const int messageCnt = csound->GetMessageCnt(); for(int i=0; i<messageCnt; i++) { csoundOutput+=csound->GetFirstMessage(); csound->PopFirstMessage(); } On 13 January 2016 at 04:59, Casey Mongoven <cm@caseymongoven.com> wrote: Hey All, |
| Date | 2016-01-13 18:03 |
| From | Casey Mongoven |
| Subject | Re: Logging Csound Messages via Csound API with Swift |
Thanks Rory! I will definitely take a look at that. :)
Casey
--
View this message in context: http://csound.1045644.n5.nabble.com/Logging-Csound-Messages-via-Csound-API-with-Swift-tp5746255p5746294.html
Sent from the Csound - General mailing list archive at Nabble.com.
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 | 2016-01-13 20:45 |
| From | Andres Cabrera |
| Subject | Re: Logging Csound Messages via Csound API with Swift |
These functions will also be more performant as your code is not inserted in the audio thread. A On Jan 13, 2016 10:04 AM, "Casey Mongoven" <cm@caseymongoven.com> wrote:
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
Thanks Rory! I will definitely take a look at that. :) |