source: trunk/src/winmm/auxos2.cpp

Last change on this file was 21916, checked in by dmik, 14 years ago

Merge branch gcc-kmk to trunk.

File size: 3.4 KB
Line 
1/* $Id: auxos2.cpp,v 1.9 2001-10-24 22:47:41 sandervl 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 <os2mewrap.h> //Odin32 OS/2 MMPM/2 api wrappers
22#include <string.h>
23
24#define OS2_ONLY
25#include "win32type.h"
26#include "misc.h"
27#include "unicode.h"
28
29#include "auxiliary.h"
30#include "initterm.h"
31
32#define DBG_LOCALLOG DBG_auxos2
33#include "dbglocal.h"
34
35ULONG auxDeviceId = -1;
36
37/******************************************************************************/
38/******************************************************************************/
39BOOL auxOS2Open()
40{
41 MCI_AMP_OPEN_PARMS AmpOpenParms;
42 APIRET rc;
43
44 if(fMMPMAvailable == FALSE) return FALSE;
45
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
55 rc = mymciSendCommand(0, MCI_OPEN,
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/******************************************************************************/
68void 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
79 mymciSendCommand(auxDeviceId, MCI_CLOSE, MCI_WAIT, (PVOID)&GenericParms, 0);
80}
81/******************************************************************************/
82/******************************************************************************/
83DWORD 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
89 rc = mymciSendCommand(auxDeviceId, MCI_MASTERAUDIO, MCI_MASTERVOL |
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/******************************************************************************/
98DWORD auxOS2GetVolume(DWORD *dwVolume)
99{
100 MCI_MASTERAUDIO_PARMS maudio = {0};
101 APIRET rc;
102
103 rc = mymciSendCommand(auxDeviceId, MCI_MASTERAUDIO, MCI_QUERYCURRENTSETTING |
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/******************************************************************************/
113
Note: See TracBrowser for help on using the repository browser.