DevMaster.net Forums
[[ Home | Forums | 3D Engines Database | Wiki | Articles/Tutorials | Game Dev Jobs | IRC Chat Network | Contact Us ]]

Go Back   DevMaster.net Forums > Programming & Development > Sound and Music Programming
User Name
Password
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
Old 03-18-2004, 11:54 PM   #1
tarbeu
New Member
 
Join Date: Mar 2004
Posts: 2
Default

I don't know how I can choose an other output sound card than the primary sound device.
Is it possible to choose the secondary sound card with the function alcOpenDevice()
or is it an other function which could allow to play a sound on the sound card of my choice either the primary sound card either the secondary sound card.
Thank you for your help.
tarbeu is offline   Reply With Quote
Old 03-20-2004, 09:11 AM   #2
SpreeTree
Valued Member
 
SpreeTree's Avatar
 
Join Date: Jan 2004
Location: England
Posts: 265
Default

To be honest, from my experience, I dont think you can. I had a good look at the OpenAL spec's, and as far as I can tell, using alcOpenDevice(...) selects the device that is most suited to the method you have choosen. It doesnt specifiy wether multiple calls to alcOpenDevice(...) selects another sound device, or just uses the same one.

It might be worth looking at OpenGL (this is a total shot in the dark, so I may be totally wrong here) and seeing if you can select different display devices. If you can, you might be able to use a similar method in AL. But as I said, thats a shot in the dark...

Sorry I couldnt be more help
Spree
SpreeTree is offline   Reply With Quote
Old 03-20-2004, 12:00 PM   #3
anubis
DevMaster Staff
 
anubis's Avatar
 
Join Date: Apr 2003
Location: Germany
Posts: 2,328
Default

you can't do that with opengl
___________________________________________
If Prolog is the answer, what is the question ?
anubis is offline   Reply With Quote
Old 03-22-2004, 04:16 AM   #4
SpreeTree
Valued Member
 
SpreeTree's Avatar
 
Join Date: Jan 2004
Location: England
Posts: 265
Default

I did say it was a shot in the dark, oh well

Just reading the OpenAL mailing lists, and the same question came up. So I guess it can be done!

Here is one of the responses

Quote:
If you download the code from CVS (instructions at
http://www.openal.org/downloads.html), you'll find the source code for
"altest" in openal/demos/altest/common/altest.cpp.* During
initialization, you'll see a reference to enumeration -- that section
will show you how to use the context enumeration extension to enumerate
the various "devices" on your system.

These "devices" do not necessarily correspond with sound cards,
however.* For instance, I have a computer at work with an NVIDIA
nForce2 and a Creative Audigy 2 in it.* The devices enumerate and will
play back as follows:

Device Name / playback device
MMSYSTEM / whatever is the "preferred audio device" selected for Windows
DirectSound / "preferred audio device" as with MMSYSTEM
DirectSound3D / "preferred audio device" as with MMSYSTEM
NVIDIA nForce2 / always will play back on the nForce 2
Creative Audigy 2 / always will play back on the Audigy 2

On your system, if you have an nForce2 and a Creative card, then you'll
see explicit entries for those two cards on your device list.* Any card
that doesn't have its own accelerated OpenAL implementation will have
to be selected by using one of the generic devices, which will follow
the "preferred audio device" selection in Windows.

Bare in mind that the DirectSound3D enumeration has a few bugs associated with it, so at the moment, out of the 3 standard devices, DirectSound is probably the best bet

Hope that helps some
Spree
SpreeTree is offline   Reply With Quote
Old 03-22-2004, 09:14 PM   #5
tarbeu
New Member
 
Join Date: Mar 2004
Posts: 2
Default

that was me who ask that in the openAL forum
I have tried what the guy has tell but it seems only working
with nForce2 and Creative audigy sound card....
and I don't have any of these sound card....
If anyone has a solution with other type of soundcard
thank you for your help.
tarbeu is offline   Reply With Quote
Old 03-23-2004, 02:35 AM   #6
SpreeTree
Valued Member
 
SpreeTree's Avatar
 
Join Date: Jan 2004
Location: England
Posts: 265
Default

Haha thought it might have been, but thought I'd post it anyway

Spree
SpreeTree is offline   Reply With Quote
Old 09-03-2004, 08:32 AM   #7
kitt3n
New Member
 
Join Date: Sep 2004
Posts: 15
Default

Sth like this to detect all devices

Code:
const alDeviceList* sound::getDeviceList (bool refresh) { * if (devList.numDevices==0 || refresh) * { * * char deviceName[256] = {0}; * char *defaultDevice=NULL; * char *deviceList=NULL; * if (alcIsExtensionPresent(NULL, (ALubyte*)"ALC_ENUMERATION_EXT") == AL_TRUE) * * { // try out enumeration extension * * deviceList = (char *)alcGetString(NULL, ALC_DEVICE_SPECIFIER); * * * devList.numDevices = 0; * * * if (strlen(deviceList)) * * * { * * * * devList.numDevices=1; * * * defaultDevice = (char *)alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER); * * * * devList.numDefaultDevice = 0; * * * for (U16 numDevices = 0; numDevices < 16; numDevices++) * * * * { * * * devList.devices[numDevices] = deviceList; * * * if (defaultDevice && strcmp(devList.devices[numDevices], defaultDevice) == 0) * * * * * { * * * * devList.numDefaultDevice = numDevices; * * * } * * * deviceList += strlen(deviceList); * * * if (deviceList[0] == 0) * * * * * { * * * * if (deviceList[1] == 0) * * * * * * { * * * * break; * * * * } * * * * * * else * * * * * * { * * * * * * * devList.numDevices++; * * * * deviceList++; * * * * } * * * } * * * * } * * } * * } * } * return &devList; }

and then sth like this - mind you, only tested on sb-audigy,
switching sound without exiting the game also works (although
old sound will be stopped so you will only hear new sounds):


Code:
bool sound::useDevice* * (U16 id) { * bool result = false; * const char* devname = getDeviceName (id); * // terminate old device + context * destroyBuffers(); * alcMakeContextCurrent(NULL); * if (pDevice) * * alcCloseDevice(pDevice); * if (pContext) * * alcDestroyContext(pContext); * // open * if (id<SOUND_AL_MAXDEVICE) * { * * // open specified device * * pDevice* = alcOpenDevice((unsigned char*)devList.devices[id]); * * devList.curDevice = id; * * pContext = alcCreateContext(pDevice, NULL); * * alcMakeContextCurrent(pContext); * * initBuffers(); * * result=true; * } * else * { * * // open default device * * pDevice* = alcOpenDevice(NULL); * * devList.curDevice = devList.numDefaultDevice; * * pContext = alcCreateContext(pDevice, NULL); * * alcMakeContextCurrent(pContext); * * initBuffers(); * * result=true; * } * alDistanceModel (AL_NONE); // or whatever distanceModel you like * return result; }
Note that you'll probably need some locks to avoid threading problems
kitt3n is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Forum Jump


All times are GMT -7. The time now is 11:28 PM.


Powered by vBulletin
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.