Compare commits

..

No commits in common. "master" and "1.99.4" have entirely different histories.

27 changed files with 1053 additions and 2438 deletions

38
.gitattributes vendored
View file

@ -1,38 +0,0 @@
* 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

View file

@ -1,160 +0,0 @@
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/*

View file

@ -1,156 +0,0 @@
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
View file

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

View file

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

79
RELEASE
View file

@ -1,88 +1,11 @@
SDL Audio plugin for Mupen64Plus 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 Mupen64Plus-audio-sdl v1.99.4 - November 22, 2010
-------------------------------------------------- --------------------------------------------------
- Bugfix: Plugin should write default config values at startup time - 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 - 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 - makefile fixes and improvements
Mupen64Plus-audio-sdl v1.99.3 - February 13, 2010 Mupen64Plus-audio-sdl v1.99.3 - February 13, 2010
-------------------------------------------------- --------------------------------------------------

View file

@ -1,41 +0,0 @@
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

@ -1,160 +0,0 @@
<?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

@ -0,0 +1,213 @@
<?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-audio-sdl - Makefile *
# * Mupen64Plus homepage: https://mupen64plus.org/ * # * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
# * Copyright (C) 2007-2009 Richard Goedeken * # * Copyright (C) 2007-2009 Richard Goedeken *
# * Copyright (C) 2007-2008 Tillin9 * # * Copyright (C) 2007-2008 Tillin9 *
# * * # * *
@ -22,7 +22,7 @@
# Makefile for SDL Audio plugin in Mupen64plus # Makefile for SDL Audio plugin in Mupen64plus
# detect operation system # detect operation system
UNAME ?= $(shell uname -s) UNAME = $(shell uname -s)
OS := NONE OS := NONE
ifeq ("$(UNAME)","Linux") ifeq ("$(UNAME)","Linux")
OS = LINUX OS = LINUX
@ -49,196 +49,118 @@ ifeq ("$(UNAME)","FreeBSD")
SHARED = -shared SHARED = -shared
SO_EXTENSION = so SO_EXTENSION = so
endif endif
ifeq ("$(UNAME)","OpenBSD")
OS = FREEBSD
SHARED = -shared
SO_EXTENSION = so
NO_OSS = 1
endif
ifneq ("$(filter GNU/kFreeBSD kfreebsd,$(UNAME))","") ifneq ("$(filter GNU/kFreeBSD kfreebsd,$(UNAME))","")
OS = LINUX OS = LINUX
SHARED = -shared SHARED = -shared
SO_EXTENSION = so SO_EXTENSION = so
endif endif
ifeq ("$(patsubst MINGW%,MINGW,$(UNAME))","MINGW")
OS = MINGW
SHARED = -shared
SO_EXTENSION = dll
PIC = 0
NO_OSS = 1
endif
ifeq ("$(OS)","NONE") ifeq ("$(OS)","NONE")
$(error OS type "$(UNAME)" not supported. Please file bug report at 'https://github.com/mupen64plus/mupen64plus-core/issues') $(error OS type "$(UNAME)" not supported. Please file bug report at 'http://code.google.com/p/mupen64plus/issues')
endif endif
# detect system architecture, only if it matters for build flags # detect system architecture
HOST_CPU ?= $(shell uname -m) HOST_CPU ?= $(shell uname -m)
CPU := OTHER NO_ASM ?= 1
CPU := NONE
ifneq ("$(filter x86_64 amd64,$(HOST_CPU))","") ifneq ("$(filter x86_64 amd64,$(HOST_CPU))","")
CPU := X86 CPU := X86
ifeq ("$(BITS)", "32") ifeq ("$(BITS)", "32")
ARCH_DETECTED := 64BITS_32 ARCH_DETECTED := 64BITS_32
PIC ?= 0
else else
ARCH_DETECTED := 64BITS ARCH_DETECTED := 64BITS
PIC ?= 1
endif endif
endif endif
ifneq ("$(filter pentium i%86,$(HOST_CPU))","") ifneq ("$(filter pentium i%86,$(HOST_CPU))","")
CPU := X86 CPU := X86
ARCH_DETECTED := 32BITS ARCH_DETECTED := 32BITS
PIC ?= 0
endif endif
ifeq ("$(CPU)","OTHER") # PPC doesn't work yet
PIC ?= 1 #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')
endif endif
SRCDIR = ../../src # base CFLAGS, LIBS, and LDFLAGS
OBJDIR = _obj$(POSTFIX) CFLAGS += -ffast-math -funroll-loops -fexpensive-optimizations -fno-strict-aliasing -fvisibility=hidden -I../../src
# base CFLAGS, LDLIBS, and LDFLAGS # Since we are building a shared library, we must compile with -fPIC for x86_64 CPUs.
OPTFLAGS ?= -O3 -flto # 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
WARNFLAGS ?= -Wall ifeq ($(ARCH_DETECTED), 64BITS)
CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -ffast-math -fvisibility=hidden -I$(SRCDIR) CFLAGS += -fpic -DPIC
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 endif
# tweak flags for 32-bit build on 64-bit system # tweak flags for 32-bit build on 64-bit system
ifeq ($(ARCH_DETECTED), 64BITS_32) ifeq ($(ARCH_DETECTED), 64BITS_32)
ifeq ($(OS), FREEBSD) ifeq ($(OS), FREEBSD)
$(error Do not use the BITS=32 option with FreeBSD, use -m32 and -m elf_i386) $(error Do not use the BITS=32 option with FreeBSD, use -m32 and -m elf_i386)
endif endif
ifneq ($(OS), OSX)
ifeq ($(OS), MINGW)
LDFLAGS += -Wl,-m,i386pe
else
CFLAGS += -m32 CFLAGS += -m32
LDFLAGS += -Wl,-m,elf_i386 LDFLAGS += -m32 -m elf_i386
endif
endif
endif
ifeq ($(ARCH_DETECTED), 64BITS)
ifeq ($(OS), MINGW)
LDFLAGS += -Wl,-m,i386pep
endif
endif endif
# set special flags per-system # set special flags per-system
ifeq ($(OS), LINUX) ifeq ($(OS), LINUX)
LDLIBS += -ldl
endif
ifeq ($(OS), OSX)
OSX_SDK_PATH = $(shell xcrun --sdk macosx --show-sdk-path)
ifeq ($(CPU), X86) ifeq ($(CPU), X86)
ifeq ($(ARCH_DETECTED), 64BITS) ifeq ($(ARCH_DETECTED), 64BITS)
CFLAGS += -pipe -arch x86_64 -mmacosx-version-min=10.9 -isysroot $(OSX_SDK_PATH) CFLAGS += -pipe -O3 -march=athlon64
LDLIBS += -ldl LDFLAGS += -ldl
else else
CFLAGS += -pipe -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=10.9 -isysroot $(OSX_SDK_PATH) CFLAGS += -pipe -O3 -mmmx -msse -march=i686 -mtune=pentium-m -fomit-frame-pointer
LDLIBS += -ldl -read_only_relocs suppress LDFLAGS += -ldl
endif endif
endif endif
endif endif
ifeq ($(OS), OSX)
# test for essential build dependencies ifeq ($(CPU), X86)
ifeq ($(origin PKG_CONFIG), undefined) ifeq ($(ARCH_DETECTED), 64BITS)
PKG_CONFIG = $(CROSS_COMPILE)pkg-config CFLAGS += -pipe -O3 -arch x86_64 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk
ifeq ($(shell which $(PKG_CONFIG) 2>/dev/null),) LDFLAGS += -arch x86_64 -ldl
$(error $(PKG_CONFIG) not found) 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 -ldl
endif endif
endif
endif
ifeq ($(CPU), PPC)
CFLAGS += -mcpu=powerpc
LDFLAGS += -ldl
endif endif
# test for presence of SDL # test for presence of SDL
ifeq ($(origin SDL_CFLAGS) $(origin SDL_LDLIBS), undefined undefined) ifeq ($(shell which sdl-config 2>/dev/null),)
ifeq ($(shell $(PKG_CONFIG) --modversion sdl2 2>/dev/null),) $(error No SDL development libraries found!)
$(error No SDL2 development libraries found!)
endif
SDL_CFLAGS += $(shell $(PKG_CONFIG) --cflags sdl2)
SDL_LDLIBS += $(shell $(PKG_CONFIG) --libs sdl2)
endif endif
CFLAGS += $(SDL_CFLAGS) ifeq ($(OS),FREEBSD)
LDLIBS += $(SDL_LDLIBS) CFLAGS += $(shell sdl-config --cflags)
LDFLAGS += $(shell sdl-config --libs)
# test for presence of speexdsp endif
ifneq ($(NO_SPEEX), 1) ifeq ($(OS),OSX)
ifeq ($(origin SPEEX_CFLAGS) $(origin SPEEX_LDLIBS), undefined undefined) CFLAGS += $(shell sdl-config --cflags)
ifneq ($(strip $(shell $(PKG_CONFIG) speexdsp --modversion 2> /dev/null)),) # sdl-config on mac screws up when we're trying to build a library and not an executable
# set speexdsp flags and libraries # SDL 1.3 is supposed to fix that, if it's ever released
SPEEX_CFLAGS += $(shell $(PKG_CONFIG) speexdsp --cflags) -DUSE_SPEEX LDFLAGS += -L/usr/local/lib -lSDL -Wl,-framework,Cocoa
SPEEX_LDLIBS += $(shell $(PKG_CONFIG) speexdsp --libs) endif
else ifeq ($(OS),LINUX)
# warn user CFLAGS += $(shell sdl-config --cflags)
$(warning No libspeexdsp development libraries found. Mupen64plus-sdl-audio will be built without speex-* resampler.) LDFLAGS += $(shell sdl-config --libs)
NO_SPEEX = 1
endif
else
SPEEX_CFLAGS += -DUSE_SPEEX
endif
CFLAGS += $(SPEEX_CFLAGS)
LDLIBS += $(SPEEX_LDLIBS)
endif endif
# test for presence of libsamplerate # test for presence of libsamplerate
ifneq ($(NO_SRC), 1) ifneq ($(strip $(shell pkg-config samplerate --modversion 2> /dev/null)),)
ifeq ($(origin SRC_CFLAGS) $(origin SRC_LDLIBS), undefined undefined) ifneq ($(NO_RESAMP), 1)
ifneq ($(strip $(shell $(PKG_CONFIG) samplerate --modversion 2> /dev/null)),)
# set libsamplerate flags and libraries # set libsamplerate flags and libraries
SRC_CFLAGS += $(shell $(PKG_CONFIG) samplerate --cflags) -DUSE_SRC CFLAGS += $(shell pkg-config samplerate --cflags) -DUSE_SRC
SRC_LDLIBS += $(shell $(PKG_CONFIG) samplerate --libs) LDFLAGS += $(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 endif
else else
USE_AUDIORESOURCE = 1 # warn user
AUDIORESOURCE_CFLAGS += -DUSE_AUDIORESOURCE $(warning No libsamplerate development libraries found. Mupen64plus-sdl-audio will be built without Best Quality SINC resampler.)
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 endif
# set mupen64plus core API header path # set mupen64plus core API header path
@ -263,6 +185,53 @@ else
endif endif
endif endif
# set shell function names
CC ?= gcc
CXX ?= g++
LD ?= g++
INSTALL ?= install
ifeq ($(OS),LINUX)
STRIP ?= strip -s
endif
ifeq ($(OS),OSX)
STRIP ?= strip -x
endif
ifeq ($(OS),FREEBSD)
STRIP += strip -s
endif
# set special flags for given Makefile parameters
ifeq ($(DEBUG),1)
CFLAGS += -g
STRIP = true # disable binary strip
endif
# set installation options
ifeq ($(PREFIX),)
PREFIX := /usr/local
endif
ifeq ($(LIBDIR),)
LIBDIR := $(PREFIX)/lib/mupen64plus
endif
SRCDIR = ../../src
OBJDIR = _obj
# list of source files to compile
SOURCE = \
$(SRCDIR)/main.c \
$(SRCDIR)/volume.c \
$(SRCDIR)/osal_dynamiclib_unix.c
# 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))
# build dependency files
CFLAGS += -MD
-include $(OBJECTS:.o=.d)
# reduced compile output when running make without V=1 # reduced compile output when running make without V=1
ifneq ($(findstring $(MAKEFLAGS),s),s) ifneq ($(findstring $(MAKEFLAGS),s),s)
ifndef V ifndef V
@ -271,64 +240,8 @@ ifndef V
endif endif
endif 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
INSTALL_STRIP_FLAG ?=
else
ifneq ($(OS),OSX)
INSTALL_STRIP_FLAG ?= -s
endif
endif
# set installation options
ifeq ($(PREFIX),)
PREFIX := /usr/local
endif
ifeq ($(LIBDIR),)
LIBDIR := $(PREFIX)/lib
endif
ifeq ($(PLUGINDIR),)
PLUGINDIR := $(LIBDIR)/mupen64plus
endif
# list of source files to compile
SOURCE = \
$(SRCDIR)/circular_buffer.c \
$(SRCDIR)/main.c \
$(SRCDIR)/sdl_backend.c \
$(SRCDIR)/volume.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) $(OBJDIRS))
# build targets # build targets
TARGET = mupen64plus-audio-sdl$(POSTFIX).$(SO_EXTENSION) TARGET = mupen64plus-audio-sdl.$(SO_EXTENSION)
targets: targets:
@echo "Mupen64Plus-audio-sdl makefile. " @echo "Mupen64Plus-audio-sdl makefile. "
@ -341,46 +254,35 @@ targets:
@echo " Options:" @echo " Options:"
@echo " BITS=32 == build 32-bit binaries on 64-bit machine" @echo " BITS=32 == build 32-bit binaries on 64-bit machine"
@echo " APIDIR=path == path to find Mupen64Plus Core headers" @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 " Install Options:"
@echo " PREFIX=path == install/uninstall prefix (default: /usr/local)" @echo " PREFIX=path == install/uninstall prefix (default: /usr/local)"
@echo " LIBDIR=path == library prefix (default: PREFIX/lib)" @echo " LIBDIR=path == path to install plugin libraries (default: PREFIX/lib/mupen64plus)"
@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 " DESTDIR=path == path to prepend to all installation paths (only for packagers)"
@echo " Debugging Options:" @echo " Debugging Options:"
@echo " DEBUG=1 == add debugging symbols" @echo " DEBUG=1 == add debugging symbols"
@echo " V=1 == show verbose compiler output"
all: $(TARGET) all: $(TARGET)
install: $(TARGET) install: $(TARGET)
$(INSTALL) -d "$(DESTDIR)$(PLUGINDIR)" $(INSTALL) -d -v "$(DESTDIR)$(LIBDIR)"
$(INSTALL) -m 0644 $(INSTALL_STRIP_FLAG) $(TARGET) "$(DESTDIR)$(PLUGINDIR)" $(INSTALL) -m 0644 $(TARGET) "$(DESTDIR)$(LIBDIR)"
uninstall: uninstall:
$(RM) "$(DESTDIR)$(PLUGINDIR)/$(TARGET)" rm -f "$(DESTDIR)$(LIBDIR)/$(TARGET)"
clean: clean:
$(RM) -r $(OBJDIR) $(TARGET) rm -rf ./_obj/* $(TARGET)
rmdir ./_obj
rebuild: clean all rebuild: clean all
# build dependency files # build rules
CFLAGS += -MD -MP
-include $(OBJECTS:.o=.d)
# standard build rules
$(OBJDIR)/%.o: $(SRCDIR)/%.c
$(COMPILE.c) -o $@ $<
$(TARGET): $(OBJECTS) $(TARGET): $(OBJECTS)
$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@ $(Q_LD)$(CC) $(SHARED) $^ $(LDFLAGS) -o $@
$(STRIP) $@
$(OBJDIR)/%.o: $(SRCDIR)/%.c
$(Q_CC)$(CC) -o $@ $(CFLAGS) -c $<
.PHONY: all clean install uninstall targets

View file

@ -1,83 +0,0 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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;
}

View file

@ -1,46 +0,0 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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 - main.h *
* Mupen64Plus homepage: https://mupen64plus.org/ * * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Copyright (C) 2008-2012 Tillin9, Richard42 * * Copyright (C) 2008 Tillin9 *
* * * *
* This program is free software; you can redistribute it and/or modify * * 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 * * it under the terms of the GNU General Public License as published by *
@ -20,36 +20,13 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* version info */ /* version info */
#include "m64p_config.h" #define SDL_AUDIO_PLUGIN_VERSION 0x016304
#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 */ /* declarations of pointers to Core config functions */
extern ptr_ConfigListSections ConfigListSections; extern ptr_ConfigListSections ConfigListSections;
extern ptr_ConfigOpenSection ConfigOpenSection; extern ptr_ConfigOpenSection ConfigOpenSection;
extern ptr_ConfigDeleteSection ConfigDeleteSection;
extern ptr_ConfigListParameters ConfigListParameters; extern ptr_ConfigListParameters ConfigListParameters;
extern ptr_ConfigSaveFile ConfigSaveFile;
extern ptr_ConfigSetParameter ConfigSetParameter; extern ptr_ConfigSetParameter ConfigSetParameter;
extern ptr_ConfigGetParameter ConfigGetParameter; extern ptr_ConfigGetParameter ConfigGetParameter;
extern ptr_ConfigGetParameterHelp ConfigGetParameterHelp; extern ptr_ConfigGetParameterHelp ConfigGetParameterHelp;
@ -62,5 +39,3 @@ extern ptr_ConfigGetParamFloat ConfigGetParamFloat;
extern ptr_ConfigGetParamBool ConfigGetParamBool; extern ptr_ConfigGetParamBool ConfigGetParamBool;
extern ptr_ConfigGetParamString ConfigGetParamString; 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-core - osal/dynamiclib.h *
* Mupen64Plus homepage: https://mupen64plus.org/ * * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Copyright (C) 2009 Richard Goedeken * * Copyright (C) 2009 Richard Goedeken *
* * * *
* This program is free software; you can redistribute it and/or modify * * 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-core - osal/dynamiclib_unix.c *
* Mupen64Plus homepage: https://mupen64plus.org/ * * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Copyright (C) 2009 Richard Goedeken * * Copyright (C) 2009 Richard Goedeken *
* * * *
* This program is free software; you can redistribute it and/or modify * * 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. * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
#include <dlfcn.h>
#include "m64p_types.h" #include "m64p_types.h"
#include "osal_dynamiclib.h" #include "osal_dynamiclib.h"

View file

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

View file

@ -1,7 +1,8 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-sdl-audio - sdl_backend.h * * Mupen64plus - osal_preproc.h *
* Mupen64Plus homepage: https://mupen64plus.org/ * * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Copyright (C) 2017 Bobby Smiles * * Copyright (C) 2009 Richard Goedeken *
* Copyright (C) 2002 Hacktarux *
* * * *
* This program is free software; you can redistribute it and/or modify * * 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 * * it under the terms of the GNU General Public License as published by *
@ -19,23 +20,13 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifndef M64P_SDL_BACKEND_H /* this header file is for system-dependent #defines, #includes, and typedefs */
#define M64P_SDL_BACKEND_H
#include <stddef.h> #if !defined(OSAL_PREPROC_H)
#define OSAL_PREPROC_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
#endif // OSAL_PREPROC_H

View file

@ -1,78 +0,0 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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

@ -1,51 +0,0 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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

View file

@ -1,133 +0,0 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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
};

View file

@ -1,200 +0,0 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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
};

View file

@ -1,83 +0,0 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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
};

View file

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

View file

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