[7196] | 1 | /* $Id: auxos2.cpp,v 1.9 2001-10-24 22:47:41 sandervl Exp $ */
|
---|
[95] | 2 |
|
---|
[4] | 3 | /*
|
---|
| 4 | * Auxilary multimedia OS/2 implementation
|
---|
| 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 |
|
---|
[588] | 13 |
|
---|
| 14 | /****************************************************************************
|
---|
| 15 | * Includes *
|
---|
| 16 | ****************************************************************************/
|
---|
| 17 |
|
---|
[4] | 18 | #define INCL_BASE
|
---|
| 19 | #define INCL_OS2MM
|
---|
[588] | 20 | #include <os2wrap.h> //Odin32 OS/2 api wrappers
|
---|
[2244] | 21 | #include <os2mewrap.h> //Odin32 OS/2 MMPM/2 api wrappers
|
---|
[4] | 22 | #include <string.h>
|
---|
| 23 |
|
---|
| 24 | #define OS2_ONLY
|
---|
| 25 | #include "win32type.h"
|
---|
| 26 | #include "misc.h"
|
---|
| 27 | #include "unicode.h"
|
---|
| 28 |
|
---|
[1144] | 29 | #include "auxiliary.h"
|
---|
[21916] | 30 | #include "initterm.h"
|
---|
[4] | 31 |
|
---|
[2812] | 32 | #define DBG_LOCALLOG DBG_auxos2
|
---|
| 33 | #include "dbglocal.h"
|
---|
| 34 |
|
---|
[4] | 35 | ULONG auxDeviceId = -1;
|
---|
| 36 |
|
---|
| 37 | /******************************************************************************/
|
---|
| 38 | /******************************************************************************/
|
---|
| 39 | BOOL auxOS2Open()
|
---|
| 40 | {
|
---|
| 41 | MCI_AMP_OPEN_PARMS AmpOpenParms;
|
---|
| 42 | APIRET rc;
|
---|
| 43 |
|
---|
[7196] | 44 | if(fMMPMAvailable == FALSE) return FALSE;
|
---|
| 45 |
|
---|
[4] | 46 | if(auxDeviceId != -1) {
|
---|
| 47 | return TRUE;
|
---|
| 48 | }
|
---|
| 49 | // Setup the open structure, pass the playlist and tell MCI_OPEN to use it
|
---|
| 50 | memset(&AmpOpenParms,0,sizeof(AmpOpenParms));
|
---|
| 51 |
|
---|
| 52 | AmpOpenParms.usDeviceID = ( USHORT ) 0;
|
---|
| 53 | AmpOpenParms.pszDeviceType = ( PSZ ) MCI_DEVTYPE_AUDIO_AMPMIX;
|
---|
| 54 |
|
---|
[7196] | 55 | rc = mymciSendCommand(0, MCI_OPEN,
|
---|
[4] | 56 | MCI_WAIT | MCI_OPEN_TYPE_ID | MCI_OPEN_SHAREABLE,
|
---|
| 57 | (PVOID) &AmpOpenParms,
|
---|
| 58 | 0);
|
---|
| 59 | if(rc) {
|
---|
| 60 | dprintf(("auxOpen: MCI_OPEN returned %X\n", rc));
|
---|
| 61 | return(FALSE);
|
---|
| 62 | }
|
---|
| 63 | auxDeviceId = AmpOpenParms.usDeviceID;
|
---|
| 64 | return(TRUE);
|
---|
| 65 | }
|
---|
| 66 | /******************************************************************************/
|
---|
| 67 | /******************************************************************************/
|
---|
| 68 | void auxOS2Close()
|
---|
| 69 | {
|
---|
| 70 | MCI_GENERIC_PARMS GenericParms;
|
---|
| 71 |
|
---|
| 72 | if(auxDeviceId == -1)
|
---|
| 73 | return;
|
---|
| 74 |
|
---|
| 75 | // Generic parameters
|
---|
| 76 | GenericParms.hwndCallback = 0; //hwndFrame
|
---|
| 77 |
|
---|
| 78 | // Close the device
|
---|
[7196] | 79 | mymciSendCommand(auxDeviceId, MCI_CLOSE, MCI_WAIT, (PVOID)&GenericParms, 0);
|
---|
[4] | 80 | }
|
---|
| 81 | /******************************************************************************/
|
---|
| 82 | /******************************************************************************/
|
---|
| 83 | DWORD auxOS2SetVolume(DWORD dwVolume)
|
---|
| 84 | {
|
---|
| 85 | MCI_MASTERAUDIO_PARMS maudio = {0};
|
---|
| 86 | APIRET rc;
|
---|
| 87 |
|
---|
| 88 | maudio.ulMasterVolume = (dwVolume*100)/65536; //TODO: Not correct, should be logartihmic
|
---|
[7196] | 89 | rc = mymciSendCommand(auxDeviceId, MCI_MASTERAUDIO, MCI_MASTERVOL |
|
---|
[4] | 90 | MCI_WAIT, (PVOID)&maudio,0);
|
---|
| 91 | if(rc) {
|
---|
| 92 | dprintf(("auxOS2SetVolume returned %X\n", rc));
|
---|
| 93 | }
|
---|
| 94 | return(0); //MMSYSERR_NOERROR
|
---|
| 95 | }
|
---|
| 96 | /******************************************************************************/
|
---|
| 97 | /******************************************************************************/
|
---|
| 98 | DWORD auxOS2GetVolume(DWORD *dwVolume)
|
---|
| 99 | {
|
---|
| 100 | MCI_MASTERAUDIO_PARMS maudio = {0};
|
---|
| 101 | APIRET rc;
|
---|
| 102 |
|
---|
[7196] | 103 | rc = mymciSendCommand(auxDeviceId, MCI_MASTERAUDIO, MCI_QUERYCURRENTSETTING |
|
---|
[4] | 104 | MCI_MASTERVOL | MCI_WAIT, (PVOID)&maudio,0);
|
---|
| 105 | if(rc) {
|
---|
| 106 | dprintf(("auxOS2GetVolume returned %X\n", rc));
|
---|
| 107 | }
|
---|
| 108 | *dwVolume = (maudio.ulReturn*65536)/100;
|
---|
| 109 | return(0); //MMSYSERR_NOERROR
|
---|
| 110 | }
|
---|
| 111 | /******************************************************************************/
|
---|
| 112 | /******************************************************************************/
|
---|
[588] | 113 |
|
---|