| 1 | /* $Id: waverec.cpp,v 1.1 2000/04/23 14:55:22 ktk Exp $ */
|
|---|
| 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 |
|
|---|
| 51 | /*
|
|---|
| 52 | BOOL __far __loadds __saveregs WaveRec_Irq_Handler(void)
|
|---|
| 53 | {
|
|---|
| 54 | PWAVESTREAM pstream;
|
|---|
| 55 |
|
|---|
| 56 | // see if there is an active stream
|
|---|
| 57 | pstream = (PWAVESTREAM)FindActiveStream(STREAM_WAVE_CAPTURE);
|
|---|
| 58 | if (pstream) { // if there is an active stream
|
|---|
| 59 |
|
|---|
| 60 | pstream->Process(); // call the active stream to
|
|---|
| 61 | }
|
|---|
| 62 | return (1); // return Happy to the IRQ
|
|---|
| 63 | }
|
|---|
| 64 | */
|
|---|
| 65 |
|
|---|
| 66 | /******************************************************************************/
|
|---|
| 67 | /* WAVEREC::Start(void) */
|
|---|
| 68 | /* */
|
|---|
| 69 | /******************************************************************************/
|
|---|
| 70 | virtual int WAVEREC::Start(STREAM *stream)
|
|---|
| 71 | {
|
|---|
| 72 | return OSS16_StartStream(stream) != TRUE;
|
|---|
| 73 | }
|
|---|
| 74 |
|
|---|
| 75 | /******************************************************************************/
|
|---|
| 76 | /* WAVEREC::Stop(void) */
|
|---|
| 77 | /* */
|
|---|
| 78 | /******************************************************************************/
|
|---|
| 79 | virtual int WAVEREC::Stop(STREAM *stream)
|
|---|
| 80 | {
|
|---|
| 81 | return OSS16_StopStream(stream) != TRUE;
|
|---|
| 82 | }
|
|---|
| 83 |
|
|---|
| 84 | virtual void WAVEREC::ConfigDev(STREAM *stream, PWAVECONFIGINFO pConfigInfo)
|
|---|
| 85 | {
|
|---|
| 86 | FORMAT_INFO formatInfo;
|
|---|
| 87 |
|
|---|
| 88 | WAVEAUDIO::ConfigDev(stream, pConfigInfo);
|
|---|
| 89 |
|
|---|
| 90 | formatInfo.ulSampleRate = pConfigInfo->ulSampleRate;
|
|---|
| 91 | formatInfo.ulBitsPerSample = pConfigInfo->ulBitsPerSample;
|
|---|
| 92 | formatInfo.ulNumChannels = pConfigInfo->ulNumChannels;
|
|---|
| 93 | formatInfo.ulDataType = pConfigInfo->ulDataType;
|
|---|
| 94 | OSS16_StreamSetFormat(stream, (ULONG)&formatInfo);
|
|---|
| 95 | }
|
|---|
| 96 |
|
|---|
| 97 | #pragma code_seg ("_inittext");
|
|---|
| 98 | #pragma data_seg ("_initdata","endds");
|
|---|
| 99 | /******************************************************************************/
|
|---|
| 100 | /* WAVEREC::WAVEREC(USHORT PrimeDma, USHORT SecDma, USHORT Irq) */
|
|---|
| 101 | /* The constructor, basicly passes the resources info up the stream to the */
|
|---|
| 102 | /* "parent classes" and calles _vSetup which constructs all the resource */
|
|---|
| 103 | /* class objects we need to run. */
|
|---|
| 104 | /* */
|
|---|
| 105 | /******************************************************************************/
|
|---|
| 106 |
|
|---|
| 107 | WAVEREC::WAVEREC():
|
|---|
| 108 | WAVEAUDIO(AUDIOHW_WAVE_CAPTURE)
|
|---|
| 109 | {
|
|---|
| 110 | _vSetup();
|
|---|
| 111 |
|
|---|
| 112 | }
|
|---|
| 113 |
|
|---|