Csound Csound-dev Csound-tekno Search About

[Csnd] Csound API stopping and starting

Date2018-06-11 22:02
FromPeter Burgess
Subject[Csnd] Csound API stopping and starting
Hi, I'm struggling with the API. It's something I almost never fiddle with, I just get it working and don't touch it for years so I never remember exactly how to use it... Anyway, I wish to stop my performance thread, and then be able to compile a new orchestra and play again. I can compile and play my CSD fine like this:

mp_csound->CompileCsdText(csd.c_str());
mp_csound->Start();
mp_csoundThread->Play();


...and I stop it with this:

mp_csoundThread->Stop();

However, I can't compile and play another csd straight after that as it says this:

WARNING: system constants can only be set once
Csound is already started, call csoundReset()
before starting again.


So as it suggests, I call

mp_csoundThread->Stop();
mp_csound->Reset();

And now, while it appears to try to do what I want when I compile and perform again, I don't get any audio. It seems to hang. What is the correct way of doing this without reinitialising Csound and CsoundPerfThread?

Pete

--
http://algorythmradio.com
https://soundcloud.com/algorythmradio
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

Date2018-06-11 22:11
FromVictor Lazzarini
SubjectRe: [Csnd] Csound API stopping and starting
I’d suggest looking at the examples in this repo


Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

On 11 Jun 2018, at 22:03, Peter Burgess <pete.soundtechnician@GMAIL.COM> wrote:

Hi, I'm struggling with the API. It's something I almost never fiddle with, I just get it working and don't touch it for years so I never remember exactly how to use it... Anyway, I wish to stop my performance thread, and then be able to compile a new orchestra and play again. I can compile and play my CSD fine like this:

mp_csound->CompileCsdText(csd.c_str());
mp_csound->Start();
mp_csoundThread->Play();


...and I stop it with this:

mp_csoundThread->Stop();

However, I can't compile and play another csd straight after that as it says this:

WARNING: system constants can only be set once
Csound is already started, call csoundReset()
before starting again.


So as it suggests, I call

mp_csoundThread->Stop();
mp_csound->Reset();

And now, while it appears to try to do what I want when I compile and perform again, I don't get any audio. It seems to hang. What is the correct way of doing this without reinitialising Csound and CsoundPerfThread?

Pete

--
http://algorythmradio.com
https://soundcloud.com/algorythmradio
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

Date2018-06-11 22:17
FromPeter Burgess
SubjectRe: [Csnd] Csound API stopping and starting
Sadly none of these examples show that. They mostly just play a performance and stop and delete csound. I've been referencing those, the floss manual and the API docs. I'm still none the wiser as to what is wrong

On Mon, Jun 11, 2018 at 10:11 PM, Victor Lazzarini <Victor.Lazzarini@mu.ie> wrote:
I’d suggest looking at the examples in this repo


Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

On 11 Jun 2018, at 22:03, Peter Burgess <pete.soundtechnician@GMAIL.COM> wrote:

Hi, I'm struggling with the API. It's something I almost never fiddle with, I just get it working and don't touch it for years so I never remember exactly how to use it... Anyway, I wish to stop my performance thread, and then be able to compile a new orchestra and play again. I can compile and play my CSD fine like this:

mp_csound->CompileCsdText(csd.c_str());
mp_csound->Start();
mp_csoundThread->Play();


...and I stop it with this:

mp_csoundThread->Stop();

However, I can't compile and play another csd straight after that as it says this:

WARNING: system constants can only be set once
Csound is already started, call csoundReset()
before starting again.


So as it suggests, I call

mp_csoundThread->Stop();
mp_csound->Reset();

And now, while it appears to try to do what I want when I compile and perform again, I don't get any audio. It seems to hang. What is the correct way of doing this without reinitialising Csound and CsoundPerfThread?

Pete

--
http://algorythmradio.com
https://soundcloud.com/algorythmradio
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
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



--
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

Date2018-06-11 22:49
FromSteven Yi
SubjectRe: [Csnd] Csound API stopping and starting
Hi Pete,

When does this hang, when you call Reset() or after calling Reset()
and trying to compile and play a new performance?

Also, what version of Csound are you using?

One thing to also try is to call mp_csoundThread->Join() after calling
Stop() but before calling Reset().  Usually you need to wait for the
thread to complete before doing anything else.

If adding Join() doesn't do it, I'd suggest removing plugin libraries
from OPCODE6DIR64 and seeing if it works; if so, then try adding back
in libraries until it stops working.  (Sometimes opcode libraries can
make Csound hang/crash, particularly when resetting Csound.)

Beyond that, a minimal example with both C++ and csound code would be handy.
On Mon, Jun 11, 2018 at 2:17 PM Peter Burgess
 wrote:
>
> Sadly none of these examples show that. They mostly just play a performance and stop and delete csound. I've been referencing those, the floss manual and the API docs. I'm still none the wiser as to what is wrong
>
> On Mon, Jun 11, 2018 at 10:11 PM, Victor Lazzarini  wrote:
>>
>> I’d suggest looking at the examples in this repo
>>
>> https://github.com/csound/csoundAPI_examples?files=1
>>
>> Victor Lazzarini
>> Dean of Arts, Celtic Studies, and Philosophy
>> Maynooth University
>> Ireland
>>
>> On 11 Jun 2018, at 22:03, Peter Burgess  wrote:
>>
>> Hi, I'm struggling with the API. It's something I almost never fiddle with, I just get it working and don't touch it for years so I never remember exactly how to use it... Anyway, I wish to stop my performance thread, and then be able to compile a new orchestra and play again. I can compile and play my CSD fine like this:
>>
>> mp_csound->CompileCsdText(csd.c_str());
>> mp_csound->Start();
>> mp_csoundThread->Play();
>>
>> ...and I stop it with this:
>>
>> mp_csoundThread->Stop();
>>
>> However, I can't compile and play another csd straight after that as it says this:
>>
>> WARNING: system constants can only be set once
>> Csound is already started, call csoundReset()
>> before starting again.
>>
>> So as it suggests, I call
>>
>> mp_csoundThread->Stop();
>> mp_csound->Reset();
>>
>> And now, while it appears to try to do what I want when I compile and perform again, I don't get any audio. It seems to hang. What is the correct way of doing this without reinitialising Csound and CsoundPerfThread?
>>
>> Pete
>>
>> --
>> http://algorythmradio.com
>> https://soundcloud.com/algorythmradio
>> 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
>>
>> 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
>
>
>
>
> --
> http://algorythmradio.com
> https://soundcloud.com/algorythmradio
> 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

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

Date2018-06-11 23:47
FromPeter Burgess
SubjectRe: [Csnd] Csound API stopping and starting
After calling Join(), do I need to check on the status of mp_csoundThread before I call Reset()?

Where it hangs is here:

STARTING FILE
Creating options
Creating orchestra
closing tag
Creating score
rtaudio: ALSA module enabled
rtmidi: ALSA Raw MIDI module enabled
displays suppressed
0dBFS level = 1.0
orch now loaded
audio buffered in 1024 sample-frame blocks
ALSA output: total buffer size: 4096, period size: 1024
writing 2048 sample blks of 64-bit floats to dac
SECTION 1:

If checking the status is not the problem, I will make a minimal example tomorrow. Also I'm running Csound 6.10, I haven't gotten round to upgrading to 6.11 yet.

Cheers, Pete

On Mon, Jun 11, 2018 at 10:49 PM, Steven Yi <stevenyi@gmail.com> wrote:
Hi Pete,

When does this hang, when you call Reset() or after calling Reset()
and trying to compile and play a new performance?

Also, what version of Csound are you using?

One thing to also try is to call mp_csoundThread->Join() after calling
Stop() but before calling Reset().  Usually you need to wait for the
thread to complete before doing anything else.

If adding Join() doesn't do it, I'd suggest removing plugin libraries
from OPCODE6DIR64 and seeing if it works; if so, then try adding back
in libraries until it stops working.  (Sometimes opcode libraries can
make Csound hang/crash, particularly when resetting Csound.)

Beyond that, a minimal example with both C++ and csound code would be handy.
On Mon, Jun 11, 2018 at 2:17 PM Peter Burgess
<pete.soundtechnician@gmail.com> wrote:
>
> Sadly none of these examples show that. They mostly just play a performance and stop and delete csound. I've been referencing those, the floss manual and the API docs. I'm still none the wiser as to what is wrong
>
> On Mon, Jun 11, 2018 at 10:11 PM, Victor Lazzarini <Victor.Lazzarini@mu.ie> wrote:
>>
>> I’d suggest looking at the examples in this repo
>>
>> https://github.com/csound/csoundAPI_examples?files=1
>>
>> Victor Lazzarini
>> Dean of Arts, Celtic Studies, and Philosophy
>> Maynooth University
>> Ireland
>>
>> On 11 Jun 2018, at 22:03, Peter Burgess <pete.soundtechnician@GMAIL.COM> wrote:
>>
>> Hi, I'm struggling with the API. It's something I almost never fiddle with, I just get it working and don't touch it for years so I never remember exactly how to use it... Anyway, I wish to stop my performance thread, and then be able to compile a new orchestra and play again. I can compile and play my CSD fine like this:
>>
>> mp_csound->CompileCsdText(csd.c_str());
>> mp_csound->Start();
>> mp_csoundThread->Play();
>>
>> ...and I stop it with this:
>>
>> mp_csoundThread->Stop();
>>
>> However, I can't compile and play another csd straight after that as it says this:
>>
>> WARNING: system constants can only be set once
>> Csound is already started, call csoundReset()
>> before starting again.
>>
>> So as it suggests, I call
>>
>> mp_csoundThread->Stop();
>> mp_csound->Reset();
>>
>> And now, while it appears to try to do what I want when I compile and perform again, I don't get any audio. It seems to hang. What is the correct way of doing this without reinitialising Csound and CsoundPerfThread?
>>
>> Pete
>>
>> --
>> http://algorythmradio.com
>> https://soundcloud.com/algorythmradio
>> 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
>>
>> 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
>
>
>
>
> --
> http://algorythmradio.com
> https://soundcloud.com/algorythmradio
> 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

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



--
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

Date2018-06-12 00:06
FromPeter Burgess
SubjectRe: [Csnd] Csound API stopping and starting
Interesting if I just do this and nothing else:

    mp_csound = new Csound;
    mp_csoundThread = new CsoundPerformanceThread(mp_csound);


my mp_csoundThread status starts is already 0, even though csPerfThread.hpp states:

    /**
     * Returns the current status, zero if still playing, positive if
     * the end of score was reached or performance was stopped, and
     * negative if an error occured.
     */

And once I've called:

    mp_csound->CompileCsdText(csd.c_str());
    mp_csound->Start();
    mp_csoundThread->Play();       
    mp_csoundThread->Stop();
    mp_csoundThread->Join();
    mp_csound->Reset();

It returns a status of 1... Am I missing something or is that backwards? haha

Pete

On Mon, Jun 11, 2018 at 11:47 PM, Peter Burgess <pete.soundtechnician@gmail.com> wrote:
After calling Join(), do I need to check on the status of mp_csoundThread before I call Reset()?

Where it hangs is here:

STARTING FILE
Creating options
Creating orchestra
closing tag
Creating score
rtaudio: ALSA module enabled
rtmidi: ALSA Raw MIDI module enabled
displays suppressed
0dBFS level = 1.0
orch now loaded
audio buffered in 1024 sample-frame blocks
ALSA output: total buffer size: 4096, period size: 1024
writing 2048 sample blks of 64-bit floats to dac
SECTION 1:

If checking the status is not the problem, I will make a minimal example tomorrow. Also I'm running Csound 6.10, I haven't gotten round to upgrading to 6.11 yet.

Cheers, Pete

On Mon, Jun 11, 2018 at 10:49 PM, Steven Yi <stevenyi@gmail.com> wrote:
Hi Pete,

When does this hang, when you call Reset() or after calling Reset()
and trying to compile and play a new performance?

Also, what version of Csound are you using?

One thing to also try is to call mp_csoundThread->Join() after calling
Stop() but before calling Reset().  Usually you need to wait for the
thread to complete before doing anything else.

If adding Join() doesn't do it, I'd suggest removing plugin libraries
from OPCODE6DIR64 and seeing if it works; if so, then try adding back
in libraries until it stops working.  (Sometimes opcode libraries can
make Csound hang/crash, particularly when resetting Csound.)

Beyond that, a minimal example with both C++ and csound code would be handy.
On Mon, Jun 11, 2018 at 2:17 PM Peter Burgess
<pete.soundtechnician@gmail.com> wrote:
>
> Sadly none of these examples show that. They mostly just play a performance and stop and delete csound. I've been referencing those, the floss manual and the API docs. I'm still none the wiser as to what is wrong
>
> On Mon, Jun 11, 2018 at 10:11 PM, Victor Lazzarini <Victor.Lazzarini@mu.ie> wrote:
>>
>> I’d suggest looking at the examples in this repo
>>
>> https://github.com/csound/csoundAPI_examples?files=1
>>
>> Victor Lazzarini
>> Dean of Arts, Celtic Studies, and Philosophy
>> Maynooth University
>> Ireland
>>
>> On 11 Jun 2018, at 22:03, Peter Burgess <pete.soundtechnician@GMAIL.COM> wrote:
>>
>> Hi, I'm struggling with the API. It's something I almost never fiddle with, I just get it working and don't touch it for years so I never remember exactly how to use it... Anyway, I wish to stop my performance thread, and then be able to compile a new orchestra and play again. I can compile and play my CSD fine like this:
>>
>> mp_csound->CompileCsdText(csd.c_str());
>> mp_csound->Start();
>> mp_csoundThread->Play();
>>
>> ...and I stop it with this:
>>
>> mp_csoundThread->Stop();
>>
>> However, I can't compile and play another csd straight after that as it says this:
>>
>> WARNING: system constants can only be set once
>> Csound is already started, call csoundReset()
>> before starting again.
>>
>> So as it suggests, I call
>>
>> mp_csoundThread->Stop();
>> mp_csound->Reset();
>>
>> And now, while it appears to try to do what I want when I compile and perform again, I don't get any audio. It seems to hang. What is the correct way of doing this without reinitialising Csound and CsoundPerfThread?
>>
>> Pete
>>
>> --
>> http://algorythmradio.com
>> https://soundcloud.com/algorythmradio
>> 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
>>
>> 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
>
>
>
>
> --
> http://algorythmradio.com
> https://soundcloud.com/algorythmradio
> 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

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



--



--
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

Date2018-06-12 01:55
FromMichael Gogins
SubjectRe: [Csnd] Csound API stopping and starting
Attachmentscsound_threaded.cpp  
The attached file does what you want without complications.

Regards,
Mike

-----------------------------------------------------
Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com

On Mon, Jun 11, 2018 at 7:06 PM Peter Burgess
 wrote:
>
> Interesting if I just do this and nothing else:
>
>     mp_csound = new Csound;
>     mp_csoundThread = new CsoundPerformanceThread(mp_csound);
>
> my mp_csoundThread status starts is already 0, even though csPerfThread.hpp states:
>
>     /**
>      * Returns the current status, zero if still playing, positive if
>      * the end of score was reached or performance was stopped, and
>      * negative if an error occured.
>      */
>
> And once I've called:
>
>     mp_csound->CompileCsdText(csd.c_str());
>     mp_csound->Start();
>     mp_csoundThread->Play();
>     mp_csoundThread->Stop();
>     mp_csoundThread->Join();
>     mp_csound->Reset();
>
> It returns a status of 1... Am I missing something or is that backwards? haha
>
> Pete
>
> On Mon, Jun 11, 2018 at 11:47 PM, Peter Burgess  wrote:
>>
>> After calling Join(), do I need to check on the status of mp_csoundThread before I call Reset()?
>>
>> Where it hangs is here:
>>
>> STARTING FILE
>> Creating options
>> Creating orchestra
>> closing tag
>> Creating score
>> rtaudio: ALSA module enabled
>> rtmidi: ALSA Raw MIDI module enabled
>> displays suppressed
>> 0dBFS level = 1.0
>> orch now loaded
>> audio buffered in 1024 sample-frame blocks
>> ALSA output: total buffer size: 4096, period size: 1024
>> writing 2048 sample blks of 64-bit floats to dac
>> SECTION 1:
>>
>> If checking the status is not the problem, I will make a minimal example tomorrow. Also I'm running Csound 6.10, I haven't gotten round to upgrading to 6.11 yet.
>>
>> Cheers, Pete
>>
>> On Mon, Jun 11, 2018 at 10:49 PM, Steven Yi  wrote:
>>>
>>> Hi Pete,
>>>
>>> When does this hang, when you call Reset() or after calling Reset()
>>> and trying to compile and play a new performance?
>>>
>>> Also, what version of Csound are you using?
>>>
>>> One thing to also try is to call mp_csoundThread->Join() after calling
>>> Stop() but before calling Reset().  Usually you need to wait for the
>>> thread to complete before doing anything else.
>>>
>>> If adding Join() doesn't do it, I'd suggest removing plugin libraries
>>> from OPCODE6DIR64 and seeing if it works; if so, then try adding back
>>> in libraries until it stops working.  (Sometimes opcode libraries can
>>> make Csound hang/crash, particularly when resetting Csound.)
>>>
>>> Beyond that, a minimal example with both C++ and csound code would be handy.
>>> On Mon, Jun 11, 2018 at 2:17 PM Peter Burgess
>>>  wrote:
>>> >
>>> > Sadly none of these examples show that. They mostly just play a performance and stop and delete csound. I've been referencing those, the floss manual and the API docs. I'm still none the wiser as to what is wrong
>>> >
>>> > On Mon, Jun 11, 2018 at 10:11 PM, Victor Lazzarini  wrote:
>>> >>
>>> >> I’d suggest looking at the examples in this repo
>>> >>
>>> >> https://github.com/csound/csoundAPI_examples?files=1
>>> >>
>>> >> Victor Lazzarini
>>> >> Dean of Arts, Celtic Studies, and Philosophy
>>> >> Maynooth University
>>> >> Ireland
>>> >>
>>> >> On 11 Jun 2018, at 22:03, Peter Burgess  wrote:
>>> >>
>>> >> Hi, I'm struggling with the API. It's something I almost never fiddle with, I just get it working and don't touch it for years so I never remember exactly how to use it... Anyway, I wish to stop my performance thread, and then be able to compile a new orchestra and play again. I can compile and play my CSD fine like this:
>>> >>
>>> >> mp_csound->CompileCsdText(csd.c_str());
>>> >> mp_csound->Start();
>>> >> mp_csoundThread->Play();
>>> >>
>>> >> ...and I stop it with this:
>>> >>
>>> >> mp_csoundThread->Stop();
>>> >>
>>> >> However, I can't compile and play another csd straight after that as it says this:
>>> >>
>>> >> WARNING: system constants can only be set once
>>> >> Csound is already started, call csoundReset()
>>> >> before starting again.
>>> >>
>>> >> So as it suggests, I call
>>> >>
>>> >> mp_csoundThread->Stop();
>>> >> mp_csound->Reset();
>>> >>
>>> >> And now, while it appears to try to do what I want when I compile and perform again, I don't get any audio. It seems to hang. What is the correct way of doing this without reinitialising Csound and CsoundPerfThread?
>>> >>
>>> >> Pete
>>> >>
>>> >> --
>>> >> http://algorythmradio.com
>>> >> https://soundcloud.com/algorythmradio
>>> >> 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
>>> >>
>>> >> 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
>>> >
>>> >
>>> >
>>> >
>>> > --
>>> > http://algorythmradio.com
>>> > https://soundcloud.com/algorythmradio
>>> > 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
>>>
>>> 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
>>
>>
>>
>>
>> --
>> http://algorythmradio.com
>> https://soundcloud.com/algorythmradio
>
>
>
>
> --
> http://algorythmradio.com
> https://soundcloud.com/algorythmradio
> 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

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

Date2018-06-12 09:35
FromPeter Burgess
SubjectRe: [Csnd] Csound API stopping and starting
Thank you. Is csound_threaded a new class that already combines csound and a performance thread?

This file only performs once though, it doesn't then try to combine a new CSD and perform again after stopping and resetting.

On Tue, 12 Jun 2018, 01:56 Michael Gogins, <michael.gogins@gmail.com> wrote:
The attached file does what you want without complications.

Regards,
Mike

-----------------------------------------------------
Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com

On Mon, Jun 11, 2018 at 7:06 PM Peter Burgess
<pete.soundtechnician@gmail.com> wrote:
>
> Interesting if I just do this and nothing else:
>
>     mp_csound = new Csound;
>     mp_csoundThread = new CsoundPerformanceThread(mp_csound);
>
> my mp_csoundThread status starts is already 0, even though csPerfThread.hpp states:
>
>     /**
>      * Returns the current status, zero if still playing, positive if
>      * the end of score was reached or performance was stopped, and
>      * negative if an error occured.
>      */
>
> And once I've called:
>
>     mp_csound->CompileCsdText(csd.c_str());
>     mp_csound->Start();
>     mp_csoundThread->Play();
>     mp_csoundThread->Stop();
>     mp_csoundThread->Join();
>     mp_csound->Reset();
>
> It returns a status of 1... Am I missing something or is that backwards? haha
>
> Pete
>
> On Mon, Jun 11, 2018 at 11:47 PM, Peter Burgess <pete.soundtechnician@gmail.com> wrote:
>>
>> After calling Join(), do I need to check on the status of mp_csoundThread before I call Reset()?
>>
>> Where it hangs is here:
>>
>> STARTING FILE
>> Creating options
>> Creating orchestra
>> closing tag
>> Creating score
>> rtaudio: ALSA module enabled
>> rtmidi: ALSA Raw MIDI module enabled
>> displays suppressed
>> 0dBFS level = 1.0
>> orch now loaded
>> audio buffered in 1024 sample-frame blocks
>> ALSA output: total buffer size: 4096, period size: 1024
>> writing 2048 sample blks of 64-bit floats to dac
>> SECTION 1:
>>
>> If checking the status is not the problem, I will make a minimal example tomorrow. Also I'm running Csound 6.10, I haven't gotten round to upgrading to 6.11 yet.
>>
>> Cheers, Pete
>>
>> On Mon, Jun 11, 2018 at 10:49 PM, Steven Yi <stevenyi@gmail.com> wrote:
>>>
>>> Hi Pete,
>>>
>>> When does this hang, when you call Reset() or after calling Reset()
>>> and trying to compile and play a new performance?
>>>
>>> Also, what version of Csound are you using?
>>>
>>> One thing to also try is to call mp_csoundThread->Join() after calling
>>> Stop() but before calling Reset().  Usually you need to wait for the
>>> thread to complete before doing anything else.
>>>
>>> If adding Join() doesn't do it, I'd suggest removing plugin libraries
>>> from OPCODE6DIR64 and seeing if it works; if so, then try adding back
>>> in libraries until it stops working.  (Sometimes opcode libraries can
>>> make Csound hang/crash, particularly when resetting Csound.)
>>>
>>> Beyond that, a minimal example with both C++ and csound code would be handy.
>>> On Mon, Jun 11, 2018 at 2:17 PM Peter Burgess
>>> <pete.soundtechnician@gmail.com> wrote:
>>> >
>>> > Sadly none of these examples show that. They mostly just play a performance and stop and delete csound. I've been referencing those, the floss manual and the API docs. I'm still none the wiser as to what is wrong
>>> >
>>> > On Mon, Jun 11, 2018 at 10:11 PM, Victor Lazzarini <Victor.Lazzarini@mu.ie> wrote:
>>> >>
>>> >> I’d suggest looking at the examples in this repo
>>> >>
>>> >> https://github.com/csound/csoundAPI_examples?files=1
>>> >>
>>> >> Victor Lazzarini
>>> >> Dean of Arts, Celtic Studies, and Philosophy
>>> >> Maynooth University
>>> >> Ireland
>>> >>
>>> >> On 11 Jun 2018, at 22:03, Peter Burgess <pete.soundtechnician@GMAIL.COM> wrote:
>>> >>
>>> >> Hi, I'm struggling with the API. It's something I almost never fiddle with, I just get it working and don't touch it for years so I never remember exactly how to use it... Anyway, I wish to stop my performance thread, and then be able to compile a new orchestra and play again. I can compile and play my CSD fine like this:
>>> >>
>>> >> mp_csound->CompileCsdText(csd.c_str());
>>> >> mp_csound->Start();
>>> >> mp_csoundThread->Play();
>>> >>
>>> >> ...and I stop it with this:
>>> >>
>>> >> mp_csoundThread->Stop();
>>> >>
>>> >> However, I can't compile and play another csd straight after that as it says this:
>>> >>
>>> >> WARNING: system constants can only be set once
>>> >> Csound is already started, call csoundReset()
>>> >> before starting again.
>>> >>
>>> >> So as it suggests, I call
>>> >>
>>> >> mp_csoundThread->Stop();
>>> >> mp_csound->Reset();
>>> >>
>>> >> And now, while it appears to try to do what I want when I compile and perform again, I don't get any audio. It seems to hang. What is the correct way of doing this without reinitialising Csound and CsoundPerfThread?
>>> >>
>>> >> Pete
>>> >>
>>> >> --
>>> >> http://algorythmradio.com
>>> >> https://soundcloud.com/algorythmradio
>>> >> 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
>>> >>
>>> >> 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
>>> >
>>> >
>>> >
>>> >
>>> > --
>>> > http://algorythmradio.com
>>> > https://soundcloud.com/algorythmradio
>>> > 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
>>>
>>> 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
>>
>>
>>
>>
>> --
>> http://algorythmradio.com
>> https://soundcloud.com/algorythmradio
>
>
>
>
> --
> http://algorythmradio.com
> https://soundcloud.com/algorythmradio
> 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

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
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

Date2018-06-12 12:43
FromMichael Gogins
SubjectRe: [Csnd] Csound API stopping and starting
Yes. Not that new. The class is CsoundThreaded.hpp, the attachment is a program that uses CsoundThreaded. The program embeds the CSD as text, intantiates CsoundThreaded just once, then loops to compile, perform, and reset three times. Obviously a different CSD could have been used each time. 

CsoundThreaded is a header file only class, you don't need to link with any extra library. 

Regards, 
Mike

On Tue, Jun 12, 2018, 04:36 Peter Burgess <pete.soundtechnician@gmail.com> wrote:
Thank you. Is csound_threaded a new class that already combines csound and a performance thread?

This file only performs once though, it doesn't then try to combine a new CSD and perform again after stopping and resetting.

On Tue, 12 Jun 2018, 01:56 Michael Gogins, <michael.gogins@gmail.com> wrote:
The attached file does what you want without complications.

Regards,
Mike

-----------------------------------------------------
Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com

