[Csnd] Csound API stopping and starting

classic Classic list List threaded Threaded
19 messages Options
Reply | Threaded
Open this post in threaded view
|

[Csnd] Csound API stopping and starting

iron_attorney
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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Csound API stopping and starting

Victor Lazzarini-2
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 <[hidden email]> 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 [hidden email] 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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Csound API stopping and starting

iron_attorney
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 <[hidden email]> 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 <[hidden email]> 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 [hidden email] 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 [hidden email] 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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Csound API stopping and starting

Steven Yi
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
<[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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 [hidden email] 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 [hidden email] 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 [hidden email] 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
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Csound API stopping and starting

iron_attorney
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 <[hidden email]> 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
<[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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 [hidden email] 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 [hidden email] 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 [hidden email] 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
[hidden email]
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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Csound API stopping and starting

iron_attorney
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 <[hidden email]> 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 <[hidden email]> 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
<[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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 [hidden email] 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 [hidden email] 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 [hidden email] 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
[hidden email]
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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Csound API stopping and starting

Michael Gogins-2
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
<[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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
>>> <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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 [hidden email] 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 [hidden email] 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 [hidden email] 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
>>> [hidden email]
>>> 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 [hidden email] 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
[hidden email]
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_threaded.cpp (13K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Csound API stopping and starting

iron_attorney
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, <[hidden email]> 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
<[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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
>>> <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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 [hidden email] 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 [hidden email] 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 [hidden email] 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
>>> [hidden email]
>>> 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 [hidden email] 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
[hidden email]
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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Csound API stopping and starting

Michael Gogins-2
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 <[hidden email]> 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, <[hidden email]> 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
<[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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
>>> <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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 [hidden email] 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 [hidden email] 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 [hidden email] 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
>>> [hidden email]
>>> 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 [hidden email] 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
[hidden email]
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 [hidden email] 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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Csound API stopping and starting

Michael Gogins-2
In reply to this post by iron_attorney
Btw the file performs 3 times. 

On Tue, Jun 12, 2018, 04:36 Peter Burgess <[hidden email]> 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, <[hidden email]> 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
<[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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
>>> <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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 [hidden email] 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 [hidden email] 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 [hidden email] 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
>>> [hidden email]
>>> 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 [hidden email] 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
[hidden email]
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 [hidden email] 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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Csound API stopping and starting

Doctor B
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 <[hidden email]> wrote:

Btw the file performs 3 times. 

On Tue, Jun 12, 2018, 04:36 Peter Burgess <[hidden email]> 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, <[hidden email]> 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
<[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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
>>> <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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 [hidden email] 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 [hidden email] 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 [hidden email] 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
>>> [hidden email]
>>> 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 [hidden email] 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
[hidden email]
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 [hidden email] 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 [hidden email] 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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Csound API stopping and starting

Michael Gogins-2
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
<[hidden email]> 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 <[hidden email]> wrote:
>
> Btw the file performs 3 times.
>
> On Tue, Jun 12, 2018, 04:36 Peter Burgess <[hidden email]> 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, <[hidden email]> 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
>>> <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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
>>> >>> <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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 [hidden email] 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 [hidden email] 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 [hidden email] 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
>>> >>> [hidden email]
>>> >>> 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 [hidden email] 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
>>> [hidden email]
>>> 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 [hidden email] 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 [hidden email] 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 [hidden email] 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
[hidden email]
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_threaded.hpp (14K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Csound API stopping and starting

iron_attorney
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, <[hidden email]> 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
<[hidden email]> 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 <[hidden email]> wrote:
>
> Btw the file performs 3 times.
>
> On Tue, Jun 12, 2018, 04:36 Peter Burgess <[hidden email]> 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, <[hidden email]> 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
>>> <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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
>>> >>> <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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 [hidden email] 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 [hidden email] 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 [hidden email] 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
>>> >>> [hidden email]
>>> >>> 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 [hidden email] 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
>>> [hidden email]
>>> 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 [hidden email] 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 [hidden email] 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 [hidden email] 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
[hidden email]
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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Csound API stopping and starting

Doctor B
In reply to this post by Michael Gogins-2
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: [hidden email]
facebook: https://www.facebook.com/richard.boulanger.58

On Tue, Jun 12, 2018 at 10:25 AM, Michael Gogins <[hidden email]> 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
<[hidden email]> 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 <[hidden email]> wrote:
>
> Btw the file performs 3 times.
>
> On Tue, Jun 12, 2018, 04:36 Peter Burgess <[hidden email]> 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, <[hidden email]> 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
>>> <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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
>>> >>> <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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 [hidden email] 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 [hidden email] 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 [hidden email] 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
>>> >>> [hidden email]
>>> >>> 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 [hidden email] 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
>>> [hidden email]
>>> 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 [hidden email] 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 [hidden email] 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 [hidden email] 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
[hidden email]
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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Csound API stopping and starting

Victor Lazzarini-2
In reply to this post by iron_attorney
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(
<CsoundSynthesizer>
<CsOptions>
-odac -B4096
</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 64    
nchnls = 2
0dbfs = 1
instr 1
a1 oscili 1, 300, 1
outs a1, a1
endin
</CsInstruments>
<CsScore>
f1 0 1024 10 1
i1 0 2
</CsScore>
</CsoundSynthesizer>
)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 <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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
> <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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 [hidden email] 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 [hidden email] 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 [hidden email] 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
> [hidden email]
> 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 [hidden email] 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
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Csound API stopping and starting

Victor Lazzarini-2
In reply to this post by Doctor B
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 <[hidden email]> 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: [hidden email]
> facebook: https://www.facebook.com/richard.boulanger.58
>
> On Tue, Jun 12, 2018 at 10:25 AM, Michael Gogins <[hidden email]> 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
> <[hidden email]> 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 <[hidden email]> wrote:
> >
> > Btw the file performs 3 times.
> >
> > On Tue, Jun 12, 2018, 04:36 Peter Burgess <[hidden email]> 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, <[hidden email]> 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
> >>> <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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
> >>> >>> <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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 [hidden email] 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 [hidden email] 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 [hidden email] 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
> >>> >>> [hidden email]
> >>> >>> 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 [hidden email] 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
> >>> [hidden email]
> >>> 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 [hidden email] 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 [hidden email] 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 [hidden email] 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
> [hidden email]
> 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 [hidden email] 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
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Csound API stopping and starting

Victor Lazzarini-2
In reply to this post by Victor Lazzarini-2
Note that you don’t necessarily need to use the heap, you can also re-create it
on the stack


std::array<int, 3> 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 <[hidden email]> 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(
> <CsoundSynthesizer>
> <CsOptions>
> -odac -B4096
> </CsOptions>
> <CsInstruments>
> sr = 44100
> ksmps = 64    
> nchnls = 2
> 0dbfs = 1
> instr 1
> a1 oscili 1, 300, 1
> outs a1, a1
> endin
> </CsInstruments>
> <CsScore>
> f1 0 1024 10 1
> i1 0 2
> </CsScore>
> </CsoundSynthesizer>
> )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 <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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
>> <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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 [hidden email] 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 [hidden email] 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 [hidden email] 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
>> [hidden email]
>> 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 [hidden email] 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
> [hidden email]
> 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
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Csound API stopping and starting

Doctor B
In reply to this post by Victor Lazzarini-2
Thanks

Sent from my iPad

> On Jun 12, 2018, at 10:39 AM, Victor Lazzarini <[hidden email]> 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 <[hidden email]> 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: [hidden email]
>> facebook: https://www.facebook.com/richard.boulanger.58
>>
>> On Tue, Jun 12, 2018 at 10:25 AM, Michael Gogins <[hidden email]> 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
>> <[hidden email]> 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 <[hidden email]> wrote:
>>>
>>> Btw the file performs 3 times.
>>>
>>>> On Tue, Jun 12, 2018, 04:36 Peter Burgess <[hidden email]> 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, <[hidden email]> 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
>>>>> <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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
>>>>>>>> <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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 [hidden email] 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 [hidden email] 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 [hidden email] 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
>>>>>>>> [hidden email]
>>>>>>>> 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 [hidden email] 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
>>>>> [hidden email]
>>>>> 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 [hidden email] 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 [hidden email] 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 [hidden email] 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
>> [hidden email]
>> 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 [hidden email] 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
> [hidden email]
> 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
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Csound API stopping and starting

iron_attorney
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, <[hidden email]> wrote:
Thanks

Sent from my iPad

> On Jun 12, 2018, at 10:39 AM, Victor Lazzarini <[hidden email]> 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 <[hidden email]> 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: [hidden email]
>> facebook: https://www.facebook.com/richard.boulanger.58
>>
>> On Tue, Jun 12, 2018 at 10:25 AM, Michael Gogins <[hidden email]> 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
>> <[hidden email]> 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 <[hidden email]> wrote:
>>>
>>> Btw the file performs 3 times.
>>>
>>>> On Tue, Jun 12, 2018, 04:36 Peter Burgess <[hidden email]> 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, <[hidden email]> 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
>>>>> <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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
>>>>>>>> <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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 [hidden email] 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 [hidden email] 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 [hidden email] 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
>>>>>>>> [hidden email]
>>>>>>>> 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 [hidden email] 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
>>>>> [hidden email]
>>>>> 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 [hidden email] 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 [hidden email] 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 [hidden email] 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
>> [hidden email]
>> 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 [hidden email] 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
> [hidden email]
> 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
[hidden email]
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 [hidden email] 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