Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Android
Search Coderanch
Advance search
Google search
Register / Login
Win a copy of
Experimentation for Engineers: From A/B testing to Bayesian optimization
this week in the
Design
forum!
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Ron McLeod
Tim Cooke
Paul Clapham
Liutauras Vilda
Sheriffs:
Junilu Lacar
Rob Spoor
Jeanne Boyarsky
Saloon Keepers:
Stephan van Hulst
Carey Brown
Tim Holloway
Piet Souris
Bartenders:
Forum:
Android
SoundPool dont load Sounds
Saad Zahoor
Ranch Hand
Posts: 92
I like...
posted 5 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
this is my code and i get no error . When i press the button i hear nothing
image link
i think its not reading the sound file .. its mp3 format
makeSomeNoice.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { SoundPool soundPool ; SoundPool.Builder soundBuilder ; AudioAttributes audioAttribute ; AudioAttributes.Builder audioBuilder ; int id_for_sound ; audioBuilder = new AudioAttributes.Builder(); audioBuilder.setUsage(AudioAttributes.USAGE_GAME); audioBuilder.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION); audioAttribute = audioBuilder.build() ; soundBuilder = new SoundPool.Builder() ; soundBuilder.setAudioAttributes(audioAttribute); soundPool = soundBuilder.build() ; id_for_sound = soundPool.load(Main_Activity.this , R.raw.coin_sound , 1); soundPool.play(id_for_sound , 1 , 1, 0 ,0 ,1); } });
I am Noob Looking for Experts for their suggestion and Ideas
Dave Tolls
Rancher
Posts: 4801
50
posted 5 years ago
1
Number of slices to send:
Optional 'thank-you' note:
Send
Check and log the value returned by Soundpool.play(), just to check it isn't zero which would apparently mean it had failed.
The City calls upon her steadfast protectors. Now for a tiny ad:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Sound only plays once
Playing sounds effiecently.
Help With My Android Calculator Project
how to change the image dynamically in android by using timer or after 1 sec and 3 sec and 5 sec
Android: Random Images Shown in image view linked to matching buttons
More...