In case you have several SoundBlasters installed you can switch between them by going to the “Sounds and Audio Devices” under the Control-panel (under the Audio tab).

Now, how can I set the default device in code?

I found plenty of neat stuff in MMSystem but nothing that allowed me to change the default device.

Please let me know if you have any idea..

Update! this maybe works:

[pascal]function SetMasterDevice(const DeviceID: Integer): MMResult;
var
Details: TMixerControlDetails;
MasterVal: TMixerControlDetailsUnsigned;
begin
with Details do
begin
cbStruct := SizeOf(Details);
dwControlID := DeviceID;
cChannels := 1; // does it really matter?
cMultipleItems := 0;
cbDetails := SizeOf(TMixerControlDetailsUnsigned);
paDetails := @MasterVal;
end;
MasterVal.dwValue := 0;
result := mixerSetControlDetails(DeviceID, @Details, MIXER_OBJECTF_AUX);

if result <> MMSYSERR_NOERROR then
raise Exception.CreateFmt('mixerSetControlDetails failure, ' +
'multimedia system error #%d', [result]);
end;[/pascal]

I get a MMSYSERR_BADDEVICEID error but thats maybe becouse I try to move SB 0 to SB 0 (only one SB in this computer)