1 | /* $Id: waveplay.cpp 142 2000-04-23 14:55:46Z ktk $ */
|
---|
2 |
|
---|
3 | /* SCCSID = %W% %E% */
|
---|
4 | /****************************************************************************
|
---|
5 | * *
|
---|
6 | * Copyright (c) IBM Corporation 1994 - 1997. *
|
---|
7 | * *
|
---|
8 | * The following IBM OS/2 source code is provided to you solely for the *
|
---|
9 | * the purpose of assisting you in your development of OS/2 device drivers. *
|
---|
10 | * You may use this code in accordance with the IBM License Agreement *
|
---|
11 | * provided in the IBM Device Driver Source Kit for OS/2. *
|
---|
12 | * *
|
---|
13 | ****************************************************************************/
|
---|
14 | /**@internal %W%
|
---|
15 | * @notes
|
---|
16 | * @version %I%
|
---|
17 | * @context Unless otherwise noted, all interfaces are Ring-0, 16-bit,
|
---|
18 | * <stack context>.
|
---|
19 | * @history
|
---|
20 | *
|
---|
21 | */
|
---|
22 | #define INCL_NOPMAPI
|
---|
23 | #include <os2.h>
|
---|
24 | #include <os2medef.h>
|
---|
25 | #include <os2mixer.h>
|
---|
26 | #include <audio.h>
|
---|
27 | #include "wavehw.hpp"
|
---|
28 | #include "wavestrm.hpp"
|
---|
29 | #include "stream.hpp"
|
---|
30 | #include "irq.hpp"
|
---|
31 | #include "iodelay.h"
|
---|
32 | #include <include.h>
|
---|
33 |
|
---|
34 | #include <ossidc.h>
|
---|
35 |
|
---|
36 | #define MUTE_ON 0x0000028F
|
---|
37 | #define MUTE_OFF 0x00000000
|
---|
38 |
|
---|
39 |
|
---|
40 | /******************************************************************************/
|
---|
41 | /* WavePlay_Irq_Handler */
|
---|
42 | /* This is the ISR for the WAVEPLAY object. All ISRs must be Global in nature.*/
|
---|
43 | /* This routine will be called by the IRQ object when it receives an interrupt*/
|
---|
44 | /* From the OS/2 kernal and the WAVEPLAY object has previously registered this*/
|
---|
45 | /* handler, (by calling the IRQ's bAddHandler member function) and enabled */
|
---|
46 | /* this handler. (by calling the IRQ's bEnableHandler member function) */
|
---|
47 | /* Updates added for Defect 190876. */
|
---|
48 | /* */
|
---|
49 | /******************************************************************************/
|
---|
50 | BOOL __far __loadds __saveregs WavePlay_Irq_Handler(void)
|
---|
51 | {
|
---|
52 | PWAVESTREAM pstream;
|
---|
53 |
|
---|
54 | // see if there is an active stream
|
---|
55 | pstream = (PWAVESTREAM)FindActiveStream(STREAM_WAVE_PLAY);
|
---|
56 | if (pstream) { // if there is an active stream
|
---|
57 | pstream->Process(); // call the active stream to
|
---|
58 | }
|
---|
59 |
|
---|
60 | return (1); // return Happy to the IRQ
|
---|
61 | }
|
---|
62 |
|
---|
63 | /******************************************************************************/
|
---|
64 | /* WAVEPLAY::Start(void) */
|
---|
65 | /* */
|
---|
66 | /******************************************************************************/
|
---|
67 | virtual int WAVEPLAY::Start(STREAM *stream)
|
---|
68 | {
|
---|
69 | return OSS16_StartStream(stream) != TRUE;
|
---|
70 | }
|
---|
71 |
|
---|
72 | /******************************************************************************/
|
---|
73 | /* WAVEPLAY::Stop(void) */
|
---|
74 | /* */
|
---|
75 | /******************************************************************************/
|
---|
76 | virtual int WAVEPLAY::Stop(STREAM *stream)
|
---|
77 | {
|
---|
78 | return OSS16_StopStream(stream) != TRUE;
|
---|
79 | }
|
---|
80 |
|
---|
81 | virtual void WAVEPLAY::ConfigDev(STREAM *stream, PWAVECONFIGINFO pConfigInfo)
|
---|
82 | {
|
---|
83 | FORMAT_INFO formatInfo;
|
---|
84 |
|
---|
85 | WAVEAUDIO::ConfigDev(stream, pConfigInfo);
|
---|
86 |
|
---|
87 | formatInfo.ulSampleRate = pConfigInfo->ulSampleRate;
|
---|
88 | formatInfo.ulBitsPerSample = pConfigInfo->ulBitsPerSample;
|
---|
89 | formatInfo.ulNumChannels = pConfigInfo->ulNumChannels;
|
---|
90 | formatInfo.ulDataType = pConfigInfo->ulDataType;
|
---|
91 | OSS16_StreamSetFormat(stream, (ULONG)&formatInfo);
|
---|
92 | }
|
---|
93 |
|
---|
94 | #pragma code_seg ("_inittext");
|
---|
95 | #pragma data_seg ("_initdata","endds");
|
---|
96 | /******************************************************************************/
|
---|
97 | /* WAVEPLAY::WAVEPLAY(USHORT PrimeDma, USHORT SecDma, USHORT Irq) */
|
---|
98 | /* The constructor, basicly passes the resources info up the stream to the */
|
---|
99 | /* "parent classes" and calles _vSetup which constructs all the resource */
|
---|
100 | /* class objects we need to run. */
|
---|
101 | /* */
|
---|
102 | /******************************************************************************/
|
---|
103 |
|
---|
104 | WAVEPLAY::WAVEPLAY():
|
---|
105 | WAVEAUDIO(AUDIOHW_WAVE_PLAY)
|
---|
106 | {
|
---|
107 | _vSetup();
|
---|
108 | }
|
---|