Revision c0fe3827 audio/dsound_template.h

b/audio/dsound_template.h
47 47

  
48 48
    hr = glue (IFACE, _Unlock) (buf, p1, blen1, p2, blen2);
49 49
    if (FAILED (hr)) {
50
        dsound_logerr (hr, "Can not unlock " NAME "\n");
50
        dsound_logerr (hr, "Could not unlock " NAME "\n");
51 51
        return -1;
52 52
    }
53 53

  
......
93 93
#ifndef DSBTYPE_IN
94 94
            if (hr == DSERR_BUFFERLOST) {
95 95
                if (glue (dsound_restore_, TYPE) (buf)) {
96
                    dsound_logerr (hr, "Can not lock " NAME "\n");
96
                    dsound_logerr (hr, "Could not lock " NAME "\n");
97 97
                    goto fail;
98 98
                }
99 99
                continue;
100 100
            }
101 101
#endif
102
            dsound_logerr (hr, "Can not lock " NAME "\n");
102
            dsound_logerr (hr, "Could not lock " NAME "\n");
103 103
            goto fail;
104 104
        }
105 105

  
......
158 158
    if (ds->FIELD) {
159 159
        hr = glue (IFACE, _Stop) (ds->FIELD);
160 160
        if (FAILED (hr)) {
161
            dsound_logerr (hr, "Can not stop " NAME "\n");
161
            dsound_logerr (hr, "Could not stop " NAME "\n");
162 162
        }
163 163

  
164 164
        hr = glue (IFACE, _Release) (ds->FIELD);
165 165
        if (FAILED (hr)) {
166
            dsound_logerr (hr, "Can not release " NAME "\n");
166
            dsound_logerr (hr, "Could not release " NAME "\n");
167 167
        }
168 168
        ds->FIELD = NULL;
169 169
    }
170 170
}
171 171

  
172 172
#ifdef DSBTYPE_IN
173
static int dsound_init_in (
174
    HWVoiceIn *hw,
175
    int freq,
176
    int nchannels,
177
    audfmt_e fmt
178
    )
173
static int dsound_init_in (HWVoiceIn *hw, audsettings_t *as)
179 174
#else
180
static int dsound_init_out (
181
    HWVoiceOut *hw,
182
    int freq,
183
    int nchannels,
184
    audfmt_e fmt
185
    )
175
static int dsound_init_out (HWVoiceOut *hw, audsettings_t *as)
186 176
#endif
187 177
{
188 178
    int err;
189 179
    HRESULT hr;
190 180
    dsound *s = &glob_dsound;
191 181
    WAVEFORMATEX wfx;
192
    struct full_fmt full_fmt;
182
    audsettings_t obt_as;
193 183
#ifdef DSBTYPE_IN
194 184
    const char *typ = "ADC";
195 185
    DSoundVoiceIn *ds = (DSoundVoiceIn *) hw;
......
202 192
    DSBCAPS bc;
203 193
#endif
204 194

  
205
    full_fmt.freq = freq;
206
    full_fmt.nchannels = nchannels;
207
    full_fmt.fmt = fmt;
208
    err = waveformat_from_full_fmt (&wfx, &full_fmt);
195
    err = waveformat_from_audio_settings (&wfx, as);
209 196
    if (err) {
210 197
        return -1;
211 198
    }
......
233 220
#endif
234 221

  
235 222
    if (FAILED (hr)) {
236
        dsound_logerr2 (hr, typ, "Can not create " NAME "\n");
223
        dsound_logerr2 (hr, typ, "Could not create " NAME "\n");
237 224
        return -1;
238 225
    }
239 226

  
240
    hr = glue (IFACE, _GetFormat) (
241
        ds->FIELD,
242
        &wfx,
243
        sizeof (wfx),
244
        NULL
245
        );
227
    hr = glue (IFACE, _GetFormat) (ds->FIELD, &wfx, sizeof (wfx), NULL);
246 228
    if (FAILED (hr)) {
247
        dsound_logerr2 (hr, typ, "Can not get " NAME " format\n");
229
        dsound_logerr2 (hr, typ, "Could not get " NAME " format\n");
248 230
        goto fail0;
249 231
    }
250 232

  
......
258 240

  
259 241
    hr = glue (IFACE, _GetCaps) (ds->FIELD, &bc);
260 242
    if (FAILED (hr)) {
261
        dsound_logerr2 (hr, typ, "Can not get " NAME " format\n");
243
        dsound_logerr2 (hr, typ, "Could not get " NAME " format\n");
262 244
        goto fail0;
263 245
    }
264 246

  
265
    err = waveformat_to_full_fmt (&wfx, &full_fmt);
247
    err = waveformat_to_audio_settings (&wfx, &obt_as);
266 248
    if (err) {
267 249
        goto fail0;
268 250
    }
269 251

  
270 252
    ds->first_time = 1;
271
    hw->bufsize = bc.dwBufferBytes;
272
    audio_pcm_init_info (
273
        &hw->info,
274
        full_fmt.freq,
275
        full_fmt.nchannels,
276
        full_fmt.fmt,
277
        audio_need_to_swap_endian (0)
278
        );
253

  
254
    audio_pcm_init_info (&hw->info, &obt_as, audio_need_to_swap_endian (0));
255

  
256
    if (bc.dwBufferBytes & hw->info.align) {
257
        dolog (
258
            "GetCaps returned misaligned buffer size %ld, alignment %d\n",
259
            bc.dwBufferBytes, hw->info.align + 1
260
            );
261
    }
262
    hw->samples = bc.dwBufferBytes >> hw->info.shift;
279 263

  
280 264
#ifdef DEBUG_DSOUND
281 265
    dolog ("caps %ld, desc %ld\n",
282 266
           bc.dwBufferBytes, bd.dwBufferBytes);
283 267

  
284 268
    dolog ("bufsize %d, freq %d, chan %d, fmt %d\n",
285
           hw->bufsize, full_fmt.freq, full_fmt.nchannels, full_fmt.fmt);
269
           hw->bufsize, settings.freq, settings.nchannels, settings.fmt);
286 270
#endif
287 271
    return 0;
288 272

  

Also available in: Unified diff