mirror of https://github.com/encounter/SDL.git
audio: Changed a disk and dummy backends to use _this instead of this.
This commit is contained in:
parent
e97cfe4ad1
commit
64853b7378
|
@ -46,19 +46,19 @@
|
||||||
static void
|
static void
|
||||||
DISKAUDIO_WaitDevice(_THIS)
|
DISKAUDIO_WaitDevice(_THIS)
|
||||||
{
|
{
|
||||||
SDL_Delay(this->hidden->io_delay);
|
SDL_Delay(_this->hidden->io_delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
DISKAUDIO_PlayDevice(_THIS)
|
DISKAUDIO_PlayDevice(_THIS)
|
||||||
{
|
{
|
||||||
const size_t written = SDL_RWwrite(this->hidden->io,
|
const size_t written = SDL_RWwrite(_this->hidden->io,
|
||||||
this->hidden->mixbuf,
|
_this->hidden->mixbuf,
|
||||||
1, this->spec.size);
|
1, _this->spec.size);
|
||||||
|
|
||||||
/* If we couldn't write, assume fatal error for now */
|
/* If we couldn't write, assume fatal error for now */
|
||||||
if (written != this->spec.size) {
|
if (written != _this->spec.size) {
|
||||||
SDL_OpenedAudioDeviceDisconnected(this);
|
SDL_OpenedAudioDeviceDisconnected(_this);
|
||||||
}
|
}
|
||||||
#ifdef DEBUG_AUDIO
|
#ifdef DEBUG_AUDIO
|
||||||
fprintf(stderr, "Wrote %d bytes of audio data\n", written);
|
fprintf(stderr, "Wrote %d bytes of audio data\n", written);
|
||||||
|
@ -68,13 +68,13 @@ DISKAUDIO_PlayDevice(_THIS)
|
||||||
static Uint8 *
|
static Uint8 *
|
||||||
DISKAUDIO_GetDeviceBuf(_THIS)
|
DISKAUDIO_GetDeviceBuf(_THIS)
|
||||||
{
|
{
|
||||||
return (this->hidden->mixbuf);
|
return (_this->hidden->mixbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
DISKAUDIO_CaptureFromDevice(_THIS, void *buffer, int buflen)
|
DISKAUDIO_CaptureFromDevice(_THIS, void *buffer, int buflen)
|
||||||
{
|
{
|
||||||
struct SDL_PrivateAudioData *h = this->hidden;
|
struct SDL_PrivateAudioData *h = _this->hidden;
|
||||||
const int origbuflen = buflen;
|
const int origbuflen = buflen;
|
||||||
|
|
||||||
SDL_Delay(h->io_delay);
|
SDL_Delay(h->io_delay);
|
||||||
|
@ -90,7 +90,7 @@ DISKAUDIO_CaptureFromDevice(_THIS, void *buffer, int buflen)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if we ran out of file, just write silence. */
|
/* if we ran out of file, just write silence. */
|
||||||
SDL_memset(buffer, this->spec.silence, buflen);
|
SDL_memset(buffer, _this->spec.silence, buflen);
|
||||||
|
|
||||||
return origbuflen;
|
return origbuflen;
|
||||||
}
|
}
|
||||||
|
@ -105,11 +105,11 @@ DISKAUDIO_FlushCapture(_THIS)
|
||||||
static void
|
static void
|
||||||
DISKAUDIO_CloseDevice(_THIS)
|
DISKAUDIO_CloseDevice(_THIS)
|
||||||
{
|
{
|
||||||
if (this->hidden->io != NULL) {
|
if (_this->hidden->io != NULL) {
|
||||||
SDL_RWclose(this->hidden->io);
|
SDL_RWclose(_this->hidden->io);
|
||||||
}
|
}
|
||||||
SDL_free(this->hidden->mixbuf);
|
SDL_free(_this->hidden->mixbuf);
|
||||||
SDL_free(this->hidden);
|
SDL_free(_this->hidden);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -132,32 +132,32 @@ DISKAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
|
||||||
const char *fname = get_filename(iscapture, handle ? NULL : devname);
|
const char *fname = get_filename(iscapture, handle ? NULL : devname);
|
||||||
const char *envr = SDL_getenv(DISKENVR_IODELAY);
|
const char *envr = SDL_getenv(DISKENVR_IODELAY);
|
||||||
|
|
||||||
this->hidden = (struct SDL_PrivateAudioData *)
|
_this->hidden = (struct SDL_PrivateAudioData *)
|
||||||
SDL_malloc(sizeof(*this->hidden));
|
SDL_malloc(sizeof(*_this->hidden));
|
||||||
if (this->hidden == NULL) {
|
if (_this->hidden == NULL) {
|
||||||
return SDL_OutOfMemory();
|
return SDL_OutOfMemory();
|
||||||
}
|
}
|
||||||
SDL_zerop(this->hidden);
|
SDL_zerop(_this->hidden);
|
||||||
|
|
||||||
if (envr != NULL) {
|
if (envr != NULL) {
|
||||||
this->hidden->io_delay = SDL_atoi(envr);
|
_this->hidden->io_delay = SDL_atoi(envr);
|
||||||
} else {
|
} else {
|
||||||
this->hidden->io_delay = ((this->spec.samples * 1000) / this->spec.freq);
|
_this->hidden->io_delay = ((_this->spec.samples * 1000) / _this->spec.freq);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Open the audio device */
|
/* Open the audio device */
|
||||||
this->hidden->io = SDL_RWFromFile(fname, iscapture ? "rb" : "wb");
|
_this->hidden->io = SDL_RWFromFile(fname, iscapture ? "rb" : "wb");
|
||||||
if (this->hidden->io == NULL) {
|
if (_this->hidden->io == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate mixing buffer */
|
/* Allocate mixing buffer */
|
||||||
if (!iscapture) {
|
if (!iscapture) {
|
||||||
this->hidden->mixbuf = (Uint8 *) SDL_malloc(this->spec.size);
|
_this->hidden->mixbuf = (Uint8 *) SDL_malloc(_this->spec.size);
|
||||||
if (this->hidden->mixbuf == NULL) {
|
if (_this->hidden->mixbuf == NULL) {
|
||||||
return SDL_OutOfMemory();
|
return SDL_OutOfMemory();
|
||||||
}
|
}
|
||||||
SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
|
SDL_memset(_this->hidden->mixbuf, _this->spec.silence, _this->spec.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_LogCritical(SDL_LOG_CATEGORY_AUDIO,
|
SDL_LogCritical(SDL_LOG_CATEGORY_AUDIO,
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include "../SDL_sysaudio.h"
|
#include "../SDL_sysaudio.h"
|
||||||
|
|
||||||
/* Hidden "this" pointer for the audio functions */
|
/* Hidden "this" pointer for the audio functions */
|
||||||
#define _THIS SDL_AudioDevice *this
|
#define _THIS SDL_AudioDevice *_this
|
||||||
|
|
||||||
struct SDL_PrivateAudioData
|
struct SDL_PrivateAudioData
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,10 +37,10 @@ static int
|
||||||
DUMMYAUDIO_CaptureFromDevice(_THIS, void *buffer, int buflen)
|
DUMMYAUDIO_CaptureFromDevice(_THIS, void *buffer, int buflen)
|
||||||
{
|
{
|
||||||
/* Delay to make this sort of simulate real audio input. */
|
/* Delay to make this sort of simulate real audio input. */
|
||||||
SDL_Delay((this->spec.samples * 1000) / this->spec.freq);
|
SDL_Delay((_this->spec.samples * 1000) / _this->spec.freq);
|
||||||
|
|
||||||
/* always return a full buffer of silence. */
|
/* always return a full buffer of silence. */
|
||||||
SDL_memset(buffer, this->spec.silence, buflen);
|
SDL_memset(buffer, _this->spec.silence, buflen);
|
||||||
return buflen;
|
return buflen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include "../SDL_sysaudio.h"
|
#include "../SDL_sysaudio.h"
|
||||||
|
|
||||||
/* Hidden "this" pointer for the audio functions */
|
/* Hidden "this" pointer for the audio functions */
|
||||||
#define _THIS SDL_AudioDevice *this
|
#define _THIS SDL_AudioDevice *_this
|
||||||
|
|
||||||
struct SDL_PrivateAudioData
|
struct SDL_PrivateAudioData
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue