Login / Register
▼
Binary Fortress
Binary Fortress Software
CheckCentral
ClipboardFusion
CloudShow
DisplayFusion
FileSeek
HashTools
LogFusion
Notepad Replacer
Online Base64 Decoder
Online Base64 Encoder
Online JSON Formatter
ShellSend
TrayStatus
VoiceBot
WallpaperFusion
Window Inspector
More Apps...
DisplayFusion
CheckCentral
CloudShow
ClipboardFusion
FileSeek
VoiceBot
WallpaperFusion
Home
▼
Download
Download
Change Log
Download Beta
Beta Change Log
License (EULA)
▼
Features
Features
Incredible Desktop Wallpaper
Monitor Configuration
Monitor Splitting
Powerful Functions
Triggers
Multi-Monitor Taskbars
Useful Windows 10 Tweaks
Useful Windows 8 Tweaks
Windows Lock Screen
Multi-Monitor Screen Savers
Monitor Fading
Window Snapping
Window Management
Mouse Management
Alt+Tab Handler
Window Position Profiles
Desktop Icon Profiles
Remote Control
Available in dozens of Languages
Easy Administration
Free vs Pro
Purchase
Screenshots
Languages
▼
Help
Help Guide
FAQ
Discussions
Contact Us
Find My License
Mailing Address
Advanced Settings
Scripted Functions (Macros)
Display
Fusion
by Binary Fortress Software
WARNING: You currently have Javascript disabled!
This website will not function correctly without Javascript enabled.
Title
Message
OK
Confirm
Yes
No
Toggle Multiple Default Audio Devices
Return to DisplayFusion Scripted Functions (Macros)
Description
Allows the user to switch between two or more Audio Devices.
Language
C# (.Net)
Minimum Version
9.4.3+
Created By
Alexander Robson
Contributors
-
Date Created
Apr 22, 2019
Date Last Modified
Apr 22, 2019
Scripted Function (Macro) Code
Copy
Select All
using System; using System.Windows.Forms; public static class DisplayFusionFunction { public static void Run(IntPtr windowHandle) { /* Step 1: To find out the name of the Playback Devices you want to switch between. To find out the list of current Playback Devices you must uncomment the code below the comment "* Show Playback Devices *" Step 2: To find out the name of the current Playback Device you are currently using. To find out the Playback Device that you are currently using you must uncomment the code below the comment "* Show Current Default Playback Device *" Step 3: Populate your list of Playback Devices you want to switch between. Under the comment "* Playback Device List *" you must paste your two, (or more) device names into the array. Replace the current text with your own. You must have a minimum of two devices for the switch to work. */ /* Playback Device List */ string[] audioDevices = {"Headphones (Corsair HS60 Surround Gaming Dongle)", "Speakers (Realtek High Definition Audio)", "23EA63 (NVIDIA High Definition Audio)"}; string currentDevice = BFS.Audio.GetDefaultPlaybackSounds(); string[] playbackDevices = BFS.Audio.GetPlaybackDevices(); /* Show Playback Devices */ //MessageBox.Show("Playback Devices Names:\n- " + string.Join("\n- ", playbackDevices)); /* Show Current Default Playback Device */ //MessageBox.Show("Current Default Playback Device:\n- " + currentDevice); int i; for (i = 0; i < audioDevices.Length; i++) { if (currentDevice == audioDevices[i]) { break; } } i++; if (i >= audioDevices.Length) { i = 0; } int j; bool foundAudioDevice = false; for (j = 0; j < playbackDevices.Length; j++) { if (audioDevices[i] == playbackDevices[j]) { foundAudioDevice = true; break; } } if (foundAudioDevice) { BFS.Audio.SetDefaultPlaybackSounds(audioDevices[i]); BFS.Audio.SetDefaultPlaybackCommunications(audioDevices[i]); /* Show Name of New Default Playback Device */ //MessageBox.Show("New Device\n- " + audioDevices[i]); } else { MessageBox.Show("Cannot Find New Device Named:\n- " + audioDevices[i] + "\n\nNo changes have been made."); } } }
Copyright © 2007-2021 Binary Fortress Software
•
News
•
Discussions
•
FAQ
•
Support
•
Privacy
•
ToS
•
Get DisplayFusion Merch