[Cs-dev] C++ API for Android
Date | 2015-09-09 11:54 |
From | Peter Burgess |
Subject | [Cs-dev] C++ API for Android |
Attachments | None None |
Is there a way of working with Csound and C++ for android? Or can you only use Java for this? |
Date | 2015-09-09 12:10 |
From | Steven Yi |
Subject | Re: [Cs-dev] C++ API for Android |
Yes, it is possible to use Csound on Android with C++. Tarmo posted about it a while back here: http://csound.1045644.n5.nabble.com/Csound-apps-for-Android-in-Qt-C-td5733453.html On Wed, Sep 9, 2015 at 11:54 AM, Peter Burgess |
Date | 2015-09-09 12:16 |
From | Michael Gogins |
Subject | Re: [Cs-dev] C++ API for Android |
Attachments | None None |
Csound is written in C with some opcodes and the audio interface layer written in C++. This is true on Android as well. But on Android the operating system user interface and user services are actually written in Java so that is the language everyone uses to write apps. You can also use HTML and Javascript because on Android Javascript easily talks to Java. So if you want to do something with Csound in C or C++ on Android, that's good if it doesn't involve the user interface. If it does, you pretty much have to use Java or else HTML and Javascript. Regards, On Sep 9, 2015 6:54 AM, "Peter Burgess" <pete.soundtechnician@gmail.com> wrote:
|
Date | 2015-09-09 12:30 |
From | Steven Yi |
Subject | Re: [Cs-dev] C++ API for Android |
I'm not sure that's quite right. It was true early on with Android, but developers can write applications on Android with C/C++ without any Java code and still create UIs. (I think this was primarily to cater to the game developer crowd.) http://developer.android.com/ndk/guides/concepts.html#naa http://developer.android.com/reference/android/app/NativeActivity.html On Wed, Sep 9, 2015 at 12:16 PM, Michael Gogins |
Date | 2015-09-09 13:03 |
From | Michael Gogins |
Subject | Re: [Cs-dev] C++ API for Android |
I understand that you can do it using Java Native Interface calls from C++ to the Java OS calls. I didn't mention this because it's not worth the trouble for anything complex. But are you saying there are now C/C++ OS calls along with the Java ones? Best, Mike ----------------------------------------------------- Michael Gogins Irreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com On Wed, Sep 9, 2015 at 7:30 AM, Steven Yi |
Date | 2015-09-09 13:13 |
From | Steven Yi |
Subject | Re: [Cs-dev] C++ API for Android |
You can read at the link: "Convenience for implementing an activity that will be implemented purely in native code. That is, a game (or game-like thing). There is no need to derive from this class; you can simply declare it in your manifest, and use the NDK APIs from there." The documentation talk about things like direct access to sensors as well that may be more efficient than going through the Java layer. With a native activity, you'd be working with low-level API's like OpenGL and OpenSL. The libraries you can link to and headers are all provided with the NDK. You can view available libraries by Android version here: http://developer.android.com/ndk/guides/stable_apis.html On Wed, Sep 9, 2015 at 1:03 PM, Michael Gogins |
Date | 2015-09-09 14:24 |
From | Michael Gogins |
Subject | Re: [Cs-dev] C++ API for Android |
Yes, I have looked at this before. As I recall, there are no facilities for constructing user interface widgets, menus, text boxes, etc. but I will check the documentation and report back. If it were possible to construct a native Android UI directly from C++ without jumping through hoops, this would be far better in my opinion, and I would port Csound for Android to it. However, I have now read through the docs, and it still looks as though, if you want a native Android user interface with standard widgets, you still have to make Java OS calls one way or the other. In my view, this still means it makes sense to write Csound for Android in two layers as we do know, a C shared library and a Java app. Native activities seems to be designed for games, and enable you to access key strokes, voice input, other sensors, and so on from C/C++. In theory one could re-implement all the required user interface widgets in OpenGL, but I haven't heard of anyone doing that for Android, and projects that did that for desktop platforms never became widely used (more's the pity, it made sense to me). (But I will look around...) Of course, if you don't need the standard Android widgets and you want to write a native app using the Csound API and OpenGL, it could simplify your life to do it all in C++. Best, Mike ----------------------------------------------------- Michael Gogins Irreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com On Wed, Sep 9, 2015 at 8:13 AM, Steven Yi |
Date | 2015-09-09 17:31 |
From | Peter Burgess |
Subject | Re: [Cs-dev] C++ API for Android |
Attachments | None None |
I have to admit, I don't know exactly what you mean by standard Android widgets, but my UI isn't going to be overly complex. There will be no user-controls that aren't passed directly to the c++ program. It's also maybe beneficial that I haven't created the UI yet. I was going to learn Qt to do it (on my linux machine first). Do you think I'd struggle to port this to android? I guess it might be worth me making a very simple csound-c++ app to test the android port before trying to port my whole program. On Wed, Sep 9, 2015 at 2:24 PM, Michael Gogins <michael.gogins@gmail.com> wrote: Yes, I have looked at this before. As I recall, there are no |
Date | 2015-09-09 17:37 |
From | Michael Gogins |
Subject | Re: [Cs-dev] C++ API for Android |
Consult the Android SDK to learn the standard Android widgets here: https://developer.android.com/guide/topics/ui/index.html What do you mean, "there will be no user-controls that aren't passed directly to the C++ program?" It would be helpful if I understood the basic purpose of your proposed application. Regards, Mike ----------------------------------------------------- Michael Gogins Irreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com On Wed, Sep 9, 2015 at 12:31 PM, Peter Burgess |
Date | 2015-09-09 20:12 |
From | Peter Burgess |
Subject | Re: [Cs-dev] C++ API for Android |
Attachments | None None |
Its gonna be a tool for algorithmic composition, so the user controls will all communicate directly with the c++ layer, and C++ will do all the talking with Csound. Cheers for the link! In truth I don't even entirely know what widgets are, never made a proper UI before, but I'm about to start the soon so widgets is high on my list of things to read up on. |
Date | 2015-09-09 20:58 |
From | Peter Burgess |
Subject | Re: [Cs-dev] C++ API for Android |
Attachments | None None |
@steven that link in the first message is awesome. That's got pretty much all the info I need, thanks! |