Results 1 to 3 of 3

Thread: Swap default sound device

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Swap default sound device

    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)
    [size=9px]BEGIN GEEK CODE BLOCK
    <br />d s-- : a24 GB GCS GTW GE C++ P L+ W++ N+ K- w++++ M- PS+ PE+ Y- t+ 5+++ X+ R*
    <br />tv b+ DI++ D+ e++ h+ G-
    <br />END GEEK CODE BLOCK[/size]
    <br />Create your own GeekCode block at: <a href="">...</a>

  2. #2

    Swap default sound device

    Does this help - HKEY_CURRENT_USER\Software\Microsoft\Multimedia\So und Mapper?

    If you use RegMon - http://www.sysinternals.com/ntw2k/source/regmon.shtml - you can find out which registry settings have changed when you change something in the control panel ( or elsewhere ).
    PS. I have not used the tool myself, but a few people have found it usefull.
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

  3. #3

    Swap default sound device

    It works by changing the registry key:
    Code:
    HKEY_CURRENT_USER\Software\Microsoft\Multimedia\Sound Mapper&#58;Playback
    And I was looking for the API call :doh:

    Thanks Dom
    [size=9px]BEGIN GEEK CODE BLOCK
    <br />d s-- : a24 GB GCS GTW GE C++ P L+ W++ N+ K- w++++ M- PS+ PE+ Y- t+ 5+++ X+ R*
    <br />tv b+ DI++ D+ e++ h+ G-
    <br />END GEEK CODE BLOCK[/size]
    <br />Create your own GeekCode block at: <a href="">...</a>

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •