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

Last change on this file since 588 was 588, checked in by phaller, 26 years ago

Add: added ODINWRAP support for WINMM

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