On Mon, Jun 11, 2018 at 7:06 PM Peter Burgess
<pete.soundtechnician@gmail.com> wrote:
>
> Interesting if I just do this and nothing else:
>
>     mp_csound = new Csound;
>     mp_csoundThread = new CsoundPerformanceThread(mp_csound);
>
> my mp_csoundThread status starts is already 0, even though csPerfThread.hpp states:
>
>     /**
>      * Returns the current status, zero if still playing, positive if
>      * the end of score was reached or performance was stopped, and
>      * negative if an error occured.
>      */
>
> And once I've called:
>
>     mp_csound->CompileCsdText(csd.c_str());
>     mp_csound->Start();
>     mp_csoundThread->Play();
>     mp_csoundThread->Stop();
>     mp_csoundThread->Join();
>     mp_csound->Reset();
>
> It returns a status of 1... Am I missing something or is that backwards? haha
>
> Pete
>
> On Mon, Jun 11, 2018 at 11:47 PM, Peter Burgess <pete.soundtechnician@gmail.com> wrote:
>>
>> After calling Join(), do I need to check on the status of mp_csoundThread before I call Reset()?
>>
>> Where it hangs is here:
>>
>> STARTING FILE
>> Creating options
>> Creating orchestra
>> closing tag
>> Creating score
>> rtaudio: ALSA module enabled
>> rtmidi: ALSA Raw MIDI module enabled
>> displays suppressed
>> 0dBFS level = 1.0
>> orch now loaded
>> audio buffered in 1024 sample-frame blocks
>> ALSA output: total buffer size: 4096, period size: 1024
>> writing 2048 sample blks of 64-bit floats to dac
>> SECTION 1:
>>
>> If checking the status is not the problem, I will make a minimal example tomorrow. Also I'm running Csound 6.10, I haven't gotten round to upgrading to 6.11 yet.
>>
>> Cheers, Pete
>>
>> On Mon, Jun 11, 2018 at 10:49 PM, Steven Yi <stevenyi@gmail.com> wrote:
>>>
>>> Hi Pete,
>>>
>>> When does this hang, when you call Reset() or after calling Reset()
>>> and trying to compile and play a new performance?
>>>
>>> Also, what version of Csound are you using?
>>>
>>> One thing to also try is to call mp_csoundThread->Join() after calling
>>> Stop() but before calling Reset().  Usually you need to wait for the
>>> thread to complete before doing anything else.
>>>
>>> If adding Join() doesn't do it, I'd suggest removing plugin libraries
>>> from OPCODE6DIR64 and seeing if it works; if so, then try adding back
>>> in libraries until it stops working.  (Sometimes opcode libraries can
>>> make Csound hang/crash, particularly when resetting Csound.)
>>>
>>> Beyond that, a minimal example with both C++ and csound code would be handy.
>>> On Mon, Jun 11, 2018 at 2:17 PM Peter Burgess
>>> <pete.soundtechnician@gmail.com> wrote:
>>> >
>>> > Sadly none of these examples show that. They mostly just play a performance and stop and delete csound. I've been referencing those, the floss manual and the API docs. I'm still none the wiser as to what is wrong
>>> >
>>> > On Mon, Jun 11, 2018 at 10:11 PM, Victor Lazzarini <Victor.Lazzarini@mu.ie> wrote:
>>> >>
>>> >> I’d suggest looking at the examples in this repo
>>> >>
>>> >> https://github.com/csound/csoundAPI_examples?files=1
>>> >>
>>> >> Victor Lazzarini
>>> >> Dean of Arts, Celtic Studies, and Philosophy
>>> >> Maynooth University
>>> >> Ireland
>>> >>
>>> >> On 11 Jun 2018, at 22:03, Peter Burgess <pete.soundtechnician@GMAIL.COM> wrote:
>>> >>
>>> >> Hi, I'm struggling with the API. It's something I almost never fiddle with, I just get it working and don't touch it for years so I never remember exactly how to use it... Anyway, I wish to stop my performance thread, and then be able to compile a new orchestra and play again. I can compile and play my CSD fine like this:
>>> >>
>>> >> mp_csound->CompileCsdText(csd.c_str());
>>> >> mp_csound->Start();
>>> >> mp_csoundThread->Play();
>>> >>
>>> >> ...and I stop it with this:
>>> >>
>>> >> mp_csoundThread->Stop();
>>> >>
>>> >> However, I can't compile and play another csd straight after that as it says this:
>>> >>
>>> >> WARNING: system constants can only be set once
>>> >> Csound is already started, call csoundReset()
>>> >> before starting again.
>>> >>
>>> >> So as it suggests, I call
>>> >>
>>> >> mp_csoundThread->Stop();
>>> >> mp_csound->Reset();
>>> >>
>>> >> And now, while it appears to try to do what I want when I compile and perform again, I don't get any audio. It seems to hang. What is the correct way of doing this without reinitialising Csound and CsoundPerfThread?
>>> >>
>>> >> Pete
>>> >>
>>> >> --
>>> >> http://algorythmradio.com
>>> >> https://soundcloud.com/algorythmradio
>>> >> 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
>>> >>
>>> >> 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
>>> >
>>> >
>>> >
>>> >
>>> > --
>>> > http://algorythmradio.com
>>> > https://soundcloud.com/algorythmradio
>>> > 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
>>>
>>> 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
>>
>>
>>
>>
>> --
>> http://algorythmradio.com
>> https://soundcloud.com/algorythmradio
>
>
>
>
> --
> http://algorythmradio.com
> https://soundcloud.com/algorythmradio
> 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

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
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
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

Date2018-06-12 12:45
FromMichael Gogins
SubjectRe: [Csnd] Csound API stopping and starting
Btw the file performs 3 times. 

On Tue, Jun 12, 2018, 04:36 Peter Burgess <pete.soundtechnician@gmail.com> wrote:
Thank you. Is csound_threaded a new class that already combines csound and a performance thread?

This file only performs once though, it doesn't then try to combine a new CSD and perform again after stopping and resetting.

On Tue, 12 Jun 2018, 01:56 Michael Gogins, <michael.gogins@gmail.com> wrote:
The attached file does what you want without complications.

Regards,
Mike

-----------------------------------------------------
Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com

On Mon, Jun 11, 2018 at 7:06 PM Peter Burgess
<pete.soundtechnician@gmail.com> wrote:
>
> Interesting if I just do this and nothing else:
>
>     mp_csound = new Csound;
>     mp_csoundThread = new CsoundPerformanceThread(mp_csound);
>
> my mp_csoundThread status starts is already 0, even though csPerfThread.hpp states:
>
>     /**
>      * Returns the current status, zero if still playing, positive if
>      * the end of score was reached or performance was stopped, and
>      * negative if an error occured.
>      */
>
> And once I've called:
>
>     mp_csound->CompileCsdText(csd.c_str());
>     mp_csound->Start();
>     mp_csoundThread->Play();
>     mp_csoundThread->Stop();
>     mp_csoundThread->Join();
>     mp_csound->Reset();
>
> It returns a status of 1... Am I missing something or is that backwards? haha
>
> Pete
>
> On Mon, Jun 11, 2018 at 11:47 PM, Peter Burgess <pete.soundtechnician@gmail.com> wrote:
>>
>> After calling Join(), do I need to check on the status of mp_csoundThread before I call Reset()?
>>
>> Where it hangs is here:
>>
>> STARTING FILE
>> Creating options
>> Creating orchestra
>> closing tag
>> Creating score
>> rtaudio: ALSA module enabled
>> rtmidi: ALSA Raw MIDI module enabled
>> displays suppressed
>> 0dBFS level = 1.0
>> orch now loaded
>> audio buffered in 1024 sample-frame blocks
>> ALSA output: total buffer size: 4096, period size: 1024
>> writing 2048 sample blks of 64-bit floats to dac
>> SECTION 1:
>>
>> If checking the status is not the problem, I will make a minimal example tomorrow. Also I'm running Csound 6.10, I haven't gotten round to upgrading to 6.11 yet.
>>
>> Cheers, Pete
>>
>> On Mon, Jun 11, 2018 at 10:49 PM, Steven Yi <stevenyi@gmail.com> wrote:
>>>
>>> Hi Pete,
>>>
>>> When does this hang, when you call Reset() or after calling Reset()
>>> and trying to compile and play a new performance?
>>>
>>> Also, what version of Csound are you using?
>>>
>>> One thing to also try is to call mp_csoundThread->Join() after calling
>>> Stop() but before calling Reset().  Usually you need to wait for the
>>> thread to complete before doing anything else.
>>>
>>> If adding Join() doesn't do it, I'd suggest removing plugin libraries
>>> from OPCODE6DIR64 and seeing if it works; if so, then try adding back
>>> in libraries until it stops working.  (Sometimes opcode libraries can
>>> make Csound hang/crash, particularly when resetting Csound.)
>>>
>>> Beyond that, a minimal example with both C++ and csound code would be handy.
>>> On Mon, Jun 11, 2018 at 2:17 PM Peter Burgess
>>> <pete.soundtechnician@gmail.com> wrote:
>>> >
>>> > Sadly none of these examples show that. They mostly just play a performance and stop and delete csound. I've been referencing those, the floss manual and the API docs. I'm still none the wiser as to what is wrong
>>> >
>>> > On Mon, Jun 11, 2018 at 10:11 PM, Victor Lazzarini <Victor.Lazzarini@mu.ie> wrote:
>>> >>
>>> >> I’d suggest looking at the examples in this repo
>>> >>
>>> >> https://github.com/csound/csoundAPI_examples?files=1
>>> >>
>>> >> Victor Lazzarini
>>> >> Dean of Arts, Celtic Studies, and Philosophy
>>> >> Maynooth University
>>> >> Ireland
>>> >>
>>> >> On 11 Jun 2018, at 22:03, Peter Burgess <pete.soundtechnician@GMAIL.COM> wrote:
>>> >>
>>> >> Hi, I'm struggling with the API. It's something I almost never fiddle with, I just get it working and don't touch it for years so I never remember exactly how to use it... Anyway, I wish to stop my performance thread, and then be able to compile a new orchestra and play again. I can compile and play my CSD fine like this:
>>> >>
>>> >> mp_csound->CompileCsdText(csd.c_str());
>>> >> mp_csound->Start();
>>> >> mp_csoundThread->Play();
>>> >>
>>> >> ...and I stop it with this:
>>> >>
>>> >> mp_csoundThread->Stop();
>>> >>
>>> >> However, I can't compile and play another csd straight after that as it says this:
>>> >>
>>> >> WARNING: system constants can only be set once
>>> >> Csound is already started, call csoundReset()
>>> >> before starting again.
>>> >>
>>> >> So as it suggests, I call
>>> >>
>>> >> mp_csoundThread->Stop();
>>> >> mp_csound->Reset();
>>> >>
>>> >> And now, while it appears to try to do what I want when I compile and perform again, I don't get any audio. It seems to hang. What is the correct way of doing this without reinitialising Csound and CsoundPerfThread?
>>> >>
>>> >> Pete
>>> >>
>>> >> --
>>> >> http://algorythmradio.com
>>> >> https://soundcloud.com/algorythmradio
>>> >> 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
>>> >>
>>> >> 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
>>> >
>>> >
>>> >
>>> >
>>> > --
>>> > http://algorythmradio.com
>>> > https://soundcloud.com/algorythmradio
>>> > 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
>>>
>>> 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
>>
>>
>>
>>
>> --
>> http://algorythmradio.com
>> https://soundcloud.com/algorythmradio
>
>
>
>
> --
> http://algorythmradio.com
> https://soundcloud.com/algorythmradio
> 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

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
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
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

Date2018-06-12 15:00
From"Dr. Richard Boulanger"
SubjectRe: [Csnd] Csound API stopping and starting
I can’t locate the included .hpp file.  Any advice?  Can you attach it also?

Sent from my iPhone

On Jun 12, 2018, at 7:45 AM, Michael Gogins <michael.gogins@GMAIL.COM> wrote:

Btw the file performs 3 times. 

On Tue, Jun 12, 2018, 04:36 Peter Burgess <pete.soundtechnician@gmail.com> wrote:
Thank you. Is csound_threaded a new class that already combines csound and a performance thread?

This file only performs once though, it doesn't then try to combine a new CSD and perform again after stopping and resetting.

On Tue, 12 Jun 2018, 01:56 Michael Gogins, <michael.gogins@gmail.com> wrote:
The attached file does what you want without complications.

Regards,
Mike

-----------------------------------------------------
Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com

