Quantcast
Channel: openFrameworks - Latest posts
Viewing all articles
Browse latest Browse all 40524

Choppy audio with ofxAndroidSoundPlayer (MediaPlayer)

$
0
0

Just a small follow-up, I've tried what feels like a hundred different ways to get MediaPlayer to work to no avail.

Using uncompressed audio (.wav.) didn't seem to help at all. The number of active MediaPlayers (2-8) also seems to have no effect. Whether or not I release() and then new() or just call reset() doesn't make a difference -- that is to say, creating a new MediaPlayer for each track or just using the same fixed set of MediaPlayers over and over produces the same effect.

I tried throttling my usage of MediaPlayer.setVolume() so that I only call it every ten frames or so and that sort of helped but didn't fix the problem of auto being choppy and sometimes stopping for no reason.

I also tried spinning off a thread for MediaPlayer.setVolume() since for whatever reason that call was pegging the CPU (I am calling it often to fade in and out my multitrack audio).

I have heard of using MediaPlayer as a service using an AsyncTask but I don't think I'm going to try that.

Similarly, this page suggests basically rolling your own mixer but I don't think I can pull that off in time:

Going to try ExoPlayer then FMOD then give up on Android forever. Yeesh!


Viewing all articles
Browse latest Browse all 40524

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>