ambiera home ambiera home

Ambiera Forum

Discussions, Help and Support.

Create a new account, Search, or Login:
Name:  Password:    
Ambiera Forum > irrKlang
Change Audio Output Device
Author Text

Aaron T
Guest
Quote
2010-11-10 04:26:16

All,

Is there a way to programatically change the audio device the program is using to play music?

Thanks,
Aaron


niko
Moderator
Quote
2010-11-10 07:16:05

You can enumerate the audio devices in your system by using the createSoundDeviceList(); function in Cplusplus. On the first page of the documentation, there is a sample 'Enumerating sound devices'. If you are using .NET, this works similar there.


Aaron Tobison
Guest
Quote
2010-11-10 14:59:13

You rock!

The sound change was easy enough to change.

Thanks for the help!

p.s. -> Next time I will check the doc before bothering you!


ein-newbie
Registered User
Quote
2018-04-27 21:24:51

hi there,
may i ask 1, 2 or 3 beginner-question?
I use the irrKlang.NET4.dll from irrKlang-64bit-1.6.0 with VS2012 oin Windows 10.
I like to build a C-Windows-Form as a stand alone "exe" file.
This file shall have a button that play a sound (selectable from a folder).
Output this mp3-file to a select-able output (i read the demofile, but it does not work here).
So i add a combobox1 and copy&past ur code there.
if i run the project and click the box, it is empty.
My code for c:
( i need to add a "var" in front of "sdl" because otherwise i got a error, like "name is not in actual context" ( or something like this)

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
//Get the list of installed sound devices.
var sdl = new IrrKlang.ISoundDeviceList(IrrKlang.SoundDeviceListType.PlaybackDevice);
//Add each device to a combo box.
for (int i = 0; i < sdl.DeviceCount; i++)
{
comboBox1.Items.Add(sdl.getDeviceDescription(i) + "\n");
}
}

the drop-down stays empty.
---
2nd: how do i tell the Play2d-Engine what output to use?

---
3rd: if i press the button tp play the mp3file, i get a error in the program: BadImageFormatException (wrong format was try to load)
In the Projectpropertiypage i selected x86 as targetplatform, but in the top is "active (any cpu)" - and i cant change this.
how to get rid of this and the warning about a konflic between architecture x86 and AMD64 of IrrKlang.net4 (all german, difficult to translate this errormessages and warnigs.)
--
Thank You.
If i ask to much or on the wrong forum, please move this to the right target.


ein-newbie
Registered User
Quote
2018-04-30 17:30:09

OK, seems i need to build a instanz of ISoundEngine witth the given parameter to the device.
Are there any c-sharp-examples?


niko
Moderator
Quote
2018-05-02 15:44:37

I think you are filling in only when something changed, right?

Examples: Yes, in the examples.NET folder, or here: https://www.ambiera.com/irrklang...


ein-newbie
Registered User
Quote
2018-05-03 12:40:16

sorry, can't find any example to use a special output-device.
There are Only some cpp examples at https://www.ambiera.com/irrklang/docu/index.htmlenumeratingDevices
i like to know how to create a "engine" with a given output in csharp.
(please remember, ima beginner....)


niko
Moderator
Quote
2018-05-04 07:51:14

You can do it like this:

IrrKlang.ISoundDeviceList list = new IrrKlang.ISoundDeviceList(IrrKlang.SoundDeviceListType.PlaybackDevice);

// to print all devices in that list:

for (int i=0; i<list.DeviceCount; ++i)
list.getDeviceDescription(i);

// to use the first device
int soundDeviceIndexToUse = 0; // first device

IrrKlang.ISoundEngine engine = new IrrKlang.ISoundEngine(
IrrKlang.SoundOutputDriver.AutoDetect,
IrrKlang.SoundEngineOptionFlag.DefaultOptions,
list.getDeviceID(soundDeviceIndexToUse));



Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Int?rnational" (you are not logged in)


Text:

 

  

Forum Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   





Software: Ambiera Light Forum. © 2008-2018 Nikolaus Gebhardt, Ambiera e.U.