~jderose/ubuntu/raring/qemu/vde-again

« back to all changes in this revision

Viewing changes to audio/dsoundaudio.c

  • Committer: Bazaar Package Importer
  • Author(s): Aurelien Jarno, Aurelien Jarno
  • Date: 2009-03-07 06:20:34 UTC
  • mfrom: (1.1.9 upstream)
  • mto: This revision was merged to the branch mainline in revision 7.
  • Revision ID: james.westby@ubuntu.com-20090307062034-i3pead4mw653v2el
Tags: 0.10.0-1
[ Aurelien Jarno ]
* New upstream release:
  - Fix fr-be keyboard mapping (closes: bug#514462).
  - Fix stat64 structure on ppc-linux-user (closes: bug#470231).
  - Add a chroot option (closes: bug#415996).
  - Add evdev support (closes: bug#513210).
  - Fix loop on symlinks in user mode (closes: bug#297572).
  - Bump depends on openbios-sparc.
  - Depends on openbios-ppc.
  - Update 12_signal_powerpc_support.patch.
  - Update 21_net_soopts.patch.
  - Drop 44_socklen_t_check.patch (merged upstream).
  - Drop 49_null_check.patch (merged upstream).
  - Update 64_ppc_asm_constraints.patch.
  - Drop security/CVE-2008-0928-fedora.patch (merged upstream).
  - Drop security/CVE-2007-5730.patch (merged upstream).
* patches/80_stable-branch.patch: add patches from stable branch:
  - Fix race condition between signal handler/execution loop (closes:
    bug#474386, bug#501731).
* debian/copyright: update.
* Compile and install .dtb files:
  - debian/control: build-depends on device-tree-compiler.
  - debian/patches/81_compile_dtb.patch: new patch from upstream.
  - debian/rules: compile and install bamboo.dtb and mpc8544.dtb.

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
    int set_primary;
48
48
    int bufsize_in;
49
49
    int bufsize_out;
50
 
    audsettings_t settings;
 
50
    struct audsettings settings;
51
51
    int latency_millis;
52
52
} conf = {
53
53
    1,
68
68
    LPDIRECTSOUND dsound;
69
69
    LPDIRECTSOUNDCAPTURE dsound_capture;
70
70
    LPDIRECTSOUNDBUFFER dsound_primary_buffer;
71
 
    audsettings_t settings;
 
71
    struct audsettings settings;
72
72
} dsound;
73
73
 
74
74
static dsound glob_dsound;
307
307
    return -1;
308
308
}
309
309
 
310
 
static int waveformat_from_audio_settings (WAVEFORMATEX *wfx, audsettings_t *as)
 
310
static int waveformat_from_audio_settings (WAVEFORMATEX *wfx,
 
311
                                           struct audsettings *as)
311
312
{
312
313
    memset (wfx, 0, sizeof (*wfx));
313
314
 
320
321
 
321
322
    switch (as->fmt) {
322
323
    case AUD_FMT_S8:
323
 
        wfx->wBitsPerSample = 8;
324
 
        break;
325
 
 
326
324
    case AUD_FMT_U8:
327
325
        wfx->wBitsPerSample = 8;
328
326
        break;
329
327
 
330
328
    case AUD_FMT_S16:
331
 
        wfx->wBitsPerSample = 16;
332
 
        wfx->nAvgBytesPerSec <<= 1;
333
 
        wfx->nBlockAlign <<= 1;
334
 
        break;
335
 
 
336
329
    case AUD_FMT_U16:
337
330
        wfx->wBitsPerSample = 16;
338
331
        wfx->nAvgBytesPerSec <<= 1;
339
332
        wfx->nBlockAlign <<= 1;
340
333
        break;
341
334
 
 
335
    case AUD_FMT_S32:
 
336
    case AUD_FMT_U32:
 
337
        wfx->wBitsPerSample = 32;
 
338
        wfx->nAvgBytesPerSec <<= 2;
 
339
        wfx->nBlockAlign <<= 2;
 
340
        break;
 
341
 
342
342
    default:
343
343
        dolog ("Internal logic error: Bad audio format %d\n", as->freq);
344
344
        return -1;
347
347
    return 0;
348
348
}
349
349
 
350
 
static int waveformat_to_audio_settings (WAVEFORMATEX *wfx, audsettings_t *as)
 
350
static int waveformat_to_audio_settings (WAVEFORMATEX *wfx,
 
351
                                         struct audsettings *as)
351
352
{
352
353
    if (wfx->wFormatTag != WAVE_FORMAT_PCM) {
353
354
        dolog ("Invalid wave format, tag is not PCM, but %d\n",
387
388
        as->fmt = AUD_FMT_S16;
388
389
        break;
389
390
 
 
391
    case 32:
 
392
        as->fmt = AUD_FMT_S32;
 
393
        break;
 
394
 
390
395
    default:
391
 
        dolog ("Invalid wave format, bits per sample is not 8 or 16, but %d\n",
 
396
        dolog ("Invalid wave format, bits per sample is not "
 
397
               "8, 16 or 32, but %d\n",
392
398
               wfx->wBitsPerSample);
393
399
        return -1;
394
400
    }
444
450
    int src_len1 = dst_len;
445
451
    int src_len2 = 0;
446
452
    int pos = hw->rpos + dst_len;
447
 
    st_sample_t *src1 = hw->mix_buf + hw->rpos;
448
 
    st_sample_t *src2 = NULL;
 
453
    struct st_sample *src1 = hw->mix_buf + hw->rpos;
 
454
    struct st_sample *src2 = NULL;
449
455
 
450
456
    if (pos > hw->samples) {
451
457
        src_len1 = hw->samples - hw->rpos;