VirtualBox

Changeset 54336 in vbox


Ignore:
Timestamp:
Feb 20, 2015 5:02:04 PM (10 years ago)
Author:
vboxsync
Message:

Audio: dsoundaudio use correct capture buffer position

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/dsoundaudio.c

    r53417 r54336  
    755755    DSCBUFFERDESC bd;
    756756    DSCBCAPS bc;
    757     DWORD cpos;
     757    DWORD rpos;
    758758
    759759    DSLOGF(("DSound: capture open %p size %d samples, freq %d, chan %d, bits %d, sign %d\n",
     
    796796    /* Query the actual parameters. */
    797797
    798     hr = IDirectSoundCaptureBuffer_GetCurrentPosition (ds->dsound_capture_buffer, &cpos, NULL);
     798    hr = IDirectSoundCaptureBuffer_GetCurrentPosition (ds->dsound_capture_buffer, NULL, &rpos);
    799799    if (FAILED (hr)) {
    800         cpos = 0;
     800        rpos = 0;
    801801        DSLOGF(("DSound: open GetCurrentPosition %Rhrc\n", hr));
    802802    }
     
    846846    /* Initial state: reading at the initial capture position. */
    847847    ds->hw.wpos = 0;
    848     ds->last_read_pos = cpos >> ds->hw.info.shift;
     848    ds->last_read_pos = rpos >> ds->hw.info.shift;
    849849    ds->capture_buffer_size = bc.dwBufferBytes >> ds->hw.info.shift;
    850850    DSLOGF(("DSound: capture open last_read_pos %d, capture_buffer_size %d\n", ds->last_read_pos, ds->capture_buffer_size));
     
    11561156    int len1, len2;
    11571157    int decr;
    1158     DWORD cpos;
     1158    DWORD rpos;
    11591159    LPVOID p1, p2;
    11601160    int hwshift;
     
    11751175    hr = IDirectSoundCaptureBuffer_GetCurrentPosition (
    11761176        dscb,
    1177         &cpos,
    1178         NULL
     1177        NULL,
     1178        &rpos
    11791179        );
    11801180    if (FAILED (hr)) {
     
    11871187    ds->hr_last_run_in = hr;
    11881188
    1189     if (cpos & hw->info.align) {
    1190         DSLOGF(("DSound: run_in misaligned capture position %ld(%d)\n", cpos, hw->info.align));
    1191     }
    1192 
    1193     cpos >>= hwshift;
     1189    if (rpos & hw->info.align) {
     1190        DSLOGF(("DSound: run_in misaligned read position %ld(%d)\n", rpos, hw->info.align));
     1191    }
     1192
     1193    rpos >>= hwshift;
    11941194
    11951195    /* Number of samples available in the capture buffer. */
    1196     len = audio_ring_dist (cpos, ds->last_read_pos, ds->capture_buffer_size);
     1196    len = audio_ring_dist (rpos, ds->last_read_pos, ds->capture_buffer_size);
    11971197    if (!len) {
    11981198        return 0;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette