Multi Touch Sound Triggers in Swift for iOS Development - ios11

I just created a simple Xylophone app with has 7 buttons, each of which triggers an individual .wav sound. I noticed however that you cannot play two sounds (or press two of the buttons) at once. I was wondering if someone could point me in the right direction as far as documentation to figure out how to enable this? Thanks.

If you play a sound from a single AVAudioPlayer and then play another sound from it before the first sound is over, it will cut off the first sound. You can play two sounds simultaneously if they're coming from two different AVAudioPlayers, so you'll have to create multiple AVAudioPlayer objects to play overlapping sounds.

Related

Does gtk support display multiple videos with gstreamer?

I've been working on a project that requires me to display multiple videos at the same time.
It's the first time I use gstreamer.
At first, I tried to use videosink to display one and use opencv and cairo to display other one,
but this failed.
And I tried to add more drawing area and use same video sink, but it came out that videos were displayed on same drawing area widget.
I also tried to add more gstvideooverlay, but this could not work.
Is it possible to display multiple videos on different drawing area widgets at the same time?
but this could not work.
is not very descriptive. It sounds like you are doing something wrong here.
On the other hand if you are developing a GTK gui application I would use gtksink or gtkglsink respectively. With these you can simply set GtkWidgets into your GUI.

Need clarification on using audio on button click, background audio, etc in Windows Phone

This is a WP 7.1/7.5/Mango Silverlight app.
I have a requirement where I need to play sounds on image click (3-4 images) and also an audio plays when user navigates to the page first time.
So I implemented that using MediaElement as mentioned here: Windows Phone 7.1 - Media Element not playing
Issue: Now I was testing the app. I started playing radio on the phone. Then started my app. Radio was still playing. Now when I navigated to the page that has audion on page Load, radio stopped.
Certification Requirements (6.5 - Non Music..) is very confusing: http://msdn.microsoft.com/en-us/library/hh184838(v=vs.92).aspx
Questions:
1: Do I need to ask user permission in this case (using a pop-up) before playing my audio?
2: Req 6.5.3 says no need to ask permission for non-interactive audio. What is that?
3: If I have to ask the user and if user selects No i.e. not to stop thier radio(or other music), then the only was for me to still allow to play my audio is using SoundEffect insted of MediaElement. So am I doing wrong with MediaElement?
4: I am also planning to add a background/ambience music to my app in future once I am done setting up above audios. Req 6.5.4. says - The SoundEffect class must not be used to play a continuous background music track in an application. No so in that case I am left with MedieElement only.
Here's rhe Sound Sample(second one) I found: http://msdn.microsoft.com/en-us/library/ff431744(v=vs.92).aspx#BKMK_Media Is this the only way I can do?
Any suggestions really appreciate.
Note: The button click and page load audio files are short clips(max 5 secs) e.g. How are you?, What's your name? It's so much fun here, etc. So they are not songs.
To answer one (or more) of you questions:
You do not need to ask the user permission before playing audio
All this means is if something is playing before your sound plays you must resume it
No you should be using a sound effect if its a sound effect and a media element if its a media file. Sound effect are usually 5-10seconds and not continuous. BAckground music that loops is not a sound effect.
In Silverlight for WP7 only one MediaPlay can be played at a time. I got around this by making my project a Windows Phone Silverlight an XNA application Refer to my previous post. The idea is that my XNA part plays the sound effects while my mediaelement plays the background audio.
It can be a little confusing sometimes. Here is how I understand it:
You don't ask permission when all these conditions are met:
The sound doesn't repeat
The sound is interactive (in response to something the user did, like click a button)
You don't stop the background music (which means not using a MediaElement)
You do ask permission when:
The sound repeats or is continuous
The sound is like background music
You use a MediaElement (Because it stops the background music)
A clarification on interactive sounds: in my opinion a sound to signify that the program's state has changed (such as a timer's alarm going off) is still somewhat interactive and wouldn't need permission. Unless of course you start playing a song that functions more as background music.

Render Silverlight Animation to video file

I need to be able to render a silverlight storyboard animation to video. The animated content itself could be simple UIElements, Images or even two or more videos playing at the same time.
Several ideas came to mind like RenderTargetBitmap on a single frame basis, but:
1) I've never tested this against video embedded content
2) Don't know how to actually compose the video from the generated images.
Expression Encoder was also on my mind, but I don't know if it's possible to integrate it in a Silverlight/XBAP app to fulfill what's expected from it.
What's your opinion on this?
Your best bet if you just need to capture this sort of thing would be to use the Expression Encoder 4's screen recording feature, or a tool like TechSmith Camtasia.

Creating media visualization in Silverlight

I'd like to create to some custom visualization effects to a sound wave in Silverlight. As of Silverlight 3 there's the MediaElement class which does a great job in playing sounds/videos.
To visualize however I would need some kind of event callback with some information on the currently played segment of the sound. Does the framework have some support for achieving this?
I wanted the same so I've created exactly that.
You can see a live demo at http://prefix.teddywino.com/post/SilverlightMediaKitLiveDemo.aspx
The library and demo source code are available at http://salusemediakit.codeplex.com/
The demo shows the added feature to alter the raw audio data to create effects.
Currently works only with MP3s and is still under development
Sadly this is not possible in Silverlight unless you go the whole way and create your own MediaStreamSource to decode the audio (e.g. from MP3) yourself.
Can you get away with cheating? A lot of web players show a fake graphic equaliser which just has bars going up and down randomly during playback. I seem to remember that MySpace and SoundClick used to do this (may still do).
If you implement a custom MediaStreamSource, you could potentially inspect/analyze the data being generated by it, but you will immediately run in to UI threading issues if you try and update the UI directly from the custom MediaStreamSource, or vice versa.
One way to get this to work might be to implement a custom MediaStreamSource that writes (or duplicates?) extra audio data to a thread-safe buffer where your UI could access it.

How to make windows form UI responsive?

This is a common problem for all developers, I am looking for the best solution to make windows forms UI responsive.
I have an animated GIF file to show progress of my calcuation on windows form. I took a picture box control and placed animated gif into that. now when my calcuation starts - the animaged gif freezes. I want the reverse, the animation should be visible when i am running the calculation.
Any to the point thoughts? A simple solution is to display a progress bar to the user while doing complex calculations behind the scene
My app is a single threaded application, and I want a simple solution, not looking for multi-threads, or background worker kind of technologies.
Any help?
Multiple threads would be my recommendation. A bit messy first time you try ;)
Simplest model: One thread for the GUI, and one thread for whatever work you need to do.
Check this link.
Application.doevents
You place it in the loop. It gives the UI the time to do its things.
Well, the only real way to do 2 things at once (like do calculations, and still keep responsive) is to use threads. If you won't want to explicitly use threads, then check to see if there are any asynchronous calls you can use to do it in the background. Aside from that, do a lot of Application.DoEvents calls wherever you do lots of work.
I'm going to have to site Jeff on this one:
Coding Horror: Is DoEvents Evil?
"simple solution to display a progress to the user while doing complex calculations behind the scene ?"
"not looking for multi-threads, or background worker kind of technologies."
Which of those wishes is more important to you? You'll have to choose one or the other.

Resources