source: trunk/src/winmm/auxos2.cpp@ 46

Last change on this file since 46 was 46, checked in by sandervl, 26 years ago

* empty log message *

File size: 2.9 KB
Line 
1/*
2 * Auxilary multimedia OS/2 implementation
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
11#define INCL_BASE
12#define INCL_OS2MM
13#include <os2.h>
14#include <os2me.h>
15#include <string.h>
16
17#define OS2_ONLY
18#include "win32type.h"
19#include "misc.h"
20#include "unicode.h"
21
22#include "aux.h"
23
24ULONG auxDeviceId = -1;
25
26/******************************************************************************/
27/******************************************************************************/
28BOOL auxOS2Open()
29{
30 MCI_AMP_OPEN_PARMS AmpOpenParms;
31 APIRET rc;
32
33 if(auxDeviceId != -1) {
34 return TRUE;
35 }
36 // Setup the open structure, pass the playlist and tell MCI_OPEN to use it
37 memset(&AmpOpenParms,0,sizeof(AmpOpenParms));
38
39 AmpOpenParms.usDeviceID = ( USHORT ) 0;
40 AmpOpenParms.pszDeviceType = ( PSZ ) MCI_DEVTYPE_AUDIO_AMPMIX;
41
42 rc = mciSendCommand(0, MCI_OPEN,
43 MCI_WAIT | MCI_OPEN_TYPE_ID | MCI_OPEN_SHAREABLE,
44 (PVOID) &AmpOpenParms,
45 0);
46 if(rc) {
47 dprintf(("auxOpen: MCI_OPEN returned %X\n", rc));
48 return(FALSE);
49 }
50 auxDeviceId = AmpOpenParms.usDeviceID;
51 return(TRUE);
52}
53/******************************************************************************/
54/******************************************************************************/
55void auxOS2Close()
56{
57 MCI_GENERIC_PARMS GenericParms;
58
59 if(auxDeviceId == -1)
60 return;
61
62 // Generic parameters
63 GenericParms.hwndCallback = 0; //hwndFrame
64
65 // Close the device
66 mciSendCommand(auxDeviceId, MCI_CLOSE, MCI_WAIT, (PVOID)&GenericParms, 0);
67}
68/******************************************************************************/
69/******************************************************************************/
70DWORD auxOS2SetVolume(DWORD dwVolume)
71{
72 MCI_MASTERAUDIO_PARMS maudio = {0};
73 APIRET rc;
74
75 maudio.ulMasterVolume = (dwVolume*100)/65536; //TODO: Not correct, should be logartihmic
76 rc = mciSendCommand(auxDeviceId, MCI_MASTERAUDIO, MCI_MASTERVOL |
77 MCI_WAIT, (PVOID)&maudio,0);
78 if(rc) {
79 dprintf(("auxOS2SetVolume returned %X\n", rc));
80 }
81 return(0); //MMSYSERR_NOERROR
82}
83/******************************************************************************/
84/******************************************************************************/
85DWORD auxOS2GetVolume(DWORD *dwVolume)
86{
87 MCI_MASTERAUDIO_PARMS maudio = {0};
88 APIRET rc;
89
90 rc = mciSendCommand(auxDeviceId, MCI_MASTERAUDIO, MCI_QUERYCURRENTSETTING |
91 MCI_MASTERVOL | MCI_WAIT, (PVOID)&maudio,0);
92 if(rc) {
93 dprintf(("auxOS2GetVolume returned %X\n", rc));
94 }
95 *dwVolume = (maudio.ulReturn*65536)/100;
96 return(0); //MMSYSERR_NOERROR
97}
98/******************************************************************************/
99/******************************************************************************/
Note: See TracBrowser for help on using the repository browser.