- fix the class name, vbox guest additions installer proceeds a bit further now
[reactos.git] / reactos / dll / directx / dsound / dxroslayer / dxrosdrv_querydsounddesc.c
1 /*
2 * reactos emulation layer betwin wine and windows api for directx
3 * get hardware dec
4 * Copyright 2004 Magnus Olsen
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 * TODO:
21 * soucre clean
22 * need to rewrite almost everthing so it get all info from the hardware instead
23 * see todo.rtf
24 *
25 * put it in own library that call dxroslayer.a
26 *
27 */
28
29 #include "config.h"
30 #include "wine/port.h"
31
32 #include <assert.h>
33 #include <stdarg.h>
34 #include <stdio.h>
35 #include <sys/types.h>
36 #include <sys/fcntl.h>
37 #ifdef HAVE_UNISTD_H
38 # include <unistd.h>
39 #endif
40 #include <stdlib.h>
41 #include <string.h>
42 #include <math.h>
43
44 #define NONAMELESSSTRUCT
45 #define NONAMELESSUNION
46 #include "windef.h"
47 #include "winbase.h"
48 #include "winreg.h"
49 #include "winuser.h"
50 #include "wingdi.h"
51 #include "winuser.h"
52 #include "winerror.h"
53 #include "mmsystem.h"
54 #include "winternl.h"
55 #include "mmddk.h"
56 #include "wine/windef16.h"
57 #include "wine/winbase16.h"
58 #include "wine/debug.h"
59 #include "dsound.h"
60 #include "dsdriver.h"
61 #include "dxros_layer.h"
62 #include "dsconf.h"
63
64 WINE_DEFAULT_DEBUG_CHANNEL(dsound);
65
66 DWORD dxrosdrv_drv_querydsounddescss(int type, HWAVEOUT hwo_out,HWAVEIN hwo_in, PDSDRIVERDESC pDESC)
67 {
68 WAVEOUTCAPSA ac_play;
69 WAVEINCAPSA ac_rec;
70 DWORD msg;
71
72
73
74 // type 0 = out
75 // clear data
76 memset(pDESC,0,sizeof(DSDRIVERDESC));
77 memset((char *)pDESC->szDrvname,0,255);
78 if (type==0) memset(&ac_play,0,sizeof(WAVEOUTCAPSA));
79 else memset(&ac_rec,0,sizeof(WAVEINCAPSA));
80
81 // get some data
82 if (type==0) {
83 msg = waveOutGetDevCapsA((UINT)hwo_out,&ac_play,sizeof(WAVEOUTCAPSA));
84 if (ac_play.szPname==NULL) return MMSYSERR_NOTSUPPORTED;
85 }
86
87 else {
88 msg = waveInGetDevCapsA((UINT)hwo_in,&ac_rec,sizeof(WAVEINCAPSA));
89 if (ac_rec.szPname==NULL) return MMSYSERR_NOTSUPPORTED;
90 }
91
92 if (msg!=MMSYSERR_NOERROR) return msg;
93
94
95
96 // setting up value
97 //pDESC->wReserved = NULL;
98
99
100 if (type==0) {
101 pDESC->ulDeviceNum = (ULONG)hwo_out;
102 memcpy((char *)pDESC->szDesc,ac_play.szPname,strlen(ac_play.szPname));
103 }
104 else {
105 pDESC->ulDeviceNum = (ULONG)hwo_in;
106 memcpy((char *)pDESC->szDesc,ac_rec.szPname,strlen(ac_rec.szPname));
107 }
108
109 // FIXME
110 /* how to fill these
111 pDESC->dwFlags |= DSDDESC_DOMMSYSTEMOPEN | DSDDESC_DOMMSYSTEMSETFORMAT |
112 DSDDESC_USESYSTEMMEMORY | DSDDESC_DONTNEEDPRIMARYLOCK |
113 DSDDESC_DONTNEEDSECONDARYLOCK;
114 //pDesc->dnDevNode = WOutDev[This->wDevID].waveDesc.dnDevNode;
115 pDESC->wVxdId = 0;
116 pDESC->wReserved = 0;
117 pDESC->dwHeapType = DSDHEAP_NOHEAP;
118 pDESC->pvDirectDrawHeap = NULL;
119 pDESC->dwMemStartAddress = 0;
120 pDESC->dwMemEndAddress = 0;
121 pDESC->dwMemAllocExtra = 0;
122 pDESC->pvReserved1 = NULL;
123 pDESC->pvReserved2 = NULL;
124
125 */
126
127 pDESC->pvReserved1 = NULL;
128 pDESC->pvReserved2 = NULL;
129
130 // we need to fill it right so we do not need ddraw.dll
131 pDESC->pvDirectDrawHeap = NULL; // wine dsound does not use ddraw.dll
132
133
134 // need to write dective for it
135 pDESC->dwHeapType = DSDHEAP_NOHEAP;
136
137 // have take the value from wine audio drv
138 pDESC->dwFlags = DSDDESC_DOMMSYSTEMOPEN |
139 DSDDESC_DOMMSYSTEMSETFORMAT |
140 DSDDESC_USESYSTEMMEMORY |
141 DSDDESC_DONTNEEDPRIMARYLOCK |
142 DSDDESC_DONTNEEDSECONDARYLOCK;
143
144
145 //WAVEOPENDESC->DevNode need to fig. how to get it from mmdrv
146 pDESC->dnDevNode = 0; // wine dsound are using this value
147
148 // need to fill the rest also
149
150 // must contain the audio drv name
151 // but how to get it ?
152 //memcpy((char *)pDESC->szDrvname,(char *)&"kx.sys",6);
153
154
155
156 pDESC->dwMemStartAddress = 0;
157 pDESC->dwMemAllocExtra = 0;
158 pDESC->wVxdId = 0;
159
160
161 return MMSYSERR_NOERROR;
162 }
163