~ubuntu-branches/ubuntu/quantal/openal-soft/quantal

« back to all changes in this revision

Viewing changes to Alc/winmm.c

  • Committer: Bazaar Package Importer
  • Author(s): Scott Ritchie
  • Date: 2010-04-16 15:20:20 UTC
  • mfrom: (0.2.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20100416152020-7gbp12lzhugfr2n0
Tags: 1:1.12.854-0ubuntu1
* New upstream release (LP: #565071)
  - Fully backwards compatible
  - Fixed playback when the PulseAudio buffer is calculated to be more than 64KB.
  - Restored compatibility with some older PulseAudio libs.
  - Alternative buffer sizing for PulseAudio, specified using a new config option.
  - Improved buffer size calculations, to prevent drastic latency changes when certain properties (such as ALC_FREQUENCY) are modified.
  - "Not broken" unlike 1.11.753, according to upstream
* Should fix some remaining crackling issues (LP: #351732, #516435)
* Should be ok to sync over; no extra patches

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
static ALCchar **CaptureDeviceList;
54
54
static ALuint  NumCaptureDevices;
55
55
 
 
56
static void ProbeDevices(void)
 
57
{
 
58
    ALuint i;
 
59
 
 
60
    for(i = 0;i < NumCaptureDevices;i++)
 
61
        free(CaptureDeviceList[i]);
 
62
 
 
63
    NumCaptureDevices = waveInGetNumDevs();
 
64
    CaptureDeviceList = realloc(CaptureDeviceList, sizeof(ALCchar*) * NumCaptureDevices);
 
65
    for(i = 0;i < NumCaptureDevices;i++)
 
66
    {
 
67
        WAVEINCAPS WaveInCaps;
 
68
 
 
69
        CaptureDeviceList[i] = NULL;
 
70
        if(waveInGetDevCaps(i, &WaveInCaps, sizeof(WAVEINCAPS)) == MMSYSERR_NOERROR)
 
71
        {
 
72
            char name[128];
 
73
            snprintf(name, sizeof(name), "WaveIn on %s", WaveInCaps.szPname);
 
74
            CaptureDeviceList[i] = strdup(name);
 
75
        }
 
76
    }
 
77
}
 
78
 
56
79
/*
57
80
    WaveInProc
58
81
 
184
207
    ALint lBufferSize;
185
208
    ALuint i;
186
209
 
 
210
    if(!CaptureDeviceList)
 
211
        ProbeDevices();
 
212
 
187
213
    // Find the Device ID matching the deviceName if valid
188
 
    if (deviceName)
189
 
    {
190
 
        for(i = 0;i < NumCaptureDevices;i++)
191
 
        {
192
 
            if (!strcmp(deviceName, CaptureDeviceList[i]))
193
 
            {
194
 
                lDeviceID = i;
195
 
                break;
196
 
            }
197
 
        }
198
 
        if(i == NumCaptureDevices)
199
 
            return ALC_FALSE;
200
 
    }
 
214
    if(deviceName)
 
215
    {
 
216
        for(i = 0;i < NumCaptureDevices;i++)
 
217
        {
 
218
            if(CaptureDeviceList[i] &&
 
219
               strcmp(deviceName, CaptureDeviceList[i]) == 0)
 
220
            {
 
221
                lDeviceID = i;
 
222
                break;
 
223
            }
 
224
        }
 
225
    }
 
226
    else
 
227
    {
 
228
        for(i = 0;i < NumCaptureDevices;i++)
 
229
        {
 
230
            if(CaptureDeviceList[i])
 
231
            {
 
232
                lDeviceID = i;
 
233
                break;
 
234
            }
 
235
        }
 
236
    }
 
237
    if(i == NumCaptureDevices)
 
238
        return ALC_FALSE;
201
239
 
202
240
    pData = calloc(1, sizeof(*pData));
203
241
    if(!pData)
443
481
 
444
482
void alcWinMMProbe(int type)
445
483
{
446
 
    ALuint lLoop;
 
484
    ALuint i;
447
485
 
448
486
    if(type != CAPTURE_DEVICE_PROBE)
449
487
        return;
450
488
 
451
 
    for(lLoop = 0; lLoop < NumCaptureDevices; lLoop++)
452
 
        free(CaptureDeviceList[lLoop]);
453
 
 
454
 
    NumCaptureDevices = waveInGetNumDevs();
455
 
    CaptureDeviceList = realloc(CaptureDeviceList, sizeof(ALCchar*) * NumCaptureDevices);
456
 
    for(lLoop = 0; lLoop < NumCaptureDevices; lLoop++)
 
489
    ProbeDevices();
 
490
    for(i = 0;i < NumCaptureDevices;i++)
457
491
    {
458
 
        WAVEINCAPS WaveInCaps;
459
 
 
460
 
        if(waveInGetDevCaps(lLoop, &WaveInCaps, sizeof(WAVEINCAPS)) == MMSYSERR_NOERROR)
461
 
        {
462
 
            char name[128];
463
 
            snprintf(name, sizeof(name), "WaveIn on %s", WaveInCaps.szPname);
464
 
            AppendCaptureDeviceList(name);
465
 
            CaptureDeviceList[lLoop] = strdup(name);
466
 
        }
467
 
        else
468
 
            CaptureDeviceList[lLoop] = strdup("");
 
492
        if(CaptureDeviceList[i])
 
493
            AppendCaptureDeviceList(CaptureDeviceList[i]);
469
494
    }
470
495
}