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