On Mon, Jun 11, 2018 at 7:06 PM Peter Burgess
<pete.soundtechnician@gmail.com> wrote:
>
> Interesting if I just do this and nothing else:
>
>     mp_csound = new Csound;
>     mp_csoundThread = new CsoundPerformanceThread(mp_csound);
>
> my mp_csoundThread status starts is already 0, even though csPerfThread.hpp states:
>
>     /**
>      * Returns the current status, zero if still playing, positive if
>      * the end of score was reached or performance was stopped, and
>      * negative if an error occured.
>      */
>
> And once I've called:
>
>     mp_csound->CompileCsdText(csd.c_str());
>     mp_csound->Start();
>     mp_csoundThread->Play();
>     mp_csoundThread->Stop();
>     mp_csoundThread->Join();
>     mp_csound->Reset();
>
> It returns a status of 1... Am I missing something or is that backwards? haha
>
> Pete
>
> On Mon, Jun 11, 2018 at 11:47 PM, Peter Burgess <pete.soundtechnician@gmail.com> wrote:
>>
>> After calling Join(), do I need to check on the status of mp_csoundThread before I call Reset()?
>>
>> Where it hangs is here:
>>
>> STARTING FILE
>> Creating options
>> Creating orchestra
>> closing tag
>> Creating score
>> rtaudio: ALSA module enabled
>> rtmidi: ALSA Raw MIDI module enabled
>> displays suppressed
>> 0dBFS level = 1.0
>> orch now loaded
>> audio buffered in 1024 sample-frame blocks
>> ALSA output: total buffer size: 4096, period size: 1024
>> writing 2048 sample blks of 64-bit floats to dac
>> SECTION 1:
>>
>> If checking the status is not the problem, I will make a minimal example tomorrow. Also I'm running Csound 6.10, I haven't gotten round to upgrading to 6.11 yet.
>>
>> Cheers, Pete
>>
>> On Mon, Jun 11, 2018 at 10:49 PM, Steven Yi <stevenyi@gmail.com> wrote:
>>>
>>> Hi Pete,
>>>
>>> When does this hang, when you call Reset() or after calling Reset()
>>> and trying to compile and play a new performance?
>>>
>>> Also, what version of Csound are you using?
>>>
>>> One thing to also try is to call mp_csoundThread->Join() after calling
>>> Stop() but before calling Reset().  Usually you need to wait for the
>>> thread to complete before doing anything else.
>>>
>>> If adding Join() doesn't do it, I'd suggest removing plugin libraries
>>> from OPCODE6DIR64 and seeing if it works; if so, then try adding back
>>> in libraries until it stops working.  (Sometimes opcode libraries can
>>> make Csound hang/crash, particularly when resetting Csound.)
>>>
>>> Beyond that, a minimal example with both C++ and csound code would be handy.
>>> On Mon, Jun 11, 2018 at 2:17 PM Peter Burgess
>>> <pete.soundtechnician@gmail.com> wrote:
>>> >
>>> > Sadly none of these examples show that. They mostly just play a performance and stop and delete csound. I've been referencing those, the floss manual and the API docs. I'm still none the wiser as to what is wrong
>>> >
>>> > On Mon, Jun 11, 2018 at 10:11 PM, Victor Lazzarini <Victor.Lazzarini@mu.ie> wrote:
>>> >>
>>> >> I’d suggest looking at the examples in this repo
>>> >>
>>> >> https://github.com/csound/csoundAPI_examples?files=1
>>> >>
>>> >> Victor Lazzarini
>>> >> Dean of Arts, Celtic Studies, and Philosophy
>>> >> Maynooth University
>>> >> Ireland
>>> >>
>>> >> On 11 Jun 2018, at 22:03, Peter Burgess <pete.soundtechnician@GMAIL.COM> wrote:
>>> >>
>>> >> Hi, I'm struggling with the API. It's something I almost never fiddle with, I just get it working and don't touch it for years so I never remember exactly how to use it... Anyway, I wish to stop my performance thread, and then be able to compile a new orchestra and play again. I can compile and play my CSD fine like this:
>>> >>
>>> >> mp_csound->CompileCsdText(csd.c_str());
>>> >> mp_csound->Start();
>>> >> mp_csoundThread->Play();
>>> >>
>>> >> ...and I stop it with this:
>>> >>
>>> >> mp_csoundThread->Stop();
>>> >>
>>> >> However, I can't compile and play another csd straight after that as it says this:
>>> >>
>>> >> WARNING: system constants can only be set once
>>> >> Csound is already started, call csoundReset()
>>> >> before starting again.
>>> >>
>>> >> So as it suggests, I call
>>> >>
>>> >> mp_csoundThread->Stop();
>>> >> mp_csound->Reset();
>>> >>
>>> >> And now, while it appears to try to do what I want when I compile and perform again, I don't get any audio. It seems to hang. What is the correct way of doing this without reinitialising Csound and CsoundPerfThread?
>>> >>
>>> >> Pete
>>> >>
>>> >> --
>>> >> http://algorythmradio.com
>>> >> https://soundcloud.com/algorythmradio
>>> >> 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
>>> >>
>>> >> 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
>>> >
>>> >
>>> >
>>> >
>>> > --
>>> > http://algorythmradio.com
>>> > https://soundcloud.com/algorythmradio
>>> > 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
>>>
>>> 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
>>
>>
>>
>>
>> --
>> http://algorythmradio.com
>> https://soundcloud.com/algorythmradio
>
>
>
>
> --
> http://algorythmradio.com
> https://soundcloud.com/algorythmradio
> 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

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
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
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

Date2018-06-12 15:25
FromMichael Gogins
SubjectRe: [Csnd] Csound API stopping and starting
Attachmentscsound_threaded.hpp  
It's in the Csound GitHub repository include directory. I have also
attached the file.

Regards,
Mike

-----------------------------------------------------
Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com
On Tue, Jun 12, 2018 at 10:00 AM Dr. Richard Boulanger
 wrote:
>
> I can’t locate the included .hpp file.  Any advice?  Can you attach it also?
>
> Sent from my iPhone
>
> On Jun 12, 2018, at 7:45 AM, Michael Gogins  wrote:
>
> Btw the file performs 3 times.
>
> On Tue, Jun 12, 2018, 04:36 Peter Burgess  wrote:
>>
>> Thank you. Is csound_threaded a new class that already combines csound and a performance thread?
>>
>> This file only performs once though, it doesn't then try to combine a new CSD and perform again after stopping and resetting.
>>
>> On Tue, 12 Jun 2018, 01:56 Michael Gogins,  wrote:
>>>
>>> The attached file does what you want without complications.
>>>
>>> Regards,
>>> Mike
>>>
>>> -----------------------------------------------------
>>> Michael Gogins
>>> Irreducible Productions
>>> http://michaelgogins.tumblr.com
>>> Michael dot Gogins at gmail dot com
>>>
>>> On Mon, Jun 11, 2018 at 7:06 PM Peter Burgess
>>>  wrote:
>>> >
>>> > Interesting if I just do this and nothing else:
>>> >
>>> >     mp_csound = new Csound;
>>> >     mp_csoundThread = new CsoundPerformanceThread(mp_csound);
>>> >
>>> > my mp_csoundThread status starts is already 0, even though csPerfThread.hpp states:
>>> >
>>> >     /**
>>> >      * Returns the current status, zero if still playing, positive if
>>> >      * the end of score was reached or performance was stopped, and
>>> >      * negative if an error occured.
>>> >      */
>>> >
>>> > And once I've called:
>>> >
>>> >     mp_csound->CompileCsdText(csd.c_str());
>>> >     mp_csound->Start();
>>> >     mp_csoundThread->Play();
>>> >     mp_csoundThread->Stop();
>>> >     mp_csoundThread->Join();
>>> >     mp_csound->Reset();
>>> >
>>> > It returns a status of 1... Am I missing something or is that backwards? haha
>>> >
>>> > Pete
>>> >
>>> > On Mon, Jun 11, 2018 at 11:47 PM, Peter Burgess  wrote:
>>> >>
>>> >> After calling Join(), do I need to check on the status of mp_csoundThread before I call Reset()?
>>> >>
>>> >> Where it hangs is here:
>>> >>
>>> >> STARTING FILE
>>> >> Creating options
>>> >> Creating orchestra
>>> >> closing tag
>>> >> Creating score
>>> >> rtaudio: ALSA module enabled
>>> >> rtmidi: ALSA Raw MIDI module enabled
>>> >> displays suppressed
>>> >> 0dBFS level = 1.0
>>> >> orch now loaded
>>> >> audio buffered in 1024 sample-frame blocks
>>> >> ALSA output: total buffer size: 4096, period size: 1024
>>> >> writing 2048 sample blks of 64-bit floats to dac
>>> >> SECTION 1:
>>> >>
>>> >> If checking the status is not the problem, I will make a minimal example tomorrow. Also I'm running Csound 6.10, I haven't gotten round to upgrading to 6.11 yet.
>>> >>
>>> >> Cheers, Pete
>>> >>
>>> >> On Mon, Jun 11, 2018 at 10:49 PM, Steven Yi  wrote:
>>> >>>
>>> >>> Hi Pete,
>>> >>>
>>> >>> When does this hang, when you call Reset() or after calling Reset()
>>> >>> and trying to compile and play a new performance?
>>> >>>
>>> >>> Also, what version of Csound are you using?
>>> >>>
>>> >>> One thing to also try is to call mp_csoundThread->Join() after calling
>>> >>> Stop() but before calling Reset().  Usually you need to wait for the
>>> >>> thread to complete before doing anything else.
>>> >>>
>>> >>> If adding Join() doesn't do it, I'd suggest removing plugin libraries
>>> >>> from OPCODE6DIR64 and seeing if it works; if so, then try adding back
>>> >>> in libraries until it stops working.  (Sometimes opcode libraries can
>>> >>> make Csound hang/crash, particularly when resetting Csound.)
>>> >>>
>>> >>> Beyond that, a minimal example with both C++ and csound code would be handy.
>>> >>> On Mon, Jun 11, 2018 at 2:17 PM Peter Burgess
>>> >>>  wrote:
>>> >>> >
>>> >>> > Sadly none of these examples show that. They mostly just play a performance and stop and delete csound. I've been referencing those, the floss manual and the API docs. I'm still none the wiser as to what is wrong
>>> >>> >
>>> >>> > On Mon, Jun 11, 2018 at 10:11 PM, Victor Lazzarini  wrote:
>>> >>> >>
>>> >>> >> I’d suggest looking at the examples in this repo
>>> >>> >>
>>> >>> >> https://github.com/csound/csoundAPI_examples?files=1
>>> >>> >>
>>> >>> >> Victor Lazzarini
>>> >>> >> Dean of Arts, Celtic Studies, and Philosophy
>>> >>> >> Maynooth University
>>> >>> >> Ireland
>>> >>> >>
>>> >>> >> On 11 Jun 2018, at 22:03, Peter Burgess  wrote:
>>> >>> >>
>>> >>> >> Hi, I'm struggling with the API. It's something I almost never fiddle with, I just get it working and don't touch it for years so I never remember exactly how to use it... Anyway, I wish to stop my performance thread, and then be able to compile a new orchestra and play again. I can compile and play my CSD fine like this:
>>> >>> >>
>>> >>> >> mp_csound->CompileCsdText(csd.c_str());
>>> >>> >> mp_csound->Start();
>>> >>> >> mp_csoundThread->Play();
>>> >>> >>
>>> >>> >> ...and I stop it with this:
>>> >>> >>
>>> >>> >> mp_csoundThread->Stop();
>>> >>> >>
>>> >>> >> However, I can't compile and play another csd straight after that as it says this:
>>> >>> >>
>>> >>> >> WARNING: system constants can only be set once
>>> >>> >> Csound is already started, call csoundReset()
>>> >>> >> before starting again.
>>> >>> >>
>>> >>> >> So as it suggests, I call
>>> >>> >>
>>> >>> >> mp_csoundThread->Stop();
>>> >>> >> mp_csound->Reset();
>>> >>> >>
>>> >>> >> And now, while it appears to try to do what I want when I compile and perform again, I don't get any audio. It seems to hang. What is the correct way of doing this without reinitialising Csound and CsoundPerfThread?
>>> >>> >>
>>> >>> >> Pete
>>> >>> >>
>>> >>> >> --
>>> >>> >> http://algorythmradio.com
>>> >>> >> https://soundcloud.com/algorythmradio
>>> >>> >> 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
>>> >>> >>
>>> >>> >> 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
>>> >>> >
>>> >>> >
>>> >>> >
>>> >>> >
>>> >>> > --
>>> >>> > http://algorythmradio.com
>>> >>> > https://soundcloud.com/algorythmradio
>>> >>> > 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
>>> >>>
>>> >>> 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
>>> >>
>>> >>
>>> >>
>>> >>
>>> >> --
>>> >> http://algorythmradio.com
>>> >> https://soundcloud.com/algorythmradio
>>> >
>>> >
>>> >
>>> >
>>> > --
>>> > http://algorythmradio.com
>>> > https://soundcloud.com/algorythmradio
>>> > 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
>>>
>>> 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
>>
>> 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
>
> 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
>
> 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

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

Date2018-06-12 15:27
FromPeter Burgess
SubjectRe: [Csnd] Csound API stopping and starting
Michael: sorry you're right, I missed the for loop when I looked at it this morning. Cheers for that, I'll give this class a try

On Tue, 12 Jun 2018, 15:26 Michael Gogins, <michael.gogins@gmail.com> wrote:
It's in the Csound GitHub repository include directory. I have also
attached the file.

Regards,
Mike

