Core Audio code running on simulator mutes currently playing audio - macos

Every time I'm working on a Core Audio application, specifically one that utilizes real-time audio via the remoteIO audio unit render callbacks, the moment I start the audio unit engine running whatever music I am playing via youtube or itunes is muted. I must reload the youtube page or reset my system preference audio settings to get sound back. Is there a solution to this?

Set the mix-with-others property on the Simulator's RemoteIO Audio Unit before starting it. Also enable a proper AVAudioSession category.

Related

Outputting Audio to the Built-In output device (Not the Default One)

I need to do some system-wide audio processing in my app.
I have installed Soundflower and selected it as my default output device in order to get the system audio. I know that Soundflower merely copies the mix buffer to a ThruBuffer and passes it to the apps so they can get it in their AudioDeviceIOProc callback.
What I don't understand is how to route the audio back to the Built-In output device after I've done the audio processing. I have the Soundflower device as the default, and it produces silence as I try to route the audio to the default output unit. Maybe what I need is to create a Multi-Output device in my program but I'm not sure how to do that.
You can create a multi-output device on osx - they're called "aggregate devices". You can do it manually in Audio MIDI Setup app and use that device in your app, or do it programmatically in your app.
If you do do it in app, example code seems to be rare. I cribbed the info I needed from this blog post.
NB the post is very old, I had to go to the Internet Archive Wayback Machine to find it.

WP7 background audio resources are no longer available

I'm using BackgroundAudioPlayer for my Windows Phone 7 music & video application. After I play some music, I play video using MediaPlayerLauncher, then press Back to return to my app. There whenever I use BackgroundAudioPlayer.Instance. I receive error "The background audio resources are no longer available".
Someone on MSDN suggests using try/catch, but this is not a good idea, and can slow down the app.
Other suggests call BackgroundAudioPlayer.Instance.Close() before launch MediaPlayer. However, when I play music, the agent load .dll again, which takes very much time.
How to fix this ?
If you play a video after your audio the OS will definitely "terminate" your Background Audio Player. From your question it seems this is reproducible 100% of the time which would confirm this. Your only option is to restart the background audio player again after you have called BackgroundAudioPlayer.Instance.Close(), and then played your video. Which as you said will require reloading your player DLL when you start the BAP.
Update following up from comments
If you aren't implementing a streaming audio agent but only an AudioPlayer agent there isn't a process for you to kill anyway. The OS spins up a process as and when it needs to get you to process an action (e.g.: user action, track ended, shutdown).
BackgroundAudioPlayer.Instance.Close() just makes sure that the OS releases those resources cleanly in a scenario such as the OP has.
To restart background audio, just call BackgroundAudioPlayer.Instance.Play() again.

Expensify WP7 test framework

Can we use the Expensify Frame work to test Voice Commands on Emulator/Device..
The feels like this should be possible, but isn't something that I've already coded.
To achieve it, you'd have to setup some sort of playback system to create the audio voice commands. This could be done, for example, by using audio playback triggered from C# SpecFlow steps on the PC - e.g. using something like DirectShow/quartz - http://csharp-slackers.blogspot.co.uk/2008/10/playing-wav-or-mp3.html
This audio would then be played out and captured back into the emulator through the speakers and microphone on the host PC - just make sure they are positioned appropriately.

How to show audio details when played using MediaPlayerLauncher?

In my application i am playing an audio file (let it be .mp3) using MediaPlayerLauncher. File is downloaded from network and stored in IsolatedStorage.
I managed to play the audio but it was a bit disapointing to see that there is absolutly no details about the played track.
Is there a way to show picture and/or track name when launched with MediaPlayerLauncher? Or am i forced to use MediaElement?
Unfortunately, if you're just playing an audio stream using the MediaPlayerLauncher there si no way to specifyu additional (meta) data for the launcher to also display.
If you want additional information displayed then you'll need to create the UI yourself and play the track via a MediaElement (or background audio).

Playback and listen to recording device in FMOD

Is it possible to simultaneously playback the recording device by using the FMOD api? This functionality would be the same to what Windows offers in the recording device properties where you can enable "listen to this device" for certain recording devices. If this isn't possible via FMOD, is there another API more suited for this functionality?
You can achieve this with FMOD by simply recording with looping set to true, then play the recorded sound as looping also. Providing you separate your recordStart call and your playSound call by some time (say 10ms) the play cursor and the record cursor will follow each other and you will get realtime playback.
There is an example of this with the "recording" example that ships in the FMOD API for most platforms and there is a more advanced example on the Windows platform that shows adding realtime effects to a live recorded sound.

Resources