[Csnd-dev] csoundCompileCsdText()
Date | 2017-11-21 12:23 |
From | Rory Walsh |
Subject | [Csnd-dev] csoundCompileCsdText() |
I'm getting a failed to open input file when i try this simple csoundCompileCsdText() example (in c++). I've added "csound" to my CsOptions after Mike's example here:
I there anything else I should be adding? The output from Csound is given below the cpp file. #include <stdio.h> #include "csound.hpp" #include <string> using namespace std; int main() { //Create an instance of Csound Csound* csound = new Csound(); string csdText = "<CsoundSynthesizer>" "<CsOptions>" "csound -+rtaudio=jack -odac -B4096" "</CsOptions>" "<CsInstruments>" "sr = 44100" "ksmps = 64 " "nchnls = 2" "0dbfs = 1" "instr 1" "a1 oscili 1, 300, 1" "outs a1, a1" "endin" "</CsInstruments>" "<CsScore>" "f1 0 1024 10 1" "i1 0 2" "</CsScore>" "</CsoundSynthesizer>"; //compile instance of csound. csound->CompileCsdText(csdText.c_str()); //prepare Csound for performance csound->Start(); //perform entire score csound->Perform(); //free Csound object delete csound; return 0; } WARNING: not loading 'libdirectory.so' (incompatible with this version of Csound (3.0/4.0) WARNING: not loading 'libopcodetest.so' (incompatible with this version of Csound (3.0/4.0) 0dBFS level = 32768.0 --Csound version 6.10 (double samples) Nov 17 2017 [commit: 72817722006dd5d9dce73427e940312bd230c60f] libsndfile-1.0.25 STARTING FILE Failed to open input file (null) rtaudio: ALSA module enabled rtmidi: ALSA Raw MIDI module enabled graphics suppressed, ascii substituted 0dBFS level = 32768.0 orch now loaded audio buffered in 256 sample-frame blocks writing 512-byte blks of shorts to test.wav (WAV) SECTION 1: ^Cbacktrace() returned 9 addresses /usr/local/lib/libcsound64.so.6.0(+0x40a9b) [0x7f04030b3a9b] /lib/x86_64-linux-gnu/libc.so.6(+0x354b0) [0x7f04027464b0] /lib/x86_64-linux-gnu/libpthread.so.0(__pthread_mutex_unlock+0x2e) [0x7f04022964ee] /usr/local/lib/libcsound64.so.6.0(csoundUnlockMutex+0x16) [0x7f0403261055] /usr/local/lib/libcsound64.so.6.0(csoundPerform+0x1bc) [0x7f04030b64c2] ./test() [0x4042a6] ./test() [0x403af3] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0) [0x7f0402731830] ./test() [0x403969] Csound tidy up: Interrupt Early return from csoundPerform(). inactive allocs returned to freespace end of score. overall amps: 0.0 overall samples out of range: 0 1 errors in performance Elapsed time at end of performance: real: 4.066s, CPU: 4.061s 256 512 sample blks of shorts written to test.wav (WAV) rory@rory-thinkpad:~/sourcecode/csoundAPI_examples/cpp$ |
Date | 2017-11-21 13:00 |
From | Steven Yi |
Subject | Re: [Csnd-dev] csoundCompileCsdText() |
Do you need \n in your CSD string? On Tue, Nov 21, 2017 at 7:24 AM Rory Walsh <rorywalsh@ear.ie> wrote:
|
Date | 2017-11-21 13:09 |
From | Victor Lazzarini |
Subject | Re: [Csnd-dev] csoundCompileCsdText() |
yes, you need them, otherwise the CSD reader will get confused (let alone the parser). ======================== Prof. Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy, Maynooth University, Maynooth, Co Kildare, Ireland Tel: 00 353 7086936 Fax: 00 353 1 7086952 > On 21 Nov 2017, at 13:00, Steven Yi |
Date | 2017-11-21 14:19 |
From | Michael Gogins |
Subject | Re: [Csnd-dev] csoundCompileCsdText() |
Either add newlines or use a multiline string constant. Regards, Mike On Nov 21, 2017 4:24 AM, "Rory Walsh" <rorywalsh@ear.ie> wrote:
|
Date | 2017-11-21 19:28 |
From | Rory Walsh |
Subject | Re: [Csnd-dev] csoundCompileCsdText() |
Thanks guys. I'll put my hand up and say I used a rather lame online text to string converter to change the csd text into a string. I assumed it would have added the line breaks! My bad. On 21 November 2017 at 14:19, Michael Gogins <michael.gogins@gmail.com> wrote:
|
Date | 2017-11-21 19:41 |
From | Victor Lazzarini |
Subject | Re: [Csnd-dev] csoundCompileCsdText() |
c++11 allows multiline string literals (although I have not used it myself yet)
http://en.cppreference.com/w/cpp/language/string_literal
Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland
|
Date | 2017-11-21 19:43 |
From | Rory Walsh |
Subject | Re: [Csnd-dev] csoundCompileCsdText() |
Good to know. On 21 November 2017 at 19:41, Victor Lazzarini <Victor.Lazzarini@mu.ie> wrote:
|