soundpool

How to Sync Sounds using SoundPool

爱⌒轻易说出口 提交于 2020-01-01 09:58:44
问题 I have been trying to get a few sounds to play at the same time; currently i'm using a shared instance of SoundPool. I would like 1, 2 or 3 sounds to be played at the exact same time with no lag. When calling SoundPool.play(...) X number of times in succession, the sounds are played in that order as one might think. what is the proper what to achieve this where i can prepare all of the sounds to be played at the same time and then play them as one? Sudo Code: SoundPool _soundPool = new

How to Sync Sounds using SoundPool

爱⌒轻易说出口 提交于 2020-01-01 09:58:35
问题 I have been trying to get a few sounds to play at the same time; currently i'm using a shared instance of SoundPool. I would like 1, 2 or 3 sounds to be played at the exact same time with no lag. When calling SoundPool.play(...) X number of times in succession, the sounds are played in that order as one might think. what is the proper what to achieve this where i can prepare all of the sounds to be played at the same time and then play them as one? Sudo Code: SoundPool _soundPool = new

Playing two sounds Simutaneosly

我怕爱的太早我们不能终老 提交于 2019-12-30 06:25:06
问题 I am trying to play two sounds simutaneosly in android.I have created two MediaPlayers and am using the code below.They are currently playing one after another.Or not exactly one after another but kinda delayed into eachother. private void playSound(){ if (mp1 != null) { mp1.release(); } if (mp2 != null) { mp2.release(); } mp1 = MediaPlayer.create(this, soundArray[0]); mp2 = MediaPlayer.create(this, soundArray[3]); mp1.start(); mp2.start(); } Thanks 回答1: Playing two digital sounds

Playing sound over speakers while playing music through headphones

帅比萌擦擦* 提交于 2019-12-28 06:24:48
问题 I have an AudioTrack streaming via headphones. I have to send a SoundPool to built-in speakers only, without interrupting the AudioTrack playing over the headphones. Any hacks gangsters? 回答1: Many Android devices use a single output thread in the AudioFlinger / audio HAL for all local playback (earpiece, speaker, wired headset/headphones), making different routing of two tracks simultaneously impossible (which is why on many devices the media streams are forcibly muted if a notification is

Android SoundPool: get notified when end of played

依然范特西╮ 提交于 2019-12-28 05:51:24
问题 This sound so simple that I can't figure out why I can't find the answer lol I have a working sound pool class (thanks to a tutorial and some tweaking I did), and it works fine. the problem now is that I want to be able to change my background music randomly. (not always have the same music in a loop but have 2 or 3 and when one finishes I play one of the 2 others). problem is I can't find a way to get notified that the music has finished playing. Any ideas ? Jason 回答1: It can't be done with

How to mute audio in headset but let it play on speaker programmatically?

孤街醉人 提交于 2019-12-28 04:21:08
问题 I am searching a work-around for my problem specified in this question: How to disable the wired headset programmatically in Java As mentioned there, I am getting audio in both my speakers and headphones. Can someone please tell me how to mute the audio in the headset programmatically , while letting it play undiminished on speaker? 回答1: AudioManager am = (AudioManager)context.getSystemService(Context.AUDIO_SERVICE); am.setMode(AudioManager.MODE_IN_CALL); am.setSpeakerphoneOn(true); And then

Android Studio SoundPool not playing sounds sporadically

岁酱吖の 提交于 2019-12-25 03:11:02
问题 I am having some issues with getting my soundboard app to function correctly. I have switched to using this method over using MediaPlayer as soundpool was designed for this kind of app. I am running into issues with this app however, whereby when I click on a button a sound will play sometimes, but not all the time. It feels random. I have an OnLoadCompleteListener which is firing a status of "0" which according to the SoundPool class documentation means success. This does not seem to be the

How to play a sound simultaneously using SoundPool for a specific period of time

纵饮孤独 提交于 2019-12-25 01:45:15
问题 I am working with an android media application for that i want play a sound file simultaneously for a specific period of time. So i've created a Class and i am using SoundPool and Thread concepts inside this class to play the sound but when i run my application it is going to an ANR state and showing a warning in log-cat sample 2130968576 not READY anyone please help me to fix this... Class package com.kodspider.funk; import android.content.Context; import android.media.AudioManager; import

Concurrent Sound on Android Device

ε祈祈猫儿з 提交于 2019-12-24 08:39:23
问题 I have been developing simple drum pads for my phone and have run into a block when it comes to playing two sounds at once (ie during a multitouch event when the user presses down on two or more drum sounds at the same time). For playing the sounds I have been using the SoundPool class. I have a HashMap that hashes a Point to a sound. So my thinking was that when a point is pressed, its corresponding sound will be played. I have a feeling that getting two sounds to play at once involves

Android SoundPool heap limits

无人久伴 提交于 2019-12-24 04:42:07
问题 I am using a SoundPool to load several sound clips into and play them back. It is functioning 100% correctly from what I can tell. But during the .load() calls I am getting my log spammed with: 06-09 11:30:26.110: ERROR/AudioCache(23363): Heap size overflow! req size: 1050624, max size: 1048576 I am loading in 11 sound files, of those 2 are very small ~3kb and the rest are between 10kb - 15kb. Windows is reporting Size: 114kb Size on disk: 128kb Am I pushing the limits of what SoundPool is