Stop/Start audio of another application - c#

Is it possible to reset (stop/start) audio from another applications using CSCore Audio Library?
I can activate windows effects from "enhancements" tab in speaker properties, but it won't start working until I restart the applications playing audio. I'm trying to reset the audio without restarting such applications.

Related

CSCore with audio through a GoXLR

I'm building an audio visualizer app in Unity and I'm currently using WASAPI to get the audio from any app playing audio.
I recently had someone with a GoXLR test it and the visualizer wasn't picking up the audio. I think all the audio is going directly to the GoXLR bypassing WASAPI. I can't debug it myself as I don't have a GoXLR so I wanted to know how I could pick up the audio from the GoXLR.

Audio Recording in Background is not working C# UWP

I've checked Background Audio Stop Issue , added
<uap3:Capability Name="backgroundMediaPlayback"/>
in Package.appxmanifest file. For playing m4a file used MediaPlayer class, it works perfectly in background. but for recording audio it is not working in background. It is being muted. Used AudioGraph to recording.
Do i need to handle externally for recording?
Didn't find any solution for this. It seems it is system limitation right now.
We cannot record audio in background on UWP platform.
Remember: when we can’t do something directly by using UWP, we can always create an hybrid UWP/Win32 app, using the UWP bridge.
Best regards

How to add a custom Windows audio input?

I have a Bluetooth Low Energy (BLE) device that streams audio through a custom service, and need to be able to use it in any Windows application (e.g. stream the audio to Skype or Google Chrome for example). I believe the only way is to make this audio source appear as a standard Windows audio input, but how to do this ?
I think the most reliable way to interract with a BLE device is through UWP (using Windows.Devices.Bluetooth.BluetoothLEDevice), so I used it to get the audio data. Then, I used the Windows.Media.Audio.AudioGraph to interract with the audio system. I'm able to generate the Windows audio stream from the BLE audio data with the AudioFrameInputNode and output it to my application default output with AudioDeviceOutputNode.
I can't override the default system audio input and audio output (e.g the laptop microphone and speakers) so in order to be able to use the output from my application as an input in other application, I used VB-Audio (https://www.vb-audio.com/) combined with the "App volume and device preferences" Windows feature. This way, I can use the VB-Audio Cable to connect the output of my application to the input of another, without having to set them as default system devices.
In theory, this should do what I need to do, but in fact, this setup isn't reliable.
I don't understand why, but the behavior isn't consistent at all. Most of the time, changing the audio settings (from "App volume and device preferences" and the "Audio devices panel") have no effect. With the same settings, sometimes it works but sometimes it doesn't (audio from my application is played on speaker instead of VB-Cable input, etc.)...
I don't know where the problem comes from, VB-Audio or Windows itself ? Is there a more reliable alternative to this setup ?
Otherwise, is there another way to use a custom audio source from an application like a standard Windows audio input ?
Please let me know if anything is unclear or you need any more information.
EDIT:
I think this post is actually about the same issue that I'm facing.

How to detect if another application's audio is playing in background? (UWP, Windows 10)

I am writing a C# SDK (to be used by UWP Publishers) and would like to detect if another application (Pandora, Spotify, Amazon Music, etc.) is playing music in the background, so that I can mute my SDK's sounds.
This comment to this question seems to indicate that I can use BackgroundMediaPlayer.IsMediaPlaying(), but when I play Pandora in a web browser, or the Amazon Music App, this method seems to always return false when music is playing in another app.
This answer to this question seems to indicate that we used to be able to use Microsoft.Xna.Framework.Media.MediaPlayer.State to detect if another app was playing background music, but I don't believe this call is not available in UWP (please let me know if I'm wrong -- I mainly care about this working on Desktop and XBox One).
So my question is, how can I determine if another app (on desktop or in web browser or on Windows phone) is playing music?
I believe the BackgroundMediaPlayer.IsMediaPlaying detects audio playing from WinRT/UWP apps only and not Win32 apps. This API was important for apps on Mobile because you were only allowed to have one app with background audio at any given time. I don't think there is a way to detect this for Win32 apps at this time.
The BackgroundMediaPlayer.IsMediaPlaying method is now obsolete. I've noticed that if background music is playing in UWP, calls to Microsoft.Xna.Framework.Media.MediaPlayer.Play succeed but do not actually play any music, so it seems the check is not necessary in some cases.

Resume spotify after playing own audio

I am coding a WP7 & WP8 sports tracking app that gives the user feedback through voice coaching. If a user is playing music, it needs to be paused, the voice coach needs to speak and finally the music must be resumed again. For the standard music player, i based my coding on the information given on this website, and it works for the standard music player, but not for Spotify.
I've been looking into it and the mediaplayer seems to lose track of Spotify when i pause their music, and Spotify seems to crash. There is no music in the MediaPlayer.Queue when Spotify is playing so i can't save and restore that. It's also not possible to simply try a MediaPlayer.Resume(); after pausing Spotify because the music player does not know what to play anymore due to the empty playlist.
Is it possible to create a windows phone app that is compitable with Spotify?
Thanks.
This isn't possible as 3rd party media applications such as Spotify don't use the MediaPlayer and so MediaPlayer.Resume() won't work for them.
You could request Microsoft to implement this in a future version the OS via the uservoice site.

Categories