Android: Looking for an easy way to play notification sounds in a loop manually
Date : March 29 2020, 07:55 AM
hop of those help? Take a look at AlarmClock from Android's git repository. It might be helpful to check out the source code on how to play sounds for an expected duration.
|
AVAudio player play list of sounds with variable pause in between
Date : March 29 2020, 07:55 AM
hope this fix your issue I think that NSTimer isn’t a very good fit for what you want to achieve. What you describe is an edit list of audio clips, and what you are attempting to build using arrays and dictionaries already exists as first class API: AVComposition and its mutable counterpart.
|
Get list of apps which play sounds
Date : March 29 2020, 07:55 AM
will be helpful for those in need I think the question says it all: Is it possible to get a list of all apps which are currently playing sounds? Maybe over the SoundManager app or something else? , You can get your list by using this : Intent intent = new Intent(Intent.ACTION_VIEW);
Uri uri = Uri.withAppendedPath(MediaStore.Audio.Media.INTERNAL_CONTENT_URI,"1");
intent.setData(uri);
intent.setType("audio/*");
List<ResolveInfo> apps = getPackageManager().queryIntentActivities(intent, 0);
for (ResolveInfo rInfo : apps) {
//process list here
}
|
Play sounds one after another with loop
Date : March 29 2020, 07:55 AM
Any of those help There can also be a solution without mutation of 'order' array, for example using Symbol.iterator called for each ended event: var a1 = new Audio('http://developer.mozilla.org/@api/deki/files/2926/=AudioTest_(1).ogg'); a1.id = "1"; // id helps to see console.log is fine
var a2 = new Audio('http://developer.mozilla.org/@api/deki/files/2926/=AudioTest_(1).ogg'); a2.id = "2";
var a3 = new Audio('http://developer.mozilla.org/@api/deki/files/2926/=AudioTest_(1).ogg'); a3.id = "3";
var a4 = new Audio('http://developer.mozilla.org/@api/deki/files/2926/=AudioTest_(1).ogg'); a4.id = "4";
var order = [2, 1, 4, 3, 2, 1];
rotateAudio(order); // main function; pass order array here
function rotateAudio(order) {
var orderMap = {1: a1, 2: a2, 3: a3, 4: a4};
var iterator = order[Symbol.iterator]();
var value, done;
function rotate({value, done}) { // get next iteration
function next(e) {
e.target.removeEventListener('ended', next); // helps for garbage removal I guess
rotate(iterator.next())
};
if (done) { console.log('done!'); return };
var current = orderMap[value];
console.log('current: ', current);
current.play();
current.addEventListener('ended', next) // listen to 'ended' on audio, start next one
}
rotate(iterator.next()); // first call
}
|
C# Play a list of sounds
Tag : chash , By : somebody
Date : March 29 2020, 07:55 AM
seems to work fine The reason is probably that you don't wait each sound to finish and the sound gets "overridden". This way you hear only the last one. You need to make sure playing a sound is finished before you continue to the other one on your iteration. Assuming sp in your code is an instance of SoundPlayer class. You can use sp.PlaySync() to make sure your program pauses before moving to the next sound.
|