-----------------------------------------------------
Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com
On Tue, Jun 12, 2018 at 10:00 AM Dr. Richard Boulanger
<rboulanger@berklee.edu> wrote:
>
> I can’t locate the included .hpp file.  Any advice?  Can you attach it also?
>
> Sent from my iPhone
>
> On Jun 12, 2018, at 7:45 AM, Michael Gogins <michael.gogins@GMAIL.COM> wrote:
>
> Btw the file performs 3 times.
>
> On Tue, Jun 12, 2018, 04:36 Peter Burgess <pete.soundtechnician@gmail.com> wrote:
>>
>> Thank you. Is csound_threaded a new class that already combines csound and a performance thread?
>>
>> This file only performs once though, it doesn't then try to combine a new CSD and perform again after stopping and resetting.
>>
>> On Tue, 12 Jun 2018, 01:56 Michael Gogins, <michael.gogins@gmail.com> wrote:
>>>
>>> The attached file does what you want without complications.
>>>
>>> Regards,
>>> Mike
>>>
>>> -----------------------------------------------------
>>> Michael Gogins
>>> Irreducible Productions
>>> http://michaelgogins.tumblr.com
>>> Michael dot Gogins at gmail dot com
>>>
>>> On Mon, Jun 11, 2018 at 7:06 PM Peter Burgess
>>> <pete.soundtechnician@gmail.com> wrote:
>>> >
>>> > Interesting if I just do this and nothing else:
>>> >
>>> >     mp_csound = new Csound;
>>> >     mp_csoundThread = new CsoundPerformanceThread(mp_csound);
>>> >
>>> > my mp_csoundThread status starts is already 0, even though csPerfThread.hpp states:
>>> >
>>> >     /**
>>> >      * Returns the current status, zero if still playing, positive if
>>> >      * the end of score was reached or performance was stopped, and
>>> >      * negative if an error occured.
>>> >      */
>>> >
>>> > And once I've called:
>>> >
>>> >     mp_csound->CompileCsdText(csd.c_str());
>>> >     mp_csound->Start();
>>> >     mp_csoundThread->Play();
>>> >     mp_csoundThread->Stop();
>>> >     mp_csoundThread->Join();
>>> >     mp_csound->Reset();
>>> >
>>> > It returns a status of 1... Am I missing something or is that backwards? haha
>>> >
>>> > Pete
>>> >
>>> > On Mon, Jun 11, 2018 at 11:47 PM, Peter Burgess <pete.soundtechnician@gmail.com> wrote:
>>> >>
>>> >> After calling Join(), do I need to check on the status of mp_csoundThread before I call Reset()?
>>> >>
>>> >> Where it hangs is here:
>>> >>
>>> >> STARTING FILE
>>> >> Creating options
>>> >> Creating orchestra
>>> >> closing tag
>>> >> Creating score
>>> >> rtaudio: ALSA module enabled
>>> >> rtmidi: ALSA Raw MIDI module enabled
>>> >> displays suppressed
>>> >> 0dBFS level = 1.0
>>> >> orch now loaded
>>> >> audio buffered in 1024 sample-frame blocks
>>> >> ALSA output: total buffer size: 4096, period size: 1024
>>> >> writing 2048 sample blks of 64-bit floats to dac
>>> >> SECTION 1:
>>> >>
>>> >> If checking the status is not the problem, I will make a minimal example tomorrow. Also I'm running Csound 6.10, I haven't gotten round to upgrading to 6.11 yet.
>>> >>
>>> >> Cheers, Pete
>>> >>
>>> >> On Mon, Jun 11, 2018 at 10:49 PM, Steven Yi <stevenyi@gmail.com> wrote:
>>> >>>
>>> >>> Hi Pete,
>>> >>>
>>> >>> When does this hang, when you call Reset() or after calling Reset()
>>> >>> and trying to compile and play a new performance?
>>> >>>
>>> >>> Also, what version of Csound are you using?
>>> >>>
>>> >>> One thing to also try is to call mp_csoundThread->Join() after calling
>>> >>> Stop() but before calling Reset().  Usually you need to wait for the
>>> >>> thread to complete before doing anything else.
>>> >>>
>>> >>> If adding Join() doesn't do it, I'd suggest removing plugin libraries
>>> >>> from OPCODE6DIR64 and seeing if it works; if so, then try adding back
>>> >>> in libraries until it stops working.  (Sometimes opcode libraries can
>>> >>> make Csound hang/crash, particularly when resetting Csound.)
>>> >>>
>>> >>> Beyond that, a minimal example with both C++ and csound code would be handy.
>>> >>> On Mon, Jun 11, 2018 at 2:17 PM Peter Burgess
>>> >>> <pete.soundtechnician@gmail.com> wrote:
>>> >>> >
>>> >>> > Sadly none of these examples show that. They mostly just play a performance and stop and delete csound. I've been referencing those, the floss manual and the API docs. I'm still none the wiser as to what is wrong
>>> >>> >
>>> >>> > On Mon, Jun 11, 2018 at 10:11 PM, Victor Lazzarini <Victor.Lazzarini@mu.ie> wrote:
>>> >>> >>
>>> >>> >> I’d suggest looking at the examples in this repo
>>> >>> >>
>>> >>> >> https://github.com/csound/csoundAPI_examples?files=1
>>> >>> >>
>>> >>> >> Victor Lazzarini
>>> >>> >> Dean of Arts, Celtic Studies, and Philosophy
>>> >>> >> Maynooth University
>>> >>> >> Ireland
>>> >>> >>
>>> >>> >> On 11 Jun 2018, at 22:03, Peter Burgess <pete.soundtechnician@GMAIL.COM> wrote:
>>> >>> >>
>>> >>> >> Hi, I'm struggling with the API. It's something I almost never fiddle with, I just get it working and don't touch it for years so I never remember exactly how to use it... Anyway, I wish to stop my performance thread, and then be able to compile a new orchestra and play again. I can compile and play my CSD fine like this:
>>> >>> >>
>>> >>> >> mp_csound->CompileCsdText(csd.c_str());
>>> >>> >> mp_csound->Start();
>>> >>> >> mp_csoundThread->Play();
>>> >>> >>
>>> >>> >> ...and I stop it with this:
>>> >>> >>
>>> >>> >> mp_csoundThread->Stop();
>>> >>> >>
>>> >>> >> However, I can't compile and play another csd straight after that as it says this:
>>> >>> >>
>>> >>> >> WARNING: system constants can only be set once
>>> >>> >> Csound is already started, call csoundReset()
>>> >>> >> before starting again.
>>> >>> >>
>>> >>> >> So as it suggests, I call
>>> >>> >>
>>> >>> >> mp_csoundThread->Stop();
>>> >>> >> mp_csound->Reset();
>>> >>> >>
>>> >>> >> And now, while it appears to try to do what I want when I compile and perform again, I don't get any audio. It seems to hang. What is the correct way of doing this without reinitialising Csound and CsoundPerfThread?
>>> >>> >>
>>> >>> >> Pete
>>> >>> >>
>>> >>> >> --
>>> >>> >> http://algorythmradio.com
>>> >>> >> https://soundcloud.com/algorythmradio
>>> >>> >> 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
>>> >>> >>
>>> >>> >> 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
>>> >>> >
>>> >>> >
>>> >>> >
>>> >>> >
>>> >>> > --
>>> >>> > http://algorythmradio.com
>>> >>> > https://soundcloud.com/algorythmradio
>>> >>> > 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
>>> >>>
>>> >>> 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
>>> >>
>>> >>
>>> >>
>>> >>
>>> >> --
>>> >> http://algorythmradio.com
>>> >> https://soundcloud.com/algorythmradio
>>> >
>>> >
>>> >
>>> >
>>> > --
>>> > http://algorythmradio.com
>>> > https://soundcloud.com/algorythmradio
>>> > 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
>>>
>>> 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
>>
>> 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
>
> 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
>
> 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

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
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

Date2018-06-12 15:28
From"Dr. Richard Boulanger"
SubjectRe: [Csnd] Csound API stopping and starting
thanks

_____________________________________________
Dr. Richard Boulanger
Professor of Electronic Production and Design
Professional Writing and Music Technology Division
Berklee College of Music
______________________________________________
President of Boulanger Labs - http://boulangerlabs.com
Author & Editor of The Csound Book - http://mitpress.mit.edu/books/csound-book
Author & Editor of The Audio Programming Book - http://mitpress.mit.edu/books/audio-programming-book
______________________________________________
about: 
http://www.boulangerlabs.com/#about
about: http://www.csounds.com/community/developers/dr-richard-boulanger/
music: http://www.csounds.com/community/developers/dr-richard-boulanger/dr-richard-boulanger-music/

______________________________________________
email: rboulanger@berklee.edu
facebook: https://www.facebook.com/richard.boulanger.58

On Tue, Jun 12, 2018 at 10:25 AM, Michael Gogins <michael.gogins@gmail.com> wrote:
It's in the Csound GitHub repository include directory. I have also
attached the file.

Regards,
Mike

-----------------------------------------------------
Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com
On Tue, Jun 12, 2018 at 10:00 AM Dr. Richard Boulanger
<rboulanger@berklee.edu> wrote:
>
> I can’t locate the included .hpp file.  Any advice?  Can you attach it also?
>
> Sent from my iPhone
>
> On Jun 12, 2018, at 7:45 AM, Michael Gogins <michael.gogins@GMAIL.COM> wrote:
>
> Btw the file performs 3 times.
>
> On Tue, Jun 12, 2018, 04:36 Peter Burgess <pete.soundtechnician@gmail.com> wrote:
>>
>> Thank you. Is csound_threaded a new class that already combines csound and a performance thread?
>>
>> This file only performs once though, it doesn't then try to combine a new CSD and perform again after stopping and resetting.
>>
>> On Tue, 12 Jun 2018, 01:56 Michael Gogins, <michael.gogins@gmail.com> wrote:
>>>
>>> The attached file does what you want without complications.
>>>
>>> Regards,
>>> Mike
>>>
>>> -----------------------------------------------------
>>> Michael Gogins
>>> Irreducible Productions
>>> http://michaelgogins.tumblr.com
>>> Michael dot Gogins at gmail dot com
>>>
>>> On Mon, Jun 11, 2018 at 7:06 PM Peter Burgess
>>> <pete.soundtechnician@gmail.com> wrote:
>>> >
>>> > Interesting if I just do this and nothing else:
>>> >
>>> >     mp_csound = new Csound;
>>> >     mp_csoundThread = new CsoundPerformanceThread(mp_csound);
>>> >
>>> > my mp_csoundThread status starts is already 0, even though csPerfThread.hpp states:
>>> >
>>> >     /**
>>> >      * Returns the current status, zero if still playing, positive if
>>> >      * the end of score was reached or performance was stopped, and
>>> >      * negative if an error occured.
>>> >      */
>>> >
>>> > And once I've called:
>>> >
>>> >     mp_csound->CompileCsdText(csd.c_str());
>>> >     mp_csound->Start();
>>> >     mp_csoundThread->Play();
>>> >     mp_csoundThread->Stop();
>>> >     mp_csoundThread->Join();
>>> >     mp_csound->Reset();
>>> >
>>> > It returns a status of 1... Am I missing something or is that backwards? haha
>>> >
>>> > Pete
>>> >
>>> > On Mon, Jun 11, 2018 at 11:47 PM, Peter Burgess <pete.soundtechnician@gmail.com> wrote:
>>> >>
>>> >> After calling Join(), do I need to check on the status of mp_csoundThread before I call Reset()?
>>> >>
>>> >> Where it hangs is here:
>>> >>
>>> >> STARTING FILE
>>> >> Creating options
>>> >> Creating orchestra
>>> >> closing tag
>>> >> Creating score
>>> >> rtaudio: ALSA module enabled
>>> >> rtmidi: ALSA Raw MIDI module enabled
>>> >> displays suppressed
>>> >> 0dBFS level = 1.0
>>> >> orch now loaded
>>> >> audio buffered in 1024 sample-frame blocks
>>> >> ALSA output: total buffer size: 4096, period size: 1024
>>> >> writing 2048 sample blks of 64-bit floats to dac
>>> >> SECTION 1:
>>> >>
>>> >> If checking the status is not the problem, I will make a minimal example tomorrow. Also I'm running Csound 6.10, I haven't gotten round to upgrading to 6.11 yet.
>>> >>
>>> >> Cheers, Pete
>>> >>
>>> >> On Mon, Jun 11, 2018 at 10:49 PM, Steven Yi <stevenyi@gmail.com> wrote:
>>> >>>
>>> >>> Hi Pete,
>>> >>>
>>> >>> When does this hang, when you call Reset() or after calling Reset()
>>> >>> and trying to compile and play a new performance?
>>> >>>
>>> >>> Also, what version of Csound are you using?
>>> >>>
>>> >>> One thing to also try is to call mp_csoundThread->Join() after calling
>>> >>> Stop() but before calling Reset().  Usually you need to wait for the
>>> >>> thread to complete before doing anything else.
>>> >>>
>>> >>> If adding Join() doesn't do it, I'd suggest removing plugin libraries
>>> >>> from OPCODE6DIR64 and seeing if it works; if so, then try adding back
>>> >>> in libraries until it stops working.  (Sometimes opcode libraries can
>>> >>> make Csound hang/crash, particularly when resetting Csound.)
>>> >>>
>>> >>> Beyond that, a minimal example with both C++ and csound code would be handy.
>>> >>> On Mon, Jun 11, 2018 at 2:17 PM Peter Burgess
>>> >>> <pete.soundtechnician@gmail.com> wrote:
>>> >>> >
>>> >>> > Sadly none of these examples show that. They mostly just play a performance and stop and delete csound. I've been referencing those, the floss manual and the API docs. I'm still none the wiser as to what is wrong
>>> >>> >
>>> >>> > On Mon, Jun 11, 2018 at 10:11 PM, Victor Lazzarini <Victor.Lazzarini@mu.ie> wrote:
>>> >>> >>
>>> >>> >> I’d suggest looking at the examples in this repo
>>> >>> >>
>>> >>> >> https://github.com/csound/csoundAPI_examples?files=1
>>> >>> >>
>>> >>> >> Victor Lazzarini
>>> >>> >> Dean of Arts, Celtic Studies, and Philosophy
>>> >>> >> Maynooth University
>>> >>> >> Ireland
>>> >>> >>
>>> >>> >> On 11 Jun 2018, at 22:03, Peter Burgess <pete.soundtechnician@GMAIL.COM> wrote:
>>> >>> >>
>>> >>> >> Hi, I'm struggling with the API. It's something I almost never fiddle with, I just get it working and don't touch it for years so I never remember exactly how to use it... Anyway, I wish to stop my performance thread, and then be able to compile a new orchestra and play again. I can compile and play my CSD fine like this:
>>> >>> >>
>>> >>> >> mp_csound->CompileCsdText(csd.c_str());
>>> >>> >> mp_csound->Start();
>>> >>> >> mp_csoundThread->Play();
>>> >>> >>
>>> >>> >> ...and I stop it with this:
>>> >>> >>
>>> >>> >> mp_csoundThread->Stop();
>>> >>> >>
>>> >>> >> However, I can't compile and play another csd straight after that as it says this:
>>> >>> >>
>>> >>> >> WARNING: system constants can only be set once
>>> >>> >> Csound is already started, call csoundReset()
>>> >>> >> before starting again.
>>> >>> >>
>>> >>> >> So as it suggests, I call
>>> >>> >>
>>> >>> >> mp_csoundThread->Stop();
>>> >>> >> mp_csound->Reset();
>>> >>> >>
>>> >>> >> And now, while it appears to try to do what I want when I compile and perform again, I don't get any audio. It seems to hang. What is the correct way of doing this without reinitialising Csound and CsoundPerfThread?
>>> >>> >>
>>> >>> >> Pete
>>> >>> >>
>>> >>> >> --
>>> >>> >> http://algorythmradio.com
>>> >>> >> https://soundcloud.com/algorythmradio
>>> >>> >> 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
>>> >>> >>
>>> >>> >> 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
>>> >>> >
>>> >>> >
>>> >>> >
>>> >>> >
>>> >>> > --
>>> >>> > http://algorythmradio.com
>>> >>> > https://soundcloud.com/algorythmradio
>>> >>> > 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
>>> >>>
>>> >>> 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
>>> >>
>>> >>
>>> >>
>>> >>
>>> >> --
>>> >> http://algorythmradio.com
>>> >> https://soundcloud.com/algorythmradio
>>> >
>>> >
>>> >
>>> >
>>> > --
>>> > http://algorythmradio.com
>>> > https://soundcloud.com/algorythmradio
>>> > 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
>>>
>>> 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
>>
>> 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
>
> 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
>
> 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

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

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

