source: trunk/src/winmm/waveoutbase.cpp@ 7196

Last change on this file since 7196 was 7196, checked in by sandervl, 24 years ago

dynamically load MDM.DLL

File size: 3.6 KB
Line 
1/* $Id: waveoutbase.cpp,v 1.4 2001-10-24 22:47:42 sandervl Exp $ */
2
3/*
4 * Wave playback class (DART)
5 *
6 * Copyright 1998-2001 Sander van Leeuwen (sandervl@xs4all.nl)
7 *
8 *
9 * Project Odin Software License can be found in LICENSE.TXT
10 *
11 * Note:
12 * 2000/11/24 PH MCI_MIXSETUP_PARMS->pMixWrite does alter FS: selector!
13 *
14 */
15
16
17/****************************************************************************
18 * Includes *
19 ****************************************************************************/
20
21
22
23#define INCL_BASE
24#define INCL_OS2MM
25#include <os2wrap.h> //Odin32 OS/2 api wrappers
26#include <os2mewrap.h> //Odin32 OS/2 MMPM/2 api wrappers
27#include <stdlib.h>
28#include <string.h>
29#define OS2_ONLY
30#include <win32api.h>
31#include <wprocess.h>
32
33#include "misc.h"
34#include "waveoutbase.h"
35#include "initwinmm.h"
36
37#define DBG_LOCALLOG DBG_waveoutbase
38#include "dbglocal.h"
39
40#ifndef min
41#define min(a, b) ((a > b) ? b : a)
42#endif
43
44#ifndef max
45#define max(a, b) ((a > b) ? a : b)
46#endif
47
48//TODO: mulaw, alaw & adpcm
49/******************************************************************************/
50/******************************************************************************/
51WaveOut::WaveOut(LPWAVEFORMATEX pwfx, ULONG fdwOpen, ULONG nCallback, ULONG dwInstance)
52 : WaveInOut(pwfx, fdwOpen, nCallback, dwInstance)
53{
54 bytesPlayed = bytesCopied = bytesReturned = 0;
55
56 volume = defvolume;
57
58 dprintf(("waveOutOpen: samplerate %d, numChan %d bps %d (%d), format %x", SampleRate, nChannels, BitsPerSample, pwfx->nBlockAlign, pwfx->wFormatTag));
59}
60/******************************************************************************/
61/******************************************************************************/
62WaveOut::~WaveOut()
63{
64}
65/******************************************************************************/
66/******************************************************************************/
67int WaveOut::getNumDevices()
68{
69 MCI_GENERIC_PARMS GenericParms;
70 MCI_AMP_OPEN_PARMS AmpOpenParms;
71 APIRET rc;
72
73 // Setup the open structure, pass the playlist and tell MCI_OPEN to use it
74 memset(&AmpOpenParms,0,sizeof(AmpOpenParms));
75
76 AmpOpenParms.usDeviceID = ( USHORT ) 0;
77 AmpOpenParms.pszDeviceType = ( PSZ ) MCI_DEVTYPE_AUDIO_AMPMIX;
78
79 rc = mymciSendCommand(0, MCI_OPEN,
80 MCI_WAIT | MCI_OPEN_TYPE_ID | MCI_OPEN_SHAREABLE,
81 (PVOID) &AmpOpenParms,
82 0);
83
84 if(rc) {
85 return 0; //no devices present
86 }
87
88 // Generic parameters
89 GenericParms.hwndCallback = 0; //hwndFrame
90
91 // Close the device
92 mymciSendCommand(AmpOpenParms.usDeviceID, MCI_CLOSE, MCI_WAIT, (PVOID)&GenericParms, 0);
93
94 return 1;
95}
96/******************************************************************************/
97//Called if waveOutSetVolume is called by the application with waveout handle NULL
98//Sets the default volume of each waveout stream (until it's volume is changed
99//with an appropriate waveOutSetVolume call)
100/******************************************************************************/
101void WaveOut::setDefaultVolume(ULONG volume)
102{
103 dprintf(("WaveOut::setDefaultVolume %x", volume));
104 defvolume = volume;
105}
106/******************************************************************************/
107/******************************************************************************/
108DWORD WaveOut::getDefaultVolume()
109{
110 return defvolume;
111}
112/******************************************************************************/
113/******************************************************************************/
114ULONG WaveOut::defvolume = 0xFFFFFFFF;
115
Note: See TracBrowser for help on using the repository browser.