Skip to content

Commit

Permalink
USB: beginning to add back initial references
Browse files Browse the repository at this point in the history
  • Loading branch information
GovanifY authored and refractionpcsx2 committed Nov 11, 2020
1 parent 9dd0ef6 commit 8f8a83a
Show file tree
Hide file tree
Showing 169 changed files with 412,303 additions and 0 deletions.
1 change: 1 addition & 0 deletions 3rdparty/libsamplerate/AUTHORS
@@ -0,0 +1 @@
Erik de Castro Lopo <erikd@mega-nerd.com>
25 changes: 25 additions & 0 deletions 3rdparty/libsamplerate/COPYING
@@ -0,0 +1,25 @@
Copyright (c) 2012-2016, Erik de Castro Lopo <erikd@mega-nerd.com>
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 changes: 40 additions & 0 deletions 3rdparty/libsamplerate/NEWS
@@ -0,0 +1,40 @@
Version 0.1.9 (2016-09-23)
* Relicense under 2 clause BSD license.
* Minor bug fixes and upates.

Version 0.1.8 (2011-08-15)
* Minor bug fixes and upates.

Version 0.1.7 (2009-02-14)
* Fix a segfault which occurs when memcpy is passed a bad length parameter.
* Fix compilation under MSVC.

Version 0.1.6 (2009-01-27)
* Minor bug fix in test suite (account for rounding error on x86_64).

Version 0.1.5 (2009-01-11)
* Optimisation resulting dramatic throughput improvements.

Version 0.1.4 (2008-07-02)
* Fix bug which causes a segfault with extremely low conversion ratios.

Version 0.1.3 (2008-03-23)
* Huge improvement to the quality of conversion with the
SRC_SINC_MEDIUM_QUALITY and SRC_SINC_BEST_QUALITY converters.
* Minor bug fixes.

Version 0.1.2 (2004-09-12)
* Fixed where callback based API wasn't being reset properly.
* Minor bug fixes.

Version 0.1.1 (2004-07-17)
* Fixed bug in callback based API.
* Fixed a bug brought to light by aggressive optimisations of gcc-3.4.
* Minor bug fixes.

Version 0.1.0 (2004-03-14)
* Added callback based API.
* Added a pair of functions for doing short to float and float to short
conversions on an arrays of data.
* Many minor bug fixes.

50 changes: 50 additions & 0 deletions 3rdparty/libsamplerate/README
@@ -0,0 +1,50 @@
This is libsamplerate, 0.1.9

libsamplerate (also known as Secret Rabbit Code) is a library for
perfroming sample rate conversion of audio data.

The src/ directory contains the source code for library itself.

The doc/ directory contains the libsamplerate documentation.

The examples/ directory contains examples of how to write code using
libsamplerate.

The tests/ directory contains programs which link against
libsamplerate and test its functionality.

The Win32/ directory contains files and documentation to allow
libsamplerate to compile under Win32 with the Microsoft Visual C++
compiler.

Win32
-----
There are detailed instructions for building libsamplerate on Win32
in the file

doc/win32.html


MacOSX
------
Building on MacOSX should be the same as building it on any other
Unix.


OTHER PLATFORMS
---------------
To compile libsamplerate on platforms which have a Bourne Shell compatible
shell, an ANSI C compiler and a make utility should require no more that
the following three commands :
./configure
make
make install

CONTACTS
--------

libsamplerate was written by Erik de Castro Lopo (erikd AT mega-nerd DOT com).
The libsamplerate home page is at :

http://www.mega-nerd.com/libsamplerate/

160 changes: 160 additions & 0 deletions 3rdparty/libsamplerate/common.h
@@ -0,0 +1,160 @@
/*
** Copyright (c) 2002-2016, Erik de Castro Lopo <erikd@mega-nerd.com>
** All rights reserved.
**
** This code is released under 2-clause BSD license. Please see the
** file at : https://github.com/erikd/libsamplerate/blob/master/COPYING
*/

#ifndef COMMON_H_INCLUDED
#define COMMON_H_INCLUDED

#ifdef HAVE_STDINT_H
#include <stdint.h>
#elif (SIZEOF_INT == 4)
typedef int int32_t ;
#elif (SIZEOF_LONG == 4)
typedef long int32_t ;
#endif

#define SRC_MAX_RATIO 256
#define SRC_MAX_RATIO_STR "256"

#define SRC_MIN_RATIO_DIFF (1e-20)

#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))

#define ARRAY_LEN(x) ((int) (sizeof (x) / sizeof ((x) [0])))
#define OFFSETOF(type,member) ((int) (&((type*) 0)->member))

#define MAKE_MAGIC(a,b,c,d,e,f) ((a) + ((b) << 4) + ((c) << 8) + ((d) << 12) + ((e) << 16) + ((f) << 20))

/*
** Inspiration : http://sourcefrog.net/weblog/software/languages/C/unused.html
*/
#ifdef UNUSED
#elif defined (__GNUC__)
# define UNUSED(x) UNUSED_ ## x __attribute__ ((unused))
#elif defined (__LCLINT__)
# define UNUSED(x) /*@unused@*/ x
#else
# define UNUSED(x) x
#endif

#ifdef __GNUC__
# define WARN_UNUSED __attribute__ ((warn_unused_result))
#else
# define WARN_UNUSED
#endif


#include "samplerate.h"

enum
{ SRC_FALSE = 0,
SRC_TRUE = 1,

SRC_MODE_PROCESS = 555,
SRC_MODE_CALLBACK = 556
} ;

enum
{ SRC_ERR_NO_ERROR = 0,

SRC_ERR_MALLOC_FAILED,
SRC_ERR_BAD_STATE,
SRC_ERR_BAD_DATA,
SRC_ERR_BAD_DATA_PTR,
SRC_ERR_NO_PRIVATE,
SRC_ERR_BAD_SRC_RATIO,
SRC_ERR_BAD_PROC_PTR,
SRC_ERR_SHIFT_BITS,
SRC_ERR_FILTER_LEN,
SRC_ERR_BAD_CONVERTER,
SRC_ERR_BAD_CHANNEL_COUNT,
SRC_ERR_SINC_BAD_BUFFER_LEN,
SRC_ERR_SIZE_INCOMPATIBILITY,
SRC_ERR_BAD_PRIV_PTR,
SRC_ERR_BAD_SINC_STATE,
SRC_ERR_DATA_OVERLAP,
SRC_ERR_BAD_CALLBACK,
SRC_ERR_BAD_MODE,
SRC_ERR_NULL_CALLBACK,
SRC_ERR_NO_VARIABLE_RATIO,
SRC_ERR_SINC_PREPARE_DATA_BAD_LEN,
SRC_ERR_BAD_INTERNAL_STATE,

/* This must be the last error number. */
SRC_ERR_MAX_ERROR
} ;

typedef struct SRC_PRIVATE_tag
{ double last_ratio, last_position ;

int error ;
int channels ;

/* SRC_MODE_PROCESS or SRC_MODE_CALLBACK */
int mode ;

/* Pointer to data to converter specific data. */
void *private_data ;

/* Varispeed process function. */
int (*vari_process) (struct SRC_PRIVATE_tag *psrc, SRC_DATA *data) ;

/* Constant speed process function. */
int (*const_process) (struct SRC_PRIVATE_tag *psrc, SRC_DATA *data) ;

/* State reset. */
void (*reset) (struct SRC_PRIVATE_tag *psrc) ;

/* Data specific to SRC_MODE_CALLBACK. */
src_callback_t callback_func ;
void *user_callback_data ;
long saved_frames ;
const float *saved_data ;
} SRC_PRIVATE ;

/* In src_sinc.c */
const char* sinc_get_name (int src_enum) ;
const char* sinc_get_description (int src_enum) ;

int sinc_set_converter (SRC_PRIVATE *psrc, int src_enum) ;

/* In src_linear.c */
const char* linear_get_name (int src_enum) ;
const char* linear_get_description (int src_enum) ;

int linear_set_converter (SRC_PRIVATE *psrc, int src_enum) ;

/* In src_zoh.c */
const char* zoh_get_name (int src_enum) ;
const char* zoh_get_description (int src_enum) ;

int zoh_set_converter (SRC_PRIVATE *psrc, int src_enum) ;

/*----------------------------------------------------------
** Common static inline functions.
*/

static inline double
fmod_one (double x)
{ double res ;

res = x - lrint (x) ;
if (res < 0.0)
return res + 1.0 ;

return res ;
} /* fmod_one */

static inline int
is_bad_src_ratio (double ratio)
{ return (ratio < (1.0 / SRC_MAX_RATIO) || ratio > (1.0 * SRC_MAX_RATIO)) ;
} /* is_bad_src_ratio */


#endif /* COMMON_H_INCLUDED */

0 comments on commit 8f8a83a

Please sign in to comment.