Date2018-06-12 15:36
FromVictor Lazzarini
SubjectRe: [Csnd] Csound API stopping and starting
Here’s a program doing what you want using CsoundPerformanceThread.
In this particular case, the perf thread object needs to be recreated for
each performance after a Csound reset.

 int main()
{
Csound csound;
string csdText = R"csd(

 
-odac -B4096 


sr = 44100
ksmps = 64    
nchnls = 2
0dbfs = 1
instr 1
a1 oscili 1, 300, 1
outs a1, a1
endin


f1 0 1024 10 1
i1 0 2


)csd";

 int i = 3;
 CsoundPerformanceThread* perf; 
 while(i-- > 0) {
 perf = new CsoundPerformanceThread(csound.GetCsound());
 csound.CompileCsdText(csdText.c_str());
 csound.Start();
 perf->Play();
 perf->Join();
 csound.Reset();
 delete perf;
}
 
return 0;
}


========================
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 12 Jun 2018, at 00:06, Peter Burgess  wrote:
> 
> Interesting if I just do this and nothing else:
> 
>     mp_csound = new Csound;
>     mp_csoundThread = new CsoundPerformanceThread(mp_csound);
> 
> my mp_csoundThread status starts is already 0, even though csPerfThread.hpp states:
> 
>     /**
>      * Returns the current status, zero if still playing, positive if
>      * the end of score was reached or performance was stopped, and
>      * negative if an error occured.
>      */
> 
> And once I've called:
> 
>     mp_csound->CompileCsdText(csd.c_str());
>     mp_csound->Start();
>     mp_csoundThread->Play();        
>     mp_csoundThread->Stop();
>     mp_csoundThread->Join();
>     mp_csound->Reset();
> 
> It returns a status of 1... Am I missing something or is that backwards? haha
> 
> Pete
> 
> On Mon, Jun 11, 2018 at 11:47 PM, Peter Burgess  wrote:
> After calling Join(), do I need to check on the status of mp_csoundThread before I call Reset()?
> 
> Where it hangs is here:
> 
> STARTING FILE
> Creating options
> Creating orchestra
> closing tag
> Creating score
> rtaudio: ALSA module enabled
> rtmidi: ALSA Raw MIDI module enabled
> displays suppressed
> 0dBFS level = 1.0
> orch now loaded
> audio buffered in 1024 sample-frame blocks
> ALSA output: total buffer size: 4096, period size: 1024
> writing 2048 sample blks of 64-bit floats to dac
> SECTION 1:
> 
> If checking the status is not the problem, I will make a minimal example tomorrow. Also I'm running Csound 6.10, I haven't gotten round to upgrading to 6.11 yet.
> 
> Cheers, Pete
> 
> On Mon, Jun 11, 2018 at 10:49 PM, Steven Yi  wrote:
> Hi Pete,
> 
> When does this hang, when you call Reset() or after calling Reset()
> and trying to compile and play a new performance?
> 
> Also, what version of Csound are you using?
> 
> One thing to also try is to call mp_csoundThread->Join() after calling
> Stop() but before calling Reset().  Usually you need to wait for the
> thread to complete before doing anything else.
> 
> If adding Join() doesn't do it, I'd suggest removing plugin libraries
> from OPCODE6DIR64 and seeing if it works; if so, then try adding back
> in libraries until it stops working.  (Sometimes opcode libraries can
> make Csound hang/crash, particularly when resetting Csound.)
> 
> Beyond that, a minimal example with both C++ and csound code would be handy.
> On Mon, Jun 11, 2018 at 2:17 PM Peter Burgess
>  wrote:
> >
> > Sadly none of these examples show that. They mostly just play a performance and stop and delete csound. I've been referencing those, the floss manual and the API docs. I'm still none the wiser as to what is wrong
> >
> > On Mon, Jun 11, 2018 at 10:11 PM, Victor Lazzarini  wrote:
> >>
> >> I’d suggest looking at the examples in this repo
> >>
> >> https://github.com/csound/csoundAPI_examples?files=1
> >>
> >> Victor Lazzarini
> >> Dean of Arts, Celtic Studies, and Philosophy
> >> Maynooth University
> >> Ireland
> >>
> >> On 11 Jun 2018, at 22:03, Peter Burgess  wrote:
> >>
> >> Hi, I'm struggling with the API. It's something I almost never fiddle with, I just get it working and don't touch it for years so I never remember exactly how to use it... Anyway, I wish to stop my performance thread, and then be able to compile a new orchestra and play again. I can compile and play my CSD fine like this:
> >>
> >> mp_csound->CompileCsdText(csd.c_str());
> >> mp_csound->Start();
> >> mp_csoundThread->Play();
> >>
> >> ...and I stop it with this:
> >>
> >> mp_csoundThread->Stop();
> >>
> >> However, I can't compile and play another csd straight after that as it says this:
> >>
> >> WARNING: system constants can only be set once
> >> Csound is already started, call csoundReset()
> >> before starting again.
> >>
> >> So as it suggests, I call
> >>
> >> mp_csoundThread->Stop();
> >> mp_csound->Reset();
> >>
> >> And now, while it appears to try to do what I want when I compile and perform again, I don't get any audio. It seems to hang. What is the correct way of doing this without reinitialising Csound and CsoundPerfThread?
> >>
> >> Pete
> >>
> >> --
> >> http://algorythmradio.com
> >> https://soundcloud.com/algorythmradio
> >> 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
> >>
> >> 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
> >
> >
> >
> >
> > --
> > http://algorythmradio.com
> > https://soundcloud.com/algorythmradio
> > 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
> 
> 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
> 
> 
> 
> -- 
> http://algorythmradio.com
> https://soundcloud.com/algorythmradio
> 
> 
> 
> -- 
> http://algorythmradio.com
> https://soundcloud.com/algorythmradio
> 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


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

Date2018-06-12 15:39
FromVictor Lazzarini
SubjectRe: [Csnd] Csound API stopping and starting
On MacOS this is installed along all the other headers in CsoundLib64.framework/Headers
========================
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 12 Jun 2018, at 15:28, Dr. Richard Boulanger  wrote:
> 
> thanks
> 
> _____________________________________________
> Dr. Richard Boulanger
> Professor of Electronic Production and Design
> Professional Writing and Music Technology Division
> Berklee College of Music
> ______________________________________________
> President of Boulanger Labs - http://boulangerlabs.com
> Author & Editor of The Csound Book - http://mitpress.mit.edu/books/csound-book
> Author & Editor of The Audio Programming Book - http://mitpress.mit.edu/books/audio-programming-book
> ______________________________________________
> about: http://www.boulangerlabs.com/#about
> about: http://www.csounds.com/community/developers/dr-richard-boulanger/
> music: http://www.csounds.com/community/developers/dr-richard-boulanger/dr-richard-boulanger-music/
> ______________________________________________
> email: rboulanger@berklee.edu
> facebook: https://www.facebook.com/richard.boulanger.58
> 
> On Tue, Jun 12, 2018 at 10:25 AM, Michael Gogins  wrote:
> It's in the Csound GitHub repository include directory. I have also
> attached the file.
> 
> Regards,
> Mike
> 
> -----------------------------------------------------
> Michael Gogins
> Irreducible Productions
> http://michaelgogins.tumblr.com
> Michael dot Gogins at gmail dot com
> On Tue, Jun 12, 2018 at 10:00 AM Dr. Richard Boulanger
>  wrote:
> >
> > I can’t locate the included .hpp file.  Any advice?  Can you attach it also?
> >
> > Sent from my iPhone
> >
> > On Jun 12, 2018, at 7:45 AM, Michael Gogins  wrote:
> >
> > Btw the file performs 3 times.
> >
> > On Tue, Jun 12, 2018, 04:36 Peter Burgess  wrote:
> >>
> >> Thank you. Is csound_threaded a new class that already combines csound and a performance thread?
> >>
> >> This file only performs once though, it doesn't then try to combine a new CSD and perform again after stopping and resetting.
> >>
> >> On Tue, 12 Jun 2018, 01:56 Michael Gogins,  wrote:
> >>>
> >>> The attached file does what you want without complications.
> >>>
> >>> Regards,
> >>> Mike
> >>>
> >>> -----------------------------------------------------
> >>> Michael Gogins
> >>> Irreducible Productions
> >>> http://michaelgogins.tumblr.com
> >>> Michael dot Gogins at gmail dot com
> >>>
> >>> On Mon, Jun 11, 2018 at 7:06 PM Peter Burgess
> >>>  wrote:
> >>> >
> >>> > Interesting if I just do this and nothing else:
> >>> >
> >>> >     mp_csound = new Csound;
> >>> >     mp_csoundThread = new CsoundPerformanceThread(mp_csound);
> >>> >
> >>> > my mp_csoundThread status starts is already 0, even though csPerfThread.hpp states:
> >>> >
> >>> >     /**
> >>> >      * Returns the current status, zero if still playing, positive if
> >>> >      * the end of score was reached or performance was stopped, and
> >>> >      * negative if an error occured.
> >>> >      */
> >>> >
> >>> > And once I've called:
> >>> >
> >>> >     mp_csound->CompileCsdText(csd.c_str());
> >>> >     mp_csound->Start();
> >>> >     mp_csoundThread->Play();
> >>> >     mp_csoundThread->Stop();
> >>> >     mp_csoundThread->Join();
> >>> >     mp_csound->Reset();
> >>> >
> >>> > It returns a status of 1... Am I missing something or is that backwards? haha
> >>> >
> >>> > Pete
> >>> >
> >>> > On Mon, Jun 11, 2018 at 11:47 PM, Peter Burgess  wrote:
> >>> >>
> >>> >> After calling Join(), do I need to check on the status of mp_csoundThread before I call Reset()?
> >>> >>
> >>> >> Where it hangs is here:
> >>> >>
> >>> >> STARTING FILE
> >>> >> Creating options
> >>> >> Creating orchestra
> >>> >> closing tag
> >>> >> Creating score
> >>> >> rtaudio: ALSA module enabled
> >>> >> rtmidi: ALSA Raw MIDI module enabled
> >>> >> displays suppressed
> >>> >> 0dBFS level = 1.0
> >>> >> orch now loaded
> >>> >> audio buffered in 1024 sample-frame blocks
> >>> >> ALSA output: total buffer size: 4096, period size: 1024
> >>> >> writing 2048 sample blks of 64-bit floats to dac
> >>> >> SECTION 1:
> >>> >>
> >>> >> If checking the status is not the problem, I will make a minimal example tomorrow. Also I'm running Csound 6.10, I haven't gotten round to upgrading to 6.11 yet.
> >>> >>
> >>> >> Cheers, Pete
> >>> >>
> >>> >> On Mon, Jun 11, 2018 at 10:49 PM, Steven Yi  wrote:
> >>> >>>
> >>> >>> Hi Pete,
> >>> >>>
> >>> >>> When does this hang, when you call Reset() or after calling Reset()
> >>> >>> and trying to compile and play a new performance?
> >>> >>>
> >>> >>> Also, what version of Csound are you using?
> >>> >>>
> >>> >>> One thing to also try is to call mp_csoundThread->Join() after calling
> >>> >>> Stop() but before calling Reset().  Usually you need to wait for the
> >>> >>> thread to complete before doing anything else.
> >>> >>>
> >>> >>> If adding Join() doesn't do it, I'd suggest removing plugin libraries
> >>> >>> from OPCODE6DIR64 and seeing if it works; if so, then try adding back
> >>> >>> in libraries until it stops working.  (Sometimes opcode libraries can
> >>> >>> make Csound hang/crash, particularly when resetting Csound.)
> >>> >>>
> >>> >>> Beyond that, a minimal example with both C++ and csound code would be handy.
> >>> >>> On Mon, Jun 11, 2018 at 2:17 PM Peter Burgess
> >>> >>>  wrote:
> >>> >>> >
> >>> >>> > Sadly none of these examples show that. They mostly just play a performance and stop and delete csound. I've been referencing those, the floss manual and the API docs. I'm still none the wiser as to what is wrong
> >>> >>> >
> >>> >>> > On Mon, Jun 11, 2018 at 10:11 PM, Victor Lazzarini  wrote:
> >>> >>> >>
> >>> >>> >> I’d suggest looking at the examples in this repo
> >>> >>> >>
> >>> >>> >> https://github.com/csound/csoundAPI_examples?files=1
> >>> >>> >>
> >>> >>> >> Victor Lazzarini
> >>> >>> >> Dean of Arts, Celtic Studies, and Philosophy
> >>> >>> >> Maynooth University
> >>> >>> >> Ireland
> >>> >>> >>
> >>> >>> >> On 11 Jun 2018, at 22:03, Peter Burgess  wrote:
> >>> >>> >>
> >>> >>> >> Hi, I'm struggling with the API. It's something I almost never fiddle with, I just get it working and don't touch it for years so I never remember exactly how to use it... Anyway, I wish to stop my performance thread, and then be able to compile a new orchestra and play again. I can compile and play my CSD fine like this:
> >>> >>> >>
> >>> >>> >> mp_csound->CompileCsdText(csd.c_str());
> >>> >>> >> mp_csound->Start();
> >>> >>> >> mp_csoundThread->Play();
> >>> >>> >>
> >>> >>> >> ...and I stop it with this:
> >>> >>> >>
> >>> >>> >> mp_csoundThread->Stop();
> >>> >>> >>
> >>> >>> >> However, I can't compile and play another csd straight after that as it says this:
> >>> >>> >>
> >>> >>> >> WARNING: system constants can only be set once
> >>> >>> >> Csound is already started, call csoundReset()
> >>> >>> >> before starting again.
> >>> >>> >>
> >>> >>> >> So as it suggests, I call
> >>> >>> >>
> >>> >>> >> mp_csoundThread->Stop();
> >>> >>> >> mp_csound->Reset();
> >>> >>> >>
> >>> >>> >> And now, while it appears to try to do what I want when I compile and perform again, I don't get any audio. It seems to hang. What is the correct way of doing this without reinitialising Csound and CsoundPerfThread?
> >>> >>> >>
> >>> >>> >> Pete
> >>> >>> >>
> >>> >>> >> --
> >>> >>> >> http://algorythmradio.com
> >>> >>> >> https://soundcloud.com/algorythmradio
> >>> >>> >> 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
> >>> >>> >>
> >>> >>> >> 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
> >>> >>> >
> >>> >>> >
> >>> >>> >
> >>> >>> >
> >>> >>> > --
> >>> >>> > http://algorythmradio.com
> >>> >>> > https://soundcloud.com/algorythmradio
> >>> >>> > 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
> >>> >>>
> >>> >>> 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
> >>> >>
> >>> >>
> >>> >>
> >>> >>
> >>> >> --
> >>> >> http://algorythmradio.com
> >>> >> https://soundcloud.com/algorythmradio
> >>> >
> >>> >
> >>> >
> >>> >
> >>> > --
> >>> > http://algorythmradio.com
> >>> > https://soundcloud.com/algorythmradio
> >>> > 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
> >>>
> >>> 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
> >>
> >> 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
> >
> > 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
> >
> > 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
> 
> 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
> 
> 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


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

