src/audio/SDL_audio_c.h
author Sam Lantinga
Fri, 04 Dec 2020 15:47:28 -0800
changeset 14431 9be2761aa0f3
parent 13435 f0750959bb29
child 14640 b2b3343a310d
permissions -rw-r--r--
Allow background input when testing game controllers
slouken@0
     1
/*
slouken@5535
     2
  Simple DirectMedia Layer
slouken@13422
     3
  Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
slouken@0
     4
slouken@5535
     5
  This software is provided 'as-is', without any express or implied
slouken@5535
     6
  warranty.  In no event will the authors be held liable for any damages
slouken@5535
     7
  arising from the use of this software.
slouken@0
     8
slouken@5535
     9
  Permission is granted to anyone to use this software for any purpose,
slouken@5535
    10
  including commercial applications, and to alter it and redistribute it
slouken@5535
    11
  freely, subject to the following restrictions:
slouken@0
    12
slouken@5535
    13
  1. The origin of this software must not be misrepresented; you must not
slouken@5535
    14
     claim that you wrote the original software. If you use this software
slouken@5535
    15
     in a product, an acknowledgment in the product documentation would be
slouken@5535
    16
     appreciated but is not required.
slouken@5535
    17
  2. Altered source versions must be plainly marked as such, and must not be
slouken@5535
    18
     misrepresented as being the original software.
slouken@5535
    19
  3. This notice may not be removed or altered from any source distribution.
slouken@0
    20
*/
icculus@10758
    21
icculus@10758
    22
#ifndef SDL_audio_c_h_
icculus@10758
    23
#define SDL_audio_c_h_
icculus@10758
    24
icculus@8093
    25
#include "../SDL_internal.h"
slouken@0
    26
icculus@10575
    27
#ifndef DEBUG_CONVERT
icculus@10575
    28
#define DEBUG_CONVERT 0
icculus@10575
    29
#endif
icculus@10575
    30
icculus@10575
    31
#if DEBUG_CONVERT
icculus@10575
    32
#define LOG_DEBUG_CONVERT(from, to) fprintf(stderr, "Converting %s to %s.\n", from, to);
icculus@10575
    33
#else
icculus@10575
    34
#define LOG_DEBUG_CONVERT(from, to)
icculus@10575
    35
#endif
icculus@10575
    36
slouken@0
    37
/* Functions and variables exported from SDL_audio.c for SDL_sysaudio.c */
slouken@0
    38
icculus@10790
    39
#ifdef HAVE_LIBSAMPLERATE_H
icculus@10791
    40
#include "samplerate.h"
icculus@10790
    41
extern SDL_bool SRC_available;
icculus@10849
    42
extern int SRC_converter;
icculus@10790
    43
extern SRC_STATE* (*SRC_src_new)(int converter_type, int channels, int *error);
icculus@10790
    44
extern int (*SRC_src_process)(SRC_STATE *state, SRC_DATA *data);
icculus@10790
    45
extern int (*SRC_src_reset)(SRC_STATE *state);
icculus@10790
    46
extern SRC_STATE* (*SRC_src_delete)(SRC_STATE *state);
icculus@10790
    47
extern const char* (*SRC_src_strerror)(int error);
icculus@10790
    48
#endif
icculus@10790
    49
slouken@0
    50
/* Functions to get a list of "close" audio formats */
icculus@1982
    51
extern SDL_AudioFormat SDL_FirstAudioFormat(SDL_AudioFormat format);
icculus@1982
    52
extern SDL_AudioFormat SDL_NextAudioFormat(void);
slouken@0
    53
slouken@0
    54
/* Function to calculate the size and silence for a SDL_AudioSpec */
icculus@13435
    55
extern Uint8 SDL_SilenceValueForFormat(const SDL_AudioFormat format);
slouken@1895
    56
extern void SDL_CalculateAudioSpec(SDL_AudioSpec * spec);
slouken@0
    57
slouken@11406
    58
/* Choose the audio filter functions below */
slouken@11406
    59
extern void SDL_ChooseAudioConverters(void);
slouken@11406
    60
slouken@11406
    61
/* These pointers get set during SDL_ChooseAudioConverters() to various SIMD implementations. */
icculus@10815
    62
extern SDL_AudioFilter SDL_Convert_S8_to_F32;
icculus@10815
    63
extern SDL_AudioFilter SDL_Convert_U8_to_F32;
icculus@10815
    64
extern SDL_AudioFilter SDL_Convert_S16_to_F32;
icculus@10815
    65
extern SDL_AudioFilter SDL_Convert_U16_to_F32;
icculus@10815
    66
extern SDL_AudioFilter SDL_Convert_S32_to_F32;
icculus@10815
    67
extern SDL_AudioFilter SDL_Convert_F32_to_S8;
icculus@10815
    68
extern SDL_AudioFilter SDL_Convert_F32_to_U8;
icculus@10815
    69
extern SDL_AudioFilter SDL_Convert_F32_to_S16;
icculus@10815
    70
extern SDL_AudioFilter SDL_Convert_F32_to_U16;
icculus@10815
    71
extern SDL_AudioFilter SDL_Convert_F32_to_S32;
icculus@3021
    72
icculus@11508
    73
/* You need to call SDL_PrepareResampleFilter() before using the internal resampler.
icculus@11508
    74
   SDL_AudioQuit() calls SDL_FreeResamplerFilter(), you should never call it yourself. */
slouken@11510
    75
extern int SDL_PrepareResampleFilter(void);
slouken@11510
    76
extern void SDL_FreeResampleFilter(void);
icculus@11508
    77
slouken@11510
    78
#endif /* SDL_audio_c_h_ */
icculus@10758
    79
slouken@1895
    80
/* vi: set ts=4 sw=4 expandtab: */