Compare commits

...

206 commits

Author SHA1 Message Date
orbea
72559114c8
Remove SDL1 support (#45)
* build: remove executable permissions from Makefile

* build: remove SDL1 support

* src: remove SDL1 code path
2024-11-02 21:09:01 -07:00
orbea
7573056761
build: remove -fno-strict-aliasing (#44)
This builds with -Werror=strict-aliasing so it should be not required.
2024-11-02 21:08:14 -07:00
Richard Goedeken
6c2c3f8ae1 update version and release info for v2.6.0 release 2024-07-14 16:01:42 -07:00
Richard Goedeken
32e2f282bb update minimum macos SDK in makefile 2024-07-14 11:59:53 -07:00
Jj0YzL5nvJ
639466bdb0
CI/CD: Update to generic scripts, independent schedule, etc (#43) 2024-05-26 19:57:32 -07:00
Jj0YzL5nvJ
cec70e42b4
CI/CD: Fixes Ubuntu i386 builds, among other changes (#42) 2023-06-11 12:21:09 -07:00
Jj0YzL5nvJ
8d5df662e9
CI/CD: Integrate scheduled builds and other necessary updates (#41) 2023-03-02 22:01:21 -08:00
Jj0YzL5nvJ
8f372a02b0
CI/CD: Update MSVC (#40) 2022-09-30 17:00:14 -07:00
Jj0YzL5nvJ
df0770215f
CI/CD: Update (#39) 2022-07-13 19:31:03 -07:00
Jj0YzL5nvJ
238b119ac9
CI/CD: Implement GitHub Actions and public nightly builds (#38) 2022-04-11 20:54:01 -07:00
bsmiles32
af6af5b1fd
Fix channel swapping logic for BigEndian systems (#37)
* Fix channel swapping logic for BigEndian systems
2021-02-19 20:59:12 -08:00
Richard Goedeken
f352528e43
Merge pull request #35 from bsmiles32/fixes
Fixes
2021-02-19 20:49:48 -08:00
Bobby Smiles
393b1c1f3e Fix warning about maybe uninitialized variable in trivial resampler 2021-01-17 17:09:36 +01:00
Bobby Smiles
1b0b1ecfe7 Fix building for SDL version < 1.3 2021-01-17 17:07:13 +01:00
Bobby Smiles
8182d1d847 Fix audio locking 2021-01-17 16:23:17 +01:00
Bobby Smiles
6c6bb9de24 Simplify sdl_backend API
Audio generated by N64 is always 16-bit stereo. BITRATE is not related
to sample depth at all. So we can simplify set_format and rename it as
set_frequency.
2021-01-17 14:36:19 +01:00
Bobby Smiles
8602b6cec6 Improve debugging when obtained spec differs from desired spec. 2021-01-17 12:11:38 +01:00
orbea
a2472a2788 build: Allow out of tree builds. 2020-12-15 10:16:58 +01:00
Richard Goedeken
1acd163aec Revert "Allow non-default compilers without resorting to symbolic links"
This reverts commit 7155ae6f21, as it conflicts with GNU make which always defines default values for certain variables
2020-09-16 22:40:41 -07:00
Richard Goedeken
39b8cb778c
Merge pull request #32 from Jj0YzL5nvJ/alter_cc_cxx
Allow non-default compilers without resorting to symbolic links
2020-08-30 18:53:18 -07:00
Jj0YzL5nvJ
7155ae6f21 Allow non-default compilers without resorting to symbolic links 2020-08-30 03:57:07 -06:00
Richard Goedeken
671b1b5dc3
Merge pull request #31 from Jj0YzL5nvJ/alter
Allow to set custom platform toolset from commands
2020-08-19 23:36:17 -07:00
Jj0YzL5nvJ
03824450cf Allow to set custom platform toolset from commands 2020-08-13 12:10:16 -06:00
Richard Goedeken
5c431df063 fix mupen64plus-user-issues ticket #712 - set AUDIO_SYNC to true by default 2020-04-21 17:37:19 -07:00
bsmiles32
9e9cd51021
Merge pull request #30 from Gillou68310/SDL2
Add SDL2 compatibility
2020-03-23 12:37:35 +01:00
Gillou68310
e19955bd9e Add SDL2 compatibility 2020-03-02 11:59:23 +01:00
Jj0YzL5nvJ
fb9aa4d65e AppVeyor with artifact packaging 2020-03-02 09:40:43 +01:00
James Donald
a82c12e300 Add standard headers to define uint32_t 2020-03-02 09:40:12 +01:00
Jj0YzL5nvJ
9430858d4c Changes to have more generic project files 2020-02-26 12:40:02 +01:00
Gillou68310
b51ea78013 Migrate to VS2017 2019-11-13 15:43:50 +01:00
Richard Goedeken
4a94ca44b1 add function attributes so GCC can find bugs in calls to string formatting functions with variadic arguments 2019-03-03 09:15:22 -08:00
Richard Goedeken
0176ffb8b1 fix integer size bugs in string format functions with variadic arguments 2019-03-03 09:14:41 -08:00
Richard Goedeken
d48c74a217 update version and release info for v2.5.9 BETA release 2019-02-10 10:11:08 -08:00
Richard Goedeken
b8a21b54dd fix Travis CI test builds for MXE 32 and 64 bits 2019-01-29 22:08:39 -08:00
Richard Goedeken
dd42e26c63
Merge pull request #26 from bugfood/fix-nosaveoptions
Remove use of ConfigSaveOptions.
2019-01-16 19:43:30 -08:00
Corey Hickey
7c5d219203 Remove use of ConfigSaveOptions.
Since commit 0bb63fe6f5a in mupen64plus-ui-console, the front-end now
saves the configuration after plugin initialization but before running
the game. Now it is no longer necessary for individual plugins to save
their config.

Removing calls to ConfigSaveOptions from within plugins makes the
'--nosaveoptions' parameter work.

Also remove unused reference to ConfigSaveFile.
2019-01-13 18:51:46 -08:00
Richard Goedeken
732722c1b7 update FSF address in license 2018-02-04 12:55:58 -08:00
bsmiles32
349f8c2540
Merge pull request #24 from bsmiles32/fix/swap_channels
Fix swap channels path.
2018-01-01 17:47:53 +01:00
bsmiles32
a897f6a985
Merge pull request #25 from bentley/master
Update homepage links
2018-01-01 17:47:28 +01:00
Anthony J. Bentley
e3e94e0c33 Update homepage. 2017-12-28 16:26:24 -07:00
Anthony J. Bentley
9972f6c997 Update link to bug tracker. 2017-12-28 16:02:23 -07:00
Bobby Smiles
b238523743 Fix swap channels path. 2017-12-23 17:34:00 +01:00
Gilles Siberlin
3379d9a4eb
Merge pull request #23 from bsmiles32/remove_spam
Remove underrun messages as it spammed too much and is not really needed
2017-12-14 11:21:28 +01:00
Bobby Smiles
ba2c764f0a Remove underrun messages as it spammed too much and is not really needed 2017-12-14 01:44:53 +01:00
Gillou68310
8304ef7486 Fix VS2013 compilation 2017-12-12 17:01:12 +01:00
Richard Goedeken
1379905bab update Makefile method for finding OSX_SDK_PATH 2017-11-14 16:20:38 -08:00
Richard Goedeken
75054caa8a
Merge pull request #21 from bsmiles32/various_fixes
Various fixes
2017-11-08 20:16:35 -08:00
Richard Goedeken
a7bd0b62e3
Merge pull request #22 from charlemagnelasse/travis-mxe
Build MXE targets as additional tests in travis build matrix
2017-11-08 20:06:27 -08:00
Charlemagne Lasse
e8ac678f39 Build MXE targets as additional tests in travis build matrix 2017-11-05 15:34:36 +01:00
Bobby Smiles
85cb19f83a buffer size updates should happen inside Audio lock/unlock pairs. 2017-11-02 01:59:02 +01:00
Bobby Smiles
bb48c70364 Avoid void pointer arithmetic.
GCC is tolerant for that, but not msvc.
2017-11-02 00:44:47 +01:00
Bobby Smiles
e2b04deffa Fix primary buffer overflow message. 2017-11-02 00:30:21 +01:00
Bobby Smiles
4edbe8bc17 Add warning on underrun. 2017-11-02 00:30:18 +01:00
Bobby Smiles
7f4d849c5d Add checks for number of generated resampled values in speex. 2017-11-02 00:29:16 +01:00
Bobby Smiles
7226b61cb9 Remove unneeded memset. 2017-11-02 00:29:16 +01:00
Bobby Smiles
64be9eda6e Minor formatting edits. 2017-11-02 00:28:04 +01:00
Bobby Smiles
932563a8ea Fix audio crackling introduced in commit b94cbf656f
Apparently using directly the pointer returned by cbuff_head leads to
audio "cracks" with better resamplers whereas adding cbuff.head inside
each memcpy desn't.
2017-11-02 00:23:05 +01:00
Bobby Smiles
aef8225d14 Fix PauseAudio regression introduced in commit b94cbf656f 2017-11-02 00:11:40 +01:00
bsmiles32
2879e517fa Merge pull request #20 from bsmiles32/build_fixes
Disable speex/src when their libraries are not found
2017-10-13 19:37:43 +02:00
Bobby Smiles
c35d803c4b Disable speex/src when their libraries are not found 2017-10-13 15:20:07 +02:00
Richard Goedeken
d763643644 Merge pull request #19 from bsmiles32/refactorings
Refactorings
2017-10-12 19:45:24 -07:00
Bobby Smiles
8edfc66b43 Fix msvc project file. 2017-10-12 12:12:31 +02:00
Bobby Smiles
2cacce90bb Extract sdl_backend in its own module. 2017-10-12 12:09:02 +02:00
Bobby Smiles
a7c8d4123d Extract circular buffer logic. 2017-10-12 10:01:26 +02:00
Bobby Smiles
b94cbf656f Extract sdl_backend data 2017-10-12 09:35:22 +02:00
Bobby Smiles
8847176ac0 Extract audio synchronization logic. 2017-10-12 05:02:30 +02:00
Bobby Smiles
9c48b7f158 Extract resamplers from main module.
Refactor resamplers in such a way that main module only interact with
them through a resampler_interface which is agnostic to implementation
details.

Also, for all resamplers, internal state is dynamically allocated, and
no longer relies on global variables.
2017-10-12 04:11:31 +02:00
Bobby Smiles
109e2fb372 Remove extra spaces. 2017-10-11 15:30:04 +02:00
Dorian Fevrier
521d1acf3a Merge pull request #17 from charlemagnelasse/travis-container
Use faster container based Travis CI
2017-09-13 11:08:41 +02:00
Charlemagne Lasse
83c2854ba0 Use faster container based Travis CI 2017-09-01 09:57:14 +02:00
Charlemagne Lasse
c410867855 Let travis handle the package installation directly
The before_install  currently fails on Travis CI with:

    The following packages have unmet dependencies:
     libsdl2-dev : Depends: libegl1-mesa-dev
                   Depends: libgles2-mesa-dev
    E: Unable to correct problems, you have held broken packages.

This can currently only be solved by using the apt addon to install
packages.
2017-09-01 09:56:02 +02:00
bsmiles32
9261b34d54 Merge pull request #16 from loganmc10/sync
Allow audio/video sync to be configured, default to off
2017-05-23 16:43:26 -06:00
Logan McNaughton
dd4c930f1e Allow audio/video sync to be configured, default to off 2017-04-25 22:17:44 -06:00
Richard Goedeken
5e157821e6 Merge pull request #15 from loganmc10/patch-1
Use resampler if available
2017-04-05 23:14:41 -07:00
Logan McNaughton
83b26884c2 Use resampler if available 2017-04-03 16:21:46 -06:00
Richard Goedeken
c8680df526 Merge pull request #14 from fprimex/fprimex-macos-version-min
bump macosx-version-min to 10.6 for SDL2.0.5
2017-03-16 23:57:10 -07:00
Brent Woodruff
7f94539a5d bump macosx-version-min to 10.6 for SDL2.0.5 2017-03-16 22:45:18 -04:00
Richard Goedeken
d9b7e73662 Merge pull request #13 from charlemagnelasse/master
Use Ubuntu Trusty as base system for Travis CI
2016-09-01 18:04:27 -07:00
Charlemagne Lasse
8f1408525d Use Ubuntu Trusty as base system for Travis CI 2016-09-01 20:23:59 +02:00
Richard Goedeken
7fecb537cc change VS2013 project files to build with the XP-compatible vc120 toolset, so the resulting binaries will run on pre-vista machines 2016-07-13 20:04:06 -07:00
Richard Goedeken
e859e1cfbb Merge pull request #12 from Gillou68310/x64
Added x64 configuration to VisualStudio2013 project file
2015-09-12 21:52:52 -07:00
Richard Goedeken
8a49326b00 github ticket #617: decrease default primary audio buffer target level, in order to reduce audio latency 2015-09-12 20:02:22 -07:00
Gillou68310
b5955b634a Added x64 configuration to VisualStudio2013 project file 2015-08-28 16:30:02 +02:00
Richard Goedeken
280066dbd1 Merge pull request #11 from bentley/openbsd
Remove unnecessary OpenBSD warning.
2015-06-08 06:30:56 -07:00
Anthony J. Bentley
7a763381cd Remove unnecessary OpenBSD warning. 2015-06-08 01:42:29 -06:00
Richard Goedeken
d6388319be Merge pull request #10 from krnlyng/master
bug workaround (volume does not follow system volume on jolla phone)
2015-05-07 23:05:23 -07:00
Franz-Josef Haider
625c938228 bug workaround (volume does not follow system volume on jolla phone) https://bugs.maemo.org/show_bug.cgi?id=7159 2015-05-07 09:16:16 +02:00
Richard Goedeken
0e64ba78e3 update text files and version number for upcoming 2.5 release 2015-04-26 12:23:24 -07:00
Richard Goedeken
1c5e40f88d Merge pull request #9 from conchurnavid/includes
Cleanup includes order and add missing includes
2015-03-21 21:34:08 -07:00
Conchúr Navid
b2f4ad0a74 Add missing includes and forward declarations 2015-03-21 13:47:40 +01:00
Conchúr Navid
a3d94d32c9 Sort the includes based on type and names 2015-03-21 10:58:40 +01:00
Conchúr Navid
54689d5f84 Fix executable bits of files 2015-03-21 10:53:38 +01:00
Richard Goedeken
088bd63908 added project/solution file for Visual Studio 2013. removed older MSVS project files. fix code compatilibity problems with MSVC 2015-02-22 07:13:34 -08:00
Richard Goedeken
0e7da995b3 Merge pull request #8 from Nebuleon/build-changes
Drop architecture checks for cross-platform project
2015-02-01 14:17:27 -08:00
Nebuleon Fumika
45719a8ac1 Unix Makefile: Discard unnecessary architecture checks
Unlike the Mupen64Plus Core, which is sensitive to the architecture
it's compiled for due to its just-in-time compilers, this project does
not require architecture-specific glue code, only operating system
checks to load dynamic libraries and the presence of a well-behaving
port of SDL on the platform.

M64P_BIG_ENDIAN is not used for any decisions in this plugin, either.
Delete the big-endian processor checks.
2015-01-26 09:43:10 +00:00
Richard Goedeken
b67e5e818b Merge pull request #7 from Gillou68310/master
Added project file for MSVC2010
2015-01-07 22:55:29 -08:00
Richard Goedeken
a06cfdc42c Merge pull request #6 from mupen64plus-ae/vanilla
Merge Android Edition history
2015-01-07 22:42:56 -08:00
Gillou68310
3bcd8b0e29 Added project file for MSVC2010 2015-01-07 15:09:35 +01:00
littleguy77
863fb3c34a Remove Android Edition customizations.
This customization was originally in the upstream source to eliminate
audio distortion:
522e27f10c

This was later removed, but the change was never propagated downstream:
cc74b18d91
2015-01-01 09:55:41 -05:00
littleguy77
24f7993ebd build: Remove Android makefile. 2014-12-18 22:07:34 -05:00
littleguy77
2cb09e9354 Merge remote-tracking branch 'upstream/master' 2014-12-18 22:07:18 -05:00
Richard Goedeken
8cf8f17e0e Merge pull request #5 from krnlyng/nemo_audioresource
implement audioresource support. required on nemo to enable audio output
2014-12-07 19:56:34 -08:00
Frajo Haider
126b8b3249 implement audioresource support. required on nemo to enable audio output 2014-12-04 08:18:08 +01:00
Paul Lamb
1fdacac18e Merge from upstream 2014-12-02 19:03:43 -06:00
Richard Goedeken
923b4c8d7d Merge pull request #3 from bentley/openbsd-no-oss
Disable OSS by default on OpenBSD.
2014-11-09 16:24:19 -08:00
Anthony J. Bentley
5ff4cb2f72 Disable OSS by default on OpenBSD.
OpenBSD never used OSS by default and is likely to remove libossaudio.
2014-11-08 19:44:33 -07:00
Paul Lamb
7ba6b8d885 Merge from upstream 2014-11-08 11:21:57 -06:00
Richard Goedeken
0bc2238682 Merge pull request #2 from fayvel/travisci
Add Travis CI configuration file for automatic build tests
2014-07-07 22:09:06 -07:00
Fayvel Victor
6a28354dc4 Add Travis CI configuration file for automatic build tests
Github provides a Travis CI integration which makes it easy to have a quick
check of a patch before a pull request is accepted. It is not enough to prove
the correctness of a contribution but at least helps to avoid some of the worst
build problems.

This feature *must* be enabled by the mupen64plus administrator *before this
commit is merged*:

- https://travis-ci.org/profile/mupen64plus
- Login via your Github account
- Make sure you are on "https://travis-ci.org/profile/mupen64plus"
- Switch repository to "On"
2014-07-06 12:31:41 +02:00
Richard Goedeken
5f69fc2f06 SDL 1.2 is not deprecated for us, and we shouldnt frighten the user with 6 lines of exclamation points 2014-05-04 11:27:02 -07:00
Ursula Abendroth
65f9525c19 Switch by default to SDL2 for Mupen64Plus 2.1
The current version of SDL is 2.0.3. All new releases of distributions contain
this library already. Current Linux distributions and OpenBSD even backporting
patches from Mupen64Plus 2.1 repo to use SDL 2. Android and other mobile
platform don't have support for legacy SDL 1.2.

People like Anthony J. Bentley and Riley Labrecque already requested
a new release of Mupen64Plus 2.1 with SDL2
2014-04-23 19:31:54 +02:00
littleguy77
21e7339243 android: Add android edition customizations. 2014-01-28 17:33:29 -05:00
littleguy77
1996f0b82d build: Add android makefile. 2014-01-28 17:33:18 -05:00
Sven Eckelmann
1837f96173 Force line ending type for specific files
Different operation systems (Unix vs. Windows) use different line ending types.
It can easily happen that users from different systems edit files and replace
all line endings of a file with the system specific version. This screws up
diffs and makes merges harder.

Git can normalize line endings for specific files and avoid this problem.
Binary files should be marked to avoid accidentally normalization.
2013-12-19 14:19:05 +01:00
Sven Eckelmann
4a19480020 Convert .hgignore to .gitignore 2013-12-19 14:13:38 +01:00
Sven Eckelmann
1346c0f7e0 Don't fail rebuild when header is removed
The *.d depends files for make just list the files used when building an
object file. Removing a file listed in such a dependency file causes make to
search for a way to recreate it. This usually cannot work because these files
aren't autogenerated.

The gcc option -MP can be used to generate empty rule for these files. Removing
a file in a dependency list will then execute this empty rule and continue with
the execution of the creation of the object file. This compilation process will
then automatically correct the dependency file.
2013-09-20 10:31:36 +02:00
richard42
ac039bb391 simplify OSX platform detection in makefile using xcode-select. based on patch from John Pender 2013-07-08 07:29:17 -07:00
Richard Goedeken
bce709a357 Added tag 2.0 for changeset eb2fad4ab7cc 2013-07-04 15:46:13 -07:00
Richard Goedeken
5ecbef80a2 update version number to 2.0 2013-07-03 07:05:34 -07:00
Richard Goedeken
d6b9b90507 update text files for upcoming 2.0 release 2013-06-24 22:44:01 -07:00
Sven Eckelmann
cc74b18d91 Initialize audiobuffer before mixing it against our data
SDL doesn't guarantee that the target audio buffer passed in its callback is
initialized to zero (silence). SDL_MixAudio may now try to mix the random data
from the dst buffer and the new data from the src buffer together and creating
distorted sound in this process.

Initializing the destination buffer to zero avoids this problem.
2013-06-11 10:55:08 +02:00
Richard Goedeken
3b07af44a9 tagged v2.0-rc2 2013-06-01 18:00:33 -07:00
richard42
63b56a0d17 Update msvc11 project file to visual studio 2012 (msvc11) 2013-06-01 07:53:09 -07:00
Sven Eckelmann
5ad950ffae Allow to statically set *_(CFLAGS|LIBS) without pkg-config
n.pepinpe requested in #540 to allow overwriting the automatically searched
CFLAGS and LIBS for used libraries. This should allow distributors to set the
build configuration without patching the makefile. This is important for
systems were pkg-config or sdl-config aren't normally used.
2013-05-11 14:59:48 +02:00
Sven Eckelmann
c45e2dcd2f Allow to statically set SDL_(CFLAGS|LIBS) without sdl-config
n.pepinpe requested in #540 to allow overwriting the automatically searched
CFLAGS and LIBS for used libraries. This should allow distributors to set the
build configuration without patching the makefile. This is important for
systems were pkg-config or sdl-config aren't normally used.
2013-05-11 12:25:52 +02:00
Sven Eckelmann
3a8bb412ce Enable Link-time optimization by default
The GCC introduced Link-time optimization in GCC 4.5 (2010-04-14). This should
be long enough available that interested users have upgraded to a compiler
supporting it.

The MSVC project already enabled WholeProgramOptimization since a long time.
Enabling it by default in GCC seems to be equally valid.
2013-05-11 11:25:44 +02:00
Sven Eckelmann
4267ac323b Add CFLAGS to the linker step
The GCC manual states for different parameters that the options for compilation
must also be used when linking. The options for compilation are stored in
CFLAGS and added to LINK.o to fix the behavior.

Option which need this are for example -fPIC/-fPIE or -flto.
2013-05-11 11:04:30 +02:00
Richard Goedeken
03645fba0d add msvc11 project file from mudlord 2013-03-20 22:24:30 -07:00
Sven Eckelmann
750de7c794 Fix typo in Hacktarux's nick 2013-03-14 08:29:02 +01:00
richard42
33235df9d6 merged heads 2013-02-02 22:19:06 -08:00
richard42
5dfde8da4c OSX build fix 2013-02-02 22:18:12 -08:00
Sven Eckelmann
b9dc2d58b4 Introduce WARNFLAGS for default (removable) compiler warning flags 2013-01-02 16:13:44 +01:00
Sven Eckelmann
19e8c67200 Disable OSS under MinGW to prevent build failures during cross compiles 2013-01-01 00:41:38 +01:00
Sven Eckelmann
0f854cd343 Disable PIC on MinGW to reduce warnings 2013-01-01 00:30:33 +01:00
n pepinpe
f336649a26 Fix path to OSX SDK with XCode >=4.3 2012-12-31 10:43:00 +01:00
Richard Goedeken
5796a6ca65 merge heads 2012-12-30 18:47:06 -08:00
Sven Eckelmann
522e27f10c Disabled Audio Mixing with SDL >= 1.3 to avoid distorted audio
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 src/main.c |    5 +++++
 1 file changed, 5 insertions(+)
2012-12-20 16:10:32 +01:00
Sven Eckelmann
4066559a70 Use $(OBJDIR) in clean target instead of hardcoded path 2012-12-13 14:53:04 +01:00
Sven Eckelmann
80c094b421 Allow to add a postfix for each build
The POSTFIX make option is useful for distributions to compile different
versions of the plugin in parallel. The object files will be stored in a
directory with the postfix appended and the linker result will also have this
postfix appended.
2012-12-13 14:47:15 +01:00
Sven Eckelmann
3050189433 Fix order of Makefile targets to print help by default 2012-12-13 14:07:56 +01:00
Sven Eckelmann
be8738e197 Add CROSS_COMPILE make option
The CROSS_COMPILE make option can be used to automatically prepend the prefix
to all build relevant tools to seamlessly allow cross compilation without
setting each tool name separately.

Cross compiling for MinGW32 would can be done using
$ make -C projects/unix/ CROSS_COMPILE=i686-pc-mingw32- HOST_CPU=i686 UNAME=MINGW
2012-12-13 12:25:23 +01:00
Sven Eckelmann
95db8eec0e Allow to change names of *-config tools for cross compiles 2012-12-13 11:33:49 +01:00
Sven Eckelmann
af8974e1ee Synchronize usage of environmental variables for UNAME with HOST_CPU 2012-12-13 10:52:49 +01:00
Sven Eckelmann
79e1e8e7ab Remove duplicated definition of MKDIR and CC for MinGW 2012-12-13 10:45:53 +01:00
veganaize
2c44ba6612 Add support for MingW32 2012-12-04 21:17:52 +01:00
Anthony J. Bentley
f9ad621686 Allow manually disabling OSS.
The previous check is inadequate, because OpenBSD has /dev/mixer but does
not use OSS.
2012-11-14 21:42:12 -07:00
Anthony J. Bentley
d6c1dafc14 Detect OpenBSD PowerPC platforms macppc and socppc. 2012-11-12 18:01:33 -07:00
Sven Eckelmann
7126a3ecf4 Add configuration for semi-supported architecture armel 2012-11-04 01:25:07 +01:00
Sven Eckelmann
9b27463cfa Add support for speexdsp resampler 2012-10-10 07:59:24 +02:00
Sven Eckelmann
95b879dba1 Rename NO_RESAMP compile option to NO_SRC 2012-10-10 07:59:24 +02:00
Sven Eckelmann
31fb39b481 Allow to change resampler quality 2012-10-10 07:59:24 +02:00
casualjames casualjames
135d83c346 From the changelog:
- Bugfix: Don't assume OSS is installed in all linux systems.
 - Bugfix: Some combinations of VolumeSetLevel and VolumeMute caused VolumeGetString to return Mute when not muted
 - Make SDL volume handling the default, since OSS is no longer included in the kernel.
 - Minor refactoring of volume handling code.

Personally, I would drop OSS support altogether, since it's deprecated (and some 'user-friendly' distros don't have it enabled by default, e.g. Ubuntu), and it changes the master volume level and 'remembers' it when muted (what if two programs did this?).
2012-08-27 22:46:18 +02:00
Sven Eckelmann
0976cef7c3 Enable experimental support for link-time optimization 2012-06-09 00:23:55 +02:00
Richard Goedeken
5540679e0a makefile change from Auria: add new linker flag in 32-bit build under OSX 2012-03-11 14:21:07 -07:00
Richard Goedeken
25235d882d Added tag 1.99.5 for changeset e503b9147e59 2012-03-10 10:28:39 -08:00
Richard Goedeken
28b533bf84 updating version and release info for v1.99.5 tag 2012-03-10 09:51:51 -08:00
Richard Goedeken
c02d7102b2 fixed round-off error in config parameter version checking 2012-03-04 15:41:50 -08:00
Richard Goedeken
f571c86ee6 bugfix: left out these declarations 2012-02-24 20:53:58 -08:00
Richard Goedeken
a441d503c1 bug fixes to config version handling 2012-02-23 20:17:51 -08:00
Richard Goedeken
b9c16f8c51 added basic code for updating param version number. 2012-02-22 21:39:58 -08:00
Richard Goedeken
3e8cb1e3f1 added version number to SDL-audio plugin config parameters, to support future changes 2012-02-21 22:09:26 -08:00
Sven Eckelmann
0f811f5f6c Remove additional -O3 on MacOSX 2011-10-14 19:58:41 +02:00
Sven Eckelmann
519a72b8b4 Explicitly disable PIC in case of PIC=0 2011-10-13 00:01:01 +02:00
Sven Eckelmann
f466b4ca39 Add help text about NO_RESAMP 2011-10-09 13:57:53 +02:00
Sven Eckelmann
0f23aa19d0 Ignore generated files in hg-status 2011-08-29 14:30:45 +02:00
Sven Eckelmann
ca4091ff91 Enable ppc(64) as experimental target
nogagplz tested mupen64plus on 32-bit ppc and didn't detect any big show
stoppers with interpreter cores and the mupen64plus example rom. This makes the
PowerPC an interesting target for further tests and may reveal other endianness
problems.
2011-08-05 10:46:14 +02:00
Sven Eckelmann
3f5f0701ab Enable PIC depending on architecture instead of bits only
nogagplz noticed on ppc32 that PIC is necessary to compile everything as shared
object. Therefore, it seems to be a better idea to have architecture specific
PIC default settings instead of checking only whether it is a 32 or 64 bit
architecture.
2011-08-05 10:32:06 +02:00
Sven Eckelmann
8fb2f67d95 Enable big endian mode on ppc and ppc64 2011-08-05 10:19:20 +02:00
Sven Eckelmann
c32b33f003 Strip binaries during install 2011-07-23 21:22:51 +02:00
Sven Eckelmann
d02aa488fd Allow to force PIC to remove text relocations 2011-07-10 13:37:54 +02:00
Sven Eckelmann
d04813c64d Fix linker search for libstdc++.so 2011-07-08 08:23:53 +00:00
Narann
80a0da9c93 A little "move to top" in some variable declarations to make MSVC compile! 2011-07-05 12:08:29 +02:00
Sven Eckelmann
20994566d3 Inform user about the possibility to make the build verbose 2011-07-03 18:04:47 +02:00
Sven Eckelmann
f5b0b6a010 Set changeable default compiler optimization option 2011-07-03 18:03:15 +02:00
Sven Eckelmann
4196b2cfbe Synchronize build rules with standard gnu make rules 2011-06-27 13:00:03 +02:00
Sven Eckelmann
a2aafcd22c Add OpenBSD as half-supported OS with FreeBSD userspace tools 2011-06-26 18:37:19 +02:00
Sven Eckelmann
8e6a5f3142 Remove -v parameter of install which is not available everywhere 2011-06-26 18:29:24 +02:00
Sven Eckelmann
2820b47b2f Split LIBDIR in LIBDIR and PLUGINDIR for consistency between modules 2011-06-26 02:05:06 +02:00
Sven Eckelmann
eb967549a7 Don't use plain 0 for pointers 2011-06-25 21:41:10 +02:00
Sven Eckelmann
912def4501 Mark not local only symbols as static 2011-06-25 21:40:37 +02:00
Sven Eckelmann
22974ae7ad Fix compilation with BITS=32 when using gcc-4.6 2011-06-25 21:29:58 +02:00
Sven Eckelmann
38cbf629f2 Use function prototypes defined by core 2011-06-25 21:23:47 +02:00
Sven Eckelmann
1903de49f5 Use ANSI function declaration for functions without arguments 2011-06-25 20:08:33 +02:00
Sven Eckelmann
363dd98d26 Remove unneccessary define PIC 2011-06-25 15:09:32 +02:00
Sven Eckelmann
c98444e1e4 Don't override optimisations set by linux build environment 2011-06-25 13:46:01 +02:00
Richard Goedeken
f49b6b8484 forgot to add this definition to the audio plugin 2011-05-17 18:06:32 -07:00
Richard Goedeken
2fcae489d2 updated audio plugin for new Mupen64plus 2.0 API versioning scheme 2011-05-16 21:45:43 -07:00
Richard Goedeken
d57e18e1f2 Added tag 1.99.4 for changeset 9735496674ec 2010-11-22 21:12:20 -05:00
Richard Goedeken
6724acf8ab updated version and RELEASE info for 1.99.4 tag 2010-11-22 21:12:17 -05:00
Richard Goedeken
bb7d070ee6 Plugin should write default config values at startup time 2010-09-25 21:48:59 -04:00
Sven Eckelmann
3d943a2214 Add GNU/Hurd as operating system with "linux" userland
---
2010-07-13 21:30:20 +02:00
Richard Goedeken
bc846549d4 FreeBSD makefile patches from David Demelier 2010-05-16 12:31:02 -04:00
Sven Eckelmann
5c7f94ec13 Build kfreebsd and GNU/kFreeBSD like Linux 2010-03-19 12:16:37 +01:00
Richard Goedeken
045f4c2ec8 merged the useful changes from Lazhur's fork 2010-03-19 00:22:12 -04:00
Sven Eckelmann
88533024e3 Add return value in non-void function resample 2010-03-04 23:27:25 +01:00
Sven Eckelmann
3c12b3eda7 Add automatically dependency tracking for C/C++ files
Every time a header is changed, the user had to cleanup the whole project and
then rebuild it. It is quite easy to fix and should help a lot when working on
the project. The dependency files will be created at the first run (when
dependency tracking isn't useful anyway) and should create nearly no overhead.
2010-03-04 22:45:16 +01:00
GoedekenR
7d05ebd7dc Fixed VC compile error caused by last night's commit 2010-02-23 08:21:25 -05:00
Richard Goedeken
d38f4ed40d fixed fast-forward for banjo-kazooie and other games which was broken due to limitation in basic resampling algorithm 2010-02-22 23:16:18 -05:00
Richard Goedeken
0b4c0e9a42 makefile updates: use CFLAGS+= instead of CFLAGS=, rmdir _obj 2010-02-20 10:36:03 -05:00
Richard Goedeken
ca5132a192 Added tag 1.99.3 for changeset eb7cb3666bde 2010-02-13 12:10:39 -05:00
Richard Goedeken
f131bb1f67 updated RELEASE file and version info for 1.99.3 tag 2010-02-13 12:10:29 -05:00
Richard Goedeken
34bb46efe6 bugfix #257: added to makefile OS type GNU/kFreeBSD 2010-01-20 21:56:26 -05:00
Richard Goedeken
ab87e2b1e9 sync with core<-->plugin API change for RomOpen() 2010-01-11 23:01:45 -05:00
Richard Goedeken
40f162e9bd plugin must be linked with CC instead of LD because 'sdl-config --libs' can give an output with a -Wl,-rpath option, which only works with gcc not ld 2010-01-09 00:14:31 -05:00
Richard Goedeken
498d6d240f bugfix: logical error in previous audio refactoring causing slowdown/lockup on loading savestate or re-initializing audio. related code cleanup 2010-01-08 22:47:00 -05:00
GoedekenR
fffd5f11fc moved 1.99.2 tag to include the msvc8 project file 2010-01-07 22:48:27 -05:00
27 changed files with 2459 additions and 1028 deletions

38
.gitattributes vendored Normal file
View file

@ -0,0 +1,38 @@
* text=auto
# normal text files
*.6 text
AUTHORS text
*.c text
*.cfg text
*.cht text
*.conf text
COPYING text
*.cpp text
*.def text
*-license text
*.h text
*.html text
*.ini text
INSTALL text
LICENSES text
Makefile text
*.py text
README text
RELEASE text
*.S text
*.sh text
*.txt text
*.ver text
# windows specific text files
*.sln text eol=crlf
*.vcproj text eol=crlf
*.vcxproj text eol=crlf
*.vcxproj.filters text eol=crlf
# binary files
*.gz binary
*.ttf binary
cursor.tex binary
font.tex binary

160
.github/workflows/build.yml vendored Normal file
View file

@ -0,0 +1,160 @@
name: SDL Audio
on:
push:
paths-ignore:
- '.{gitattributes,gitignore,travis.yml}'
- '*.md,appveyor.yml,README'
pull_request:
paths-ignore:
- '.{gitattributes,gitignore,travis.yml}'
- '*.md,appveyor.yml,README'
workflow_dispatch:
jobs:
Linux:
strategy:
fail-fast: false
matrix:
include:
- cc: GCC
arch: x64
- cc: GCC
arch: x86
- cc: Clang
arch: x64
- cc: Clang
arch: x86
name: Linux / ${{ matrix.cc }} / ${{ matrix.arch }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Get build dependencies and arrange the environment
run: |
git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ../mupen64plus-core
export C_CLANG_SUFFIX="-15" C_GCC_SUFFIX="-12"
export BUILD_DEPS="libsamplerate0-dev libsdl1.2-dev libsdl2-dev libspeexdsp-dev"
./../mupen64plus-core/.github/workflows/scripts/ci_install_ubuntu_deps.sh ${{ matrix.arch }} ${{ matrix.cc }}
- name: Build and related stuff, backup binaries
run: |
export C_CLANG_SUFFIX="-15" C_GCC_SUFFIX="-12"
export PATH="$(pwd)/../mupen64plus-core/.github/workflows/scripts:${PATH}"
export CONFIG_OVERRIDE="SDL_CONFIG="sdl-config""
ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }}
export CONFIG_OVERRIDE="SDL_CONFIG="sdl2-config""
ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }} makepkg
- name: Upload artifact
if: matrix.cc == 'GCC'
uses: actions/upload-artifact@v4
with:
name: ${{ env.PKG_NAME }}
path: pkg/*.tar.gz
MSYS2:
strategy:
fail-fast: false
matrix:
include:
- cc: GCC
arch: x64
cross: x86_64
env: MINGW64
- cc: GCC
arch: x86
cross: i686
env: MINGW32
name: Windows / MSYS2 ${{ matrix.cc }} / ${{ matrix.arch }}
runs-on: windows-2022
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v4
- uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.env }}
update: true
install: >-
git
libtool
make
mingw-w64-${{ matrix.cross }}-gcc
mingw-w64-${{ matrix.cross }}-toolchain
mingw-w64-${{ matrix.cross }}-libsamplerate
mingw-w64-${{ matrix.cross }}-ntldd
mingw-w64-${{ matrix.cross }}-SDL2
mingw-w64-${{ matrix.cross }}-speexdsp
- name: Build and related stuff, backup binaries
run: |
git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ../mupen64plus-core
./../mupen64plus-core/.github/workflows/scripts/ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }}
- name: Backup dependencies, etc...
run: |
./../mupen64plus-core/.github/workflows/scripts/ci_backup_mingw_deps.sh ${{ matrix.env }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.PKG_NAME }}
path: pkg/*
MSVC:
strategy:
fail-fast: false
matrix:
include:
- toolset: v143
arch: x64
vs: 2022
- toolset: v141_xp
arch: x86
vs: 2019
name: Windows / MSVC with ${{ matrix.toolset }} / ${{ matrix.arch }}
runs-on: windows-${{ matrix.vs }}
defaults:
run:
shell: cmd
steps:
- uses: actions/checkout@v4
- uses: microsoft/setup-msbuild@v2
- name: Build and related stuff, backup binaries
run: |
git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ..\mupen64plus-core
set TOOLSET=${{ matrix.toolset }}
.\..\mupen64plus-core\.github\workflows\scripts\ci_msvc_build.cmd ${{ matrix.arch }}
- name: Backup dependencies, etc...
run: |
.\..\mupen64plus-core\.github\workflows\scripts\ci_backup_msvc_deps.cmd ${{ matrix.arch }} SDL2.dll
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.PKG_NAME }}
path: pkg/*
Nightly-build:
runs-on: ubuntu-latest
if: github.ref_name == 'master'
needs: [Linux, MSYS2, MSVC]
steps:
- uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: binaries
- name: Get some tools
run: |
git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ../mupen64plus-core
sudo apt-get update
sudo apt-get -y install hashdeep
- name: Creating new artifacts and update nightly-build
run: |
./../mupen64plus-core/.github/workflows/scripts/ci_nightly_artifacts.sh
- name: Nightly-build
uses: ncipollo/release-action@v1
with:
prerelease: true
allowUpdates: true
removeArtifacts: true
replacesArtifacts: false
tag: nightly-build
artifacts: pkg/*

156
.github/workflows/schedule.yml vendored Normal file
View file

@ -0,0 +1,156 @@
name: SDL Audio - Scheduled
on:
schedule:
- cron: '45 14 21 * *'
jobs:
Linux:
strategy:
fail-fast: false
matrix:
include:
- cc: GCC
arch: x64
- cc: GCC
arch: x86
- cc: Clang
arch: x64
- cc: Clang
arch: x86
name: Linux / ${{ matrix.cc }} / ${{ matrix.arch }}
runs-on: ubuntu-22.04
if: github.repository == 'mupen64plus/mupen64plus-audio-sdl'
steps:
- uses: actions/checkout@v4
- name: Get build dependencies and arrange the environment
run: |
git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ../mupen64plus-core
export C_CLANG_SUFFIX="-15" C_GCC_SUFFIX="-12"
export BUILD_DEPS="libsamplerate0-dev libsdl1.2-dev libsdl2-dev libspeexdsp-dev"
./../mupen64plus-core/.github/workflows/scripts/ci_install_ubuntu_deps.sh ${{ matrix.arch }} ${{ matrix.cc }}
- name: Build and related stuff, backup binaries
run: |
export C_CLANG_SUFFIX="-15" C_GCC_SUFFIX="-12"
export PATH="$(pwd)/../mupen64plus-core/.github/workflows/scripts:${PATH}"
export CONFIG_OVERRIDE="SDL_CONFIG="sdl-config""
ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }}
export CONFIG_OVERRIDE="SDL_CONFIG="sdl2-config""
ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }} makepkg
- name: Upload artifact
if: matrix.cc == 'GCC'
uses: actions/upload-artifact@v4
with:
name: ${{ env.PKG_NAME }}
path: pkg/*.tar.gz
MSYS2:
strategy:
fail-fast: false
matrix:
include:
- cc: GCC
arch: x64
cross: x86_64
env: MINGW64
- cc: GCC
arch: x86
cross: i686
env: MINGW32
name: Windows / MSYS2 ${{ matrix.cc }} / ${{ matrix.arch }}
runs-on: windows-2022
if: github.repository == 'mupen64plus/mupen64plus-audio-sdl'
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v4
- uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.env }}
update: true
install: >-
git
libtool
make
mingw-w64-${{ matrix.cross }}-gcc
mingw-w64-${{ matrix.cross }}-toolchain
mingw-w64-${{ matrix.cross }}-libsamplerate
mingw-w64-${{ matrix.cross }}-ntldd
mingw-w64-${{ matrix.cross }}-SDL2
mingw-w64-${{ matrix.cross }}-speexdsp
- name: Build and related stuff, backup binaries
run: |
git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ../mupen64plus-core
./../mupen64plus-core/.github/workflows/scripts/ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }}
- name: Backup dependencies, etc...
run: |
./../mupen64plus-core/.github/workflows/scripts/ci_backup_mingw_deps.sh ${{ matrix.env }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.PKG_NAME }}
path: pkg/*
MSVC:
strategy:
fail-fast: false
matrix:
include:
- toolset: v143
arch: x64
vs: 2022
- toolset: v141_xp
arch: x86
vs: 2019
name: Windows / MSVC with ${{ matrix.toolset }} / ${{ matrix.arch }}
runs-on: windows-${{ matrix.vs }}
if: github.repository == 'mupen64plus/mupen64plus-audio-sdl'
defaults:
run:
shell: cmd
steps:
- uses: actions/checkout@v4
- uses: microsoft/setup-msbuild@v2
- name: Build and related stuff, backup binaries
run: |
git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ..\mupen64plus-core
set TOOLSET=${{ matrix.toolset }}
.\..\mupen64plus-core\.github\workflows\scripts\ci_msvc_build.cmd ${{ matrix.arch }}
- name: Backup dependencies, etc...
run: |
.\..\mupen64plus-core\.github\workflows\scripts\ci_backup_msvc_deps.cmd ${{ matrix.arch }} SDL2.dll
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.PKG_NAME }}
path: pkg/*
Nightly-build:
runs-on: ubuntu-latest
if: github.ref_name == 'master'
needs: [Linux, MSYS2, MSVC]
steps:
- uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: binaries
- name: Get some tools
run: |
git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ../mupen64plus-core
sudo apt-get update
sudo apt-get -y install hashdeep
- name: Creating new artifacts and update nightly-build
run: |
./../mupen64plus-core/.github/workflows/scripts/ci_nightly_artifacts.sh
- name: Nightly-build
uses: ncipollo/release-action@v1
with:
prerelease: true
allowUpdates: true
removeArtifacts: true
replacesArtifacts: false
tag: nightly-build
artifacts: pkg/*

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
/projects/unix/_obj*/
/projects/unix/mupen64plus-audio-sdl*.so

66
.travis.yml Normal file
View file

@ -0,0 +1,66 @@
sudo: required
dist: xenial
language: cpp
compiler:
- gcc
- clang
addons:
apt:
packages:
- git
- libsdl1.2-dev
- libsdl2-dev
- libsamplerate0-dev
- libspeexdsp-dev
- pkg-config
before_install:
- git clone --depth=1 --branch=master git://github.com/mupen64plus/mupen64plus-core.git deps/mupen64plus-core
env:
- NO_SRC=0 NO_SPEEX=0
- NO_SRC=0 NO_SPEEX=0
- NO_SRC=0 NO_SPEEX=1
- NO_SRC=0 NO_SPEEX=1
- NO_SRC=1 NO_SPEEX=0
- NO_SRC=1 NO_SPEEX=0
- NO_SRC=1 NO_SPEEX=1
- NO_SRC=1 NO_SPEEX=1
script:
- make -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/" V=1 clean && LDFLAGS="-Wl,--no-add-needed -Wl,--no-undefined" OPTFLAGS="-O2" make SDL_CONFIG=sdl-config CC="${CC}" CXX="${CXX}" -j$(nproc) -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/" V=1 all
- make -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/" V=1 clean && LDFLAGS="-Wl,--no-add-needed -Wl,--no-undefined" OPTFLAGS="-O2" make SDL_CONFIG=sdl2-config CC="${CC}" CXX="${CXX}" -j$(nproc) -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/" V=1 all
# extra mxe build entries
matrix:
include:
- env:
- MXE_CPU=i686
- PATH="/usr/lib/mxe/usr/bin/:$PATH"
before_install:
- curl -sSL "https://mirror.mxe.cc/repos/apt/client-conf/mxeapt.gpg" | sudo -E apt-key add -
- echo "deb https://mirror.mxe.cc/repos/apt xenial main" | sudo tee -a /etc/apt/sources.list
- sudo apt-get update -qq
- sudo apt-get -y --allow-unauthenticated install mxe-i686-w64-mingw32.shared-gcc
- sudo apt-get -y --allow-unauthenticated install mxe-i686-w64-mingw32.shared-sdl2
- sudo apt-get -y --allow-unauthenticated install mxe-i686-w64-mingw32.shared-speexdsp
- sudo apt-get -y --allow-unauthenticated install mxe-i686-w64-mingw32.shared-libsamplerate
- sudo apt-get -y --allow-unauthenticated install mxe-i686-w64-mingw32.shared-pkgconf
- git clone --depth=1 --branch=master git://github.com/mupen64plus/mupen64plus-core.git deps/mupen64plus-core
script:
- make UNAME=MINGW CROSS_COMPILE="${MXE_CPU}-w64-mingw32.shared-" CC="${MXE_CPU}-w64-mingw32.shared-gcc" CXX="${MXE_CPU}-w64-mingw32.shared-g++" HOST_CPU="${MXE_CPU}" SDL_CONFIG="${MXE_CPU}-w64-mingw32.shared-sdl2-config" -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/" V=1 clean &&
make UNAME=MINGW CROSS_COMPILE="${MXE_CPU}-w64-mingw32.shared-" CC="${MXE_CPU}-w64-mingw32.shared-gcc" CXX="${MXE_CPU}-w64-mingw32.shared-g++" HOST_CPU="${MXE_CPU}" SDL_CONFIG="${MXE_CPU}-w64-mingw32.shared-sdl2-config" -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/" V=1 -j$(nproc) all
- env:
- MXE_CPU=x86_64
- PATH="/usr/lib/mxe/usr/bin/:$PATH"
before_install:
- curl -sSL "https://mirror.mxe.cc/repos/apt/client-conf/mxeapt.gpg" | sudo -E apt-key add -
- echo "deb https://mirror.mxe.cc/repos/apt xenial main" | sudo tee -a /etc/apt/sources.list
- sudo apt-get update -qq
- sudo apt-get -y --allow-unauthenticated install mxe-x86-64-w64-mingw32.shared-gcc
- sudo apt-get -y --allow-unauthenticated install mxe-x86-64-w64-mingw32.shared-sdl2
- sudo apt-get -y --allow-unauthenticated install mxe-x86-64-w64-mingw32.shared-speexdsp
- sudo apt-get -y --allow-unauthenticated install mxe-x86-64-w64-mingw32.shared-libsamplerate
- sudo apt-get -y --allow-unauthenticated install mxe-x86-64-w64-mingw32.shared-pkgconf
- git clone --depth=1 --branch=master git://github.com/mupen64plus/mupen64plus-core.git deps/mupen64plus-core
script:
- make UNAME=MINGW CROSS_COMPILE="${MXE_CPU}-w64-mingw32.shared-" CC="${MXE_CPU}-w64-mingw32.shared-gcc" CXX="${MXE_CPU}-w64-mingw32.shared-g++" HOST_CPU="${MXE_CPU}" SDL_CONFIG="${MXE_CPU}-w64-mingw32.shared-sdl2-config" -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/" V=1 clean &&
make UNAME=MINGW CROSS_COMPILE="${MXE_CPU}-w64-mingw32.shared-" CC="${MXE_CPU}-w64-mingw32.shared-gcc" CXX="${MXE_CPU}-w64-mingw32.shared-g++" HOST_CPU="${MXE_CPU}" SDL_CONFIG="${MXE_CPU}-w64-mingw32.shared-sdl2-config" -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/" V=1 -j$(nproc) all

View file

@ -13,6 +13,9 @@ The authors of Mupen64Plus are:
* Louai Al-Khanji (slougi)
* Bob Forder (orbitaldecay)
* Jason Espinosa (hasone)
* Nebuleon
* krnlyng
* Casualjames
* HyperHacker
* and others.
@ -28,7 +31,7 @@ Mupen64Plus is based on GPL-licensed source code from Mupen64 v0.5, originally w
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

91
RELEASE
View file

@ -1,6 +1,97 @@
SDL Audio plugin for Mupen64Plus
---------------------------------
----------------------------------------------
# Mupen64Plus-audio-sdl v2.6.0 - July 14, 2024
## Merged PRs
* [43](https://github.com/mupen64plus/mupen64plus-audio-sdl/pull/43): CI/CD: Update to generic scripts, independent schedule, etc
* [42](https://github.com/mupen64plus/mupen64plus-audio-sdl/pull/42): CI/CD: Fixes Ubuntu i386 builds, among other changes
* [41](https://github.com/mupen64plus/mupen64plus-audio-sdl/pull/41): CI/CD: Integrate scheduled builds and other...
* [40](https://github.com/mupen64plus/mupen64plus-audio-sdl/pull/40): CI/CD: Update MSVC
* [39](https://github.com/mupen64plus/mupen64plus-audio-sdl/pull/39): CI/CD: Update
* [38](https://github.com/mupen64plus/mupen64plus-audio-sdl/pull/38): CI/CD: Implement GitHub Actions and public nightly builds
* [37](https://github.com/mupen64plus/mupen64plus-audio-sdl/pull/37): Fix channel swapping logic for BigEndian systems
* [35](https://github.com/mupen64plus/mupen64plus-audio-sdl/pull/35): Fixes
* [34](https://github.com/mupen64plus/mupen64plus-audio-sdl/pull/34): build: Allow out of tree builds.
* [32](https://github.com/mupen64plus/mupen64plus-audio-sdl/pull/32): Allow non-default compilers without resorting to symbolic links
* [31](https://github.com/mupen64plus/mupen64plus-audio-sdl/pull/31): Allow to set custom platform toolset from commands
* [30](https://github.com/mupen64plus/mupen64plus-audio-sdl/pull/30): Add SDL2 compatibility
* [29](https://github.com/mupen64plus/mupen64plus-audio-sdl/pull/29): AppVeyor with artifact packaging
* [28](https://github.com/mupen64plus/mupen64plus-audio-sdl/pull/28): Changes to have more generic project files
* [27](https://github.com/mupen64plus/mupen64plus-audio-sdl/pull/27): Fix gcc 8.3 compile with headers for uint32_t
## Top Contributors (2 or more commits)
1. Jj0YzL5nvJ
2. bsmiles32
3. richard42
4. Gillou68310
--------------------------------------------------
# Mupen64Plus-audio-sdl v2.5.9 - February 10, 2019
## Merged PRs
* [26](https://github.com/mupen64plus/mupen64plus-audio-sdl/pull/26): Remove use of ConfigSaveOptions.
* [25](https://github.com/mupen64plus/mupen64plus-audio-sdl/pull/25): Update homepage links
* [24](https://github.com/mupen64plus/mupen64plus-audio-sdl/pull/24): Fix swap channels path.
* [23](https://github.com/mupen64plus/mupen64plus-audio-sdl/pull/23): Remove underrun messages as it spammed too much and is not really needed
* [22](https://github.com/mupen64plus/mupen64plus-audio-sdl/pull/22): Build MXE targets as additional tests in travis build matrix
* [21](https://github.com/mupen64plus/mupen64plus-audio-sdl/pull/21): Various fixes.
Hopefully this should fix the "audio cracks" reported in https://github.com/mupen64plus/mupen64plus-core/issues/463
* [20](https://github.com/mupen64plus/mupen64plus-audio-sdl/pull/20): Disable speex/src when their libraries are not found
* [19](https://github.com/mupen64plus/mupen64plus-audio-sdl/pull/19): Refactorings
* [17](https://github.com/mupen64plus/mupen64plus-audio-sdl/pull/17): Use faster container based Travis CI
* [16](https://github.com/mupen64plus/mupen64plus-audio-sdl/pull/16): Allow audio/video sync to be configured, default to off
* [15](https://github.com/mupen64plus/mupen64plus-audio-sdl/pull/15): Use resampler if available
* [14](https://github.com/mupen64plus/mupen64plus-audio-sdl/pull/14): bump macosx-version-min to 10.6 for SDL2.0.5.
Allows for compilation on MacOS 10.12 Sierra using packages from Homebrew (samplerate speexdsp nasm and the sdl2 packages).
* [13](https://github.com/mupen64plus/mupen64plus-audio-sdl/pull/13): Use Ubuntu Trusty as base system for Travis CI
* [12](https://github.com/mupen64plus/mupen64plus-audio-sdl/pull/12): Added x64 configuration to VisualStudio2013 project file
* [11](https://github.com/mupen64plus/mupen64plus-audio-sdl/pull/11): Remove unnecessary OpenBSD warning.
* [10](https://github.com/mupen64plus/mupen64plus-audio-sdl/pull/10): bug workaround (volume does not follow system volume on jolla phone)
Mupen64Plus-audio-sdl - v2.5 - April 26, 2015
---------------------------------------------
- MS Visual Studio 2013 project files
- audioresource support for integration with Linux-based Nemo Mobile OS
- Makefile: use SDL2 by default if present, disable OSS support on OpenBSD
Mupen64Plus-audio-sdl - v2.0 - July 4, 2013
-------------------------------------------
- Add support for resampling with speexdsp library
- Add more resampling quality options
- Bugfix: Don't assume OSS is installed in all linux systems.
- Bugfix: Some combinations of VolumeSetLevel and VolumeMute caused VolumeGetString to return "Mute" when not muted
- Make SDL volume handling the default, since OSS is no longer included in the kernel.
- Minor refactoring of volume handling code.
- MS Visual Studio 2012 project files
- Makefile improvements
- support for ARM and MINGW architectures
- support for cross-compiling (MXE win32 builds under Unix)
Mupen64Plus-audio-sdl v1.99.5 - March 10, 2012
--------------------------------------------------
- added version number to SDL-audio plugin config parameters, to support future changes
- updated audio plugin for new Mupen64plus 2.0 API versioning scheme
- makefile fixes and improvements
Mupen64Plus-audio-sdl v1.99.4 - November 22, 2010
--------------------------------------------------
- Bugfix: Plugin should write default config values at startup time
- Bugfix: fixed fast-forward for banjo-kazooie and other games which was broken due to limitation in basic resampling algorithm
- many makefile fixes and improvements
Mupen64Plus-audio-sdl v1.99.3 - February 13, 2010
--------------------------------------------------
- sync with core<-->plugin API change for RomOpen()
- bugfix: logical error in previous audio refactoring causing slowdown/lockup on loading savestate or re-initializing audio
- Makefile improvements:
- 'sdl-config --libs' can give "-Wl,-rpath", so plugin must be linked with CC instead of LD
- issue #257: added to makefile OS type GNU/kFreeBSD
Mupen64Plus-audio-sdl v1.99.2 - January 6, 2010
-------------------------------------------------
- new feature: Completely re-wrote buffering/synchronization code:

41
appveyor.yml Normal file
View file

@ -0,0 +1,41 @@
version: 1.0.{build}
image: Visual Studio 2022
skip_tags: true
skip_commits:
files:
- '**/*.md'
- .github/
- data/*
- .gitattributes
- .gitignore
- .travis.yml
- README
configuration:
- Release
platform:
- Win32
- x64
before_build:
- git tag --delete nightly-build
- git clone --depth 1 https://github.com/mupen64plus/mupen64plus-win32-deps.git ..\mupen64plus-win32-deps
- git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ..\mupen64plus-core
build_script:
- msbuild projects\msvc\mupen64plus-audio-sdl.vcxproj /p:Configuration=%configuration%;Platform=%platform%
after_build:
- ps: $env:rev1 = git describe --tags
- set rev2=%platform%
- if "%rev2%"=="Win32" set rev2=x86
- set filepkg=mupen64plus-audio-sdl_v%rev1%_%rev2%
- cd projects\msvc\%platform%\%configuration%
- 7z a -t7z ..\..\..\..\build\%filepkg%.7z *.dll
artifacts:
- path: build\$(filepkg).7z
name: $(filepkg)

View file

@ -0,0 +1,160 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{96969748-EA54-43FC-8103-A346E9AD98E7}</ProjectGuid>
<RootNamespace>mupen64plusaudiosdl</RootNamespace>
</PropertyGroup>
<PropertyGroup Condition="'$(WindowsTargetPlatformVersion)'=='' and '$(VisualStudioVersion)' != '14.0'">
<LatestTargetPlatformVersion>$([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))</LatestTargetPlatformVersion>
<WindowsTargetPlatformVersion>$(LatestTargetPlatformVersion)</WindowsTargetPlatformVersion>
<TargetPlatformVersion>$(WindowsTargetPlatformVersion)</TargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(PlatformToolset)'=='' or '$(PlatformToolset)'=='v100'" Label="Configuration">
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\src;..\..\..\mupen64plus-core\src\api;..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
</ClCompile>
<Link>
<AdditionalDependencies>..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\lib\x86\SDL2.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\src;..\..\..\mupen64plus-core\src\api;..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
</ClCompile>
<Link>
<AdditionalDependencies>..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\lib\x64\SDL2.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..\..\src;..\..\..\mupen64plus-core\src\api;..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
</ClCompile>
<Link>
<AdditionalDependencies>..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\lib\x86\SDL2.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>..\..\src;..\..\..\mupen64plus-core\src\api;..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
</ClCompile>
<Link>
<AdditionalDependencies>..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\lib\x64\SDL2.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\src\circular_buffer.c" />
<ClCompile Include="..\..\src\main.c" />
<ClCompile Include="..\..\src\osal_dynamiclib_win32.c" />
<ClCompile Include="..\..\src\sdl_backend.c" />
<ClCompile Include="..\..\src\resamplers\resamplers.c" />
<ClCompile Include="..\..\src\resamplers\trivial.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\src\circular_buffer.h" />
<ClInclude Include="..\..\src\main.h" />
<ClInclude Include="..\..\src\osal_dynamiclib.h" />
<ClInclude Include="..\..\src\sdl_backend.h" />
<ClInclude Include="..\..\src\resamplers\resamplers.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View file

@ -1,213 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="mupen64plus-audio-sdl"
ProjectGUID="{96969748-EA54-43FC-8103-A346E9AD98E7}"
RootNamespace="mupen64plusaudiosdl"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\mupen64plus-core\src\api;..\..\..\mupen64plus-win32-deps\SDL-1.2.14\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="..\..\..\mupen64plus-win32-deps\SDL-1.2.14\lib\SDL.lib"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\..\mupen64plus-core\src\api;..\..\..\mupen64plus-win32-deps\SDL-1.2.14\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="..\..\..\mupen64plus-win32-deps\SDL-1.2.14\lib\SDL.lib"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\src\main.c"
>
</File>
<File
RelativePath="..\..\src\osal_dynamiclib_win32.c"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\..\src\main.h"
>
</File>
<File
RelativePath="..\..\src\osal_dynamiclib.h"
>
</File>
<File
RelativePath="..\..\src\osal_preproc.h"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -1,6 +1,6 @@
#/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
# * Mupen64plus-audio-sdl - Makefile *
# * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
# * Mupen64Plus homepage: https://mupen64plus.org/ *
# * Copyright (C) 2007-2009 Richard Goedeken *
# * Copyright (C) 2007-2008 Tillin9 *
# * *
@ -22,7 +22,7 @@
# Makefile for SDL Audio plugin in Mupen64plus
# detect operation system
UNAME = $(shell uname -s)
UNAME ?= $(shell uname -s)
OS := NONE
ifeq ("$(UNAME)","Linux")
OS = LINUX
@ -34,6 +34,11 @@ ifeq ("$(UNAME)","linux")
SHARED = -shared
SO_EXTENSION = so
endif
ifneq ("$(filter GNU hurd,$(UNAME))","")
OS = LINUX
SHARED = -shared
SO_EXTENSION = so
endif
ifeq ("$(UNAME)","Darwin")
OS = OSX
SHARED = -bundle
@ -44,111 +49,196 @@ ifeq ("$(UNAME)","FreeBSD")
SHARED = -shared
SO_EXTENSION = so
endif
ifeq ("$(UNAME)","OpenBSD")
OS = FREEBSD
SHARED = -shared
SO_EXTENSION = so
NO_OSS = 1
endif
ifneq ("$(filter GNU/kFreeBSD kfreebsd,$(UNAME))","")
OS = LINUX
SHARED = -shared
SO_EXTENSION = so
endif
ifeq ("$(patsubst MINGW%,MINGW,$(UNAME))","MINGW")
OS = MINGW
SHARED = -shared
SO_EXTENSION = dll
PIC = 0
NO_OSS = 1
endif
ifeq ("$(OS)","NONE")
$(error OS type "$(UNAME)" not supported. Please file bug report at 'http://code.google.com/p/mupen64plus/issues')
$(error OS type "$(UNAME)" not supported. Please file bug report at 'https://github.com/mupen64plus/mupen64plus-core/issues')
endif
# detect system architecture
# detect system architecture, only if it matters for build flags
HOST_CPU ?= $(shell uname -m)
NO_ASM ?= 1
CPU := NONE
CPU := OTHER
ifneq ("$(filter x86_64 amd64,$(HOST_CPU))","")
CPU := X86
ifeq ("$(BITS)", "32")
ARCH_DETECTED := 64BITS_32
PIC ?= 0
else
ARCH_DETECTED := 64BITS
PIC ?= 1
endif
endif
ifneq ("$(filter pentium i%86,$(HOST_CPU))","")
CPU := X86
ARCH_DETECTED := 32BITS
PIC ?= 0
endif
# PPC doesn't work yet
#ifneq ("$(filter ppc powerpc,$(HOST_CPU))","")
# CPU := PPC
# ARCH_DETECTED := 32BITS
#endif
#ifneq ("$(filter ppc64 powerpc64,$(HOST_CPU))","")
# CPU := PPC
# ARCH_DETECTED := 64BITS
#endif
ifeq ("$(CPU)","NONE")
$(error CPU type "$(HOST_CPU)" not supported. Please file bug report at 'http://code.google.com/p/mupen64plus/issues')
ifeq ("$(CPU)","OTHER")
PIC ?= 1
endif
# base CFLAGS, LIBS, and LDFLAGS
CFLAGS = -ffast-math -funroll-loops -fexpensive-optimizations -fno-strict-aliasing -I../../src
LDFLAGS = -ldl
SRCDIR = ../../src
OBJDIR = _obj$(POSTFIX)
# Since we are building a shared library, we must compile with -fPIC for x86_64 CPUs.
# On 32-bit systems we do not want to use -fPIC because we don't have to and it has a big performance penalty on this arch
ifeq ($(ARCH_DETECTED), 64BITS)
CFLAGS += -fpic -DPIC -fvisibility=hidden
# base CFLAGS, LDLIBS, and LDFLAGS
OPTFLAGS ?= -O3 -flto
WARNFLAGS ?= -Wall
CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -ffast-math -fvisibility=hidden -I$(SRCDIR)
LDFLAGS += $(SHARED)
# Since we are building a shared library, we must compile with -fPIC on some architectures
# On 32-bit x86 systems we do not want to use -fPIC because we don't have to and it has a big performance penalty on this arch
ifeq ($(PIC), 1)
CFLAGS += -fPIC
else
CFLAGS += -fno-PIC
endif
# tweak flags for 32-bit build on 64-bit system
ifeq ($(ARCH_DETECTED), 64BITS_32)
ifeq ($(OS), FREEBSD)
$(error Do not use the BITS=32 option with FreeBSD, use -m32 and -m elf_i386)
endif
CFLAGS += -m32
LDFLAGS += -m32 -m elf_i386
ifneq ($(OS), OSX)
ifeq ($(OS), MINGW)
LDFLAGS += -Wl,-m,i386pe
else
CFLAGS += -m32
LDFLAGS += -Wl,-m,elf_i386
endif
endif
endif
ifeq ($(ARCH_DETECTED), 64BITS)
ifeq ($(OS), MINGW)
LDFLAGS += -Wl,-m,i386pep
endif
endif
# set special flags per-system
ifeq ($(OS), LINUX)
ifeq ($(CPU), X86)
ifeq ($(ARCH_DETECTED), 64BITS)
CFLAGS += -pipe -O3 -march=athlon64
else
CFLAGS += -pipe -O3 -mmmx -msse -march=i686 -mtune=pentium-m -fomit-frame-pointer
endif
endif
LDLIBS += -ldl
endif
ifeq ($(OS), OSX)
OSX_SDK_PATH = $(shell xcrun --sdk macosx --show-sdk-path)
ifeq ($(CPU), X86)
ifeq ($(ARCH_DETECTED), 64BITS)
CFLAGS += -pipe -O3 -arch x86_64 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk
LDFLAGS += -arch x86_64
CFLAGS += -pipe -arch x86_64 -mmacosx-version-min=10.9 -isysroot $(OSX_SDK_PATH)
LDLIBS += -ldl
else
CFLAGS += -pipe -O3 -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk
LDFLAGS += -arch i686
CFLAGS += -pipe -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=10.9 -isysroot $(OSX_SDK_PATH)
LDLIBS += -ldl -read_only_relocs suppress
endif
endif
endif
ifeq ($(CPU), PPC)
CFLAGS += -mcpu=powerpc
# test for essential build dependencies
ifeq ($(origin PKG_CONFIG), undefined)
PKG_CONFIG = $(CROSS_COMPILE)pkg-config
ifeq ($(shell which $(PKG_CONFIG) 2>/dev/null),)
$(error $(PKG_CONFIG) not found)
endif
endif
# test for presence of SDL
ifeq ($(shell which sdl-config 2>/dev/null),)
$(error No SDL development libraries found!)
ifeq ($(origin SDL_CFLAGS) $(origin SDL_LDLIBS), undefined undefined)
ifeq ($(shell $(PKG_CONFIG) --modversion sdl2 2>/dev/null),)
$(error No SDL2 development libraries found!)
endif
SDL_CFLAGS += $(shell $(PKG_CONFIG) --cflags sdl2)
SDL_LDLIBS += $(shell $(PKG_CONFIG) --libs sdl2)
endif
ifeq ($(OS),FREEBSD)
CFLAGS += `${SDL_CONFIG} --cflags`
LDFLAGS += `${SDL_CONFIG} --libs`
endif
ifeq ($(OS),OSX)
CFLAGS += $(shell sdl-config --cflags)
# sdl-config on mac screws up when we're trying to build a library and not an executable
# SDL 1.3 is supposed to fix that, if it's ever released
LDFLAGS += -L/usr/local/lib -lSDL -Wl,-framework,Cocoa
endif
ifeq ($(OS),LINUX)
CFLAGS += $(shell sdl-config --cflags)
LDFLAGS += $(shell sdl-config --libs)
CFLAGS += $(SDL_CFLAGS)
LDLIBS += $(SDL_LDLIBS)
# test for presence of speexdsp
ifneq ($(NO_SPEEX), 1)
ifeq ($(origin SPEEX_CFLAGS) $(origin SPEEX_LDLIBS), undefined undefined)
ifneq ($(strip $(shell $(PKG_CONFIG) speexdsp --modversion 2> /dev/null)),)
# set speexdsp flags and libraries
SPEEX_CFLAGS += $(shell $(PKG_CONFIG) speexdsp --cflags) -DUSE_SPEEX
SPEEX_LDLIBS += $(shell $(PKG_CONFIG) speexdsp --libs)
else
# warn user
$(warning No libspeexdsp development libraries found. Mupen64plus-sdl-audio will be built without speex-* resampler.)
NO_SPEEX = 1
endif
else
SPEEX_CFLAGS += -DUSE_SPEEX
endif
CFLAGS += $(SPEEX_CFLAGS)
LDLIBS += $(SPEEX_LDLIBS)
endif
# test for presence of libsamplerate
ifneq ($(strip $(shell pkg-config samplerate --modversion 2> /dev/null)),)
ifneq ($(NO_RESAMP), 1)
# set libsamplerate flags and libraries
CFLAGS += $(shell pkg-config samplerate --cflags) -DUSE_SRC
LDFLAGS += $(shell pkg-config samplerate --libs)
ifneq ($(NO_SRC), 1)
ifeq ($(origin SRC_CFLAGS) $(origin SRC_LDLIBS), undefined undefined)
ifneq ($(strip $(shell $(PKG_CONFIG) samplerate --modversion 2> /dev/null)),)
# set libsamplerate flags and libraries
SRC_CFLAGS += $(shell $(PKG_CONFIG) samplerate --cflags) -DUSE_SRC
SRC_LDLIBS += $(shell $(PKG_CONFIG) samplerate --libs)
else
$(warning No libsamplerate development libraries found. Mupen64plus-sdl-audio will be built without src-* resampler.)
NO_SRC = 1
endif
else
SRC_CFLAGS += -DUSE_SRC
endif
CFLAGS += $(SRC_CFLAGS)
LDLIBS += $(SRC_LDLIBS)
endif
USE_AUDIORESOURCE = 0
ifeq ($(origin AUDIORESOURCE_CFLAGS) $(origin AUDIORESOURCE_LDLIBS), undefined undefined)
ifneq ($(strip $(shell $(PKG_CONFIG) audioresource --modversion 2> /dev/null)),)
# set audioresourceflags and libraries
USE_AUDIORESOURCE = 1
AUDIORESOURCE_CFLAGS += $(shell $(PKG_CONFIG) audioresource --cflags) -DUSE_AUDIORESOURCE
AUDIORESOURCE_LDLIBS += $(shell $(PKG_CONFIG) audioresource --libs)
endif
else
# warn user
$(warning No libsamplerate development libraries found. Mupen64plus-sdl-audio will be built without Best Quality SINC resampler.)
USE_AUDIORESOURCE = 1
AUDIORESOURCE_CFLAGS += -DUSE_AUDIORESOURCE
endif
ifeq ($(USE_AUDIORESOURCE),1)
ifeq ($(origin GLIB_CFLAGS) $(origin GLIB_LDLIBS), undefined undefined)
ifneq ($(strip $(shell $(PKG_CONFIG) glib-2.0 --modversion 2> /dev/null)),)
# set glib-2.0 flags and libraries
GLIB_CFLAGS += $(shell $(PKG_CONFIG) glib-2.0 --cflags)
GLIB_LDLIBS += $(shell $(PKG_CONFIG) glib-2.0 --libs)
else
$(warning audioresource available but glib-2.0 not found, disabling audioresource support. Mupen64plus-sdl-audio will be built without the Nemo Mobile Audio Resource API.)
AUDIORESOURCE_CFLAGS =
AUDIORESOURCE_LDLIBS =
endif
endif
CFLAGS += $(GLIB_CFLAGS) $(AUDIORESOURCE_CFLAGS)
LDLIBS += $(GLIB_LDLIBS) $(AUDIORESOURCE_LDLIBS)
endif
# test for the presence of OSS
ifneq ($(wildcard /dev/mixer),)
ifneq ($(NO_OSS), 1)
CFLAGS += -DHAS_OSS_SUPPORT
endif
endif
# set mupen64plus core API header path
@ -173,22 +263,30 @@ else
endif
endif
# set shell function names
CC ?= gcc
CXX ?= g++
LD ?= g++
INSTALL ?= install
ifeq ($(OS),LINUX)
STRIP ?= strip -s
# reduced compile output when running make without V=1
ifneq ($(findstring $(MAKEFLAGS),s),s)
ifndef V
Q_CC = @echo ' CC '$@;
Q_LD = @echo ' LD '$@;
endif
ifeq ($(OS),OSX)
STRIP ?= strip -x
endif
# set base program pointers and flags
CC = $(CROSS_COMPILE)gcc
RM ?= rm -f
INSTALL ?= install
MKDIR ?= mkdir -p
COMPILE.c = $(Q_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
LINK.o = $(Q_LD)$(CC) $(CFLAGS) $(LDFLAGS) $(TARGET_ARCH)
# set special flags for given Makefile parameters
ifeq ($(DEBUG),1)
CFLAGS += -g
STRIP = true # disable binary strip
INSTALL_STRIP_FLAG ?=
else
ifneq ($(OS),OSX)
INSTALL_STRIP_FLAG ?= -s
endif
endif
# set installation options
@ -196,25 +294,41 @@ ifeq ($(PREFIX),)
PREFIX := /usr/local
endif
ifeq ($(LIBDIR),)
LIBDIR := $(PREFIX)/lib/mupen64plus
LIBDIR := $(PREFIX)/lib
endif
ifeq ($(PLUGINDIR),)
PLUGINDIR := $(LIBDIR)/mupen64plus
endif
SRCDIR = ../../src
OBJDIR = _obj
# list of source files to compile
SOURCE = \
$(SRCDIR)/circular_buffer.c \
$(SRCDIR)/main.c \
$(SRCDIR)/sdl_backend.c \
$(SRCDIR)/volume.c \
$(SRCDIR)/osal_dynamiclib_unix.c
$(SRCDIR)/resamplers/resamplers.c \
$(SRCDIR)/resamplers/trivial.c
ifeq ($(OS),MINGW)
SOURCE += $(SRCDIR)/osal_dynamiclib_win32.c
else
SOURCE += $(SRCDIR)/osal_dynamiclib_unix.c
endif
ifneq ($(NO_SPEEX), 1)
SOURCE += $(SRCDIR)/resamplers/speex.c
endif
ifneq ($(NO_SRC), 1)
SOURCE += $(SRCDIR)/resamplers/src.c
endif
# generate a list of object files build, make a temporary directory for them
OBJECTS := $(patsubst $(SRCDIR)/%.c, $(OBJDIR)/%.o, $(filter %.c, $(SOURCE)))
OBJDIRS = $(dir $(OBJECTS))
$(shell mkdir -p $(OBJDIRS))
$(shell $(MKDIR) $(OBJDIRS))
# build targets
TARGET = mupen64plus-audio-sdl.$(SO_EXTENSION)
TARGET = mupen64plus-audio-sdl$(POSTFIX).$(SO_EXTENSION)
targets:
@echo "Mupen64Plus-audio-sdl makefile. "
@ -227,34 +341,46 @@ targets:
@echo " Options:"
@echo " BITS=32 == build 32-bit binaries on 64-bit machine"
@echo " APIDIR=path == path to find Mupen64Plus Core headers"
@echo " OPTFLAGS=flag == compiler optimization (default: -O3 -flto)"
@echo " WARNFLAGS=flag == compiler warning levels (default: -Wall)"
@echo " PIC=(1|0) == Force enable/disable of position independent code"
@echo " NO_SRC=1 == build without libsamplerate; disables src-* high-quality audio resampling"
@echo " NO_SPEEX=1 == build without libspeexdsp; disables speex-* high-quality audio resampling"
@echo " NO_OSS=1 == build without OSS; disables Open Sound System support"
@echo " POSTFIX=name == String added to the name of the the build (default: '')"
@echo " Install Options:"
@echo " PREFIX=path == install/uninstall prefix (default: /usr/local)"
@echo " LIBDIR=path == path to install plugin libraries (default: PREFIX/lib/mupen64plus)"
@echo " LIBDIR=path == library prefix (default: PREFIX/lib)"
@echo " PLUGINDIR=path == path to install plugin libraries (default: LIBDIR/mupen64plus)"
@echo " DESTDIR=path == path to prepend to all installation paths (only for packagers)"
@echo " Debugging Options:"
@echo " DEBUG=1 == add debugging symbols"
@echo " V=1 == show verbose compiler output"
all: $(TARGET)
install: $(TARGET)
$(INSTALL) -d -v "$(DESTDIR)$(LIBDIR)"
$(INSTALL) -m 0644 $(TARGET) "$(DESTDIR)$(LIBDIR)"
$(INSTALL) -d "$(DESTDIR)$(PLUGINDIR)"
$(INSTALL) -m 0644 $(INSTALL_STRIP_FLAG) $(TARGET) "$(DESTDIR)$(PLUGINDIR)"
uninstall:
rm -f "$(DESTDIR)$(LIBDIR)/$(TARGET)"
$(RM) "$(DESTDIR)$(PLUGINDIR)/$(TARGET)"
clean:
rm -rf ./_obj/* $(TARGET)
$(RM) -r $(OBJDIR) $(TARGET)
rebuild: clean all
# build rules
$(TARGET): $(OBJECTS)
$(LD) $(SHARED) $^ $(LDFLAGS) -o $@
$(STRIP) $@
# build dependency files
CFLAGS += -MD -MP
-include $(OBJECTS:.o=.d)
# standard build rules
$(OBJDIR)/%.o: $(SRCDIR)/%.c
$(CC) -o $@ $(CFLAGS) -c $<
$(COMPILE.c) -o $@ $<
$(TARGET): $(OBJECTS)
$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
.PHONY: all clean install uninstall targets

83
src/circular_buffer.c Normal file
View file

@ -0,0 +1,83 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-ui-console - circular_buffer.c *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2015 Bobby Smiles *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include "circular_buffer.h"
int init_cbuff(struct circular_buffer* cbuff, size_t capacity)
{
void* data = malloc(capacity);
if (data == NULL)
{
return -1;
}
cbuff->data = data;
cbuff->size = capacity;
cbuff->head = 0;
return 0;
}
void release_cbuff(struct circular_buffer* cbuff)
{
free(cbuff->data);
memset(cbuff, 0, sizeof(*cbuff));
}
void* cbuff_head(const struct circular_buffer* cbuff, size_t* available)
{
assert(cbuff->head <= cbuff->size);
*available = cbuff->size - cbuff->head;
return (unsigned char*)cbuff->data + cbuff->head;
}
void* cbuff_tail(const struct circular_buffer* cbuff, size_t* available)
{
*available = cbuff->head;
return cbuff->data;
}
void produce_cbuff_data(struct circular_buffer* cbuff, size_t amount)
{
assert(cbuff->head + amount <= cbuff->size);
cbuff->head += amount;
}
void consume_cbuff_data(struct circular_buffer* cbuff, size_t amount)
{
assert(cbuff->head >= amount);
memmove(cbuff->data, (unsigned char*)cbuff->data + amount, cbuff->head - amount);
cbuff->head -= amount;
}

46
src/circular_buffer.h Normal file
View file

@ -0,0 +1,46 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-ui-console - circular_buffer.h *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2015 Bobby Smiles *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifndef M64P_CIRCULAR_BUFFER_H
#define M64P_CIRCULAR_BUFFER_H
#include <stddef.h>
struct circular_buffer
{
void* data;
size_t size;
size_t head;
};
int init_cbuff(struct circular_buffer* cbuff, size_t capacity);
void release_cbuff(struct circular_buffer* cbuff);
void* cbuff_head(const struct circular_buffer* cbuff, size_t* available);
void* cbuff_tail(const struct circular_buffer* cbuff, size_t* available);
void produce_cbuff_data(struct circular_buffer* cbuff, size_t amount);
void consume_cbuff_data(struct circular_buffer* cbuff, size_t amount);
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus - main.h *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Copyright (C) 2008 Tillin9 *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2008-2012 Tillin9, Richard42 *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@ -20,13 +20,36 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* version info */
#define SDL_AUDIO_PLUGIN_VERSION 0x016302
#include "m64p_config.h"
#include <stddef.h>
#if defined(__GNUC__)
#define ATTR_FMT(fmtpos, attrpos) __attribute__ ((format (printf, fmtpos, attrpos)))
#else
#define ATTR_FMT(fmtpos, attrpos)
#endif
struct resampler_interface;
/* volume mixer types */
enum {
VOLUME_TYPE_SDL = 1,
VOLUME_TYPE_OSS = 2,
};
void SetPlaybackVolume(void);
size_t ResampleAndMix(void* resampler, const struct resampler_interface* iresampler,
void* mix_buffer,
const void* src, size_t src_size, unsigned int src_freq,
void* dst, size_t dst_size, unsigned int dst_freq);
/* declarations of pointers to Core config functions */
extern ptr_ConfigListSections ConfigListSections;
extern ptr_ConfigOpenSection ConfigOpenSection;
extern ptr_ConfigDeleteSection ConfigDeleteSection;
extern ptr_ConfigListParameters ConfigListParameters;
extern ptr_ConfigSaveFile ConfigSaveFile;
extern ptr_ConfigSetParameter ConfigSetParameter;
extern ptr_ConfigGetParameter ConfigGetParameter;
extern ptr_ConfigGetParameterHelp ConfigGetParameterHelp;
@ -39,3 +62,5 @@ extern ptr_ConfigGetParamFloat ConfigGetParamFloat;
extern ptr_ConfigGetParamBool ConfigGetParamBool;
extern ptr_ConfigGetParamString ConfigGetParamString;
void DebugMessage(int level, const char *message, ...) ATTR_FMT(2,3);

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-core - osal/dynamiclib.h *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2009 Richard Goedeken *
* *
* This program is free software; you can redistribute it and/or modify *

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-core - osal/dynamiclib_unix.c *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2009 Richard Goedeken *
* *
* This program is free software; you can redistribute it and/or modify *
@ -19,9 +19,9 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <stdlib.h>
#include <stdio.h>
#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
#include "m64p_types.h"
#include "osal_dynamiclib.h"

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-ui-console - osal_dynamiclib_win32.c *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2009 Richard Goedeken *
* *
* This program is free software; you can redistribute it and/or modify *
@ -19,9 +19,9 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include "m64p_types.h"
#include "osal_dynamiclib.h"

View file

@ -0,0 +1,78 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-audio-sdl - resamplers.c *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2017 Bobby Smiles *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "resamplers.h"
#include "main.h"
#include "m64p_types.h"
#include <string.h>
extern const struct resampler_interface g_trivial_iresampler;
#ifdef USE_SPEEX
extern const struct resampler_interface g_speex_iresampler;
#endif
#ifdef USE_SRC
extern const struct resampler_interface g_src_iresampler;
#endif
#define ARRAY_SIZE(x) sizeof((x)) / sizeof((x)[0])
const struct resampler_interface* get_iresampler(const char* resampler_id, void** resampler)
{
size_t i;
static const struct {
const struct resampler_interface* iresampler;
const char* cmp_str;
} resamplers[] = {
{ &g_trivial_iresampler, "trivial" },
#ifdef USE_SPEEX
{ &g_speex_iresampler, "speex-" },
#endif
#ifdef USE_SRC
{ &g_src_iresampler, "src-" }
#endif
};
/* search matching resampler */
for(i = 0; i < ARRAY_SIZE(resamplers); ++i) {
if (strncmp(resampler_id, resamplers[i].cmp_str, strlen(resamplers[i].cmp_str)) == 0) {
DebugMessage(M64MSG_INFO, "Using resampler %s", resamplers[i].iresampler->name);
break;
}
}
/* handle not found case */
if (i >= ARRAY_SIZE(resamplers)) {
i = 0;
DebugMessage(M64MSG_WARNING, "Could not find RESAMPLE configuration %s; use %s resampler",
resampler_id, resamplers[i].iresampler->name);
}
/* instanciate resampler */
*resampler = resamplers[i].iresampler->init_from_id(resampler_id);
return resamplers[i].iresampler;
}

View file

@ -0,0 +1,51 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-audio-sdl - resamplers.h *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2017 Bobby Smiles *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifndef M64P_RESAMPLERS_RESAMPLERS_H
#define M64P_RESAMPLERS_RESAMPLERS_H
#include <stddef.h>
struct resampler_interface
{
const char* name;
void* (*init_from_id)(const char* resampler_id);
void (*release)(void* resampler);
size_t (*resample)(void* resampler,
const void* src, size_t src_size, unsigned int src_freq,
void* dst, size_t dst_size, unsigned int dst_freq);
};
const struct resampler_interface* get_iresampler(const char* resampler_id, void** resampler);
/* default resampler */
#if defined(USE_SPEEX)
#define DEFAULT_RESAMPLER "speex-fixed-4"
#elif defined(USE_SRC)
#define DEFAULT_RESAMPLER "src-sinc-medium-quality"
#else
#define DEFAULT_RESAMPLER "trivial"
#endif
#endif

133
src/resamplers/speex.c Normal file
View file

@ -0,0 +1,133 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-sdl-audio - speex.c *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2017 Bobby Smiles *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "resamplers/resamplers.h"
#include "main.h"
#include <speex/speex_resampler.h>
#include "m64p_types.h"
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#define ARRAY_SIZE(x) sizeof((x)) / sizeof((x)[0])
/* assume 2x16bit interleaved channels */
enum { BYTES_PER_SAMPLE = 4 };
static void* speex_init_from_id(const char* resampler_id)
{
size_t i;
int error;
static const char *types[] =
{
"speex-fixed-0",
"speex-fixed-1",
"speex-fixed-2",
"speex-fixed-3",
"speex-fixed-4",
"speex-fixed-5",
"speex-fixed-6",
"speex-fixed-7",
"speex-fixed-8",
"speex-fixed-9",
"speex-fixed-10",
};
/* select resampler configuration */
for (i = 0; i < ARRAY_SIZE(types); ++i) {
if (strcmp(types[i], resampler_id) == 0) {
break;
}
}
/* handle unknown configuration */
if (i >= ARRAY_SIZE(types)) {
i = 4;
DebugMessage(M64MSG_WARNING,
"Unknown RESAMPLE configuration %s; use %s resampler",
resampler_id, types[i]);
}
/* init speex object with dummy frequencies (will be set later) */
SpeexResamplerState* spx_state = speex_resampler_init(2, 44100, 44100, (int)i, &error);
if (error != RESAMPLER_ERR_SUCCESS) {
DebugMessage(M64MSG_ERROR, "Speex error: %s", speex_resampler_strerror(error));
}
return spx_state;
}
static void speex_release(void* resampler)
{
SpeexResamplerState* spx_state = (SpeexResamplerState*)resampler;
if (spx_state == NULL) {
return;
}
speex_resampler_destroy(spx_state);
}
static size_t speex_resample(void* resampler,
const void* src, size_t src_size, unsigned int src_freq,
void* dst, size_t dst_size, unsigned int dst_freq)
{
SpeexResamplerState* spx_state = (SpeexResamplerState*)resampler;
/* update resampling rates */
speex_resampler_set_rate(spx_state, src_freq, dst_freq);
/* perform resampling */
spx_uint32_t in_len = src_size / BYTES_PER_SAMPLE;
spx_uint32_t out_len = dst_size / BYTES_PER_SAMPLE;
int error = speex_resampler_process_interleaved_int(spx_state, (const spx_int16_t *)src, &in_len, (spx_int16_t *)dst, &out_len);
/* in case of error, display error, zero output buffer and discard input buffer */
if (error != RESAMPLER_ERR_SUCCESS)
{
DebugMessage(M64MSG_ERROR, "Speex error: %s", speex_resampler_strerror(error));
memset(dst, 0, dst_size);
return src_size;
}
if (dst_size != out_len * BYTES_PER_SAMPLE) {
DebugMessage(M64MSG_WARNING, "dst_size = %u != outlen*4 = %u",
(uint32_t) dst_size, out_len * BYTES_PER_SAMPLE);
}
memset((char*)dst + out_len * BYTES_PER_SAMPLE, 0, dst_size - out_len * BYTES_PER_SAMPLE);
return in_len * BYTES_PER_SAMPLE;
}
const struct resampler_interface g_speex_iresampler = {
"speex",
speex_init_from_id,
speex_release,
speex_resample
};

200
src/resamplers/src.c Normal file
View file

@ -0,0 +1,200 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-sdl-audio - src.c *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2017 Bobby Smiles *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "resamplers/resamplers.h"
#include "main.h"
#include <samplerate.h>
#include "m64p_types.h"
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#define ARRAY_SIZE(x) sizeof((x)) / sizeof((x)[0])
struct fbuffer
{
float* data;
size_t size;
};
static void grow_fbuffer(struct fbuffer* fbuffer, size_t new_size)
{
if (fbuffer->size < new_size) {
fbuffer->data = realloc(fbuffer->data, new_size);
fbuffer->size = new_size;
}
}
static void free_fbuffer(struct fbuffer* fbuffer)
{
free(fbuffer->data);
fbuffer->data = NULL;
fbuffer->size = 0;
}
struct src_resampler
{
SRC_STATE* state;
/* 2 intermediate buffers are needed for float/int conversion */
struct fbuffer fbuffers[2];
};
static void* src_init_from_id(const char* resampler_id)
{
size_t i;
int error = 0;
static const struct {
const char* name;
int converter_type;
} types[] =
{
{ "src-sinc-best-quality", SRC_SINC_BEST_QUALITY },
{ "src-sinc-medium-quality", SRC_SINC_MEDIUM_QUALITY },
{ "src-sinc-fastest", SRC_SINC_FASTEST },
{ "src-zero-order-hold", SRC_ZERO_ORDER_HOLD },
{ "src-linear", SRC_LINEAR }
};
/* select resampler configuration */
for (i = 0; i < ARRAY_SIZE(types); ++i) {
if (strcmp(types[i].name, resampler_id) == 0) {
break;
}
}
/* handle unknown configuration */
if (i >= ARRAY_SIZE(types)) {
i = 1;
DebugMessage(M64MSG_WARNING,
"Unknown RESAMPLE configuration %s; use %s resampler",
resampler_id, types[i].name);
}
/* init src resampler */
struct src_resampler* src_resampler = malloc(sizeof(*src_resampler));
if (src_resampler == NULL) {
DebugMessage(M64MSG_ERROR, "Failed to allocate memory for SRC resampler");
return NULL;
}
/* lazy-alloc of fbuffers */
memset(src_resampler, 0, sizeof(*src_resampler));
src_resampler->state = src_new(types[i].converter_type, 2, &error);
if (error != 0) {
DebugMessage(M64MSG_ERROR, "SRC error: %s", src_strerror(error));
free(src_resampler);
return NULL;
}
return src_resampler;
}
static void src_release(void* resampler)
{
size_t i;
struct src_resampler* src_resampler = (struct src_resampler*)resampler;
if (src_resampler == NULL)
return;
src_delete(src_resampler->state);
for(i = 0; i < 2; ++i) {
free_fbuffer(&src_resampler->fbuffers[i]);
}
}
static size_t src_resample(void* resampler,
const void* src, size_t src_size, unsigned int src_freq,
void* dst, size_t dst_size, unsigned int dst_freq)
{
struct src_resampler* src_resampler = (struct src_resampler*)resampler;
/* High quality resamplers needs more input than what
* the sample rate ratio would indicate to work properly, hence the src/dst>1 ratio
*
* Limit src_size to avoid too much short-float-short conversion time
*/
if (src_size > dst_size * 5 / 2) {
src_size = dst_size * 5 / 2;
}
/* grow float buffers if necessary */
if (src_size > 0) {
grow_fbuffer(&src_resampler->fbuffers[0], src_size*2);
}
if (dst_size > 0) {
grow_fbuffer(&src_resampler->fbuffers[1], dst_size*2);
}
src_short_to_float_array((short*)src, src_resampler->fbuffers[0].data, src_size/2);
/* perform resampling */
SRC_DATA src_data;
src_data.data_in = src_resampler->fbuffers[0].data;
src_data.input_frames = src_size/4;
src_data.data_out = src_resampler->fbuffers[1].data;
src_data.output_frames = dst_size/4;
src_data.src_ratio = (float)dst_freq / src_freq;
src_data.end_of_input = 0;
int error = src_process(src_resampler->state, &src_data);
/* in case of error, display error, zero output buffer and discard input buffer */
if (error)
{
DebugMessage(M64MSG_ERROR, "SRC error: %s", src_strerror(error));
memset(dst, 0, dst_size);
return src_size;
}
if (dst_size != src_data.output_frames_gen*4) {
DebugMessage(M64MSG_WARNING, "dst_size = %u != output_frames_gen*4 = %u",
(uint32_t) dst_size, (uint32_t) src_data.output_frames_gen*4);
}
src_float_to_short_array(src_resampler->fbuffers[1].data, (short*)dst, src_data.output_frames_gen*2);
memset((char*)dst + src_data.output_frames_gen*4, 0, dst_size - src_data.output_frames_gen*4);
return src_data.input_frames_used * 4;
}
const struct resampler_interface g_src_iresampler = {
"src",
src_init_from_id,
src_release,
src_resample
};

83
src/resamplers/trivial.c Normal file
View file

@ -0,0 +1,83 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-sdl-audio - trivial.c *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2017 Bobby Smiles *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "resamplers/resamplers.h"
#include <stddef.h>
#include <stdint.h>
static void* trivial_init_from_id(const char* resampler_id)
{
/* nothing to do */
return NULL;
}
static void trivial_release(void* resampler)
{
/* nothing to do */
}
static size_t trivial_resample(void* resampler,
const void* src, size_t src_size, unsigned int src_freq,
void* dst, size_t dst_size, unsigned int dst_freq)
{
enum { BYTES_PER_SAMPLE = 4 };
size_t i;
size_t j = 0;
if (dst_freq >= src_freq) {
const int dpos = 2*src_freq;
const int dneg = dpos - 2*dst_freq;
int criteria = dpos - dst_freq;
for (i = 0; i < dst_size/BYTES_PER_SAMPLE; ++i) {
((uint32_t*)dst)[i] = ((const uint32_t*)src)[j];
if (criteria >= 0) {
++j;
criteria += dneg;
}
else {
criteria += dpos;
}
}
}
else {
/* Can happen when speed_factor > 1 */
for (i = 0; i < dst_size/BYTES_PER_SAMPLE; ++i) {
j = i * src_freq / dst_freq;
((uint32_t*)dst)[i] = ((const uint32_t*)src)[j];
}
}
return j * 4;
}
const struct resampler_interface g_trivial_iresampler = {
"trivial",
trivial_init_from_id,
trivial_release,
trivial_resample
};

458
src/sdl_backend.c Normal file
View file

@ -0,0 +1,458 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-sdl-audio - sdl_backend.c *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2017 Bobby Smiles *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <SDL.h>
#include <SDL_audio.h>
#include <stdlib.h>
#include <string.h>
#include "circular_buffer.h"
#include "main.h"
#include "resamplers/resamplers.h"
#define M64P_PLUGIN_PROTOTYPES 1
#include "m64p_common.h"
#include "m64p_config.h"
#include "m64p_types.h"
/* number of bytes per sample */
#define N64_SAMPLE_BYTES 4
#define SDL_SAMPLE_BYTES 4
#define SDL_LockAudio() SDL_LockAudioDevice(sdl_backend->device)
#define SDL_UnlockAudio() SDL_UnlockAudioDevice(sdl_backend->device)
#define SDL_PauseAudio(A) SDL_PauseAudioDevice(sdl_backend->device, A)
#define SDL_CloseAudio() SDL_CloseAudioDevice(sdl_backend->device)
#define SDL_OpenAudio(A, B) ((sdl_backend->device = SDL_OpenAudioDevice(NULL, 0, A, B, 0)) - 1)
struct sdl_backend
{
SDL_AudioDeviceID device;
m64p_handle config;
struct circular_buffer primary_buffer;
/* Primary buffer size (in output samples) */
size_t primary_buffer_size;
/* Primary buffer fullness target (in output samples) */
size_t target;
/* Secondary buffer size (in output samples) */
size_t secondary_buffer_size;
/* Mixing buffer used for volume control */
unsigned char* mix_buffer;
unsigned int last_cb_time;
unsigned int input_frequency;
unsigned int output_frequency;
unsigned int speed_factor;
unsigned int swap_channels;
unsigned int audio_sync;
unsigned int paused_for_sync;
unsigned int underrun_count;
unsigned int error;
/* Resampler */
void* resampler;
const struct resampler_interface* iresampler;
};
/* SDL_AudioFormat.format format specifier and args builder */
#define AFMT_FMTSPEC "%c%d%s"
#define AFMT_ARGS(x) \
((SDL_AUDIO_ISFLOAT(x)) ? 'F' : (SDL_AUDIO_ISSIGNED(x)) ? 'S' : 'U'), \
SDL_AUDIO_BITSIZE(x), \
SDL_AUDIO_ISBIGENDIAN(x) ? "BE" : "LE"
static void my_audio_callback(void* userdata, unsigned char* stream, int len)
{
struct sdl_backend* sdl_backend = (struct sdl_backend*)userdata;
/* mark the time, for synchronization on the input side */
sdl_backend->last_cb_time = SDL_GetTicks();
unsigned int newsamplerate = sdl_backend->output_frequency * 100 / sdl_backend->speed_factor;
unsigned int oldsamplerate = sdl_backend->input_frequency;
size_t needed = (len * oldsamplerate) / newsamplerate;
size_t available;
size_t consumed;
const void* src = cbuff_tail(&sdl_backend->primary_buffer, &available);
if ((available > 0) && (available >= needed))
{
consumed = ResampleAndMix(sdl_backend->resampler, sdl_backend->iresampler,
sdl_backend->mix_buffer,
src, available, oldsamplerate,
stream, len, newsamplerate);
consume_cbuff_data(&sdl_backend->primary_buffer, consumed);
}
else
{
++sdl_backend->underrun_count;
memset(stream, 0, len);
}
}
static size_t new_primary_buffer_size(const struct sdl_backend* sdl_backend)
{
return N64_SAMPLE_BYTES * ((uint64_t)sdl_backend->primary_buffer_size * sdl_backend->input_frequency * sdl_backend->speed_factor) /
(sdl_backend->output_frequency * 100);
}
static void resize_primary_buffer(struct sdl_backend* sdl_backend, size_t new_size)
{
/* only grows the buffer */
if (new_size > sdl_backend->primary_buffer.size) {
SDL_LockAudio();
sdl_backend->primary_buffer.data = realloc(sdl_backend->primary_buffer.data, new_size);
memset((unsigned char*)sdl_backend->primary_buffer.data + sdl_backend->primary_buffer.size, 0, new_size - sdl_backend->primary_buffer.size);
sdl_backend->primary_buffer.size = new_size;
SDL_UnlockAudio();
}
}
static unsigned int select_output_frequency(unsigned int input_frequency)
{
if (input_frequency <= 11025) { return 11025; }
else if (input_frequency <= 22050) { return 22050; }
else { return 44100; }
}
static void sdl_init_audio_device(struct sdl_backend* sdl_backend)
{
SDL_AudioSpec desired, obtained;
sdl_backend->error = 0;
if (SDL_WasInit(SDL_INIT_AUDIO|SDL_INIT_TIMER) == (SDL_INIT_AUDIO|SDL_INIT_TIMER) )
{
DebugMessage(M64MSG_VERBOSE, "sdl_init_audio_device(): SDL Audio sub-system already initialized.");
SDL_PauseAudio(1);
SDL_CloseAudio();
}
else
{
if (SDL_Init(SDL_INIT_AUDIO | SDL_INIT_TIMER) < 0)
{
DebugMessage(M64MSG_ERROR, "Failed to initialize SDL audio subsystem.");
sdl_backend->error = 1;
return;
}
}
sdl_backend->paused_for_sync = 1;
/* reload these because they gets re-assigned from SDL data below, and sdl_init_audio_device can be called more than once */
sdl_backend->primary_buffer_size = ConfigGetParamInt(sdl_backend->config, "PRIMARY_BUFFER_SIZE");
sdl_backend->target = ConfigGetParamInt(sdl_backend->config, "PRIMARY_BUFFER_TARGET");
sdl_backend->secondary_buffer_size = ConfigGetParamInt(sdl_backend->config, "SECONDARY_BUFFER_SIZE");
DebugMessage(M64MSG_INFO, "Initializing SDL audio subsystem...");
DebugMessage(M64MSG_VERBOSE, "Primary buffer: %i output samples.", (uint32_t) sdl_backend->primary_buffer_size);
DebugMessage(M64MSG_VERBOSE, "Primary target fullness: %i output samples.", (uint32_t) sdl_backend->target);
DebugMessage(M64MSG_VERBOSE, "Secondary buffer: %i output samples.", (uint32_t) sdl_backend->secondary_buffer_size);
memset(&desired, 0, sizeof(desired));
desired.freq = select_output_frequency(sdl_backend->input_frequency);
desired.format = AUDIO_S16SYS;
desired.channels = 2;
desired.samples = sdl_backend->secondary_buffer_size;
desired.callback = my_audio_callback;
desired.userdata = sdl_backend;
DebugMessage(M64MSG_VERBOSE, "Requesting frequency: %iHz.", desired.freq);
DebugMessage(M64MSG_VERBOSE, "Requesting format: " AFMT_FMTSPEC ".", AFMT_ARGS(desired.format));
/* Open the audio device */
if (SDL_OpenAudio(&desired, &obtained) < 0)
{
DebugMessage(M64MSG_ERROR, "Couldn't open audio: %s", SDL_GetError());
sdl_backend->error = 1;
return;
}
if (desired.format != obtained.format)
{
DebugMessage(M64MSG_WARNING, "Obtained audio format (" AFMT_FMTSPEC ") differs from requested (" AFMT_FMTSPEC ").", AFMT_ARGS(obtained.format), AFMT_ARGS(desired.format));
}
if (desired.freq != obtained.freq)
{
DebugMessage(M64MSG_WARNING, "Obtained frequency (%i) differs from requested (%i).", obtained.freq, desired.freq);
}
/* adjust some variables given the obtained audio spec */
sdl_backend->output_frequency = obtained.freq;
sdl_backend->secondary_buffer_size = obtained.samples;
if (sdl_backend->target < sdl_backend->secondary_buffer_size)
sdl_backend->target = sdl_backend->secondary_buffer_size;
if (sdl_backend->primary_buffer_size < sdl_backend->target)
sdl_backend->primary_buffer_size = sdl_backend->target;
if (sdl_backend->primary_buffer_size < sdl_backend->secondary_buffer_size * 2)
sdl_backend->primary_buffer_size = sdl_backend->secondary_buffer_size * 2;
/* allocate memory for audio buffers */
resize_primary_buffer(sdl_backend, new_primary_buffer_size(sdl_backend));
sdl_backend->mix_buffer = realloc(sdl_backend->mix_buffer, sdl_backend->secondary_buffer_size * SDL_SAMPLE_BYTES);
/* preset the last callback time */
if (sdl_backend->last_cb_time == 0) {
sdl_backend->last_cb_time = SDL_GetTicks();
}
DebugMessage(M64MSG_VERBOSE, "Frequency: %i", obtained.freq);
DebugMessage(M64MSG_VERBOSE, "Format: " AFMT_FMTSPEC, AFMT_ARGS(obtained.format));
DebugMessage(M64MSG_VERBOSE, "Channels: %i", obtained.channels);
DebugMessage(M64MSG_VERBOSE, "Silence: %i", obtained.silence);
DebugMessage(M64MSG_VERBOSE, "Samples: %i", obtained.samples);
DebugMessage(M64MSG_VERBOSE, "Size: %i", obtained.size);
/* set playback volume */
SetPlaybackVolume();
}
static void release_audio_device(struct sdl_backend* sdl_backend)
{
if (SDL_WasInit(SDL_INIT_AUDIO) != 0) {
SDL_PauseAudio(1);
SDL_CloseAudio();
SDL_QuitSubSystem(SDL_INIT_AUDIO);
}
if (SDL_WasInit(SDL_INIT_TIMER) != 0) {
SDL_QuitSubSystem(SDL_INIT_TIMER);
}
}
static struct sdl_backend* init_sdl_backend(m64p_handle config,
unsigned int default_frequency,
unsigned int swap_channels,
unsigned int audio_sync,
const char* resampler_id)
{
/* allocate memory for sdl_backend */
struct sdl_backend* sdl_backend = malloc(sizeof(*sdl_backend));
if (sdl_backend == NULL) {
return NULL;
}
/* reset sdl_backend */
memset(sdl_backend, 0, sizeof(*sdl_backend));
/* instanciate resampler */
void* resampler = NULL;
const struct resampler_interface* iresampler = get_iresampler(resampler_id, &resampler);
if (iresampler == NULL) {
free(sdl_backend);
return NULL;
}
sdl_backend->config = config;
sdl_backend->input_frequency = default_frequency;
sdl_backend->swap_channels = swap_channels;
sdl_backend->audio_sync = audio_sync;
sdl_backend->paused_for_sync = 1;
sdl_backend->speed_factor = 100;
sdl_backend->resampler = resampler;
sdl_backend->iresampler = iresampler;
sdl_init_audio_device(sdl_backend);
return sdl_backend;
}
struct sdl_backend* init_sdl_backend_from_config(m64p_handle config)
{
unsigned int default_frequency = ConfigGetParamInt(config, "DEFAULT_FREQUENCY");
unsigned int swap_channels = ConfigGetParamBool(config, "SWAP_CHANNELS");
unsigned int audio_sync = ConfigGetParamBool(config, "AUDIO_SYNC");
const char* resampler_id = ConfigGetParamString(config, "RESAMPLE");
return init_sdl_backend(config,
default_frequency,
swap_channels,
audio_sync,
resampler_id);
}
void release_sdl_backend(struct sdl_backend* sdl_backend)
{
if (sdl_backend == NULL) {
return;
}
if (sdl_backend->error == 0) {
release_audio_device(sdl_backend);
}
/* release primary buffer */
release_cbuff(&sdl_backend->primary_buffer);
/* release mix buffer */
free(sdl_backend->mix_buffer);
/* release resampler */
sdl_backend->iresampler->release(sdl_backend->resampler);
/* release sdl backend */
free(sdl_backend);
}
void sdl_set_frequency(struct sdl_backend* sdl_backend, unsigned int frequency)
{
if (sdl_backend->error != 0)
return;
sdl_backend->input_frequency = frequency;
sdl_init_audio_device(sdl_backend);
}
void sdl_push_samples(struct sdl_backend* sdl_backend, const void* src, size_t size)
{
size_t available;
if (sdl_backend->error != 0)
return;
/* truncate to full samples */
if (size & 0x3) {
DebugMessage(M64MSG_WARNING, "sdl_push_samples: pushing non full samples: %zu bytes !", size);
}
size = (size / 4) * 4;
/* We need to lock audio before accessing cbuff */
SDL_LockAudio();
unsigned char* dst = cbuff_head(&sdl_backend->primary_buffer, &available);
if (size <= available)
{
/* Confusing logic but, for LittleEndian host using memcpy will result in swapped channels,
* whereas the other branch will result in non-swapped channels.
* For BigEndian host this logic is inverted, memcpy will result in non swapped channels
* and the other branch will result in swapped channels.
*
* This is due to the fact that the core stores 32bit words in native order in RDRAM.
* For instance N64 bytes "Lh Ll Rh Rl" will be stored as "Rl Rh Ll Lh" on LittleEndian host
* and therefore should the non-memcpy path to get non swapped channels,
* whereas on BigEndian host the bytes will be stored as "Lh Ll Rh Rl" and therefore
* memcpy path results in the non-swapped channels outcome.
*/
if (sdl_backend->swap_channels ^ (SDL_BYTEORDER == SDL_BIG_ENDIAN)) {
memcpy(dst, src, size);
}
else {
size_t i;
for (i = 0 ; i < size ; i += 4 )
{
memcpy(dst + i + 0, (const unsigned char*)src + i + 2, 2); /* Left */
memcpy(dst + i + 2, (const unsigned char*)src + i + 0, 2); /* Right */
}
}
produce_cbuff_data(&sdl_backend->primary_buffer, size);
}
SDL_UnlockAudio();
if (size > available)
{
DebugMessage(M64MSG_WARNING, "sdl_push_samples: pushing %zu bytes, but only %zu available !", size, available);
}
}
static size_t estimate_level_at_next_audio_cb(struct sdl_backend* sdl_backend)
{
size_t available;
unsigned int now = SDL_GetTicks();
/* NOTE: given that we only access "available" counter from cbuff, we don't need to protect it's access with LockAudio/UnlockAudio */
cbuff_tail(&sdl_backend->primary_buffer, &available);
/* Start by calculating the current Primary buffer fullness in terms of output samples */
size_t expected_level = (size_t)(((int64_t)(available/N64_SAMPLE_BYTES) * sdl_backend->output_frequency * 100) / (sdl_backend->input_frequency * sdl_backend->speed_factor));
/* Next, extrapolate to the buffer level at the expected time of the next audio callback, assuming that the
buffer is filled at the same rate as the output frequency */
unsigned int expected_next_cb_time = sdl_backend->last_cb_time + ((1000 * sdl_backend->secondary_buffer_size) / sdl_backend->output_frequency);
if (now < expected_next_cb_time) {
expected_level += (expected_next_cb_time - now) * sdl_backend->output_frequency / 1000;
}
return expected_level;
}
void sdl_synchronize_audio(struct sdl_backend* sdl_backend)
{
enum { TOLERANCE_MS = 10 };
size_t expected_level = estimate_level_at_next_audio_cb(sdl_backend);
/* If the expected value of the Primary Buffer Fullness at the time of the next audio callback is more than 10
milliseconds ahead of our target buffer fullness level, then insert a delay now */
if (sdl_backend->audio_sync && expected_level >= sdl_backend->target + sdl_backend->output_frequency * TOLERANCE_MS / 1000)
{
/* Core is ahead of SDL audio thread,
* delay emulation to allow the SDL audio thread to catch up */
unsigned int wait_time = (expected_level - sdl_backend->target) * 1000 / sdl_backend->output_frequency;
if (sdl_backend->paused_for_sync) { SDL_PauseAudio(0); }
sdl_backend->paused_for_sync = 0;
SDL_Delay(wait_time);
}
else if (expected_level < sdl_backend->secondary_buffer_size)
{
/* Core is behind SDL audio thread (predicting an underflow),
* pause the audio to let the Core catch up */
if (!sdl_backend->paused_for_sync) { SDL_PauseAudio(1); }
sdl_backend->paused_for_sync = 1;
}
else
{
/* Expected fullness is within tolerance,
* audio thread is running */
if (sdl_backend->paused_for_sync) { SDL_PauseAudio(0); }
sdl_backend->paused_for_sync = 0;
}
}
void sdl_set_speed_factor(struct sdl_backend* sdl_backend, unsigned int speed_factor)
{
if (speed_factor < 10 || speed_factor > 300)
return;
sdl_backend->speed_factor = speed_factor;
/* we need a different size primary buffer to store the N64 samples when the speed changes */
resize_primary_buffer(sdl_backend, new_primary_buffer_size(sdl_backend));
}

View file

@ -1,8 +1,7 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus - osal_preproc.h *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Copyright (C) 2009 Richard Goedeken *
* Copyright (C) 2002 Hacktarux *
* Mupen64plus-sdl-audio - sdl_backend.h *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2017 Bobby Smiles *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@ -20,13 +19,23 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* this header file is for system-dependent #defines, #includes, and typedefs */
#ifndef M64P_SDL_BACKEND_H
#define M64P_SDL_BACKEND_H
#if !defined(OSAL_PREPROC_H)
#define OSAL_PREPROC_H
#include <stddef.h>
struct sdl_backend;
struct sdl_backend* init_sdl_backend_from_config(m64p_handle config);
void release_sdl_backend(struct sdl_backend* sdl_backend);
void sdl_set_frequency(struct sdl_backend* sdl_backend, unsigned int frequency);
void sdl_push_samples(struct sdl_backend* sdl_backend, const void* src, size_t size);
void sdl_synchronize_audio(struct sdl_backend* sdl_backend);
void sdl_set_speed_factor(struct sdl_backend* sdl_backend, unsigned int speed_factor);
#if defined(__linux__)
#define HAS_OSS_SUPPORT
#endif
#endif // OSAL_PREPROC_H

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-sdl-audio - volume.c *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2007-2008 Richard42 Ebenblues *
* Copyright (C) 2002 Hacktarux *
* *
@ -20,19 +20,17 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "osal_preproc.h"
#if defined(HAS_OSS_SUPPORT)
/* Sound volume functions. */
#include <sys/soundcard.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <unistd.h> /* close() */
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <errno.h>
#include <sys/ioctl.h>
/* Sound volume functions. */
#include <sys/soundcard.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h> /* close() */
#include "volume.h"
@ -46,7 +44,7 @@ void volSet(int percent)
if(mixerfd < 0)
{
perror("/dev/mixer: ");
perror("/dev/mixer");
return;
}
@ -58,7 +56,7 @@ void volSet(int percent)
vol = (percent << 8) + percent; // set both left/right channels to same vol
ret = ioctl(mixerfd, MIXER_WRITE(SOUND_MIXER_PCM), &vol);
if(ret < 0)
perror("Setting PCM volume: ");
perror("Setting PCM volume");
close(mixerfd);
}
@ -74,13 +72,13 @@ int volGet(void)
if(mixerfd < 0)
{
perror("/dev/mixer: ");
perror("/dev/mixer");
return 0;
}
ret = ioctl(mixerfd, MIXER_READ(SOUND_MIXER_PCM), &vol);
if(ret < 0)
perror("Reading PCM volume: ");
perror("Reading PCM volume");
close(mixerfd);

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus - nogui.h *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2007-2008 Richard42 Ebenblues *
* Copyright (C) 2002 Hacktarux *
* *