Csound Csound-dev Csound-tekno Search About

[Csnd] csoundandroid through c++ and android NDK

Date2014-03-21 16:03
FromTarmo Johannes
Subject[Csnd] csoundandroid through c++ and android NDK

Hi,

 

I am investing how it is possible to use csound through Qt and C++ on android (Qt 5.2 has good support for android and also experimental for iOs!)

 

Everything has gone well and and looks right - but I get no Csound performance.

 

The piece of the code that I used for testing :

 

Csound testCs;

qDebug()<<"CsoundVersion: "<<testCs.GetVersion();

 

 

testCs.SetOption("-odac");

testCs.SetOption("-d");

testCs.Compile(R"(

sr = 44100

nchnls = 2

0dbfs = 1

ksmps = 32

 

instr test

prints "INSTR TEST"

endin)");

 

testCs.ReadScore("i 1 0 1");

testCs.Start();

qDebug()<<"Csound pointer: "<<testCs.GetCsound();

testCs.Perform();

testCs.Stop();

 

The Csound version and pointer get reported correctly to console, so the library should work and csound should be operational.

 

The only line that does nothing is testCs.Perform() - I get no message about Csound performance, nor error message.

 

Looking what is inside libcsoundandroid

$nm -D libcsoundandroid.so

 

seems to me that there is no method Perform().

 

Can it be? What should I do or how to test?

 

The app works on desktop well.

 

When I get it working, I will report what I did to get it work. Qt+Csound+Android/iOs - if it succeeds, I will be very excited!!!

 

thanks!

tarmo

 

 

 

 


Date2014-03-21 23:06
FromSteven Yi
SubjectRe: [Csnd] csoundandroid through c++ and android NDK
Hi Tarmo,

With Android we use a sub-class of Csound called AndroidCsound. You
can find the code in the CsoundAndroid/jni folder as AndroidCsound.hpp
and AndroidCsound.cpp.  The one thing that is relevant I think is to
use that and call the setOpenSLCallbacks() method.

If you look at the CsoundObj.java Java class, you'll find that we call
that method (using the SWIG-generated wrapper to the C++ class).  We
call that first before Compile.

I'd try modifying the code to use:

AndroidCsound testCs;

and call

testCs.setOpenSLCallbacks();

before doing

testCs.Compile(...)

Hope that helps!
steven

On Fri, Mar 21, 2014 at 12:03 PM, Tarmo Johannes
 wrote:
> Hi,
>
>
>
> I am investing how it is possible to use csound through Qt and C++ on
> android (Qt 5.2 has good support for android and also experimental for iOs!)
>
>
>
> Everything has gone well and and looks right - but I get no Csound
> performance.
>
>
>
> The piece of the code that I used for testing :
>
>
>
> Csound testCs;
>
> qDebug()<<"CsoundVersion: "<
>
>
>
>
> testCs.SetOption("-odac");
>
> testCs.SetOption("-d");
>
> testCs.Compile(R"(
>
> sr = 44100
>
> nchnls = 2
>
> 0dbfs = 1
>
> ksmps = 32
>
>
>
> instr test
>
> prints "INSTR TEST"
>
> endin)");
>
>
>
> testCs.ReadScore("i 1 0 1");
>
> testCs.Start();
>
> qDebug()<<"Csound pointer: "<
> testCs.Perform();
>
> testCs.Stop();
>
>
>
> The Csound version and pointer get reported correctly to console, so the
> library should work and csound should be operational.
>
>
>
> The only line that does nothing is testCs.Perform() - I get no message about
> Csound performance, nor error message.
>
>
>
> Looking what is inside libcsoundandroid
>
> $nm -D libcsoundandroid.so
>
>
>
> seems to me that there is no method Perform().
>
>
>
> Can it be? What should I do or how to test?
>
>
>
> The app works on desktop well.
>
>
>
> When I get it working, I will report what I did to get it work.
> Qt+Csound+Android/iOs - if it succeeds, I will be very excited!!!
>
>
>
> thanks!
>
> tarmo
>
>
>
>
>
>
>
>


Send bugs reports to the Sourceforge bug trackers
csound6:
            https://sourceforge.net/p/csound/tickets/
csound5:
            https://sourceforge.net/p/csound/bugs/
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"


Date2014-03-22 08:10
FromTarmo Johannes
SubjectRe: [Csnd] csoundandroid through c++ and android NDK

Thanks,
I will give a try later today.
Tarmo.

2014 3 22 01:07 kirjutas kuupäeval "Steven Yi" <stevenyi@gmail.com>:
Hi Tarmo,

With Android we use a sub-class of Csound called AndroidCsound. You
can find the code in the CsoundAndroid/jni folder as AndroidCsound.hpp
and AndroidCsound.cpp.  The one thing that is relevant I think is to
use that and call the setOpenSLCallbacks() method.

If you look at the CsoundObj.java Java class, you'll find that we call
that method (using the SWIG-generated wrapper to the C++ class).  We
call that first before Compile.

