madmaw / marmalade-openal

port of OpenAL to the Made With Marmalade platform
http://connect.creativelabs.com/openal/default.aspx
6 stars 2 forks source link

Fixed problem with cracking sound; also new algorithm which uses less CPU #9

Closed vedran- closed 10 years ago

vedran- commented 10 years ago

New thread synchronizing algorithm. It uses less CPU, and it should work without any cracking sound. Throughly tested on all iOS mobile devices (iPhone/iPad/iPod), and on PC and on Android. It should work on other platforms too.

frankinshtein commented 10 years ago

Hi again everything is okay except small delay when sound really begin playing from speakers. It is about 100-300 ms I see it at least on PC. There is no lags If I play sound directly from buffer with s3eSoundChannelPlay Any ideas?

vedran- commented 10 years ago

Hey, that is due to nature of the algorithm - I have to pre-buffer the sound, so there will always be some delay. That was the only way I could synchronize openal and s3e sound callback, as Marmalade doesn't allow thread locks inside s3e sound callback which are needed by openal.

If you want, you can try decreasing the pre-buffer size, that could make to faster reaction time. Change data->preBufferSize = data->sampleSize * 3; to data->preBufferSize = data->sampleSize * 2; or even data->preBufferSize = data->sampleSize + 32;

On devices, update size (and the size of pre-buffer) is usually smaller than on PC, so reaction time should be faster than on PC anyhow.

frankinshtein commented 10 years ago

yep. I understand and it is a pity... I also have one awesome idea: wrap native OpenAL library as Marmalade extension. It would be ideal solution with great performance without Marmalade overhead.

frankinshtein commented 10 years ago

I did it! Native OpenAL extension for marmalade but It don't have all openal functions wrapped yet. https://github.com/frankinshtein/openalext

vedran- commented 10 years ago

Congratulations, nice work! Have you been testing it, how does it work? I guess it should use less CPU and have less latency than this implementation which uses Marmalade's s3eSound (and pre-buffering). Do you plan to expand your extension for iOS too?

Perhaps you could post your extension to Marmalade forums - https://devnet.madewithmarmalade.com/questions/index.html - I am sure that there are many people interested in what you have done.

frankinshtein commented 10 years ago

thank you. I tested it on PC and Android (not much). It works perfectly and without delays. Build it for iOS should be pretty easy, but i don't have mac right now, maybe later.

yep, posted https://devnet.madewithmarmalade.com/questions/18973/native-openal-extension-for-marmalade.html