home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ioctlapi.zip / appsrc.zip / pddname.c < prev    next >
C/C++ Source or Header  |  1999-11-16  |  2KB  |  81 lines

  1. //-----------------------------------------------------------------------------
  2. // Freeware.  This file may be used freely to promote the ioctl90 mixer API.
  3. //-----------------------------------------------------------------------------
  4.  
  5. //
  6. // OS/2 32-bit program to query the Physical Device Driver name
  7. // for the default MMPM/2 WaveAudio device.  Joe Nord 10-Mar-1999
  8. //
  9.  
  10. #include <stdlib.h>
  11. #include <stdio.h>
  12. #include <string.h>
  13.  
  14. #include <os2.h>
  15.  
  16. #define INCL_OS2MM
  17. #include <os2me.h>
  18.  
  19. #include "data.h"
  20.  
  21. ULONG GetAudioPDDName (char *pszPDDName)
  22. {
  23.    ULONG                   ulRC;
  24.    char                    szAmpMix[9] = "AMPMIX01";
  25.  
  26.    MCI_SYSINFO_PARMS       SysInfo;
  27.    MCI_SYSINFO_LOGDEVICE   SysInfoParm;
  28.    MCI_SYSINFO_QUERY_NAME  QueryNameParm;
  29.  
  30.    memset (&SysInfo, '\0', sizeof(SysInfo));
  31.    memset (&SysInfoParm, '\0', sizeof(SysInfoParm));
  32.    memset (&QueryNameParm, '\0', sizeof(QueryNameParm));
  33.  
  34.    SysInfo.ulItem       = MCI_SYSINFO_QUERY_NAMES;
  35.    SysInfo.usDeviceType  = MCI_DEVTYPE_WAVEFORM_AUDIO;
  36.    SysInfo.pSysInfoParm = &QueryNameParm;
  37.  
  38.    strcpy (QueryNameParm.szLogicalName, szAmpMix);
  39.  
  40.    ulRC = mciSendCommand (0,
  41.                           MCI_SYSINFO,
  42.                           MCI_SYSINFO_ITEM | MCI_WAIT,
  43.                           (PVOID) &SysInfo,
  44.                           0);
  45.    if (ulRC != 0)
  46.    {
  47.       if (Options.Verbose || Options.Debug)
  48.       {
  49.          printf ("GetAudioPDDName mciSendCommand ulRC=%u\n", ulRC);
  50.       }
  51.       return (ulRC);
  52.    }
  53.  
  54.    // Get PDD associated with our AmpMixer
  55.    // Device name is in pSysInfoParm->szPDDName
  56.  
  57.    SysInfo.ulItem       = MCI_SYSINFO_QUERY_DRIVER;
  58.    SysInfo.usDeviceType = MCI_DEVTYPE_WAVEFORM_AUDIO;
  59.    SysInfo.pSysInfoParm = &SysInfoParm;
  60.  
  61.    strcpy (SysInfoParm.szInstallName, QueryNameParm.szInstallName);
  62.  
  63.    ulRC = mciSendCommand (0,
  64.                           MCI_SYSINFO,
  65.                           MCI_SYSINFO_ITEM | MCI_WAIT,
  66.                           (PVOID) &SysInfo,
  67.                           0);
  68.    if (ulRC != 0)
  69.    {
  70.       if (Options.Verbose || Options.Debug)
  71.       {
  72.          printf ("GetAudioPDDName mciSendCommand ulRC=%u\n", ulRC);
  73.       }
  74.       return (ulRC);
  75.    }
  76.  
  77.    strcpy (pszPDDName, SysInfoParm.szPDDName);
  78.  
  79.    return (ulRC);
  80. }
  81.