I'd try modifying the code to use:

AndroidCsound testCs;

and call

testCs.setOpenSLCallbacks();

before doing

testCs.Compile(...)

Hope that helps!
steven

On Fri, Mar 21, 2014 at 12:03 PM, Tarmo Johannes
<tarmo.johannes@otsakool.edu.ee> wrote:
> Hi,
>
>
>
> I am investing how it is possible to use csound through Qt and C++ on
> android (Qt 5.2 has good support for android and also experimental for iOs!)
>
>
>
> Everything has gone well and and looks right - but I get no Csound
> performance.
>
>
>
> The piece of the code that I used for testing :
>
>
>
> Csound testCs;
>
> qDebug()<<"CsoundVersion: "<<testCs.GetVersion();
>
>
>
>
>
> testCs.SetOption("-odac");
>
> testCs.SetOption("-d");
>
> testCs.Compile(R"(
>
> sr = 44100
>
> nchnls = 2
>
> 0dbfs = 1
>
> ksmps = 32
>
>
>
> instr test
>
> prints "INSTR TEST"
>
> endin)");
>
>
>
> testCs.ReadScore("i 1 0 1");
>
> testCs.Start();
>
> qDebug()<<"Csound pointer: "<<testCs.GetCsound();
>
> testCs.Perform();
>
> testCs.Stop();
>
>
>
> The Csound version and pointer get reported correctly to console, so the
> library should work and csound should be operational.
>
>
>
> The only line that does nothing is testCs.Perform() - I get no message about
> Csound performance, nor error message.
>
>
>
> Looking what is inside libcsoundandroid
>
> $nm -D libcsoundandroid.so
>
>
>
> seems to me that there is no method Perform().
>
>
>
> Can it be? What should I do or how to test?
>
>
>
> The app works on desktop well.
>
>
>
> When I get it working, I will report what I did to get it work.
> Qt+Csound+Android/iOs - if it succeeds, I will be very excited!!!
>
>
>
> thanks!
>
> tarmo
>
>
>
>
>
>
>
>


Send bugs reports to the Sourceforge bug trackers
csound6:
            https://sourceforge.net/p/csound/tickets/
csound5:
            https://sourceforge.net/p/csound/bugs/
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"



Date2014-03-22 11:56
FromTarmo Johannes
SubjectRe: [Csnd] csoundandroid through c++ and android NDK

Thanks, Steven!
That was it!
My qt/c++/qml/csound app for android works!
I will post soon more about how to do it.
Tarmo

2014 3 22 10:10 kirjutas kuupäeval "Tarmo Johannes" <tarmo.johannes@otsakool.edu.ee>:

Thanks,
I will give a try later today.
Tarmo.

2014 3 22 01:07 kirjutas kuupäeval "Steven Yi" <stevenyi@gmail.com>:
Hi Tarmo,

With Android we use a sub-class of Csound called AndroidCsound. You
can find the code in the CsoundAndroid/jni folder as AndroidCsound.hpp
and AndroidCsound.cpp.  The one thing that is relevant I think is to
use that and call the setOpenSLCallbacks() method.

If you look at the CsoundObj.java Java class, you'll find that we call
that method (using the SWIG-generated wrapper to the C++ class).  We
call that first before Compile.

I'd try modifying the code to use:

AndroidCsound testCs;

and call

testCs.setOpenSLCallbacks();

before doing

testCs.Compile(...)

Hope that helps!
steven

On Fri, Mar 21, 2014 at 12:03 PM, Tarmo Johannes
<tarmo.johannes@otsakool.edu.ee> wrote:
> Hi,
>
>
>
> I am investing how it is possible to use csound through Qt and C++ on
> android (Qt 5.2 has good support for android and also experimental for iOs!)
>
>
>
> Everything has gone well and and looks right - but I get no Csound
> performance.
>
>
>
> The piece of the code that I used for testing :
>
>
>
> Csound testCs;
>
> qDebug()<<"CsoundVersion: "<<testCs.GetVersion();
>
>
>
>
>
> testCs.SetOption("-odac");
>
> testCs.SetOption("-d");
>
> testCs.Compile(R"(
>
> sr = 44100
>
> nchnls = 2
>
> 0dbfs = 1
>
> ksmps = 32
>
>
>
> instr test
>
> prints "INSTR TEST"
>
> endin)");
>
>
>
> testCs.ReadScore("i 1 0 1");
>
> testCs.Start();
>
> qDebug()<<"Csound pointer: "<<testCs.GetCsound();
>
> testCs.Perform();
>
> testCs.Stop();
>
>
>
> The Csound version and pointer get reported correctly to console, so the
> library should work and csound should be operational.
>
>
>
> The only line that does nothing is testCs.Perform() - I get no message about
> Csound performance, nor error message.
>
>
>
> Looking what is inside libcsoundandroid
>
> $nm -D libcsoundandroid.so
>
>
>
> seems to me that there is no method Perform().
>
>
>
> Can it be? What should I do or how to test?
>
>
>
> The app works on desktop well.
>
>
>
> When I get it working, I will report what I did to get it work.
> Qt+Csound+Android/iOs - if it succeeds, I will be very excited!!!
>
>
>
> thanks!
>
> tarmo
>
>
>
>
>
>
>
>


