| 1 | /* $Id: auxiliary.cpp,v 1.4 2002-05-22 15:50:24 sandervl Exp $ */ | 
|---|
| 2 |  | 
|---|
| 3 | /* | 
|---|
| 4 | * Auxilary multimedia apis | 
|---|
| 5 | * | 
|---|
| 6 | * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl) | 
|---|
| 7 | * | 
|---|
| 8 | * | 
|---|
| 9 | * Project Odin Software License can be found in LICENSE.TXT | 
|---|
| 10 | * | 
|---|
| 11 | */ | 
|---|
| 12 |  | 
|---|
| 13 |  | 
|---|
| 14 | /**************************************************************************** | 
|---|
| 15 | * Includes                                                                 * | 
|---|
| 16 | ****************************************************************************/ | 
|---|
| 17 |  | 
|---|
| 18 | #include <os2win.h> | 
|---|
| 19 | #include <mmsystem.h> | 
|---|
| 20 | #include <mmddk.h> | 
|---|
| 21 | #include <odinwrap.h> | 
|---|
| 22 | #include <string.h> | 
|---|
| 23 |  | 
|---|
| 24 | #include <misc.h> | 
|---|
| 25 | #include <unicode.h> | 
|---|
| 26 |  | 
|---|
| 27 | #include "winmm.h" | 
|---|
| 28 | #include "auxiliary.h" | 
|---|
| 29 |  | 
|---|
| 30 | #define DBG_LOCALLOG    DBG_auxiliary | 
|---|
| 31 | #include "dbglocal.h" | 
|---|
| 32 |  | 
|---|
| 33 | /******************************************************************************/ | 
|---|
| 34 | /******************************************************************************/ | 
|---|
| 35 | MMRESULT WINAPI auxGetDevCapsA(UINT uDeviceID, LPAUXCAPSA pac, UINT cbac) | 
|---|
| 36 | { | 
|---|
| 37 | if(uDeviceID == AUX_MAPPER) {//AUX mapper | 
|---|
| 38 | return(MMSYSERR_NODRIVER); | 
|---|
| 39 | } | 
|---|
| 40 | if(uDeviceID != 0) { | 
|---|
| 41 | return(MMSYSERR_BADDEVICEID); | 
|---|
| 42 | } | 
|---|
| 43 | if(auxOS2Open() == FALSE) { | 
|---|
| 44 | return(MMSYSERR_NODRIVER); | 
|---|
| 45 | } | 
|---|
| 46 | pac->wMid           = 0; | 
|---|
| 47 | pac->wPid           = 0; | 
|---|
| 48 | pac->vDriverVersion = 0x0001; | 
|---|
| 49 | strcpy(pac->szPname, "OS/2 Aux Device"); | 
|---|
| 50 | pac->wTechnology    = AUXCAPS_AUXIN; | 
|---|
| 51 | pac->wReserved1     = 0; | 
|---|
| 52 | pac->dwSupport      = AUXCAPS_LRVOLUME | AUXCAPS_VOLUME; | 
|---|
| 53 | return MMSYSERR_NOERROR; | 
|---|
| 54 | } | 
|---|
| 55 | /******************************************************************************/ | 
|---|
| 56 | /******************************************************************************/ | 
|---|
| 57 | MMRESULT WINAPI auxGetDevCapsW(UINT uDeviceID, LPAUXCAPSW pac, UINT cbac) | 
|---|
| 58 | { | 
|---|
| 59 | if(uDeviceID == AUX_MAPPER) {//AUX mapper | 
|---|
| 60 | return(MMSYSERR_NODRIVER); | 
|---|
| 61 | } | 
|---|
| 62 | if(uDeviceID != 0) { | 
|---|
| 63 | return(MMSYSERR_BADDEVICEID); | 
|---|
| 64 | } | 
|---|
| 65 | if(auxOS2Open() == FALSE) { | 
|---|
| 66 | return(MMSYSERR_NODRIVER); | 
|---|
| 67 | } | 
|---|
| 68 | pac->wMid           = 0; | 
|---|
| 69 | pac->wPid           = 0; | 
|---|
| 70 | pac->vDriverVersion = 0x0001; | 
|---|
| 71 | AsciiToUnicode("OS/2 Aux Device", pac->szPname); | 
|---|
| 72 | pac->wTechnology    = AUXCAPS_AUXIN; | 
|---|
| 73 | pac->wReserved1     = 0; | 
|---|
| 74 | pac->dwSupport      = AUXCAPS_LRVOLUME | AUXCAPS_VOLUME; | 
|---|
| 75 | return MMSYSERR_NOERROR; | 
|---|
| 76 | } | 
|---|
| 77 | /******************************************************************************/ | 
|---|
| 78 | /******************************************************************************/ | 
|---|
| 79 | MMRESULT WINAPI auxSetVolume(UINT uDeviceID, DWORD dwVolume) | 
|---|
| 80 | { | 
|---|
| 81 | if(uDeviceID == AUX_MAPPER) {//AUX mapper | 
|---|
| 82 | return(MMSYSERR_NODRIVER); | 
|---|
| 83 | } | 
|---|
| 84 | if(uDeviceID != 0) { | 
|---|
| 85 | return(MMSYSERR_BADDEVICEID); | 
|---|
| 86 | } | 
|---|
| 87 | if(auxOS2Open() == FALSE) { | 
|---|
| 88 | return(MMSYSERR_NODRIVER); | 
|---|
| 89 | } | 
|---|
| 90 | return auxOS2SetVolume(dwVolume); | 
|---|
| 91 | } | 
|---|
| 92 | /******************************************************************************/ | 
|---|
| 93 | /******************************************************************************/ | 
|---|
| 94 | MMRESULT WINAPI auxGetVolume(UINT uDeviceID, LPDWORD pdwVolume) | 
|---|
| 95 | { | 
|---|
| 96 | if(uDeviceID == AUX_MAPPER) {//AUX mapper | 
|---|
| 97 | return(MMSYSERR_NODRIVER); | 
|---|
| 98 | } | 
|---|
| 99 | if(uDeviceID != 0) { | 
|---|
| 100 | return(MMSYSERR_BADDEVICEID); | 
|---|
| 101 | } | 
|---|
| 102 | if(auxOS2Open() == FALSE) { | 
|---|
| 103 | return(MMSYSERR_NODRIVER); | 
|---|
| 104 | } | 
|---|
| 105 | return auxOS2GetVolume(pdwVolume); | 
|---|
| 106 | } | 
|---|
| 107 | /******************************************************************************/ | 
|---|
| 108 | /******************************************************************************/ | 
|---|
| 109 | UINT WINAPI auxGetNumDevs() | 
|---|
| 110 | { | 
|---|
| 111 | if(auxOS2Open() == FALSE) | 
|---|
| 112 | return(0); | 
|---|
| 113 | else | 
|---|
| 114 | return 1; | 
|---|
| 115 | } | 
|---|
| 116 | /******************************************************************************/ | 
|---|
| 117 | /******************************************************************************/ | 
|---|
| 118 | MMRESULT WINAPI auxOutMessage(UINT uDeviceID, UINT uMsg, DWORD dwParam1, | 
|---|
| 119 | DWORD dwParam2) | 
|---|
| 120 | { | 
|---|
| 121 | if(uDeviceID == AUX_MAPPER) {//AUX mapper | 
|---|
| 122 | return(MMSYSERR_NODRIVER); | 
|---|
| 123 | } | 
|---|
| 124 | if(uDeviceID != 0) { | 
|---|
| 125 | return(MMSYSERR_BADDEVICEID); | 
|---|
| 126 | } | 
|---|
| 127 | if(auxOS2Open() == FALSE) { | 
|---|
| 128 | return(MMSYSERR_NODRIVER); | 
|---|
| 129 | } | 
|---|
| 130 | switch(uMsg) { | 
|---|
| 131 | case DRVM_INIT: | 
|---|
| 132 | case DRVM_EXIT: | 
|---|
| 133 | return MMSYSERR_NOERROR; | 
|---|
| 134 | case AUXDM_GETNUMDEVS: | 
|---|
| 135 | return auxGetNumDevs(); | 
|---|
| 136 |  | 
|---|
| 137 | case AUXDM_GETDEVCAPS: | 
|---|
| 138 | return auxGetDevCapsA(uDeviceID, (AUXCAPSA *)dwParam1, dwParam2); | 
|---|
| 139 |  | 
|---|
| 140 | case AUXDM_GETVOLUME: | 
|---|
| 141 | return auxGetVolume(uDeviceID, (DWORD *)dwParam1); | 
|---|
| 142 |  | 
|---|
| 143 | case AUXDM_SETVOLUME: | 
|---|
| 144 | return auxSetVolume(uDeviceID, dwParam1); | 
|---|
| 145 | } | 
|---|
| 146 | return MMSYSERR_NOTSUPPORTED; | 
|---|
| 147 | } | 
|---|
| 148 | /******************************************************************************/ | 
|---|
| 149 | /******************************************************************************/ | 
|---|
| 150 |  | 
|---|