source: cmedia/trunk/Vsd/AudioIF/vsdmap.c@ 354

Last change on this file since 354 was 354, checked in by stevenhl, 17 years ago

Import untested baseline cmedia sources, work products and binaries
Binaries and work products should be deleted from repository.
once new builds are verified to work.

File size: 10.6 KB
Line 
1/***********************START OF SPECIFICATIONS ****************
2
3*
4* SOURCE FILE NAME: VSDMAP.C
5*
6* DESCRIPTIVE NAME: Ring 3 Amp/Mixer AUDIO Interface Driver
7*
8* COPYRIGHT: IBM Confidential
9* Copyright (c) IBM Corporation 1991
10* All Rights Reserved
11*
12* STATUS: OS/2 Release 2.0
13*
14* FUNCTION: This file contains a mapping from the old VSD layer to the
15* new VSD layer. It will be called by older MCDs. We maintain
16* this for compatibility purposes.
17*
18* NOTES:
19*
20* DATE DEVELOPER CHANGE DESCRIPTION
21* 07/28/93 Linden deCarmo File created
22*
23************************** END OF SPECIFICATIONS **************************/
24
25#define INCL_NOPMAPI
26#define INCL_DOS
27#define INCL_ERRORS
28#define INCL_RESOURCES
29#define INCL_AUDIO_VSD
30
31
32
33#include <os2.h>
34#include <os2me.h>
35#include <mcd.h>
36#include <audio.h>
37#include <stdio.h>
38#include <stdlib.h>
39#include <string.h>
40#include <hhpheap.h>
41
42#include <vsdcmds.h>
43#include <vsdaud.h>
44
45
46
47/************************ START OF SPECIFICATIONS **************************
48*
49* SUBROUTINE NAME: AUDIOIFIDriverEntry
50*
51* FUNCTION: Ring 3 entry point for AUDIOIF calls from Amp/Mixer
52*
53* INPUT: sMessage - request id
54* lParam1 - function specific value
55* lParam2 - function specific value
56* lParam3 - identifies caller (1 = Amp/Mixer, 0 = Audio MCI)
57*
58* OUTPUT: returns VSDERR_SUCCESS if successful, otherwise it returns an
59* MCI error code.
60
61*
62* OS/2 CALLS: None
63*
64* C CALLS: None
65*
66* Notes: This entry only maps known callers (i.e. MIDIMCD, Audio MCD etc.)
67* interfaces. If anyone calls another unsupported interface, they
68* are in deep trouble.
69*
70*************************** END OF SPECIFICATIONS *************************/
71
72ULONG APIENTRY AUDIOIFDriverEntry(PMCI_AMP_INSTANCE pInstance,
73 ULONG sMessage,
74 ULONG lParam1,
75 ULONG lParam2,
76 ULONG lParam3)
77
78 {
79 LONG lError = VSDERR_SUCCESS;
80
81 if ( sMessage == MCI_SET )
82 {
83 lError = WaveMap( pInstance, lParam1, lParam2 );
84 }
85
86// switch(sMessage)
87// {
88// /*---------------------------------------------------------*
89// * STATUS message received
90// *---------------------------------------------------------*/
91//
92//// case MCI_STATUS:
93//// lError = StatusMap(pInstance, lParam2, lParam3);
94////
95//// break;
96// /*---------------------------------------------------------*
97// * SET message received
98// *---------------------------------------------------------*/
99//
100// case MCI_SET:
101// /*-------------------------------------------------*
102// * Map request to manipulate audio data types
103// *-------------------------------------------------*/
104//
105// lError = WaveMap( pInstance,
106// lParam1,
107// lParam2 );
108// break;
109// /*---------------------------------------------------------*
110// * GETDEVCAPS message received
111// *---------------------------------------------------------*/
112//
113//// case MCI_GETDEVCAPS:
114//// lError = CapsMap( pInstance,
115//// lParam1,
116//// (ULONG *) lParam2,
117//// lParam3 );
118//
119// break;
120// /*---------------------------------------------------------*
121// * MCI_SEQ_STATUS_TEMPO message received
122// *---------------------------------------------------------*/
123//
124//// case MCI_SEQ_STATUS_TEMPO:
125//// lError = VSDERR_UNSUPPORTED_FUNCTION;
126////
127//// break;
128//
129// }
130
131 return(lError);
132 }
133
134
135
136
137/************************ START OF SPECIFICATIONS **************************
138*
139* SUBROUTINE NAME: Wave_Driver
140*
141* FUNCTION: Sets waveform attributes (Sample rate, bits per sample, etc)
142*
143* INPUT: pInstance - pointer to Amp Instance structure
144* lParam1 - pointer to MCI_WAVE_SET_PARMS structure
145*
146* OUTPUT: returns VSDERR_SUCCESS if successful, otherwise it returns an
147* MCI error code.
148*
149* OS/2 CALLS: DosDevIOCtl(), DosOpen(), DosClose(), DosQueryFileInfo()
150* DosAllocSharedMem(), DosFreeMem()
151*
152* C CALLS: None.
153*
154*
155*************************** END OF SPECIFICATIONS *************************/
156
157LONG WaveMap( PMCI_AMP_INSTANCE pInstance,
158 ULONG lParam1,
159 ULONG lParam2)
160
161{
162 LONG lError = VSDERR_SUCCESS;
163
164// ULONG ulResourceDecrease;
165// ULONG ulResourceChange = FALSE;
166// ULONG ulOldResources = pInstance->ulResourcesUsed;
167// ULONG ulOldClass = pInstance->ulClass;
168// ULONG ulMatch;
169
170
171// MCI_AMP_INSTANCE TempAmp;
172
173// MCIDRV_CHANGERESOURCE_PARMS mciChangeResource;
174
175 LPMCI_WAVE_SET_PARMS prWaveSet;
176
177 VSD_AUDIODATATYPE_PARMS AudioDatatype;
178
179
180 prWaveSet = (LPMCI_WAVE_SET_PARMS) lParam2;
181
182
183 AudioDatatype.ulDataType = prWaveSet->wFormatTag;
184 AudioDatatype.ulBitsPerSample = prWaveSet->wBitsPerSample;
185 AudioDatatype.ulSamplingRate = prWaveSet->nSamplesPerSec;
186 AudioDatatype.ulChannels = prWaveSet->nChannels;
187 AudioDatatype.ulFlags = lParam1;
188
189 lError = VSDSetCommand( pInstance, VSD_SETDATATYPE, &AudioDatatype );
190
191 pInstance->sBestFitMode = DATATYPE_WAVEFORM;
192 pInstance->ulBestFitBPS = AudioDatatype.ulBitsPerSample;
193 pInstance->ulBestFitChan = AudioDatatype.ulChannels;
194 pInstance->ulBestFitRate = AudioDatatype.ulSamplingRate;
195
196
197 return(lError);
198
199} /* VSDWave */
200
201
202
203
204///************************ START OF SPECIFICATIONS **************************
205//*
206//* SUBROUTINE NAME: Status_Driver()
207//*
208//* FUNCTION: Sends audio status IOCTL request to PDD
209//*
210//* INPUT: pInstance - pointer to AMP/Mixer instance structure
211//* lParam1 - flag indicating what info to return
212//* lParam2 - pointer to MCI_STATUS_PARMS structure
213//* lParam3 - indicates who made the request (0 - Audio MCD, 1 = AMP)
214//*
215//* OUTPUT: returns VSDERR_SUCCESS if successful, otherwise it returns an
216//* MCI error code.
217//*
218//* OS/2 CALLS: DosDevIOCtl()
219//*
220//* C CALLS: None
221//*
222//* INTERNAL CALLS: MCI_Error()
223//*
224//*************************** END OF SPECIFICATIONS *************************/
225//
226//LONG StatusMap( PMCI_AMP_INSTANCE pInstance,
227// ULONG lParam2,
228// ULONG lParam3)
229//{
230//
231// LONG lError = VSDERR_SUCCESS;
232// LPMCI_STATUS_PARMS prStatusParms;
233//
234//
235// prStatusParms = (LPMCI_STATUS_PARMS) lParam2;
236//
237// /*-----------------------------------------------------------------*
238// * Transfer requested status info to Status Parms structure
239// *-----------------------------------------------------------------*/
240//
241// switch(prStatusParms->dwItem)
242// {
243//
244// case MCI_STATUS_READY:
245// if ( pInstance->ulActive )
246// {
247// prStatusParms->dwReturn = MCI_TRUE;
248// }
249// else
250// {
251// prStatusParms->dwReturn = MCI_FALSE;
252// }
253// lError = MAKEULONG(lError, MCI_TRUE_FALSE_RETURN);
254// break;
255// case MCI_STATUS_CURRENT_TRACK:
256// // return some bogus number to remain compatible
257// // with the redmondians
258// prStatusParms->dwReturn = 1;
259// lError = MAKEULONG(lError, MCI_INTEGER_RETURNED);
260// break;
261//
262// default:
263// lError = VSDERR_INVALID_ITEM_FLAG;
264// prStatusParms->dwReturn = 0L;
265// lError = MAKEULONG(lError, MCI_INTEGER_RETURNED);
266// break;
267// }
268//
269//
270// return(lError);
271//
272///* StatusMap */
273
274// removed because all MCI drivers were updated.
275
276/************************ START OF SPECIFICATIONS **************************
277*
278* SUBROUTINE NAME: DevCaps_Driver
279*
280* FUNCTION: Returns device capabilities
281*
282* INPUT: lParam1 - type of capability
283* lParam2 - pointer to LONG variable to receive capability
284*
285* OUTPUT: returns VSDERR_SUCCESS if successful, otherwise it returns an
286* MCI error code.
287*
288* OS/2 CALLS: None.
289*
290* C CALLS: None.
291*
292* INTERNAL CALLS: None.
293*
294*************************** END OF SPECIFICATIONS *************************/
295
296//LONG CapsMap( PMCI_AMP_INSTANCE pInstance,
297// ULONG lParam1,
298// ULONG *lParam2,
299// ULONG ulCaller )
300//{
301// LONG lError = VSDERR_SUCCESS;
302// MCI_AMP_INSTANCE TempAmp;
303// ULONG ulrc;
304// PMCI_WAVE_GETDEVCAPS_PARMS pAudioCaps;
305//
306//
307//
308//
309// if ( lParam1 == MCI_GETDEVCAPS_CAN_RECORD )
310// {
311// *lParam2 = pInstance->ulCanRecord;
312// ulrc = VSDERR_SUCCESS;
313// }
314// else if (lParam1 == MCI_GETDEVCAPS_WAVE_FORMAT )
315// {
316// pAudioCaps = ( PMCI_WAVE_GETDEVCAPS_PARMS ) *lParam2;
317//
318// memmove ( &TempAmp, pInstance, sizeof( MCI_AMP_INSTANCE ) );
319//
320// TempAmp.lSRate = ( LONG ) pAudioCaps->ulSamplesPerSec;
321// TempAmp.sMode = ( SHORT ) pAudioCaps->ulFormatTag;
322// TempAmp.lBitsPerSRate = ( LONG ) pAudioCaps->ulBitsPerSample;
323// TempAmp.sChannels = ( LONG ) pAudioCaps->ulChannels;
324//
325// if ( pAudioCaps->ulFormatMode == MCI_PLAY )
326// TempAmp.ulOperation = OPERATION_PLAY;
327// else
328// TempAmp.ulOperation = OPERATION_RECORD;
329//
330// /*-----------------------------------------------------------------*
331// * Return the resource class and number of resource units for the
332// * mode that the caller has specified.
333// *-----------------------------------------------------------------*/
334//
335// ulrc = GetClassInformation( &TempAmp );
336//
337// pAudioCaps->ulReturn = !ulrc;
338//
339//
340// } /* wave format request */
341//
342// return ( MAKEULONG(ulrc, MCI_TRUE_FALSE_RETURN) );
343//
344//} /* DevCapsMap */
Note: See TracBrowser for help on using the repository browser.