2015-06-21 10:33:46 -05:00
|
|
|
/*
|
|
|
|
Simple DirectMedia Layer
|
2022-01-03 11:40:00 -06:00
|
|
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
2015-06-21 10:33:46 -05:00
|
|
|
|
|
|
|
This software is provided 'as-is', without any express or implied
|
|
|
|
warranty. In no event will the authors be held liable for any damages
|
|
|
|
arising from the use of this software.
|
|
|
|
|
|
|
|
Permission is granted to anyone to use this software for any purpose,
|
|
|
|
including commercial applications, and to alter it and redistribute it
|
|
|
|
freely, subject to the following restrictions:
|
|
|
|
|
|
|
|
1. The origin of this software must not be misrepresented; you must not
|
|
|
|
claim that you wrote the original software. If you use this software
|
|
|
|
in a product, an acknowledgment in the product documentation would be
|
|
|
|
appreciated but is not required.
|
|
|
|
2. Altered source versions must be plainly marked as such, and must not be
|
|
|
|
misrepresented as being the original software.
|
|
|
|
3. This notice may not be removed or altered from any source distribution.
|
|
|
|
*/
|
2022-11-29 20:34:15 -06:00
|
|
|
#include "SDL_internal.h"
|
2015-06-21 10:33:46 -05:00
|
|
|
|
|
|
|
/* Output audio to nowhere... */
|
|
|
|
|
|
|
|
#include "../SDL_audio_c.h"
|
|
|
|
#include "SDL_dummyaudio.h"
|
|
|
|
|
2022-11-30 14:51:59 -06:00
|
|
|
static int DUMMYAUDIO_OpenDevice(_THIS, const char *devname)
|
2015-06-21 10:33:46 -05:00
|
|
|
{
|
2022-11-30 14:51:59 -06:00
|
|
|
_this->hidden = (void *)0x1; /* just something non-NULL */
|
|
|
|
|
|
|
|
return 0; /* always succeeds. */
|
2015-06-21 10:33:46 -05:00
|
|
|
}
|
|
|
|
|
2022-11-30 14:51:59 -06:00
|
|
|
static int DUMMYAUDIO_CaptureFromDevice(_THIS, void *buffer, int buflen)
|
2016-08-03 01:18:47 -05:00
|
|
|
{
|
|
|
|
/* Delay to make this sort of simulate real audio input. */
|
2021-04-06 17:34:17 -05:00
|
|
|
SDL_Delay((_this->spec.samples * 1000) / _this->spec.freq);
|
2016-08-03 01:18:47 -05:00
|
|
|
|
|
|
|
/* always return a full buffer of silence. */
|
2021-04-06 17:34:17 -05:00
|
|
|
SDL_memset(buffer, _this->spec.silence, buflen);
|
2016-08-03 01:18:47 -05:00
|
|
|
return buflen;
|
|
|
|
}
|
|
|
|
|
2022-11-30 14:51:59 -06:00
|
|
|
static SDL_bool DUMMYAUDIO_Init(SDL_AudioDriverImpl *impl)
|
2015-06-21 10:33:46 -05:00
|
|
|
{
|
|
|
|
/* Set the function pointers */
|
2016-08-11 21:22:09 -05:00
|
|
|
impl->OpenDevice = DUMMYAUDIO_OpenDevice;
|
|
|
|
impl->CaptureFromDevice = DUMMYAUDIO_CaptureFromDevice;
|
2016-08-03 01:18:47 -05:00
|
|
|
|
2022-01-17 04:21:01 -06:00
|
|
|
impl->OnlyHasDefaultOutputDevice = SDL_TRUE;
|
|
|
|
impl->OnlyHasDefaultCaptureDevice = SDL_TRUE;
|
2016-08-03 01:18:47 -05:00
|
|
|
impl->HasCaptureSupport = SDL_TRUE;
|
|
|
|
|
2022-11-30 14:51:59 -06:00
|
|
|
return SDL_TRUE; /* this audio target is available. */
|
2015-06-21 10:33:46 -05:00
|
|
|
}
|
|
|
|
|
2016-08-11 21:22:09 -05:00
|
|
|
AudioBootStrap DUMMYAUDIO_bootstrap = {
|
2022-01-17 04:21:01 -06:00
|
|
|
"dummy", "SDL dummy audio driver", DUMMYAUDIO_Init, SDL_TRUE
|
2015-06-21 10:33:46 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
/* vi: set ts=4 sw=4 expandtab: */
|