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