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

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

Added new logging feature + fixed waveout query format bug

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