To put things in context, I'm finally getting around to implementing audio1
for Android (Java). As it turns out, I'm a little confused about how the backends are laid out.
Below are some questions I'd like to know the answers to. Of course, any additional information that comes to mind is welcome as well. My plan is to compile this into a Wiki entry later on, so that people who want to contribute to Kha know what to watch out for.
General questions
- How are the backend sources included in the compilation process?
The library sources and backend sources often overlap. I'm wondering if the packages are remapped before compilation so that the backend types overwrite the library types, or is there something else going on? It's a bit confusing because backend sources often reference types from library sources that aren't implemented for that backend. Makes it difficult to configure the display server and get completion, so far I had to write a couple of stubs or temporarily comment things to appease the parser.
- What is the purpose of stub classes (definitions without implementations) in Kha library sources?
Some classes in the library sources only contain method stubs (e.g. kha.graphics2.Graphics
). Is your intention for these classes to be implemented by the backend?
- Some backends have
kha/<backend name>
folders. When should these be created?
I assume it's for implementations that require more code to be written in order for the end result to conform to Kha's API.
- Is the 'Empty' backend a template for future backends?
It looks like Empty
is just a template, so I'm just looking for confirmation.
kha.audio1
questions
-
Since there are no tests for audio, what would constitute a good test for the implementation?
-
Android audio playback can be handled in different ways, but for
kha.audio1
theSoundPool
class seems like a good choice. However, it puts a limit on the maximum number of simultaneous playback streams. What should the limit be?
What is the difference between
SoundPool
andMediaPlayer
for playing sound?I also would like to know how Assets are implemented. When I briefly tried to implement audio I saw that they were all null. I didn't test further but maybe they were in
Assets.blobs
or weren't loaded at at all.