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