src/audio/dummy/SDL_dummyaudio.c
author Ryan C. Gordon
Wed, 04 Oct 2006 21:27:53 +0000
branchSDL-ryan-multiple-audio-device
changeset 3798 c8b3d3d13ed1
parent 3796 b19680c84cdf
child 3809 7852b5b78af5
permissions -rw-r--r--
Audio bootstraps can now specify that a driver is only to be used if
explicitly requested (for things like the "disk" driver that is always
available but you would never want to default to using).

Trimmed out code that can be handled by stubs in the core. The "dummy" driver
is pretty damned small now. :)
     1 /*
     2     SDL - Simple DirectMedia Layer
     3     Copyright (C) 1997-2006 Sam Lantinga
     4 
     5     This library is free software; you can redistribute it and/or
     6     modify it under the terms of the GNU Lesser General Public
     7     License as published by the Free Software Foundation; either
     8     version 2.1 of the License, or (at your option) any later version.
     9 
    10     This library is distributed in the hope that it will be useful,
    11     but WITHOUT ANY WARRANTY; without even the implied warranty of
    12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    13     Lesser General Public License for more details.
    14 
    15     You should have received a copy of the GNU Lesser General Public
    16     License along with this library; if not, write to the Free Software
    17     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    18 
    19     Sam Lantinga
    20     slouken@libsdl.org
    21 
    22     This file written by Ryan C. Gordon (icculus@icculus.org)
    23 */
    24 #include "SDL_config.h"
    25 
    26 /* Output audio to nowhere... */
    27 
    28 #include "SDL_rwops.h"
    29 #include "SDL_timer.h"
    30 #include "SDL_audio.h"
    31 #include "../SDL_audiomem.h"
    32 #include "../SDL_audio_c.h"
    33 #include "../SDL_audiodev_c.h"
    34 #include "SDL_dummyaudio.h"
    35 
    36 /* The tag name used by DUMMY audio */
    37 #define DUMMYAUD_DRIVER_NAME         "dummy"
    38 
    39 /* Audio driver functions */
    40 static int DUMMYAUD_OpenDevice(_THIS, const char *devname, int iscapture);
    41 static void DUMMYAUD_WaitDevice(_THIS);
    42 static void DUMMYAUD_PlayDevice(_THIS);
    43 static Uint8 *DUMMYAUD_GetDeviceBuf(_THIS);
    44 static void DUMMYAUD_CloseDevice(_THIS);
    45 
    46 /* Audio driver bootstrap functions */
    47 static int
    48 DUMMYAUD_Available(void)
    49 {
    50     return 1;  /* always available. */
    51 }
    52 
    53 static int
    54 DUMMYAUD_Init(SDL_AudioDriverImpl *impl)
    55 {
    56     /* Set the function pointers */
    57     impl->OpenDevice = DUMMYAUD_OpenDevice;
    58     impl->OnlyHasDefaultOutputDevice = 1;
    59 
    60     return 1;
    61 }
    62 
    63 AudioBootStrap DUMMYAUD_bootstrap = {
    64     DUMMYAUD_DRIVER_NAME, "SDL dummy audio driver",
    65     DUMMYAUD_Available, DUMMYAUD_Init, 1
    66 };
    67 
    68 static int
    69 DUMMYAUD_OpenDevice(_THIS, const char *devname, int iscapture)
    70 {
    71     return 1;   /* always succeeds. */
    72 }
    73 
    74 /* vi: set ts=4 sw=4 expandtab: */