Android Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsMobile ProgrammingAndroid Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 23rd, 2012, 12:31 PM
jerryk1234 jerryk1234 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2012
Posts: 2 jerryk1234 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 24 m 24 sec
Reputation Power: 0
Sequenced Sounds

Hello,

My name is Jerry Kaidor. I recently got a shiny new LG Optimus Slider, and am eager to write a few things for it. I am handicapped by the facts that
1. I know nothing about Android
2. I do not know Java.

HOWEVER, I do have over 20 years of experience in embedded C development, and have recently written maybe 50,000 lines of object-oriented Perl. I am also a longtime Linux user ( since kernel version 0.94.... AND, the eclipse IDE is very helpful .

So - moving on to today's question. I am writing an app that needs to make some sounds. These sounds need to be sequenced. That is, I would like the device to play sound #1 until it is done, then play #2 till it is done, then play #3. Etc.

I am trying to use the SoundPool class to do this, but it insists on trying to play my sounds all at once. Or dropping the sound it's playing for the new sound.

Anybody have a clue for me? Thanks in advance,

- Jerry Kaidor

Reply With Quote
  #2  
Old September 24th, 2012, 01:48 PM
jerryk1234 jerryk1234 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2012
Posts: 2 jerryk1234 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 24 m 24 sec
Reputation Power: 0
OK, I have a partial answer - the SoundPool class just is not appropriate for what I want to do. The appropriate class is something called "AudioTrack", which is the most primitive android sound API. AudioTrack doesn't do much for you, but it doesn't get in your way, either. You basically just send it some samples, and it writes them to the hardware. You can set up a listener for when there's room for more samples.

So I'm envisioning a layer that implements a circular buffer. "Upper level" code writes into it, "Lower level" code reads from it. When I used to do this sort of thing in C and assembler, I'd always size the buffer to a power of 2, and wrap the indices with logical "and"s. A special case would be a 64K buffer indexed with a 16-bit variable- don't even have to do the "and"s. And an even more special case was the traditional X86 architecture, with segment registers, which allowed me to use 16-bit *pointers* and not even do any index->pointer arithmetic - the cheapest circular buffer of all!

I don't think java is conducive to such tricks. Too high level.
But the processors are a lot faster nowadays too. But I will want to be careful about memory - not that much in the typical cell phone.

Reply With Quote
Reply

Viewing: Dev Shed ForumsMobile ProgrammingAndroid Development > Sequenced Sounds

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap