Wonderful :) And you know what ? It's taking 1% of the CPU now... 3% @ 250 BPM with all quarter notes running. Absolutely amazing.
Topic closed ! Thanks again. On 1 jan, 19:55, Dianne Hackborn <[email protected]> wrote: > "adb shell top" will show CPU usage. My favorite version is "adb shell top > -t -m 10". > > > > On Sat, Jan 1, 2011 at 7:49 AM, Slash4 <[email protected]> wrote: > > After several tests involving AudioTrack, both STATIC and STREAM mode, > > It was obvious I could not use this because of the specificity of my > > metronome, which can mix and play Notes, Half notes, quarter notes and > > triplets at the same time. Filling and reseting the AudioTracks > > buffers between each tempo change was way too long, even if after that > > no more CPU was needed because I used the loops (pretty interesting > > feature though, especially with the OnPlaybackPositionUpdateListener > > features allowing to sync between several AudioTracks, or UI). In > > STREAM mode, filling the buffer permanently was CPU consuming too, and > > I was facing a sync problem with my UI, which needs to react to each > > first beat of the bar. > > > To answer Kristopher, I can testify that the latencies are very low > > and pretty appropriate to short loops (for Audiotrack at least, as I > > didn't test Mediaplayer). > > > So, after that I followed Dianne 's idea and searched about delayed > > message posting. Finally I came up to a mix between delayed messages > > and Bret supposition with a timeStamp refreshed on each first beat to > > compensate the (eventual) jitter. > > > GC doesn't bothers it seems, even if it happens, I see it in the debug > > log, but do not hear jitter anyway. > > > Is there something like Task Manager on android to see how much CPU it > > costs now ? I would like to compare the two versions now :) > > > Thanks for your reactive and precise help. > > > And oh, happy new year :) > > > Rgds, Alex > > > On 30 déc 2010, 10:56, Slash4 <[email protected]> wrote: > > > Thanks Kostya, > > > > Streaming seems to be a great solution. And it is very interesting > > > because this way I can mix sounds... Let's do this :) > > > > Rgds, Alex > > > > On 29 déc, 21:23, Kostya Vasilyev <[email protected]> wrote: > > > > > To elaborate a bit: > > > > >http://developer.android.com/reference/android/media/AudioTrack.html > > > > > AudioTrack supports "streaming" mode of operation, where data can be > > fed > > > > into it on the fly. > > > > > You'd still need to do some sort of scheduled periodic loop, for > > feeding > > > > data to AudioTrack in chunks, but this way can deal with much larger > > > > jitter, which would be reasonable at application level. > > > > > At some point, you'd need to queue the metronome click, presumably from > > > > an audio file packed within the application. > > > > > This should help with that: > > > > >http://mindtherobot.com/blog/580/android-audio-play-a-wav-file-on-an-. > > .. > > > > > -- Kostya > > > > > 29.12.2010 22:40, Frank Weiss пишет: > > > > > > I'd look into Kostya's suggestion. Ideally, you only need the click > > > > > sample and you can program the audio player to play the sample at > > > > > precise intervals. > > > > > Trying to do precise timing with SDK programming is just frought with > > > > > pitfalls, AFAIK. > > > > > -- > > > > > You received this message because you are subscribed to the Google > > > > > Groups "Android Developers" group. > > > > > To post to this group, send email to > > [email protected] > > > > > To unsubscribe from this group, send email to > > > > > [email protected]<android-developers%[email protected]> > > > > > For more options, visit this group at > > > > >http://groups.google.com/group/android-developers?hl=en > > > > > -- > > > > Kostya Vasilyev -- WiFi Manager + pretty widget -- > >http://kmansoft.wordpress.com > > > -- > > You received this message because you are subscribed to the Google > > Groups "Android Developers" group. > > To post to this group, send email to [email protected] > > To unsubscribe from this group, send email to > > [email protected]<android-developers%[email protected]> > > For more options, visit this group at > >http://groups.google.com/group/android-developers?hl=en > > -- > Dianne Hackborn > Android framework engineer > [email protected] > > Note: please don't send private questions to me, as I don't have time to > provide private support, and so won't reply to such e-mails. All such > questions should be posted on public forums, where I and others can see and > answer them. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

