[Csnd] csoundandroid through c++ and android NDK
Date | 2014-03-21 16:03 |
From | Tarmo 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
|
Date | 2014-03-21 23:06 |
From | Steven Yi |
Subject | Re: [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 |
Date | 2014-03-22 08:10 |
From | Tarmo Johannes |
Subject | Re: [Csnd] csoundandroid through c++ and android NDK |
Thanks, 2014 3 22 01:07 kirjutas kuupäeval "Steven Yi" <stevenyi@gmail.com>:
Hi Tarmo, |
Date | 2014-03-22 11:56 |
From | Tarmo Johannes |
Subject | Re: [Csnd] csoundandroid through c++ and android NDK |
Thanks, Steven! 2014 3 22 10:10 kirjutas kuupäeval "Tarmo Johannes" <tarmo.johannes@otsakool.edu.ee>:
|
Date | 2014-03-22 13:57 |
From | Steven Yi |
Subject | Re: [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 |