[142] | 1 | /* $Id: waverec.cpp 561 2011-07-28 09:16:56Z rudi $ */
|
---|
| 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 | /* WaveRec_Irq_Handler */
|
---|
| 42 | /* This is the ISR for the WAVEREC 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 WAVEREC 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 WaveRec_Irq_Handler(void)
|
---|
| 51 | {
|
---|
| 52 | PWAVESTREAM pstream;
|
---|
| 53 |
|
---|
| 54 | // see if there is an active stream
|
---|
| 55 | pstream = (PWAVESTREAM)FindActiveStream(STREAM_WAVE_CAPTURE);
|
---|
| 56 | if (pstream) { // if there is an active stream
|
---|
| 57 |
|
---|
| 58 | pstream->Process(); // call the active stream to
|
---|
| 59 | }
|
---|
| 60 | return (1); // return Happy to the IRQ
|
---|
| 61 | }
|
---|
| 62 |
|
---|
| 63 | /******************************************************************************/
|
---|
| 64 | /* WAVEREC::Start(void) */
|
---|
| 65 | /* */
|
---|
| 66 | /******************************************************************************/
|
---|
[561] | 67 | int WAVEREC::Start(STREAM *stream)
|
---|
[142] | 68 | {
|
---|
| 69 | return OSS16_StartStream(stream) != TRUE;
|
---|
| 70 | }
|
---|
| 71 |
|
---|
| 72 | /******************************************************************************/
|
---|
| 73 | /* WAVEREC::Stop(void) */
|
---|
| 74 | /* */
|
---|
| 75 | /******************************************************************************/
|
---|
[561] | 76 | int WAVEREC::Stop(STREAM *stream)
|
---|
[142] | 77 | {
|
---|
| 78 | return OSS16_StopStream(stream) != TRUE;
|
---|
| 79 | }
|
---|
| 80 |
|
---|
[561] | 81 | void WAVEREC::ConfigDev(STREAM *stream, PWAVECONFIGINFO pConfigInfo)
|
---|
[142] | 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 | /* WAVEREC::WAVEREC(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 | WAVEREC::WAVEREC():
|
---|
| 105 | WAVEAUDIO(AUDIOHW_WAVE_CAPTURE)
|
---|
| 106 | {
|
---|
| 107 | _vSetup();
|
---|
| 108 |
|
---|
| 109 | }
|
---|
| 110 |
|
---|