Send bugs reports to the Sourceforge bug trackers
csound6:
            https://sourceforge.net/p/csound/tickets/
csound5:
            https://sourceforge.net/p/csound/bugs/
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"



Date2014-03-22 13:57
FromSteven Yi
SubjectRe: [Csnd] csoundandroid through c++ and android NDK
Fantastic! Looking forward to reading about this!

steven

On Sat, Mar 22, 2014 at 7:56 AM, Tarmo Johannes
 wrote:
> Thanks, Steven!
> That was it!
> My qt/c++/qml/csound app for android works!
> I will post soon more about how to do it.
> Tarmo
>
> 2014 3 22 10:10 kirjutas kuupäeval "Tarmo Johannes"
> :
>
>> Thanks,
>> I will give a try later today.
>> Tarmo.
>>
>> 2014 3 22 01:07 kirjutas kuupäeval "Steven Yi" :
>>>
>>> Hi Tarmo,
>>>
>>> With Android we use a sub-class of Csound called AndroidCsound. You
>>> can find the code in the CsoundAndroid/jni folder as AndroidCsound.hpp
>>> and AndroidCsound.cpp.  The one thing that is relevant I think is to
>>> use that and call the setOpenSLCallbacks() method.
>>>
>>> If you look at the CsoundObj.java Java class, you'll find that we call
>>> that method (using the SWIG-generated wrapper to the C++ class).  We
>>> call that first before Compile.
>>>
>>> I'd try modifying the code to use:
>>>
>>> AndroidCsound testCs;
>>>
>>> and call
>>>
>>> testCs.setOpenSLCallbacks();
>>>
>>> before doing
>>>
>>> testCs.Compile(...)
>>>
>>> Hope that helps!
>>> steven
>>>
>>> On Fri, Mar 21, 2014 at 12:03 PM, Tarmo Johannes
>>>  wrote:
>>> > Hi,
>>> >
>>> >
>>> >
>>> > I am investing how it is possible to use csound through Qt and C++ on
>>> > android (Qt 5.2 has good support for android and also experimental for
>>> > iOs!)
>>> >
>>> >
>>> >
>>> > Everything has gone well and and looks right - but I get no Csound
>>> > performance.
>>> >
>>> >
>>> >
>>> > The piece of the code that I used for testing :
>>> >
>>> >
>>> >
>>> > Csound testCs;
>>> >
>>> > qDebug()<<"CsoundVersion: "<>> >
>>> >
>>> >
>>> >
>>> >
>>> > testCs.SetOption("-odac");
>>> >
>>> > testCs.SetOption("-d");
>>> >
>>> > testCs.Compile(R"(
>>> >
>>> > sr = 44100
>>> >
>>> > nchnls = 2
>>> >
>>> > 0dbfs = 1
>>> >
>>> > ksmps = 32
>>> >
>>> >
>>> >
>>> > instr test
>>> >
>>> > prints "INSTR TEST"
>>> >
>>> > endin)");
>>> >
>>> >
>>> >
>>> > testCs.ReadScore("i 1 0 1");
>>> >
>>> > testCs.Start();
>>> >
>>> > qDebug()<<"Csound pointer: "<>> >
>>> > testCs.Perform();
>>> >
>>> > testCs.Stop();
>>> >
>>> >
>>> >
>>> > The Csound version and pointer get reported correctly to console, so
>>> > the
>>> > library should work and csound should be operational.
>>> >
>>> >
>>> >
>>> > The only line that does nothing is testCs.Perform() - I get no message
>>> > about
>>> > Csound performance, nor error message.
>>> >
>>> >
>>> >
>>> > Looking what is inside libcsoundandroid
>>> >
>>> > $nm -D libcsoundandroid.so
>>> >
>>> >
>>> >
>>> > seems to me that there is no method Perform().
>>> >
>>> >
>>> >
>>> > Can it be? What should I do or how to test?
>>> >
>>> >
>>> >
>>> > The app works on desktop well.
>>> >
>>> >
>>> >
>>> > When I get it working, I will report what I did to get it work.
>>> > Qt+Csound+Android/iOs - if it succeeds, I will be very excited!!!
>>> >
>>> >
>>> >
>>> > thanks!
>>> >
>>> > tarmo
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>>
>>>
>>> Send bugs reports to the Sourceforge bug trackers
>>> csound6:
>>>             https://sourceforge.net/p/csound/tickets/
>>> csound5:
>>>             https://sourceforge.net/p/csound/bugs/
>>> Discussions of bugs and features can be posted here
>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>>> csound"
>>>
>>>
>


Send bugs reports to the Sourceforge bug trackers
csound6:
            https://sourceforge.net/p/csound/tickets/
csound5:
            https://sourceforge.net/p/csound/bugs/
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"