[CLT2012]
[reactos.git] / dll / win32 / msgsm32.acm / msgsm32.c
1 /*
2 * GSM 06.10 codec handling
3 * Copyright (C) 2009 Maarten Lankhorst
4 *
5 * Based on msg711.acm
6 * Copyright (C) 2002 Eric Pouech
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 */
22
23 #include "config.h"
24 #include <wine/port.h>
25
26 #include <assert.h>
27 #include <stdarg.h>
28 #include <string.h>
29
30 #ifdef HAVE_GSM_GSM_H
31 #include <gsm/gsm.h>
32 #elif defined(HAVE_GSM_H)
33 #include <gsm.h>
34 #endif
35
36 #include "windef.h"
37 #include "winbase.h"
38 #include "wingdi.h"
39 #include "winuser.h"
40 #include "winnls.h"
41 #include "mmsystem.h"
42 #include "mmreg.h"
43 #include "msacm.h"
44 #include "msacmdrv.h"
45 #include "wine/library.h"
46 #include "wine/debug.h"
47
48 WINE_DEFAULT_DEBUG_CHANNEL(gsm);
49
50 #ifdef SONAME_LIBGSM
51
52 static void *libgsm_handle;
53 #define FUNCPTR(f) static typeof(f) * p##f
54 FUNCPTR(gsm_create);
55 FUNCPTR(gsm_destroy);
56 FUNCPTR(gsm_option);
57 FUNCPTR(gsm_encode);
58 FUNCPTR(gsm_decode);
59
60 #define LOAD_FUNCPTR(f) \
61 if((p##f = wine_dlsym(libgsm_handle, #f, NULL, 0)) == NULL) { \
62 wine_dlclose(libgsm_handle, NULL, 0); \
63 libgsm_handle = NULL; \
64 return 0; \
65 }
66
67 /***********************************************************************
68 * GSM_drvLoad
69 */
70 static LRESULT GSM_drvLoad(void)
71 {
72 char error[128];
73
74 libgsm_handle = wine_dlopen(SONAME_LIBGSM, RTLD_NOW, error, sizeof(error));
75 if (libgsm_handle)
76 {
77 LOAD_FUNCPTR(gsm_create);
78 LOAD_FUNCPTR(gsm_destroy);
79 LOAD_FUNCPTR(gsm_option);
80 LOAD_FUNCPTR(gsm_encode);
81 LOAD_FUNCPTR(gsm_decode);
82 return 1;
83 }
84 else
85 {
86 ERR("Couldn't load " SONAME_LIBGSM ": %s\n", error);
87 return 0;
88 }
89 }
90
91 /***********************************************************************
92 * GSM_drvFree
93 */
94 static LRESULT GSM_drvFree(void)
95 {
96 if (libgsm_handle)
97 wine_dlclose(libgsm_handle, NULL, 0);
98 return 1;
99 }
100
101 #else
102
103 static LRESULT GSM_drvFree(void)
104 {
105 return 1;
106 }
107
108 #endif
109
110 /***********************************************************************
111 * GSM_DriverDetails
112 *
113 */
114 static LRESULT GSM_DriverDetails(PACMDRIVERDETAILSW add)
115 {
116 add->fccType = ACMDRIVERDETAILS_FCCTYPE_AUDIOCODEC;
117 add->fccComp = ACMDRIVERDETAILS_FCCCOMP_UNDEFINED;
118 /* Details found from probing native msgsm32.acm */
119 add->wMid = MM_MICROSOFT;
120 add->wPid = 36;
121 add->vdwACM = 0x3320000;
122 add->vdwDriver = 0x4000000;
123 add->fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CODEC;
124 add->cFormatTags = 2;
125 add->cFilterTags = 0;
126 add->hicon = NULL;
127 MultiByteToWideChar( CP_ACP, 0, "Wine GSM 6.10", -1,
128 add->szShortName, sizeof(add->szShortName)/sizeof(WCHAR) );
129 MultiByteToWideChar( CP_ACP, 0, "Wine GSM 6.10 libgsm codec", -1,
130 add->szLongName, sizeof(add->szLongName)/sizeof(WCHAR) );
131 MultiByteToWideChar( CP_ACP, 0, "Brought to you by the Wine team...", -1,
132 add->szCopyright, sizeof(add->szCopyright)/sizeof(WCHAR) );
133 MultiByteToWideChar( CP_ACP, 0, "Refer to LICENSE file", -1,
134 add->szLicensing, sizeof(add->szLicensing)/sizeof(WCHAR) );
135 add->szFeatures[0] = 0;
136 return MMSYSERR_NOERROR;
137 }
138
139 /* Validate a WAVEFORMATEX structure */
140 static DWORD GSM_FormatValidate(const WAVEFORMATEX *wfx)
141 {
142 if (wfx->nChannels != 1)
143 return 0;
144
145 switch (wfx->wFormatTag)
146 {
147 case WAVE_FORMAT_PCM:
148 if (wfx->wBitsPerSample != 16)
149 {
150 WARN("PCM wBitsPerSample %u\n", wfx->wBitsPerSample);
151 return 0;
152 }
153 if (wfx->nBlockAlign != 2)
154 {
155 WARN("PCM nBlockAlign %u\n", wfx->nBlockAlign);
156 return 0;
157 }
158 if (wfx->nAvgBytesPerSec != wfx->nBlockAlign * wfx->nSamplesPerSec)
159 {
160 WARN("PCM nAvgBytesPerSec %u/%u\n",
161 wfx->nAvgBytesPerSec,
162 wfx->nBlockAlign * wfx->nSamplesPerSec);
163 return 0;
164 }
165 return 1;
166 case WAVE_FORMAT_GSM610:
167 if (wfx->cbSize < sizeof(WORD))
168 {
169 WARN("GSM cbSize %u\n", wfx->cbSize);
170 return 0;
171 }
172 if (wfx->wBitsPerSample != 0)
173 {
174 WARN("GSM wBitsPerSample %u\n", wfx->wBitsPerSample);
175 return 0;
176 }
177 if (wfx->nBlockAlign != 65)
178 {
179 WARN("GSM nBlockAlign %u\n", wfx->nBlockAlign);
180 return 0;
181 }
182 if (((const GSM610WAVEFORMAT*)wfx)->wSamplesPerBlock != 320)
183 {
184 WARN("GSM wSamplesPerBlock %u\n",
185 ((const GSM610WAVEFORMAT*)wfx)->wSamplesPerBlock);
186 return 0;
187 }
188 if (wfx->nAvgBytesPerSec != wfx->nSamplesPerSec * 65 / 320)
189 {
190 WARN("GSM nAvgBytesPerSec %d / %d\n",
191 wfx->nAvgBytesPerSec, wfx->nSamplesPerSec * 65 / 320);
192 return 0;
193 }
194 return 1;
195 default:
196 return 0;
197 }
198 return 0;
199 }
200
201 static const DWORD gsm_rates[] = { 8000, 11025, 22050, 44100, 48000, 96000 };
202 #define NUM_RATES (sizeof(gsm_rates)/sizeof(*gsm_rates))
203
204 /***********************************************************************
205 * GSM_FormatTagDetails
206 *
207 */
208 static LRESULT GSM_FormatTagDetails(PACMFORMATTAGDETAILSW aftd, DWORD dwQuery)
209 {
210 static const WCHAR szPcm[]={'P','C','M',0};
211 static const WCHAR szGsm[]={'G','S','M',' ','6','.','1','0',0};
212
213 switch (dwQuery)
214 {
215 case ACM_FORMATTAGDETAILSF_INDEX:
216 if (aftd->dwFormatTagIndex > 1) return ACMERR_NOTPOSSIBLE;
217 break;
218 case ACM_FORMATTAGDETAILSF_LARGESTSIZE:
219 if (aftd->dwFormatTag == WAVE_FORMAT_UNKNOWN)
220 {
221 aftd->dwFormatTagIndex = 1;
222 break;
223 }
224 /* fall thru */
225 case ACM_FORMATTAGDETAILSF_FORMATTAG:
226 switch (aftd->dwFormatTag)
227 {
228 case WAVE_FORMAT_PCM: aftd->dwFormatTagIndex = 0; break;
229 case WAVE_FORMAT_GSM610: aftd->dwFormatTagIndex = 1; break;
230 default: return ACMERR_NOTPOSSIBLE;
231 }
232 break;
233 default:
234 WARN("Unsupported query %08x\n", dwQuery);
235 return MMSYSERR_NOTSUPPORTED;
236 }
237
238 aftd->fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CODEC;
239 switch (aftd->dwFormatTagIndex)
240 {
241 case 0:
242 aftd->dwFormatTag = WAVE_FORMAT_PCM;
243 aftd->cbFormatSize = sizeof(PCMWAVEFORMAT);
244 aftd->cStandardFormats = NUM_RATES;
245 lstrcpyW(aftd->szFormatTag, szPcm);
246 break;
247 case 1:
248 aftd->dwFormatTag = WAVE_FORMAT_GSM610;
249 aftd->cbFormatSize = sizeof(GSM610WAVEFORMAT);
250 aftd->cStandardFormats = NUM_RATES;
251 lstrcpyW(aftd->szFormatTag, szGsm);
252 break;
253 }
254 return MMSYSERR_NOERROR;
255 }
256
257 /***********************************************************************
258 * GSM_FormatDetails
259 *
260 */
261 static LRESULT GSM_FormatDetails(PACMFORMATDETAILSW afd, DWORD dwQuery)
262 {
263 switch (dwQuery)
264 {
265 case ACM_FORMATDETAILSF_FORMAT:
266 if (!GSM_FormatValidate(afd->pwfx)) return ACMERR_NOTPOSSIBLE;
267 break;
268 case ACM_FORMATDETAILSF_INDEX:
269 afd->pwfx->wFormatTag = afd->dwFormatTag;
270 switch (afd->dwFormatTag)
271 {
272 case WAVE_FORMAT_PCM:
273 if (afd->dwFormatIndex >= NUM_RATES) return ACMERR_NOTPOSSIBLE;
274 afd->pwfx->nChannels = 1;
275 afd->pwfx->nSamplesPerSec = gsm_rates[afd->dwFormatIndex];
276 afd->pwfx->wBitsPerSample = 16;
277 afd->pwfx->nBlockAlign = 2;
278 afd->pwfx->nAvgBytesPerSec = afd->pwfx->nSamplesPerSec * afd->pwfx->nBlockAlign;
279 break;
280 case WAVE_FORMAT_GSM610:
281 if (afd->dwFormatIndex >= NUM_RATES) return ACMERR_NOTPOSSIBLE;
282 afd->pwfx->nChannels = 1;
283 afd->pwfx->nSamplesPerSec = gsm_rates[afd->dwFormatIndex];
284 afd->pwfx->wBitsPerSample = 0;
285 afd->pwfx->nBlockAlign = 65;
286 afd->pwfx->nAvgBytesPerSec = afd->pwfx->nSamplesPerSec * 65 / 320;
287 afd->pwfx->cbSize = sizeof(WORD);
288 ((GSM610WAVEFORMAT*)afd->pwfx)->wSamplesPerBlock = 320;
289 break;
290 default:
291 WARN("Unsupported tag %08x\n", afd->dwFormatTag);
292 return MMSYSERR_INVALPARAM;
293 }
294 break;
295 default:
296 WARN("Unsupported query %08x\n", dwQuery);
297 return MMSYSERR_NOTSUPPORTED;
298 }
299 afd->fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CODEC;
300 afd->szFormat[0] = 0; /* let MSACM format this for us... */
301
302 return MMSYSERR_NOERROR;
303 }
304
305 /***********************************************************************
306 * GSM_FormatSuggest
307 *
308 */
309 static LRESULT GSM_FormatSuggest(PACMDRVFORMATSUGGEST adfs)
310 {
311 /* some tests ... */
312 if (adfs->cbwfxSrc < sizeof(PCMWAVEFORMAT) ||
313 adfs->cbwfxDst < sizeof(PCMWAVEFORMAT) ||
314 !GSM_FormatValidate(adfs->pwfxSrc)) return ACMERR_NOTPOSSIBLE;
315 /* FIXME: should do those tests against the real size (according to format tag */
316
317 /* If no suggestion for destination, then copy source value */
318 if (!(adfs->fdwSuggest & ACM_FORMATSUGGESTF_NCHANNELS))
319 adfs->pwfxDst->nChannels = adfs->pwfxSrc->nChannels;
320 if (!(adfs->fdwSuggest & ACM_FORMATSUGGESTF_NSAMPLESPERSEC))
321 adfs->pwfxDst->nSamplesPerSec = adfs->pwfxSrc->nSamplesPerSec;
322
323 if (!(adfs->fdwSuggest & ACM_FORMATSUGGESTF_WBITSPERSAMPLE))
324 {
325 if (adfs->pwfxSrc->wFormatTag == WAVE_FORMAT_PCM)
326 adfs->pwfxDst->wBitsPerSample = 0;
327 else
328 adfs->pwfxDst->wBitsPerSample = 16;
329 }
330 if (!(adfs->fdwSuggest & ACM_FORMATSUGGESTF_WFORMATTAG))
331 {
332 switch (adfs->pwfxSrc->wFormatTag)
333 {
334 case WAVE_FORMAT_PCM: adfs->pwfxDst->wFormatTag = WAVE_FORMAT_GSM610; break;
335 case WAVE_FORMAT_GSM610: adfs->pwfxDst->wFormatTag = WAVE_FORMAT_PCM; break;
336 }
337 }
338
339 /* recompute other values */
340 switch (adfs->pwfxDst->wFormatTag)
341 {
342 case WAVE_FORMAT_PCM:
343 adfs->pwfxDst->nBlockAlign = 2;
344 adfs->pwfxDst->nAvgBytesPerSec = adfs->pwfxDst->nSamplesPerSec * 2;
345 break;
346 case WAVE_FORMAT_GSM610:
347 if (adfs->pwfxDst->cbSize < sizeof(WORD))
348 return ACMERR_NOTPOSSIBLE;
349 adfs->pwfxDst->nBlockAlign = 65;
350 adfs->pwfxDst->nAvgBytesPerSec = adfs->pwfxDst->nSamplesPerSec * 65 / 320;
351 ((GSM610WAVEFORMAT*)adfs->pwfxDst)->wSamplesPerBlock = 320;
352 break;
353 default:
354 return ACMERR_NOTPOSSIBLE;
355 }
356
357 /* check if result is ok */
358 if (!GSM_FormatValidate(adfs->pwfxDst)) return ACMERR_NOTPOSSIBLE;
359 return MMSYSERR_NOERROR;
360 }
361
362 #ifdef SONAME_LIBGSM
363 /***********************************************************************
364 * GSM_StreamOpen
365 *
366 */
367 static LRESULT GSM_StreamOpen(PACMDRVSTREAMINSTANCE adsi)
368 {
369 int used = 1;
370 gsm r;
371 if (!GSM_FormatValidate(adsi->pwfxSrc) || !GSM_FormatValidate(adsi->pwfxDst))
372 return MMSYSERR_NOTSUPPORTED;
373
374 if (adsi->pwfxSrc->nSamplesPerSec != adsi->pwfxDst->nSamplesPerSec)
375 return MMSYSERR_NOTSUPPORTED;
376
377 if (!GSM_drvLoad()) return MMSYSERR_NOTSUPPORTED;
378
379 r = pgsm_create();
380 if (!r)
381 return MMSYSERR_NOMEM;
382 if (pgsm_option(r, GSM_OPT_WAV49, &used) < 0)
383 {
384 FIXME("Your libgsm library doesn't support GSM_OPT_WAV49\n");
385 FIXME("Please recompile libgsm with WAV49 support\n");
386 pgsm_destroy(r);
387 return MMSYSERR_NOTSUPPORTED;
388 }
389 adsi->dwDriver = (DWORD_PTR)r;
390 return MMSYSERR_NOERROR;
391 }
392
393 /***********************************************************************
394 * GSM_StreamClose
395 *
396 */
397 static LRESULT GSM_StreamClose(PACMDRVSTREAMINSTANCE adsi)
398 {
399 pgsm_destroy((gsm)adsi->dwDriver);
400 return MMSYSERR_NOERROR;
401 }
402
403 /***********************************************************************
404 * GSM_StreamSize
405 *
406 */
407 static LRESULT GSM_StreamSize(const ACMDRVSTREAMINSTANCE *adsi, PACMDRVSTREAMSIZE adss)
408 {
409 switch (adss->fdwSize)
410 {
411 case ACM_STREAMSIZEF_DESTINATION:
412 /* cbDstLength => cbSrcLength */
413 if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_PCM &&
414 adsi->pwfxDst->wFormatTag == WAVE_FORMAT_GSM610)
415 {
416 adss->cbSrcLength = adss->cbDstLength / 65 * 640;
417 }
418 else if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_GSM610 &&
419 adsi->pwfxDst->wFormatTag == WAVE_FORMAT_PCM)
420 {
421 adss->cbSrcLength = adss->cbDstLength / 640 * 65;
422 }
423 else
424 {
425 return MMSYSERR_NOTSUPPORTED;
426 }
427 return MMSYSERR_NOERROR;
428 case ACM_STREAMSIZEF_SOURCE:
429 /* cbSrcLength => cbDstLength */
430 if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_PCM &&
431 adsi->pwfxDst->wFormatTag == WAVE_FORMAT_GSM610)
432 {
433 adss->cbDstLength = (adss->cbSrcLength + 639) / 640 * 65;
434 }
435 else if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_GSM610 &&
436 adsi->pwfxDst->wFormatTag == WAVE_FORMAT_PCM)
437 {
438 adss->cbDstLength = adss->cbSrcLength / 65 * 640;
439 }
440 else
441 {
442 return MMSYSERR_NOTSUPPORTED;
443 }
444 return MMSYSERR_NOERROR;
445 default:
446 WARN("Unsupported query %08x\n", adss->fdwSize);
447 return MMSYSERR_NOTSUPPORTED;
448 }
449 }
450
451 /***********************************************************************
452 * GSM_StreamConvert
453 *
454 */
455 static LRESULT GSM_StreamConvert(PACMDRVSTREAMINSTANCE adsi, PACMDRVSTREAMHEADER adsh)
456 {
457 gsm r = (gsm)adsi->dwDriver;
458 DWORD nsrc = 0;
459 DWORD ndst = 0;
460 BYTE *src = adsh->pbSrc;
461 BYTE *dst = adsh->pbDst;
462 int odd = 0;
463
464 if (adsh->fdwConvert &
465 ~(ACM_STREAMCONVERTF_BLOCKALIGN|
466 ACM_STREAMCONVERTF_END|
467 ACM_STREAMCONVERTF_START))
468 {
469 FIXME("Unsupported fdwConvert (%08x), ignoring it\n", adsh->fdwConvert);
470 }
471
472 /* Reset the index to 0, just to be sure */
473 pgsm_option(r, GSM_OPT_FRAME_INDEX, &odd);
474
475 /* The native ms codec writes 65 bytes, and this requires 2 libgsm calls.
476 * First 32 bytes are written, or 33 bytes read
477 * Second 33 bytes are written, or 32 bytes read
478 */
479
480 /* Decode */
481 if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_GSM610)
482 {
483 if (adsh->cbSrcLength / 65 * 640 > adsh->cbDstLength)
484 {
485 return ACMERR_NOTPOSSIBLE;
486 }
487
488 while (nsrc + 65 <= adsh->cbSrcLength)
489 {
490 /* Decode data */
491 if (pgsm_decode(r, src + nsrc, (gsm_signal*)(dst + ndst)) < 0)
492 FIXME("Couldn't decode data\n");
493 ndst += 320;
494 nsrc += 33;
495
496 if (pgsm_decode(r, src + nsrc, (gsm_signal*)(dst + ndst)) < 0)
497 FIXME("Couldn't decode data\n");
498 ndst += 320;
499 nsrc += 32;
500 }
501 }
502 else
503 {
504 /* Testing a little seems to reveal that despite being able to fit
505 * inside the buffer if ACM_STREAMCONVERTF_BLOCKALIGN is set
506 * it still rounds up
507 */
508 if ((adsh->cbSrcLength + 639) / 640 * 65 > adsh->cbDstLength)
509 {
510 return ACMERR_NOTPOSSIBLE;
511 }
512
513 /* The packing algorythm writes 32 bytes, then 33 bytes,
514 * and it seems to pad to align to 65 bytes always
515 * adding extra data where necessary
516 */
517 while (nsrc + 640 <= adsh->cbSrcLength)
518 {
519 /* Encode data */
520 pgsm_encode(r, (gsm_signal*)(src+nsrc), dst+ndst);
521 nsrc += 320;
522 ndst += 32;
523 pgsm_encode(r, (gsm_signal*)(src+nsrc), dst+ndst);
524 nsrc += 320;
525 ndst += 33;
526 }
527
528 /* If ACM_STREAMCONVERTF_BLOCKALIGN isn't set pad with zeros */
529 if (!(adsh->fdwConvert & ACM_STREAMCONVERTF_BLOCKALIGN) &&
530 nsrc < adsh->cbSrcLength)
531 {
532 char emptiness[320];
533 int todo = adsh->cbSrcLength - nsrc;
534
535 if (todo > 320)
536 {
537 pgsm_encode(r, (gsm_signal*)(src+nsrc), dst+ndst);
538 ndst += 32;
539 todo -= 320;
540 nsrc += 320;
541
542 memcpy(emptiness, src+nsrc, todo);
543 memset(emptiness + todo, 0, 320 - todo);
544 pgsm_encode(r, (gsm_signal*)emptiness, dst+ndst);
545 ndst += 33;
546 }
547 else
548 {
549 memcpy(emptiness, src+nsrc, todo);
550 memset(emptiness + todo, 0, 320 - todo);
551 pgsm_encode(r, (gsm_signal*)emptiness, dst+ndst);
552 ndst += 32;
553
554 memset(emptiness, 0, todo);
555 pgsm_encode(r, (gsm_signal*)emptiness, dst+ndst);
556 ndst += 33;
557 }
558 nsrc = adsh->cbSrcLength;
559 }
560 }
561
562 adsh->cbSrcLengthUsed = nsrc;
563 adsh->cbDstLengthUsed = ndst;
564 TRACE("%d(%d) -> %d(%d)\n", nsrc, adsh->cbSrcLength, ndst, adsh->cbDstLength);
565 return MMSYSERR_NOERROR;
566 }
567
568 #endif
569
570 /**************************************************************************
571 * GSM_DriverProc [exported]
572 */
573 LRESULT CALLBACK GSM_DriverProc(DWORD_PTR dwDevID, HDRVR hDriv, UINT wMsg,
574 LPARAM dwParam1, LPARAM dwParam2)
575 {
576 TRACE("(%08lx %p %04x %08lx %08lx);\n",
577 dwDevID, hDriv, wMsg, dwParam1, dwParam2);
578
579 switch (wMsg)
580 {
581 case DRV_LOAD: return 1;
582 case DRV_FREE: return GSM_drvFree();
583 case DRV_OPEN: return 1;
584 case DRV_CLOSE: return 1;
585 case DRV_ENABLE: return 1;
586 case DRV_DISABLE: return 1;
587 case DRV_QUERYCONFIGURE: return 1;
588 case DRV_CONFIGURE: MessageBoxA(0, "GSM 06.10 codec", "Wine Driver", MB_OK); return 1;
589 case DRV_INSTALL: return DRVCNF_RESTART;
590 case DRV_REMOVE: return DRVCNF_RESTART;
591
592 case ACMDM_DRIVER_NOTIFY:
593 /* no caching from other ACM drivers is done so far */
594 return MMSYSERR_NOERROR;
595
596 case ACMDM_DRIVER_DETAILS:
597 return GSM_DriverDetails((PACMDRIVERDETAILSW)dwParam1);
598
599 case ACMDM_FORMATTAG_DETAILS:
600 return GSM_FormatTagDetails((PACMFORMATTAGDETAILSW)dwParam1, dwParam2);
601
602 case ACMDM_FORMAT_DETAILS:
603 return GSM_FormatDetails((PACMFORMATDETAILSW)dwParam1, dwParam2);
604
605 case ACMDM_FORMAT_SUGGEST:
606 return GSM_FormatSuggest((PACMDRVFORMATSUGGEST)dwParam1);
607
608 #ifdef SONAME_LIBGSM
609 case ACMDM_STREAM_OPEN:
610 return GSM_StreamOpen((PACMDRVSTREAMINSTANCE)dwParam1);
611
612 case ACMDM_STREAM_CLOSE:
613 return GSM_StreamClose((PACMDRVSTREAMINSTANCE)dwParam1);
614
615 case ACMDM_STREAM_SIZE:
616 return GSM_StreamSize((PACMDRVSTREAMINSTANCE)dwParam1, (PACMDRVSTREAMSIZE)dwParam2);
617
618 case ACMDM_STREAM_CONVERT:
619 return GSM_StreamConvert((PACMDRVSTREAMINSTANCE)dwParam1, (PACMDRVSTREAMHEADER)dwParam2);
620 #else
621 case ACMDM_STREAM_OPEN: ERR("libgsm support not compiled in!\n");
622 case ACMDM_STREAM_CLOSE:
623 case ACMDM_STREAM_SIZE:
624 case ACMDM_STREAM_CONVERT:
625 return MMSYSERR_NOTSUPPORTED;
626 #endif
627
628 case ACMDM_HARDWARE_WAVE_CAPS_INPUT:
629 case ACMDM_HARDWARE_WAVE_CAPS_OUTPUT:
630 /* this converter is not a hardware driver */
631 case ACMDM_FILTERTAG_DETAILS:
632 case ACMDM_FILTER_DETAILS:
633 /* this converter is not a filter */
634 case ACMDM_STREAM_RESET:
635 /* only needed for asynchronous driver... we aren't, so just say it */
636 return MMSYSERR_NOTSUPPORTED;
637 case ACMDM_STREAM_PREPARE:
638 case ACMDM_STREAM_UNPREPARE:
639 /* nothing special to do here... so don't do anything */
640 return MMSYSERR_NOERROR;
641
642 default:
643 return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
644 }
645 }