Date2018-06-12 15:56
FromVictor Lazzarini
SubjectRe: [Csnd] Csound API stopping and starting
Note that you don’t necessarily need to use the heap, you can also re-create it
on the stack


std::array counter({1,2,3});
Csound csound;
for(int count : counter) {
 std::cout << "RUN #" << count << std::endl;
 CsoundPerformanceThread perf = CsoundPerformanceThread(csound.GetCsound());
 csound.CompileCsdText(csdText.c_str());
 csound.Start();
 perf.Play();
 perf.Join();
 csound.Reset();
}

========================
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 12 Jun 2018, at 15:36, Victor Lazzarini  wrote:
> 
> Here’s a program doing what you want using CsoundPerformanceThread.
> In this particular case, the perf thread object needs to be recreated for
> each performance after a Csound reset.
> 
> int main()
> {
> Csound csound;
> string csdText = R"csd(
> 
>  
> -odac -B4096 
> 
> 
> sr = 44100
> ksmps = 64    
> nchnls = 2
> 0dbfs = 1
> instr 1
> a1 oscili 1, 300, 1
> outs a1, a1
> endin
> 
> 
> f1 0 1024 10 1
> i1 0 2
> 
> 
> )csd";
> 
> int i = 3;
> CsoundPerformanceThread* perf; 
> while(i-- > 0) {
> perf = new CsoundPerformanceThread(csound.GetCsound());
> csound.CompileCsdText(csdText.c_str());
> csound.Start();
> perf->Play();
> perf->Join();
> csound.Reset();
> delete perf;
> }
> 
> return 0;
> }
> 
> 
> ========================
> 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 12 Jun 2018, at 00:06, Peter Burgess  wrote:
>> 
>> Interesting if I just do this and nothing else:
>> 
>>    mp_csound = new Csound;
>>    mp_csoundThread = new CsoundPerformanceThread(mp_csound);
>> 
>> my mp_csoundThread status starts is already 0, even though csPerfThread.hpp states:
>> 
>>    /**
>>     * Returns the current status, zero if still playing, positive if
>>     * the end of score was reached or performance was stopped, and
>>     * negative if an error occured.
>>     */
>> 
>> And once I've called:
>> 
>>    mp_csound->CompileCsdText(csd.c_str());
>>    mp_csound->Start();
>>    mp_csoundThread->Play();        
>>    mp_csoundThread->Stop();
>>    mp_csoundThread->Join();
>>    mp_csound->Reset();
>> 
>> It returns a status of 1... Am I missing something or is that backwards? haha
>> 
>> Pete
>> 
>> On Mon, Jun 11, 2018 at 11:47 PM, Peter Burgess  wrote:
>> After calling Join(), do I need to check on the status of mp_csoundThread before I call Reset()?
>> 
>> Where it hangs is here:
>> 
>> STARTING FILE
>> Creating options
>> Creating orchestra
>> closing tag
>> Creating score
>> rtaudio: ALSA module enabled
>> rtmidi: ALSA Raw MIDI module enabled
>> displays suppressed
>> 0dBFS level = 1.0
>> orch now loaded
>> audio buffered in 1024 sample-frame blocks
>> ALSA output: total buffer size: 4096, period size: 1024
>> writing 2048 sample blks of 64-bit floats to dac
>> SECTION 1:
>> 
>> If checking the status is not the problem, I will make a minimal example tomorrow. Also I'm running Csound 6.10, I haven't gotten round to upgrading to 6.11 yet.
>> 
>> Cheers, Pete
>> 
>> On Mon, Jun 11, 2018 at 10:49 PM, Steven Yi  wrote:
>> Hi Pete,
>> 
>> When does this hang, when you call Reset() or after calling Reset()
>> and trying to compile and play a new performance?
>> 
>> Also, what version of Csound are you using?
>> 
>> One thing to also try is to call mp_csoundThread->Join() after calling
>> Stop() but before calling Reset().  Usually you need to wait for the
>> thread to complete before doing anything else.
>> 
>> If adding Join() doesn't do it, I'd suggest removing plugin libraries
>> from OPCODE6DIR64 and seeing if it works; if so, then try adding back
>> in libraries until it stops working.  (Sometimes opcode libraries can
>> make Csound hang/crash, particularly when resetting Csound.)
>> 
>> Beyond that, a minimal example with both C++ and csound code would be handy.
>> On Mon, Jun 11, 2018 at 2:17 PM Peter Burgess
>>  wrote:
>>> 
>>> Sadly none of these examples show that. They mostly just play a performance and stop and delete csound. I've been referencing those, the floss manual and the API docs. I'm still none the wiser as to what is wrong
>>> 
>>> On Mon, Jun 11, 2018 at 10:11 PM, Victor Lazzarini  wrote:
>>>> 
>>>> I’d suggest looking at the examples in this repo
>>>> 
>>>> https://github.com/csound/csoundAPI_examples?files=1
>>>> 
>>>> Victor Lazzarini
>>>> Dean of Arts, Celtic Studies, and Philosophy
>>>> Maynooth University
>>>> Ireland
>>>> 
>>>> On 11 Jun 2018, at 22:03, Peter Burgess  wrote:
>>>> 
>>>> Hi, I'm struggling with the API. It's something I almost never fiddle with, I just get it working and don't touch it for years so I never remember exactly how to use it... Anyway, I wish to stop my performance thread, and then be able to compile a new orchestra and play again. I can compile and play my CSD fine like this:
>>>> 
>>>> mp_csound->CompileCsdText(csd.c_str());
>>>> mp_csound->Start();
>>>> mp_csoundThread->Play();
>>>> 
>>>> ...and I stop it with this:
>>>> 
>>>> mp_csoundThread->Stop();
>>>> 
>>>> However, I can't compile and play another csd straight after that as it says this:
>>>> 
>>>> WARNING: system constants can only be set once
>>>> Csound is already started, call csoundReset()
>>>> before starting again.
>>>> 
>>>> So as it suggests, I call
>>>> 
>>>> mp_csoundThread->Stop();
>>>> mp_csound->Reset();
>>>> 
>>>> And now, while it appears to try to do what I want when I compile and perform again, I don't get any audio. It seems to hang. What is the correct way of doing this without reinitialising Csound and CsoundPerfThread?
>>>> 
>>>> Pete
>>>> 
>>>> --
>>>> http://algorythmradio.com
>>>> https://soundcloud.com/algorythmradio
>>>> 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
>>>> 
>>>> 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
>>> 
>>> 
>>> 
>>> 
>>> --
>>> http://algorythmradio.com
>>> https://soundcloud.com/algorythmradio
>>> 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
>> 
>> 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
>> 
>> 
>> 
>> -- 
>> http://algorythmradio.com
>> https://soundcloud.com/algorythmradio
>> 
>> 
>> 
>> -- 
>> http://algorythmradio.com
>> https://soundcloud.com/algorythmradio
>> 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
> 
> 
> 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


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

Date2018-06-12 16:46
FromRichard Boulanger
SubjectRe: [Csnd] Csound API stopping and starting
Thanks

Sent from my iPad

> On Jun 12, 2018, at 10:39 AM, Victor Lazzarini  wrote:
> 
> On MacOS this is installed along all the other headers in CsoundLib64.framework/Headers
> ========================
> 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 12 Jun 2018, at 15:28, Dr. Richard Boulanger  wrote:
>> 
>> thanks
>> 
>> _____________________________________________
>> Dr. Richard Boulanger
>> Professor of Electronic Production and Design
>> Professional Writing and Music Technology Division
>> Berklee College of Music
>> ______________________________________________
>> President of Boulanger Labs - http://boulangerlabs.com
>> Author & Editor of The Csound Book - http://mitpress.mit.edu/books/csound-book
>> Author & Editor of The Audio Programming Book - http://mitpress.mit.edu/books/audio-programming-book
>> ______________________________________________
>> about: http://www.boulangerlabs.com/#about
>> about: http://www.csounds.com/community/developers/dr-richard-boulanger/
>> music: http://www.csounds.com/community/developers/dr-richard-boulanger/dr-richard-boulanger-music/
>> ______________________________________________
>> email: rboulanger@berklee.edu
>> facebook: https://www.facebook.com/richard.boulanger.58
>> 
>> On Tue, Jun 12, 2018 at 10:25 AM, Michael Gogins  wrote:
>> It's in the Csound GitHub repository include directory. I have also
>> attached the file.
>> 
>> Regards,
>> Mike
>> 
>> -----------------------------------------------------
>> Michael Gogins
>> Irreducible Productions
>> http://michaelgogins.tumblr.com
>> Michael dot Gogins at gmail dot com
>> On Tue, Jun 12, 2018 at 10:00 AM Dr. Richard Boulanger
>>  wrote:
>>> 
>>> I can’t locate the included .hpp file.  Any advice?  Can you attach it also?
>>> 
>>> Sent from my iPhone
>>> 
>>> On Jun 12, 2018, at 7:45 AM, Michael Gogins  wrote:
>>> 
>>> Btw the file performs 3 times.
>>> 
>>>> On Tue, Jun 12, 2018, 04:36 Peter Burgess  wrote:
>>>> 
>>>> Thank you. Is csound_threaded a new class that already combines csound and a performance thread?
>>>> 
>>>> This file only performs once though, it doesn't then try to combine a new CSD and perform again after stopping and resetting.
>>>> 
>>>>> On Tue, 12 Jun 2018, 01:56 Michael Gogins,  wrote:
>>>>> 
>>>>> The attached file does what you want without complications.
>>>>> 
>>>>> Regards,
>>>>> Mike
>>>>> 
>>>>> -----------------------------------------------------
>>>>> Michael Gogins
>>>>> Irreducible Productions
>>>>> http://michaelgogins.tumblr.com
>>>>> Michael dot Gogins at gmail dot com
>>>>> 
>>>>> On Mon, Jun 11, 2018 at 7:06 PM Peter Burgess
>>>>>  wrote:
>>>>>> 
>>>>>> Interesting if I just do this and nothing else:
>>>>>> 
>>>>>>    mp_csound = new Csound;
>>>>>>    mp_csoundThread = new CsoundPerformanceThread(mp_csound);
>>>>>> 
>>>>>> my mp_csoundThread status starts is already 0, even though csPerfThread.hpp states:
>>>>>> 
>>>>>>    /**
>>>>>>     * Returns the current status, zero if still playing, positive if
>>>>>>     * the end of score was reached or performance was stopped, and
>>>>>>     * negative if an error occured.
>>>>>>     */
>>>>>> 
>>>>>> And once I've called:
>>>>>> 
>>>>>>    mp_csound->CompileCsdText(csd.c_str());
>>>>>>    mp_csound->Start();
>>>>>>    mp_csoundThread->Play();
>>>>>>    mp_csoundThread->Stop();
>>>>>>    mp_csoundThread->Join();
>>>>>>    mp_csound->Reset();
>>>>>> 
>>>>>> It returns a status of 1... Am I missing something or is that backwards? haha
>>>>>> 
>>>>>> Pete
>>>>>> 
>>>>>>> On Mon, Jun 11, 2018 at 11:47 PM, Peter Burgess  wrote:
>>>>>>> 
>>>>>>> After calling Join(), do I need to check on the status of mp_csoundThread before I call Reset()?
>>>>>>> 
>>>>>>> Where it hangs is here:
>>>>>>> 
>>>>>>> STARTING FILE
>>>>>>> Creating options
>>>>>>> Creating orchestra
>>>>>>> closing tag
>>>>>>> Creating score
>>>>>>> rtaudio: ALSA module enabled
>>>>>>> rtmidi: ALSA Raw MIDI module enabled
>>>>>>> displays suppressed
>>>>>>> 0dBFS level = 1.0
>>>>>>> orch now loaded
>>>>>>> audio buffered in 1024 sample-frame blocks
>>>>>>> ALSA output: total buffer size: 4096, period size: 1024
>>>>>>> writing 2048 sample blks of 64-bit floats to dac
>>>>>>> SECTION 1:
>>>>>>> 
>>>>>>> If checking the status is not the problem, I will make a minimal example tomorrow. Also I'm running Csound 6.10, I haven't gotten round to upgrading to 6.11 yet.
>>>>>>> 
>>>>>>> Cheers, Pete
>>>>>>> 
>>>>>>>> On Mon, Jun 11, 2018 at 10:49 PM, Steven Yi  wrote:
>>>>>>>> 
>>>>>>>> Hi Pete,
>>>>>>>> 
>>>>>>>> When does this hang, when you call Reset() or after calling Reset()
>>>>>>>> and trying to compile and play a new performance?
>>>>>>>> 
>>>>>>>> Also, what version of Csound are you using?
>>>>>>>> 
>>>>>>>> One thing to also try is to call mp_csoundThread->Join() after calling
>>>>>>>> Stop() but before calling Reset().  Usually you need to wait for the
>>>>>>>> thread to complete before doing anything else.
>>>>>>>> 
>>>>>>>> If adding Join() doesn't do it, I'd suggest removing plugin libraries
>>>>>>>> from OPCODE6DIR64 and seeing if it works; if so, then try adding back
>>>>>>>> in libraries until it stops working.  (Sometimes opcode libraries can
>>>>>>>> make Csound hang/crash, particularly when resetting Csound.)
>>>>>>>> 
>>>>>>>> Beyond that, a minimal example with both C++ and csound code would be handy.
>>>>>>>> On Mon, Jun 11, 2018 at 2:17 PM Peter Burgess
>>>>>>>>  wrote:
>>>>>>>>> 
>>>>>>>>> Sadly none of these examples show that. They mostly just play a performance and stop and delete csound. I've been referencing those, the floss manual and the API docs. I'm still none the wiser as to what is wrong
>>>>>>>>> 
>>>>>>>>>> On Mon, Jun 11, 2018 at 10:11 PM, Victor Lazzarini  wrote:
>>>>>>>>>> 
>>>>>>>>>> I’d suggest looking at the examples in this repo
>>>>>>>>>> 
>>>>>>>>>> https://github.com/csound/csoundAPI_examples?files=1
>>>>>>>>>> 
>>>>>>>>>> Victor Lazzarini
>>>>>>>>>> Dean of Arts, Celtic Studies, and Philosophy
>>>>>>>>>> Maynooth University
>>>>>>>>>> Ireland
>>>>>>>>>> 
>>>>>>>>>> On 11 Jun 2018, at 22:03, Peter Burgess  wrote:
>>>>>>>>>> 
>>>>>>>>>> Hi, I'm struggling with the API. It's something I almost never fiddle with, I just get it working and don't touch it for years so I never remember exactly how to use it... Anyway, I wish to stop my performance thread, and then be able to compile a new orchestra and play again. I can compile and play my CSD fine like this:
>>>>>>>>>> 
>>>>>>>>>> mp_csound->CompileCsdText(csd.c_str());
>>>>>>>>>> mp_csound->Start();
>>>>>>>>>> mp_csoundThread->Play();
>>>>>>>>>> 
>>>>>>>>>> ...and I stop it with this:
>>>>>>>>>> 
>>>>>>>>>> mp_csoundThread->Stop();
>>>>>>>>>> 
>>>>>>>>>> However, I can't compile and play another csd straight after that as it says this:
>>>>>>>>>> 
>>>>>>>>>> WARNING: system constants can only be set once
>>>>>>>>>> Csound is already started, call csoundReset()
>>>>>>>>>> before starting again.
>>>>>>>>>> 
>>>>>>>>>> So as it suggests, I call
>>>>>>>>>> 
>>>>>>>>>> mp_csoundThread->Stop();
>>>>>>>>>> mp_csound->Reset();
>>>>>>>>>> 
>>>>>>>>>> And now, while it appears to try to do what I want when I compile and perform again, I don't get any audio. It seems to hang. What is the correct way of doing this without reinitialising Csound and CsoundPerfThread?
>>>>>>>>>> 
>>>>>>>>>> Pete
>>>>>>>>>> 
>>>>>>>>>> --
>>>>>>>>>> http://algorythmradio.com
>>>>>>>>>> https://soundcloud.com/algorythmradio
>>>>>>>>>> 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
>>>>>>>>>> 
>>>>>>>>>> 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
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> --
>>>>>>>>> http://algorythmradio.com
>>>>>>>>> https://soundcloud.com/algorythmradio
>>>>>>>>> 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
>>>>>>>> 
>>>>>>>> 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
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> --
>>>>>>> http://algorythmradio.com
>>>>>>> https://soundcloud.com/algorythmradio
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> --
>>>>>> http://algorythmradio.com
>>>>>> https://soundcloud.com/algorythmradio
>>>>>> 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
>>>>> 
>>>>> 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
>>>> 
>>>> 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
>>> 
>>> 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
>>> 
>>> 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
>> 
>> 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
>> 
>> 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
> 
> 
> 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

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

Date2018-06-12 19:15
FromPeter Burgess
SubjectRe: [Csnd] Csound API stopping and starting
Hi there, I gave CsoundThreaded a go, perfect! :D Thanks for that. It's missing the TogglePause control, but if it hasn't already been added in Csound 6.11, I might try and add that myself.

Cheers for your help guys!

On Tue, 12 Jun 2018, 16:47 Richard Boulanger, <rboulanger@berklee.edu> wrote:
Thanks

Sent from my iPad

> On Jun 12, 2018, at 10:39 AM, Victor Lazzarini <Victor.Lazzarini@MU.IE> wrote:
>
> On MacOS this is installed along all the other headers in CsoundLib64.framework/Headers
> ========================
> 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 12 Jun 2018, at 15:28, Dr. Richard Boulanger <rboulanger@BERKLEE.EDU> wrote:
>>
>> thanks
>>
>> _____________________________________________
>> Dr. Richard Boulanger
>> Professor of Electronic Production and Design
>> Professional Writing and Music Technology Division
>> Berklee College of Music
>> ______________________________________________
>> President of Boulanger Labs - http://boulangerlabs.com
>> Author & Editor of The Csound Book - http://mitpress.mit.edu/books/csound-book
>> Author & Editor of The Audio Programming Book - http://mitpress.mit.edu/books/audio-programming-book
>> ______________________________________________
>> about: http://www.boulangerlabs.com/#about
>> about: http://www.csounds.com/community/developers/dr-richard-boulanger/
>> music: http://www.csounds.com/community/developers/dr-richard-boulanger/dr-richard-boulanger-music/
>> ______________________________________________
>> email: rboulanger@berklee.edu
>> facebook: https://www.facebook.com/richard.boulanger.58
>>
>> On Tue, Jun 12, 2018 at 10:25 AM, Michael Gogins <michael.gogins@gmail.com> wrote:
>> It's in the Csound GitHub repository include directory. I have also
>> attached the file.
>>
>> Regards,
>> Mike
>>
>> -----------------------------------------------------
>> Michael Gogins
>> Irreducible Productions
>> http://michaelgogins.tumblr.com
>> Michael dot Gogins at gmail dot com
>> On Tue, Jun 12, 2018 at 10:00 AM Dr. Richard Boulanger
>> <rboulanger@berklee.edu> wrote:
>>>
>>> I can’t locate the included .hpp file.  Any advice?  Can you attach it also?
>>>
>>> Sent from my iPhone
>>>
>>> On Jun 12, 2018, at 7:45 AM, Michael Gogins <michael.gogins@GMAIL.COM> wrote:
>>>
>>> Btw the file performs 3 times.
>>>
>>>> On Tue, Jun 12, 2018, 04:36 Peter Burgess <pete.soundtechnician@gmail.com> wrote:
>>>>
>>>> Thank you. Is csound_threaded a new class that already combines csound and a performance thread?
>>>>
>>>> This file only performs once though, it doesn't then try to combine a new CSD and perform again after stopping and resetting.
>>>>
>>>>> On Tue, 12 Jun 2018, 01:56 Michael Gogins, <michael.gogins@gmail.com> wrote:
>>>>>
>>>>> The attached file does what you want without complications.
>>>>>
>>>>> Regards,
>>>>> Mike
>>>>>
>>>>> -----------------------------------------------------
>>>>> Michael Gogins
>>>>> Irreducible Productions
>>>>> http://michaelgogins.tumblr.com
>>>>> Michael dot Gogins at gmail dot com
>>>>>
>>>>> On Mon, Jun 11, 2018 at 7:06 PM Peter Burgess
>>>>> <pete.soundtechnician@gmail.com> wrote:
>>>>>>
>>>>>> Interesting if I just do this and nothing else:
>>>>>>
>>>>>>    mp_csound = new Csound;
>>>>>>    mp_csoundThread = new CsoundPerformanceThread(mp_csound);
>>>>>>
>>>>>> my mp_csoundThread status starts is already 0, even though csPerfThread.hpp states:
>>>>>>
>>>>>>    /**
>>>>>>     * Returns the current status, zero if still playing, positive if
>>>>>>     * the end of score was reached or performance was stopped, and
>>>>>>     * negative if an error occured.
>>>>>>     */
>>>>>>
>>>>>> And once I've called:
>>>>>>
>>>>>>    mp_csound->CompileCsdText(csd.c_str());
>>>>>>    mp_csound->Start();
>>>>>>    mp_csoundThread->Play();
>>>>>>    mp_csoundThread->Stop();
>>>>>>    mp_csoundThread->Join();
>>>>>>    mp_csound->Reset();
>>>>>>
>>>>>> It returns a status of 1... Am I missing something or is that backwards? haha
>>>>>>
>>>>>> Pete
>>>>>>
>>>>>>> On Mon, Jun 11, 2018 at 11:47 PM, Peter Burgess <pete.soundtechnician@gmail.com> wrote:
>>>>>>>
>>>>>>> After calling Join(), do I need to check on the status of mp_csoundThread before I call Reset()?
>>>>>>>
>>>>>>> Where it hangs is here:
>>>>>>>
>>>>>>> STARTING FILE
>>>>>>> Creating options
>>>>>>> Creating orchestra
>>>>>>> closing tag
>>>>>>> Creating score
>>>>>>> rtaudio: ALSA module enabled
>>>>>>> rtmidi: ALSA Raw MIDI module enabled
>>>>>>> displays suppressed
>>>>>>> 0dBFS level = 1.0
>>>>>>> orch now loaded
>>>>>>> audio buffered in 1024 sample-frame blocks
>>>>>>> ALSA output: total buffer size: 4096, period size: 1024
>>>>>>> writing 2048 sample blks of 64-bit floats to dac
>>>>>>> SECTION 1:
>>>>>>>
>>>>>>> If checking the status is not the problem, I will make a minimal example tomorrow. Also I'm running Csound 6.10, I haven't gotten round to upgrading to 6.11 yet.
>>>>>>>
>>>>>>> Cheers, Pete
>>>>>>>
>>>>>>>> On Mon, Jun 11, 2018 at 10:49 PM, Steven Yi <stevenyi@gmail.com> wrote:
>>>>>>>>
>>>>>>>> Hi Pete,
>>>>>>>>
>>>>>>>> When does this hang, when you call Reset() or after calling Reset()
>>>>>>>> and trying to compile and play a new performance?
>>>>>>>>
>>>>>>>> Also, what version of Csound are you using?
>>>>>>>>
>>>>>>>> One thing to also try is to call mp_csoundThread->Join() after calling
>>>>>>>> Stop() but before calling Reset().  Usually you need to wait for the
>>>>>>>> thread to complete before doing anything else.
>>>>>>>>
>>>>>>>> If adding Join() doesn't do it, I'd suggest removing plugin libraries
>>>>>>>> from OPCODE6DIR64 and seeing if it works; if so, then try adding back
>>>>>>>> in libraries until it stops working.  (Sometimes opcode libraries can
>>>>>>>> make Csound hang/crash, particularly when resetting Csound.)
>>>>>>>>
>>>>>>>> Beyond that, a minimal example with both C++ and csound code would be handy.
>>>>>>>> On Mon, Jun 11, 2018 at 2:17 PM Peter Burgess
>>>>>>>> <pete.soundtechnician@gmail.com> wrote:
>>>>>>>>>
>>>>>>>>> Sadly none of these examples show that. They mostly just play a performance and stop and delete csound. I've been referencing those, the floss manual and the API docs. I'm still none the wiser as to what is wrong
>>>>>>>>>
>>>>>>>>>> On Mon, Jun 11, 2018 at 10:11 PM, Victor Lazzarini <Victor.Lazzarini@mu.ie> wrote:
>>>>>>>>>>
>>>>>>>>>> I’d suggest looking at the examples in this repo
>>>>>>>>>>
>>>>>>>>>> https://github.com/csound/csoundAPI_examples?files=1
>>>>>>>>>>
>>>>>>>>>> Victor Lazzarini
>>>>>>>>>> Dean of Arts, Celtic Studies, and Philosophy
>>>>>>>>>> Maynooth University
>>>>>>>>>> Ireland
>>>>>>>>>>
>>>>>>>>>> On 11 Jun 2018, at 22:03, Peter Burgess <pete.soundtechnician@GMAIL.COM> wrote:
>>>>>>>>>>
>>>>>>>>>> Hi, I'm struggling with the API. It's something I almost never fiddle with, I just get it working and don't touch it for years so I never remember exactly how to use it... Anyway, I wish to stop my performance thread, and then be able to compile a new orchestra and play again. I can compile and play my CSD fine like this:
>>>>>>>>>>
>>>>>>>>>> mp_csound->CompileCsdText(csd.c_str());
>>>>>>>>>> mp_csound->Start();
>>>>>>>>>> mp_csoundThread->Play();
>>>>>>>>>>
>>>>>>>>>> ...and I stop it with this:
>>>>>>>>>>
>>>>>>>>>> mp_csoundThread->Stop();
>>>>>>>>>>
>>>>>>>>>> However, I can't compile and play another csd straight after that as it says this:
>>>>>>>>>>
>>>>>>>>>> WARNING: system constants can only be set once
>>>>>>>>>> Csound is already started, call csoundReset()
>>>>>>>>>> before starting again.
>>>>>>>>>>
>>>>>>>>>> So as it suggests, I call
>>>>>>>>>>
>>>>>>>>>> mp_csoundThread->Stop();
>>>>>>>>>> mp_csound->Reset();
>>>>>>>>>>
>>>>>>>>>> And now, while it appears to try to do what I want when I compile and perform again, I don't get any audio. It seems to hang. What is the correct way of doing this without reinitialising Csound and CsoundPerfThread?
>>>>>>>>>>
>>>>>>>>>> Pete
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> http://algorythmradio.com
>>>>>>>>>> https://soundcloud.com/algorythmradio
>>>>>>>>>> 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
>>>>>>>>>>
>>>>>>>>>> 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
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> http://algorythmradio.com
>>>>>>>>> https://soundcloud.com/algorythmradio
>>>>>>>>> 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
>>>>>>>>
>>>>>>>> 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
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> http://algorythmradio.com
>>>>>>> https://soundcloud.com/algorythmradio
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> http://algorythmradio.com
>>>>>> https://soundcloud.com/algorythmradio
>>>>>> 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
>>>>>
>>>>> 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
>>>>
>>>> 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
>>>
>>> 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
>>>
>>> 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
>>
>> 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
>>
>> 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
>
>
> 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

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
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