src/audio/dummy/SDL_dummyaudio.c
changeset 10234 05e2142bcd69
parent 9998 f67cf37e9cd4
child 10235 0e83beda6d8b
equal deleted inserted replaced
10233:449a75328029 10234:05e2142bcd69
    31 {
    31 {
    32     return 0;                   /* always succeeds. */
    32     return 0;                   /* always succeeds. */
    33 }
    33 }
    34 
    34 
    35 static int
    35 static int
       
    36 DUMMYAUD_CaptureFromDevice(_THIS, void *buffer, int buflen)
       
    37 {
       
    38     /* Delay to make this sort of simulate real audio input. */
       
    39     SDL_Delay((device->spec.samples * 1000) / device->spec.freq);
       
    40 
       
    41     /* always return a full buffer of silence. */
       
    42     SDL_memset(buffer, this->spec.silence, buflen);
       
    43     return buflen;
       
    44 }
       
    45 
       
    46 static int
    36 DUMMYAUD_Init(SDL_AudioDriverImpl * impl)
    47 DUMMYAUD_Init(SDL_AudioDriverImpl * impl)
    37 {
    48 {
    38     /* Set the function pointers */
    49     /* Set the function pointers */
    39     impl->OpenDevice = DUMMYAUD_OpenDevice;
    50     impl->OpenDevice = DUMMYAUD_OpenDevice;
       
    51     impl->CaptureFromDevice = DUMMYAUD_CaptureFromDevice;
       
    52 
    40     impl->OnlyHasDefaultOutputDevice = 1;
    53     impl->OnlyHasDefaultOutputDevice = 1;
       
    54     impl->OnlyHasDefaultInputDevice = 1;
       
    55     impl->HasCaptureSupport = SDL_TRUE;
       
    56 
    41     return 1;   /* this audio target is available. */
    57     return 1;   /* this audio target is available. */
    42 }
    58 }
    43 
    59 
    44 AudioBootStrap DUMMYAUD_bootstrap = {
    60 AudioBootStrap DUMMYAUD_bootstrap = {
    45     "dummy", "SDL dummy audio driver", DUMMYAUD_Init, 1
    61     "dummy", "SDL dummy audio driver", DUMMYAUD_Init, 1