diff --git a/.travis/appveyor.bat b/.ci/bootstrap.bat
similarity index 64%
rename from .travis/appveyor.bat
rename to .ci/bootstrap.bat
index 3723abeb6..9a4a110f6 100644
--- a/.travis/appveyor.bat
+++ b/.ci/bootstrap.bat
@@ -1,9 +1,5 @@
+@ECHO OFF
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
-del /q /s internal\c\libqb\*.o >nul 2>nul
-del /q /s internal\c\libqb\*.a >nul 2>nul
-del /q /s internal\c\parts\*.o >nul 2>nul
-del /q /s internal\c\parts\*.a >nul 2>nul
-del /q /s internal\temp\*.* >nul 2>nul
cd internal\c
set MINGW=mingw32
@@ -40,20 +36,4 @@ cd internal\c
c_compiler\bin\windres.exe -i ..\temp\icon.rc -o ..\temp\icon.o
c_compiler\bin\g++ -mconsole -s -Wfatal-errors -w -Wall qbx.cpp libqb\os\win\libqb_setup.o ..\temp\icon.o -D DEPENDENCY_LOADFONT parts\video\font\ttf\os\win\src.o -D DEPENDENCY_SOCKETS -D DEPENDENCY_NO_PRINTER -D DEPENDENCY_ICON -D DEPENDENCY_NO_SCREENIMAGE parts\core\os\win\src.a -lopengl32 -lglu32 -mwindows -static-libgcc -static-libstdc++ -D GLEW_STATIC -D FREEGLUT_STATIC -lws2_32 -lwinmm -lgdi32 -o "..\..\qb64_bootstrap.exe"
IF ERRORLEVEL 1 exit /b 1
-cd ..\..
-echo Compiling new QB64
-echo From git %APPVEYOR_REPO_COMMIT:~0,7% > internal\version.txt
-qb64_bootstrap.exe -x source\qb64.bas -o qb64.exe
-IF ERRORLEVEL 1 exit /b 1
-
-del qb64_bootstrap.exe
-del /q /s secure-file
-del /q /s internal\source\*
-move internal\temp\* internal\source\
-del /q /s internal\c\libqb\*.o >nul 2>nul
-del /q /s internal\c\libqb\*.a >nul 2>nul
-del /q /s internal\c\parts\*.o >nul 2>nul
-del /q /s internal\c\parts\*.a >nul 2>nul
-cd internal\source
-del /q /s debug_* recompile_*
diff --git a/.ci/bootstrap.sh b/.ci/bootstrap.sh
new file mode 100755
index 000000000..ac43d2b76
--- /dev/null
+++ b/.ci/bootstrap.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+OS=$1
+
+com_build() {
+ cd internal/c/$1/os/$OS
+ echo -n "Building $2..."
+ if [[ $OS == "osx" ]]; then
+ ./setup_build.command
+ else
+ ./setup_build.sh
+ fi
+ if [ $? -ne 0 ]; then
+ echo "$2 build failed."
+ exit 1
+ fi
+ echo "Done"
+ cd - > /dev/null
+}
+
+com_build "libqb" "libQB"
+com_build "parts/video/font/ttf" "FreeType"
+if [[ $OS == "lnx" ]]; then
+ com_build "parts/core" "FreeGLUT"
+fi
+
+cp -r internal/source/* internal/temp/
+cd internal/c
+echo -n "Bootstrapping QB64..."
+if [[ $OS == "osx" ]]; then
+ clang++ -w qbx.cpp libqb/os/osx/libqb_setup.o parts/video/font/ttf/os/osx/src.o -framework GLUT -framework OpenGL -framework Cocoa -lcurses -o ../../qb64_bootstrap
+else
+ g++ -w qbx.cpp libqb/os/lnx/libqb_setup.o parts/video/font/ttf/os/lnx/src.o parts/core/os/lnx/src.a -lGL -lGLU -lX11 -lcurses -lpthread -ldl -lrt -D FREEGLUT_STATIC -DDEPENDENCY_USER_MODS -o ../../qb64_bootstrap
+fi
+
+if [ $? -ne 0 ]; then
+ echo "QB64 bootstrap failed"
+ exit 1
+fi
+echo "Done"
diff --git a/.ci/build.bat b/.ci/build.bat
new file mode 100644
index 000000000..e0f82e2bf
--- /dev/null
+++ b/.ci/build.bat
@@ -0,0 +1,20 @@
+SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
+
+echo Compiling new QB64
+echo From git %APPVEYOR_REPO_COMMIT:~0,7% > internal\version.txt
+qb64_bootstrap.exe -z source\qb64.bas
+cd internal\c
+c_compiler\bin\g++ -mconsole -s -Wfatal-errors -w -Wall qbx.cpp libqb\os\win\libqb_setup.o ..\temp\icon.o -D DEPENDENCY_LOADFONT parts\video\font\ttf\os\win\src.o -D DEPENDENCY_SOCKETS -D DEPENDENCY_NO_PRINTER -D DEPENDENCY_ICON -D DEPENDENCY_NO_SCREENIMAGE parts\core\os\win\src.a -lopengl32 -lglu32 -mwindows -static-libgcc -static-libstdc++ -D GLEW_STATIC -D FREEGLUT_STATIC -lws2_32 -lwinmm -lgdi32 -o "..\..\qb64.exe"
+IF ERRORLEVEL 1 exit /b 1
+
+cd ..\..
+del qb64_bootstrap.exe
+del /q /s secure-file
+del /q /s internal\source\*
+move internal\temp\* internal\source\
+del /q /s internal\c\libqb\*.o >nul 2>nul
+del /q /s internal\c\libqb\*.a >nul 2>nul
+del /q /s internal\c\parts\*.o >nul 2>nul
+del /q /s internal\c\parts\*.a >nul 2>nul
+cd internal\source
+del /q /s debug_* recompile_*
diff --git a/.travis/common-exclusion.list b/.ci/common-exclusion.list
similarity index 51%
rename from .travis/common-exclusion.list
rename to .ci/common-exclusion.list
index aca915c52..6e9890917 100644
--- a/.travis/common-exclusion.list
+++ b/.ci/common-exclusion.list
@@ -1,9 +1,10 @@
+.ci
.travis
.travis.yml
appveyor.yml
.git
.gitignore
+.github
setup_win.bat
-qb64/internal/c/mingw32
-qb64/internal/c/mingw64
-autosync.sh
+internal/c/mingw32
+internal/c/mingw64
diff --git a/.ci/compile.bat b/.ci/compile.bat
new file mode 100644
index 000000000..f1bea773a
--- /dev/null
+++ b/.ci/compile.bat
@@ -0,0 +1,20 @@
+@ECHO OFF
+SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
+
+echo From git %GITHUB_SHA:~0,7% > internal\version.txt
+qb64_bootstrap.exe -z source\qb64.bas
+cd internal\c
+c_compiler\bin\g++ -mconsole -s -Wfatal-errors -w -Wall qbx.cpp libqb\os\win\libqb_setup.o ..\temp\icon.o -D DEPENDENCY_LOADFONT parts\video\font\ttf\os\win\src.o -D DEPENDENCY_SOCKETS -D DEPENDENCY_NO_PRINTER -D DEPENDENCY_ICON -D DEPENDENCY_NO_SCREENIMAGE parts\core\os\win\src.a -lopengl32 -lglu32 -mwindows -static-libgcc -static-libstdc++ -D GLEW_STATIC -D FREEGLUT_STATIC -lws2_32 -lwinmm -lgdi32 -o "..\..\qb64.exe"
+IF ERRORLEVEL 1 exit /b 1
+
+cd ..\..
+del qb64_bootstrap.exe
+del /q /s secure-file
+del /q /s internal\source\*
+del /q /s internal\temp\*
+del /q /s internal\c\libqb\*.o >nul 2>nul
+del /q /s internal\c\libqb\*.a >nul 2>nul
+del /q /s internal\c\parts\*.o >nul 2>nul
+del /q /s internal\c\parts\*.a >nul 2>nul
+cd internal\source
+del /q /s debug_* recompile_*
diff --git a/.ci/compile.sh b/.ci/compile.sh
new file mode 100755
index 000000000..b8c7d233b
--- /dev/null
+++ b/.ci/compile.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+echo From git `echo $GITHUB_SHA | sed 's/\(.......\).*$/\1/'` > internal/version.txt
+./qb64_bootstrap -x -w source/qb64.bas
+SUCCESS=$?
+rm qb64_bootstrap
+rm internal/source/*
+mv internal/temp/* internal/source/
+rm internal/source/debug_* internal/source/recompile_*
+find . -type f -iname "*.a" -exec rm {} \;
+find . -type f -iname "*.o" -exec rm {} \;
+exit $SUCCESS
diff --git a/.ci/deploy.ps1 b/.ci/deploy.ps1
new file mode 100644
index 000000000..016c33693
--- /dev/null
+++ b/.ci/deploy.ps1
@@ -0,0 +1,12 @@
+$Bucket = "qb64"
+$Timestamp = (Get-Date).ToUniversalTime().ToString("yyyy-MM-dd-HH-mm-ss")
+$Filename = "qb64_development_win-${Env:PLATFORM}.7z"
+# Ideally this would change the directory name to have useful information, but Windows gives an error
+# "The process cannot access the file because it is being used by another process.", so this feature
+# is disabled until someone can work out a better way.
+# $Dirname = "qb64_${Timestamp}_$($Env:GITHUB_SHA.substring(0,7))_win-${Env:PLATFORM}"
+# Rename-Item qb64 $Dirname
+$Dirname = "qb64"
+Set-Location ..
+7z a "-xr@${Dirname}\.ci\common-exclusion.list" "-xr@${Dirname}\.ci\win-exclusion.list" $Filename $Dirname
+aws --endpoint-url ${Env:S3_ENDPOINT} s3api put-object --bucket ${Bucket} --body $Filename --acl public-read --key development-builds/$Filename
diff --git a/.ci/deploy.sh b/.ci/deploy.sh
new file mode 100755
index 000000000..486cbd9e5
--- /dev/null
+++ b/.ci/deploy.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+OS=$1
+TZ=UTC now=`date +"%F-%H-%M-%S"`
+BUCKET=qb64
+filename="qb64_development_${OS}.tar.gz"
+dirname="qb64_${now}_`echo ${GITHUB_SHA} | sed 's/\(.......\).*$/\1/'`_${OS}"
+cd ..
+mv qb64 "${dirname}"
+tar --create --auto-compress --file ${filename} --exclude-from=${dirname}/.ci/common-exclusion.list --exclude-from=${dirname}/.ci/$OS-exclusion.list ${dirname}
+aws --endpoint-url ${S3_ENDPOINT} s3api put-object --bucket ${BUCKET} --body ${filename} --acl public-read --key development-builds/${filename}
+if [[ $OS == lnx ]]; then
+ aws --endpoint-url ${S3_ENDPOINT} s3api put-object --bucket ${BUCKET} --body ${dirname}/CHANGELOG.md --acl public-read --key development-builds/changelog.md
+fi
+# Move it back so the post-job cleanup doesn't complain
+mv "${dirname}" qb64
diff --git a/.travis/lnx-exclusion.list b/.ci/lnx-exclusion.list
similarity index 69%
rename from .travis/lnx-exclusion.list
rename to .ci/lnx-exclusion.list
index 16a8f91df..e7e35e664 100644
--- a/.travis/lnx-exclusion.list
+++ b/.ci/lnx-exclusion.list
@@ -1,3 +1,3 @@
-setup_osx.command
+setup_macos.command
internal/c/c_compiler
qb64_start_osx.command
diff --git a/.travis/osx-exclusion.list b/.ci/osx-exclusion.list
similarity index 100%
rename from .travis/osx-exclusion.list
rename to .ci/osx-exclusion.list
diff --git a/.ci/update-source.sh b/.ci/update-source.sh
new file mode 100755
index 000000000..7b7c10f68
--- /dev/null
+++ b/.ci/update-source.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+git config --local user.email "flukiluke@gmail.com"
+git config --local user.name "Autobuild Process"
+git add internal/source
+if [[ $(git diff --cached | wc -l) -gt 0 ]]
+ then git commit -m "Update internal/source"
+fi
+
diff --git a/.travis/win-exclusion.list b/.ci/win-exclusion.list
similarity index 100%
rename from .travis/win-exclusion.list
rename to .ci/win-exclusion.list
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
new file mode 100644
index 000000000..7de31baf8
--- /dev/null
+++ b/.github/FUNDING.yml
@@ -0,0 +1,3 @@
+# These are supported funding model platforms
+
+patreon: qb64
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
new file mode 100644
index 000000000..4e199e675
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -0,0 +1,32 @@
+---
+name: Bug report
+about: Create a report to help us improve
+title: ''
+labels: ''
+assignees: ''
+
+---
+
+**QB64 info (please complete the following information):**
+ - First, make sure you've tried to replicate the problem in the latest development build. Get it from https://www.qb64.org/portal/development-build/: [Yes, the issue is in the latest dev build. / No, the issue was fixed. Yay!]
+ - If the suspected bug is also present in the latest dev build, please report what you get in the `Help->About` dialog: [e.g. `Version 1.5 dev build from git a6101af`]
+ - Report the OS you're using: [e.g. Windows 10 Build 2H2D]
+
+ **Describe the bug**
+ A clear and concise description of what the bug is.
+
+**To Reproduce**
+Steps to reproduce the behavior:
+1. Go to '...'
+2. Click on '....'
+3. Scroll down to '....'
+4. See error
+
+**Expected behavior**
+A clear and concise description of what you expected to happen.
+
+**Screenshots**
+If applicable, add screenshots to help explain your problem. If not, delete this block.
+
+**Additional context**
+Add any other context about the problem here.
diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md
new file mode 100644
index 000000000..e301d68ce
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature_request.md
@@ -0,0 +1,20 @@
+---
+name: Feature request
+about: Suggest an idea for this project
+title: ''
+labels: feature request
+assignees: ''
+
+---
+
+**Is your feature request related to a problem? Please describe.**
+A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
+
+**Describe the solution you'd like**
+A clear and concise description of what you want to happen.
+
+**Describe alternatives you've considered**
+A clear and concise description of any alternative solutions or features you've considered.
+
+**Additional context**
+Add any other context or screenshots about the feature request here.
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 000000000..f051dd7e8
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,84 @@
+on:
+ push:
+ branches:
+ - master
+
+jobs:
+ linux-build:
+ runs-on: ubuntu-latest
+ if: "!contains(github.event.head_commit.message, 'ci-skip')"
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install dependencies
+ run: sudo apt update && sudo apt install libglu1-mesa-dev libncurses-dev
+ - name: Bootstrap compiler
+ run: .ci/bootstrap.sh lnx
+ - name: Compile
+ run: .ci/compile.sh
+ - name: Publish to S3
+ if: github.event_name == 'push'
+ run: .ci/deploy.sh lnx
+ env:
+ AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
+ AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
+ AWS_REGION: us-east-2
+ S3_ENDPOINT: https://nyc3.digitaloceanspaces.com
+
+ macos-build:
+ runs-on: macos-latest
+ if: "!contains(github.event.head_commit.message, 'ci-skip')"
+ steps:
+ - uses: actions/checkout@v2
+ - name: Bootstrap compiler
+ run: .ci/bootstrap.sh osx
+ - name: Compile
+ run: .ci/compile.sh
+ - name: Publish to S3
+ if: github.event_name == 'push'
+ run: .ci/deploy.sh osx
+ env:
+ AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
+ AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
+ AWS_REGION: us-east-2
+ S3_ENDPOINT: https://nyc3.digitaloceanspaces.com
+
+ windows-x86-build:
+ runs-on: windows-latest
+ if: "!contains(github.event.head_commit.message, 'ci-skip')"
+ env:
+ PLATFORM: x86
+ steps:
+ - uses: actions/checkout@v2
+ - name: Bootstrap compiler
+ run: .ci/bootstrap.bat
+ - name: Compile
+ run: .ci/compile.bat
+ - name: Publish to S3
+ if: github.event_name == 'push'
+ run: .ci/deploy.ps1
+ env:
+ AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
+ AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
+ AWS_REGION: us-east-2
+ S3_ENDPOINT: https://nyc3.digitaloceanspaces.com
+
+ windows-x64-build:
+ runs-on: windows-latest
+ if: "!contains(github.event.head_commit.message, 'ci-skip')"
+ env:
+ PLATFORM: x64
+ steps:
+ - uses: actions/checkout@v2
+ - name: Bootstrap compiler
+ run: .ci/bootstrap.bat
+ - name: Compile
+ run: .ci/compile.bat
+ - name: Publish to S3
+ if: github.event_name == 'push'
+ run: .ci/deploy.ps1
+ env:
+ AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
+ AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
+ AWS_REGION: us-east-2
+ S3_ENDPOINT: https://nyc3.digitaloceanspaces.com
+
diff --git a/.github/workflows/run.yml b/.github/workflows/run.yml
new file mode 100644
index 000000000..113c2f14c
--- /dev/null
+++ b/.github/workflows/run.yml
@@ -0,0 +1,94 @@
+on:
+ push:
+ branches:
+ - development
+
+jobs:
+ linux-build:
+ runs-on: ubuntu-latest
+ if: "!contains(github.event.head_commit.message, 'ci-skip')"
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install dependencies
+ run: sudo apt update && sudo apt install libglu1-mesa-dev libncurses-dev
+ - name: Bootstrap compiler
+ run: .ci/bootstrap.sh lnx
+ - name: Compile
+ run: .ci/compile.sh
+ - name: Update source
+ if: github.event_name == 'push'
+ run: .ci/update-source.sh
+ - name: Push to repository
+ if: github.event_name == 'push'
+ uses: ad-m/github-push-action@19caa5c351f47734055690f7d01aaaef2f9114d5
+ with:
+ github_token: ${{ secrets.GITHUB_TOKEN }}
+ branch: development
+ - name: Publish to S3
+ if: github.event_name == 'push'
+ run: .ci/deploy.sh lnx
+ env:
+ # We are using Digital Ocean Spaces but they are API compatible with S3
+ AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
+ AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
+ # AWS_REGION is useless but aws-cli gives errors if its not set
+ AWS_REGION: us-east-2
+ S3_ENDPOINT: https://nyc3.digitaloceanspaces.com
+
+ macos-build:
+ runs-on: macos-latest
+ if: "!contains(github.event.head_commit.message, 'ci-skip')"
+ steps:
+ - uses: actions/checkout@v2
+ - name: Bootstrap compiler
+ run: .ci/bootstrap.sh osx
+ - name: Compile
+ run: .ci/compile.sh
+ - name: Publish to S3
+ if: github.event_name == 'push'
+ run: .ci/deploy.sh osx
+ env:
+ AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
+ AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
+ AWS_REGION: us-east-2
+ S3_ENDPOINT: https://nyc3.digitaloceanspaces.com
+
+ windows-x86-build:
+ runs-on: windows-latest
+ if: "!contains(github.event.head_commit.message, 'ci-skip')"
+ env:
+ PLATFORM: x86
+ steps:
+ - uses: actions/checkout@v2
+ - name: Bootstrap compiler
+ run: .ci/bootstrap.bat
+ - name: Compile
+ run: .ci/compile.bat
+ - name: Publish to S3
+ if: github.event_name == 'push'
+ run: .ci/deploy.ps1
+ env:
+ AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
+ AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
+ AWS_REGION: us-east-2
+ S3_ENDPOINT: https://nyc3.digitaloceanspaces.com
+
+ windows-x64-build:
+ runs-on: windows-latest
+ if: "!contains(github.event.head_commit.message, 'ci-skip')"
+ env:
+ PLATFORM: x64
+ steps:
+ - uses: actions/checkout@v2
+ - name: Bootstrap compiler
+ run: .ci/bootstrap.bat
+ - name: Compile
+ run: .ci/compile.bat
+ - name: Publish to S3
+ if: github.event_name == 'push'
+ run: .ci/deploy.ps1
+ env:
+ AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
+ AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
+ AWS_REGION: us-east-2
+ S3_ENDPOINT: https://nyc3.digitaloceanspaces.com
diff --git a/.gitignore b/.gitignore
index eca482e34..b786cf1ae 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,15 +1,17 @@
internal/c/c_compiler
-internal/temp
-internal/temp2
-internal/temp3
+internal/temp*
*.o
*.a
*.exe
-internal/config.txt
+*.bas
+internal/config*.txt
+internal/config.ini
internal/help
-internal/config(2).txt
-internal/config(1).txt
internal/version.txt
tempfoldersearch.bin
internal/c/mingw32
internal/c/mingw64
+internal/c/qbx[2-9].cpp
+*.ttf
+/run_qb64.sh
+/qb64
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index ef52e028e..000000000
--- a/.travis.yml
+++ /dev/null
@@ -1,36 +0,0 @@
-language: cpp
-install: true
-script: ".travis/build.sh"
-after_success: ".travis/push.sh"
-matrix:
- include:
- - os: osx
- compiler: clang
- - os: linux
- compiler: gcc
-notifications:
- irc:
- channels: chat.freenode.net#qb64
- skip_join: true
- template:
- - 'Autobuild of branch %{branch}: %{message}'
-addons:
- ssh_known_hosts: qb64.org
- apt:
- packages:
- - p7zip-full
-before_deploy:
-- openssl aes-256-cbc -K $encrypted_efd51ce9e893_key -iv $encrypted_efd51ce9e893_iv
- -in .travis/travis-qb64.org_rsa.enc -out /tmp/travis-qb64.org_rsa -d
-- eval "$(ssh-agent -s)"
-- chmod 600 /tmp/travis-qb64.org_rsa
-- ssh-add /tmp/travis-qb64.org_rsa
-deploy:
- provider: script
- skip_cleanup: true
- script: ".travis/deploy.sh"
- on:
- branch:
- - development
- - master
-before_install:
diff --git a/.travis/appveyor-deploy.ps1 b/.travis/appveyor-deploy.ps1
deleted file mode 100644
index 4927a8aa5..000000000
--- a/.travis/appveyor-deploy.ps1
+++ /dev/null
@@ -1,5 +0,0 @@
-$filename = "qb64_" + (get-date -uformat "%Y-%m-%d-%H-%M-%S") + "_" + $Env:APPVEYOR_REPO_COMMIT.Substring(0,7) + "-" + $Env:APPVEYOR_REPO_BRANCH + "_win_" + $Env:PLATFORM + ".7z"
-cd ..
-7z a '-xr@qb64\.travis\common-exclusion.list' '-xr@qb64\.travis\win-exclusion.list' $filename qb64
-
-scp -q -o StrictHostKeyChecking=no $filename m6rosupy1q2t@qb64.org:autobuilds/$Env:APPVEYOR_REPO_BRANCH/
diff --git a/.travis/appveyor-qb64.org_rsa.enc b/.travis/appveyor-qb64.org_rsa.enc
deleted file mode 100644
index 4be36b374..000000000
Binary files a/.travis/appveyor-qb64.org_rsa.enc and /dev/null differ
diff --git a/.travis/build-osx.sh b/.travis/build-osx.sh
deleted file mode 100755
index 71b4f3b80..000000000
--- a/.travis/build-osx.sh
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/bin/sh
-
-g++ --version
-
-###### Part 1: Build old QB64 ######
-echo "Preparing bootstrap:"
-find . -type f -iname "*.command" -exec chmod +x {} \;
-find . -type f -iname "*.a" -exec rm {} \;
-find . -type f -iname "*.o" -exec rm {} \;
-
-rm internal/temp/* 2> /dev/null
-
-com_build() {
- cd internal/c/$1/os/osx
- echo "Building $2..."
- ./setup_build.command
- if [ $? -ne 0 ]; then
- echo "$2 build failed."
- exit 1
- fi
- echo "Done"
- cd - > /dev/null
-}
-
-com_build "libqb" "libQB"
-com_build "parts/video/font/ttf" "FreeType"
-
-cp -r internal/source/* internal/temp/
-cd internal/c
-echo "Bootstrapping QB64..."
-g++ -w qbx.cpp libqb/os/osx/libqb_setup.o parts/video/font/ttf/os/osx/src.o -framework GLUT -framework OpenGL -framework Cocoa -lcurses -o ../../qb64_bootstrap
-if [ $? -ne 0 ]; then
- echo "QB64 bootstrap failed"
- exit 1
-fi
-echo "Done"
-cd - > /dev/null
-
-###### Part 2: Build new QB64 from .bas sources ######
-echo "Translating .bas source..."
-echo From git `echo $TRAVIS_COMMIT | sed 's/\(.......\).*$/\1/'` > internal/version.txt
-./qb64_bootstrap -x -z source/qb64.bas > /tmp/qb64-output
-rm qb64_bootstrap
-if [ `grep -v '^WARNING' /tmp/qb64-output | wc -l` -gt 2 ]; then
- cat /tmp/qb64-output
- rm /tmp/qb64-output
- exit 1
-fi
-echo "Done"
-
-echo "Testing compile/link..."
-# extract g++ line
-cd internal/temp/
-cpp_call=`awk '$1=="g++" {print $0}' < recompile_osx.command`
-
-# run g++
-cd ../c/
-$cpp_call -o ../../qb64_testrun
-if [ $? -ne 0 -o ! -f ../../qb64_testrun ]; then
- echo "Compile/link test failed"
- exit 1
-fi
-cd ../../
-rm qb64_testrun
-echo "Done"
-exit
diff --git a/.travis/build.sh b/.travis/build.sh
deleted file mode 100755
index b4a0f0175..000000000
--- a/.travis/build.sh
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/bin/bash
-if [ "$TRAVIS_OS_NAME" = "osx" ]; then exec .travis/build-osx.sh; fi
-
-###### Part 1: Build old QB64 ######
-echo "Preparing bootstrap:"
-find . -type f -iname "*.sh" -exec chmod +x {} \;
-find . -type f -iname "*.a" -exec rm {} \;
-find . -type f -iname "*.o" -exec rm {} \;
-
-rm internal/temp/* 2> /dev/null
-
-com_build() {
- cd internal/c/$1/os/lnx
- echo -n "Building $2..."
- ./setup_build.sh
- if [ $? -ne 0 ]; then
- echo "$2 build failed."
- exit 1
- fi
- echo "Done"
- cd - > /dev/null
-}
-
-com_build "libqb" "libQB"
-com_build "parts/video/font/ttf" "FreeType"
-com_build "parts/core" "FreeGLUT"
-
-cp -r internal/source/* internal/temp/
-cd internal/c
-echo -n "Bootstrapping QB64..."
-g++ $NOPIE -w qbx.cpp libqb/os/lnx/libqb_setup.o parts/video/font/ttf/os/lnx/src.o parts/core/os/lnx/src.a -lGL -lGLU -lX11 -lcurses -lpthread -ldl -lrt -D FREEGLUT_STATIC -DDEPENDENCY_USER_MODS -o ../../qb64_bootstrap
-if [ $? -ne 0 ]; then
- echo "QB64 bootstrap failed"
- exit 1
-fi
-echo "Done"
-cd - > /dev/null
-
-###### Part 2: Build new QB64 from .bas sources ######
-echo -n "Translating .bas source..."
-echo From git `echo $TRAVIS_COMMIT | sed 's/\(.......\).*$/\1/'` > internal/version.txt
-./qb64_bootstrap -x -z source/qb64.bas > /tmp/qb64-output
-rm qb64_bootstrap
-if [ `grep -v '^WARNING' /tmp/qb64-output | wc -l` -gt 2 ]; then
- cat /tmp/qb64-output
- rm /tmp/qb64-output
- exit 1
-fi
-echo "Done"
-
-echo -n "Testing compile/link..."
-# extract g++ line
-cd internal/temp/
-cpp_call=`awk '$1=="g++" {print $0}' < recompile_lnx.sh`
-echo $cpp_call
-
-# run g++
-cd ../c/
-${cpp_call/-no-pie/} -o ../../qb64_testrun
-if [ $? -ne 0 -o ! -f ../../qb64_testrun ]; then
- echo "Compile/link test failed"
- exit 1
-fi
-cd ../../
-rm qb64_testrun
-echo "Done"
-if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then exit; fi
-
-###### Part 3: Establish new bootstrapee ######
-rm internal/source/*
-mv internal/temp/* internal/source/
-find . -type f -iname "*.a" -exec rm {} \;
-find . -type f -iname "*.o" -exec rm {} \;
-cd internal/source
-rm debug_* recompile_*
diff --git a/.travis/deploy.sh b/.travis/deploy.sh
deleted file mode 100755
index 371460dab..000000000
--- a/.travis/deploy.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-
-if [ "$TRAVIS_OS_NAME" != "linux" ]; then exit; fi
-
-# Prepare archives
-# mainversion=`awk '$1=="Version$" {split($3, A, /\"/);print A[2];}' < source/global/version.bas`
-# buildnum=`awk '$1=="BuildNum$" {split($3,A, /[\"\/]/); print A[3];}' < source/global/version.bas`
-TZ=UTC now=`date +"%F-%H-%M-%S"`
-filebase="/tmp/qb64_${now}_`echo ${TRAVIS_COMMIT} | sed 's/\(.......\).*$/\1/'`-${TRAVIS_BRANCH}"
-rm -r .dpl
-
-cd ..
-tar --create --auto-compress --file ${filebase}_osx.tar.gz --exclude-from=qb64/.travis/common-exclusion.list --exclude-from=qb64/.travis/osx-exclusion.list qb64
-tar --create --auto-compress --file ${filebase}_lnx.tar.gz --exclude-from=qb64/.travis/common-exclusion.list --exclude-from=qb64/.travis/lnx-exclusion.list qb64
-#7z a -xr@qb64/.travis/common-exclusion.list -xr@qb64/.travis/win-exclusion.list ${filebase}_win.7z qb64/ > /dev/null
-
-# Send to server
-# Sometimes the connection can be a bit flakey, so try multiple times on error
-for i in `seq 1 10`
-do scp ${filebase}_* m6rosupy1q2t@qb64.org:autobuilds/${TRAVIS_BRANCH}/
- if [ "$?" -eq 0 ]
- then exit 0
- fi
- echo scp failed
-done
-
diff --git a/.travis/push.sh b/.travis/push.sh
deleted file mode 100755
index ff6cd7023..000000000
--- a/.travis/push.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-if [ "$TRAVIS_OS_NAME" != "linux" ]; then exit; fi
-if [ "${UPDATE_REPO}" != "yes" ]; then exit; fi
-git config --global user.email "flukiluke@gmail.com"
-git config --global user.name "Autobuild process"
-git clone --depth=1 --branch=$TRAVIS_BRANCH https://${GH_TOKEN}@github.com/Galleondragon/qb64.git homeqb64
-cd homeqb64
-rm -r internal/source
-cp -r ../internal/source internal/source
-git add --all internal/source
-git commit --message "Autobuild update [ci skip]"
-git push
-cd ..
-rm -rf homeqb64
diff --git a/.travis/travis-qb64.org_rsa.enc b/.travis/travis-qb64.org_rsa.enc
deleted file mode 100644
index 146ccb813..000000000
Binary files a/.travis/travis-qb64.org_rsa.enc and /dev/null differ
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 000000000..de08c16e3
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,41 @@
+# QB64 development build - Changelog
+Upcoming version is currently identified as v2.1, but that number may change before release.
+
+## New features
+### All platforms
+- Implement the `_Bin$` function as counterpart to `&B` prefixed number strings. Usage is analog to the legacy OCT$ and HEX$ functions.
+- Save Watch Panel position and size.
+- Add `$NOPREFIX` support for `$COLOR`.
+- Allow changing color of menu panels and dialogs (Options->IDE Colors).
+- Add support to different number formats in Watch Panel and Watch List dialog (dec/hex/oct/bin).
+
+
+
+## Fixes
+### All platforms
+- Fix function `LOC` returning wrong values when used on physical files.
+- Fix glitch in syntax highlighter mistaking variable names with scientific notation.
+- Fix Variable List dialog's "Add All" button not properly considering the active filter.
+- Fix wiki update feature.
+- Fix issue with Sub/Function parameters in `Declare` blocks with `$NoPrefix`.
+- Fix issue with Sub/Function parameters without types after `As`.
+- Fix issue with capitalization of array names in `LBound/UBound` calls.
+- Fix capitalization of 'To' in `Case` statements.
+- Fix indentation issue in disabled precompiler blocks.
+- Fix crash when a variable was deleted between `$Debug` sessions.
+- Reenables selecting a line by clicking the line number bar when `$Debug` is not used and the `Auto-add $Debug metacommand` feature is disabled.
+
+
+
+### Linux
+- Fix building static libraries when installation path contains spaces.
\ No newline at end of file
diff --git a/COPYING.txt b/COPYING.txt
new file mode 100644
index 000000000..f8b288860
--- /dev/null
+++ b/COPYING.txt
@@ -0,0 +1 @@
+Please refer to licenses/COPYING.TXT for licensing details.
diff --git a/README.md b/README.md
index 82b49e44e..c3eb0ca57 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,55 @@
-_This repository is outdated. Follow development at https://github.com/QB64Team/qb64_
-
# QB64
-
-
-
+Download the appropriate package for your operating system. Check the Releases page.
+
+
+## Windows
+
+Make sure to extract the package contents to a folder with full write permissions (failing to do so may result in IDE or compilation errors).
+
+* It is advisable to to whitelist the QB64 folder in your antivirus/antimalware software *
+
+
+## macOS
+Before using QB64 make sure to install the Xcode command line tools with:
+```bash
+xcode-select --install
+```
+
+Run ```./setup_osx.command``` to compile QB64 for your OS version.
+
+
+## Linux
+Compile QB64 with ```./setup_lnx.sh```.
+
+Dependencies should be automatically installed. Required packages include OpenGL, ALSA and the GNU C++ Compiler.
+
+
+# Usage
+Run the QB64 executable to launch the IDE, which you can use to edit your .BAS files. From there, hit F5 to compile and run your code.
+
+To generate a binary without running it, hit F11.
+
+Additionally, if you do not wish to use the integrated IDE and to only compile your program, you can use the following command-line calls:
+
+```qb64 -c yourfile.bas```
+
+```qb64 -c yourfile.bas -o outputname.exe```
+
+Replacing `-c` with `-x` will compile without opening a separate compiler window.
\ No newline at end of file
diff --git a/SAMPLES.txt b/SAMPLES.txt
new file mode 100644
index 000000000..daee05619
--- /dev/null
+++ b/SAMPLES.txt
@@ -0,0 +1,3 @@
+The collection of sample programs previous distributed with QB64 is now available at https://www.qb64.org/forum/index.php?topic=171.0
+
+More programs and useful code routines at https://www.qb64.org/forum/index.php?board=8.0
diff --git a/appveyor.yml b/appveyor.yml
deleted file mode 100644
index 557bc46b6..000000000
--- a/appveyor.yml
+++ /dev/null
@@ -1,17 +0,0 @@
-version: 1.2.{build}
-image: Visual Studio 2017
-clone_depth: 1
-environment:
- sshkey:
- secure: BiD9D+ye4Q+R8yBsThsfG0K+SFL5gRx6gNfxxSTR8ge3lp98cwZ3y7T3bq7tmgE7
-platform:
- - x86
- - x64
-build_script:
-- cmd: .travis\appveyor.bat
-install:
- - nuget install secure-file -ExcludeVersion
- - cmd: secure-file\tools\secure-file -decrypt .travis\appveyor-qb64.org_rsa.enc -secret %sshkey% -out %userprofile%\.ssh\id_rsa
-deploy_script:
- - ps: .travis\appveyor-deploy.ps1
-test: off
diff --git a/autosync.sh b/autosync.sh
deleted file mode 100755
index e2c624efc..000000000
--- a/autosync.sh
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/bash
-# This script reproduces any commits on upstream to the given remotes, but only on the given branches.
-# It is intended to be run via a cron job or similar.
-# The merge is --ff-only, so the target branches must not have anything else adding commits to them.
-
-set -e
-cd ~/qb64
-
-# Adding a new branch/remote? git checkout -b $remote-$branch $remote/$branch to create a new local.
-BRANCHES='development'
-REMOTES='origin fellippe qb64team'
-
-git fetch upstream
-
-for branch in $BRANCHES; do
- for remote in $REMOTES; do
- git checkout -q $remote-$branch
- git merge -q --ff-only upstream/$branch
- done
-done
-
-for remote in $REMOTES; do
- refspecs=
- for branch in $BRANCHES; do
- refspecs="$refspecs $remote-$branch:$branch"
- done
- git push -q $remote $refspecs
-done
diff --git a/cyberbit.ttf b/cyberbit.ttf
deleted file mode 100644
index 264ccc4d0..000000000
Binary files a/cyberbit.ttf and /dev/null differ
diff --git a/internal/c/common.h b/internal/c/common.h
index 2fcd4a8c2..aa46548f9 100644
--- a/internal/c/common.h
+++ b/internal/c/common.h
@@ -100,7 +100,6 @@
#endif
#endif
- using namespace std;
//QB64 string descriptor structure
struct qbs_field{
@@ -270,6 +269,7 @@
*/
ptrszint elementsize;
int32 image;
+ int32 sound;
};
struct mem_lock{
uint64 id;
@@ -279,6 +279,7 @@
//2=image
//3=sub/function scope block
//4=array
+ //5=sound
//---- type specific variables follow ----
void *offset;//used by malloc'ed blocks to free them
};
diff --git a/internal/c/libqb.cpp b/internal/c/libqb.cpp
index a6ec82ce1..1c7f4ac0d 100644
--- a/internal/c/libqb.cpp
+++ b/internal/c/libqb.cpp
@@ -22,9 +22,15 @@
#endif
-
int32 disableEvents=0;
+//Global console vvalues
+static int32 consolekey;
+static int32 consolemousex;
+static int32 consolemousey;
+static int32 consolebutton;
+int32 func__getconsoleinput(); //declare here, so we can use with SLEEP and END commands
+
//This next block used to be in common.cpp; put here until I can find a better
//place for it (LC, 2018-01-05)
@@ -58,90 +64,58 @@ return (word << shift) | (word >> (32 - shift));
uint64 qbr_longdouble_to_uint64(long double f){if (f<0) return(f-0.5f); else return(f+0.5f);}
int32 qbr_float_to_long(float f){if (f<0) return(f-0.5f); else return(f+0.5f);}
int32 qbr_double_to_long(double f){if (f<0) return(f-0.5f); else return(f+0.5f);}
+ void fpu_reinit() { } // do nothing
#else
//QBASIC compatible rounding via FPU:
- #ifdef QB64_MICROSOFT
- int64 qbr(long double f){
- int64 i; int temp=0;
- if (f>9223372036854775807) {temp=1;f=f-9223372036854775808u;} //if it's too large for a signed int64, make it an unsigned int64 and return that value if possible.
- __asm{
- fld f
- fistp i
- }
- if (temp) return i|0x8000000000000000;//+9223372036854775808;
- return i;
- }
- uint64 qbr_longdouble_to_uint64(long double f){
- uint64 i;
- __asm{
- fld f
- fistp i
- }
- return i;
- }
- int32 qbr_float_to_long(float f){
- int32 i;
- __asm{
- fld f
- fistp i
- }
- return i;
- }
- int32 qbr_double_to_long(double f){
- int32 i;
- __asm{
- fld f
- fistp i
- }
- return i;
- }
- #else
- //FLDS=load single
- //FLDL=load double
- //FLDT=load long double
- int64 qbr(long double f){
- int64 i; int temp=0;
- if (f>9223372036854775807) {temp=1;f=f-9223372036854775808u;} //if it's too large for a signed int64, make it an unsigned int64 and return that value if possible.
- __asm__ (
+ //FLDS=load single
+ //FLDL=load double
+ //FLDT=load long double
+ int64 qbr(long double f){
+ int64 i; int temp=0;
+ if (f>9223372036854775807) {temp=1;f=f-9223372036854775808u;} //if it's too large for a signed int64, make it an unsigned int64 and return that value if possible.
+ __asm__ (
"fldt %1;"
"fistpll %0;"
:"=m" (i)
:"m" (f)
- );
- if (temp) return i|0x8000000000000000;// if it's an unsigned int64, manually set the bit flag
- return i;
- }
- uint64 qbr_longdouble_to_uint64(long double f){
- uint64 i;
- __asm__ (
+ );
+ if (temp) return i|0x8000000000000000;// if it's an unsigned int64, manually set the bit flag
+ return i;
+ }
+ uint64 qbr_longdouble_to_uint64(long double f){
+ uint64 i;
+ __asm__ (
"fldt %1;"
"fistpll %0;"
:"=m" (i)
:"m" (f)
- );
- return i;
- }
- int32 qbr_float_to_long(float f){
- int32 i;
- __asm__ (
+ );
+ return i;
+ }
+ int32 qbr_float_to_long(float f){
+ int32 i;
+ __asm__ (
"flds %1;"
"fistpl %0;"
:"=m" (i)
:"m" (f)
- );
- return i;
- }
- int32 qbr_double_to_long(double f){
- int32 i;
- __asm__ (
+ );
+ return i;
+ }
+ int32 qbr_double_to_long(double f){
+ int32 i;
+ __asm__ (
"fldl %1;"
"fistpl %0;"
:"=m" (i)
:"m" (f)
- );
- return i;
- }
- #endif
+ );
+ return i;
+ }
+ void fpu_reinit(){
+ unsigned int mode = 0x37F;
+ asm("fldcw %0" : : "m" (*&mode));
+ }
#endif //x86 support
//bit-array access functions (note: used to be included through 'bit.cpp')
uint64 getubits(uint32 bsize,uint8 *base,ptrszint i){
@@ -278,8 +252,6 @@ int32 environment_2d__letterbox=0;//1=vertical black stripes required, 2=horizon
-int32 qloud_next_input_index=1;
-
int32 window_exists=0;
int32 create_window=0;
int32 window_focused=0; //Not used on Windows
@@ -1216,10 +1188,6 @@ typedef enum {
-extern int32 cloud_app;
-int32 cloud_chdir_complete=0;
-int32 cloud_port[8];
-
/* Restricted Functionality: (Security focused approach, does not include restricting sound etc)
Block while compiling: (ONLY things that cannot be caught at runtime)
@@ -1264,8 +1232,6 @@ int32 mem_lock_freed_max=1000;//number of allocated entries
int32 mem_lock_freed_n=0;//number of entries
ptrszint *mem_lock_freed=(ptrszint*)malloc(sizeof(ptrszint)*mem_lock_freed_max);
-//inline removed because it is incompatible with Android studio x86 build
-
void new_mem_lock(){
if (mem_lock_freed_n){
mem_lock_tmp=(mem_lock*)mem_lock_freed[--mem_lock_freed_n];
@@ -1397,6 +1363,8 @@ extern uint32 qbevent;
extern int32 console;
extern int32 screen_hide_startup;
+extern int32 asserts;
+extern int32 vwatch;
//...
int64 exit_code=0;
@@ -2358,18 +2326,6 @@ int32 exit_ok=0;
int MessageBox2(int ignore,char* message,char* title,int type){
- if (cloud_app){
- FILE *f = fopen("..\\final.txt", "w");
- if (f != NULL)
- {
- fprintf(f, "%s", title);
- fprintf(f, "\n");
- fprintf(f, "%s", message);
- fclose(f);
- }
- exit(0);//should log error
- }
-
#ifdef QB64_WINDOWS
return MessageBox(window_handle,message,title,type);
#else
@@ -2749,24 +2705,7 @@ char *fixdir(qbs *filename){
//note: changes the slashes in a filename to make it compatible with the OS
//applied to QB commands: open, bload/bsave, loadfont, loadimage, sndopen/sndplayfile
static int32 i;
-
- if (cloud_app){
- for (i=0;ilen;i++){
- if ((filename->chr[i]>=48)&&(filename->chr[i]<=57)) goto ok;
- if ((filename->chr[i]>=65)&&(filename->chr[i]<=90)){filename->chr[i]+=32; goto ok;}//force lowercase
- if ((filename->chr[i]>=97)&&(filename->chr[i]<=122)) goto ok;
- if (filename->chr[i]==95) goto ok;//underscore
- if (filename->chr[i]==46){
- if (i!=0) goto ok;//period cannot be the first character
- }
- if (filename->chr[i]==0){
- if (i==(filename->len-1)) goto ok;//NULL terminator
- }
- error(263);//"Paths/Filename illegal in QLOUD"
- ok:;
- }
- }
-
+
for (i=0;ilen;i++){
#ifdef QB64_WINDOWS
if (filename->chr[i]==47) filename->chr[i]=92;
@@ -3479,7 +3418,14 @@ void sub__putimage(double f_dx1,double f_dy1,double f_dx2,double f_dy2,int32 src
if (d->text){error(5); return;}
dbpp=d->bytes_per_pixel;
if ((sbpp==4)&&(dbpp==1)){error(5); return;}
- if (s==d){error(5); return;}//cannot put source onto itself!
+ if (s==d){
+ //{error(5); return;}//cannot put source onto itself!
+ int32 temphandle=func__copyimage(dst,NULL,0);
+ passed=passed|8; //make certain we set the flag TO LET QB64 know we're passing a handle to the temp image
+ sub__putimage(f_dx1, f_dy1, f_dx2, f_dy2,temphandle, dst, f_sx1, f_sy1, f_sx2, f_sy2, passed);
+ sub__freeimage(temphandle,1);
+ return;
+ }
resolve_coordinates:
@@ -5449,91 +5395,135 @@ extern uint32 error_goto_line;
extern uint32 error_handling;
extern uint32 error_retry;
+void sub__echo(qbs *message);
+
+void unlockvWatchHandle() {
+ if (vwatch>0) vwatch=-1;
+}
+
+int32 vWatchHandle() {
+ return vwatch;
+}
+
+void sub__assert(int32 expression, qbs *assert_message, int32 passed) {
+ if (asserts==0) return;
+ if (expression==0) {
+ if (console==1 && passed==1) {
+ sub__echo(assert_message);
+ error(315);
+ return;
+ }
+ error(314);
+ }
+ return;
+}
+
+char *human_error(int32 errorcode) {
+ switch (errorcode) {
+ case 0: return "No error";
+ case 1: return "NEXT without FOR";
+ case 2: return "Syntax error";
+ case 3: return "RETURN without GOSUB";
+ case 4: return "Out of DATA";
+ case 5: return "Illegal function call";
+ case 6: return "Overflow";
+ case 7: return "Out of memory";
+ case 8: return "Label not defined";
+ case 9: return "Subscript out of range";
+ case 10: return "Duplicate definition";
+ case 12: return "Illegal in direct mode";
+ case 13: return "Type mismatch";
+ case 14: return "Out of string space";
+ //error 15 undefined
+ case 16: return "String formula too complex";
+ case 17: return "Cannot continue";
+ case 18: return "Function not defined";
+ case 19: return "No RESUME";
+ case 20: return "RESUME without error";
+ //error 21-23 undefined
+ case 24: return "Device timeout";
+ case 25: return "Device fault";
+ case 26: return "FOR without NEXT";
+ case 27: return "Out of paper";
+ //error 28 undefined
+ case 29: return "WHILE without WEND";
+ case 30: return "WEND without WHILE";
+ //error 31-32 undefined
+ case 33: return "Duplicate label";
+ //error 34 undefined
+ case 35: return "Subprogram not defined";
+ //error 36 undefined
+ case 37: return "Argument-count mismatch";
+ case 38: return "Array not defined";
+ case 40: return "Variable required";
+ case 50: return "FIELD overflow";
+ case 51: return "Internal error";
+ case 52: return "Bad file name or number";
+ case 53: return "File not found";
+ case 54: return "Bad file mode";
+ case 55: return "File already open";
+ case 56: return "FIELD statement active";
+ case 57: return "Device I/O error";
+ case 58: return "File already exists";
+ case 59: return "Bad record length";
+ case 61: return "Disk full";
+ case 62: return "Input past end of file";
+ case 63: return "Bad record number";
+ case 64: return "Bad file name";
+ case 67: return "Too many files";
+ case 68: return "Device unavailable";
+ case 69: return "Communication-buffer overflow";
+ case 70: return "Permission denied";
+ case 71: return "Disk not ready";
+ case 72: return "Disk-media error";
+ case 73: return "Feature unavailable";
+ case 74: return "Rename across disks";
+ case 75: return "Path/File access error";
+ case 76: return "Path not found";
+ case 258: return "Invalid handle";
+ case 300: return "Memory region out of range";
+ case 301: return "Invalid size";
+ case 302: return "Source memory region out of range";
+ case 303: return "Destination memory region out of range";
+ case 304: return "Source and destination memory regions out of range";
+ case 305: return "Source memory has been freed";
+ case 306: return "Destination memory has been freed";
+ case 307: return "Memory already freed";
+ case 308: return "Memory has been freed";
+ case 309: return "Memory not initialized";
+ case 310: return "Source memory not initialized";
+ case 311: return "Destination memory not initialized";
+ case 312: return "Source and destination memory not initialized";
+ case 313: return "Source and destination memory have been freed";
+ case 314: return "_ASSERT failed";
+ case 315: return "_ASSERT failed (check console for description)";
+ default: return "Unprintable error";
+ }
+}
+
+qbs *func_mid(qbs *str,int32 start,int32 l,int32 passed);
+qbs *qbs_new_txt_len(const char *txt,int32 len);
+qbs *func_command(int32 index, int32 passed);
+
void fix_error(){
char *errtitle = NULL, *errmess = NULL, *cp;
int prevent_handling = 0, len, v;
- if ((new_error >= 300) && (new_error <= 313)) prevent_handling = 1;
+ if ((new_error >= 300) && (new_error <= 315)) prevent_handling = 1;
if (!error_goto_line || error_handling || prevent_handling) {
- switch (new_error) {
- case 1: cp="NEXT without FOR"; break;
- case 2: cp="Syntax error"; break;
- case 3: cp="RETURN without GOSUB"; break;
- case 4: cp="Out of DATA"; break;
- case 5: cp="Illegal function call"; break;
- case 6: cp="Overflow"; break;
- case 7: cp="Out of memory"; break;
- case 8: cp="Label not defined"; break;
- case 9: cp="Subscript out of range"; break;
- case 10: cp="Duplicate definition"; break;
- case 12: cp="Illegal in direct mode"; break;
- case 13: cp="Type mismatch"; break;
- case 14: cp="Out of string space"; break;
- //error 15 undefined
- case 16: cp="String formula too complex"; break;
- case 17: cp="Cannot continue"; break;
- case 18: cp="Function not defined"; break;
- case 19: cp="No RESUME"; break;
- case 20: cp="RESUME without error"; break;
- //error 21-23 undefined
- case 24: cp="Device timeout"; break;
- case 25: cp="Device fault"; break;
- case 26: cp="FOR without NEXT"; break;
- case 27: cp="Out of paper"; break;
- //error 28 undefined
- case 29: cp="WHILE without WEND"; break;
- case 30: cp="WEND without WHILE"; break;
- //error 31-32 undefined
- case 33: cp="Duplicate label"; break;
- //error 34 undefined
- case 35: cp="Subprogram not defined"; break;
- //error 36 undefined
- case 37: cp="Argument-count mismatch"; break;
- case 38: cp="Array not defined"; break;
- case 40: cp="Variable required"; break;
- case 50: cp="FIELD overflow"; break;
- case 51: cp="Internal error"; break;
- case 52: cp="Bad file name or number"; break;
- case 53: cp="File not found"; break;
- case 54: cp="Bad file mode"; break;
- case 55: cp="File already open"; break;
- case 56: cp="FIELD statement active"; break;
- case 57: cp="Device I/O error"; break;
- case 58: cp="File already exists"; break;
- case 59: cp="Bad record length"; break;
- case 61: cp="Disk full"; break;
- case 62: cp="Input past end of file"; break;
- case 63: cp="Bad record number"; break;
- case 64: cp="Bad file name"; break;
- case 67: cp="Too many files"; break;
- case 68: cp="Device unavailable"; break;
- case 69: cp="Communication-buffer overflow"; break;
- case 70: cp="Permission denied"; break;
- case 71: cp="Disk not ready"; break;
- case 72: cp="Disk-media error"; break;
- case 73: cp="Feature unavailable"; break;
- case 74: cp="Rename across disks"; break;
- case 75: cp="Path/File access error"; break;
- case 76: cp="Path not found"; break;
- case 258: cp="Invalid handle"; break;
-
- case 300: cp="Memory region out of range"; break;
- case 301: cp="Invalid size"; break;
- case 302: cp="Source memory region out of range"; break;
- case 303: cp="Destination memory region out of range"; break;
- case 304: cp="Source and destination memory regions out of range"; break;
- case 305: cp="Source memory has been freed"; break;
- case 306: cp="Destination memory has been freed"; break;
- case 307: cp="Memory already freed"; break;
- case 308: cp="Memory has been freed"; break;
- case 309: cp="Memory not initialized"; break;
- case 310: cp="Source memory not initialized"; break;
- case 311: cp="Destination memory not initialized"; break;
- case 312: cp="Source and destination memory not initialized"; break;
- case 313: cp="Source and destination memory have been freed"; break;
- default: cp="Unprintable error"; break;
+ //strip path from binary name
+ static int32 i;
+ static qbs *binary_name=NULL;
+ if (!binary_name) binary_name=qbs_new(0,0);
+ qbs_set(binary_name,qbs_add(func_command( 0 ,1),qbs_new_txt_len("\0",1)));
+ for(i=binary_name->len;i>0;i--){
+ if ((binary_name->chr[i-1]==47)||(binary_name->chr[i-1]==92)) {
+ qbs_set(binary_name,func_mid(binary_name, i + 1,NULL,0));
+ break;
+ }
}
- #define FIXERRMSG_TITLE "%s%u"
+ cp = human_error(new_error);
+ #define FIXERRMSG_TITLE "%s%u - %s"
#define FIXERRMSG_BODY "Line: %u (in %s)\n%s%s"
#define FIXERRMSG_MAINFILE "main module"
#define FIXERRMSG_CONT "\nContinue?"
@@ -5545,10 +5535,10 @@ void fix_error(){
if (!errmess) exit(0); //At this point we just give up
snprintf(errmess, len + 1, FIXERRMSG_BODY, (inclercl ? inclercl : ercl), (inclercl ? includedfilename : FIXERRMSG_MAINFILE), cp, (!prevent_handling ? FIXERRMSG_CONT : ""));
- len = snprintf(errtitle, 0, FIXERRMSG_TITLE, (!prevent_handling ? FIXERRMSG_UNHAND : FIXERRMSG_CRIT), new_error);
+ len = snprintf(errtitle, 0, FIXERRMSG_TITLE, (!prevent_handling ? FIXERRMSG_UNHAND : FIXERRMSG_CRIT), new_error, binary_name->chr);
errtitle = (char*)malloc(len + 1);
if (!errtitle) exit(0); //At this point we just give up
- snprintf(errtitle, len + 1, FIXERRMSG_TITLE, (!prevent_handling ? FIXERRMSG_UNHAND : FIXERRMSG_CRIT), new_error);
+ snprintf(errtitle, len + 1, FIXERRMSG_TITLE, (!prevent_handling ? FIXERRMSG_UNHAND : FIXERRMSG_CRIT), new_error, binary_name->chr);
if (prevent_handling){
v=MessageBox2(NULL,errmess,errtitle,MB_OK);
@@ -5602,8 +5592,6 @@ void error(int32 error_number){
if (error_number==259){MessageBox2(NULL,"Cannot find dynamic library file","Critical Error",MB_OK|MB_SYSTEMMODAL); exit(0);}
if (error_number==260){MessageBox2(NULL,"Sub/Function does not exist in dynamic library","Critical Error",MB_OK|MB_SYSTEMMODAL); exit(0);}
if (error_number==261){MessageBox2(NULL,"Sub/Function does not exist in dynamic library","Critical Error",MB_OK|MB_SYSTEMMODAL); exit(0);}
- if (error_number==262){MessageBox2(NULL,"Function unavailable in QLOUD","Critical Error",MB_OK|MB_SYSTEMMODAL); exit(0);}
- if (error_number==263){MessageBox2(NULL,"Paths/Filename illegal in QLOUD","Critical Error",MB_OK|MB_SYSTEMMODAL); exit(0);}
if (error_number==270){MessageBox2(NULL,"_GL command called outside of SUB _GL's scope","Critical Error",MB_OK|MB_SYSTEMMODAL); exit(0);}
if (error_number==271){MessageBox2(NULL,"END/SYSTEM called within SUB _GL's scope","Critical Error",MB_OK|MB_SYSTEMMODAL); exit(0);}
@@ -5632,6 +5620,9 @@ void end(){
while(1) Sleep(16);
}
+int32 stop_program_state() {
+ return stop_program;
+}
//MEM_STATIC memory manager
@@ -6490,6 +6481,8 @@ qbs *ui642string(uint64 v){ static qbs *tqbs; tqbs=qbs_new(8,1); *((uint64*)(tqb
qbs *s2string(float v){ static qbs *tqbs; tqbs=qbs_new(4,1); *((float*)(tqbs->chr))=v; return tqbs;}
qbs *d2string(double v){ static qbs *tqbs; tqbs=qbs_new(8,1); *((double*)(tqbs->chr))=v; return tqbs;}
qbs *f2string(long double v){ static qbs *tqbs; tqbs=qbs_new(32,1); memset(tqbs->chr,0,32); *((long double*)(tqbs->chr))=v; return tqbs;}
+qbs *o2string(ptrszint v){ static qbs *tqbs; tqbs=qbs_new(sizeof(ptrszint),1); memset(tqbs->chr,0,sizeof(ptrszint)); *((ptrszint*)(tqbs->chr))=v; return tqbs;}
+qbs *uo2string(uptrszint v){ static qbs *tqbs; tqbs=qbs_new(sizeof(uptrszint),1); memset(tqbs->chr,0,sizeof(uptrszint)); *((uptrszint*)(tqbs->chr))=v; return tqbs;}
qbs *bit2string(uint32 bsize,int64 v){
static qbs* tqbs;
tqbs=qbs_new(8,1);
@@ -6520,6 +6513,8 @@ uint64 string2ui64(qbs*str){ if (str->len<8) {error(5); return 0;} else {return
float string2s(qbs*str){ if (str->len<4) {error(5); return 0;} else {return *((float*)str->chr);} }
double string2d(qbs*str){ if (str->len<8) {error(5); return 0;} else {return *((double*)str->chr);} }
long double string2f(qbs*str){ if (str->len<32) {error(5); return 0;} else {return *((long double*)str->chr);} }
+ptrszint string2o(qbs*str){ if (str->lenchr);} }
+uptrszint string2uo(qbs*str){ if (str->lenchr);} }
uint64 string2ubit(qbs*str,uint32 bsize){
int64 bmask;
if (str->len<((bsize+7)>>3)) {error(5); return 0;}
@@ -6580,6 +6575,11 @@ qbs *func_string(int32 characters,int32 asciivalue){
return tqbs;
}
+void set_qbs_size(ptrszint *target_qbs,int32 newlength) {
+ qbs_set((qbs*)(*target_qbs), func_space(newlength));
+ return;
+}
+
int32 func_instr(int32 start,qbs *str,qbs *substr,int32 passed){
//QB64 difference: start can be 0 or negative
//justification-start could be larger than the length of string to search in QBASIC
@@ -6758,7 +6758,7 @@ int32 func__str_nc_compare(qbs *s1, qbs *s2) {
}
if (l1l1) return 1;
+ if (l1>l2) return 1;
return 0;
}
@@ -6781,11 +6781,7 @@ int32 func__str_compare(qbs *s1, qbs *s2) {
qbs *qbs_inkey(){
if (new_error) return qbs_new(0,1);
qbs *tqbs;
- if (cloud_app){
- Sleep(20);
- }else{
- Sleep(0);
- }
+ // Sleep(0);
tqbs=qbs_new(2,1);
if (cmem[0x41a]!=cmem[0x41c]){
tqbs->chr[0]=cmem[0x400+cmem[0x41a]];
@@ -6821,6 +6817,12 @@ void sub__keyclear(int32 buf, int32 passed) {
//INP(&H60) buffer
port60h_events = 0;
}
+ #ifdef QB64_WINDOWS
+ //Windows Console Buffer
+ FlushConsoleInputBuffer(GetStdHandle (STD_INPUT_HANDLE));
+ #endif
+
+
}
//STR() functions
@@ -7406,6 +7408,30 @@ void qbg_sub_color(uint32 col1,uint32 col2,uint32 bordercolor,int32 passed){
//performs no action if nothing passed (as in QBASIC for some modes)
return;
}
+
+ if (write_page->console){
+ #ifdef QB64_WINDOWS
+ HANDLE output = GetStdHandle(STD_OUTPUT_HANDLE);
+ int color = col2 * 16 + col1;
+ SetConsoleTextAttribute(output, color);
+ #else
+ // Exactly how the colour is rendered depends on your terminal emulator and
+ // colour palette. Themes and user-customisation aside, the first 16 colours
+ // line up with the old VGA colour scheme.
+ // Most terminal emulators can handle 8 bit colour, see
+ // https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit for the 8 bit colour palette.
+ if ((passed & 1 && (col1 > 255 || col1 < 0))
+ || (passed & 2 && (col2 > 255 || col2 < 0)))
+ goto error;
+
+ if (passed & 1)
+ printf("\033[38;5;%dm", col1);
+
+ if (passed & 2)
+ printf("\033[48;5;%dm", col2);
+ #endif
+ return;
+ }
if (write_page->compatible_mode==32){
if (passed&4) goto error;
@@ -8038,7 +8064,7 @@ void sub_pcopy(int32 src,int32 dst){
return;
}
-void qbsub_width(int32 option,int32 value1,int32 value2,int32 passed){
+void qbsub_width(int32 option,int32 value1,int32 value2,int32 value3, int32 value4, int32 passed){
//[{#|LPRINT}][?],[?]
static int32 i,i2;
@@ -8071,9 +8097,33 @@ void qbsub_width(int32 option,int32 value1,int32 value2,int32 passed){
//COLOR selection is kept, all other values are lost (if staying in same "mode")
static int32 f,f2,width,height;
- if ((!(passed&1))&&(!(passed&2))) goto error;//cannot omit both arguments
-
width=value1; height=value2;
+
+ #ifdef QB64_WINDOWS
+ if (write_page->console){
+ SECURITY_ATTRIBUTES SecAttribs = {sizeof(SECURITY_ATTRIBUTES), 0, 1};
+ HANDLE cl_conout = CreateFileA("CONOUT$", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, & SecAttribs, OPEN_EXISTING, 0, 0);
+ HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
+ CONSOLE_SCREEN_BUFFER_INFO cl_bufinfo;
+
+ GetConsoleScreenBufferInfo(cl_conout, &cl_bufinfo); //get the screen buffer information, for blank entries
+
+ if (width<=0) width = cl_bufinfo.srWindow.Right - cl_bufinfo.srWindow.Left + 1;; //if width is omitted, then use existing width
+ if (height<=0) height = cl_bufinfo.srWindow.Bottom - cl_bufinfo.srWindow.Top + 1;; //if height is omitted, then use existing height
+ if (value3<=0) value3 = cl_bufinfo.dwSize.X; //if bufferwidth is omitted, then use existing buffer width
+ if (value4<=0) value4 = cl_bufinfo.dwSize.Y; //same as above, but for height
+ if (value3compatible_mode==32)||(write_page->compatible_mode==256)){
@@ -9649,11 +9699,64 @@ void sub_paint(float x,float y,uint32 fillcol,uint32 bordercol,qbs *backgroundst
+//////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void getptsize_1bpp (const qbs *pt, int32 *sx, int32 *sy) {
+ *sx = 8;
+ *sy = pt->len;
+}
+
+uint32 getptcol_1bpp (const qbs *pt, int32 x, int32 y) {
+ return (pt->chr[y] >> (7-x)) & 1;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void getptsize_2bpp (const qbs *pt, int32 *sx, int32 *sy) {
+ *sx = 4;
+ *sy = pt->len;
+}
+
+uint32 getptcol_2bpp (const qbs *pt, int32 x, int32 y) {
+ return (pt->chr[y] >> ((3-x) << 1)) & 0x03;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void getptsize_4bpp (const qbs *pt, int32 *sx, int32 *sy) {
+ *sx = 8;
+ *sy = pt->len >> 2;
+ if (((*sy) << 2) < pt->len) ++*sy;
+}
+
+uint32 getptcol_4bpp (const qbs *pt, int32 x, int32 y) {
+ int quadstart = (y << 2);
+ uint32 clr = 0;
+ for(uint8 i=0; i<4; ++i) {
+ uint8 byte = ((i+quadstart) >= pt->len ? 0 : pt->chr[i+quadstart]);
+ if (byte & (1 << (7-x)))
+ clr |= (1 << i);
+ }
+ return clr;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void getptsize_8bpp (const qbs *pt, int32 *sx, int32 *sy) {
+ *sx = 1;
+ *sy = pt->len;
+}
+
+uint32 getptcol_8bpp (const qbs *pt, int x, int y) {
+ return pt->chr[y];
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////
+
void sub_paint(float x,float y,qbs *fillstr,uint32 bordercol,qbs *backgroundstr,int32 passed){
if (new_error) return;
//uses 2 buffers, a and b, and swaps between them for reading and creating
- static uint32 fillcol=0;//stub
static uint32 a_n=0;
static uint16 *a_x=(uint16*)malloc(2*65536),*a_y=(uint16*)malloc(2*65536);
static uint8 *a_t=(uint8*)malloc(65536);
@@ -9665,171 +9768,80 @@ void sub_paint(float x,float y,qbs *fillstr,uint32 bordercol,qbs *backgroundstr,
static uint32 offset;
static uint8 *cp;
static uint16 *sp;
- static uint32 backgroundcol;
-
+ static int32 done_size=640*480;
+
if (qbg_text_only){error(5); return;}
if ((passed&2)==0){error(5); return;}//must be called with this parameter!
- //STEP 1: create the tile in a buffer (tile) using the source string
- static uint8 tilestr[256];
+ if (fillstr->len==0){error(5); return;}
+
static uint8 tile[8][64];
static int32 sx,sy;
- static int32 bytesperrow;
- static int32 row2offset;
- static int32 row3offset;
- static int32 row4offset;
- static int32 byte;
- static int32 bitvalue;
- static int32 c;
- if (fillstr->len==0){error(5); return;}
- if (qbg_bits_per_pixel==4){
- if (fillstr->len>256){error(5); return;}
- }else{
- if (fillstr->len>64){error(5); return;}
+ void (*getptsize)(const qbs *pt, int32 *sx, int32 *sy) = getptsize_4bpp;
+ uint32 (*getptcol)(const qbs *pt, int32 x, int32 y) = getptcol_4bpp;
+
+ switch(write_page->compatible_mode) {
+ case 1:
+ getptsize = getptsize_2bpp;
+ getptcol = getptcol_2bpp;
+ break;
+ case 2:
+ getptsize = getptsize_1bpp;
+ getptcol = getptcol_1bpp;
+ break;
+ case 7:
+ case 8:
+ case 9:
+ case 12:
+ getptsize = getptsize_4bpp;
+ getptcol = getptcol_4bpp;
+ break;
+ case 13:
+ getptsize = getptsize_8bpp;
+ getptcol = getptcol_8bpp;
+ break;
}
- memset(&tilestr[0],0,256);
- memcpy(&tilestr[0],fillstr->chr,fillstr->len);
- sx=8; sy=fillstr->len; //defaults
- if (qbg_bits_per_pixel==8) sx=1;
- if (qbg_bits_per_pixel==4){
- if (fillstr->len&3){
- sy=(fillstr->len-(fillstr->len&3)+4)>>2;
+
+ getptsize(fillstr, &sx, &sy);
+ for(int x=0; xmask;
+
+ if (passed&1){write_page->x+=x; write_page->y+=y;}else{write_page->x=x; write_page->y=y;}
+
+ if (write_page->clipping_or_scaling){
+ if (write_page->clipping_or_scaling==2){
+ ix=qbr_float_to_long(write_page->x*write_page->scaling_x+write_page->scaling_offset_x)+write_page->view_offset_x;
+ iy=qbr_float_to_long(write_page->y*write_page->scaling_y+write_page->scaling_offset_y)+write_page->view_offset_y;
}else{
- sy=fillstr->len>>2;
- }
- bytesperrow=sx>>3; if (sx&7) bytesperrow++;
- row2offset=bytesperrow;
- row3offset=bytesperrow*2;
- row4offset=bytesperrow*3;
- }
- if (qbg_bits_per_pixel==2) sx=4;
- //use modified "PUT" routine to create the tile
- cp=&tilestr[0];
- {//layer
- static int32 x,y;
- for (y=0;y>3;
- c=0;
- if (cp[byte]&bitvalue) c|=1;
- if (cp[row2offset+byte]&bitvalue) c|=2;
- if (cp[row3offset+byte]&bitvalue) c|=4;
- if (cp[row4offset+byte]&bitvalue) c|=8;
- bitvalue>>=1; if (bitvalue==0) bitvalue=128;
- }
- if (qbg_bits_per_pixel==1){
- if (!(x&7)){
- byte=*cp;
- cp++;
- }
- c=(byte&128)>>7; byte<<=1;
- }
- if (qbg_bits_per_pixel==2){
- if (!(x&3)){
- byte=*cp;
- cp++;
- }
- c=(byte&192)>>6; byte<<=2;
- }
- //"pset" color
- tile[x][y]=c;
- }//x
- if (qbg_bits_per_pixel==4) cp+=(bytesperrow*4);
- if (qbg_bits_per_pixel==1){
- if (sx&7) cp++;
- }
- if (qbg_bits_per_pixel==2){
- if (sx&3) cp++;
- }
- }//y
- }//unlayer
- //tile created!
-
- //STEP 2: establish border and background colors
- if ((passed&4)==0) bordercol=qbg_color;
- bordercol&=qbg_pixel_mask;
-
- backgroundcol=0;//default
- if (passed&8){
- if (backgroundstr->len==0){error(5); return;}
- if (backgroundstr->len>255){error(5); return;}
- if (qbg_bits_per_pixel==1){
- c=backgroundstr->chr[0];
- if ((c>0)&&(c<255)) backgroundcol=-1;//unclear definition
- if (c==255) backgroundcol=1;
- }
- if (qbg_bits_per_pixel==2){
- backgroundcol=-1;//unclear definition
- x2=backgroundstr->chr[0];
- y2=x2&3;
- x2>>=2; if ((x2&3)!=y2) goto uncleardef;
- x2>>=2; if ((x2&3)!=y2) goto uncleardef;
-
- x2>>=2; if ((x2&3)!=y2) goto uncleardef;
-
- backgroundcol=y2;
- }
- if (qbg_bits_per_pixel==4){
- backgroundcol=-1;//unclear definition
- y2=0;
- x2=4; if (backgroundstr->len<4) x2=backgroundstr->len;
- c=0; memcpy(&c,backgroundstr->chr,x2);
- x2=c&255; c>>=8; if ((x2!=0)&&(x2!=255)) goto uncleardef;
- y2|=(x2&1);
- x2=c&255; c>>=8; if ((x2!=0)&&(x2!=255)) goto uncleardef;
- y2|=((x2&1)<<1);
- x2=c&255; c>>=8; if ((x2!=0)&&(x2!=255)) goto uncleardef;
- y2|=((x2&1)<<2);
- x2=c&255; c>>=8; if ((x2!=0)&&(x2!=255)) goto uncleardef;
- y2|=((x2&1)<<3);
- backgroundcol=y2;
- }
- if (qbg_bits_per_pixel==8){
- backgroundcol=backgroundstr->chr[0];
- }
- }
- uncleardef:
-
- //STEP 3: perform tile'd fill
- if (passed&1){qbg_x+=x; qbg_y+=y;}else{qbg_x=x; qbg_y=y;}
- if (qbg_clipping_or_scaling){
- if (qbg_clipping_or_scaling==2){
- ix=qbr_float_to_long(qbg_x*qbg_scaling_x+qbg_scaling_offset_x)+qbg_view_offset_x;
- iy=qbr_float_to_long(qbg_y*qbg_scaling_y+qbg_scaling_offset_y)+qbg_view_offset_y;
- }else{
- ix=qbr_float_to_long(qbg_x)+qbg_view_offset_x; iy=qbr_float_to_long(qbg_y)+qbg_view_offset_y;
+ ix=qbr_float_to_long(write_page->x)+write_page->view_offset_x; iy=qbr_float_to_long(write_page->y)+write_page->view_offset_y;
}
}else{
- ix=qbr_float_to_long(qbg_x); iy=qbr_float_to_long(qbg_y);
+ ix=qbr_float_to_long(write_page->x); iy=qbr_float_to_long(write_page->y);
}
//return if offscreen
- if ((ixqbg_view_x2)||(iy>qbg_view_y2)){
+ if ((ixview_x1)||(iyview_y1)||(ix>write_page->view_x2)||(iy>write_page->view_y2)){
return;
}
- offset=iy*qbg_width+ix;
+ //overrides
+ qbg_active_page_offset=write_page->offset;
+ qbg_width=write_page->width;
+ qbg_view_x1=write_page->view_x1;
+ qbg_view_y1=write_page->view_y1;
+ qbg_view_x2=write_page->view_x2;
+ qbg_view_y2=write_page->view_y2;
+ i=write_page->width*write_page->height;
+ if (i>done_size){
+ free(done);
+ done=(uint8*)calloc(i,1);
+ }
//return if first point is the bordercolor
- if (qbg_active_page_offset[offset]==bordercol) return;
-
- //return if first point is the same as the tile color used and is not the background color
- fillcol=tile[ix%sx][iy%sy];
- if ((fillcol==qbg_active_page_offset[offset])&&(fillcol!=backgroundcol)) return;
- qbg_active_page_offset[offset]=fillcol;
-
-
-
+ if (qbg_active_page_offset[iy*qbg_width+ix]==bordercol) return;
//create first node
a_x[0]=ix; a_y[0]=iy;
@@ -9841,7 +9853,7 @@ void sub_paint(float x,float y,qbs *fillstr,uint32 bordercol,qbs *backgroundstr,
//&8=check below
a_n=1;
- qbg_active_page_offset[iy*qbg_width+ix]=fillcol;
+ qbg_active_page_offset[iy*qbg_width+ix]=tile[ix%sx][iy%sy];
done[iy*qbg_width+ix]=1;
nextpass:
@@ -9857,9 +9869,7 @@ void sub_paint(float x,float y,qbs *fillstr,uint32 bordercol,qbs *backgroundstr,
if (!done[offset]){
done[offset]=1;
if (qbg_active_page_offset[offset]!=bordercol){
- fillcol=tile[x2%sx][y2%sy];
- //no tile check required when moving horizontally!
- qbg_active_page_offset[offset]=fillcol;
+ qbg_active_page_offset[offset]=tile[x2%sx][y2%sy];
b_t[b_n]=13; b_x[b_n]=x2; b_y[b_n]=y2; b_n++;//add new node
}}}}
@@ -9871,9 +9881,7 @@ void sub_paint(float x,float y,qbs *fillstr,uint32 bordercol,qbs *backgroundstr,
if (!done[offset]){
done[offset]=1;
if (qbg_active_page_offset[offset]!=bordercol){
- fillcol=tile[x2%sx][y2%sy];
- //no tile check required when moving horizontally!
- qbg_active_page_offset[offset]=fillcol;
+ qbg_active_page_offset[offset]=tile[x2%sx][y2%sy];
b_t[b_n]=14; b_x[b_n]=x2; b_y[b_n]=y2; b_n++;//add new node
}}}}
@@ -9885,11 +9893,8 @@ void sub_paint(float x,float y,qbs *fillstr,uint32 bordercol,qbs *backgroundstr,
if (!done[offset]){
done[offset]=1;
if (qbg_active_page_offset[offset]!=bordercol){
- fillcol=tile[x2%sx][y2%sy];
- if ((fillcol!=qbg_active_page_offset[offset])||(fillcol==backgroundcol)){
- qbg_active_page_offset[offset]=fillcol;
- b_t[b_n]=7; b_x[b_n]=x2; b_y[b_n]=y2; b_n++;//add new node
- }
+ qbg_active_page_offset[offset]=tile[x2%sx][y2%sy];
+ b_t[b_n]=7; b_x[b_n]=x2; b_y[b_n]=y2; b_n++;//add new node
}}}}
//below
@@ -9900,18 +9905,15 @@ void sub_paint(float x,float y,qbs *fillstr,uint32 bordercol,qbs *backgroundstr,
if (!done[offset]){
done[offset]=1;
if (qbg_active_page_offset[offset]!=bordercol){
- fillcol=tile[x2%sx][y2%sy];
- if ((fillcol!=qbg_active_page_offset[offset])||(fillcol==backgroundcol)){
- qbg_active_page_offset[offset]=fillcol;
- b_t[b_n]=11; b_x[b_n]=x2; b_y[b_n]=y2; b_n++;//add new node
- }
+ qbg_active_page_offset[offset]=tile[x2%sx][y2%sy];
+ b_t[b_n]=11; b_x[b_n]=x2; b_y[b_n]=y2; b_n++;//add new node
}}}}
}//i
//no new nodes?
if (b_n==0){
- memset(done,0,qbg_width*qbg_height);//cleanup
+ memset(done,0,write_page->width*write_page->height);//cleanup
return;//finished!
}
@@ -10541,6 +10543,20 @@ void tab(){
newline(); write_page->holding_cursor=0;
return;
}
+
+ #ifdef QB64_WINDOWS //if Windows console
+ if (write_page->console){
+ if (func_pos(0)>write_page->width-10){
+ printf("\n");
+ return;
+ }else{
+ do {
+ printf(" ");
+ }while(func_pos(0) % 10!=0);
+ }
+ return;
+ }
+ #endif
//text
if (write_page->text){
@@ -10637,6 +10653,9 @@ void qbs_print(qbs* str,int32 finish_on_new_line){
static qbs* strz; if (!strz) strz=qbs_new(0,0);
qbs_set(strz,qbs_add(str,qbs_new_txt_len("\0",1)));
if (finish_on_new_line) cout<<(char*)strz->chr<chr;
+ #ifndef QB64_WINDOWS
+ std::cout.flush();
+ #endif
return;
}
@@ -11194,13 +11213,25 @@ void qbg_sub_view(int32 x1,int32 y1,int32 x2,int32 y2,int32 fillcolor,int32 bord
}
-
+void qbg_sub_locate(int32 row,int32 column,int32 cursor,int32 start,int32 stop,int32 passed);
void sub_cls(int32 method,uint32 use_color,int32 passed){
if (new_error) return;
static int32 characters,i;
static uint16 *sp;
static uint16 clearvalue;
+ if (write_page->console){
+ #ifdef QB64_WINDOWS
+ system("cls"); //lazy but works
+ qbg_sub_locate(1, 1, 0, 0, 0, 3); //is this really necessary?
+ #else
+ if (passed&2) qbg_sub_color(0, use_color, 0, 2);
+ cout<<"\033[2J";
+ qbg_sub_locate(1, 1, 0, 0, 0, 3);
+ #endif
+ return;
+ }
+
//validate
if (passed&2){
if (write_page->bytes_per_pixel!=4){
@@ -11364,11 +11395,31 @@ void sub_cls(int32 method,uint32 use_color,int32 passed){
}
-
void qbg_sub_locate(int32 row,int32 column,int32 cursor,int32 start,int32 stop,int32 passed){
static int32 h,w,i;
if (new_error) return;
-
+
+ if (write_page->console){
+ #ifdef QB64_WINDOWS //If trying to locate with windows console
+ CONSOLE_SCREEN_BUFFER_INFO cl_bufinfo;
+ SECURITY_ATTRIBUTES SecAttribs = {sizeof(SECURITY_ATTRIBUTES), 0, 1};
+ HANDLE cl_conout = CreateFileA("CONOUT$", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, & SecAttribs, OPEN_EXISTING, 0, 0);
+ GetConsoleScreenBufferInfo(cl_conout, & cl_bufinfo);
+ if (column==0)column=cl_bufinfo.dwCursorPosition.X + 1;
+ if (row==0)row=cl_bufinfo.dwCursorPosition.Y + 1;
+ COORD pos = {column-1, row-1};
+ HANDLE output = GetStdHandle (STD_OUTPUT_HANDLE);
+ SetConsoleCursorPosition(output, pos);
+ #else
+ // We don't have a good way of getting the current cursor position, so we ignore any LOCATEs
+ // that don't give an absolute position.
+ if (!(passed & 1 && passed & 2))
+ return;
+ printf("\033[%d;%dH", row, column);
+ #endif
+ return;
+ }
+
//calculate height & width in characters
if (write_page->compatible_mode){
h=write_page->height/fontheight[write_page->font];
@@ -11398,7 +11449,7 @@ void qbg_sub_locate(int32 row,int32 column,int32 cursor,int32 start,int32 stop,i
buffer=(char*)malloc(80*25*2);
c=write_page->color; c2=write_page->background_color;
memcpy(buffer,&cmem[0xB8000],80*25*2);
- qbsub_width(0,80,50,3);
+ qbsub_width(0,80,50,0,0,3);
memcpy(&cmem[0xB8000],buffer,80*25*2);
write_page->color=c; write_page->background_color=c2;
free(buffer);
@@ -11482,68 +11533,87 @@ void qbg_sub_locate(int32 row,int32 column,int32 cursor,int32 start,int32 stop,i
//input helper functions:
uint64 hexoct2uint64_value;
-int32 hexoct2uint64(qbs* h){
- //returns 0=failed
- // 1=HEX value (default if unspecified)
- // 2=OCT value
- static int32 i,i2;
- static uint64 result;
- result=0;
- static int32 type;
- type=0;
- hexoct2uint64_value=0;
- if (!h->len) return 1;
- if (h->chr[0]!=38) return 0;//not "&"
- if (h->len==1) return 1;//& received, but awaiting further input
- i=h->chr[1];
- if ((i==72)||(i==104)) type=1;//"H"or"h"
- if ((i==79)||(i==111)) type=2;//"O"or"o"
- if (!type) return 0;
- if (h->len==2) return type;
-
- if (type==1){
- if (h->len>18) return 0;//larger than int64
- for (i=2;ilen;i++){
- result<<=4;
- i2=h->chr[i];
- // 0 - 9 A - F a - f
- if ( ((i2>=48)&&(i2<=57)) || ((i2>=65)&&(i2<=70)) || ((i2>=97)&&(i2<=102)) ){
- if (i2>=97) i2-=32;
- if (i2>=65) i2-=7;
- i2-=48;
- //i2 is now a values between 0 and 15
- result+=i2;
- }else return 0;//invalid character
- }//i
- hexoct2uint64_value=result;
- return 1;
- }//type==1
-
- if (type==2){
- //unsigned _int64 max=18446744073709551615 (decimal, 20 chars)
- // =1777777777777777777777 (octal, 22 chars)
- // =FFFFFFFFFFFFFFFF (hex, 16 chars)
- if (h->len>24) return 0;//larger than int64
- if (h->len==24){
- if ((h->chr[2]!=48)&&(h->chr[2]!=49)) return 0;//larger than int64
- }
- for (i=2;ilen;i++){
- result<<=3;
- i2=h->chr[i];
- if ((i2>=48)&&(i2<=55)){//0-7
- i2-=48;
- result+=i2;
- }else return 0;//invalid character
- }//i
- hexoct2uint64_value=result;
- return 2;
- }//type==2
-
+int32 hexoct2uint64(qbs *h) {
+ // returns 0 = failed
+ // 1 = HEX value (default if unspecified)
+ // 2 = OCT value
+ // 3 = BIN value
+ static int32 i, i2;
+ static uint64 result;
+ result = 0;
+ static int32 type;
+ type = 0;
+ hexoct2uint64_value = 0;
+ if (!h->len) return 1;
+ if (h->chr[0] != 38) return 0; // not "&"
+ if (h->len == 1) return 1; // "&" received, but awaiting further input
+ i = h->chr[1];
+ if ((i == 72) || (i == 104)) type = 1; // "H" or "h"
+ if ((i == 79) || (i == 111)) type = 2; // "O" or "o"
+ if ((i == 66) || (i == 98)) type = 3; // "B" or "b"
+ if (!type) return 0;
+ if (h->len == 2) return type;
+
+ // unsigned _int64 max = 18446744073709551615 (decimal, 20 chars)
+ // = 1111111 etc., max. 64x (binary, 64 chars)
+ // = 1777777777777777777777 (octal, 22 chars)
+ // = FFFFFFFFFFFFFFFF (hex, 16 chars)
+
+ if (type == 1) {
+ if (h->len > 18) return 0; // larger than int64
+ for (i = 2; i < h->len; i++) {
+ result <<= 4;
+ i2 = h->chr[i];
+ // 0 - 9 / A - F / a - f
+ if (((i2 >= 48) && (i2 <= 57)) || ((i2 >= 65) && (i2 <= 70)) || ((i2 >= 97) && (i2 <= 102))) {
+ if (i2 >= 97) i2 -= 32;
+ if (i2 >= 65) i2 -= 7;
+ i2 -= 48;
+ // i2 is now a values between 0 and 15
+ result += i2;
+ } else
+ return 0; // invalid character
+ } // i
+ hexoct2uint64_value = result;
+ return 1;
+ } // type == 1
+
+ if (type == 2) {
+ if (h->len > 24) return 0; // larger than int64
+ if (h->len == 24) {
+ if ((h->chr[2] != 48) && (h->chr[2] != 49))
+ return 0; // larger than int64
+ }
+ for (i = 2; i < h->len; i++) {
+ result <<= 3;
+ i2 = h->chr[i];
+ if ((i2 >= 48) && (i2 <= 55)) { // 0-7
+ i2 -= 48;
+ result += i2;
+ } else
+ return 0; // invalid character
+ } // i
+ hexoct2uint64_value = result;
+ return 2;
+ } // type == 2
+
+ if (type == 3) {
+ if (h->len > 66) return 0; // larger than int64
+ for (i = 2; i < h->len; i++) {
+ result <<= 1;
+ i2 = h->chr[i];
+ if ((i2 >= 48) && (i2 <= 49)) { // 0-1
+ i2 -= 48;
+ result += i2;
+ } else
+ return 0; // invalid character
+ } // i
+ hexoct2uint64_value = result;
+ return 3;
+ } // type == 3
}
-extern void SUB_VKUPDATE();
-
//input method (complex, calls other qbs functions)
const char *uint64_max[] = {"18446744073709551615"};
const char *int64_max[] = {"9223372036854775807"};
@@ -11711,7 +11781,7 @@ void qbs_input(int32 numvariables,uint8 newline){
max<<=i4;
max--;
- //check for hex/oct
+ //check for hex/oct/bin
if (i3=hexoct2uint64(qbs_input_arguements[argn])){
hexvalue=hexoct2uint64_value;
if (hexvalue>max){valid=0; goto typechecked;}
@@ -11736,7 +11806,18 @@ void qbs_input(int32 numvariables,uint8 newline){
value>>=3;
}
if (l>(2+i)){valid=0; goto typechecked;}
- if (l==1) completewith=111;//"O"
+ if (l==1) completewith=79;//"O"
+ if (l==2) completewith=48;//"0"
+ }
+ if (i3==3){
+ value=max;
+ i=0;
+ for (i2=1;i2<=64;i2++){
+ if (value&0x1) i=i2;
+ value>>=1;
+ }
+ if (l>(2+i)){valid=0; goto typechecked;}
+ if (l==1) completewith=66;//"B"
if (l==2) completewith=48;//"0"
}
finalvalue=hexvalue;
@@ -11808,13 +11889,14 @@ void qbs_input(int32 numvariables,uint8 newline){
if ((qbs_input_variabletypes[argn]&511)==64){
if (l==0){completewith=48; *(int64*)qbs_input_variableoffsets[argn]=0; goto typechecked;}
- //check for hex/oct
+ //check for hex/oct/bin
if (i3=hexoct2uint64(qbs_input_arguements[argn])){
hexvalue=hexoct2uint64_value;
if (hexvalue>max){valid=0; goto typechecked;}
//set completewith value (if necessary)
if (i3==1) if (l==1) completewith=72;//"H"
- if (i3==2) if (l==1) completewith=111;//"O"
+ if (i3==2) if (l==1) completewith=79;//"O"
+ if (i3==3) if (l==1) completewith=66;//"B"
if (l==2) completewith=48;//"0"
*(uint64*)qbs_input_variableoffsets[argn]=hexvalue;
goto typechecked;
@@ -11898,12 +11980,13 @@ void qbs_input(int32 numvariables,uint8 newline){
//begin with a generic assessment, regardless of whether it is single, double or float
if (l==0){completewith=48; goto typechecked;}
- //check for hex/oct
+ //check for hex/oct/bin
if (i3=hexoct2uint64(qbs_input_arguements[argn])){
hexvalue=hexoct2uint64_value;
//set completewith value (if necessary)
if (i3==1) if (l==1) completewith=72;//"H"
- if (i3==2) if (l==1) completewith=111;//"O"
+ if (i3==2) if (l==1) completewith=79;//"O"
+ if (i3==3) if (l==1) completewith=66;//"B"
if (l==2) completewith=48;//"0"
//nb. because VC6 didn't support...
//error C2520: conversion from uint64 to double not implemented, use signed int64
@@ -12235,10 +12318,6 @@ void qbs_input(int32 numvariables,uint8 newline){
Sleep(10);
qbs_set(key,qbs_inkey());
- disableEvents=1;//we don't want the ON TIMER bound version of VKUPDATE to fire during a call to itself!
- SUB_VKUPDATE();
- disableEvents=0;
-
}
qbs_cleanup(qbs_tmp_base,0);
@@ -12337,8 +12416,6 @@ void qbs_input(int32 numvariables,uint8 newline){
goto qbs_input_next;
}
- if (inpstr2->len>=255) goto qbs_input_next;
-
//affect inpstr2 with key
qbs_set(inpstr2,qbs_add(inpstr2,key));
@@ -12594,11 +12671,21 @@ int32 func__blink(){
}
int64 func__handle(){
- #ifdef QB64_GUI
- #ifdef QB64_WINDOWS
- while (!window_handle){Sleep(100);}
+ #ifdef QB64_WINDOWS
+ #ifdef DEPENDENCY_CONSOLE_ONLY
+ if (!window_handle) {
+ char pszConsoleTitle[1024];
+ GetConsoleTitle(pszConsoleTitle,1024);
+ window_handle = FindWindow(NULL, pszConsoleTitle);
+ }
return (ptrszint)window_handle;
#endif
+
+ if (!screen_hide){
+ while (!window_exists){Sleep(100);}
+ while (!window_handle){Sleep(100);}
+ return (ptrszint)window_handle;
+ }
#endif
return 0;
@@ -12612,6 +12699,13 @@ qbs *func__title(){
}
}
+void set_foreground_window(ptrszint i) {
+ #ifdef QB64_WINDOWS
+ BOOL result = SetForegroundWindow((HWND) i);
+ #endif
+ return;
+}
+
int32 func__hasfocus() {
#ifdef QB64_GUI
#ifdef QB64_WINDOWS
@@ -12938,7 +13032,6 @@ void sub_open(qbs *name,int32 type,int32 access,int32 sharing,int32 i,int64 reco
if (sharing==2) g_restrictions=3;
if (sharing==3) g_restrictions=1;
if (sharing==4) g_restrictions=2;
- if (cloud_app) g_restrictions=0;//applying restrictions on server not possible
//note: In QB, opening a file already open for OUTPUT/APPEND created the 'file already open' error.
// However, from a new cmd window (or a SHELLed QB program) it can be opened!
@@ -12967,7 +13060,7 @@ void sub_open(qbs *name,int32 type,int32 access,int32 sharing,int32 i,int64 reco
if (type==1){//set record length
f->record_length=128;
if (passed) if (record_length!=-1) f->record_length=record_length;
- f->field_buffer=(uint8*)calloc(record_length,1);
+ f->field_buffer=(uint8*)calloc(f->record_length,1);
}
if (type==5){//seek eof
@@ -13054,7 +13147,11 @@ void sub_close(int32 i2,int32 passed){
for (i=1;i<=special_handles->indexes;i++){
- sub_close(-i-1,1);
+ if (vwatch>0 && vwatch==i) {
+ //keep connection to the IDE open for $DEBUG mode
+ } else {
+ sub_close(-i-1,1);
+ }
}
@@ -13238,8 +13335,9 @@ uint8 n_digit[256];
int64 n_exp;//if 0, there is one digit in front of the decimal place
uint8 n_neg;//if 1, the number is negative
uint8 n_hex;//if 1, the digits are in hexidecimal and n_exp should be ignored
-//if 2, the digits are in octal and n_exp should be ignored
-//(consider revising variable name n_hex)
+ //if 2, the digits are in octal and n_exp should be ignored
+ //if 3, the digits are in binary and n_exp should be ignored
+ //(consider revising variable name n_hex)
int32 n_roundincrement(){
static int32 i,i2,i3;
@@ -13290,6 +13388,17 @@ int32 n_float(){
n_float_value=value;
return 1;
}
+ //bin?
+ if (n_hex==3){
+ if (n_digits>64) return 0;
+ for (i=0;i308)return 0;//overflow
@@ -13360,7 +13469,6 @@ int32 n_int64(){
return 1;
}
//oct
-
if (n_hex==2){
if (n_digits>=22){
@@ -13374,6 +13482,17 @@ int32 n_int64(){
n_int64_value=value;
return 1;
}
+ //bin
+ if (n_hex==3){
+ if (n_digits>64) return 0;
+ for (i=0;i18)return 0;//overflow
@@ -13454,6 +13573,17 @@ int32 n_uint64(){
n_uint64_value=uvalue;
return 1;
}
+ //bin
+ if (n_hex==3){
+ if (n_digits>64) return 0;
+ for (i=0;i=data_size) goto gotnumber;
- c=data[*data_offset];
- if (c==44){(*data_offset)++; goto gotnumber;}
- if ((c==72)||(c==104)){//"H"or"h"
- nexthexchr:
- (*data_offset)++; if (*data_offset>=data_size) goto gotnumber;
- c=data[*data_offset];
- if (c==44){(*data_offset)++; goto gotnumber;}
- if ( ((c>=48)&&(c<=57)) || ((c>=65)&&(c<=70)) || ((c>=97)&&(c<=102)) ){//0-9 or A-F or a-f
- if (n_digits==256) return 1;//Overflow
- n_digit[n_digits]=c;
- n_digits++;
- n_hex=1;
- goto nexthexchr;
- }
- return 3;//Syntax error
+ // hex/oct/bin
+ if (c == 38) { // "&"
+ (*data_offset)++;
+ if (*data_offset >= data_size) return 3; // Syntax error (missing H/O/B after &)
+ c = data[*data_offset];
+ if (c == 44) {
+ (*data_offset)++;
+ return 3; // Syntax error (missing H/O/B after &)
+ }
+ if ((c == 72) || (c == 104)) { // "H" or "h"
+ nexthexchr:
+ (*data_offset)++;
+ if (*data_offset >= data_size) goto gotnumber;
+ c = data[*data_offset];
+ if (c == 44) {
+ (*data_offset)++;
+ goto gotnumber;
}
- if ((c==79)||(c==111)){//"O"or"o"
- nexthexchr2:
- (*data_offset)++; if (*data_offset>=data_size) goto gotnumber;
- c=data[*data_offset];
- if (c==44){(*data_offset)++; goto gotnumber;}
- if ((c>=48)&&(c<=55)){//0-7
- if (n_digits==256) return 1;//Overflow
- n_digit[n_digits]=c;
- n_digits++;
- n_hex=2;
- goto nexthexchr2;
- }
- return 3;//Syntax error
+ if (((c >= 48) && (c <= 57)) || ((c >= 65) && (c <= 70)) ||
+ ((c >= 97) && (c <= 102))) { // 0-9 or A-F or a-f
+ if (step == 5) return 3; // Syntax error (digits after type suffix)
+ if (n_digits == 256) return 1; // Overflow
+ n_digit[n_digits] = c;
+ n_digits++;
+ n_hex = 1;
+ goto nexthexchr;
}
- return 3;//Syntax error
- }//&
+ if ((c == 33) || (c == 35) || (c == 36) ||
+ (c == 37) || (c == 38) || (c == 96) || (c == 126)) { // type suffix
+ if (step <= 5) {step = 5; goto nexthexchr;}
+ }
+ return 3; // Syntax error (invalid HEX char)
+ }
+ if ((c == 79) || (c == 111)) { // "O" or "o"
+ nexthexchr2:
+ (*data_offset)++;
+ if (*data_offset >= data_size) goto gotnumber;
+ c = data[*data_offset];
+ if (c == 44) {
+ (*data_offset)++;
+ goto gotnumber;
+ }
+ if ((c >= 48) && (c <= 55)) { // 0-7
+ if (step == 5) return 3; // Syntax error (digits after type suffix)
+ if (n_digits == 256) return 1; // Overflow
+ n_digit[n_digits] = c;
+ n_digits++;
+ n_hex = 2;
+ goto nexthexchr2;
+ }
+ if ((c == 33) || (c == 35) || (c == 36) ||
+ (c == 37) || (c == 38) || (c == 96) || (c == 126)) { // type suffix
+ if (step <= 5) {step = 5; goto nexthexchr2;}
+ }
+ return 3; // Syntax error (invalid OCT char)
+ }
+ if ((c == 66) || (c == 98)) { // "B" or "b"
+ nexthexchr3:
+ (*data_offset)++;
+ if (*data_offset >= data_size) goto gotnumber;
+ c = data[*data_offset];
+ if (c == 44) {
+ (*data_offset)++;
+ goto gotnumber;
+ }
+ if ((c >= 48) && (c <= 49)) { // 0-1
+ if (step == 5) return 3; // Syntax error (digits after type suffix)
+ if (n_digits == 256) return 1; // Overflow
+ n_digit[n_digits] = c;
+ n_digits++;
+ n_hex = 3;
+ goto nexthexchr3;
+ }
+ if ((c == 33) || (c == 35) || (c == 36) ||
+ (c == 37) || (c == 38) || (c == 96) || (c == 126)) { // type suffix
+ if (step <= 5) {step = 5; goto nexthexchr3;}
+ }
+ return 3; // Syntax error (invalid BIN char)
+ }
+ return 3; // Syntax error (missing H/O/B after &)
+ } // "&"
readnextchr:
if (c==44){(*data_offset)++; goto gotnumber;}
if (c==45){//-
- if (step==0){n_neg=1; step=1; goto nextchr;}
- if (step==3){negate_exponent=1; step=4; goto nextchr;}
- return 3;//Syntax error
+ if (step==0){n_neg=1; step=1; goto nextchr;}//sign before integer part
+ if (step==3){negate_exponent=1; step=4; goto nextchr;}//exponent sign
+ return 3;//Syntax error (no - allowed in fraction part of number or after type suffix)
}
if (c==43){//+
- if (step==0){step=1; goto nextchr;}
- if (step==3){step=4; goto nextchr;}
- return 3;//Syntax error
+ if (step==0){step=1; goto nextchr;}//sign before integer part
+ if (step==3){step=4; goto nextchr;}//exponent sign
+ return 3;//Syntax error (no + allowed in fraction part of number or after type suffix)
}
if ((c>=48)&&(c<=57)){//0-9
+ if (step == 5) return 3; // Syntax error (digit after type suffix)
if (step<=1){//before decimal point
step=1;
@@ -13608,17 +13785,21 @@ int32 n_inputnumberfromdata(uint8 *data,ptrszint *data_offset,ptrszint data_size
}
if (c==46){//.
- if (step>1) return 3;//Syntax error
+ if (step>1) return 3;//Syntax error (multiple . or after type suffix)
if (n_digits==0) n_exp=-1;
step=2; goto nextchr;
}
if ((c==68)||(c==69)||(c==100)||(c==101)){//D,E,d,e
- if (step>2) return 3;//Syntax error
+ if (step>2) return 3;//Syntax error (multiple exponents or after type suffix)
step=3; goto nextchr;
}
- return 3;//Syntax error
+ if ((c == 33) || (c == 35) || (c == 36) ||
+ (c == 37) || (c == 38) || (c == 96) || (c == 126)) { // type suffix
+ if (step <= 5) {step = 5; goto nextchr;}
+ }
+ return 3;//Syntax error (invalid number char)
nextchr:
(*data_offset)++; if (*data_offset>=data_size) goto gotnumber;
c=data[*data_offset];
@@ -13698,36 +13879,53 @@ int32 n_inputnumberfromfile(int32 fileno){
if (c==-1){return_value=2; goto error;}//input past end of file
}while(c==32);
- //hex/oct
- if (c==38){//&
- c=file_input_chr(fileno); if (c==-2) return 3;
- if (c==-1) goto gotnumber;
- if ((c==72)||(c==104)){//"H"or"h"
- nexthexchr:
- c=file_input_chr(fileno); if (c==-2) return 3;
- if ( ((c>=48)&&(c<=57)) || ((c>=65)&&(c<=70)) || ((c>=97)&&(c<=102)) ){//0-9 or A-F or a-f
- if (n_digits==256) goto error;//overflow
- n_digit[n_digits]=c;
- n_digits++;
- n_hex=1;
- goto nexthexchr;
- }
- goto gotnumber;
- }
- if ((c==79)||(c==111)){//"O"or"o"
- nexthexchr2:
- c=file_input_chr(fileno); if (c==-2) return 3;
- if ((c>=48)&&(c<=55)){//0-7
- if (n_digits==256) goto error;//overflow
- n_digit[n_digits]=c;
- n_digits++;
- n_hex=2;
- goto nexthexchr2;
- }
- goto gotnumber;
+ // hex/oct/bin
+ if (c == 38) { // "&"
+ c = file_input_chr(fileno);
+ if (c == -2) return 3;
+ if (c == -1) goto gotnumber;
+ if ((c == 72) || (c == 104)) { // "H" or "h"
+ nexthexchr:
+ c = file_input_chr(fileno);
+ if (c == -2) return 3;
+ if (((c >= 48) && (c <= 57)) || ((c >= 65) && (c <= 70)) ||
+ ((c >= 97) && (c <= 102))) { // 0-9 or A-F or a-f
+ if (n_digits == 256) goto error; // overflow
+ n_digit[n_digits] = c;
+ n_digits++;
+ n_hex = 1;
+ goto nexthexchr;
}
goto gotnumber;
- }//&
+ }
+ if ((c == 79) || (c == 111)) { // "O" or "o"
+ nexthexchr2:
+ c = file_input_chr(fileno);
+ if (c == -2) return 3;
+ if ((c >= 48) && (c <= 55)) { // 0-7
+ if (n_digits == 256) goto error; // overflow
+ n_digit[n_digits] = c;
+ n_digits++;
+ n_hex = 2;
+ goto nexthexchr2;
+ }
+ goto gotnumber;
+ }
+ if ((c == 66) || (c == 98)) { // "B" or "b"
+ nexthexchr3:
+ c = file_input_chr(fileno);
+ if (c == -2) return 3;
+ if ((c >= 48) && (c <= 49)) { // 0-1
+ if (n_digits == 256) goto error; // overflow
+ n_digit[n_digits] = c;
+ n_digits++;
+ n_hex = 3;
+ goto nexthexchr3;
+ }
+ goto gotnumber;
+ }
+ goto gotnumber;
+ } // "&"
readnextchr:
if (c==-1) goto gotnumber;
@@ -14013,7 +14211,7 @@ long double func_read_float(uint8 *data,ptrszint *data_offset,ptrszint data_size
}
if ((value>maxval)||(valuemaxval)||(valueconsole){
+ CONSOLE_SCREEN_BUFFER_INFO cl_bufinfo;
+ SECURITY_ATTRIBUTES SecAttribs = {sizeof(SECURITY_ATTRIBUTES), 0, 1};
+ HANDLE cl_conout = CreateFileA("CONOUT$", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, & SecAttribs, OPEN_EXISTING, 0, 0);
+ GetConsoleScreenBufferInfo(cl_conout, & cl_bufinfo);
+ return cl_bufinfo.dwCursorPosition.Y + 1;
+ }
+ #endif
if (write_page->holding_cursor){
if (write_page->cursor_y>=write_page->bottom_row) return write_page->bottom_row; else return write_page->cursor_y+1;
}
return write_page->cursor_y;
}
int32 func_pos(int32 ignore){
+ #ifdef QB64_WINDOWS
+ if (write_page->console){ //qb64 console CSRLIN
+ CONSOLE_SCREEN_BUFFER_INFO cl_bufinfo;
+ SECURITY_ATTRIBUTES SecAttribs = {sizeof(SECURITY_ATTRIBUTES), 0, 1};
+ HANDLE cl_conout = CreateFileA("CONOUT$", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, & SecAttribs, OPEN_EXISTING, 0, 0);
+ GetConsoleScreenBufferInfo(cl_conout, & cl_bufinfo);
+ return cl_bufinfo.dwCursorPosition.X + 1;
+ }
+ #endif
if (write_page->holding_cursor) return 1;
return write_page->cursor_x;
}
@@ -15239,10 +15455,51 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
void sub_sleep(int32 seconds,int32 passed){
if (new_error) return;
+
sleep_break=0;
double prev,ms,now,elapsed;//cannot be static
- if (passed) prev=GetTicks();
+ prev=GetTicks();
ms=1000.0*(double)seconds;
+
+ #ifdef QB64_WINDOWS
+
+ if (read_page->console){
+ int32 junk=0,junk2=0;
+ DWORD dwRet;
+ HANDLE hStdin = GetStdHandle (STD_INPUT_HANDLE);
+ FlushConsoleInputBuffer(hStdin);
+ if (passed){
+ do{
+ now=GetTicks();
+ if (now0);//as long as our timer hasn't expired, we continue to run the loop and countdown the time remaining
+ return; //if we get here, something odd happened. We should expire automatically with the WAIT_TIMEOUT event before this occurs.
+ }
+ do{ //ignore all console input unless it's a keydown event
+ junk=func__getconsoleinput();
+ }while(junk!=1); //only when junk = 1 do we have a keyboard event
+ Sleep(100); //Give the user time to remove their finger from the key, before clearing the buffer.
+ FlushConsoleInputBuffer(hStdin); //and flush the keyboard buffer after, so we don't leave stray events to be processed.
+ return;
+ }
+ #endif
+
+
recalculate:
wait:
evnt(0);//handle general events
@@ -15273,6 +15530,79 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
return;
}
+ qbs *func__bin(int64 value,int32 neg_bits){
+
+ static int32 i,i2,i3,neg;
+ static int64 value2;
+ static qbs *str;
+
+ str=qbs_new(64,1);
+
+ //negative?
+ if ((value>>63)&1) neg=1; else neg=0;
+
+ //calc. most significant bit
+ i2=0;
+ value2=value;
+ if (neg){
+ for (i=1;i<=64;i++){
+ if (!(value2&1)) i2=i;
+ value2>>=1;
+ }
+ if (i2>=neg_bits){
+ //doesn't fit in neg_bits, so expand to next 16/32/64 boundary
+ i3=64;
+ if (i2<32) i3=32;
+ if (i2<16) i3=16;
+ i2=i3;
+ }else i2=neg_bits;
+ }else{
+ for (i=1;i<=64;i++){
+ if (value2&1) i2=i;
+ value2>>=1;
+ }
+ }
+
+ if (!i2){str->chr[0]=48; str->len=1; return str;}//"0"
+
+ //calc. number of characters required in i3
+ i3=i2; // equal for BIN$ because one bit = one char
+
+ //build string
+ str->len=i3; i3--;
+ for (i=1;i<=i2;i++){
+ str->chr[i3--]=(value&1)+48;
+ value>>=1;
+ }
+
+ return str;
+
+ }
+
+ //note: QBASIC doesn't have a BIN$ function
+ // QB64 uses 32 bin digits for SINGLE/DOUBLE/FLOAT but if this range is exceeded
+ // it uses up to 64 bin digits before generating an "OVERFLOW" error
+ //performs overflow check before calling func__bin
+ qbs *func__bin_float(long double value){
+ static qbs *str;
+ static int64 ivalue;
+ static int64 uivalue;
+ //ref: uint64 0-18446744073709551615
+ // int64 \969223372036854775808 to 9223372036854775807
+ if ((value>=9.223372036854776E18)||(value<=-9.223372036854776E18)){
+ //note: ideally, the following line would be used, however, qbr_longdouble_to_uint64 just does the same as qbr
+ //if ((value>=1.844674407370956E19)||(value<=-9.223372036854776E18)){
+ str=qbs_new(0,1); error(6);//Overflow
+ return str;
+ }
+ if (value>=0){
+ uivalue=qbr_longdouble_to_uint64(value);
+ ivalue=uivalue;
+ }else{
+ ivalue=qbr(value);
+ }
+ return func__bin(ivalue,32);
+ }
qbs *func_oct(int64 value,int32 neg_bits){
@@ -15328,10 +15658,10 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
}
- //note: QBASIC uses 8 characters for SINGLE/DOUBLE or generates "OVERFLOW" if this range is exceeded
- // QB64 uses 8 characters for SINGLE/DOUBLE/FLOAT but if this range is exceeded
- // it uses up to 16 characters before generating an "OVERFLOW" error
- //performs overflow check before calling func_hex
+ //note: QBASIC uses 11 oct digits for SINGLE/DOUBLE or generates "OVERFLOW" if this range is exceeded
+ // QB64 uses 11 oct digits for SINGLE/DOUBLE/FLOAT but if this range is exceeded
+ // it uses up to 22 oct digits before generating an "OVERFLOW" error
+ //performs overflow check before calling func_oct
qbs *func_oct_float(long double value){
static qbs *str;
static int64 ivalue;
@@ -15400,9 +15730,9 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
}
- //note: QBASIC uses 8 characters for SINGLE/DOUBLE or generates "OVERFLOW" if this range is exceeded
- // QB64 uses 8 characters for SINGLE/DOUBLE/FLOAT but if this range is exceeded
- // it uses up to 16 characters before generating an "OVERFLOW" error
+ //note: QBASIC uses 8 hex digits for SINGLE/DOUBLE or generates "OVERFLOW" if this range is exceeded
+ // QB64 uses 8 hex digits for SINGLE/DOUBLE/FLOAT but if this range is exceeded
+ // it uses up to 16 hex digits before generating an "OVERFLOW" error
//performs overflow check before calling func_hex
qbs *func_hex_float(long double value){
static qbs *str;
@@ -15566,8 +15896,11 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
//returns a string to advance to the horizontal position "pos" on either
//the current line or the next line.
static int32 w,div,cursor;
+
+ static int32 cr_size; // a local in case file is SCRN
+ cr_size = tab_spc_cr_size; // init to caller's value
//calculate width in spaces & current position
- if (tab_spc_cr_size==2){
+ if (cr_size==2){
//print to file
div=1;
w=2147483647;
@@ -15578,9 +15911,14 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
if (i<0) goto invalid_file;//TCP/IP unsupported
if (gfs_fileno_valid(i)!=1) goto invalid_file;//Bad file name or number
i=gfs_fileno[i];//convert fileno to gfs index
+ if (gfs_file[i].scrn == 1) { // going to screen, change the cr size
+ cr_size = 1;
+ } else {
cursor=gfs_file[i].column;
+ }
invalid_file:;
- }else{
+ }
+ if (cr_size == 1) {
//print to surface
if (write_page->text){
w=write_page->width;
@@ -15602,7 +15940,7 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
if ((pos<-32768)||(pos>32767)){
if (tab_LPRINT) sub__dest(tab_LPRINT_olddest);
tqbs=qbs_new(0,1);
- error(7); return tqbs;//Overflow
+ error(6); return tqbs;//Overflow
}
if (pos>w) pos%=w;
if (pos<1) pos=1;
@@ -15610,7 +15948,7 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
size=0; spaces=0; cr=0;
if (cursor>pos){
cr=1;
- size=tab_spc_cr_size;
+ size=cr_size;
spaces=pos/div; if (pos%div) spaces++;
spaces--;//don't put a space on the dest position
size+=spaces;
@@ -15621,8 +15959,8 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
//build custom string
tqbs=qbs_new(size,1);
if (cr){
- tqbs->chr[0]=13; if (tab_spc_cr_size==2) tqbs->chr[1]=10;
- memset(&tqbs->chr[tab_spc_cr_size],32,spaces);
+ tqbs->chr[0]=13; if (cr_size==2) tqbs->chr[1]=10;
+ memset(&tqbs->chr[cr_size],32,spaces);
}else{
memset(tqbs->chr,32,spaces);
}
@@ -15634,7 +15972,7 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
if (new_error) return qbs_new(0,1);
static qbs *tqbs;
- if ((spaces<-32768)||(spaces>32767)){tqbs=qbs_new(0,1); error(7); return tqbs;}//Overflow
+ if ((spaces<-32768)||(spaces>32767)){tqbs=qbs_new(0,1); error(6); return tqbs;}//Overflow
if (spaces<0) spaces=0;
//for files, spc simply adds that many spaces
@@ -15724,6 +16062,23 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
uint8 *cp;
if (!passed) returncol=0;
+
+ #ifdef QB64_WINDOWS
+ if (read_page->console){
+ SECURITY_ATTRIBUTES SecAttribs = {sizeof(SECURITY_ATTRIBUTES), 0, 1};
+ HANDLE cl_conout = CreateFileA("CONOUT$", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, & SecAttribs, OPEN_EXISTING, 0, 0);
+ COORD cp1 = {x-1, y-1};
+ DWORD t;
+ uint16 a;
+ if (returncol){
+ int x1 = ReadConsoleOutputAttribute(cl_conout, &a, 1, cp1, &t) ;
+ return a;
+ } else {
+ ReadConsoleOutputCharacterA(cl_conout, (char *) &a, 1, cp1, &t) ;
+ return a & 0xff;
+ }
+ }
+ #endif
if (read_page->text){
//on screen?
@@ -15970,19 +16325,13 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
}
if (gfs->type==1){//RANDOM
- return gfs_getpos(i)/gfs->record_length+1;
+ return gfs_getpos(i)/gfs->record_length;
}
if (gfs->type==2){//BINARY
return gfs_getpos(i);
}
//APPEND/OUTPUT/INPUT
- int64 pos;
- pos=gfs_getpos(i);
- if (!pos) return 1;
- pos--;
- pos/=128;
- pos++;
- return pos;
+ return gfs_getpos(i)/128;
}
qbs *func_input(int32 n,int32 i,int32 passed){
@@ -16204,7 +16553,13 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
#include "parts/audio/decode/src.c"
#endif
-
+ #ifdef DEPENDENCY_ZLIB
+ #ifdef QB64_BACKSLASH_FILESYSTEM
+ #include "parts\\zlib\\src.c"
+ #else
+ #include "parts/zlib/src.c"
+ #endif
+ #endif
@@ -16219,7 +16574,7 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
qbs *func_command(int32 index, int32 passed){
static qbs *tqbs;
if (passed) { //Get specific parameter
- //If out of bounds or error getting cmdline args (on Android, perhaps), return empty string.
+ //If out of bounds or error getting cmdline args, return empty string.
if (index >= func_command_count || index < 0 || func_command_array==NULL) {tqbs = qbs_new(0, 1); return tqbs;}
int len = strlen(func_command_array[index]);
//Create new temp qbs and copy data into it.
@@ -16334,7 +16689,6 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
int64 func_shell(qbs *str){
if (new_error) return 1;
- if (cloud_app){error(262); return 1;}
int64 return_code;
@@ -16609,7 +16963,6 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
int64 func__shellhide(qbs *str){ //func _SHELLHIDE(...
if (new_error) return 1;
- if (cloud_app){error(262); return 1;}
static int64 return_code;
return_code=0;
@@ -16836,7 +17189,6 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
void sub_shell(qbs *str,int32 passed){
if (new_error) return;
- if (cloud_app){error(262); return;}
//exit full screen mode if necessary
static int32 full_screen_mode;
@@ -17114,7 +17466,6 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
void sub_shell2(qbs *str,int32 passed){ //HIDE
if (new_error) return;
- if (cloud_app){error(262); return;}
if (passed&1){sub_shell4(str,passed&2); return;}
if (!(passed&2)){error(5); return;}//should not hide a shell waiting for input
@@ -17316,7 +17667,6 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
void sub_shell3(qbs *str,int32 passed){//_DONTWAIT
//shell3 launches 'str' but does not wait for it to complete
if (new_error) return;
- if (cloud_app){error(262); return;}
if (passed&1){sub_shell4(str,passed&2); return;}
@@ -17509,7 +17859,6 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
void sub_shell4(qbs *str,int32 passed){//_DONTWAIT & _HIDE
//if passed&2 set a string was given
if (!(passed&2)){error(5); return;}//should not hide a shell waiting for input
- if (cloud_app){error(262); return;}
static qbs *strz=NULL;
static int32 i;
@@ -17771,25 +18120,11 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
static int32 tmp_long;
static int32 got_ports=0;
- if (cloud_app){
- cloud_chdir_complete=1;
-
- if (!got_ports){
- got_ports=1;
- static FILE* file = fopen ("..\\ports.txt\0", "r");
- fscanf (file, "%d", &tmp_long);
- cloud_port[1]=tmp_long;
- fscanf (file, "%d", &tmp_long);
- cloud_port[2]=tmp_long;
- fclose (file);
- }
- }
}
void sub_mkdir(qbs *str){
if (new_error) return;
- if (cloud_app){error(262); return;}
static qbs *strz=NULL;
if (!strz) strz=qbs_new(0,0);
qbs_set(strz,qbs_add(str,qbs_new_txt_len("\0",1)));
@@ -17833,9 +18168,7 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
if (!screen_hide){
while (!window_exists){Sleep(100);}
#ifdef QB64_GLUT
- #ifndef QB64_ANDROID
- glutSetCursor(GLUT_CURSOR_NONE);
- #endif
+ glutSetCursor(GLUT_CURSOR_NONE);
#endif
}
#endif
@@ -17863,6 +18196,9 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
if (qbs_equal(str,qbs_new_txt("HORIZONTAL"))) {mouse_cursor_style=GLUT_CURSOR_LEFT_RIGHT; goto cursor_valid;}
if (qbs_equal(str,qbs_new_txt("TOPLEFT_BOTTOMRIGHT"))) {mouse_cursor_style=GLUT_CURSOR_TOP_LEFT_CORNER; goto cursor_valid;}
if (qbs_equal(str,qbs_new_txt ("TOPRIGHT_BOTTOMLEFT"))) {mouse_cursor_style=GLUT_CURSOR_TOP_RIGHT_CORNER; goto cursor_valid;}
+ if (qbs_equal(str,qbs_new_txt ("WAIT"))) {mouse_cursor_style=GLUT_CURSOR_WAIT; goto cursor_valid;}
+ if (qbs_equal(str,qbs_new_txt ("HELP"))) {mouse_cursor_style=GLUT_CURSOR_HELP; goto cursor_valid;}
+ if(qbs_equal(str,qbs_new_txt("CYCLE"))||qbs_equal(str, qbs_new_txt("MOVE"))) {mouse_cursor_style=GLUT_CURSOR_CYCLE; goto cursor_valid;}
error(5); return;
}
cursor_valid:
@@ -17935,21 +18271,17 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
static float f;
int32 handle;
+
+ #ifdef QB64_WINDOWS
+ if (read_page->console){return consolemousex;}
+ #endif
+
handle=mouse_message_queue_default;
if (passed) handle=context;
mouse_message_queue_struct *queue=(mouse_message_queue_struct*)list_get(mouse_message_queue_handles,handle);
if (queue==NULL){error(258); return 0;}
x=queue->queue[queue->current].x;
- /*
- if (cloud_app){
- x2=display_page->width; if (display_page->text) x2*=fontwidth[display_page->font];
- x_limit=x2-1;
- x_scale=1;
- x_offset=0;
- }
- */
-
//calculate pixel offset of mouse within SCREEN using environment variables
x-=environment_2d__screen_x1;
x=qbr_float_to_long((((float)x+0.5f)/environment_2d__screen_x_scale)-0.5f);
@@ -17979,21 +18311,17 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
static float f;
int32 handle;
+
+ #ifdef QB64_WINDOWS
+ if (read_page->console){return consolemousey;}
+ #endif
+
handle=mouse_message_queue_default;
if (passed) handle=context;
mouse_message_queue_struct *queue=(mouse_message_queue_struct*)list_get(mouse_message_queue_handles,handle);
if (queue==NULL){error(258); return 0;}
y=queue->queue[queue->current].y;
- /*
- if (cloud_app){
- y2=display_page->height; if (display_page->text) y2*=fontheight[display_page->font];
- y_limit=y2-1;
- y_scale=1;
- y_offset=0;
- }
- */
-
//calculate pixel offset of mouse within SCREEN using environment variables
y-=environment_2d__screen_y1;
y=qbr_float_to_long((((float)y+0.5f)/environment_2d__screen_y_scale)-0.5f);
@@ -18096,6 +18424,17 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
int32 func__mousebutton(int32 i, int32 context, int32 passed){
if (i<1){error(5); return 0;}
+ #ifdef QB64_WINDOWS
+ if (read_page->console){ //console may support up to 5 mouse buttons according to the documentation.
+ if (i==1)return consolebutton&1;
+ if (i==2)return consolebutton&2;
+ if (i==3)return consolebutton&4;
+ if (i==4)return consolebutton&8;
+ if (i==5)return consolebutton&16;
+ return 0;
+ }
+ #endif
+
if (i>3) return 0;//current SDL only supports 3 mouse buttons!
//swap indexes 2&3
if (i==2){
@@ -18115,6 +18454,16 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
int32 func__mousewheel(int32 context, int32 passed){
static uint32 x;
int32 handle;
+
+
+ #ifdef QB64_WINDOWS
+ if (read_page->console){
+ if (consolebutton<-0x100)return -1;
+ if (consolebutton>0x100)return 1;
+ return 0;
+ }
+ #endif
+
handle=mouse_message_queue_default;
if (passed) handle=context;
mouse_message_queue_struct *queue=(mouse_message_queue_struct*)list_get(mouse_message_queue_handles,handle);
@@ -18218,6 +18567,24 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
//Creating/destroying an image surface:
int32 func__newimage(int32 x,int32 y,int32 bpp,int32 passed){
+ #ifdef QB64_WINDOWS
+ #if WINVER >= 0x0600 //this block is not compatible with XP
+ static bool j;
+ if(j != 1){
+ FARPROC dpiaware;
+ HMODULE user32 = LoadLibrary(TEXT("user32.dll"));
+ if(user32 != NULL){
+ dpiaware = GetProcAddress(user32, "SetProcessDPIAware");
+ if(NULL != dpiaware){
+ (dpiaware) ();
+ j = 1;
+ FreeLibrary(user32);
+ }
+ FreeLibrary(user32);
+ }
+ }
+ #endif
+ #endif
static int32 i;
if (new_error) return 0;
if (x<=0||y<=0){error(5); return 0;}
@@ -18289,7 +18656,10 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
i2=newimg();
d=&img[i2];
memcpy(d,s,sizeof(img_struct));
- img[i2].lock_id=NULL; img[i2].lock_offset=NULL; // force _MEMIMGAGE to get a new lock for the copy
+ //don't duplicate the memory lock (if any),
+ //_MEMIMAGE needs to obtain a new lock for the copy
+ img[i2].lock_id=NULL;
+ img[i2].lock_offset=NULL;
//duplicate pixel data
bytes=d->width*d->height*d->bytes_per_pixel;
d->offset=(uint8*)malloc(bytes);
@@ -18359,7 +18729,7 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
static int32 i;
//note: handles 0 & -1(1) are reserved
for (i=2;iconsole && !passed)||i==console_image){
+ SECURITY_ATTRIBUTES SecAttribs = {sizeof(SECURITY_ATTRIBUTES), 0, 1};
+ HANDLE cl_conout = CreateFileA("CONOUT$", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, & SecAttribs, OPEN_EXISTING, 0, 0);
+ CONSOLE_SCREEN_BUFFER_INFO cl_bufinfo;
+ GetConsoleScreenBufferInfo(cl_conout, &cl_bufinfo);
+ return cl_bufinfo.srWindow.Right - cl_bufinfo.srWindow.Left + 1;
+ }
+ #endif
+
if (passed){
if (i>=0){//validate i
validatepage(i); i=page[i];
@@ -18591,6 +18972,18 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
int32 func__height(int32 i,int32 passed){
if (new_error) return 0;
+
+ #ifdef QB64_WINDOWS
+ if ((read_page->console && !passed)||i==console_image){
+ SECURITY_ATTRIBUTES SecAttribs = {sizeof(SECURITY_ATTRIBUTES), 0, 1};
+ HANDLE cl_conout = CreateFileA("CONOUT$", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, & SecAttribs, OPEN_EXISTING, 0, 0);
+ CONSOLE_SCREEN_BUFFER_INFO cl_bufinfo;
+ GetConsoleScreenBufferInfo(cl_conout, &cl_bufinfo);
+ return cl_bufinfo.srWindow.Bottom - cl_bufinfo.srWindow.Top + 1;
+ return cl_bufinfo.dwMaximumWindowSize.Y;
+ }
+ #endif
+
if (passed){
if (i>=0){//validate i
validatepage(i); i=page[i];
@@ -19087,7 +19480,24 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
//validate size
if (size<1){error(5); return NULL;}
if (size>2048) return -1;
+
+
+ //load the file
+ if (!f->len) return -1;//return invalid handle if null length string
+ int32 fh,result;
+ int64 bytes;
+ fh=gfs_open(f,1,0,0);
+ #ifdef QB64_WINDOWS //rather than just immediately tossing an error, let's try looking in the default OS folder for the font first in case the user left off the filepath.
+ if (fh<0&&recall==0) {
+ recall=-1; //to set a flag so we don't get trapped endlessly recalling the routine when the font actually doesn't exist
+ i=func__loadfont(qbs_add(qbs_new_txt("C:/Windows/Fonts/"),f), size, requirements,passed); //Look in the default windows font location
+ return i;
+ }
+ #endif
+ recall=0;
+ if (fh<0) return -1; //If we still can't load the font, then we just can't load the font... Send an error code back.
+
//check requirements
memset(r,0,32);
if (passed){
@@ -19122,23 +19532,7 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
//8 dontblend (blending is the default in 32-bit alpha-enabled modes)
//16 monospace
//32 unicode
-
- //load the file
- if (!f->len) return -1;//return invalid handle if null length string
- int32 fh,result;
- int64 bytes;
- fh=gfs_open(f,1,0,0);
-
- #ifdef QB64_WINDOWS //rather than just immediately tossing an error, let's try looking in the default OS folder for the font first in case the user left off the filepath.
- if (fh<0&&recall==0) {
- recall=-1; //to set a flag so we don't get trapped endlessly recalling the routine when the font actually doesn't exist
- i=func__loadfont(qbs_add(qbs_new_txt("C:/Windows/Fonts/"),f), size, requirements,passed); //Look in the default windows font location
- return i;
- }
- #endif
- recall=0;
-
- if (fh<0) return -1;
+
bytes=gfs_lof(fh);
static uint8* content;
content=(uint8*)malloc(bytes); if (!content){gfs_close(fh); return -1;}
@@ -19597,40 +19991,7 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
sub_close(NULL,0);
exit_blocked=0;//allow exit via X-box or CTRL+BREAK
-
- if (cloud_app){
- //1. set the display page as the destination page
- sub__dest(func__display());
- //2. VIEW PRINT bottomline,bottomline
- static int32 y;
- if (write_page->text){
- y=write_page->height;
- }else{
- y=write_page->height/fontheight[write_page->font];
- }
- qbg_sub_view_print(y,y,1|2);
- //3. PRINT 'clears the line without having to worry about its contents/size
- qbs_print(nothingstring,1);
- //4. PRINT "Press any key to continue"
- qbs_print(qbs_new_txt("Program ended. Closing (10 seconds)..."),0);
- //6. Enable autodisplay
- autodisplay=1;
- int sec=7;
- while(sec--){
- evnt(1);
- Sleep(1000);
- qbs_print(qbs_new_txt("."),0);
- }
- sec=3;
- while(sec--){
- Sleep(1000);
- evnt(1);
- }
-
- close_program=1;
- end();
- exit(0);//<-- should never happen
- }
+
#ifdef DEPENDENCY_CONSOLE_ONLY
screen_hide=1;
@@ -19668,12 +20029,21 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
}else{
if (console){
- //screen is hidden, console is visible
- cout<<"\nPress enter to continue";
- static int32 ignore;
- ignore=fgetc(stdin);
+ //screen is hidden, console is visible
+ #ifdef QB64_WINDOWS
+ cout<<"\nPress any key to continue";
+ int32 junk;
+ FlushConsoleInputBuffer(GetStdHandle(STD_INPUT_HANDLE)); //clear any stray buffer events before we run END.
+ do{ //ignore all console input
+ junk=func__getconsoleinput();
+ }while(junk!=1); //until we have a key down event
+ #else
+ cout<<"\nPress enter to continue";
+ static int32 ignore;
+ ignore=fgetc(stdin);
+ #endif
+ }
}
- }
close_program=1;
end();
exit(0);//<-- should never happen
@@ -20370,7 +20740,9 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
//set screen mode to 0 (80x25)
qbg_screen(0,NULL,0,0,NULL,1|4|8);
//make sure WIDTH is 80x25
- qbsub_width(NULL,80,25,1|2);
+ qbsub_width(NULL,80,25,0,0,1|2);
+ //restore view print
+ qbg_sub_view_print(NULL,NULL,0);
//restore palette
restorepalette(write_page);
//restore default colors
@@ -20381,13 +20753,14 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
//Reset RND & RANDOMIZE state
rnd_seed=327680;
rnd_seed_first=327680;//Note: must contain the same value as rnd_seed
+ //clear keyboard buffers
+ sub__keyclear(NULL,0);
}
void sub_run(qbs* f){
if (new_error) return;
- if (cloud_app){error(262); return;}
//run program
static qbs *str=NULL;
@@ -20642,9 +21015,7 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
void sub__display(){
- if (cloud_app==0){
- if (screen_hide) return;
- }
+ if (screen_hide) return;
//disable autodisplay (if enabled)
if (autodisplay){
@@ -21097,57 +21468,101 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
goto nextchar;
}
-
-
- #ifdef QB64_UNIX
- extern char** environ;
- #define envp environ
- #else /* WINDOWS */
+ #ifdef QB64_WINDOWS
#define envp _environ
+ #else
+ extern char **environ;
+ #define envp environ
#endif
- size_t environ_count;
-
- qbs *func_environ(qbs *name)
- {
- static char *cp;
- static qbs *tqbs;
- static int32 bytes;
- cp=getenv((char*)name->chr);
- if (cp&&(cloud_app==0)){
- bytes=strlen(cp);
- tqbs=qbs_new(bytes,1);
- memcpy(tqbs->chr,cp,bytes);
- }else{
- tqbs=qbs_new(0,1);
+
+ int32 func__environcount() {
+ //count array bound
+ char **p = envp;
+ while (*++p);
+ return p - envp;
+ }
+
+ qbs *func_environ(qbs *name) {
+ char *query, *result;
+ qbs *tqbs;
+ query = (char *)malloc(name->len + 1);
+ query[name->len] = '\0'; //add NULL terminator
+ memcpy(query, name->chr, name->len);
+ result = getenv(query);
+ if (result) {
+ int result_length = strlen(result);
+ tqbs = qbs_new(result_length, 1);
+ memcpy(tqbs->chr, result, result_length);
+ }
+ else {
+ tqbs = qbs_new(0, 1);
}
return tqbs;
}
-
- qbs *func_environ(int32 number)
- {
- static qbs *tqbs;
- static char *cp;
- static int32 bytes;
- if (cloud_app){tqbs=qbs_new(0,1); error(5); return tqbs;}
- if (number<=0){tqbs=qbs_new(0,1); error(5); return tqbs;}
- if (number>=environ_count){tqbs=qbs_new(0,1); return tqbs;}
- cp=*(envp+number-1);
- bytes=strlen(cp);
- tqbs=qbs_new(bytes,1);
- memcpy(tqbs->chr,cp,bytes);
+
+ qbs *func_environ(int32 number) {
+ char *result;
+ qbs *tqbs;
+ int result_length;
+ if (number <= 0) {
+ tqbs = qbs_new(0, 1);
+ error(5);
+ return tqbs;
+ }
+ //Check we do not go beyond array bound
+ char **p = envp;
+ while (*++p);
+ if (number > p - envp) {
+ tqbs = qbs_new(0, 1);
+ return tqbs;
+ }
+ result = envp[number - 1];
+ result_length = strlen(result);
+ tqbs = qbs_new(result_length, 1);
+ memcpy(tqbs->chr, result, result_length);
return tqbs;
}
- void sub_environ(qbs *str)
- {
- if (cloud_app){error(262); return;}
- static char *cp;
- cp=(char*)malloc(str->len+1);
- cp[str->len]=0;//add NULL terminator
- memcpy(cp,str->chr,str->len);
- putenv(cp);
- free(cp);
- environ_count++;
+ void sub_environ(qbs *str) {
+ char *buf;
+ char *separator;
+ buf = (char *)malloc(str->len + 1);
+ buf[str->len] = '\0';
+ memcpy(buf, str->chr, str->len);
+ //Name and value may be separated by = or space
+ separator = strchr(buf, ' ');
+ if (!separator) {
+ separator = strchr(buf, '=');
+ }
+ if (!separator) {
+ //It is an error is there is no separator
+ error(5);
+ return;
+ }
+ // Split into two separate strings
+ *separator = '\0';
+ if (separator == &buf[str->len] - 1) {
+ //Separator is at end of string, so remove the variable
+ #ifdef QB64_WINDOWS
+ *separator = '=';
+ _putenv(buf);
+ #else
+ unsetenv(buf);
+ #endif
+ }
+ else {
+ #ifdef QB64_WINDOWS
+ #if WINVER >= 0x0600
+ _putenv_s(buf, separator + 1);
+ #else
+ *separator = '=';
+ _putenv(buf);
+ #endif
+ #else
+ setenv(buf, separator + 1, 1);
+ #endif
+ }
+ free(buf);
}
#ifdef QB64_WINDOWS
@@ -21158,16 +21573,7 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
MessageBox2(NULL,(char*)s->chr,"showvalue",MB_OK|MB_SYSTEMMODAL);
}
#endif
-
-
-
-
-
-
-
-
-
-
+
//Referenced: http://johnnie.jerrata.com/winsocktutorial/
//Much of the unix sockets code based on http://beej.us/guide/bgnet/
@@ -21181,8 +21587,6 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
#include
#endif
-
-
#define NETWORK_ERROR -1
#define NETWORK_OK 0
@@ -21268,7 +21672,7 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
sockfd = socket(p->ai_family, p->ai_socktype, p->ai_protocol);
if (sockfd == -1) continue;
setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int));
- if (bind(sockfd, p->ai_addr, p->ai_addrlen) == -1) {
+ if (::bind(sockfd, p->ai_addr, p->ai_addrlen) == -1) {
close(sockfd);
continue;
}
@@ -21450,14 +21854,18 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
void tcp_out(void *connection,void *offset,ptrszint bytes){
#if !defined(DEPENDENCY_SOCKETS)
- #elif defined(QB64_WINDOWS) || defined(QB64_UNIX)
+ #elif defined(QB64_WINDOWS) || defined(QB64_UNIX)
+ // Handle Windows which might not have this flag (it would be a no-op anyway)
+ #if !defined(MSG_NOSIGNAL)
+ #define MSG_NOSIGNAL 0
+ #endif
tcp_connection *tcp; tcp=(tcp_connection*)connection;
int total = 0; // how many bytes we've sent
int bytesleft = bytes; // how many we have left to send
int n;
while(total < bytes) {
- n = send(tcp->socket, (char*)((char *)offset + total), bytesleft, 0);
+ n = send(tcp->socket, (char*)((char *)offset + total), bytesleft, MSG_NOSIGNAL);
if (n < 0) {
tcp->connected = 0;
return;
@@ -21469,7 +21877,6 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
#endif
}
- int32 cloud_port_redirect=-1;
struct connection_struct{
int8 in_use;//0=not being used, 1=in use
int8 protocol;//1=TCP/IP
@@ -21619,7 +22026,11 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
if ((method==0)||(method==1)){
if (parts<2) return -1;
- if (qbs_equal(qbs_ucase(info_part[1]),qbs_new_txt("TCP/IP"))==0) return -1;
+ if (qbs_equal(qbs_ucase(info_part[1]),qbs_new_txt("TCP/IP"))==0) {
+ if (qbs_equal(qbs_ucase(info_part[1]),qbs_new_txt("QB64IDE"))==0 || vwatch!=-1) {
+ return -1;
+ }
+ }
d=func_val(info_part[2]);
port=qbr_double_to_long(d);//***assume*** port number is within valid range
@@ -21627,10 +22038,6 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
if (method==0){//_OPENCLIENT
if (parts!=3) return -1;
- if (cloud_app){
- if (port==cloud_port_redirect) port=cloud_port[1];
- }
-
static void *connection;
qbs_set(str,qbs_add(info_part[3],strz));
connection=tcp_client_open(str->chr,port);
@@ -21654,22 +22061,14 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
//init stream
my_stream_struct->in=NULL; my_stream_struct->in_size=0; my_stream_struct->in_limit=0;
+ if (vwatch==-1) vwatch=my_handle;
return my_handle;
}//client
if (method==1){//_OPENHOST
if (parts!=2) return -1;
-
- if (cloud_app){
- if (port==cloud_port[1]) goto gotcloudport;
- if (port==cloud_port[2]) goto gotcloudport;
- if ((port>=1)&&(port<=2)){port=cloud_port[port]; goto gotcloudport;}
- cloud_port_redirect=port;
- port=cloud_port[1];//unknown values default to primary hosting port
- }
- gotcloudport:
-
+
static void *connection;
connection=tcp_host_open(port);
if (!connection) return 0;
@@ -21874,7 +22273,7 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
- #if defined(QB64_LINUX)
+ #if defined(QB64_LINUX) && defined(QB64_GUI)
//X11 clipboard interface for Linux
//SDL_SysWMinfo syswminfo;
@@ -21922,10 +22321,10 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
//SDL_EventState(SDL_SYSWMEVENT,SDL_ENABLE);
//SDL_SetEventFilter(x11filter);
x11_lock();
- targets=XInternAtom(X11_display,"TARGETS",True);
- utf8string=XInternAtom(X11_display,"UTF8_STRING",True);
- compoundtext=XInternAtom(X11_display,"COMPOUND_TEXT",True);
- clipboard=XInternAtom(X11_display,"CLIPBOARD",True);
+ targets=XInternAtom(X11_display,"TARGETS",False);
+ utf8string=XInternAtom(X11_display,"UTF8_STRING",False);
+ compoundtext=XInternAtom(X11_display,"COMPOUND_TEXT",False);
+ clipboard=XInternAtom(X11_display,"CLIPBOARD",False);
x11_unlock();
}
}
@@ -21997,6 +22396,9 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
return NULL;
}
+ #elif defined(QB64_LINUX)
+ void x11clipboardcopy(const char *text){ }
+ char *x11clipboardpaste(){ return NULL; }
#endif
@@ -22261,6 +22663,7 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
if ( (err) != noErr ) goto CantGetPasteboardItemIdentifier;
err = PasteboardCopyItemFlavorData( inPasteboard, itemID, CFSTR("public.utf8-plain-text"), &flavorData );
+ if ( (err) != noErr ) goto CantGetPasteboardItemCount;
data = (char*)CFDataGetBytePtr(flavorData);
uint32 size;
@@ -22369,7 +22772,7 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
if (i32==258){
generic_get(i,-1,(uint8*)&i32,4); i32b=i32;
generic_get(i,-1,(uint8*)&i32,4);
- qbsub_width(0,i32b,i32,1+2);
+ qbsub_width(0,i32b,i32,0,0,1+2);
generic_get(i,-1,(uint8*)&i32,4);
}
}
@@ -23116,6 +23519,10 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
f->file_handle->seekp(position);
}
f->pos=position;
+ if (f->pos<=gfs_lof(i)){
+ f->eof_passed=0;
+ f->eof_reached=0;
+ }
return 0;
#endif
@@ -23130,6 +23537,10 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
}
}
f->pos=position;
+ if (f->pos<=gfs_lof(i)){
+ f->eof_passed=0;
+ f->eof_reached=0;
+ }
return 0;
#endif
@@ -23523,9 +23934,7 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
#endif //DEPENDENCY_SCREENIMAGE
void sub__screenclick(int32 x,int32 y, int32 button, int32 passed){
-
- if (cloud_app){error(262); return;}
-
+
#ifdef QB64_WINDOWS
static INPUT input;
@@ -23984,8 +24393,6 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
void sub__screenprint(qbs *txt){
- if (cloud_app){error(262); return;}
-
static int32 i,s,x,vk,c;
#ifdef QB64_MACOSX
@@ -24411,7 +24818,6 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
void sub_files(qbs *str,int32 passed){
if (new_error) return;
- if (cloud_app){error(262); return;}
static int32 i,i2,i3;
static qbs *strz=NULL; if (!strz) strz=qbs_new(0,0);
@@ -24839,6 +25245,9 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
#if defined(QB64_GUI) && defined(QB64_WINDOWS) && defined(QB64_GLUT)
while (!window_exists){Sleep(100);} //Wait for window to be created before checking position
return glutGet(GLUT_WINDOW_X) - glutGet(GLUT_WINDOW_BORDER_WIDTH);
+ #elif defined(QB64_GUI) && defined(QB64_MACOSX) && defined(QB64_GLUT)
+ while (!window_exists){Sleep(100);} //Wait for window to be created before checking position
+ return glutGet(GLUT_WINDOW_X);
#endif
return 0; //if not windows then return 0
}
@@ -24847,6 +25256,9 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
#if defined(QB64_GUI) && defined(QB64_WINDOWS) && defined(QB64_GLUT)
while (!window_exists){Sleep(100);} //Wait for window to be created before checking position
return glutGet(GLUT_WINDOW_Y) - glutGet(GLUT_WINDOW_BORDER_WIDTH) - glutGet(GLUT_WINDOW_HEADER_HEIGHT);
+ #elif defined(QB64_GUI) && defined(QB64_MACOSX) && defined(QB64_GLUT)
+ while (!window_exists){Sleep(100);} //Wait for window to be created before checking position
+ return glutGet(GLUT_WINDOW_Y);
#endif
return 0; //if not windows then return 0
}
@@ -25888,15 +26300,16 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
int32 func__screenhide(){return -screen_hide;}
void sub__consoletitle(qbs* s){
- if (new_error) return;
- static qbs *sz=NULL; if (!sz) sz=qbs_new(0,0);
- static qbs *cz=NULL; if (!cz){cz=qbs_new(1,0); cz->chr[0]=0;}
- qbs_set(sz,qbs_add(s,cz));
- if (console){ if (console_active){
- #ifdef QB64_WINDOWS
- SetConsoleTitle((char*)sz->chr);
- #endif
- }}
+ #ifdef QB64_WINDOWS
+ char *title;
+ title = (char *)malloc(s->len + 1);
+ title[s->len] = '\0'; //add NULL terminator
+ memcpy(title, s->chr, s->len);
+ if (console){ if (console_active){
+ SetConsoleTitle(title);
+ Sleep(40);
+ }}
+ #endif
}
@@ -26696,13 +27109,6 @@ qbs *func__startdir(){
qbs *rootDir=NULL;//the dir moved to when program begins
-char *android_dir_downloads=NULL;
-char *android_dir_documents=NULL;
-char *android_dir_pictures=NULL;
-char *android_dir_music=NULL;
-char *android_dir_video=NULL;
-char *android_dir_dcim=NULL;
-
qbs *func__dir(qbs* context_in){
static qbs *context=NULL;
@@ -26711,10 +27117,6 @@ qbs *func__dir(qbs* context_in){
qbs_set(context,qbs_ucase(context_in));
if (qbs_equal(qbs_ucase(context),qbs_new_txt("TEXT"))||qbs_equal(qbs_ucase(context),qbs_new_txt("DOCUMENT"))||qbs_equal(qbs_ucase(context),qbs_new_txt("DOCUMENTS"))||qbs_equal(qbs_ucase(context),qbs_new_txt("MY DOCUMENTS"))){
- #ifdef QB64_ANDROID
- mkdir(android_dir_documents,0770);
- return qbs_new_txt(android_dir_documents);
- #endif
#ifdef QB64_WINDOWS
CHAR osPath[MAX_PATH];
if(SUCCEEDED(SHGetFolderPathA(NULL,5,NULL,0,osPath))){ //Documents
@@ -26724,10 +27126,6 @@ qbs *func__dir(qbs* context_in){
}
if (qbs_equal(qbs_ucase(context),qbs_new_txt("MUSIC"))||qbs_equal(qbs_ucase(context),qbs_new_txt("AUDIO"))||qbs_equal(qbs_ucase(context),qbs_new_txt("SOUND"))||qbs_equal(qbs_ucase(context),qbs_new_txt("SOUNDS"))||qbs_equal(qbs_ucase(context),qbs_new_txt("MY MUSIC"))){
- #ifdef QB64_ANDROID
- mkdir(android_dir_music,0770);
- return qbs_new_txt(android_dir_music);
- #endif
#ifdef QB64_WINDOWS
CHAR osPath[MAX_PATH];
if(SUCCEEDED(SHGetFolderPathA(NULL,13,NULL,0,osPath))){ //Music
@@ -26737,10 +27135,6 @@ qbs *func__dir(qbs* context_in){
}
if (qbs_equal(qbs_ucase(context),qbs_new_txt("PICTURE"))||qbs_equal(qbs_ucase(context),qbs_new_txt("PICTURES"))||qbs_equal(qbs_ucase(context),qbs_new_txt("IMAGE"))||qbs_equal(qbs_ucase(context),qbs_new_txt("IMAGES"))||qbs_equal(qbs_ucase(context),qbs_new_txt("MY PICTURES"))){
- #ifdef QB64_ANDROID
- mkdir(android_dir_pictures,0770);
- return qbs_new_txt(android_dir_pictures);
- #endif
#ifdef QB64_WINDOWS
CHAR osPath[MAX_PATH];
if(SUCCEEDED(SHGetFolderPathA(NULL,39,NULL,0,osPath))){//Pictures
@@ -26750,10 +27144,6 @@ qbs *func__dir(qbs* context_in){
}
if (qbs_equal(qbs_ucase(context),qbs_new_txt("DCIM"))||qbs_equal(qbs_ucase(context),qbs_new_txt("CAMERA"))||qbs_equal(qbs_ucase(context),qbs_new_txt("CAMERA ROLL"))||qbs_equal(qbs_ucase(context),qbs_new_txt("PHOTO"))||qbs_equal(qbs_ucase(context),qbs_new_txt("PHOTOS"))){
- #ifdef QB64_ANDROID
- mkdir(android_dir_dcim,0770);
- return qbs_new_txt(android_dir_dcim);
- #endif
#ifdef QB64_WINDOWS
CHAR osPath[MAX_PATH];
if(SUCCEEDED(SHGetFolderPathA(NULL,39,NULL,0,osPath))){//Pictures
@@ -26763,10 +27153,6 @@ qbs *func__dir(qbs* context_in){
}
if (qbs_equal(qbs_ucase(context),qbs_new_txt("MOVIE"))||qbs_equal(qbs_ucase(context),qbs_new_txt("MOVIES"))||qbs_equal(qbs_ucase(context),qbs_new_txt("VIDEO"))||qbs_equal(qbs_ucase(context),qbs_new_txt("VIDEOS"))||qbs_equal(qbs_ucase(context),qbs_new_txt("MY VIDEOS"))){
- #ifdef QB64_ANDROID
- mkdir(android_dir_video,0770);
- return qbs_new_txt(android_dir_video);
- #endif
#ifdef QB64_WINDOWS
CHAR osPath[MAX_PATH];
if(SUCCEEDED(SHGetFolderPathA(NULL,14,NULL,0,osPath))){ //Videos
@@ -26776,10 +27162,6 @@ qbs *func__dir(qbs* context_in){
}
if (qbs_equal(qbs_ucase(context),qbs_new_txt("DOWNLOAD"))||qbs_equal(qbs_ucase(context),qbs_new_txt("DOWNLOADS"))){
- #ifdef QB64_ANDROID
- mkdir(android_dir_downloads,0770);
- return qbs_new_txt(android_dir_downloads);
- #endif
#ifdef QB64_WINDOWS
CHAR osPath[MAX_PATH];
if(SUCCEEDED(SHGetFolderPathA(NULL,0x0028,NULL,0,osPath))){//user folder
@@ -26791,10 +27173,6 @@ qbs *func__dir(qbs* context_in){
}
if (qbs_equal(qbs_ucase(context),qbs_new_txt("DESKTOP"))){
- #ifdef QB64_ANDROID
- mkdir(android_dir_downloads,0770);
- return qbs_new_txt(android_dir_downloads);
- #endif
#ifdef QB64_WINDOWS
CHAR osPath[MAX_PATH];
if(SUCCEEDED(SHGetFolderPathA(NULL,0,NULL,0,osPath))){ //Desktop
@@ -26804,9 +27182,6 @@ qbs *func__dir(qbs* context_in){
}
if (qbs_equal(qbs_ucase(context),qbs_new_txt("APPDATA"))||qbs_equal(qbs_ucase(context),qbs_new_txt("APPLICATION DATA"))||qbs_equal(qbs_ucase(context),qbs_new_txt("PROGRAM DATA"))||qbs_equal(qbs_ucase(context),qbs_new_txt("DATA"))){
- #ifdef QB64_ANDROID
- return qbs_add(rootDir,qbs_new_txt("/"));
- #endif
#ifdef QB64_WINDOWS
CHAR osPath[MAX_PATH];
if(SUCCEEDED(SHGetFolderPathA(NULL,0x001a,NULL,0,osPath))){ //CSIDL_APPDATA (%APPDATA%)
@@ -26816,9 +27191,6 @@ qbs *func__dir(qbs* context_in){
}
if (qbs_equal(qbs_ucase(context),qbs_new_txt("LOCALAPPDATA"))||qbs_equal(qbs_ucase(context),qbs_new_txt("LOCAL APPLICATION DATA"))||qbs_equal(qbs_ucase(context),qbs_new_txt("LOCAL PROGRAM DATA"))||qbs_equal(qbs_ucase(context),qbs_new_txt("LOCAL DATA"))){
- #ifdef QB64_ANDROID
- return qbs_add(rootDir,qbs_new_txt("/"));
- #endif
#ifdef QB64_WINDOWS
CHAR osPath[MAX_PATH];
if(SUCCEEDED(SHGetFolderPathA(NULL,0x001c,NULL,0,osPath))){ //CSIDL_LOCAL_APPDATA (%LOCALAPPDATA%)
@@ -26826,6 +27198,37 @@ qbs *func__dir(qbs* context_in){
}
#endif
}
+
+ if (qbs_equal(qbs_ucase(context),qbs_new_txt("PROGRAMFILES"))||qbs_equal(qbs_ucase(context),qbs_new_txt("PROGRAM FILES"))){
+ #ifdef QB64_WINDOWS
+ CHAR osPath[MAX_PATH];
+ if(SUCCEEDED(SHGetFolderPathA(NULL,0x0026,NULL,0,osPath))){ //CSIDL_PROGRAM_FILES (%PROGRAMFILES%)
+ return qbs_add(qbs_new_txt(osPath),qbs_new_txt("\\"));
+ }
+ #endif
+ }
+
+ if (qbs_equal(qbs_ucase(context),qbs_new_txt("PROGRAMFILESX86"))||qbs_equal(qbs_ucase(context),qbs_new_txt("PROGRAMFILES X86"))||qbs_equal(qbs_ucase(context),qbs_new_txt("PROGRAM FILES X86"))||qbs_equal(qbs_ucase(context),qbs_new_txt("PROGRAM FILES 86"))||qbs_equal(qbs_ucase(context),qbs_new_txt("PROGRAM FILES (X86)"))||qbs_equal(qbs_ucase(context),qbs_new_txt("PROGRAMFILES (X86)"))||qbs_equal(qbs_ucase(context),qbs_new_txt("PROGRAM FILES(X86)"))){
+ #ifdef QB64_WINDOWS && _WIN64
+ CHAR osPath[MAX_PATH];
+ if(SUCCEEDED(SHGetFolderPathA(NULL,0x002a,NULL,0,osPath))){ //CSIDL_PROGRAM_FILES (%PROGRAMFILES(X86)%)
+ return qbs_add(qbs_new_txt(osPath),qbs_new_txt("\\"));
+ }
+ #endif
+ }
+
+ if (qbs_equal(qbs_ucase(context),qbs_new_txt("TEMP"))||qbs_equal(qbs_ucase(context),qbs_new_txt("TEMP FILES"))){
+ #ifdef QB64_WINDOWS
+ CHAR osPath[MAX_PATH+1];
+ DWORD pathlen;
+ pathlen = GetTempPathA(261, osPath); //%TEMP%
+ char path[pathlen];
+ memcpy(path, &osPath, pathlen);
+ if (pathlen > 0){
+ return qbs_new_txt(path);
+ }
+ #endif
+ }
//general fallback location
#ifdef QB64_WINDOWS
@@ -26835,10 +27238,6 @@ qbs *func__dir(qbs* context_in){
}
return qbs_new_txt(".\\");//current location
#else
- #ifdef QB64_ANDROID
- mkdir(android_dir_downloads,0770);
- return qbs_new_txt(android_dir_downloads);
- #endif
return qbs_new_txt("./");//current location
#endif
}
@@ -26912,9 +27311,7 @@ int main( int argc, char* argv[] ){
this_mouse_message_queue->lastIndex=65535;
this_mouse_message_queue->queue=(mouse_message*)calloc(1,sizeof(mouse_message)*(this_mouse_message_queue->lastIndex+1));
- if (!cloud_app){
- snd_init();
- }
+ snd_init();
@@ -26959,19 +27356,6 @@ int main( int argc, char* argv[] ){
ontimer[0].state=0;
ontimer[0].active=0;
-
-
-
-
-
-
- {
- /* For bounds check on numeric ENVIRON$ */
- char **p = envp;
- while (*p++);
- environ_count = p - envp;
- }
-
fontwidth[8]=8; fontwidth[14]=8; fontwidth[16]=8;
fontheight[8]=8; fontheight[14]=14; fontheight[16]=16;
fontflags[8]=16; fontflags[14]=16; fontflags[16]=16;//monospace flag
@@ -27651,123 +28035,9 @@ void MAIN_LOOP(){
goto end_program;
}
- if (!cloud_app){
- snd_mainloop();
- }
+ snd_mainloop();
-
- //check for input event (qloud_next_input_index)
- if (cloud_app){
-
- //***should be replaced with a timer based check (or removed)***
- //static int qloud_input_frame_count=0;
- //qloud_input_frame_count++;
- //if (qloud_input_frame_count>8) qloud_input_frame_count=1;
- //if (qloud_input_frame_count==1){//~8 checks per second (would be ~64 without this check)
-
- qloud_input_recheck:
-
- FILE * pFile;
- long lSize;
- char * buffer;
- size_t result;
- pFile = NULL;
-
- static char filename[] = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
- sprintf(filename, "input_%d.txt\0", qloud_next_input_index);
- pFile = fopen ( filename , "rb" );
- if (pFile!=NULL) {
- // obtain file size:
- fseek (pFile , 0 , SEEK_END);
- lSize = ftell (pFile);
- rewind (pFile);
- if (lSize>0){
- // allocate memory to contain the whole file:
- buffer = (char*) calloc (1,sizeof(char)*lSize+1);
- if (buffer != NULL) {
- // copy the file into the buffer:
- result = fread (buffer,1,lSize,pFile);
- if (result == lSize) {
-
- if (buffer[lSize-1]==42){ //"*" terminator
-
- int start,stop;
- start=0;
-
- int bi;
-
- nextcommand:
-
- for (bi=start;bi 4 changes p/sec
if (frame&8) show_flashing=1; else show_flashing=0;
- if (cloud_app){
- static double cloud_timer_flash;
- cloud_timer_flash=func_timer(0.001,1)/2.0;
- static int64 cloud_timer_flash_int;
- cloud_timer_flash_int=cloud_timer_flash;
- if (cloud_timer_flash_int&1) show_cursor=1; else show_cursor=0;
- if (cloud_timer_flash_int&1) show_flashing=1; else show_flashing=0;
- //static int qloud_show_cursor=0;
- //qloud_show_cursor++; if (qloud_show_cursor&1) show_cursor=1; else show_cursor=0;
- }
-
-
-
//calculate cursor position (base 0)
cx=display_page->cursor_x-1; cy=display_page->cursor_y-1;
@@ -28592,60 +28821,10 @@ void display(){
//if (!display_frame_begin) display_frame_begin=frame_i;
display_frame[frame_i].state=DISPLAY_FRAME_STATE__READY; last_hardware_display_frame_order=display_frame[frame_i].order;
-
-
- if (cloud_app){
- if (cloud_chdir_complete){
-
- #ifdef QB64_WINDOWS
- /*
- static FILE *cloud_screenshot_file_handle=NULL;
- if (cloud_screenshot_file_handle==NULL) cloud_screenshot_file_handle=fopen("output_image.raw","w+b");
- fseek ( cloud_screenshot_file_handle , 0 , SEEK_SET );//reset file pointer to beginning of file
- static int32 w,h;
- w=display_frame[frame_i].w;
- h=display_frame[frame_i].h;
- static int32 wh[2];
- wh[0]=w;
- wh[1]=h;
- fwrite (&wh[0] , 8, 1, cloud_screenshot_file_handle);
- fwrite (display_frame[frame_i].bgra , w*h*4, 1, cloud_screenshot_file_handle);
- fflush(cloud_screenshot_file_handle);
- */
-
- static HANDLE cloud_screenshot_file_handle=NULL;
- if (cloud_screenshot_file_handle==NULL) cloud_screenshot_file_handle=CreateFile("output_image.raw", GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS,
- /*FILE_ATTRIBUTE_NORMAL*/FILE_FLAG_WRITE_THROUGH, NULL);
-
-
- //fseek ( cloud_screenshot_file_handle , 0 , SEEK_SET );//reset file pointer to beginning of file
-
-
- static int32 w,h,index=0;
- w=display_frame[frame_i].w;
- h=display_frame[frame_i].h;
- index++;
- static int32 header[3];
- header[0]=index;
- header[1]=w;
- header[2]=h;
-
- SetFilePointer(cloud_screenshot_file_handle,12,0,FILE_BEGIN);
- WriteFile(cloud_screenshot_file_handle, display_frame[frame_i].bgra, w*h*4, NULL, NULL);
- FlushFileBuffers(cloud_screenshot_file_handle);
- SetFilePointer(cloud_screenshot_file_handle,0,0,FILE_BEGIN);
- WriteFile(cloud_screenshot_file_handle, &header[0], 12, NULL, NULL);
-
-
- //CloseHandle(cloud_screenshot_file_handle);
-
- #endif
- }
- }
+
no_new_frame:;
display_page_invalid:;
- cloud_skip_frame:
//cancel frame if not built
@@ -29752,3 +29931,171 @@ void reinit_glut_callbacks(){
#endif
}
+
+int32 func__capslock(){
+ #ifdef QB64_WINDOWS
+ return -GetKeyState(VK_CAPITAL);
+ #endif
+ return 0;
+}
+
+int32 func__scrolllock(){
+ #ifdef QB64_WINDOWS
+ return -GetKeyState(VK_SCROLL);
+ #endif
+ return 0;
+}
+
+int32 func__numlock(){
+ #ifdef QB64_WINDOWS
+ return -GetKeyState(VK_NUMLOCK);
+ #endif
+ return 0;
+}
+
+void toggle_lock_key(int32 key_code){
+ #ifdef QB64_WINDOWS
+ keybd_event (key_code, 0x45, 1, 0);
+ keybd_event (key_code, 0x45, 3, 0);
+ #endif
+}
+
+void sub__capslock(int32 options){
+ #ifdef QB64_WINDOWS
+ //VK_CAPITAL
+ int32 currentState = func__capslock();
+ switch(options){
+ case 1: //ON
+ if (currentState==-1) return;
+ break;
+ case 2: //OFF
+ if (currentState==0) return;
+ break;
+ }
+ // _TOGGLE:
+ toggle_lock_key(VK_CAPITAL);
+ #endif
+}
+
+void sub__scrolllock(int32 options){
+ #ifdef QB64_WINDOWS
+ //VK_SCROLL
+ int32 currentState = func__scrolllock();
+ switch(options){
+ case 1: //ON
+ if (currentState==-1) return;
+ break;
+ case 2: //OFF
+ if (currentState==0) return;
+ break;
+ }
+ // _TOGGLE:
+ toggle_lock_key(VK_SCROLL);
+ #endif
+}
+
+void sub__numlock(int32 options){
+ #ifdef QB64_WINDOWS
+ //VK_NUMLOCK
+ int32 currentState = func__numlock();
+ switch(options){
+ case 1: //ON
+ if (currentState==-1) return;
+ break;
+ case 2: //OFF
+ if (currentState==0) return;
+ break;
+ }
+ // _TOGGLE:
+ toggle_lock_key(VK_NUMLOCK);
+ #endif
+}
+
+void sub__consolefont(qbs* FontName, int FontSize){
+ #ifdef QB64_WINDOWS
+ #if WINVER >= 0x0600 //this block is not compatible with XP
+ SECURITY_ATTRIBUTES SecAttribs = {sizeof(SECURITY_ATTRIBUTES), 0, 1};
+ HANDLE cl_conout = CreateFileA("CONOUT$", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, & SecAttribs, OPEN_EXISTING, 0, 0);
+ static int OneTimePause;
+ if (!OneTimePause){ // a slight delay so the console can be properly created and registered with Windows, before we try and change fonts with it.
+ Sleep(500);
+ OneTimePause=1; //after the first pause, the console should be created, so we don't need any more delays in the future.
+ }
+ CONSOLE_FONT_INFOEX info = {0};
+ info.cbSize = sizeof(info);
+ info.dwFontSize.Y = FontSize; // leave X as zero
+ info.FontWeight = FW_NORMAL;
+ if (FontName->len>0){ //if we don't pass a font name, don't change the existing one.
+ const size_t cSize = FontName->len;
+ wchar_t* wc = new wchar_t[32];
+ mbstowcs (wc, (char *)FontName->chr, cSize);
+ wcscpy(info.FaceName, wc);
+ delete[] wc;
+ }
+
+ SetCurrentConsoleFontEx(cl_conout, NULL, &info);
+ #endif
+ #endif
+}
+
+
+void sub__console_cursor(int32 visible, int32 cursorsize, int32 passed){
+ #ifdef QB64_WINDOWS
+ HANDLE consoleHandle = GetStdHandle(STD_OUTPUT_HANDLE);
+ CONSOLE_CURSOR_INFO info;
+
+ GetConsoleCursorInfo(consoleHandle, &info); //get the original info, so we reuse it, unless the user called for a change.
+
+ if (visible==1)info.bVisible = TRUE; //cursor is set to show
+ if (visible==2)info.bVisible = FALSE; //set to hide
+ if (passed&&cursorsize>=0&&cursorsize<=100)info.dwSize = cursorsize; //the user passed the cursor size, of a suitable size
+
+ SetConsoleCursorInfo(consoleHandle, &info);
+ #endif
+}
+
+int32 func__getconsoleinput(){
+ #ifdef QB64_WINDOWS
+ HANDLE hStdin = GetStdHandle (STD_INPUT_HANDLE);
+ INPUT_RECORD irInputRecord;
+ DWORD dwEventsRead, fdwMode, dwMode;
+ CONSOLE_SCREEN_BUFFER_INFO cl_bufinfo;
+
+ GetConsoleMode(hStdin, (LPDWORD)&dwMode);
+ fdwMode = ENABLE_EXTENDED_FLAGS;
+ SetConsoleMode(hStdin, fdwMode);
+ fdwMode = dwMode | ENABLE_WINDOW_INPUT | ENABLE_MOUSE_INPUT;
+ SetConsoleMode(hStdin, fdwMode);
+
+ ReadConsoleInputA (hStdin, &irInputRecord, 1, &dwEventsRead);
+ switch(irInputRecord.EventType){
+ case KEY_EVENT: //keyboard input
+ consolekey = irInputRecord.Event.KeyEvent.wVirtualScanCode;
+ if (!irInputRecord.Event.KeyEvent.bKeyDown) consolekey = -consolekey; //positive/negative return of scan codes.
+ return 1;
+ case MOUSE_EVENT: //mouse input
+ consolemousex = irInputRecord.Event.MouseEvent.dwMousePosition.X + 1;
+ consolemousey = irInputRecord.Event.MouseEvent.dwMousePosition.Y - cl_bufinfo.srWindow.Top + 1;
+ consolebutton = irInputRecord.Event.MouseEvent.dwButtonState; //button state for all buttons
+ //SetConsoleMode(hStdin, dwMode);
+ return 2;
+ }
+ #endif
+ return 0; //in case it's some other odd input
+}
+
+int32 func__cinp (int32 toggle, int32 passed){
+ #ifdef QB64_WINDOWS
+ int32 temp = consolekey;
+ consolekey = 0; //reset the console key, now that we've read it
+ if (passed==0)toggle=1; //default return of positive/negative scan code values
+ if (toggle) {
+ return temp;
+ }else{
+ if (temp>=0)return temp;
+ return -temp + 128;
+ }
+ #else
+ return 0;
+ #endif
+}
diff --git a/internal/c/libqb.h b/internal/c/libqb.h
index a9cd39f1f..30bd85362 100644
--- a/internal/c/libqb.h
+++ b/internal/c/libqb.h
@@ -68,4 +68,6 @@
extern qbs *qbs_lcase(qbs *str);
extern qbs *qbs_ucase(qbs *str);
+
+ using namespace std;
#endif
diff --git a/internal/c/libqb/gui.cpp b/internal/c/libqb/gui.cpp
index aec2b00ed..23dda85d6 100644
--- a/internal/c/libqb/gui.cpp
+++ b/internal/c/libqb/gui.cpp
@@ -1,3 +1,8 @@
+#ifdef QB64_MACOSX
+#include
+#endif
+
+// trigger recompilation = 3
int32 displayorder_screen=1;
int32 displayorder_hardware=2;
@@ -18,7 +23,7 @@ void sub__displayorder(int32 method1,int32 method2,int32 method3,int32 method4){
displayorder_hardware1=0;
displayorder_glrender=0;
static int32 i,method;
- for (i=1;i<=4;i++){
+ for (i=1;i<=4;i++){
if (i==1) method=method1;
if (i==2) method=method2;
if (i==3) method=method3;
@@ -98,7 +103,7 @@ void sub__glrender(int32 method){
- void free_hardware_img(int32 handle, int32 caller_id){
+ void free_hardware_img(int32 handle, int32 caller_id){
hardware_img_struct* hardware_img;
hardware_img=(hardware_img_struct*)list_get(hardware_img_handles,handle);
@@ -116,7 +121,7 @@ void sub__glrender(int32 method){
glDeleteFramebuffersEXT(1, &depthbuffer_handle);
}
GLuint texture=(GLuint)hardware_img->texture_handle;
- glDeleteTextures(1, &texture);
+ glDeleteTextures(1, &texture);
//test reasset of hardware+img
//hardware_img=(hardware_img_struct*)list_get(hardware_img_handles,handle);
@@ -175,7 +180,7 @@ void sub__glrender(int32 method){
can_scale=1;
if (resize_auto==2) environment_2d__screen_smooth=1;
//note: screen will fix its aspect ratio automatically, so there is no need to enforce squarepixels
- }
+ }
}
if (environment_2d__screen_width==environment__window_width &&
@@ -247,7 +252,7 @@ void sub__glrender(int32 method){
environment_2d__screen_scaled_height=environment_2d__screen_y2-environment_2d__screen_y1+1;
environment_2d__screen_x_scale=(float)environment_2d__screen_scaled_width/(float)environment_2d__screen_width;
environment_2d__screen_y_scale=(float)environment_2d__screen_scaled_height/(float)environment_2d__screen_height;
- }
+ }
}//prepare_environment_2d
@@ -369,7 +374,7 @@ void sub__glrender(int32 method){
if (new_mode_shrunk==SMOOTH_MODE__DONT_SMOOTH){
if (render_state.source->PO2_fix==PO2_FIX__MIPMAPPED){
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- }else{
+ }else{
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);//Use _MAPTRIANGLE's _SMOOTHSHRUNK to apply linear filtering here
}
}
@@ -442,7 +447,7 @@ void sub__glrender(int32 method){
}
if (new_mode==DEPTHBUFFER_MODE__ON){
glEnable(GL_DEPTH_TEST);
- glDepthMask(GL_TRUE);
+ glDepthMask(GL_TRUE);
glAlphaFunc(GL_GREATER, 0.001);
glEnable(GL_ALPHA_TEST);
}
@@ -463,7 +468,7 @@ void sub__glrender(int32 method){
glDisable(GL_CULL_FACE);
}
if (new_mode==CULL_MODE__CLOCKWISE_ONLY){
- glFrontFace(GL_CW);
+ glFrontFace(GL_CW);
if (current_mode!=CULL_MODE__ANTICLOCKWISE_ONLY) glEnable(GL_CULL_FACE);
}
if (new_mode==CULL_MODE__ANTICLOCKWISE_ONLY){
@@ -493,7 +498,7 @@ void sub__glrender(int32 method){
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glAlphaFunc(GL_ALWAYS, 0);
if (framebufferobjects_supported) glBindFramebufferEXT(GL_FRAMEBUFFER, 0);
- glBindTexture (GL_TEXTURE_2D, 0);
+ glBindTexture (GL_TEXTURE_2D, 0);
glClear(GL_DEPTH_BUFFER_BIT);
glColor4f(1.f, 1.f, 1.f, 1.f);
glMatrixMode(GL_PROJECTION);
@@ -506,11 +511,11 @@ void sub__glrender(int32 method){
set_cull_mode(CULL_MODE__UNKNOWN);
set_render_source(INVALID_HARDWARE_HANDLE);
set_render_dest(INVALID_HARDWARE_HANDLE);
- new_mode=VIEW_MODE__UNKNOWN;//resets are performed before unknown operations are executed
+ new_mode=VIEW_MODE__UNKNOWN;//resets are performed before unknown operations are executed
}
if (new_mode==VIEW_MODE__2D){
if (current_mode!=VIEW_MODE__3D){
- glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
+ glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
glDisable(GL_COLOR_MATERIAL);
glDisable(GL_LIGHTING);
set_alpha(ALPHA_MODE__BLEND);
@@ -525,6 +530,44 @@ void sub__glrender(int32 method){
if (render_state.dest_handle==0){
static int32 dst_w,dst_h;
+ static int32 scale_factor=0;
+
+ #ifdef QB64_MACOSX
+ if (scale_factor==0) {
+ // by default scale_factor should be 1, but in macOS Catalina (10.15.*) scale_factor must be setted in 2
+ // * in cases where the app is executed on system with Retina Display
+ scale_factor = 1; // by default
+
+ // lookup for retina/5k output from system_profiler (storing all outpun in stream)
+ bool b_isRetina, b_is5k;
+ FILE* consoleStream = popen("system_profiler SPDisplaysDataType", "r");
+ if (consoleStream) {
+ char buffer[128];
+ while (!feof(consoleStream)) {
+ if (fgets(buffer, 128, consoleStream) != NULL) {
+ string szBuffer(buffer);
+
+ if (!b_isRetina) b_isRetina = (szBuffer.rfind("Retina") != ULONG_MAX);
+ if (!b_is5k) b_is5k = (szBuffer.rfind("5K") != ULONG_MAX);
+ }
+ }
+ }
+ pclose(consoleStream);
+
+ if (b_isRetina || b_is5k) {
+ // apply only factor = 2 if macOS is Catalina (11.15.* // kern.osrelease 19.*)
+ char str[256];
+ size_t size = sizeof(str);
+ int ret = sysctlbyname("kern.osrelease", str, &size, NULL, 0);
+
+ string sz_osrelease(str);
+ if (sz_osrelease.rfind("19.") == 0) scale_factor=2;
+ }
+ }
+ #else
+ scale_factor=1;
+ #endif
+
dst_w=environment__window_width;
dst_h=environment__window_height;
@@ -538,7 +581,7 @@ void sub__glrender(int32 method){
glLoadIdentity();
glScalef(1, -1, 1);//flip vertically
glTranslatef(0, -dst_h, 0);//move to new vertical position
- glViewport(0,0,dst_w,dst_h);
+ glViewport(0,0,dst_w * scale_factor,dst_h * scale_factor);
}else{
@@ -580,7 +623,7 @@ void sub__glrender(int32 method){
}else{
fov=90.0f*((float)environment__window_height/(float)environment_2d__screen_scaled_height);
}
- gluPerspective(fov, (GLfloat)dst_w / (GLfloat)dst_h, 0.1, 10000.0); // Set the Field of view angle (in degrees), the aspect ratio of our window, and the new and far planes
+ gluPerspective(fov, (GLfloat)dst_w / (GLfloat)dst_h, 0.1, 10000.0); // Set the Field of view angle (in degrees), the aspect ratio of our window, and the new and far planes
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}else{
@@ -604,7 +647,7 @@ void sub__glrender(int32 method){
}else{
fov=90.0f;
}
- gluPerspective(fov, (GLfloat)dst_w / (GLfloat)dst_h, 0.1, 10000.0); // Set the Field of view angle (in degrees), the aspect ratio of our window, and the new and far planes
+ gluPerspective(fov, (GLfloat)dst_w / (GLfloat)dst_h, 0.1, 10000.0); // Set the Field of view angle (in degrees), the aspect ratio of our window, and the new and far planes
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
//alert("3D rendering onto FBO not supported yet");
@@ -671,7 +714,7 @@ void sub__glrender(int32 method){
glGenFramebuffersEXT(1, &framebuffer_handle);
glBindFramebufferEXT(GL_FRAMEBUFFER, framebuffer_handle);
hardware_img->dest_context_handle=framebuffer_handle;
- glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, hardware_img->texture_handle, 0);
+ glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, hardware_img->texture_handle, 0);
//glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
//glClear(GL_COLOR_BUFFER_BIT);
@@ -786,7 +829,7 @@ void sub__glrender(int32 method){
if (src_hardware_img->source_state.PO2_fix){
src_w=src_hardware_img->PO2_w;
src_h=src_hardware_img->PO2_h;
- }
+ }
//calc source texture co-ordinates
static float x1f,y1f,x2f,y2f;
@@ -1066,7 +1109,7 @@ void sub__glrender(int32 method){
if (src_hardware_img->source_state.PO2_fix){
src_w=src_hardware_img->PO2_w;
src_h=src_hardware_img->PO2_h;
- }
+ }
//calc source texture co-ordinates
static float x1f,y1f,x2f,y2f,x3f,y3f;
@@ -1130,7 +1173,7 @@ void sub__glrender(int32 method){
static hardware_img_struct* dst_hardware_img;
dst_hardware_img=(hardware_img_struct*)list_get(hardware_img_handles,dst_img);
hardware_img_requires_depthbuffer(dst_hardware_img);
- }else{ //dest is 0
+ }else{ //dest is 0
}
set_render_source(src_img);
@@ -1178,7 +1221,7 @@ void sub__glrender(int32 method){
if (src_hardware_img->source_state.PO2_fix){
src_w=src_hardware_img->PO2_w;
src_h=src_hardware_img->PO2_h;
- }
+ }
//calc source texture co-ordinates
static float x1f,y1f,x2f,y2f,x3f,y3f;
@@ -1275,7 +1318,7 @@ void sub__glrender(int32 method){
if (temp_window_title_set==1) {
glutSetWindowTitle((char*)window_title);
temp_window_title_set=0;
- }
+ }
#endif
//general use variables
@@ -1305,7 +1348,7 @@ void sub__glrender(int32 method){
in_GLUT_DISPLAY_REQUEST=0;
return;//no frames exist yet, so screen size cannot be determined, therefore no action possible
}
- if (i!=last_i){
+ if (i!=last_i){
for (i2=0; i2<=2;i2++){
if (display_frame[i2].order1) use_alpha=1;
+ use_alpha=0; if (level>1) use_alpha=1;
- //put the software screen
+ //put the software screen
hardware_img_put(0,0,environment_2d__screen_width-1,environment_2d__screen_height-1,
software_screen_hardware_frame, 0,
0,0,f1->w-1,f1->h-1,
@@ -1791,7 +1834,7 @@ void sub__glrender(int32 method){
if ((hgc->dst_img>0&&first_hardware_layer_rendered==0)||hgc->dst_img==dst){
hardware_img_put(hgc->dst_x1,hgc->dst_y1,hgc->dst_x2,hgc->dst_y2,
hgc->src_img, hgc->dst_img,
- hgc->src_x1,hgc->src_y1,hgc->src_x2,hgc->src_y2,
+ hgc->src_x1,hgc->src_y1,hgc->src_x2,hgc->src_y2,
hgc->use_alpha,hgc->smooth);
}
}
@@ -2023,20 +2066,29 @@ void sub__glrender(int32 method){
void GLUT_MOTION_FUNC(int x, int y){
- static int32 i,last_i;
- static int32 xrel=0,yrel=0;
-
+ int32 i, last_i;
int32 handle;
+ int32 xrel, yrel;
handle=mouse_message_queue_first;
mouse_message_queue_struct *queue=(mouse_message_queue_struct*)list_get(mouse_message_queue_handles,handle);
//message #1
last_i=queue->last;
- i=queue->last+1; if (i>queue->lastIndex) i=0;
+ i=queue->last+1; if (i>queue->lastIndex) i=0; //wrap around
if (i==queue->current){
- int32 nextIndex=queue->last+1; if (nextIndex>queue->lastIndex) nextIndex=0;
+ int32 nextIndex=queue->last+1;
+ if (nextIndex>queue->lastIndex) nextIndex=0;
queue->current=nextIndex;
}
+ #ifdef QB64_WINDOWS
+ // Windows calculates relative movement by intercepting WM_INPUT events instead
+ xrel = 0;
+ yrel = 0;
+ #else
+ xrel = x - queue->queue[queue->last].x;
+ yrel = y - queue->queue[queue->last].y;
+ #endif
+
queue->queue[i].x=x;
queue->queue[i].y=y;
queue->queue[i].movementx=xrel;
@@ -2083,7 +2135,7 @@ void sub__glrender(int32 method){
fy*=2.0;//0 to 2
fy-=1.0;//-1 to 1
setDeviceEventAxisValue(d,eventIndex,0,fx);
- setDeviceEventAxisValue(d,eventIndex,1,fy);
+ setDeviceEventAxisValue(d,eventIndex,1,fy);
commitDeviceEvent(d);
}else{
@@ -2096,7 +2148,7 @@ void sub__glrender(int32 method){
fx=xrel;
fy=yrel;
setDeviceEventWheelValue(d,eventIndex,0,fx);
- setDeviceEventWheelValue(d,eventIndex,1,fy);
+ setDeviceEventWheelValue(d,eventIndex,1,fy);
commitDeviceEvent(d);
eventIndex=createDeviceEvent(d);
diff --git a/internal/c/libqb/gui.h b/internal/c/libqb/gui.h
index 00b684f84..a1015d69e 100644
--- a/internal/c/libqb/gui.h
+++ b/internal/c/libqb/gui.h
@@ -181,16 +181,6 @@ int32 requestedKeyboardOverlayImage=0;
if (flags&NEW_HARDWARE_IMG__DUPLICATE_PROVIDED_BUFFER){
hardware_img->software_pixel_buffer=(uint32*)malloc(x*y*4);
memcpy(hardware_img->software_pixel_buffer,pixels,x*y*4);
- #ifdef QB64_ANDROID
- //BGRA->RGBA
- uint32 *pos=(uint32*)hardware_img->software_pixel_buffer;
- int32 numPixels=x*y;
- uint32 col;
- while(numPixels--){
- col=*pos;
- *pos++= (col&0xFF00FF00) | ((col & 0xFF0000) >> 16) | ((col & 0x0000FF) << 16);
- }
- #endif
}else{
hardware_img->software_pixel_buffer=pixels;
}
diff --git a/internal/c/libqb/os/osx/build_test.command b/internal/c/libqb/os/osx/build_test.command
old mode 100644
new mode 100755
index aa2b456d7..0d6da4916
--- a/internal/c/libqb/os/osx/build_test.command
+++ b/internal/c/libqb/os/osx/build_test.command
@@ -1,5 +1,5 @@
cd "$(dirname "$0")"
-g++ -c -w -Wall ../../../libqb.mm -D DEPENDENCY_AUDIO_OUT -D DEPENDENCY_AUDIO_DECODE -D DEPENDENCY_AUDIO_CONVERSION -o libqb_test_only.o
+clang++ -c -w -Wall ../../../libqb.mm -D DEPENDENCY_AUDIO_OUT -D DEPENDENCY_AUDIO_DECODE -D DEPENDENCY_AUDIO_CONVERSION -o libqb_test_only.o
echo "Press any key to continue"
Pause()
{
diff --git a/internal/c/libqb/os/osx/setup_build.command b/internal/c/libqb/os/osx/setup_build.command
old mode 100644
new mode 100755
index e81aaea6b..6db7d8eb1
--- a/internal/c/libqb/os/osx/setup_build.command
+++ b/internal/c/libqb/os/osx/setup_build.command
@@ -1,3 +1,3 @@
cd "$(dirname "$0")"
-g++ -c -w -Wall ../../../libqb.mm -D DEPENDENCY_LOADFONT -o libqb_setup.o
+clang++ -c -w -Wall ../../../libqb.mm -D DEPENDENCY_LOADFONT -o libqb_setup.o
diff --git a/internal/c/makeline_lnx_nogui.txt b/internal/c/makeline_lnx_nogui.txt
new file mode 100644
index 000000000..e95fdbe52
--- /dev/null
+++ b/internal/c/makeline_lnx_nogui.txt
@@ -0,0 +1,2 @@
+g++ -no-pie -w qbx.cpp parts/core/os/lnx/src.a -lpthread -ldl -lrt -D FREEGLUT_STATIC -o
+
diff --git a/internal/c/makeline_osx.txt b/internal/c/makeline_osx.txt
index 2406a18c6..f44517f5c 100644
--- a/internal/c/makeline_osx.txt
+++ b/internal/c/makeline_osx.txt
@@ -1,4 +1,4 @@
-g++ -w qbx.cpp -framework OpenGL -framework IOKit -framework GLUT -framework OpenGL -framework Cocoa -o
+clang++ -w qbx.cpp -framework OpenGL -framework IOKit -framework GLUT -framework OpenGL -framework Cocoa -o
(below for reference purposes only, above is minimum viable)
-g++ -w qbx.cpp -framework ApplicationServices -framework OpenGL -framework IOKit -framework CoreServices -framework CoreFoundation -framework GLUT -framework OpenGL -framework Cocoa -o
\ No newline at end of file
+clang++ -w qbx.cpp -framework ApplicationServices -framework OpenGL -framework IOKit -framework CoreServices -framework CoreFoundation -framework GLUT -framework OpenGL -framework Cocoa -o
\ No newline at end of file
diff --git a/internal/c/mingw32/libexec/gcc/i686-w64-mingw32/8.1.0/install-tools/fixinc.sh b/internal/c/mingw32/libexec/gcc/i686-w64-mingw32/8.1.0/install-tools/fixinc.sh
old mode 100644
new mode 100755
diff --git a/internal/c/mingw32/opt/bin/python-config-u.sh b/internal/c/mingw32/opt/bin/python-config-u.sh
old mode 100644
new mode 100755
diff --git a/internal/c/mingw32/opt/bin/python-config.sh b/internal/c/mingw32/opt/bin/python-config.sh
old mode 100644
new mode 100755
diff --git a/internal/c/mingw32/opt/lib/itcl4.1.1/itclConfig.sh b/internal/c/mingw32/opt/lib/itcl4.1.1/itclConfig.sh
old mode 100644
new mode 100755
diff --git a/internal/c/mingw32/opt/lib/tcl8.6/tclConfig.sh b/internal/c/mingw32/opt/lib/tcl8.6/tclConfig.sh
old mode 100644
new mode 100755
diff --git a/internal/c/mingw32/opt/lib/tclConfig.sh b/internal/c/mingw32/opt/lib/tclConfig.sh
old mode 100644
new mode 100755
diff --git a/internal/c/mingw32/opt/lib/tdbc1.0.6/tdbcConfig.sh b/internal/c/mingw32/opt/lib/tdbc1.0.6/tdbcConfig.sh
old mode 100644
new mode 100755
diff --git a/internal/c/mingw32/opt/lib/tk8.6/tkConfig.sh b/internal/c/mingw32/opt/lib/tk8.6/tkConfig.sh
old mode 100644
new mode 100755
diff --git a/internal/c/mingw32/opt/lib/tkConfig.sh b/internal/c/mingw32/opt/lib/tkConfig.sh
old mode 100644
new mode 100755
diff --git a/internal/c/mingw32/opt/ssl/misc/CA.sh b/internal/c/mingw32/opt/ssl/misc/CA.sh
old mode 100644
new mode 100755
diff --git a/internal/c/mingw64/libexec/gcc/x86_64-w64-mingw32/8.1.0/install-tools/fixinc.sh b/internal/c/mingw64/libexec/gcc/x86_64-w64-mingw32/8.1.0/install-tools/fixinc.sh
old mode 100644
new mode 100755
diff --git a/internal/c/mingw64/opt/bin/python-config-u.sh b/internal/c/mingw64/opt/bin/python-config-u.sh
old mode 100644
new mode 100755
diff --git a/internal/c/mingw64/opt/bin/python-config.sh b/internal/c/mingw64/opt/bin/python-config.sh
old mode 100644
new mode 100755
diff --git a/internal/c/mingw64/opt/lib/itcl4.1.1/itclConfig.sh b/internal/c/mingw64/opt/lib/itcl4.1.1/itclConfig.sh
old mode 100644
new mode 100755
diff --git a/internal/c/mingw64/opt/lib/tcl8.6/tclConfig.sh b/internal/c/mingw64/opt/lib/tcl8.6/tclConfig.sh
old mode 100644
new mode 100755
diff --git a/internal/c/mingw64/opt/lib/tclConfig.sh b/internal/c/mingw64/opt/lib/tclConfig.sh
old mode 100644
new mode 100755
diff --git a/internal/c/mingw64/opt/lib/tdbc1.0.6/tdbcConfig.sh b/internal/c/mingw64/opt/lib/tdbc1.0.6/tdbcConfig.sh
old mode 100644
new mode 100755
diff --git a/internal/c/mingw64/opt/lib/tk8.6/tkConfig.sh b/internal/c/mingw64/opt/lib/tk8.6/tkConfig.sh
old mode 100644
new mode 100755
diff --git a/internal/c/mingw64/opt/lib/tkConfig.sh b/internal/c/mingw64/opt/lib/tkConfig.sh
old mode 100644
new mode 100755
diff --git a/internal/c/mingw64/opt/ssl/misc/CA.sh b/internal/c/mingw64/opt/ssl/misc/CA.sh
old mode 100644
new mode 100755
diff --git a/internal/c/msbin.c b/internal/c/msbin.c
index 85890be91..f623b7ab4 100644
--- a/internal/c/msbin.c
+++ b/internal/c/msbin.c
@@ -214,7 +214,7 @@ int32 _dieeetomsbin(double *src8, double *dest8)
/* Make a clobberable copy of the source number */
memcpy(ieee,src8,8); //strncpy((char *)ieee,(char *)src8,8);
- for (i=0; i<8; i++) msbin[i] = 0;
+ memset(msbin, 0, sizeof(*dest8)); //for (i=0; i<8; i++) msbin[i] = 0;
/* If all are zero in src8, the msbin should be zero */
for (i=0; i<8; i++) any_on |= ieee[i];
@@ -222,12 +222,15 @@ int32 _dieeetomsbin(double *src8, double *dest8)
sign = ieee[7] & 0x80;
msbin[6] |= sign;
- msbin_exp = (unsigned)(ieee[7] & 0x7f) * 0x10;
+ msbin_exp = (unsigned)(ieee[7] & 0x7f) << 4; //(unsigned)(ieee[7] & 0x7f) * 0x10;
msbin_exp += ieee[6] >> 4;
- if (msbin_exp-0x3ff > 0x80) return 1;
-
- msbin[7] = msbin_exp - 0x3ff + 0x80 + 1;
+ // verify the exponent is in range for MBF encoding
+ msbin_exp = msbin_exp - 0x3ff + 0x80 + 1;
+ if ((msbin_exp & 0xff00) != 0) return 1;
+ msbin[7] = msbin_exp;
+ // if (msbin_exp-0x3ff > 0x80) return 1;
+ // msbin[7] = msbin_exp - 0x3ff + 0x80 + 1;
/* The ieee mantissa must be shifted up 3 bits */
ieee[6] &= 0x0f; /* mask out the exponent in the second byte */
diff --git a/internal/c/myip.cpp b/internal/c/myip.cpp
index 445074e42..bfb8e21bd 100644
--- a/internal/c/myip.cpp
+++ b/internal/c/myip.cpp
@@ -29,40 +29,22 @@
_DELAY 0.05 ' 50ms delay (20 checks per second)
GET #client, , a2$
a$ = a$ + a2$
- i = INSTR(a$, "Content-Length:")
- IF i THEN
- i2 = INSTR(i, a$, e$)
- IF i2 THEN
- l = VAL(MID$(a$, i + 15, i2 - i - 14))
- i3 = INSTR(i2, a$, e$ + e$)
- IF i3 THEN
- i3 = i3 + 4 'move i3 to start of data
- IF (LEN(a$) - i3 + 1) = l THEN
- CLOSE client ' CLOSE CLIENT
- d$ = MID$(a$, i3, l)
-
- 'check IP format:
- i = 0 'total dots
- x$ = "" 'current number
- FOR i2 = 1 TO LEN(d$)
- IF ASC(d$, i2) = 46 THEN
- IF LEN(x$) = 0 THEN EXIT FUNCTION
- x$ = ""
- i = i + 1
- IF i > 3 THEN EXIT FUNCTION
- ELSEIF ASC(d$, i2) < 48 OR ASC(d$, i2) > 57 THEN
- EXIT FUNCTION
- ELSE
- x$ = x$ + MID$(d$, i2, 1)
- END IF
- NEXT
-
- whatismyip$ = d$
- EXIT FUNCTION
- END IF ' availabledata = l
- END IF ' i3
- END IF ' i2
- END IF ' i
+ IF l = 0 THEN
+ i = INSTR(a$, e$ + e$)
+ IF i THEN
+ i2 = INSTR(i + 4, a$, e$)
+ IF i2 THEN
+ l = VAL("&H" + MID$(a$, i + 4, i2 - i - 2))
+ a$ = MID$(a$, i + 4 + i2 - i - 2)
+ END IF ' i2
+ END IF ' i
+ ELSE
+ IF LEN(a$) >= l THEN
+ whatismyip$ = LEFT$(a$, l)
+ CLOSE client
+ EXIT FUNCTION
+ END IF
+ END IF
LOOP UNTIL TIMER > t! + 5 ' (in seconds)
CLOSE client
END FUNCTION
@@ -77,8 +59,7 @@ qbs* WHATISMYIP(){ //changed name from FUNC_WHATISMYIP to WHATISMYIP
uint8 *tmp_mem_static_pointer=mem_static_pointer;
uint32 tmp_cmem_sp=cmem_sp;
-
- //data1.txt
+ // include "data1.txt"
qbs *_FUNC_WHATISMYIP_STRING_WHATISMYIP=NULL;
if (!_FUNC_WHATISMYIP_STRING_WHATISMYIP)_FUNC_WHATISMYIP_STRING_WHATISMYIP=qbs_new(0,0);
qbs *_FUNC_WHATISMYIP_STRING_URL=NULL;
@@ -87,77 +68,58 @@ qbs* WHATISMYIP(){ //changed name from FUNC_WHATISMYIP to WHATISMYIP
if (!_FUNC_WHATISMYIP_STRING_URL2)_FUNC_WHATISMYIP_STRING_URL2=qbs_new(0,0);
float *_FUNC_WHATISMYIP_SINGLE_X=NULL;
if(_FUNC_WHATISMYIP_SINGLE_X==NULL){
- _FUNC_WHATISMYIP_SINGLE_X=(float*)mem_static_malloc(4);
- *_FUNC_WHATISMYIP_SINGLE_X=0;
+ _FUNC_WHATISMYIP_SINGLE_X=(float*)mem_static_malloc(4);
+ *_FUNC_WHATISMYIP_SINGLE_X=0;
}
float *_FUNC_WHATISMYIP_SINGLE_CLIENT=NULL;
if(_FUNC_WHATISMYIP_SINGLE_CLIENT==NULL){
- _FUNC_WHATISMYIP_SINGLE_CLIENT=(float*)mem_static_malloc(4);
- *_FUNC_WHATISMYIP_SINGLE_CLIENT=0;
+ _FUNC_WHATISMYIP_SINGLE_CLIENT=(float*)mem_static_malloc(4);
+ *_FUNC_WHATISMYIP_SINGLE_CLIENT=0;
}
qbs *_FUNC_WHATISMYIP_STRING_E=NULL;
if (!_FUNC_WHATISMYIP_STRING_E)_FUNC_WHATISMYIP_STRING_E=qbs_new(0,0);
qbs *_FUNC_WHATISMYIP_STRING_URL3=NULL;
if (!_FUNC_WHATISMYIP_STRING_URL3)_FUNC_WHATISMYIP_STRING_URL3=qbs_new(0,0);
- byte_element_struct *byte_element_20=NULL;
- if (!byte_element_20){
- if ((mem_static_pointer+=12)chr,_FUNC_WHATISMYIP_STRING_X->len,byte_element_21),0);
+ sub_put2(qbr(*_FUNC_WHATISMYIP_SINGLE_CLIENT),NULL,byte_element((uint64)_FUNC_WHATISMYIP_STRING_X->chr,_FUNC_WHATISMYIP_STRING_X->len,byte_element_3),0);
qbs_cleanup(qbs_tmp_base,0);
*_FUNC_WHATISMYIP_SINGLE_T=func_timer(NULL,0);
do{
- sub__delay( 0.05E+0 );
- sub_get2(qbr(*_FUNC_WHATISMYIP_SINGLE_CLIENT),NULL,_FUNC_WHATISMYIP_STRING_A2,0);
- qbs_cleanup(qbs_tmp_base,0);
- qbs_set(_FUNC_WHATISMYIP_STRING_A,qbs_add(_FUNC_WHATISMYIP_STRING_A,_FUNC_WHATISMYIP_STRING_A2));
- qbs_cleanup(qbs_tmp_base,0);
- *_FUNC_WHATISMYIP_SINGLE_I=func_instr(NULL,_FUNC_WHATISMYIP_STRING_A,qbs_new_txt_len("Content-Length:",15),0);
- qbs_cleanup(qbs_tmp_base,0);
- if ((*_FUNC_WHATISMYIP_SINGLE_I)||new_error){
- *_FUNC_WHATISMYIP_SINGLE_I2=func_instr(qbr(*_FUNC_WHATISMYIP_SINGLE_I),_FUNC_WHATISMYIP_STRING_A,_FUNC_WHATISMYIP_STRING_E,1);
- qbs_cleanup(qbs_tmp_base,0);
- if ((*_FUNC_WHATISMYIP_SINGLE_I2)||new_error){
- *_FUNC_WHATISMYIP_SINGLE_L=func_val(func_mid(_FUNC_WHATISMYIP_STRING_A,qbr(*_FUNC_WHATISMYIP_SINGLE_I+ 15 ),qbr(*_FUNC_WHATISMYIP_SINGLE_I2-*_FUNC_WHATISMYIP_SINGLE_I- 14 ),1));
- qbs_cleanup(qbs_tmp_base,0);
- *_FUNC_WHATISMYIP_SINGLE_I3=func_instr(qbr(*_FUNC_WHATISMYIP_SINGLE_I2),_FUNC_WHATISMYIP_STRING_A,qbs_add(_FUNC_WHATISMYIP_STRING_E,_FUNC_WHATISMYIP_STRING_E),1);
- qbs_cleanup(qbs_tmp_base,0);
- if ((*_FUNC_WHATISMYIP_SINGLE_I3)||new_error){
- *_FUNC_WHATISMYIP_SINGLE_I3=*_FUNC_WHATISMYIP_SINGLE_I3+ 4 ;
- if ((qbs_cleanup(qbs_tmp_base,-(((float)((_FUNC_WHATISMYIP_STRING_A->len-*_FUNC_WHATISMYIP_SINGLE_I3+ 1 )))==((float)(*_FUNC_WHATISMYIP_SINGLE_L)))))||new_error){
- sub_close(qbr(*_FUNC_WHATISMYIP_SINGLE_CLIENT),1);
- qbs_set(_FUNC_WHATISMYIP_STRING_D,func_mid(_FUNC_WHATISMYIP_STRING_A,qbr(*_FUNC_WHATISMYIP_SINGLE_I3),qbr(*_FUNC_WHATISMYIP_SINGLE_L),1));
- qbs_cleanup(qbs_tmp_base,0);
- *_FUNC_WHATISMYIP_SINGLE_I= 0 ;
- qbs_set(_FUNC_WHATISMYIP_STRING_X,qbs_new_txt_len("",0));
- qbs_cleanup(qbs_tmp_base,0);
- fornext_value25= 1 ;
- fornext_finalvalue25=_FUNC_WHATISMYIP_STRING_D->len;
- fornext_step25= 1 ;
- if (fornext_step25<0) fornext_step_negative25=1; else fornext_step_negative25=0;
- if (new_error) goto fornext_error25;
- goto fornext_entrylabel25;
- while(1){
- fornext_value25=fornext_step25+(*_FUNC_WHATISMYIP_SINGLE_I2);
- fornext_entrylabel25:
- *_FUNC_WHATISMYIP_SINGLE_I2=fornext_value25;
- qbs_cleanup(qbs_tmp_base,0);
- if (fornext_step_negative25){
- if (fornext_value25fornext_finalvalue25) break;
- }
- fornext_error25:;
- if ((qbs_cleanup(qbs_tmp_base,-(qbs_asc(_FUNC_WHATISMYIP_STRING_D,qbr(*_FUNC_WHATISMYIP_SINGLE_I2))== 46 )))||new_error){
- if ((qbs_cleanup(qbs_tmp_base,-(_FUNC_WHATISMYIP_STRING_X->len== 0 )))||new_error){
- goto exit_subfunc;
- }
- qbs_set(_FUNC_WHATISMYIP_STRING_X,qbs_new_txt_len("",0));
- qbs_cleanup(qbs_tmp_base,0);
- *_FUNC_WHATISMYIP_SINGLE_I=*_FUNC_WHATISMYIP_SINGLE_I+ 1 ;
- if ((-(*_FUNC_WHATISMYIP_SINGLE_I> 3 ))||new_error){
- goto exit_subfunc;
- }
- }else{
- if (qbs_cleanup(qbs_tmp_base,(-(qbs_asc(_FUNC_WHATISMYIP_STRING_D,qbr(*_FUNC_WHATISMYIP_SINGLE_I2))< 48 ))|(-(qbs_asc(_FUNC_WHATISMYIP_STRING_D,qbr(*_FUNC_WHATISMYIP_SINGLE_I2))> 57 )))){
- goto exit_subfunc;
- }else{
- qbs_set(_FUNC_WHATISMYIP_STRING_X,qbs_add(_FUNC_WHATISMYIP_STRING_X,func_mid(_FUNC_WHATISMYIP_STRING_D,qbr(*_FUNC_WHATISMYIP_SINGLE_I2), 1 ,1)));
- qbs_cleanup(qbs_tmp_base,0);
- }
- }
- fornext_continue_24:;
- }
- fornext_exit_24:;
- qbs_set(_FUNC_WHATISMYIP_STRING_WHATISMYIP,_FUNC_WHATISMYIP_STRING_D);
- qbs_cleanup(qbs_tmp_base,0);
- goto exit_subfunc;
- }
- }
- }
- }
- dl_continue_22:;
+ sub__delay( 0.05E+0 );
+ sub_get2(qbr(*_FUNC_WHATISMYIP_SINGLE_CLIENT),NULL,_FUNC_WHATISMYIP_STRING_A2,0);
+ qbs_cleanup(qbs_tmp_base,0);
+ qbs_set(_FUNC_WHATISMYIP_STRING_A,qbs_add(_FUNC_WHATISMYIP_STRING_A,_FUNC_WHATISMYIP_STRING_A2));
+ qbs_cleanup(qbs_tmp_base,0);
+ if ((-(*_FUNC_WHATISMYIP_SINGLE_L== 0 ))||new_error){
+ *_FUNC_WHATISMYIP_SINGLE_I=func_instr(NULL,_FUNC_WHATISMYIP_STRING_A,qbs_add(_FUNC_WHATISMYIP_STRING_E,_FUNC_WHATISMYIP_STRING_E),0);
+ qbs_cleanup(qbs_tmp_base,0);
+ if ((*_FUNC_WHATISMYIP_SINGLE_I)||new_error){
+ *_FUNC_WHATISMYIP_SINGLE_I2=func_instr(qbr(*_FUNC_WHATISMYIP_SINGLE_I+ 4 ),_FUNC_WHATISMYIP_STRING_A,_FUNC_WHATISMYIP_STRING_E,1);
+ qbs_cleanup(qbs_tmp_base,0);
+ if ((*_FUNC_WHATISMYIP_SINGLE_I2)||new_error){
+ *_FUNC_WHATISMYIP_SINGLE_L=func_val(qbs_add(qbs_new_txt_len("&H",2),func_mid(_FUNC_WHATISMYIP_STRING_A,qbr(*_FUNC_WHATISMYIP_SINGLE_I+ 4 ),qbr(*_FUNC_WHATISMYIP_SINGLE_I2-*_FUNC_WHATISMYIP_SINGLE_I- 2 ),1)));
+ qbs_cleanup(qbs_tmp_base,0);
+ qbs_set(_FUNC_WHATISMYIP_STRING_A,func_mid(_FUNC_WHATISMYIP_STRING_A,qbr(*_FUNC_WHATISMYIP_SINGLE_I+ 4 +*_FUNC_WHATISMYIP_SINGLE_I2-*_FUNC_WHATISMYIP_SINGLE_I- 2 ),NULL,0));
+ qbs_cleanup(qbs_tmp_base,0);
+ }
+ }
+ }else{
+ if ((qbs_cleanup(qbs_tmp_base,-(_FUNC_WHATISMYIP_STRING_A->len>=*_FUNC_WHATISMYIP_SINGLE_L)))||new_error){
+ qbs_set(_FUNC_WHATISMYIP_STRING_WHATISMYIP,qbs_left(_FUNC_WHATISMYIP_STRING_A,qbr(*_FUNC_WHATISMYIP_SINGLE_L)));
+ qbs_cleanup(qbs_tmp_base,0);
+ sub_close(qbr(*_FUNC_WHATISMYIP_SINGLE_CLIENT),1);
+ goto exit_subfunc;
+ }
+ }
+ dl_continue_4:;
}while((!(-(((float)((func_timer(NULL,0))))>((float)((*_FUNC_WHATISMYIP_SINGLE_T+ 5 ))))))&&(!new_error));
- dl_exit_22:;
+ dl_exit_4:;
sub_close(qbr(*_FUNC_WHATISMYIP_SINGLE_CLIENT),1);
exit_subfunc:;
free_mem_lock(sf_mem_lock);
-
- //"free1.txt"
+ // include "free1.txt"
qbs_free(_FUNC_WHATISMYIP_STRING_URL);
qbs_free(_FUNC_WHATISMYIP_STRING_URL2);
qbs_free(_FUNC_WHATISMYIP_STRING_E);
@@ -275,9 +193,8 @@ qbs* WHATISMYIP(){ //changed name from FUNC_WHATISMYIP to WHATISMYIP
qbs_free(_FUNC_WHATISMYIP_STRING_X);
qbs_free(_FUNC_WHATISMYIP_STRING_A2);
qbs_free(_FUNC_WHATISMYIP_STRING_A);
- qbs_free(_FUNC_WHATISMYIP_STRING_D);
-
-
+ // end of "free1.txt"
+
if ((tmp_mem_static_pointer>=mem_static)&&(tmp_mem_static_pointer<=mem_static_limit)) mem_static_pointer=tmp_mem_static_pointer; else mem_static_pointer=mem_static;
cmem_sp=tmp_cmem_sp;
qbs_maketmp(_FUNC_WHATISMYIP_STRING_WHATISMYIP);return _FUNC_WHATISMYIP_STRING_WHATISMYIP;
diff --git a/internal/c/os.h b/internal/c/os.h
index 85b27e76e..869121445 100644
--- a/internal/c/os.h
+++ b/internal/c/os.h
@@ -34,12 +34,16 @@
#error "Unknown system; refusing to build. Edit os.h if needed"
#endif
-#if defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__) || defined(QB64_MACOSX)
+#if defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__) || defined(QB64_MACOSX) || defined(__aarch64__)
#define QB64_64
#else
#define QB64_32
#endif
+#if !defined(i386) && !defined(__x86_64__)
+ #define QB64_NOT_X86
+#endif
+
/* common types (not quite an include guard, but allows an including
* file to not have these included.
*
diff --git a/internal/c/parts/audio/conversion/os/osx/build.command b/internal/c/parts/audio/conversion/os/osx/build.command
old mode 100644
new mode 100755
index f376f5474..42121347c
--- a/internal/c/parts/audio/conversion/os/osx/build.command
+++ b/internal/c/parts/audio/conversion/os/osx/build.command
@@ -1,5 +1,5 @@
cd "$(dirname "$0")"
-gcc -c ../../src/resample.c -o temp/resample.o
+clang -c ../../src/resample.c -o temp/resample.o
ar rcs src.a temp/resample.o
echo "Press any key to continue..."
Pause()
diff --git a/internal/c/parts/audio/decode/mp3_mini/os/osx/build.command b/internal/c/parts/audio/decode/mp3_mini/os/osx/build.command
old mode 100644
new mode 100755
index dabea0015..54115af58
--- a/internal/c/parts/audio/decode/mp3_mini/os/osx/build.command
+++ b/internal/c/parts/audio/decode/mp3_mini/os/osx/build.command
@@ -1,5 +1,5 @@
cd "$(dirname "$0")"
-gcc -c ../../src/minimp3.c -o temp/minimp3.o
+clang -c ../../src/minimp3.c -o temp/minimp3.o
ar rcs src.a temp/minimp3.o
echo "Press any key to continue..."
Pause()
diff --git a/internal/c/parts/audio/decode/mp3_mini/src/libc.h b/internal/c/parts/audio/decode/mp3_mini/src/libc.h
index 80a600df5..0294972fd 100644
--- a/internal/c/parts/audio/decode/mp3_mini/src/libc.h
+++ b/internal/c/parts/audio/decode/mp3_mini/src/libc.h
@@ -54,10 +54,12 @@
typedef unsigned __int64 uint64_t;
typedef signed __int64 int64_t;
#else
- typedef unsigned long long uint64_t;
- typedef signed long long int64_t;
- // typedef __uint64_t uint64_t;
- // typedef __int64_t int64_t;
+ #ifndef UINT64_MAX
+ typedef unsigned long long uint64_t;
+ #endif
+ #ifndef INT64_MAX
+ typedef signed long long int64_t;
+ #endif
#endif
#endif
diff --git a/internal/c/parts/audio/decode/ogg/os/osx/build.command b/internal/c/parts/audio/decode/ogg/os/osx/build.command
old mode 100644
new mode 100755
index 3f6f4a6f6..7622b01d4
--- a/internal/c/parts/audio/decode/ogg/os/osx/build.command
+++ b/internal/c/parts/audio/decode/ogg/os/osx/build.command
@@ -1,5 +1,5 @@
cd "$(dirname "$0")"
-gcc -c ../../src/stb_vorbis.c -o src.o
+clang -c ../../src/stb_vorbis.c -o src.o
echo "Press any key to continue..."
Pause()
{
diff --git a/internal/c/parts/audio/decode/src.c b/internal/c/parts/audio/decode/src.c
index 455de635d..49f2d2e32 100644
--- a/internal/c/parts/audio/decode/src.c
+++ b/internal/c/parts/audio/decode/src.c
@@ -244,6 +244,61 @@ got_seq:
return handle;
}
+mem_block func__memsound(int32 i,int32 targetChannel){
+
+ static mem_block b;
+
+ if (new_error) goto error;
+ if (i<=0) goto error;
+
+ sndsetup();
+
+ static snd_struct *sn;
+ sn = (snd_struct*)list_get(snd_handles, i);
+ if (!sn){
+ goto error;
+ }
+ if (!snd_allow_internal){
+ if (sn->internal){
+ goto error;
+ }
+ }
+ if (targetChannel<1 || targetChannel>sn->seq->channels) goto error;
+
+ if (sn->lock_id){
+ b.lock_offset=(ptrszint)sn->lock_offset; b.lock_id=sn->lock_id;//get existing tag
+ }else{
+ new_mem_lock();
+ mem_lock_tmp->type=5;//sound
+ b.lock_offset=(ptrszint)mem_lock_tmp; b.lock_id=mem_lock_id;
+ sn->lock_offset=(void*)mem_lock_tmp; sn->lock_id=mem_lock_id;//create tag
+ }
+
+ if (targetChannel==1) {
+ b.offset=(ptrszint)sn->seq->data_left;
+ b.size=sn->seq->data_left_size;
+ }
+
+ if (targetChannel==2) {
+ b.offset=(ptrszint)sn->seq->data_right;
+ b.size=sn->seq->data_right_size;
+ }
+
+ b.type=0;//sn->bytes_per_pixel+128+1024+2048;//integer+unsigned+pixeltype
+ b.elementsize=sn->seq->bits_per_sample/8;
+ b.sound=i;
+
+ return b;
+ error:
+ b.offset=0;
+ b.size=0;
+ b.lock_offset=(ptrszint)mem_lock_base; b.lock_id=1073741821;//set invalid lock
+ b.type=0;
+ b.elementsize=0;
+ b.sound=0;
+ return b;
+}
+
void sub__sndplayfile(qbs *filename, int32 sync, double volume, int32 passed){
if (new_error) return;
diff --git a/internal/c/parts/audio/out/android/Android.mk b/internal/c/parts/audio/out/android/Android.mk
deleted file mode 100644
index 5d673bea2..000000000
--- a/internal/c/parts/audio/out/android/Android.mk
+++ /dev/null
@@ -1,105 +0,0 @@
-ifeq ("$(ROOTDIR)","")
- LOCAL_PATH := $(call my-dir)
-else
- LOCAL_PATH := $(ROOTDIR)
-endif
-
-ANALYZE ?= no
-ANALYZE_OUTPUT?=/dev/null
-
-include $(CLEAR_VARS)
-TARGET_ARCH_ABI ?=armeabi-v7a
-LOCAL_LDLIBS := -llog
-LOCAL_MODULE := openal
-LOCAL_ARM_MODE := arm
-CLANG_VERSION ?= 3.1
-ROOTDIR ?= $(LOCAL_PATH)
-OPENAL_DIR := OpenAL
-MODULE := openal
-MODULE_DST := obj/local/$(TARGET_ARCH_ABI)/objs/openal
-ifeq ("$(BINDIR)","")
- BINDIR := $(abspath $(ROOTDIR)/../obj/local/$(TARGET_ARCH_ABI)/objs/ )
-else
- BINDIR := $(abspath $(BINDIR) )
-endif
-
-ANDROID_NDK_ROOT=/Developer/DestinyCloudFist/android-ndk-r8b
-
-LOCAL_CFLAGS += -I$(ROOTDIR)/$(OPENAL_DIR) \
- -I$(ROOTDIR)/$(OPENAL_DIR)/include \
- -I$(ROOTDIR)/$(OPENAL_DIR)/OpenAL32/Include \
- -DAL_ALEXT_PROTOTYPES \
- -DANDROID \
- -fpic \
- -ffunction-sections \
- -funwind-tables \
- -fstack-protector \
- -fno-short-enums \
- -DHAVE_GCC_VISIBILITY \
- -O3 \
- -g \
-
-LOCAL_LDLIBS += -Wl,--build-id -Bsymbolic -shared
-
-# Default to Fixed-point math
-ifeq ($(TARGET_ARCH_ABI),armeabi)
- # ARMv5, used fixed point math
- LOCAL_CFLAGS += -marm -DOPENAL_FIXED_POINT -DOPENAL_FIXED_POINT_SHIFT=16
-endif
-
-
-MAX_SOURCES_LOW ?= 4
-MAX_SOURCES_START ?= 8
-MAX_SOURCES_HIGH ?= 64
-LOCAL_CFLAGS += -DMAX_SOURCES_LOW=$(MAX_SOURCES_LOW) -DMAX_SOURCES_START=$(MAX_SOURCES_START) -DMAX_SOURCES_HIGH=$(MAX_SOURCES_HIGH)
-
-LOCAL_SRC_FILES := \
- $(OPENAL_DIR)/Alc/android.c \
- $(OPENAL_DIR)/OpenAL32/alAuxEffectSlot.c \
- $(OPENAL_DIR)/OpenAL32/alBuffer.c \
- $(OPENAL_DIR)/OpenAL32/alDatabuffer.c \
- $(OPENAL_DIR)/OpenAL32/alEffect.c \
- $(OPENAL_DIR)/OpenAL32/alError.c \
- $(OPENAL_DIR)/OpenAL32/alExtension.c \
- $(OPENAL_DIR)/OpenAL32/alFilter.c \
- $(OPENAL_DIR)/OpenAL32/alListener.c \
- $(OPENAL_DIR)/OpenAL32/alSource.c \
- $(OPENAL_DIR)/OpenAL32/alState.c \
- $(OPENAL_DIR)/OpenAL32/alThunk.c \
- $(OPENAL_DIR)/Alc/ALc.c \
- $(OPENAL_DIR)/Alc/alcConfig.c \
- $(OPENAL_DIR)/Alc/alcEcho.c \
- $(OPENAL_DIR)/Alc/alcModulator.c \
- $(OPENAL_DIR)/Alc/alcReverb.c \
- $(OPENAL_DIR)/Alc/alcRing.c \
- $(OPENAL_DIR)/Alc/alcThread.c \
- $(OPENAL_DIR)/Alc/ALu.c \
- $(OPENAL_DIR)/Alc/bs2b.c \
- $(OPENAL_DIR)/Alc/null.c \
- $(OPENAL_DIR)/Alc/panning.c \
- $(OPENAL_DIR)/Alc/mixer.c \
- $(OPENAL_DIR)/Alc/audiotrack.c \
-
-
-# If building for versions after FROYO
-ifeq ($(POST_FROYO), yes)
- LOCAL_CFLAGS += -DPOST_FROYO -I$(ANDROID_NDK_ROOT)/platforms/android-9/arch-arm/usr/include/
- LOCAL_LDLIBS += -ldl -L$(ANDROID_NDK_ROOT)/platforms/android-9/arch-arm/usr/lib/
- LOCAL_SRC_FILES += $(OPENAL_DIR)/Alc/opensles.c
-endif
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-include $(BUILD_SHARED_LIBRARY)
-
diff --git a/internal/c/parts/audio/out/android/Application.mk b/internal/c/parts/audio/out/android/Application.mk
deleted file mode 100644
index fab0d7e5d..000000000
--- a/internal/c/parts/audio/out/android/Application.mk
+++ /dev/null
@@ -1,3 +0,0 @@
-APP_ABI := $(TARGET_ARCH_ABI)
-# $(warning APP_ABI $(APP_ABI))
-# $(warning LOCAL_ARM_NEON $(LOCAL_ARM_NEON))
diff --git a/internal/c/parts/audio/out/android/OpenAL/Alc/AL/al.h b/internal/c/parts/audio/out/android/OpenAL/Alc/AL/al.h
deleted file mode 100644
index e084b3ed3..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Alc/AL/al.h
+++ /dev/null
@@ -1,825 +0,0 @@
-#ifndef AL_AL_H
-#define AL_AL_H
-
-#ifdef ANDROID
-#include
-#ifndef LOGI
-#define LOGI(...) __android_log_print(ANDROID_LOG_INFO,"OpenAL",__VA_ARGS__)
-#endif
-#ifndef LOGE
-#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,"OpenAL",__VA_ARGS__)
-#endif
-#endif
-
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
-#if defined(AL_LIBTYPE_STATIC)
- #define AL_API
-#elif defined(_WIN32) && !defined(_XBOX)
- #if defined(AL_BUILD_LIBRARY)
- #define AL_API __declspec(dllexport)
- #else
- #define AL_API __declspec(dllimport)
- #endif
-#else
- #if defined(AL_BUILD_LIBRARY) && defined(HAVE_GCC_VISIBILITY)
- #define AL_API __attribute__((visibility("protected")))
- #else
- #define AL_API extern
- #endif
-#endif
-
-#if defined(_WIN32)
- #define AL_APIENTRY __cdecl
-#else
- #define AL_APIENTRY
-#endif
-
-#if defined(TARGET_OS_MAC) && TARGET_OS_MAC
- #pragma export on
-#endif
-
-/*
- * The OPENAL, ALAPI, ALAPIENTRY, AL_INVALID, AL_ILLEGAL_ENUM, and
- * AL_ILLEGAL_COMMAND macros are deprecated, but are included for
- * applications porting code from AL 1.0
- */
-#define OPENAL
-#define ALAPI AL_API
-#define ALAPIENTRY AL_APIENTRY
-#define AL_INVALID (-1)
-#define AL_ILLEGAL_ENUM AL_INVALID_ENUM
-#define AL_ILLEGAL_COMMAND AL_INVALID_OPERATION
-
-#define AL_VERSION_1_0
-#define AL_VERSION_1_1
-
-
-/** 8-bit boolean */
-typedef char ALboolean;
-
-/** character */
-typedef char ALchar;
-
-/** signed 8-bit 2's complement integer */
-typedef signed char ALbyte;
-
-/** unsigned 8-bit integer */
-typedef unsigned char ALubyte;
-
-/** signed 16-bit 2's complement integer */
-typedef short ALshort;
-
-/** unsigned 16-bit integer */
-typedef unsigned short ALushort;
-
-/** signed 32-bit 2's complement integer */
-typedef int ALint;
-
-/** unsigned 32-bit integer */
-typedef unsigned int ALuint;
-
-/** non-negative 32-bit binary integer size */
-typedef int ALsizei;
-
-/** enumerated 32-bit value */
-typedef int ALenum;
-
-/** 32-bit IEEE754 floating-point */
-typedef float ALfloat;
-
-/** 64-bit IEEE754 floating-point */
-typedef double ALdouble;
-
-#ifdef OPENAL_FIXED_POINT
-/* Apportable tries to define int64_t and int32_t if it thinks it is needed.
- * But this is breaking in a complex project involving both pure C and C++
- * something is triggering redefinition errors. The workaround seems to be just using stdint.h.
- */
-#include
-/** Types and Macros for fixed-point math */
-#ifndef INT64_MAX
-typedef long long int64_t;
-#define INT64_MAX 9223372036854775807LL
-
-#endif
-#ifndef INT32_MAX
-typedef int int32_t;
-#define INT32_MAX 2147483647
-#endif
-
-// FIXME(apportable) make this int32_t
-typedef int64_t ALfp;
-typedef int64_t ALdfp;
-
-#define ONE (1<=0 ? 0.5 : -0.5)))
-#define ALfp2float(x) ((float)(x) / (1<=0 ? 0.5 : -0.5)))
-#define ALdfp2double(x) ((double)(x) / (1<> OPENAL_FIXED_POINT_SHIFT))
-
-#define int2ALdfp(x) ((ALdfp)(x) << OPENAL_FIXED_POINT_SHIFT)
-#define ALdfp2int(x) ((ALint)((x) >> OPENAL_FIXED_POINT_SHIFT))
-
-#define ALfpMult(x,y) ((ALfp)((((int64_t)(x))*((int64_t)(y)))>>OPENAL_FIXED_POINT_SHIFT))
-#define ALfpDiv(x,y) ((ALfp)(((int64_t)(x) << OPENAL_FIXED_POINT_SHIFT) / (y)))
-
-#define ALdfpMult(x,y) ALfpMult(x,y)
-#define ALdfpDiv(x,y) ALfpDiv(x,y)
-
-#define __isnan(x) (0)
-#define __cos(x) (float2ALfp(cos(ALfp2float(x))))
-#define __sin(x) (float2ALfp(sin(ALfp2float(x))))
-#define __log10(x) (float2ALfp(log10(ALfp2float(x))))
-#define __atan(x) (float2ALfp(atan(ALfp2float(x))))
-
-#define toALfpConst(x) ((x)*(1< Hz
- */
-#define ALC_FREQUENCY 0x1007
-
-/**
- * followed by Hz
- */
-#define ALC_REFRESH 0x1008
-
-/**
- * followed by AL_TRUE, AL_FALSE
- */
-#define ALC_SYNC 0x1009
-
-/**
- * followed by Num of requested Mono (3D) Sources
- */
-#define ALC_MONO_SOURCES 0x1010
-
-/**
- * followed by Num of requested Stereo Sources
- */
-#define ALC_STEREO_SOURCES 0x1011
-
-/**
- * errors
- */
-
-/**
- * No error
- */
-#define ALC_NO_ERROR ALC_FALSE
-
-/**
- * No device
- */
-#define ALC_INVALID_DEVICE 0xA001
-
-/**
- * invalid context ID
- */
-#define ALC_INVALID_CONTEXT 0xA002
-
-/**
- * bad enum
- */
-#define ALC_INVALID_ENUM 0xA003
-
-/**
- * bad value
- */
-#define ALC_INVALID_VALUE 0xA004
-
-/**
- * Out of memory.
- */
-#define ALC_OUT_OF_MEMORY 0xA005
-
-
-/**
- * The Specifier string for default device
- */
-#define ALC_DEFAULT_DEVICE_SPECIFIER 0x1004
-#define ALC_DEVICE_SPECIFIER 0x1005
-#define ALC_EXTENSIONS 0x1006
-
-#define ALC_MAJOR_VERSION 0x1000
-#define ALC_MINOR_VERSION 0x1001
-
-#define ALC_ATTRIBUTES_SIZE 0x1002
-#define ALC_ALL_ATTRIBUTES 0x1003
-
-
-/**
- * Capture extension
- */
-#define ALC_CAPTURE_DEVICE_SPECIFIER 0x310
-#define ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER 0x311
-#define ALC_CAPTURE_SAMPLES 0x312
-
-
-/*
- * Context Management
- */
-ALC_API ALCcontext * ALC_APIENTRY alcCreateContext( ALCdevice *device, const ALCint* attrlist );
-
-ALC_API ALCboolean ALC_APIENTRY alcMakeContextCurrent( ALCcontext *context );
-
-ALC_API void ALC_APIENTRY alcProcessContext( ALCcontext *context );
-
-ALC_API void ALC_APIENTRY alcSuspendContext( ALCcontext *context );
-
-ALC_API void ALC_APIENTRY alcDestroyContext( ALCcontext *context );
-
-ALC_API ALCcontext * ALC_APIENTRY alcGetCurrentContext( void );
-
-ALC_API ALCdevice* ALC_APIENTRY alcGetContextsDevice( ALCcontext *context );
-
-
-/*
- * Device Management
- */
-ALC_API ALCdevice * ALC_APIENTRY alcOpenDevice( const ALCchar *devicename );
-
-ALC_API ALCboolean ALC_APIENTRY alcCloseDevice( ALCdevice *device );
-
-
-/*
- * Error support.
- * Obtain the most recent Context error
- */
-ALC_API ALCenum ALC_APIENTRY alcGetError( ALCdevice *device );
-
-
-/*
- * Extension support.
- * Query for the presence of an extension, and obtain any appropriate
- * function pointers and enum values.
- */
-ALC_API ALCboolean ALC_APIENTRY alcIsExtensionPresent( ALCdevice *device, const ALCchar *extname );
-
-ALC_API void * ALC_APIENTRY alcGetProcAddress( ALCdevice *device, const ALCchar *funcname );
-
-ALC_API ALCenum ALC_APIENTRY alcGetEnumValue( ALCdevice *device, const ALCchar *enumname );
-
-
-/*
- * Query functions
- */
-ALC_API const ALCchar * ALC_APIENTRY alcGetString( ALCdevice *device, ALCenum param );
-
-ALC_API void ALC_APIENTRY alcGetIntegerv( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *data );
-
-
-/*
- * Capture functions
- */
-ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize );
-
-ALC_API ALCboolean ALC_APIENTRY alcCaptureCloseDevice( ALCdevice *device );
-
-ALC_API void ALC_APIENTRY alcCaptureStart( ALCdevice *device );
-
-ALC_API void ALC_APIENTRY alcCaptureStop( ALCdevice *device );
-
-ALC_API void ALC_APIENTRY alcCaptureSamples( ALCdevice *device, ALCvoid *buffer, ALCsizei samples );
-
-/*
- * Pointer-to-function types, useful for dynamically getting ALC entry points.
- */
-typedef ALCcontext * (ALC_APIENTRY *LPALCCREATECONTEXT) (ALCdevice *device, const ALCint *attrlist);
-typedef ALCboolean (ALC_APIENTRY *LPALCMAKECONTEXTCURRENT)( ALCcontext *context );
-typedef void (ALC_APIENTRY *LPALCPROCESSCONTEXT)( ALCcontext *context );
-typedef void (ALC_APIENTRY *LPALCSUSPENDCONTEXT)( ALCcontext *context );
-typedef void (ALC_APIENTRY *LPALCDESTROYCONTEXT)( ALCcontext *context );
-typedef ALCcontext * (ALC_APIENTRY *LPALCGETCURRENTCONTEXT)( void );
-typedef ALCdevice * (ALC_APIENTRY *LPALCGETCONTEXTSDEVICE)( ALCcontext *context );
-typedef ALCdevice * (ALC_APIENTRY *LPALCOPENDEVICE)( const ALCchar *devicename );
-typedef ALCboolean (ALC_APIENTRY *LPALCCLOSEDEVICE)( ALCdevice *device );
-typedef ALCenum (ALC_APIENTRY *LPALCGETERROR)( ALCdevice *device );
-typedef ALCboolean (ALC_APIENTRY *LPALCISEXTENSIONPRESENT)( ALCdevice *device, const ALCchar *extname );
-typedef void * (ALC_APIENTRY *LPALCGETPROCADDRESS)(ALCdevice *device, const ALCchar *funcname );
-typedef ALCenum (ALC_APIENTRY *LPALCGETENUMVALUE)(ALCdevice *device, const ALCchar *enumname );
-typedef const ALCchar* (ALC_APIENTRY *LPALCGETSTRING)( ALCdevice *device, ALCenum param );
-typedef void (ALC_APIENTRY *LPALCGETINTEGERV)( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *dest );
-typedef ALCdevice * (ALC_APIENTRY *LPALCCAPTUREOPENDEVICE)( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize );
-typedef ALCboolean (ALC_APIENTRY *LPALCCAPTURECLOSEDEVICE)( ALCdevice *device );
-typedef void (ALC_APIENTRY *LPALCCAPTURESTART)( ALCdevice *device );
-typedef void (ALC_APIENTRY *LPALCCAPTURESTOP)( ALCdevice *device );
-typedef void (ALC_APIENTRY *LPALCCAPTURESAMPLES)( ALCdevice *device, ALCvoid *buffer, ALCsizei samples );
-
-#if defined(TARGET_OS_MAC) && TARGET_OS_MAC
- #pragma export off
-#endif
-
-#if defined(ANDROID)
-/*
- * OpenAL extension for suspend/resume of audio throughout application lifecycle
- */
-ALC_API void ALC_APIENTRY alcSuspend( void );
-ALC_API void ALC_APIENTRY alcResume( void );
-#endif
-
-#if defined(__cplusplus)
-}
-#endif
-
-#endif /* AL_ALC_H */
diff --git a/internal/c/parts/audio/out/android/OpenAL/Alc/AL/alext.h b/internal/c/parts/audio/out/android/OpenAL/Alc/AL/alext.h
deleted file mode 100644
index f3c7bcae8..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Alc/AL/alext.h
+++ /dev/null
@@ -1,165 +0,0 @@
-/**
- * OpenAL cross platform audio library
- * Copyright (C) 2008 by authors.
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- * Or go to http://www.gnu.org/copyleft/lgpl.html
- */
-
-#ifndef AL_ALEXT_H
-#define AL_ALEXT_H
-
-#include
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef AL_LOKI_IMA_ADPCM_format
-#define AL_LOKI_IMA_ADPCM_format 1
-#define AL_FORMAT_IMA_ADPCM_MONO16_EXT 0x10000
-#define AL_FORMAT_IMA_ADPCM_STEREO16_EXT 0x10001
-#endif
-
-#ifndef AL_LOKI_WAVE_format
-#define AL_LOKI_WAVE_format 1
-#define AL_FORMAT_WAVE_EXT 0x10002
-#endif
-
-#ifndef AL_EXT_vorbis
-#define AL_EXT_vorbis 1
-#define AL_FORMAT_VORBIS_EXT 0x10003
-#endif
-
-#ifndef AL_LOKI_quadriphonic
-#define AL_LOKI_quadriphonic 1
-#define AL_FORMAT_QUAD8_LOKI 0x10004
-#define AL_FORMAT_QUAD16_LOKI 0x10005
-#endif
-
-#ifndef AL_EXT_float32
-#define AL_EXT_float32 1
-#define AL_FORMAT_MONO_FLOAT32 0x10010
-#define AL_FORMAT_STEREO_FLOAT32 0x10011
-#endif
-
-#ifndef AL_EXT_double
-#define AL_EXT_double 1
-#define AL_FORMAT_MONO_DOUBLE_EXT 0x10012
-#define AL_FORMAT_STEREO_DOUBLE_EXT 0x10013
-#endif
-
-#ifndef ALC_LOKI_audio_channel
-#define ALC_LOKI_audio_channel 1
-#define ALC_CHAN_MAIN_LOKI 0x500001
-#define ALC_CHAN_PCM_LOKI 0x500002
-#define ALC_CHAN_CD_LOKI 0x500003
-#endif
-
-#ifndef ALC_ENUMERATE_ALL_EXT
-#define ALC_ENUMERATE_ALL_EXT 1
-#define ALC_DEFAULT_ALL_DEVICES_SPECIFIER 0x1012
-#define ALC_ALL_DEVICES_SPECIFIER 0x1013
-#endif
-
-#ifndef AL_EXT_MCFORMATS
-#define AL_EXT_MCFORMATS 1
-#define AL_FORMAT_QUAD8 0x1204
-#define AL_FORMAT_QUAD16 0x1205
-#define AL_FORMAT_QUAD32 0x1206
-#define AL_FORMAT_REAR8 0x1207
-#define AL_FORMAT_REAR16 0x1208
-#define AL_FORMAT_REAR32 0x1209
-#define AL_FORMAT_51CHN8 0x120A
-#define AL_FORMAT_51CHN16 0x120B
-#define AL_FORMAT_51CHN32 0x120C
-#define AL_FORMAT_61CHN8 0x120D
-#define AL_FORMAT_61CHN16 0x120E
-#define AL_FORMAT_61CHN32 0x120F
-#define AL_FORMAT_71CHN8 0x1210
-#define AL_FORMAT_71CHN16 0x1211
-#define AL_FORMAT_71CHN32 0x1212
-#endif
-
-#ifndef AL_EXT_MULAW_MCFORMATS
-#define AL_EXT_MULAW_MCFORMATS 1
-#define AL_FORMAT_MONO_MULAW 0x10014
-#define AL_FORMAT_STEREO_MULAW 0x10015
-#define AL_FORMAT_QUAD_MULAW 0x10021
-#define AL_FORMAT_REAR_MULAW 0x10022
-#define AL_FORMAT_51CHN_MULAW 0x10023
-#define AL_FORMAT_61CHN_MULAW 0x10024
-#define AL_FORMAT_71CHN_MULAW 0x10025
-#endif
-
-#ifndef AL_EXT_IMA4
-#define AL_EXT_IMA4 1
-#define AL_FORMAT_MONO_IMA4 0x1300
-#define AL_FORMAT_STEREO_IMA4 0x1301
-#endif
-
-#ifndef AL_EXT_STATIC_BUFFER
-#define AL_EXT_STATIC_BUFFER 1
-typedef ALvoid (AL_APIENTRY*PFNALBUFFERDATASTATICPROC)(const ALint,ALenum,ALvoid*,ALsizei,ALsizei);
-#ifdef AL_ALEXT_PROTOTYPES
-AL_API ALvoid AL_APIENTRY alBufferDataStatic(const ALint buffer, ALenum format, ALvoid *data, ALsizei len, ALsizei freq);
-#endif
-#endif
-
-#ifndef ALC_EXT_EFX
-#define ALC_EXT_EFX 1
-#include "efx.h"
-#endif
-
-#ifndef ALC_EXT_disconnect
-#define ALC_EXT_disconnect 1
-#define ALC_CONNECTED 0x313
-#endif
-
-#ifndef ALC_EXT_thread_local_context
-#define ALC_EXT_thread_local_context 1
-typedef ALCboolean (ALC_APIENTRY*PFNALCSETTHREADCONTEXTPROC)(ALCcontext *context);
-typedef ALCcontext* (ALC_APIENTRY*PFNALCGETTHREADCONTEXTPROC)(void);
-#ifdef AL_ALEXT_PROTOTYPES
-ALC_API ALCboolean ALC_APIENTRY alcSetThreadContext(ALCcontext *context);
-ALC_API ALCcontext* ALC_APIENTRY alcGetThreadContext(void);
-#endif
-#endif
-
-#ifndef AL_EXT_source_distance_model
-#define AL_EXT_source_distance_model 1
-#define AL_SOURCE_DISTANCE_MODEL 0x200
-#endif
-
-#ifndef AL_SOFT_buffer_sub_data
-#define AL_SOFT_buffer_sub_data 1
-#define AL_BYTE_RW_OFFSETS_SOFT 0x1031
-#define AL_SAMPLE_RW_OFFSETS_SOFT 0x1032
-typedef ALvoid (AL_APIENTRY*PFNALBUFFERSUBDATASOFTPROC)(ALuint,ALenum,const ALvoid*,ALsizei,ALsizei);
-#ifdef AL_ALEXT_PROTOTYPES
-AL_API ALvoid AL_APIENTRY alBufferSubDataSOFT(ALuint buffer,ALenum format,const ALvoid *data,ALsizei offset,ALsizei length);
-#endif
-#endif
-
-#ifndef AL_SOFT_loop_points
-#define AL_SOFT_loop_points 1
-#define AL_LOOP_POINTS_SOFT 0x2015
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/internal/c/parts/audio/out/android/OpenAL/Alc/AL/efx-creative.h b/internal/c/parts/audio/out/android/OpenAL/Alc/AL/efx-creative.h
deleted file mode 100644
index 0a04c982e..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Alc/AL/efx-creative.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* The tokens that would be defined here are already defined in efx.h. This
- * empty file is here to provide compatibility with Windows-based projects
- * that would include it. */
diff --git a/internal/c/parts/audio/out/android/OpenAL/Alc/AL/efx.h b/internal/c/parts/audio/out/android/OpenAL/Alc/AL/efx.h
deleted file mode 100644
index 0ccef95d6..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Alc/AL/efx.h
+++ /dev/null
@@ -1,758 +0,0 @@
-#ifndef AL_EFX_H
-#define AL_EFX_H
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define ALC_EXT_EFX_NAME "ALC_EXT_EFX"
-
-#define ALC_EFX_MAJOR_VERSION 0x20001
-#define ALC_EFX_MINOR_VERSION 0x20002
-#define ALC_MAX_AUXILIARY_SENDS 0x20003
-
-
-/* Listener properties. */
-#define AL_METERS_PER_UNIT 0x20004
-
-/* Source properties. */
-#define AL_DIRECT_FILTER 0x20005
-#define AL_AUXILIARY_SEND_FILTER 0x20006
-#define AL_AIR_ABSORPTION_FACTOR 0x20007
-#define AL_ROOM_ROLLOFF_FACTOR 0x20008
-#define AL_CONE_OUTER_GAINHF 0x20009
-#define AL_DIRECT_FILTER_GAINHF_AUTO 0x2000A
-#define AL_AUXILIARY_SEND_FILTER_GAIN_AUTO 0x2000B
-#define AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO 0x2000C
-
-
-/* Effect properties. */
-
-/* Reverb effect parameters */
-#define AL_REVERB_DENSITY 0x0001
-#define AL_REVERB_DIFFUSION 0x0002
-#define AL_REVERB_GAIN 0x0003
-#define AL_REVERB_GAINHF 0x0004
-#define AL_REVERB_DECAY_TIME 0x0005
-#define AL_REVERB_DECAY_HFRATIO 0x0006
-#define AL_REVERB_REFLECTIONS_GAIN 0x0007
-#define AL_REVERB_REFLECTIONS_DELAY 0x0008
-#define AL_REVERB_LATE_REVERB_GAIN 0x0009
-#define AL_REVERB_LATE_REVERB_DELAY 0x000A
-#define AL_REVERB_AIR_ABSORPTION_GAINHF 0x000B
-#define AL_REVERB_ROOM_ROLLOFF_FACTOR 0x000C
-#define AL_REVERB_DECAY_HFLIMIT 0x000D
-
-/* EAX Reverb effect parameters */
-#define AL_EAXREVERB_DENSITY 0x0001
-#define AL_EAXREVERB_DIFFUSION 0x0002
-#define AL_EAXREVERB_GAIN 0x0003
-#define AL_EAXREVERB_GAINHF 0x0004
-#define AL_EAXREVERB_GAINLF 0x0005
-#define AL_EAXREVERB_DECAY_TIME 0x0006
-#define AL_EAXREVERB_DECAY_HFRATIO 0x0007
-#define AL_EAXREVERB_DECAY_LFRATIO 0x0008
-#define AL_EAXREVERB_REFLECTIONS_GAIN 0x0009
-#define AL_EAXREVERB_REFLECTIONS_DELAY 0x000A
-#define AL_EAXREVERB_REFLECTIONS_PAN 0x000B
-#define AL_EAXREVERB_LATE_REVERB_GAIN 0x000C
-#define AL_EAXREVERB_LATE_REVERB_DELAY 0x000D
-#define AL_EAXREVERB_LATE_REVERB_PAN 0x000E
-#define AL_EAXREVERB_ECHO_TIME 0x000F
-#define AL_EAXREVERB_ECHO_DEPTH 0x0010
-#define AL_EAXREVERB_MODULATION_TIME 0x0011
-#define AL_EAXREVERB_MODULATION_DEPTH 0x0012
-#define AL_EAXREVERB_AIR_ABSORPTION_GAINHF 0x0013
-#define AL_EAXREVERB_HFREFERENCE 0x0014
-#define AL_EAXREVERB_LFREFERENCE 0x0015
-#define AL_EAXREVERB_ROOM_ROLLOFF_FACTOR 0x0016
-#define AL_EAXREVERB_DECAY_HFLIMIT 0x0017
-
-/* Chorus effect parameters */
-#define AL_CHORUS_WAVEFORM 0x0001
-#define AL_CHORUS_PHASE 0x0002
-#define AL_CHORUS_RATE 0x0003
-#define AL_CHORUS_DEPTH 0x0004
-#define AL_CHORUS_FEEDBACK 0x0005
-#define AL_CHORUS_DELAY 0x0006
-
-/* Distortion effect parameters */
-#define AL_DISTORTION_EDGE 0x0001
-#define AL_DISTORTION_GAIN 0x0002
-#define AL_DISTORTION_LOWPASS_CUTOFF 0x0003
-#define AL_DISTORTION_EQCENTER 0x0004
-#define AL_DISTORTION_EQBANDWIDTH 0x0005
-
-/* Echo effect parameters */
-#define AL_ECHO_DELAY 0x0001
-#define AL_ECHO_LRDELAY 0x0002
-#define AL_ECHO_DAMPING 0x0003
-#define AL_ECHO_FEEDBACK 0x0004
-#define AL_ECHO_SPREAD 0x0005
-
-/* Flanger effect parameters */
-#define AL_FLANGER_WAVEFORM 0x0001
-#define AL_FLANGER_PHASE 0x0002
-#define AL_FLANGER_RATE 0x0003
-#define AL_FLANGER_DEPTH 0x0004
-#define AL_FLANGER_FEEDBACK 0x0005
-#define AL_FLANGER_DELAY 0x0006
-
-/* Frequency shifter effect parameters */
-#define AL_FREQUENCY_SHIFTER_FREQUENCY 0x0001
-#define AL_FREQUENCY_SHIFTER_LEFT_DIRECTION 0x0002
-#define AL_FREQUENCY_SHIFTER_RIGHT_DIRECTION 0x0003
-
-/* Vocal morpher effect parameters */
-#define AL_VOCAL_MORPHER_PHONEMEA 0x0001
-#define AL_VOCAL_MORPHER_PHONEMEA_COARSE_TUNING 0x0002
-#define AL_VOCAL_MORPHER_PHONEMEB 0x0003
-#define AL_VOCAL_MORPHER_PHONEMEB_COARSE_TUNING 0x0004
-#define AL_VOCAL_MORPHER_WAVEFORM 0x0005
-#define AL_VOCAL_MORPHER_RATE 0x0006
-
-/* Pitchshifter effect parameters */
-#define AL_PITCH_SHIFTER_COARSE_TUNE 0x0001
-#define AL_PITCH_SHIFTER_FINE_TUNE 0x0002
-
-/* Ringmodulator effect parameters */
-#define AL_RING_MODULATOR_FREQUENCY 0x0001
-#define AL_RING_MODULATOR_HIGHPASS_CUTOFF 0x0002
-#define AL_RING_MODULATOR_WAVEFORM 0x0003
-
-/* Autowah effect parameters */
-#define AL_AUTOWAH_ATTACK_TIME 0x0001
-#define AL_AUTOWAH_RELEASE_TIME 0x0002
-#define AL_AUTOWAH_RESONANCE 0x0003
-#define AL_AUTOWAH_PEAK_GAIN 0x0004
-
-/* Compressor effect parameters */
-#define AL_COMPRESSOR_ONOFF 0x0001
-
-/* Equalizer effect parameters */
-#define AL_EQUALIZER_LOW_GAIN 0x0001
-#define AL_EQUALIZER_LOW_CUTOFF 0x0002
-#define AL_EQUALIZER_MID1_GAIN 0x0003
-#define AL_EQUALIZER_MID1_CENTER 0x0004
-#define AL_EQUALIZER_MID1_WIDTH 0x0005
-#define AL_EQUALIZER_MID2_GAIN 0x0006
-#define AL_EQUALIZER_MID2_CENTER 0x0007
-#define AL_EQUALIZER_MID2_WIDTH 0x0008
-#define AL_EQUALIZER_HIGH_GAIN 0x0009
-#define AL_EQUALIZER_HIGH_CUTOFF 0x000A
-
-/* Effect type */
-#define AL_EFFECT_FIRST_PARAMETER 0x0000
-#define AL_EFFECT_LAST_PARAMETER 0x8000
-#define AL_EFFECT_TYPE 0x8001
-
-/* Effect types, used with the AL_EFFECT_TYPE property */
-#define AL_EFFECT_NULL 0x0000
-#define AL_EFFECT_REVERB 0x0001
-#define AL_EFFECT_CHORUS 0x0002
-#define AL_EFFECT_DISTORTION 0x0003
-#define AL_EFFECT_ECHO 0x0004
-#define AL_EFFECT_FLANGER 0x0005
-#define AL_EFFECT_FREQUENCY_SHIFTER 0x0006
-#define AL_EFFECT_VOCAL_MORPHER 0x0007
-#define AL_EFFECT_PITCH_SHIFTER 0x0008
-#define AL_EFFECT_RING_MODULATOR 0x0009
-#define AL_EFFECT_AUTOWAH 0x000A
-#define AL_EFFECT_COMPRESSOR 0x000B
-#define AL_EFFECT_EQUALIZER 0x000C
-#define AL_EFFECT_EAXREVERB 0x8000
-
-/* Auxiliary Effect Slot properties. */
-#define AL_EFFECTSLOT_EFFECT 0x0001
-#define AL_EFFECTSLOT_GAIN 0x0002
-#define AL_EFFECTSLOT_AUXILIARY_SEND_AUTO 0x0003
-
-/* NULL Auxiliary Slot ID to disable a source send. */
-#define AL_EFFECTSLOT_NULL 0x0000
-
-
-/* Filter properties. */
-
-/* Lowpass filter parameters */
-#define AL_LOWPASS_GAIN 0x0001
-#define AL_LOWPASS_GAINHF 0x0002
-
-/* Highpass filter parameters */
-#define AL_HIGHPASS_GAIN 0x0001
-#define AL_HIGHPASS_GAINLF 0x0002
-
-/* Bandpass filter parameters */
-#define AL_BANDPASS_GAIN 0x0001
-#define AL_BANDPASS_GAINLF 0x0002
-#define AL_BANDPASS_GAINHF 0x0003
-
-/* Filter type */
-#define AL_FILTER_FIRST_PARAMETER 0x0000
-#define AL_FILTER_LAST_PARAMETER 0x8000
-#define AL_FILTER_TYPE 0x8001
-
-/* Filter types, used with the AL_FILTER_TYPE property */
-#define AL_FILTER_NULL 0x0000
-#define AL_FILTER_LOWPASS 0x0001
-#define AL_FILTER_HIGHPASS 0x0002
-#define AL_FILTER_BANDPASS 0x0003
-
-
-/* Effect object function types. */
-typedef void (AL_APIENTRY *LPALGENEFFECTS)(ALsizei, ALuint*);
-typedef void (AL_APIENTRY *LPALDELETEEFFECTS)(ALsizei, ALuint*);
-typedef ALboolean (AL_APIENTRY *LPALISEFFECT)(ALuint);
-typedef void (AL_APIENTRY *LPALEFFECTI)(ALuint, ALenum, ALint);
-typedef void (AL_APIENTRY *LPALEFFECTIV)(ALuint, ALenum, ALint*);
-typedef void (AL_APIENTRY *LPALEFFECTF)(ALuint, ALenum, ALfloat);
-typedef void (AL_APIENTRY *LPALEFFECTFV)(ALuint, ALenum, ALfloat*);
-typedef void (AL_APIENTRY *LPALGETEFFECTI)(ALuint, ALenum, ALint*);
-typedef void (AL_APIENTRY *LPALGETEFFECTIV)(ALuint, ALenum, ALint*);
-typedef void (AL_APIENTRY *LPALGETEFFECTF)(ALuint, ALenum, ALfloat*);
-typedef void (AL_APIENTRY *LPALGETEFFECTFV)(ALuint, ALenum, ALfloat*);
-
-/* Filter object function types. */
-typedef void (AL_APIENTRY *LPALGENFILTERS)(ALsizei, ALuint*);
-typedef void (AL_APIENTRY *LPALDELETEFILTERS)(ALsizei, ALuint*);
-typedef ALboolean (AL_APIENTRY *LPALISFILTER)(ALuint);
-typedef void (AL_APIENTRY *LPALFILTERI)(ALuint, ALenum, ALint);
-typedef void (AL_APIENTRY *LPALFILTERIV)(ALuint, ALenum, ALint*);
-typedef void (AL_APIENTRY *LPALFILTERF)(ALuint, ALenum, ALfloat);
-typedef void (AL_APIENTRY *LPALFILTERFV)(ALuint, ALenum, ALfloat*);
-typedef void (AL_APIENTRY *LPALGETFILTERI)(ALuint, ALenum, ALint*);
-typedef void (AL_APIENTRY *LPALGETFILTERIV)(ALuint, ALenum, ALint*);
-typedef void (AL_APIENTRY *LPALGETFILTERF)(ALuint, ALenum, ALfloat*);
-typedef void (AL_APIENTRY *LPALGETFILTERFV)(ALuint, ALenum, ALfloat*);
-
-/* Auxiliary Effect Slot object function types. */
-typedef void (AL_APIENTRY *LPALGENAUXILIARYEFFECTSLOTS)(ALsizei, ALuint*);
-typedef void (AL_APIENTRY *LPALDELETEAUXILIARYEFFECTSLOTS)(ALsizei, ALuint*);
-typedef ALboolean (AL_APIENTRY *LPALISAUXILIARYEFFECTSLOT)(ALuint);
-typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTI)(ALuint, ALenum, ALint);
-typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTIV)(ALuint, ALenum, ALint*);
-typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTF)(ALuint, ALenum, ALfloat);
-typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTFV)(ALuint, ALenum, ALfloat*);
-typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTI)(ALuint, ALenum, ALint*);
-typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTIV)(ALuint, ALenum, ALint*);
-typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTF)(ALuint, ALenum, ALfloat*);
-typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTFV)(ALuint, ALenum, ALfloat*);
-
-#ifdef AL_ALEXT_PROTOTYPES
-AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects);
-AL_API ALvoid AL_APIENTRY alDeleteEffects(ALsizei n, ALuint *effects);
-AL_API ALboolean AL_APIENTRY alIsEffect(ALuint effect);
-AL_API ALvoid AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint iValue);
-AL_API ALvoid AL_APIENTRY alEffectiv(ALuint effect, ALenum param, ALint *piValues);
-AL_API ALvoid AL_APIENTRY alEffectf(ALuint effect, ALenum param, ALfloat flValue);
-AL_API ALvoid AL_APIENTRY alEffectfv(ALuint effect, ALenum param, ALfloat *pflValues);
-AL_API ALvoid AL_APIENTRY alGetEffecti(ALuint effect, ALenum param, ALint *piValue);
-AL_API ALvoid AL_APIENTRY alGetEffectiv(ALuint effect, ALenum param, ALint *piValues);
-AL_API ALvoid AL_APIENTRY alGetEffectf(ALuint effect, ALenum param, ALfloat *pflValue);
-AL_API ALvoid AL_APIENTRY alGetEffectfv(ALuint effect, ALenum param, ALfloat *pflValues);
-
-AL_API ALvoid AL_APIENTRY alGenFilters(ALsizei n, ALuint *filters);
-AL_API ALvoid AL_APIENTRY alDeleteFilters(ALsizei n, ALuint *filters);
-AL_API ALboolean AL_APIENTRY alIsFilter(ALuint filter);
-AL_API ALvoid AL_APIENTRY alFilteri(ALuint filter, ALenum param, ALint iValue);
-AL_API ALvoid AL_APIENTRY alFilteriv(ALuint filter, ALenum param, ALint *piValues);
-AL_API ALvoid AL_APIENTRY alFilterf(ALuint filter, ALenum param, ALfloat flValue);
-AL_API ALvoid AL_APIENTRY alFilterfv(ALuint filter, ALenum param, ALfloat *pflValues);
-AL_API ALvoid AL_APIENTRY alGetFilteri(ALuint filter, ALenum param, ALint *piValue);
-AL_API ALvoid AL_APIENTRY alGetFilteriv(ALuint filter, ALenum param, ALint *piValues);
-AL_API ALvoid AL_APIENTRY alGetFilterf(ALuint filter, ALenum param, ALfloat *pflValue);
-AL_API ALvoid AL_APIENTRY alGetFilterfv(ALuint filter, ALenum param, ALfloat *pflValues);
-
-AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslots);
-AL_API ALvoid AL_APIENTRY alDeleteAuxiliaryEffectSlots(ALsizei n, ALuint *effectslots);
-AL_API ALboolean AL_APIENTRY alIsAuxiliaryEffectSlot(ALuint effectslot);
-AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint iValue);
-AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotiv(ALuint effectslot, ALenum param, ALint *piValues);
-AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotf(ALuint effectslot, ALenum param, ALfloat flValue);
-AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotfv(ALuint effectslot, ALenum param, ALfloat *pflValues);
-AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint *piValue);
-AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotiv(ALuint effectslot, ALenum param, ALint *piValues);
-AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotf(ALuint effectslot, ALenum param, ALfloat *pflValue);
-AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotfv(ALuint effectslot, ALenum param, ALfloat *pflValues);
-#endif
-
-/* Filter ranges and defaults. */
-
-/* Lowpass filter */
-#define LOWPASS_MIN_GAIN (0.0f)
-#define LOWPASS_MAX_GAIN (1.0f)
-#define LOWPASS_DEFAULT_GAIN (1.0f)
-
-#define LOWPASS_MIN_GAINHF (0.0f)
-#define LOWPASS_MAX_GAINHF (1.0f)
-#define LOWPASS_DEFAULT_GAINHF (1.0f)
-
-/* Highpass filter */
-#define HIGHPASS_MIN_GAIN (0.0f)
-#define HIGHPASS_MAX_GAIN (1.0f)
-#define HIGHPASS_DEFAULT_GAIN (1.0f)
-
-#define HIGHPASS_MIN_GAINLF (0.0f)
-#define HIGHPASS_MAX_GAINLF (1.0f)
-#define HIGHPASS_DEFAULT_GAINLF (1.0f)
-
-/* Bandpass filter */
-#define BANDPASS_MIN_GAIN (0.0f)
-#define BANDPASS_MAX_GAIN (1.0f)
-#define BANDPASS_DEFAULT_GAIN (1.0f)
-
-#define BANDPASS_MIN_GAINHF (0.0f)
-#define BANDPASS_MAX_GAINHF (1.0f)
-#define BANDPASS_DEFAULT_GAINHF (1.0f)
-
-#define BANDPASS_MIN_GAINLF (0.0f)
-#define BANDPASS_MAX_GAINLF (1.0f)
-#define BANDPASS_DEFAULT_GAINLF (1.0f)
-
-
-/* Effect parameter ranges and defaults. */
-
-/* Standard reverb effect */
-#define AL_REVERB_MIN_DENSITY (0.0f)
-#define AL_REVERB_MAX_DENSITY (1.0f)
-#define AL_REVERB_DEFAULT_DENSITY (1.0f)
-
-#define AL_REVERB_MIN_DIFFUSION (0.0f)
-#define AL_REVERB_MAX_DIFFUSION (1.0f)
-#define AL_REVERB_DEFAULT_DIFFUSION (1.0f)
-
-#define AL_REVERB_MIN_GAIN (0.0f)
-#define AL_REVERB_MAX_GAIN (1.0f)
-#define AL_REVERB_DEFAULT_GAIN (0.32f)
-
-#define AL_REVERB_MIN_GAINHF (0.0f)
-#define AL_REVERB_MAX_GAINHF (1.0f)
-#define AL_REVERB_DEFAULT_GAINHF (0.89f)
-
-#define AL_REVERB_MIN_DECAY_TIME (0.1f)
-#define AL_REVERB_MAX_DECAY_TIME (20.0f)
-#define AL_REVERB_DEFAULT_DECAY_TIME (1.49f)
-
-#define AL_REVERB_MIN_DECAY_HFRATIO (0.1f)
-#define AL_REVERB_MAX_DECAY_HFRATIO (2.0f)
-#define AL_REVERB_DEFAULT_DECAY_HFRATIO (0.83f)
-
-#define AL_REVERB_MIN_REFLECTIONS_GAIN (0.0f)
-#define AL_REVERB_MAX_REFLECTIONS_GAIN (3.16f)
-#define AL_REVERB_DEFAULT_REFLECTIONS_GAIN (0.05f)
-
-#define AL_REVERB_MIN_REFLECTIONS_DELAY (0.0f)
-#define AL_REVERB_MAX_REFLECTIONS_DELAY (0.3f)
-#define AL_REVERB_DEFAULT_REFLECTIONS_DELAY (0.007f)
-
-#define AL_REVERB_MIN_LATE_REVERB_GAIN (0.0f)
-#define AL_REVERB_MAX_LATE_REVERB_GAIN (10.0f)
-#define AL_REVERB_DEFAULT_LATE_REVERB_GAIN (1.26f)
-
-#define AL_REVERB_MIN_LATE_REVERB_DELAY (0.0f)
-#define AL_REVERB_MAX_LATE_REVERB_DELAY (0.1f)
-#define AL_REVERB_DEFAULT_LATE_REVERB_DELAY (0.011f)
-
-#define AL_REVERB_MIN_AIR_ABSORPTION_GAINHF (0.892f)
-#define AL_REVERB_MAX_AIR_ABSORPTION_GAINHF (1.0f)
-#define AL_REVERB_DEFAULT_AIR_ABSORPTION_GAINHF (0.994f)
-
-#define AL_REVERB_MIN_ROOM_ROLLOFF_FACTOR (0.0f)
-#define AL_REVERB_MAX_ROOM_ROLLOFF_FACTOR (10.0f)
-#define AL_REVERB_DEFAULT_ROOM_ROLLOFF_FACTOR (0.0f)
-
-#define AL_REVERB_MIN_DECAY_HFLIMIT AL_FALSE
-#define AL_REVERB_MAX_DECAY_HFLIMIT AL_TRUE
-#define AL_REVERB_DEFAULT_DECAY_HFLIMIT AL_TRUE
-
-/* EAX reverb effect */
-#define AL_EAXREVERB_MIN_DENSITY (0.0f)
-#define AL_EAXREVERB_MAX_DENSITY (1.0f)
-#define AL_EAXREVERB_DEFAULT_DENSITY (1.0f)
-
-#define AL_EAXREVERB_MIN_DIFFUSION (0.0f)
-#define AL_EAXREVERB_MAX_DIFFUSION (1.0f)
-#define AL_EAXREVERB_DEFAULT_DIFFUSION (1.0f)
-
-#define AL_EAXREVERB_MIN_GAIN (0.0f)
-#define AL_EAXREVERB_MAX_GAIN (1.0f)
-#define AL_EAXREVERB_DEFAULT_GAIN (0.32f)
-
-#define AL_EAXREVERB_MIN_GAINHF (0.0f)
-#define AL_EAXREVERB_MAX_GAINHF (1.0f)
-#define AL_EAXREVERB_DEFAULT_GAINHF (0.89f)
-
-#define AL_EAXREVERB_MIN_GAINLF (0.0f)
-#define AL_EAXREVERB_MAX_GAINLF (1.0f)
-#define AL_EAXREVERB_DEFAULT_GAINLF (1.0f)
-
-#define AL_EAXREVERB_MIN_DECAY_TIME (0.1f)
-#define AL_EAXREVERB_MAX_DECAY_TIME (20.0f)
-#define AL_EAXREVERB_DEFAULT_DECAY_TIME (1.49f)
-
-#define AL_EAXREVERB_MIN_DECAY_HFRATIO (0.1f)
-#define AL_EAXREVERB_MAX_DECAY_HFRATIO (2.0f)
-#define AL_EAXREVERB_DEFAULT_DECAY_HFRATIO (0.83f)
-
-#define AL_EAXREVERB_MIN_DECAY_LFRATIO (0.1f)
-#define AL_EAXREVERB_MAX_DECAY_LFRATIO (2.0f)
-#define AL_EAXREVERB_DEFAULT_DECAY_LFRATIO (1.0f)
-
-#define AL_EAXREVERB_MIN_REFLECTIONS_GAIN (0.0f)
-#define AL_EAXREVERB_MAX_REFLECTIONS_GAIN (3.16f)
-#define AL_EAXREVERB_DEFAULT_REFLECTIONS_GAIN (0.05f)
-
-#define AL_EAXREVERB_MIN_REFLECTIONS_DELAY (0.0f)
-#define AL_EAXREVERB_MAX_REFLECTIONS_DELAY (0.3f)
-#define AL_EAXREVERB_DEFAULT_REFLECTIONS_DELAY (0.007f)
-
-#define AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN_XYZ (0.0f)
-
-#define AL_EAXREVERB_MIN_LATE_REVERB_GAIN (0.0f)
-#define AL_EAXREVERB_MAX_LATE_REVERB_GAIN (10.0f)
-#define AL_EAXREVERB_DEFAULT_LATE_REVERB_GAIN (1.26f)
-
-#define AL_EAXREVERB_MIN_LATE_REVERB_DELAY (0.0f)
-#define AL_EAXREVERB_MAX_LATE_REVERB_DELAY (0.1f)
-#define AL_EAXREVERB_DEFAULT_LATE_REVERB_DELAY (0.011f)
-
-#define AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN_XYZ (0.0f)
-
-#define AL_EAXREVERB_MIN_ECHO_TIME (0.075f)
-#define AL_EAXREVERB_MAX_ECHO_TIME (0.25f)
-#define AL_EAXREVERB_DEFAULT_ECHO_TIME (0.25f)
-
-#define AL_EAXREVERB_MIN_ECHO_DEPTH (0.0f)
-#define AL_EAXREVERB_MAX_ECHO_DEPTH (1.0f)
-#define AL_EAXREVERB_DEFAULT_ECHO_DEPTH (0.0f)
-
-#define AL_EAXREVERB_MIN_MODULATION_TIME (0.04f)
-#define AL_EAXREVERB_MAX_MODULATION_TIME (4.0f)
-#define AL_EAXREVERB_DEFAULT_MODULATION_TIME (0.25f)
-
-#define AL_EAXREVERB_MIN_MODULATION_DEPTH (0.0f)
-#define AL_EAXREVERB_MAX_MODULATION_DEPTH (1.0f)
-#define AL_EAXREVERB_DEFAULT_MODULATION_DEPTH (0.0f)
-
-#define AL_EAXREVERB_MIN_AIR_ABSORPTION_GAINHF (0.892f)
-#define AL_EAXREVERB_MAX_AIR_ABSORPTION_GAINHF (1.0f)
-#define AL_EAXREVERB_DEFAULT_AIR_ABSORPTION_GAINHF (0.994f)
-
-#define AL_EAXREVERB_MIN_HFREFERENCE (1000.0f)
-#define AL_EAXREVERB_MAX_HFREFERENCE (20000.0f)
-#define AL_EAXREVERB_DEFAULT_HFREFERENCE (5000.0f)
-
-#define AL_EAXREVERB_MIN_LFREFERENCE (20.0f)
-#define AL_EAXREVERB_MAX_LFREFERENCE (1000.0f)
-#define AL_EAXREVERB_DEFAULT_LFREFERENCE (250.0f)
-
-#define AL_EAXREVERB_MIN_ROOM_ROLLOFF_FACTOR (0.0f)
-#define AL_EAXREVERB_MAX_ROOM_ROLLOFF_FACTOR (10.0f)
-#define AL_EAXREVERB_DEFAULT_ROOM_ROLLOFF_FACTOR (0.0f)
-
-#define AL_EAXREVERB_MIN_DECAY_HFLIMIT AL_FALSE
-#define AL_EAXREVERB_MAX_DECAY_HFLIMIT AL_TRUE
-#define AL_EAXREVERB_DEFAULT_DECAY_HFLIMIT AL_TRUE
-
-/* Chorus effect */
-#define AL_CHORUS_WAVEFORM_SINUSOID (0)
-#define AL_CHORUS_WAVEFORM_TRIANGLE (1)
-
-#define AL_CHORUS_MIN_WAVEFORM (0)
-#define AL_CHORUS_MAX_WAVEFORM (1)
-#define AL_CHORUS_DEFAULT_WAVEFORM (1)
-
-#define AL_CHORUS_MIN_PHASE (-180)
-#define AL_CHORUS_MAX_PHASE (180)
-#define AL_CHORUS_DEFAULT_PHASE (90)
-
-#define AL_CHORUS_MIN_RATE (0.0f)
-#define AL_CHORUS_MAX_RATE (10.0f)
-#define AL_CHORUS_DEFAULT_RATE (1.1f)
-
-#define AL_CHORUS_MIN_DEPTH (0.0f)
-#define AL_CHORUS_MAX_DEPTH (1.0f)
-#define AL_CHORUS_DEFAULT_DEPTH (0.1f)
-
-#define AL_CHORUS_MIN_FEEDBACK (-1.0f)
-#define AL_CHORUS_MAX_FEEDBACK (1.0f)
-#define AL_CHORUS_DEFAULT_FEEDBACK (0.25f)
-
-#define AL_CHORUS_MIN_DELAY (0.0f)
-#define AL_CHORUS_MAX_DELAY (0.016f)
-#define AL_CHORUS_DEFAULT_DELAY (0.016f)
-
-/* Distortion effect */
-#define AL_DISTORTION_MIN_EDGE (0.0f)
-#define AL_DISTORTION_MAX_EDGE (1.0f)
-#define AL_DISTORTION_DEFAULT_EDGE (0.2f)
-
-#define AL_DISTORTION_MIN_GAIN (0.01f)
-#define AL_DISTORTION_MAX_GAIN (1.0f)
-#define AL_DISTORTION_DEFAULT_GAIN (0.05f)
-
-#define AL_DISTORTION_MIN_LOWPASS_CUTOFF (80.0f)
-#define AL_DISTORTION_MAX_LOWPASS_CUTOFF (24000.0f)
-#define AL_DISTORTION_DEFAULT_LOWPASS_CUTOFF (8000.0f)
-
-#define AL_DISTORTION_MIN_EQCENTER (80.0f)
-#define AL_DISTORTION_MAX_EQCENTER (24000.0f)
-#define AL_DISTORTION_DEFAULT_EQCENTER (3600.0f)
-
-#define AL_DISTORTION_MIN_EQBANDWIDTH (80.0f)
-#define AL_DISTORTION_MAX_EQBANDWIDTH (24000.0f)
-#define AL_DISTORTION_DEFAULT_EQBANDWIDTH (3600.0f)
-
-/* Echo effect */
-#define AL_ECHO_MIN_DELAY (0.0f)
-#define AL_ECHO_MAX_DELAY (0.207f)
-#define AL_ECHO_DEFAULT_DELAY (0.1f)
-
-#define AL_ECHO_MIN_LRDELAY (0.0f)
-#define AL_ECHO_MAX_LRDELAY (0.404f)
-#define AL_ECHO_DEFAULT_LRDELAY (0.1f)
-
-#define AL_ECHO_MIN_DAMPING (0.0f)
-#define AL_ECHO_MAX_DAMPING (0.99f)
-#define AL_ECHO_DEFAULT_DAMPING (0.5f)
-
-#define AL_ECHO_MIN_FEEDBACK (0.0f)
-#define AL_ECHO_MAX_FEEDBACK (1.0f)
-#define AL_ECHO_DEFAULT_FEEDBACK (0.5f)
-
-#define AL_ECHO_MIN_SPREAD (-1.0f)
-#define AL_ECHO_MAX_SPREAD (1.0f)
-#define AL_ECHO_DEFAULT_SPREAD (-1.0f)
-
-/* Flanger effect */
-#define AL_FLANGER_WAVEFORM_SINUSOID (0)
-#define AL_FLANGER_WAVEFORM_TRIANGLE (1)
-
-#define AL_FLANGER_MIN_WAVEFORM (0)
-#define AL_FLANGER_MAX_WAVEFORM (1)
-#define AL_FLANGER_DEFAULT_WAVEFORM (1)
-
-#define AL_FLANGER_MIN_PHASE (-180)
-#define AL_FLANGER_MAX_PHASE (180)
-#define AL_FLANGER_DEFAULT_PHASE (0)
-
-#define AL_FLANGER_MIN_RATE (0.0f)
-#define AL_FLANGER_MAX_RATE (10.0f)
-#define AL_FLANGER_DEFAULT_RATE (0.27f)
-
-#define AL_FLANGER_MIN_DEPTH (0.0f)
-#define AL_FLANGER_MAX_DEPTH (1.0f)
-#define AL_FLANGER_DEFAULT_DEPTH (1.0f)
-
-#define AL_FLANGER_MIN_FEEDBACK (-1.0f)
-#define AL_FLANGER_MAX_FEEDBACK (1.0f)
-#define AL_FLANGER_DEFAULT_FEEDBACK (-0.5f)
-
-#define AL_FLANGER_MIN_DELAY (0.0f)
-#define AL_FLANGER_MAX_DELAY (0.004f)
-#define AL_FLANGER_DEFAULT_DELAY (0.002f)
-
-/* Frequency shifter effect */
-#define AL_FREQUENCY_SHIFTER_MIN_FREQUENCY (0.0f)
-#define AL_FREQUENCY_SHIFTER_MAX_FREQUENCY (24000.0f)
-#define AL_FREQUENCY_SHIFTER_DEFAULT_FREQUENCY (0.0f)
-
-#define AL_FREQUENCY_SHIFTER_MIN_LEFT_DIRECTION (0)
-#define AL_FREQUENCY_SHIFTER_MAX_LEFT_DIRECTION (2)
-#define AL_FREQUENCY_SHIFTER_DEFAULT_LEFT_DIRECTION (0)
-
-#define AL_FREQUENCY_SHIFTER_DIRECTION_DOWN (0)
-#define AL_FREQUENCY_SHIFTER_DIRECTION_UP (1)
-#define AL_FREQUENCY_SHIFTER_DIRECTION_OFF (2)
-
-#define AL_FREQUENCY_SHIFTER_MIN_RIGHT_DIRECTION (0)
-#define AL_FREQUENCY_SHIFTER_MAX_RIGHT_DIRECTION (2)
-#define AL_FREQUENCY_SHIFTER_DEFAULT_RIGHT_DIRECTION (0)
-
-/* Vocal morpher effect */
-#define AL_VOCAL_MORPHER_MIN_PHONEMEA (0)
-#define AL_VOCAL_MORPHER_MAX_PHONEMEA (29)
-#define AL_VOCAL_MORPHER_DEFAULT_PHONEMEA (0)
-
-#define AL_VOCAL_MORPHER_MIN_PHONEMEA_COARSE_TUNING (-24)
-#define AL_VOCAL_MORPHER_MAX_PHONEMEA_COARSE_TUNING (24)
-#define AL_VOCAL_MORPHER_DEFAULT_PHONEMEA_COARSE_TUNING (0)
-
-#define AL_VOCAL_MORPHER_MIN_PHONEMEB (0)
-#define AL_VOCAL_MORPHER_MAX_PHONEMEB (29)
-#define AL_VOCAL_MORPHER_DEFAULT_PHONEMEB (10)
-
-#define AL_VOCAL_MORPHER_MIN_PHONEMEB_COARSE_TUNING (-24)
-#define AL_VOCAL_MORPHER_MAX_PHONEMEB_COARSE_TUNING (24)
-#define AL_VOCAL_MORPHER_DEFAULT_PHONEMEB_COARSE_TUNING (0)
-
-#define AL_VOCAL_MORPHER_PHONEME_A (0)
-#define AL_VOCAL_MORPHER_PHONEME_E (1)
-#define AL_VOCAL_MORPHER_PHONEME_I (2)
-#define AL_VOCAL_MORPHER_PHONEME_O (3)
-#define AL_VOCAL_MORPHER_PHONEME_U (4)
-#define AL_VOCAL_MORPHER_PHONEME_AA (5)
-#define AL_VOCAL_MORPHER_PHONEME_AE (6)
-#define AL_VOCAL_MORPHER_PHONEME_AH (7)
-#define AL_VOCAL_MORPHER_PHONEME_AO (8)
-#define AL_VOCAL_MORPHER_PHONEME_EH (9)
-#define AL_VOCAL_MORPHER_PHONEME_ER (10)
-#define AL_VOCAL_MORPHER_PHONEME_IH (11)
-#define AL_VOCAL_MORPHER_PHONEME_IY (12)
-#define AL_VOCAL_MORPHER_PHONEME_UH (13)
-#define AL_VOCAL_MORPHER_PHONEME_UW (14)
-#define AL_VOCAL_MORPHER_PHONEME_B (15)
-#define AL_VOCAL_MORPHER_PHONEME_D (16)
-#define AL_VOCAL_MORPHER_PHONEME_F (17)
-#define AL_VOCAL_MORPHER_PHONEME_G (18)
-#define AL_VOCAL_MORPHER_PHONEME_J (19)
-#define AL_VOCAL_MORPHER_PHONEME_K (20)
-#define AL_VOCAL_MORPHER_PHONEME_L (21)
-#define AL_VOCAL_MORPHER_PHONEME_M (22)
-#define AL_VOCAL_MORPHER_PHONEME_N (23)
-#define AL_VOCAL_MORPHER_PHONEME_P (24)
-#define AL_VOCAL_MORPHER_PHONEME_R (25)
-#define AL_VOCAL_MORPHER_PHONEME_S (26)
-#define AL_VOCAL_MORPHER_PHONEME_T (27)
-#define AL_VOCAL_MORPHER_PHONEME_V (28)
-#define AL_VOCAL_MORPHER_PHONEME_Z (29)
-
-#define AL_VOCAL_MORPHER_WAVEFORM_SINUSOID (0)
-#define AL_VOCAL_MORPHER_WAVEFORM_TRIANGLE (1)
-#define AL_VOCAL_MORPHER_WAVEFORM_SAWTOOTH (2)
-
-#define AL_VOCAL_MORPHER_MIN_WAVEFORM (0)
-#define AL_VOCAL_MORPHER_MAX_WAVEFORM (2)
-#define AL_VOCAL_MORPHER_DEFAULT_WAVEFORM (0)
-
-#define AL_VOCAL_MORPHER_MIN_RATE (0.0f)
-#define AL_VOCAL_MORPHER_MAX_RATE (10.0f)
-#define AL_VOCAL_MORPHER_DEFAULT_RATE (1.41f)
-
-/* Pitch shifter effect */
-#define AL_PITCH_SHIFTER_MIN_COARSE_TUNE (-12)
-#define AL_PITCH_SHIFTER_MAX_COARSE_TUNE (12)
-#define AL_PITCH_SHIFTER_DEFAULT_COARSE_TUNE (12)
-
-#define AL_PITCH_SHIFTER_MIN_FINE_TUNE (-50)
-#define AL_PITCH_SHIFTER_MAX_FINE_TUNE (50)
-#define AL_PITCH_SHIFTER_DEFAULT_FINE_TUNE (0)
-
-/* Ring modulator effect */
-#define AL_RING_MODULATOR_MIN_FREQUENCY (0.0f)
-#define AL_RING_MODULATOR_MAX_FREQUENCY (8000.0f)
-#define AL_RING_MODULATOR_DEFAULT_FREQUENCY (440.0f)
-
-#define AL_RING_MODULATOR_MIN_HIGHPASS_CUTOFF (0.0f)
-#define AL_RING_MODULATOR_MAX_HIGHPASS_CUTOFF (24000.0f)
-#define AL_RING_MODULATOR_DEFAULT_HIGHPASS_CUTOFF (800.0f)
-
-#define AL_RING_MODULATOR_SINUSOID (0)
-#define AL_RING_MODULATOR_SAWTOOTH (1)
-#define AL_RING_MODULATOR_SQUARE (2)
-
-#define AL_RING_MODULATOR_MIN_WAVEFORM (0)
-#define AL_RING_MODULATOR_MAX_WAVEFORM (2)
-#define AL_RING_MODULATOR_DEFAULT_WAVEFORM (0)
-
-/* Autowah effect */
-#define AL_AUTOWAH_MIN_ATTACK_TIME (0.0001f)
-#define AL_AUTOWAH_MAX_ATTACK_TIME (1.0f)
-#define AL_AUTOWAH_DEFAULT_ATTACK_TIME (0.06f)
-
-#define AL_AUTOWAH_MIN_RELEASE_TIME (0.0001f)
-#define AL_AUTOWAH_MAX_RELEASE_TIME (1.0f)
-#define AL_AUTOWAH_DEFAULT_RELEASE_TIME (0.06f)
-
-#define AL_AUTOWAH_MIN_RESONANCE (2.0f)
-#define AL_AUTOWAH_MAX_RESONANCE (1000.0f)
-#define AL_AUTOWAH_DEFAULT_RESONANCE (1000.0f)
-
-#define AL_AUTOWAH_MIN_PEAK_GAIN (0.00003f)
-#define AL_AUTOWAH_MAX_PEAK_GAIN (31621.0f)
-#define AL_AUTOWAH_DEFAULT_PEAK_GAIN (11.22f)
-
-/* Compressor effect */
-#define AL_COMPRESSOR_MIN_ONOFF (0)
-#define AL_COMPRESSOR_MAX_ONOFF (1)
-#define AL_COMPRESSOR_DEFAULT_ONOFF (1)
-
-/* Equalizer effect */
-#define AL_EQUALIZER_MIN_LOW_GAIN (0.126f)
-#define AL_EQUALIZER_MAX_LOW_GAIN (7.943f)
-#define AL_EQUALIZER_DEFAULT_LOW_GAIN (1.0f)
-
-#define AL_EQUALIZER_MIN_LOW_CUTOFF (50.0f)
-#define AL_EQUALIZER_MAX_LOW_CUTOFF (800.0f)
-#define AL_EQUALIZER_DEFAULT_LOW_CUTOFF (200.0f)
-
-#define AL_EQUALIZER_MIN_MID1_GAIN (0.126f)
-#define AL_EQUALIZER_MAX_MID1_GAIN (7.943f)
-#define AL_EQUALIZER_DEFAULT_MID1_GAIN (1.0f)
-
-#define AL_EQUALIZER_MIN_MID1_CENTER (200.0f)
-#define AL_EQUALIZER_MAX_MID1_CENTER (3000.0f)
-#define AL_EQUALIZER_DEFAULT_MID1_CENTER (500.0f)
-
-#define AL_EQUALIZER_MIN_MID1_WIDTH (0.01f)
-#define AL_EQUALIZER_MAX_MID1_WIDTH (1.0f)
-#define AL_EQUALIZER_DEFAULT_MID1_WIDTH (1.0f)
-
-#define AL_EQUALIZER_MIN_MID2_GAIN (0.126f)
-#define AL_EQUALIZER_MAX_MID2_GAIN (7.943f)
-#define AL_EQUALIZER_DEFAULT_MID2_GAIN (1.0f)
-
-#define AL_EQUALIZER_MIN_MID2_CENTER (1000.0f)
-#define AL_EQUALIZER_MAX_MID2_CENTER (8000.0f)
-#define AL_EQUALIZER_DEFAULT_MID2_CENTER (3000.0f)
-
-#define AL_EQUALIZER_MIN_MID2_WIDTH (0.01f)
-#define AL_EQUALIZER_MAX_MID2_WIDTH (1.0f)
-#define AL_EQUALIZER_DEFAULT_MID2_WIDTH (1.0f)
-
-#define AL_EQUALIZER_MIN_HIGH_GAIN (0.126f)
-#define AL_EQUALIZER_MAX_HIGH_GAIN (7.943f)
-#define AL_EQUALIZER_DEFAULT_HIGH_GAIN (1.0f)
-
-#define AL_EQUALIZER_MIN_HIGH_CUTOFF (4000.0f)
-#define AL_EQUALIZER_MAX_HIGH_CUTOFF (16000.0f)
-#define AL_EQUALIZER_DEFAULT_HIGH_CUTOFF (6000.0f)
-
-
-/* Source parameter value ranges and defaults. */
-#define AL_MIN_AIR_ABSORPTION_FACTOR (0.0f)
-#define AL_MAX_AIR_ABSORPTION_FACTOR (10.0f)
-#define AL_DEFAULT_AIR_ABSORPTION_FACTOR (0.0f)
-
-#define AL_MIN_ROOM_ROLLOFF_FACTOR (0.0f)
-#define AL_MAX_ROOM_ROLLOFF_FACTOR (10.0f)
-#define AL_DEFAULT_ROOM_ROLLOFF_FACTOR (0.0f)
-
-#define AL_MIN_CONE_OUTER_GAINHF (0.0f)
-#define AL_MAX_CONE_OUTER_GAINHF (1.0f)
-#define AL_DEFAULT_CONE_OUTER_GAINHF (1.0f)
-
-#define AL_MIN_DIRECT_FILTER_GAINHF_AUTO AL_FALSE
-#define AL_MAX_DIRECT_FILTER_GAINHF_AUTO AL_TRUE
-#define AL_DEFAULT_DIRECT_FILTER_GAINHF_AUTO AL_TRUE
-
-#define AL_MIN_AUXILIARY_SEND_FILTER_GAIN_AUTO AL_FALSE
-#define AL_MAX_AUXILIARY_SEND_FILTER_GAIN_AUTO AL_TRUE
-#define AL_DEFAULT_AUXILIARY_SEND_FILTER_GAIN_AUTO AL_TRUE
-
-#define AL_MIN_AUXILIARY_SEND_FILTER_GAINHF_AUTO AL_FALSE
-#define AL_MAX_AUXILIARY_SEND_FILTER_GAINHF_AUTO AL_TRUE
-#define AL_DEFAULT_AUXILIARY_SEND_FILTER_GAINHF_AUTO AL_TRUE
-
-
-/* Listener parameter value ranges and defaults. */
-#define AL_MIN_METERS_PER_UNIT FLT_MIN
-#define AL_MAX_METERS_PER_UNIT FLT_MAX
-#define AL_DEFAULT_METERS_PER_UNIT (1.0f)
-
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif /* AL_EFX_H */
diff --git a/internal/c/parts/audio/out/android/OpenAL/Alc/AL/oalMacOSX_OALExtensions.h b/internal/c/parts/audio/out/android/OpenAL/Alc/AL/oalMacOSX_OALExtensions.h
deleted file mode 100644
index c3db30546..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Alc/AL/oalMacOSX_OALExtensions.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/**********************************************************************************************************************************
-*
-* OpenAL cross platform audio library
-* Copyright (c) 2004-2006, Apple Computer, Inc. All rights reserved.
-* Copyright (c) 2007-2008, Apple Inc. All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
-* conditions are met:
-*
-* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
-* disclaimer in the documentation and/or other materials provided with the distribution.
-* 3. Neither the name of Apple Inc. ("Apple") nor the names of its contributors may be used to endorse or promote products derived
-* from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS
-* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-**********************************************************************************************************************************/
-
-#ifndef __OAL_MAC_OSX_OAL_EXTENSIONS_H__
-#define __OAL_MAC_OSX_OAL_EXTENSIONS_H__
-
-#include
-
-/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
-
-/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ALC_EXT_MAC_OSX
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
-
-// Retrieve functions via alGetProcAddress() by passing in strings: alcMacOSXMixerOutputRate or alcMacOSXGetMixerOutputRate
-
-// Setting the Mixer Output Rate effectively sets the samnple rate at which the mixer
-typedef ALvoid (*alcMacOSXRenderingQualityProcPtr) (ALint value);
-typedef ALvoid (*alMacOSXRenderChannelCountProcPtr) (ALint value);
-typedef ALvoid (*alcMacOSXMixerMaxiumumBussesProcPtr) (ALint value);
-typedef ALvoid (*alcMacOSXMixerOutputRateProcPtr) (ALdouble value);
-
-typedef ALint (*alcMacOSXGetRenderingQualityProcPtr) ();
-typedef ALint (*alMacOSXGetRenderChannelCountProcPtr) ();
-typedef ALint (*alcMacOSXGetMixerMaxiumumBussesProcPtr) ();
-typedef ALdouble (*alcMacOSXGetMixerOutputRateProcPtr) ();
-
-/* Render Quality. Used with alcMacOSXRenderingQuality() */
-
- #define ALC_MAC_OSX_SPATIAL_RENDERING_QUALITY_HIGH 'rqhi'
- #define ALC_MAC_OSX_SPATIAL_RENDERING_QUALITY_LOW 'rdlo'
-
- // High Quality Spatial Algorithm suitable only for headphone use
- #define ALC_IPHONE_SPATIAL_RENDERING_QUALITY_HEADPHONES 'hdph'
-
-/*
- Render Channels. Used with alMacOSXRenderChannelCount()
- Allows a user to force OpenAL to render to stereo, regardless of the audio hardware being used
-*/
- #define ALC_MAC_OSX_RENDER_CHANNEL_COUNT_STEREO 'rcst'
-
-/* GameKit extension */
-
- #define AL_GAMEKIT 'gksr'
-
-/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- AL_EXT_SOURCE_NOTIFICATIONS
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
-/*
- Source Notifications
-
- Eliminates the need for continuous polling for source state by providing a
- mechanism for the application to receive source state change notifications.
- Upon receiving a notification, the application can retrieve the actual state
- corresponding to the notification ID for which the notification was sent.
- */
-
-#define AL_QUEUE_HAS_LOOPED 0x9000
-
-/*
- Notification Proc: ALSourceNotificationProc
-
- sid - source id
- notificationID - id of state that has changed
- userData - user data provided to alSourceAddNotification()
- */
-
-typedef ALvoid (*alSourceNotificationProc)(ALuint sid, ALuint notificationID, ALvoid* userData);
-
-/*
- API: alSourceAddNotification
-
- sid - source id
- notificationID - id of state for which caller wants to be notified of a change
- notifyProc - notification proc
- userData - ptr to applications user data, will be returned in the notification proc
-
- Returns AL_NO_ERROR if request is successful.
-
- Valid IDs:
- AL_SOURCE_STATE
- AL_BUFFERS_PROCESSED
- AL_QUEUE_HAS_LOOPED - notification sent when a looping source has looped to it's start point
- */
-typedef ALenum (*alSourceAddNotificationProcPtr) (ALuint sid, ALuint notificationID, alSourceNotificationProc notifyProc, ALvoid* userData);
-
-/*
- API: alSourceRemoveStateNotification
-
- sid - source id
- notificationID - id of state for which caller wants to remove an existing notification
- notifyProc - notification proc
- userData - ptr to applications user data, will be returned in the notification proc
- */
-typedef ALvoid (*alSourceRemoveNotificationProcPtr) (ALuint sid, ALuint notificationID, alSourceNotificationProc notifyProc, ALvoid* userData);
-
-/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ALC_EXT_ASA : Apple Spatial Audio Extension
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
-/*
- Used with the ASA API calls: alcASAGetSource(), alcASASetSource(), alcASAGetListener(), alcASASetListener()
-*/
-
-typedef ALenum (*alcASAGetSourceProcPtr) (ALuint property, ALuint source, ALvoid *data, ALuint* dataSize);
-typedef ALenum (*alcASASetSourceProcPtr) (ALuint property, ALuint source, ALvoid *data, ALuint dataSize);
-typedef ALenum (*alcASAGetListenerProcPtr) (ALuint property, ALvoid *data, ALuint* dataSize);
-typedef ALenum (*alcASASetListenerProcPtr) (ALuint property, ALvoid *data, ALuint dataSize);
-
- /* listener properties */
- #define ALC_ASA_REVERB_ON 'rvon' // type ALuint
- #define ALC_ASA_REVERB_GLOBAL_LEVEL 'rvgl' // type ALfloat -40.0 db - 40.0 db
-
- #define ALC_ASA_REVERB_ROOM_TYPE 'rvrt' // type ALint
-
- /* reverb room type presets for the ALC_ASA_REVERB_ROOM_TYPE property */
- #define ALC_ASA_REVERB_ROOM_TYPE_SmallRoom 0
- #define ALC_ASA_REVERB_ROOM_TYPE_MediumRoom 1
- #define ALC_ASA_REVERB_ROOM_TYPE_LargeRoom 2
- #define ALC_ASA_REVERB_ROOM_TYPE_MediumHall 3
- #define ALC_ASA_REVERB_ROOM_TYPE_LargeHall 4
- #define ALC_ASA_REVERB_ROOM_TYPE_Plate 5
- #define ALC_ASA_REVERB_ROOM_TYPE_MediumChamber 6
- #define ALC_ASA_REVERB_ROOM_TYPE_LargeChamber 7
- #define ALC_ASA_REVERB_ROOM_TYPE_Cathedral 8
- #define ALC_ASA_REVERB_ROOM_TYPE_LargeRoom2 9
- #define ALC_ASA_REVERB_ROOM_TYPE_MediumHall2 10
- #define ALC_ASA_REVERB_ROOM_TYPE_MediumHall3 11
- #define ALC_ASA_REVERB_ROOM_TYPE_LargeHall2 12
-
- #define ALC_ASA_REVERB_EQ_GAIN 'rveg' // type ALfloat
- #define ALC_ASA_REVERB_EQ_BANDWITH 'rveb' // type ALfloat
- #define ALC_ASA_REVERB_EQ_FREQ 'rvef' // type ALfloat
-
- /* source properties */
- #define ALC_ASA_REVERB_SEND_LEVEL 'rvsl' // type ALfloat 0.0 (dry) - 1.0 (wet) (0-100% dry/wet mix, 0.0 default)
- #define ALC_ASA_OCCLUSION 'occl' // type ALfloat -100.0 db (most occlusion) - 0.0 db (no occlusion, 0.0 default)
- #define ALC_ASA_OBSTRUCTION 'obst' // type ALfloat -100.0 db (most obstruction) - 0.0 db (no obstruction, 0.0 default)
-
-#endif // __OAL_MAC_OSX_OAL_EXTENSIONS_H__
diff --git a/internal/c/parts/audio/out/android/OpenAL/Alc/ALc.c b/internal/c/parts/audio/out/android/OpenAL/Alc/ALc.c
deleted file mode 100644
index 8f4d7a4a3..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Alc/ALc.c
+++ /dev/null
@@ -1,2371 +0,0 @@
-/**
- * OpenAL cross platform audio library
- * Copyright (C) 1999-2007 by authors.
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- * Or go to http://www.gnu.org/copyleft/lgpl.html
- */
-
-#include "config.h"
-
-#include
-#include
-#include
-#include
-#include
-
-#include "alMain.h"
-#include "alSource.h"
-#include "AL/al.h"
-#include "AL/alc.h"
-#include "alThunk.h"
-#include "alSource.h"
-#include "alBuffer.h"
-#include "alAuxEffectSlot.h"
-#include "alDatabuffer.h"
-#include "bs2b.h"
-#include "alu.h"
-
-
-#define EmptyFuncs { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
-typedef struct BackendInfo {
- const char *name;
- void (*Init)(BackendFuncs*);
- void (*Deinit)(void);
- void (*Probe)(int);
- BackendFuncs Funcs;
-} BackendInfo;
-static BackendInfo BackendList[] = {
-#ifdef HAVE_PULSEAUDIO
- { "pulse", alc_pulse_init, alc_pulse_deinit, alc_pulse_probe, EmptyFuncs },
-#endif
-#ifdef HAVE_ALSA
- { "alsa", alc_alsa_init, alc_alsa_deinit, alc_alsa_probe, EmptyFuncs },
-#endif
-#ifdef HAVE_OSS
- { "oss", alc_oss_init, alc_oss_deinit, alc_oss_probe, EmptyFuncs },
-#endif
-#ifdef HAVE_SOLARIS
- { "solaris", alc_solaris_init, alc_solaris_deinit, alc_solaris_probe, EmptyFuncs },
-#endif
-#ifdef HAVE_DSOUND
- { "dsound", alcDSoundInit, alcDSoundDeinit, alcDSoundProbe, EmptyFuncs },
-#endif
-#ifdef HAVE_WINMM
- { "winmm", alcWinMMInit, alcWinMMDeinit, alcWinMMProbe, EmptyFuncs },
-#endif
-#ifdef HAVE_PORTAUDIO
- { "port", alc_pa_init, alc_pa_deinit, alc_pa_probe, EmptyFuncs },
-#endif
-#ifdef HAVE_OPENSLES
- { "opensles", alc_opensles_init, alc_opensles_deinit, alc_opensles_probe, EmptyFuncs },
-#endif
-#if defined(HAVE_AUDIOTRACK)
- { "audiotrack", alc_audiotrack_init, alc_audiotrack_deinit, alc_audiotrack_probe, EmptyFuncs },
-#endif
-
- { "null", alc_null_init, alc_null_deinit, alc_null_probe, EmptyFuncs },
-#ifdef HAVE_WAVE
- { "wave", alc_wave_init, alc_wave_deinit, alc_wave_probe, EmptyFuncs },
-#endif
-
- { NULL, NULL, NULL, NULL, EmptyFuncs }
-};
-#undef EmptyFuncs
-
-///////////////////////////////////////////////////////
-
-#define ALC_EFX_MAJOR_VERSION 0x20001
-#define ALC_EFX_MINOR_VERSION 0x20002
-#define ALC_MAX_AUXILIARY_SENDS 0x20003
-
-///////////////////////////////////////////////////////
-// STRING and EXTENSIONS
-
-typedef struct ALCfunction {
- const ALCchar *funcName;
- ALCvoid *address;
-} ALCfunction;
-
-typedef struct ALCenums {
- const ALCchar *enumName;
- ALCenum value;
-} ALCenums;
-
-
-static const ALCfunction alcFunctions[] = {
- { "alcCreateContext", (ALCvoid *) alcCreateContext },
- { "alcMakeContextCurrent", (ALCvoid *) alcMakeContextCurrent },
- { "alcProcessContext", (ALCvoid *) alcProcessContext },
- { "alcSuspendContext", (ALCvoid *) alcSuspendContext },
- { "alcDestroyContext", (ALCvoid *) alcDestroyContext },
- { "alcGetCurrentContext", (ALCvoid *) alcGetCurrentContext },
- { "alcGetContextsDevice", (ALCvoid *) alcGetContextsDevice },
- { "alcOpenDevice", (ALCvoid *) alcOpenDevice },
- { "alcCloseDevice", (ALCvoid *) alcCloseDevice },
- { "alcGetError", (ALCvoid *) alcGetError },
- { "alcIsExtensionPresent", (ALCvoid *) alcIsExtensionPresent },
- { "alcGetProcAddress", (ALCvoid *) alcGetProcAddress },
- { "alcGetEnumValue", (ALCvoid *) alcGetEnumValue },
- { "alcGetString", (ALCvoid *) alcGetString },
- { "alcGetIntegerv", (ALCvoid *) alcGetIntegerv },
- { "alcCaptureOpenDevice", (ALCvoid *) alcCaptureOpenDevice },
- { "alcCaptureCloseDevice", (ALCvoid *) alcCaptureCloseDevice },
- { "alcCaptureStart", (ALCvoid *) alcCaptureStart },
- { "alcCaptureStop", (ALCvoid *) alcCaptureStop },
- { "alcCaptureSamples", (ALCvoid *) alcCaptureSamples },
-
- { "alcSetThreadContext", (ALCvoid *) alcSetThreadContext },
- { "alcGetThreadContext", (ALCvoid *) alcGetThreadContext },
-
- { "alEnable", (ALCvoid *) alEnable },
- { "alDisable", (ALCvoid *) alDisable },
- { "alIsEnabled", (ALCvoid *) alIsEnabled },
- { "alGetString", (ALCvoid *) alGetString },
- { "alGetBooleanv", (ALCvoid *) alGetBooleanv },
- { "alGetIntegerv", (ALCvoid *) alGetIntegerv },
- { "alGetFloatv", (ALCvoid *) alGetFloatv },
- { "alGetDoublev", (ALCvoid *) alGetDoublev },
- { "alGetBoolean", (ALCvoid *) alGetBoolean },
- { "alGetInteger", (ALCvoid *) alGetInteger },
- { "alGetFloat", (ALCvoid *) alGetFloat },
- { "alGetDouble", (ALCvoid *) alGetDouble },
- { "alGetError", (ALCvoid *) alGetError },
- { "alIsExtensionPresent", (ALCvoid *) alIsExtensionPresent },
- { "alGetProcAddress", (ALCvoid *) alGetProcAddress },
- { "alGetEnumValue", (ALCvoid *) alGetEnumValue },
- { "alListenerf", (ALCvoid *) alListenerf },
- { "alListener3f", (ALCvoid *) alListener3f },
- { "alListenerfv", (ALCvoid *) alListenerfv },
- { "alListeneri", (ALCvoid *) alListeneri },
- { "alListener3i", (ALCvoid *) alListener3i },
- { "alListeneriv", (ALCvoid *) alListeneriv },
- { "alGetListenerf", (ALCvoid *) alGetListenerf },
- { "alGetListener3f", (ALCvoid *) alGetListener3f },
- { "alGetListenerfv", (ALCvoid *) alGetListenerfv },
- { "alGetListeneri", (ALCvoid *) alGetListeneri },
- { "alGetListener3i", (ALCvoid *) alGetListener3i },
- { "alGetListeneriv", (ALCvoid *) alGetListeneriv },
- { "alGenSources", (ALCvoid *) alGenSources },
- { "alDeleteSources", (ALCvoid *) alDeleteSources },
- { "alIsSource", (ALCvoid *) alIsSource },
- { "alSourcef", (ALCvoid *) alSourcef },
- { "alSource3f", (ALCvoid *) alSource3f },
- { "alSourcefv", (ALCvoid *) alSourcefv },
- { "alSourcei", (ALCvoid *) alSourcei },
- { "alSource3i", (ALCvoid *) alSource3i },
- { "alSourceiv", (ALCvoid *) alSourceiv },
- { "alGetSourcef", (ALCvoid *) alGetSourcef },
- { "alGetSource3f", (ALCvoid *) alGetSource3f },
- { "alGetSourcefv", (ALCvoid *) alGetSourcefv },
- { "alGetSourcei", (ALCvoid *) alGetSourcei },
- { "alGetSource3i", (ALCvoid *) alGetSource3i },
- { "alGetSourceiv", (ALCvoid *) alGetSourceiv },
- { "alSourcePlayv", (ALCvoid *) alSourcePlayv },
- { "alSourceStopv", (ALCvoid *) alSourceStopv },
- { "alSourceRewindv", (ALCvoid *) alSourceRewindv },
- { "alSourcePausev", (ALCvoid *) alSourcePausev },
- { "alSourcePlay", (ALCvoid *) alSourcePlay },
- { "alSourceStop", (ALCvoid *) alSourceStop },
- { "alSourceRewind", (ALCvoid *) alSourceRewind },
- { "alSourcePause", (ALCvoid *) alSourcePause },
- { "alSourceQueueBuffers", (ALCvoid *) alSourceQueueBuffers },
- { "alSourceUnqueueBuffers", (ALCvoid *) alSourceUnqueueBuffers },
- { "alGenBuffers", (ALCvoid *) alGenBuffers },
- { "alDeleteBuffers", (ALCvoid *) alDeleteBuffers },
- { "alIsBuffer", (ALCvoid *) alIsBuffer },
- { "alBufferData", (ALCvoid *) alBufferData },
- { "alBufferDataStatic", (ALCvoid *) alBufferData },
- { "alBufferf", (ALCvoid *) alBufferf },
- { "alBuffer3f", (ALCvoid *) alBuffer3f },
- { "alBufferfv", (ALCvoid *) alBufferfv },
- { "alBufferi", (ALCvoid *) alBufferi },
- { "alBuffer3i", (ALCvoid *) alBuffer3i },
- { "alBufferiv", (ALCvoid *) alBufferiv },
- { "alGetBufferf", (ALCvoid *) alGetBufferf },
- { "alGetBuffer3f", (ALCvoid *) alGetBuffer3f },
- { "alGetBufferfv", (ALCvoid *) alGetBufferfv },
- { "alGetBufferi", (ALCvoid *) alGetBufferi },
- { "alGetBuffer3i", (ALCvoid *) alGetBuffer3i },
- { "alGetBufferiv", (ALCvoid *) alGetBufferiv },
- { "alDopplerFactor", (ALCvoid *) alDopplerFactor },
- { "alDopplerVelocity", (ALCvoid *) alDopplerVelocity },
- { "alSpeedOfSound", (ALCvoid *) alSpeedOfSound },
- { "alDistanceModel", (ALCvoid *) alDistanceModel },
-
- { "alGenFilters", (ALCvoid *) alGenFilters },
- { "alDeleteFilters", (ALCvoid *) alDeleteFilters },
- { "alIsFilter", (ALCvoid *) alIsFilter },
- { "alFilteri", (ALCvoid *) alFilteri },
- { "alFilteriv", (ALCvoid *) alFilteriv },
- { "alFilterf", (ALCvoid *) alFilterf },
- { "alFilterfv", (ALCvoid *) alFilterfv },
- { "alGetFilteri", (ALCvoid *) alGetFilteri },
- { "alGetFilteriv", (ALCvoid *) alGetFilteriv },
- { "alGetFilterf", (ALCvoid *) alGetFilterf },
- { "alGetFilterfv", (ALCvoid *) alGetFilterfv },
-
- { "alGenEffects", (ALCvoid *) alGenEffects },
- { "alDeleteEffects", (ALCvoid *) alDeleteEffects },
- { "alIsEffect", (ALCvoid *) alIsEffect },
- { "alEffecti", (ALCvoid *) alEffecti },
- { "alEffectiv", (ALCvoid *) alEffectiv },
- { "alEffectf", (ALCvoid *) alEffectf },
- { "alEffectfv", (ALCvoid *) alEffectfv },
- { "alGetEffecti", (ALCvoid *) alGetEffecti },
- { "alGetEffectiv", (ALCvoid *) alGetEffectiv },
- { "alGetEffectf", (ALCvoid *) alGetEffectf },
- { "alGetEffectfv", (ALCvoid *) alGetEffectfv },
-
- { "alGenAuxiliaryEffectSlots", (ALCvoid *) alGenAuxiliaryEffectSlots},
- { "alDeleteAuxiliaryEffectSlots",(ALCvoid *) alDeleteAuxiliaryEffectSlots},
- { "alIsAuxiliaryEffectSlot", (ALCvoid *) alIsAuxiliaryEffectSlot },
- { "alAuxiliaryEffectSloti", (ALCvoid *) alAuxiliaryEffectSloti },
- { "alAuxiliaryEffectSlotiv", (ALCvoid *) alAuxiliaryEffectSlotiv },
- { "alAuxiliaryEffectSlotf", (ALCvoid *) alAuxiliaryEffectSlotf },
- { "alAuxiliaryEffectSlotfv", (ALCvoid *) alAuxiliaryEffectSlotfv },
- { "alGetAuxiliaryEffectSloti", (ALCvoid *) alGetAuxiliaryEffectSloti},
- { "alGetAuxiliaryEffectSlotiv", (ALCvoid *) alGetAuxiliaryEffectSlotiv},
- { "alGetAuxiliaryEffectSlotf", (ALCvoid *) alGetAuxiliaryEffectSlotf},
- { "alGetAuxiliaryEffectSlotfv", (ALCvoid *) alGetAuxiliaryEffectSlotfv},
-
- { "alBufferSubDataSOFT", (ALCvoid *) alBufferSubDataSOFT },
-#if 0
- { "alGenDatabuffersEXT", (ALCvoid *) alGenDatabuffersEXT },
- { "alDeleteDatabuffersEXT", (ALCvoid *) alDeleteDatabuffersEXT },
- { "alIsDatabufferEXT", (ALCvoid *) alIsDatabufferEXT },
- { "alDatabufferDataEXT", (ALCvoid *) alDatabufferDataEXT },
- { "alDatabufferSubDataEXT", (ALCvoid *) alDatabufferSubDataEXT },
- { "alGetDatabufferSubDataEXT", (ALCvoid *) alGetDatabufferSubDataEXT},
- { "alDatabufferfEXT", (ALCvoid *) alDatabufferfEXT },
- { "alDatabufferfvEXT", (ALCvoid *) alDatabufferfvEXT },
- { "alDatabufferiEXT", (ALCvoid *) alDatabufferiEXT },
- { "alDatabufferivEXT", (ALCvoid *) alDatabufferivEXT },
- { "alGetDatabufferfEXT", (ALCvoid *) alGetDatabufferfEXT },
- { "alGetDatabufferfvEXT", (ALCvoid *) alGetDatabufferfvEXT },
- { "alGetDatabufferiEXT", (ALCvoid *) alGetDatabufferiEXT },
- { "alGetDatabufferivEXT", (ALCvoid *) alGetDatabufferivEXT },
- { "alSelectDatabufferEXT", (ALCvoid *) alSelectDatabufferEXT },
- { "alMapDatabufferEXT", (ALCvoid *) alMapDatabufferEXT },
- { "alUnmapDatabufferEXT", (ALCvoid *) alUnmapDatabufferEXT },
-#endif
- { NULL, (ALCvoid *) NULL }
-};
-
-static const ALCenums enumeration[] = {
- // Types
- { "ALC_INVALID", ALC_INVALID },
- { "ALC_FALSE", ALC_FALSE },
- { "ALC_TRUE", ALC_TRUE },
-
- // ALC Properties
- { "ALC_MAJOR_VERSION", ALC_MAJOR_VERSION },
- { "ALC_MINOR_VERSION", ALC_MINOR_VERSION },
- { "ALC_ATTRIBUTES_SIZE", ALC_ATTRIBUTES_SIZE },
- { "ALC_ALL_ATTRIBUTES", ALC_ALL_ATTRIBUTES },
- { "ALC_DEFAULT_DEVICE_SPECIFIER", ALC_DEFAULT_DEVICE_SPECIFIER },
- { "ALC_DEVICE_SPECIFIER", ALC_DEVICE_SPECIFIER },
- { "ALC_ALL_DEVICES_SPECIFIER", ALC_ALL_DEVICES_SPECIFIER },
- { "ALC_DEFAULT_ALL_DEVICES_SPECIFIER", ALC_DEFAULT_ALL_DEVICES_SPECIFIER },
- { "ALC_EXTENSIONS", ALC_EXTENSIONS },
- { "ALC_FREQUENCY", ALC_FREQUENCY },
- { "ALC_REFRESH", ALC_REFRESH },
- { "ALC_SYNC", ALC_SYNC },
- { "ALC_MONO_SOURCES", ALC_MONO_SOURCES },
- { "ALC_STEREO_SOURCES", ALC_STEREO_SOURCES },
- { "ALC_CAPTURE_DEVICE_SPECIFIER", ALC_CAPTURE_DEVICE_SPECIFIER },
- { "ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER", ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER},
- { "ALC_CAPTURE_SAMPLES", ALC_CAPTURE_SAMPLES },
- { "ALC_CONNECTED", ALC_CONNECTED },
-
- // EFX Properties
- { "ALC_EFX_MAJOR_VERSION", ALC_EFX_MAJOR_VERSION },
- { "ALC_EFX_MINOR_VERSION", ALC_EFX_MINOR_VERSION },
- { "ALC_MAX_AUXILIARY_SENDS", ALC_MAX_AUXILIARY_SENDS },
-
- // ALC Error Message
- { "ALC_NO_ERROR", ALC_NO_ERROR },
- { "ALC_INVALID_DEVICE", ALC_INVALID_DEVICE },
- { "ALC_INVALID_CONTEXT", ALC_INVALID_CONTEXT },
- { "ALC_INVALID_ENUM", ALC_INVALID_ENUM },
- { "ALC_INVALID_VALUE", ALC_INVALID_VALUE },
- { "ALC_OUT_OF_MEMORY", ALC_OUT_OF_MEMORY },
- { NULL, (ALCenum)0 }
-};
-// Error strings
-static const ALCchar alcNoError[] = "No Error";
-static const ALCchar alcErrInvalidDevice[] = "Invalid Device";
-static const ALCchar alcErrInvalidContext[] = "Invalid Context";
-static const ALCchar alcErrInvalidEnum[] = "Invalid Enum";
-static const ALCchar alcErrInvalidValue[] = "Invalid Value";
-static const ALCchar alcErrOutOfMemory[] = "Out of Memory";
-
-/* Device lists. Sizes only include the first ending null character, not the
- * second */
-static ALCchar *alcDeviceList;
-static size_t alcDeviceListSize;
-static ALCchar *alcAllDeviceList;
-static size_t alcAllDeviceListSize;
-static ALCchar *alcCaptureDeviceList;
-static size_t alcCaptureDeviceListSize;
-// Default is always the first in the list
-static ALCchar *alcDefaultDeviceSpecifier;
-static ALCchar *alcDefaultAllDeviceSpecifier;
-static ALCchar *alcCaptureDefaultDeviceSpecifier;
-
-
-static const ALCchar alcNoDeviceExtList[] =
- "ALC_ENUMERATE_ALL_EXT ALC_ENUMERATION_EXT ALC_EXT_CAPTURE "
- "ALC_EXT_thread_local_context";
-static const ALCchar alcExtensionList[] =
- "ALC_ENUMERATE_ALL_EXT ALC_ENUMERATION_EXT ALC_EXT_CAPTURE "
- "ALC_EXT_disconnect ALC_EXT_EFX ALC_EXT_thread_local_context";
-static const ALCint alcMajorVersion = 1;
-static const ALCint alcMinorVersion = 1;
-
-static const ALCint alcEFXMajorVersion = 1;
-static const ALCint alcEFXMinorVersion = 0;
-
-///////////////////////////////////////////////////////
-
-
-///////////////////////////////////////////////////////
-// Global Variables
-
-static ALCdevice *g_pDeviceList = NULL;
-static ALCuint g_ulDeviceCount = 0;
-
-static CRITICAL_SECTION g_csMutex;
-
-// Context List
-static ALCcontext *g_pContextList = NULL;
-static ALCuint g_ulContextCount = 0;
-
-// Thread-local current context
-static tls_type LocalContext;
-// Process-wide current context
-static ALCcontext *GlobalContext = NULL;
-
-// Context Error
-static ALCenum g_eLastNullDeviceError = ALC_NO_ERROR;
-
-// Default context extensions
-static const ALchar alExtList[] =
- "AL_EXT_DOUBLE AL_EXT_EXPONENT_DISTANCE AL_EXT_FLOAT32 AL_EXT_IMA4 "
- "AL_EXT_LINEAR_DISTANCE AL_EXT_MCFORMATS AL_EXT_MULAW "
- "AL_EXT_MULAW_MCFORMATS AL_EXT_OFFSET AL_EXT_source_distance_model "
- "AL_LOKI_quadriphonic AL_SOFT_buffer_sub_data AL_SOFT_loop_points";
-
-// Mixing Priority Level
-static ALint RTPrioLevel;
-
-// Output Log File
-static FILE *LogFile;
-
-///////////////////////////////////////////////////////
-
-
-///////////////////////////////////////////////////////
-// ALC Related helper functions
-static void ReleaseALC(void);
-
-#ifdef HAVE_GCC_DESTRUCTOR
-static void alc_init(void) __attribute__((constructor));
-static void alc_deinit(void) __attribute__((destructor));
-#else
-#ifdef _WIN32
-static void alc_init(void);
-static void alc_deinit(void);
-
-BOOL APIENTRY DllMain(HANDLE hModule,DWORD ul_reason_for_call,LPVOID lpReserved)
-{
- (void)lpReserved;
-
- // Perform actions based on the reason for calling.
- switch(ul_reason_for_call)
- {
- case DLL_PROCESS_ATTACH:
- DisableThreadLibraryCalls(hModule);
- alc_init();
- break;
-
- case DLL_PROCESS_DETACH:
- alc_deinit();
- break;
- }
- return TRUE;
-}
-#endif
-#endif
-
-static void alc_init(void)
-{
- int i;
- const char *devs, *str;
-
- str = getenv("ALSOFT_LOGFILE");
- if(str && str[0])
- {
- LogFile = fopen(str, "w");
- if(!LogFile)
- fprintf(stderr, "AL lib: Failed to open log file '%s'\n", str);
- }
- if(!LogFile)
- LogFile = stderr;
-
- InitializeCriticalSection(&g_csMutex);
- ALTHUNK_INIT();
- ReadALConfig();
-
- tls_create(&LocalContext);
-
- RTPrioLevel = GetConfigValueInt(NULL, "rt-prio", 0);
-
- DefaultResampler = GetConfigValueInt(NULL, "resampler", RESAMPLER_DEFAULT);
- if(DefaultResampler >= RESAMPLER_MAX || DefaultResampler <= RESAMPLER_MIN)
- DefaultResampler = RESAMPLER_DEFAULT;
-
- devs = GetConfigValue(NULL, "drivers", "");
- if(devs[0])
- {
- int n;
- size_t len;
- const char *next = devs;
- int endlist, delitem;
-
- i = 0;
- do {
- devs = next;
- next = strchr(devs, ',');
-
- delitem = (devs[0] == '-');
- if(devs[0] == '-') devs++;
-
- if(!devs[0] || devs[0] == ',')
- {
- endlist = 0;
- continue;
- }
- endlist = 1;
-
- len = (next ? ((size_t)(next-devs)) : strlen(devs));
- for(n = i;BackendList[n].Init;n++)
- {
- if(len == strlen(BackendList[n].name) &&
- strncmp(BackendList[n].name, devs, len) == 0)
- {
- if(delitem)
- {
- do {
- BackendList[n] = BackendList[n+1];
- ++n;
- } while(BackendList[n].Init);
- }
- else
- {
- BackendInfo Bkp = BackendList[n];
- while(n > i)
- {
- BackendList[n] = BackendList[n-1];
- --n;
- }
- BackendList[n] = Bkp;
-
- i++;
- }
- break;
- }
- }
- } while(next++);
-
- if(endlist)
- {
- BackendList[i].name = NULL;
- BackendList[i].Init = NULL;
- BackendList[i].Deinit = NULL;
- BackendList[i].Probe = NULL;
- }
- }
-
- for(i = 0;BackendList[i].Init;i++)
- BackendList[i].Init(&BackendList[i].Funcs);
-
- str = GetConfigValue(NULL, "excludefx", "");
- if(str[0])
- {
- const struct {
- const char *name;
- int type;
- } EffectList[] = {
- { "eaxreverb", EAXREVERB },
- { "reverb", REVERB },
- { "echo", ECHO },
- { "modulator", MODULATOR },
- { NULL, 0 }
- };
- int n;
- size_t len;
- const char *next = str;
-
- do {
- str = next;
- next = strchr(str, ',');
-
- if(!str[0] || next == str)
- continue;
-
- len = (next ? ((size_t)(next-str)) : strlen(str));
- for(n = 0;EffectList[n].name;n++)
- {
- if(len == strlen(EffectList[n].name) &&
- strncmp(EffectList[n].name, str, len) == 0)
- DisabledEffects[EffectList[n].type] = AL_TRUE;
- }
- } while(next++);
- }
-}
-
-static void alc_deinit(void)
-{
- int i;
-
- ReleaseALC();
-
- for(i = 0;BackendList[i].Deinit;i++)
- BackendList[i].Deinit();
-
- tls_delete(LocalContext);
-
- FreeALConfig();
- ALTHUNK_EXIT();
- DeleteCriticalSection(&g_csMutex);
-
- if(LogFile != stderr)
- fclose(LogFile);
- LogFile = NULL;
-}
-
-
-static void ProbeDeviceList()
-{
- ALint i;
-
- free(alcDeviceList); alcDeviceList = NULL;
- alcDeviceListSize = 0;
-
- for(i = 0;BackendList[i].Probe;i++)
- BackendList[i].Probe(DEVICE_PROBE);
-}
-
-static void ProbeAllDeviceList()
-{
- ALint i;
-
- free(alcAllDeviceList); alcAllDeviceList = NULL;
- alcAllDeviceListSize = 0;
-
- for(i = 0;BackendList[i].Probe;i++)
- BackendList[i].Probe(ALL_DEVICE_PROBE);
-}
-
-static void ProbeCaptureDeviceList()
-{
- ALint i;
-
- free(alcCaptureDeviceList); alcCaptureDeviceList = NULL;
- alcCaptureDeviceListSize = 0;
-
- for(i = 0;BackendList[i].Probe;i++)
- BackendList[i].Probe(CAPTURE_DEVICE_PROBE);
-}
-
-
-static void AppendList(const ALCchar *name, ALCchar **List, size_t *ListSize)
-{
- size_t len = strlen(name);
- void *temp;
-
- if(len == 0)
- return;
-
- temp = realloc(*List, (*ListSize) + len + 2);
- if(!temp)
- {
- AL_PRINT("Realloc failed to add %s!\n", name);
- return;
- }
- *List = temp;
-
- memcpy((*List)+(*ListSize), name, len+1);
- *ListSize += len+1;
- (*List)[*ListSize] = 0;
-}
-
-#define DECL_APPEND_LIST_FUNC(type) \
-void Append##type##List(const ALCchar *name) \
-{ AppendList(name, &alc##type##List, &alc##type##ListSize); }
-
-DECL_APPEND_LIST_FUNC(Device)
-DECL_APPEND_LIST_FUNC(AllDevice)
-DECL_APPEND_LIST_FUNC(CaptureDevice)
-
-#undef DECL_APPEND_LIST_FUNC
-
-
-void al_print(const char *fname, unsigned int line, const char *fmt, ...)
-{
- const char *fn;
- char str[256];
- int i;
-
- fn = strrchr(fname, '/');
- if(!fn) fn = strrchr(fname, '\\');;
- if(!fn) fn = fname;
- else fn += 1;
-
- i = snprintf(str, sizeof(str), "AL lib: %s:%d: ", fn, line);
- if(i < (int)sizeof(str) && i > 0)
- {
- va_list ap;
- va_start(ap, fmt);
- vsnprintf(str+i, sizeof(str)-i, fmt, ap);
- va_end(ap);
- }
- str[sizeof(str)-1] = 0;
-
- fprintf(LogFile, "%s", str);
- fflush(LogFile);
-}
-
-void SetRTPriority(void)
-{
- ALboolean failed;
-
-#ifdef _WIN32
- if(RTPrioLevel > 0)
- failed = !SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
- else
- failed = !SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL);
-#elif defined(HAVE_PTHREAD_SETSCHEDPARAM)
- struct sched_param param;
-
- if(RTPrioLevel > 0)
- {
- /* Use the minimum real-time priority possible for now (on Linux this
- * should be 1 for SCHED_RR) */
- param.sched_priority = sched_get_priority_min(SCHED_RR);
- failed = !!pthread_setschedparam(pthread_self(), SCHED_RR, ¶m);
- }
- else
- {
- param.sched_priority = 0;
- failed = !!pthread_setschedparam(pthread_self(), SCHED_OTHER, ¶m);
- }
-#else
- /* Real-time priority not available */
- failed = (RTPrioLevel>0);
-#endif
- if(failed)
- AL_PRINT("Failed to set priority level for thread\n");
-}
-
-
-void InitUIntMap(UIntMap *map)
-{
- map->array = NULL;
- map->size = 0;
- map->maxsize = 0;
-}
-
-void ResetUIntMap(UIntMap *map)
-{
- free(map->array);
- map->array = NULL;
- map->size = 0;
- map->maxsize = 0;
-}
-
-ALenum InsertUIntMapEntry(UIntMap *map, ALuint key, ALvoid *value)
-{
- ALsizei pos = 0;
-
- if(map->size > 0)
- {
- ALsizei low = 0;
- ALsizei high = map->size - 1;
- while(low < high)
- {
- ALsizei mid = low + (high-low)/2;
- if(map->array[mid].key < key)
- low = mid + 1;
- else
- high = mid;
- }
- if(map->array[low].key < key)
- low++;
- pos = low;
- }
-
- if(pos == map->size || map->array[pos].key != key)
- {
- if(map->size == map->maxsize)
- {
- ALvoid *temp;
- ALsizei newsize;
-
- newsize = (map->maxsize ? (map->maxsize<<1) : 4);
- if(newsize < map->maxsize)
- return AL_OUT_OF_MEMORY;
-
- temp = realloc(map->array, newsize*sizeof(map->array[0]));
- if(!temp) return AL_OUT_OF_MEMORY;
- map->array = temp;
- map->maxsize = newsize;
- }
-
- map->size++;
- if(pos < map->size-1)
- memmove(&map->array[pos+1], &map->array[pos],
- (map->size-1-pos)*sizeof(map->array[0]));
- }
- map->array[pos].key = key;
- map->array[pos].value = value;
-
- return AL_NO_ERROR;
-}
-
-void RemoveUIntMapKey(UIntMap *map, ALuint key)
-{
- if(map->size > 0)
- {
- ALsizei low = 0;
- ALsizei high = map->size - 1;
- while(low < high)
- {
- ALsizei mid = low + (high-low)/2;
- if(map->array[mid].key < key)
- low = mid + 1;
- else
- high = mid;
- }
- if(map->array[low].key == key)
- {
- if(low < map->size-1)
- memmove(&map->array[low], &map->array[low+1],
- (map->size-1-low)*sizeof(map->array[0]));
- map->size--;
- }
- }
-}
-
-ALvoid *LookupUIntMapKey(UIntMap *map, ALuint key)
-{
- if(map->size > 0)
- {
- ALsizei low = 0;
- ALsizei high = map->size - 1;
- while(low < high)
- {
- ALsizei mid = low + (high-low)/2;
- if(map->array[mid].key < key)
- low = mid + 1;
- else
- high = mid;
- }
- if(map->array[low].key == key)
- return map->array[low].value;
- }
- return NULL;
-}
-
-
-ALuint BytesFromDevFmt(enum DevFmtType type)
-{
- switch(type)
- {
- case DevFmtByte: return sizeof(ALbyte);
- case DevFmtUByte: return sizeof(ALubyte);
- case DevFmtShort: return sizeof(ALshort);
- case DevFmtUShort: return sizeof(ALushort);
- case DevFmtFloat: return sizeof(ALfloat);
- }
- return 0;
-}
-ALuint ChannelsFromDevFmt(enum DevFmtChannels chans)
-{
- switch(chans)
- {
- case DevFmtMono: return 1;
- case DevFmtStereo: return 2;
- case DevFmtQuad: return 4;
- case DevFmtX51: return 6;
- case DevFmtX61: return 7;
- case DevFmtX71: return 8;
- }
- return 0;
-}
-ALboolean DecomposeDevFormat(ALenum format, enum DevFmtChannels *chans,
- enum DevFmtType *type)
-{
- switch(format)
- {
- case AL_FORMAT_MONO8:
- *chans = DevFmtMono;
- *type = DevFmtUByte;
- return AL_TRUE;
- case AL_FORMAT_MONO16:
- *chans = DevFmtMono;
- *type = DevFmtShort;
- return AL_TRUE;
- case AL_FORMAT_MONO_FLOAT32:
- *chans = DevFmtMono;
- *type = DevFmtFloat;
- return AL_TRUE;
- case AL_FORMAT_STEREO8:
- *chans = DevFmtStereo;
- *type = DevFmtUByte;
- return AL_TRUE;
- case AL_FORMAT_STEREO16:
- *chans = DevFmtStereo;
- *type = DevFmtShort;
- return AL_TRUE;
- case AL_FORMAT_STEREO_FLOAT32:
- *chans = DevFmtStereo;
- *type = DevFmtFloat;
- return AL_TRUE;
- case AL_FORMAT_QUAD8:
- *chans = DevFmtQuad;
- *type = DevFmtUByte;
- return AL_TRUE;
- case AL_FORMAT_QUAD16:
- *chans = DevFmtQuad;
- *type = DevFmtShort;
- return AL_TRUE;
- case AL_FORMAT_QUAD32:
- *chans = DevFmtQuad;
- *type = DevFmtFloat;
- return AL_TRUE;
- case AL_FORMAT_51CHN8:
- *chans = DevFmtX51;
- *type = DevFmtUByte;
- return AL_TRUE;
- case AL_FORMAT_51CHN16:
- *chans = DevFmtX51;
- *type = DevFmtShort;
- return AL_TRUE;
- case AL_FORMAT_51CHN32:
- *chans = DevFmtX51;
- *type = DevFmtFloat;
- return AL_TRUE;
- case AL_FORMAT_61CHN8:
- *chans = DevFmtX61;
- *type = DevFmtUByte;
- return AL_TRUE;
- case AL_FORMAT_61CHN16:
- *chans = DevFmtX61;
- *type = DevFmtShort;
- return AL_TRUE;
- case AL_FORMAT_61CHN32:
- *chans = DevFmtX61;
- *type = DevFmtFloat;
- return AL_TRUE;
- case AL_FORMAT_71CHN8:
- *chans = DevFmtX71;
- *type = DevFmtUByte;
- return AL_TRUE;
- case AL_FORMAT_71CHN16:
- *chans = DevFmtX71;
- *type = DevFmtShort;
- return AL_TRUE;
- case AL_FORMAT_71CHN32:
- *chans = DevFmtX71;
- *type = DevFmtFloat;
- return AL_TRUE;
- }
- return AL_FALSE;
-}
-
-/*
- IsDevice
-
- Check pDevice is a valid Device pointer
-*/
-static ALCboolean IsDevice(ALCdevice *pDevice)
-{
- ALCdevice *pTempDevice;
-
- SuspendContext(NULL);
-
- pTempDevice = g_pDeviceList;
- while(pTempDevice && pTempDevice != pDevice)
- pTempDevice = pTempDevice->next;
-
- ProcessContext(NULL);
-
- return (pTempDevice ? ALC_TRUE : ALC_FALSE);
-}
-
-/*
- IsContext
-
- Check pContext is a valid Context pointer
-*/
-static ALCboolean IsContext(ALCcontext *pContext)
-{
- ALCcontext *pTempContext;
-
- SuspendContext(NULL);
-
- pTempContext = g_pContextList;
- while (pTempContext && pTempContext != pContext)
- pTempContext = pTempContext->next;
-
- ProcessContext(NULL);
-
- return (pTempContext ? ALC_TRUE : ALC_FALSE);
-}
-
-
-/*
- alcSetError
-
- Store latest ALC Error
-*/
-ALCvoid alcSetError(ALCdevice *device, ALenum errorCode)
-{
- if(IsDevice(device))
- device->LastError = errorCode;
- else
- g_eLastNullDeviceError = errorCode;
-}
-
-
-/* UpdateDeviceParams:
- *
- * Updates device parameters according to the attribute list.
- */
-static ALCboolean UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
-{
- ALCuint freq, numMono, numStereo, numSends;
- ALboolean running;
- ALuint oldRate;
- ALuint attrIdx;
- ALuint i;
-
- running = ((device->NumContexts > 0) ? AL_TRUE : AL_FALSE);
- oldRate = device->Frequency;
-
- // Check for attributes
- if(attrList && attrList[0])
- {
- // If a context is already running on the device, stop playback so the
- // device attributes can be updated
- if(running)
- {
- ProcessContext(NULL);
- ALCdevice_StopPlayback(device);
- SuspendContext(NULL);
- running = AL_FALSE;
- }
-
- freq = device->Frequency;
- numMono = device->NumMonoSources;
- numStereo = device->NumStereoSources;
- numSends = device->NumAuxSends;
-
- attrIdx = 0;
- while(attrList[attrIdx])
- {
- if(attrList[attrIdx] == ALC_FREQUENCY &&
- !ConfigValueExists(NULL, "frequency"))
- {
- freq = attrList[attrIdx + 1];
- if(freq < 8000)
- freq = 8000;
- }
-
- if(attrList[attrIdx] == ALC_STEREO_SOURCES)
- {
- numStereo = attrList[attrIdx + 1];
- if(numStereo > device->MaxNoOfSources)
- numStereo = device->MaxNoOfSources;
-
- numMono = device->MaxNoOfSources - numStereo;
- }
-
- if(attrList[attrIdx] == ALC_MAX_AUXILIARY_SENDS &&
- !ConfigValueExists(NULL, "sends"))
- {
- numSends = attrList[attrIdx + 1];
- if(numSends > MAX_SENDS)
- numSends = MAX_SENDS;
- }
-
- attrIdx += 2;
- }
-
- device->UpdateSize = (ALuint64)device->UpdateSize * freq /
- device->Frequency;
-
- device->Frequency = freq;
- device->NumMonoSources = numMono;
- device->NumStereoSources = numStereo;
- device->NumAuxSends = numSends;
- }
-
- if(running)
- return ALC_TRUE;
-
- if(ALCdevice_ResetPlayback(device) == ALC_FALSE)
- return ALC_FALSE;
-
- aluInitPanning(device);
-
- for(i = 0;i < MAXCHANNELS;i++)
- {
- device->ClickRemoval[i] = int2ALfp(0);
- device->PendingClicks[i] = int2ALfp(0);
- }
-
- for(i = 0;i < device->NumContexts;i++)
- {
- ALCcontext *context = device->Contexts[i];
- ALsizei pos;
-
- SuspendContext(context);
- for(pos = 0;pos < context->EffectSlotMap.size;pos++)
- {
- ALeffectslot *slot = context->EffectSlotMap.array[pos].value;
-
- if(ALEffect_DeviceUpdate(slot->EffectState, device) == AL_FALSE)
- {
- ProcessContext(context);
- return ALC_FALSE;
- }
- ALEffect_Update(slot->EffectState, context, &slot->effect);
- }
-
- for(pos = 0;pos < context->SourceMap.size;pos++)
- {
- ALsource *source = context->SourceMap.array[pos].value;
- ALuint s = device->NumAuxSends;
- while(s < MAX_SENDS)
- {
- if(source->Send[s].Slot)
- source->Send[s].Slot->refcount--;
- source->Send[s].Slot = NULL;
- source->Send[s].WetFilter.type = 0;
- source->Send[s].WetFilter.filter = 0;
- s++;
- }
- source->NeedsUpdate = AL_TRUE;
- }
- ProcessContext(context);
- }
-
- if(device->Bs2bLevel > 0 && device->Bs2bLevel <= 6)
- {
- if(!device->Bs2b)
- {
- device->Bs2b = calloc(1, sizeof(*device->Bs2b));
- bs2b_clear(device->Bs2b);
- }
- bs2b_set_srate(device->Bs2b, device->Frequency);
- bs2b_set_level(device->Bs2b, device->Bs2bLevel);
- }
- else
- {
- free(device->Bs2b);
- device->Bs2b = NULL;
- }
-
- if(ChannelsFromDevFmt(device->FmtChans) <= 2)
- {
- device->HeadDampen = float2ALfp(GetConfigValueFloat(NULL, "head_dampen", DEFAULT_HEAD_DAMPEN));
- device->HeadDampen = __min(device->HeadDampen, int2ALfp(1));
- device->HeadDampen = __max(device->HeadDampen, int2ALfp(0));
- }
- else
- device->HeadDampen = int2ALfp(0);
-
- return ALC_TRUE;
-}
-
-
-/*
- SuspendContext
-
- Thread-safe entry
-*/
-ALCvoid SuspendContext(ALCcontext *pContext)
-{
- (void)pContext;
- EnterCriticalSection(&g_csMutex);
-}
-
-
-/*
- ProcessContext
-
- Thread-safe exit
-*/
-ALCvoid ProcessContext(ALCcontext *pContext)
-{
- (void)pContext;
- LeaveCriticalSection(&g_csMutex);
-}
-
-
-/*
- GetContextSuspended
-
- Returns the currently active Context, in a locked state
-*/
-ALCcontext *GetContextSuspended(void)
-{
- ALCcontext *pContext = NULL;
-
- SuspendContext(NULL);
-
- pContext = tls_get(LocalContext);
- if(pContext && !IsContext(pContext))
- {
- tls_set(LocalContext, NULL);
- pContext = NULL;
- }
- if(!pContext)
- pContext = GlobalContext;
-
- if(pContext)
- SuspendContext(pContext);
-
- ProcessContext(NULL);
-
- return pContext;
-}
-
-
-/*
- InitContext
-
- Initialize Context variables
-*/
-static ALvoid InitContext(ALCcontext *pContext)
-{
- //Initialise listener
- pContext->Listener.Gain = int2ALfp(1);
- pContext->Listener.MetersPerUnit = int2ALfp(1);
- pContext->Listener.Position[0] = int2ALfp(0);
- pContext->Listener.Position[1] = int2ALfp(0);
- pContext->Listener.Position[2] = int2ALfp(0);
- pContext->Listener.Velocity[0] = int2ALfp(0);
- pContext->Listener.Velocity[1] = int2ALfp(0);
- pContext->Listener.Velocity[2] = int2ALfp(0);
- pContext->Listener.Forward[0] = int2ALfp(0);
- pContext->Listener.Forward[1] = int2ALfp(0);
- pContext->Listener.Forward[2] = int2ALfp(-1);
- pContext->Listener.Up[0] = int2ALfp(0);
- pContext->Listener.Up[1] = int2ALfp(1);
- pContext->Listener.Up[2] = int2ALfp(0);
-
- //Validate pContext
- pContext->LastError = AL_NO_ERROR;
- pContext->Suspended = AL_FALSE;
- pContext->ActiveSourceCount = 0;
- InitUIntMap(&pContext->SourceMap);
- InitUIntMap(&pContext->EffectSlotMap);
-
- //Set globals
- pContext->DistanceModel = AL_INVERSE_DISTANCE_CLAMPED;
- pContext->SourceDistanceModel = AL_FALSE;
- pContext->DopplerFactor = int2ALfp(1);
- pContext->DopplerVelocity = int2ALfp(1);
- pContext->flSpeedOfSound = float2ALfp(SPEEDOFSOUNDMETRESPERSEC);
- pContext->PrioritySlots = 0;
-
- pContext->ExtensionList = alExtList;
-}
-
-
-/*
- ExitContext
-
- Clean up Context, destroy any remaining Sources
-*/
-static ALCvoid ExitContext(ALCcontext *pContext)
-{
- //Invalidate context
- pContext->LastError = AL_NO_ERROR;
-}
-
-///////////////////////////////////////////////////////
-
-
-///////////////////////////////////////////////////////
-// ALC Functions calls
-
-
-// This should probably move to another c file but for now ...
-ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice(const ALCchar *deviceName, ALCuint frequency, ALCenum format, ALCsizei SampleSize)
-{
- ALCboolean DeviceFound = ALC_FALSE;
- ALCdevice *device = NULL;
- ALCint i;
-
- if(SampleSize <= 0)
- {
- alcSetError(NULL, ALC_INVALID_VALUE);
- return NULL;
- }
-
- if(deviceName && !deviceName[0])
- deviceName = NULL;
-
- device = calloc(1, sizeof(ALCdevice));
- if(!device)
- {
- alcSetError(NULL, ALC_OUT_OF_MEMORY);
- return NULL;
- }
-
- //Validate device
- device->Connected = ALC_TRUE;
- device->IsCaptureDevice = AL_TRUE;
-
- device->szDeviceName = NULL;
-
- device->Frequency = frequency;
- if(DecomposeDevFormat(format, &device->FmtChans, &device->FmtType) == AL_FALSE)
- {
- free(device);
- alcSetError(NULL, ALC_INVALID_ENUM);
- return NULL;
- }
-
- device->UpdateSize = SampleSize;
- device->NumUpdates = 1;
-
- SuspendContext(NULL);
- for(i = 0;BackendList[i].Init;i++)
- {
- device->Funcs = &BackendList[i].Funcs;
- if(ALCdevice_OpenCapture(device, deviceName))
- {
- device->next = g_pDeviceList;
- g_pDeviceList = device;
- g_ulDeviceCount++;
-
- DeviceFound = ALC_TRUE;
- break;
- }
- }
- ProcessContext(NULL);
-
- if(!DeviceFound)
- {
- alcSetError(NULL, ALC_INVALID_VALUE);
- free(device);
- device = NULL;
- }
-
- return device;
-}
-
-ALC_API ALCboolean ALC_APIENTRY alcCaptureCloseDevice(ALCdevice *pDevice)
-{
- ALCdevice **list;
-
- if(!IsDevice(pDevice) || !pDevice->IsCaptureDevice)
- {
- alcSetError(pDevice, ALC_INVALID_DEVICE);
- return ALC_FALSE;
- }
-
- SuspendContext(NULL);
-
- list = &g_pDeviceList;
- while(*list != pDevice)
- list = &(*list)->next;
-
- *list = (*list)->next;
- g_ulDeviceCount--;
-
- ProcessContext(NULL);
-
- ALCdevice_CloseCapture(pDevice);
-
- free(pDevice->szDeviceName);
- pDevice->szDeviceName = NULL;
-
- free(pDevice);
-
- return ALC_TRUE;
-}
-
-ALC_API void ALC_APIENTRY alcCaptureStart(ALCdevice *device)
-{
- SuspendContext(NULL);
- if(!IsDevice(device) || !device->IsCaptureDevice)
- alcSetError(device, ALC_INVALID_DEVICE);
- else if(device->Connected)
- ALCdevice_StartCapture(device);
- ProcessContext(NULL);
-}
-
-ALC_API void ALC_APIENTRY alcCaptureStop(ALCdevice *device)
-{
- SuspendContext(NULL);
- if(!IsDevice(device) || !device->IsCaptureDevice)
- alcSetError(device, ALC_INVALID_DEVICE);
- else
- ALCdevice_StopCapture(device);
- ProcessContext(NULL);
-}
-
-ALC_API void ALC_APIENTRY alcCaptureSamples(ALCdevice *device, ALCvoid *buffer, ALCsizei samples)
-{
- SuspendContext(NULL);
- if(!IsDevice(device) || !device->IsCaptureDevice)
- alcSetError(device, ALC_INVALID_DEVICE);
- else
- ALCdevice_CaptureSamples(device, buffer, samples);
- ProcessContext(NULL);
-}
-
-/*
- alcGetError
-
- Return last ALC generated error code
-*/
-ALC_API ALCenum ALC_APIENTRY alcGetError(ALCdevice *device)
-{
- ALCenum errorCode;
-
- if(IsDevice(device))
- {
- errorCode = device->LastError;
- device->LastError = ALC_NO_ERROR;
- }
- else
- {
- errorCode = g_eLastNullDeviceError;
- g_eLastNullDeviceError = ALC_NO_ERROR;
- }
- return errorCode;
-}
-
-
-/*
- alcSuspendContext
-
- Not functional
-*/
-ALC_API ALCvoid ALC_APIENTRY alcSuspendContext(ALCcontext *pContext)
-{
- SuspendContext(NULL);
- if(IsContext(pContext))
- pContext->Suspended = AL_TRUE;
- ProcessContext(NULL);
-}
-
-
-/*
- alcProcessContext
-
- Not functional
-*/
-ALC_API ALCvoid ALC_APIENTRY alcProcessContext(ALCcontext *pContext)
-{
- SuspendContext(NULL);
- if(IsContext(pContext))
- pContext->Suspended = AL_FALSE;
- ProcessContext(NULL);
-}
-
-
-/*
- alcGetString
-
- Returns information about the Device, and error strings
-*/
-ALC_API const ALCchar* ALC_APIENTRY alcGetString(ALCdevice *pDevice,ALCenum param)
-{
- const ALCchar *value = NULL;
-
- switch (param)
- {
- case ALC_NO_ERROR:
- value = alcNoError;
- break;
-
- case ALC_INVALID_ENUM:
- value = alcErrInvalidEnum;
- break;
-
- case ALC_INVALID_VALUE:
- value = alcErrInvalidValue;
- break;
-
- case ALC_INVALID_DEVICE:
- value = alcErrInvalidDevice;
- break;
-
- case ALC_INVALID_CONTEXT:
- value = alcErrInvalidContext;
- break;
-
- case ALC_OUT_OF_MEMORY:
- value = alcErrOutOfMemory;
- break;
-
- case ALC_DEVICE_SPECIFIER:
- if(IsDevice(pDevice))
- value = pDevice->szDeviceName;
- else
- {
- ProbeDeviceList();
- value = alcDeviceList;
- }
- break;
-
- case ALC_ALL_DEVICES_SPECIFIER:
- ProbeAllDeviceList();
- value = alcAllDeviceList;
- break;
-
- case ALC_CAPTURE_DEVICE_SPECIFIER:
- if(IsDevice(pDevice))
- value = pDevice->szDeviceName;
- else
- {
- ProbeCaptureDeviceList();
- value = alcCaptureDeviceList;
- }
- break;
-
- /* Default devices are always first in the list */
- case ALC_DEFAULT_DEVICE_SPECIFIER:
- if(!alcDeviceList)
- ProbeDeviceList();
-
- free(alcDefaultDeviceSpecifier);
- alcDefaultDeviceSpecifier = strdup(alcDeviceList ? alcDeviceList : "");
- if(!alcDefaultDeviceSpecifier)
- alcSetError(pDevice, ALC_OUT_OF_MEMORY);
- value = alcDefaultDeviceSpecifier;
- break;
-
- case ALC_DEFAULT_ALL_DEVICES_SPECIFIER:
- if(!alcAllDeviceList)
- ProbeAllDeviceList();
-
- free(alcDefaultAllDeviceSpecifier);
- alcDefaultAllDeviceSpecifier = strdup(alcAllDeviceList ?
- alcAllDeviceList : "");
- if(!alcDefaultAllDeviceSpecifier)
- alcSetError(pDevice, ALC_OUT_OF_MEMORY);
- value = alcDefaultAllDeviceSpecifier;
- break;
-
- case ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER:
- if(!alcCaptureDeviceList)
- ProbeCaptureDeviceList();
-
- free(alcCaptureDefaultDeviceSpecifier);
- alcCaptureDefaultDeviceSpecifier = strdup(alcCaptureDeviceList ?
- alcCaptureDeviceList : "");
- if(!alcCaptureDefaultDeviceSpecifier)
- alcSetError(pDevice, ALC_OUT_OF_MEMORY);
- value = alcCaptureDefaultDeviceSpecifier;
- break;
-
- case ALC_EXTENSIONS:
- if(IsDevice(pDevice))
- value = alcExtensionList;
- else
- value = alcNoDeviceExtList;
- break;
-
- default:
- alcSetError(pDevice, ALC_INVALID_ENUM);
- break;
- }
-
- return value;
-}
-
-
-/*
- alcGetIntegerv
-
- Returns information about the Device and the version of Open AL
-*/
-ALC_API ALCvoid ALC_APIENTRY alcGetIntegerv(ALCdevice *device,ALCenum param,ALsizei size,ALCint *data)
-{
- if(size == 0 || data == NULL)
- {
- alcSetError(device, ALC_INVALID_VALUE);
- return;
- }
-
- if(IsDevice(device) && device->IsCaptureDevice)
- {
- SuspendContext(NULL);
-
- // Capture device
- switch (param)
- {
- case ALC_CAPTURE_SAMPLES:
- *data = ALCdevice_AvailableSamples(device);
- break;
-
- case ALC_CONNECTED:
- *data = device->Connected;
- break;
-
- default:
- alcSetError(device, ALC_INVALID_ENUM);
- break;
- }
-
- ProcessContext(NULL);
- return;
- }
-
- // Playback Device
- switch (param)
- {
- case ALC_MAJOR_VERSION:
- *data = alcMajorVersion;
- break;
-
- case ALC_MINOR_VERSION:
- *data = alcMinorVersion;
- break;
-
- case ALC_EFX_MAJOR_VERSION:
- *data = alcEFXMajorVersion;
- break;
-
- case ALC_EFX_MINOR_VERSION:
- *data = alcEFXMinorVersion;
- break;
-
- case ALC_MAX_AUXILIARY_SENDS:
- if(!IsDevice(device))
- alcSetError(device, ALC_INVALID_DEVICE);
- else
- *data = device->NumAuxSends;
- break;
-
- case ALC_ATTRIBUTES_SIZE:
- if(!IsDevice(device))
- alcSetError(device, ALC_INVALID_DEVICE);
- else
- *data = 13;
- break;
-
- case ALC_ALL_ATTRIBUTES:
- if(!IsDevice(device))
- alcSetError(device, ALC_INVALID_DEVICE);
- else if (size < 13)
- alcSetError(device, ALC_INVALID_VALUE);
- else
- {
- int i = 0;
-
- SuspendContext(NULL);
- data[i++] = ALC_FREQUENCY;
- data[i++] = device->Frequency;
-
- data[i++] = ALC_REFRESH;
- data[i++] = device->Frequency / device->UpdateSize;
-
- data[i++] = ALC_SYNC;
- data[i++] = ALC_FALSE;
-
- data[i++] = ALC_MONO_SOURCES;
- data[i++] = device->NumMonoSources;
-
- data[i++] = ALC_STEREO_SOURCES;
- data[i++] = device->NumStereoSources;
-
- data[i++] = ALC_MAX_AUXILIARY_SENDS;
- data[i++] = device->NumAuxSends;
-
- data[i++] = 0;
- ProcessContext(NULL);
- }
- break;
-
- case ALC_FREQUENCY:
- if(!IsDevice(device))
- alcSetError(device, ALC_INVALID_DEVICE);
- else
- *data = device->Frequency;
- break;
-
- case ALC_REFRESH:
- if(!IsDevice(device))
- alcSetError(device, ALC_INVALID_DEVICE);
- else
- *data = device->Frequency / device->UpdateSize;
- break;
-
- case ALC_SYNC:
- if(!IsDevice(device))
- alcSetError(device, ALC_INVALID_DEVICE);
- else
- *data = ALC_FALSE;
- break;
-
- case ALC_MONO_SOURCES:
- if(!IsDevice(device))
- alcSetError(device, ALC_INVALID_DEVICE);
- else
- *data = device->NumMonoSources;
- break;
-
- case ALC_STEREO_SOURCES:
- if(!IsDevice(device))
- alcSetError(device, ALC_INVALID_DEVICE);
- else
- *data = device->NumStereoSources;
- break;
-
- case ALC_CONNECTED:
- if(!IsDevice(device))
- alcSetError(device, ALC_INVALID_DEVICE);
- else
- *data = device->Connected;
- break;
-
- default:
- alcSetError(device, ALC_INVALID_ENUM);
- break;
- }
-}
-
-
-/*
- alcIsExtensionPresent
-
- Determines if there is support for a particular extension
-*/
-ALC_API ALCboolean ALC_APIENTRY alcIsExtensionPresent(ALCdevice *device, const ALCchar *extName)
-{
- ALCboolean bResult = ALC_FALSE;
- const char *ptr;
- size_t len;
-
- if(!extName)
- {
- alcSetError(device, ALC_INVALID_VALUE);
- return ALC_FALSE;
- }
-
- len = strlen(extName);
- ptr = (IsDevice(device) ? alcExtensionList : alcNoDeviceExtList);
- while(ptr && *ptr)
- {
- if(strncasecmp(ptr, extName, len) == 0 &&
- (ptr[len] == '\0' || isspace(ptr[len])))
- {
- bResult = ALC_TRUE;
- break;
- }
- if((ptr=strchr(ptr, ' ')) != NULL)
- {
- do {
- ++ptr;
- } while(isspace(*ptr));
- }
- }
-
- return bResult;
-}
-
-
-/*
- alcGetProcAddress
-
- Retrieves the function address for a particular extension function
-*/
-ALC_API ALCvoid* ALC_APIENTRY alcGetProcAddress(ALCdevice *device, const ALCchar *funcName)
-{
- ALsizei i = 0;
-
- if(!funcName)
- {
- alcSetError(device, ALC_INVALID_VALUE);
- return NULL;
- }
-
- while(alcFunctions[i].funcName && strcmp(alcFunctions[i].funcName,funcName) != 0)
- i++;
- return alcFunctions[i].address;
-}
-
-
-/*
- alcGetEnumValue
-
- Get the value for a particular ALC Enumerated Value
-*/
-ALC_API ALCenum ALC_APIENTRY alcGetEnumValue(ALCdevice *device, const ALCchar *enumName)
-{
- ALsizei i = 0;
-
- if(!enumName)
- {
- alcSetError(device, ALC_INVALID_VALUE);
- return (ALCenum)0;
- }
-
- while(enumeration[i].enumName && strcmp(enumeration[i].enumName,enumName) != 0)
- i++;
- return enumeration[i].value;
-}
-
-
-/*
- alcCreateContext
-
- Create and attach a Context to a particular Device.
-*/
-ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCint *attrList)
-{
- ALCcontext *ALContext;
- void *temp;
-
- SuspendContext(NULL);
-
- if(!IsDevice(device) || device->IsCaptureDevice || !device->Connected)
- {
- alcSetError(device, ALC_INVALID_DEVICE);
- ProcessContext(NULL);
- return NULL;
- }
-
- // Reset Context Last Error code
- device->LastError = ALC_NO_ERROR;
-
- if(UpdateDeviceParams(device, attrList) == ALC_FALSE)
- {
- alcSetError(device, ALC_INVALID_DEVICE);
- aluHandleDisconnect(device);
- ProcessContext(NULL);
- ALCdevice_StopPlayback(device);
- return NULL;
- }
-
- ALContext = NULL;
- temp = realloc(device->Contexts, (device->NumContexts+1) * sizeof(*device->Contexts));
- if(temp)
- {
- device->Contexts = temp;
-
- ALContext = calloc(1, sizeof(ALCcontext));
- if(ALContext)
- {
- ALContext->MaxActiveSources = 256;
- ALContext->ActiveSources = malloc(sizeof(ALContext->ActiveSources[0]) *
- ALContext->MaxActiveSources);
- }
- }
- if(!ALContext || !ALContext->ActiveSources)
- {
- free(ALContext);
- alcSetError(device, ALC_OUT_OF_MEMORY);
- ProcessContext(NULL);
- if(device->NumContexts == 0)
- ALCdevice_StopPlayback(device);
- return NULL;
- }
-
- device->Contexts[device->NumContexts++] = ALContext;
- ALContext->Device = device;
-
- InitContext(ALContext);
-
- ALContext->next = g_pContextList;
- g_pContextList = ALContext;
- g_ulContextCount++;
-
- ProcessContext(NULL);
-
- return ALContext;
-}
-
-
-/*
- alcDestroyContext
-
- Remove a Context
-*/
-ALC_API ALCvoid ALC_APIENTRY alcDestroyContext(ALCcontext *context)
-{
- ALCdevice *Device;
- ALCcontext **list;
- ALuint i;
-
- if(!IsContext(context))
- {
- alcSetError(NULL, ALC_INVALID_CONTEXT);
- return;
- }
-
- Device = context->Device;
-
- if(Device->NumContexts == 1)
- ALCdevice_StopPlayback(Device);
-
- SuspendContext(NULL);
-
- if(context == GlobalContext)
- GlobalContext = NULL;
-
- for(i = 0;i < Device->NumContexts;i++)
- {
- if(Device->Contexts[i] == context)
- {
- Device->Contexts[i] = Device->Contexts[Device->NumContexts-1];
- Device->NumContexts--;
- break;
- }
- }
-
- // Lock context
- SuspendContext(context);
-
- if(context->SourceMap.size > 0)
- {
-#ifdef _DEBUG
- AL_PRINT("alcDestroyContext(): deleting %d Source(s)\n", context->SourceMap.size);
-#endif
- ReleaseALSources(context);
- }
- ResetUIntMap(&context->SourceMap);
-
- if(context->EffectSlotMap.size > 0)
- {
-#ifdef _DEBUG
- AL_PRINT("alcDestroyContext(): deleting %d AuxiliaryEffectSlot(s)\n", context->EffectSlotMap.size);
-#endif
- ReleaseALAuxiliaryEffectSlots(context);
- }
- ResetUIntMap(&context->EffectSlotMap);
-
- free(context->ActiveSources);
- context->ActiveSources = NULL;
- context->MaxActiveSources = 0;
- context->ActiveSourceCount = 0;
-
- list = &g_pContextList;
- while(*list != context)
- list = &(*list)->next;
-
- *list = (*list)->next;
- g_ulContextCount--;
-
- // Unlock context
- ProcessContext(context);
- ProcessContext(NULL);
-
- ExitContext(context);
-
- // Free memory (MUST do this after ProcessContext)
- memset(context, 0, sizeof(ALCcontext));
- free(context);
-}
-
-
-/*
- alcGetCurrentContext
-
- Returns the currently active Context
-*/
-ALC_API ALCcontext* ALC_APIENTRY alcGetCurrentContext(ALCvoid)
-{
- ALCcontext *pContext;
-
- if((pContext=GetContextSuspended()) != NULL)
- ProcessContext(pContext);
-
- return pContext;
-}
-
-/*
- alcGetThreadContext
-
- Returns the currently active thread-local Context
-*/
-ALC_API ALCcontext* ALC_APIENTRY alcGetThreadContext(void)
-{
- ALCcontext *pContext = NULL;
-
- SuspendContext(NULL);
-
- pContext = tls_get(LocalContext);
- if(pContext && !IsContext(pContext))
- {
- tls_set(LocalContext, NULL);
- pContext = NULL;
- }
-
- ProcessContext(NULL);
-
- return pContext;
-}
-
-
-/*
- alcGetContextsDevice
-
- Returns the Device that a particular Context is attached to
-*/
-ALC_API ALCdevice* ALC_APIENTRY alcGetContextsDevice(ALCcontext *pContext)
-{
- ALCdevice *pDevice = NULL;
-
- SuspendContext(NULL);
- if(IsContext(pContext))
- pDevice = pContext->Device;
- else
- alcSetError(NULL, ALC_INVALID_CONTEXT);
- ProcessContext(NULL);
-
- return pDevice;
-}
-
-
-/*
- alcMakeContextCurrent
-
- Makes the given Context the active Context
-*/
-ALC_API ALCboolean ALC_APIENTRY alcMakeContextCurrent(ALCcontext *context)
-{
- ALboolean bReturn = AL_TRUE;
-
- SuspendContext(NULL);
-
- // context must be a valid Context or NULL
- if(context == NULL || IsContext(context))
- {
- GlobalContext = context;
- tls_set(LocalContext, NULL);
- }
- else
- {
- alcSetError(NULL, ALC_INVALID_CONTEXT);
- bReturn = AL_FALSE;
- }
-
- ProcessContext(NULL);
-
- return bReturn;
-}
-
-/*
- alcSetThreadContext
-
- Makes the given Context the active Context for the current thread
-*/
-ALC_API ALCboolean ALC_APIENTRY alcSetThreadContext(ALCcontext *context)
-{
- ALboolean bReturn = AL_TRUE;
-
- SuspendContext(NULL);
-
- // context must be a valid Context or NULL
- if(context == NULL || IsContext(context))
- tls_set(LocalContext, context);
- else
- {
- alcSetError(NULL, ALC_INVALID_CONTEXT);
- bReturn = AL_FALSE;
- }
-
- ProcessContext(NULL);
-
- return bReturn;
-}
-
-
-// Sets the default channel order used by most non-WaveFormatEx-based APIs
-void SetDefaultChannelOrder(ALCdevice *device)
-{
- switch(device->FmtChans)
- {
- case DevFmtStereo: device->DevChannels[FRONT_LEFT] = 0;
- device->DevChannels[FRONT_RIGHT] = 1; break;
-
-#ifdef STEREO_ONLY
- case DevFmtMono:
- case DevFmtQuad:
- case DevFmtX51:
- case DevFmtX61:
- case DevFmtX71:
- break;
-#else
- case DevFmtMono: device->DevChannels[FRONT_CENTER] = 0; break;
-
- case DevFmtQuad: device->DevChannels[FRONT_LEFT] = 0;
- device->DevChannels[FRONT_RIGHT] = 1;
- device->DevChannels[BACK_LEFT] = 2;
- device->DevChannels[BACK_RIGHT] = 3; break;
-
- case DevFmtX51: device->DevChannels[FRONT_LEFT] = 0;
- device->DevChannels[FRONT_RIGHT] = 1;
- device->DevChannels[BACK_LEFT] = 2;
- device->DevChannels[BACK_RIGHT] = 3;
- device->DevChannels[FRONT_CENTER] = 4;
- device->DevChannels[LFE] = 5; break;
-
- case DevFmtX61: device->DevChannels[FRONT_LEFT] = 0;
- device->DevChannels[FRONT_RIGHT] = 1;
- device->DevChannels[FRONT_CENTER] = 2;
- device->DevChannels[LFE] = 3;
- device->DevChannels[BACK_CENTER] = 4;
- device->DevChannels[SIDE_LEFT] = 5;
- device->DevChannels[SIDE_RIGHT] = 6; break;
-
- case DevFmtX71: device->DevChannels[FRONT_LEFT] = 0;
- device->DevChannels[FRONT_RIGHT] = 1;
- device->DevChannels[BACK_LEFT] = 2;
- device->DevChannels[BACK_RIGHT] = 3;
- device->DevChannels[FRONT_CENTER] = 4;
- device->DevChannels[LFE] = 5;
- device->DevChannels[SIDE_LEFT] = 6;
- device->DevChannels[SIDE_RIGHT] = 7; break;
-#endif
- }
-}
-// Sets the default order used by WaveFormatEx
-void SetDefaultWFXChannelOrder(ALCdevice *device)
-{
- switch(device->FmtChans)
- {
-
- case DevFmtStereo: device->DevChannels[FRONT_LEFT] = 0;
- device->DevChannels[FRONT_RIGHT] = 1; break;
-
-#ifdef STEREO_ONLY
- case DevFmtMono:
- case DevFmtQuad:
- case DevFmtX51:
- case DevFmtX61:
- case DevFmtX71:
- break;
-#else
- case DevFmtMono: device->DevChannels[FRONT_CENTER] = 0; break;
-
- case DevFmtQuad: device->DevChannels[FRONT_LEFT] = 0;
- device->DevChannels[FRONT_RIGHT] = 1;
- device->DevChannels[BACK_LEFT] = 2;
- device->DevChannels[BACK_RIGHT] = 3; break;
-
- case DevFmtX51: device->DevChannels[FRONT_LEFT] = 0;
- device->DevChannels[FRONT_RIGHT] = 1;
- device->DevChannels[FRONT_CENTER] = 2;
- device->DevChannels[LFE] = 3;
- device->DevChannels[BACK_LEFT] = 4;
- device->DevChannels[BACK_RIGHT] = 5; break;
-
- case DevFmtX61: device->DevChannels[FRONT_LEFT] = 0;
- device->DevChannels[FRONT_RIGHT] = 1;
- device->DevChannels[FRONT_CENTER] = 2;
- device->DevChannels[LFE] = 3;
- device->DevChannels[BACK_CENTER] = 4;
- device->DevChannels[SIDE_LEFT] = 5;
- device->DevChannels[SIDE_RIGHT] = 6; break;
-
- case DevFmtX71: device->DevChannels[FRONT_LEFT] = 0;
- device->DevChannels[FRONT_RIGHT] = 1;
- device->DevChannels[FRONT_CENTER] = 2;
- device->DevChannels[LFE] = 3;
- device->DevChannels[BACK_LEFT] = 4;
- device->DevChannels[BACK_RIGHT] = 5;
- device->DevChannels[SIDE_LEFT] = 6;
- device->DevChannels[SIDE_RIGHT] = 7; break;
-#endif
- }
-}
-
-static ALenum GetFormatFromString(const char *str)
-{
- if(strcasecmp(str, "AL_FORMAT_MONO32") == 0) return AL_FORMAT_MONO_FLOAT32;
- if(strcasecmp(str, "AL_FORMAT_STEREO32") == 0) return AL_FORMAT_STEREO_FLOAT32;
- if(strcasecmp(str, "AL_FORMAT_QUAD32") == 0) return AL_FORMAT_QUAD32;
- if(strcasecmp(str, "AL_FORMAT_51CHN32") == 0) return AL_FORMAT_51CHN32;
- if(strcasecmp(str, "AL_FORMAT_61CHN32") == 0) return AL_FORMAT_61CHN32;
- if(strcasecmp(str, "AL_FORMAT_71CHN32") == 0) return AL_FORMAT_71CHN32;
-
- if(strcasecmp(str, "AL_FORMAT_MONO16") == 0) return AL_FORMAT_MONO16;
- if(strcasecmp(str, "AL_FORMAT_STEREO16") == 0) return AL_FORMAT_STEREO16;
- if(strcasecmp(str, "AL_FORMAT_QUAD16") == 0) return AL_FORMAT_QUAD16;
- if(strcasecmp(str, "AL_FORMAT_51CHN16") == 0) return AL_FORMAT_51CHN16;
- if(strcasecmp(str, "AL_FORMAT_61CHN16") == 0) return AL_FORMAT_61CHN16;
- if(strcasecmp(str, "AL_FORMAT_71CHN16") == 0) return AL_FORMAT_71CHN16;
-
- if(strcasecmp(str, "AL_FORMAT_MONO8") == 0) return AL_FORMAT_MONO8;
- if(strcasecmp(str, "AL_FORMAT_STEREO8") == 0) return AL_FORMAT_STEREO8;
- if(strcasecmp(str, "AL_FORMAT_QUAD8") == 0) return AL_FORMAT_QUAD8;
- if(strcasecmp(str, "AL_FORMAT_51CHN8") == 0) return AL_FORMAT_51CHN8;
- if(strcasecmp(str, "AL_FORMAT_61CHN8") == 0) return AL_FORMAT_61CHN8;
- if(strcasecmp(str, "AL_FORMAT_71CHN8") == 0) return AL_FORMAT_71CHN8;
-
- AL_PRINT("Unknown format: \"%s\"\n", str);
- return AL_FORMAT_STEREO16;
-}
-
-/*
- alcOpenDevice
-
- Open the Device specified.
-*/
-ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName)
-{
- ALboolean bDeviceFound = AL_FALSE;
- const ALCchar *fmt;
- ALCdevice *device;
- ALint i;
-
- if(deviceName && !deviceName[0])
- deviceName = NULL;
-
- device = calloc(1, sizeof(ALCdevice));
- if(!device)
- {
- alcSetError(NULL, ALC_OUT_OF_MEMORY);
- return NULL;
- }
-
- //Validate device
- device->Connected = ALC_TRUE;
- device->IsCaptureDevice = AL_FALSE;
- device->LastError = ALC_NO_ERROR;
-
- device->Bs2b = NULL;
- device->szDeviceName = NULL;
-
- device->Contexts = NULL;
- device->NumContexts = 0;
-
- InitUIntMap(&device->BufferMap);
- InitUIntMap(&device->EffectMap);
- InitUIntMap(&device->FilterMap);
- InitUIntMap(&device->DatabufferMap);
-
- //Set output format
- device->Frequency = GetConfigValueInt(NULL, "frequency", SWMIXER_OUTPUT_RATE);
- if(device->Frequency < 8000)
- device->Frequency = 8000;
-
- fmt = GetConfigValue(NULL, "format", "AL_FORMAT_STEREO16");
- if(DecomposeDevFormat(GetFormatFromString(fmt),
- &device->FmtChans, &device->FmtType) == AL_FALSE)
- {
- /* Should never happen... */
- device->FmtChans = DevFmtStereo;
- device->FmtType = DevFmtShort;
- }
-
- device->NumUpdates = GetConfigValueInt(NULL, "periods", 4);
- if(device->NumUpdates < 2)
- device->NumUpdates = 4;
-
- device->UpdateSize = GetConfigValueInt(NULL, "period_size", 1024);
- if(device->UpdateSize <= 0)
- device->UpdateSize = 1024;
-
- device->MaxNoOfSources = GetConfigValueInt(NULL, "sources", 256);
- if((ALint)device->MaxNoOfSources <= 0)
- device->MaxNoOfSources = 256;
-
- device->AuxiliaryEffectSlotMax = GetConfigValueInt(NULL, "slots", 4);
- if((ALint)device->AuxiliaryEffectSlotMax <= 0)
- device->AuxiliaryEffectSlotMax = 4;
-
- device->NumStereoSources = 1;
- device->NumMonoSources = device->MaxNoOfSources - device->NumStereoSources;
-
- device->NumAuxSends = GetConfigValueInt(NULL, "sends", 1);
- if(device->NumAuxSends > MAX_SENDS)
- device->NumAuxSends = MAX_SENDS;
-
- device->Bs2bLevel = GetConfigValueInt(NULL, "cf_level", 0);
-
- device->DuplicateStereo = GetConfigValueBool(NULL, "stereodup", 1);
-
- device->HeadDampen = int2ALfp(0);
-
- // Find a playback device to open
- SuspendContext(NULL);
- for(i = 0;BackendList[i].Init;i++)
- {
-
- if (BackendList[i].Funcs.OpenPlayback == NULL) {
- BackendList[i].Probe(DEVICE_PROBE);
- if (BackendList[i].Funcs.OpenPlayback == NULL) {
- continue;
- }
- }
- device->Funcs = &BackendList[i].Funcs;
- if(ALCdevice_OpenPlayback(device, deviceName))
- {
- device->next = g_pDeviceList;
- g_pDeviceList = device;
- g_ulDeviceCount++;
-
- bDeviceFound = AL_TRUE;
- break;
- }
- }
- ProcessContext(NULL);
-
- if(!bDeviceFound)
- {
- // No suitable output device found
- alcSetError(NULL, ALC_INVALID_VALUE);
- free(device);
- device = NULL;
- }
-
- return device;
-}
-
-
-/*
- alcCloseDevice
-
- Close the specified Device
-*/
-ALC_API ALCboolean ALC_APIENTRY alcCloseDevice(ALCdevice *pDevice)
-{
- ALCdevice **list;
-
- if(!IsDevice(pDevice) || pDevice->IsCaptureDevice)
- {
- alcSetError(pDevice, ALC_INVALID_DEVICE);
- return ALC_FALSE;
- }
-
- SuspendContext(NULL);
-
- list = &g_pDeviceList;
- while(*list != pDevice)
- list = &(*list)->next;
-
- *list = (*list)->next;
- g_ulDeviceCount--;
-
- ProcessContext(NULL);
-
- if(pDevice->NumContexts > 0)
- {
-#ifdef _DEBUG
- AL_PRINT("alcCloseDevice(): destroying %u Context(s)\n", pDevice->NumContexts);
-#endif
- while(pDevice->NumContexts > 0)
- alcDestroyContext(pDevice->Contexts[0]);
- }
- ALCdevice_ClosePlayback(pDevice);
-
- if(pDevice->BufferMap.size > 0)
- {
-#ifdef _DEBUG
- AL_PRINT("alcCloseDevice(): deleting %d Buffer(s)\n", pDevice->BufferMap.size);
-#endif
- ReleaseALBuffers(pDevice);
- }
- ResetUIntMap(&pDevice->BufferMap);
-
- if(pDevice->EffectMap.size > 0)
- {
-#ifdef _DEBUG
- AL_PRINT("alcCloseDevice(): deleting %d Effect(s)\n", pDevice->EffectMap.size);
-#endif
- ReleaseALEffects(pDevice);
- }
- ResetUIntMap(&pDevice->EffectMap);
-
- if(pDevice->FilterMap.size > 0)
- {
-#ifdef _DEBUG
- AL_PRINT("alcCloseDevice(): deleting %d Filter(s)\n", pDevice->FilterMap.size);
-#endif
- ReleaseALFilters(pDevice);
- }
- ResetUIntMap(&pDevice->FilterMap);
-
- if(pDevice->DatabufferMap.size > 0)
- {
-#ifdef _DEBUG
- AL_PRINT("alcCloseDevice(): deleting %d Databuffer(s)\n", pDevice->DatabufferMap.size);
-#endif
- ReleaseALDatabuffers(pDevice);
- }
- ResetUIntMap(&pDevice->DatabufferMap);
-
- free(pDevice->Bs2b);
- pDevice->Bs2b = NULL;
-
- free(pDevice->szDeviceName);
- pDevice->szDeviceName = NULL;
-
- free(pDevice->Contexts);
- pDevice->Contexts = NULL;
-
- //Release device structure
- memset(pDevice, 0, sizeof(ALCdevice));
- free(pDevice);
-
- return ALC_TRUE;
-}
-
-
-static void ReleaseALC(void)
-{
- free(alcDeviceList); alcDeviceList = NULL;
- alcDeviceListSize = 0;
- free(alcAllDeviceList); alcAllDeviceList = NULL;
- alcAllDeviceListSize = 0;
- free(alcCaptureDeviceList); alcCaptureDeviceList = NULL;
- alcCaptureDeviceListSize = 0;
-
- free(alcDefaultDeviceSpecifier);
- alcDefaultDeviceSpecifier = NULL;
- free(alcDefaultAllDeviceSpecifier);
- alcDefaultAllDeviceSpecifier = NULL;
- free(alcCaptureDefaultDeviceSpecifier);
- alcCaptureDefaultDeviceSpecifier = NULL;
-
-#ifdef _DEBUG
- if(g_ulDeviceCount > 0)
- AL_PRINT("exit(): closing %u Device%s\n", g_ulDeviceCount, (g_ulDeviceCount>1)?"s":"");
-#endif
-
- while(g_pDeviceList)
- {
- if(g_pDeviceList->IsCaptureDevice)
- alcCaptureCloseDevice(g_pDeviceList);
- else
- alcCloseDevice(g_pDeviceList);
- }
-}
-
-///////////////////////////////////////////////////////
diff --git a/internal/c/parts/audio/out/android/OpenAL/Alc/ALu.c b/internal/c/parts/audio/out/android/OpenAL/Alc/ALu.c
deleted file mode 100644
index 6e5f31350..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Alc/ALu.c
+++ /dev/null
@@ -1,1118 +0,0 @@
-/**
- * OpenAL cross platform audio library
- * Copyright (C) 1999-2007 by authors.
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- * Or go to http://www.gnu.org/copyleft/lgpl.html
- */
-
-#include "config.h"
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "alMain.h"
-#include "AL/al.h"
-#include "AL/alc.h"
-#include "alSource.h"
-#include "alBuffer.h"
-#include "alListener.h"
-#include "alAuxEffectSlot.h"
-#include "alu.h"
-#include "bs2b.h"
-
-#ifdef MAX_SOURCES_LOW
-// For throttling AlSource.c
-int alc_max_sources = MAX_SOURCES_LOW;
-int alc_active_sources = 0;
-int alc_num_cores = 0;
-#endif
-
-static __inline ALvoid aluCrossproduct(const ALfp *inVector1, const ALfp *inVector2, ALfp *outVector)
-{
- outVector[0] = (ALfpMult(inVector1[1],inVector2[2]) - ALfpMult(inVector1[2],inVector2[1]));
- outVector[1] = (ALfpMult(inVector1[2],inVector2[0]) - ALfpMult(inVector1[0],inVector2[2]));
- outVector[2] = (ALfpMult(inVector1[0],inVector2[1]) - ALfpMult(inVector1[1],inVector2[0]));
-}
-
-static __inline ALfp aluDotproduct(const ALfp *inVector1, const ALfp *inVector2)
-{
- return (ALfpMult(inVector1[0],inVector2[0]) + ALfpMult(inVector1[1],inVector2[1]) +
- ALfpMult(inVector1[2],inVector2[2]));
-}
-
-static __inline ALvoid aluNormalize(ALfp *inVector)
-{
- ALfp length, inverse_length;
-
- length = aluSqrt(aluDotproduct(inVector, inVector));
- if(length != int2ALfp(0))
- {
- inverse_length = ALfpDiv(int2ALfp(1),length);
- inVector[0] = ALfpMult(inVector[0], inverse_length);
- inVector[1] = ALfpMult(inVector[1], inverse_length);
- inVector[2] = ALfpMult(inVector[2], inverse_length);
- }
-}
-
-static __inline ALvoid aluMatrixVector(ALfp *vector,ALfp w,ALfp matrix[4][4])
-{
- ALfp temp[4] = {
- vector[0], vector[1], vector[2], w
- };
-
- vector[0] = ALfpMult(temp[0],matrix[0][0]) + ALfpMult(temp[1],matrix[1][0]) + ALfpMult(temp[2],matrix[2][0]) + ALfpMult(temp[3],matrix[3][0]);
- vector[1] = ALfpMult(temp[0],matrix[0][1]) + ALfpMult(temp[1],matrix[1][1]) + ALfpMult(temp[2],matrix[2][1]) + ALfpMult(temp[3],matrix[3][1]);
- vector[2] = ALfpMult(temp[0],matrix[0][2]) + ALfpMult(temp[1],matrix[1][2]) + ALfpMult(temp[2],matrix[2][2]) + ALfpMult(temp[3],matrix[3][2]);
-}
-
-
-ALvoid CalcNonAttnSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
-{
- ALfp SourceVolume,ListenerGain,MinVolume,MaxVolume;
- ALbufferlistitem *BufferListItem;
- enum DevFmtChannels DevChans;
- enum FmtChannels Channels;
- ALfp DryGain, DryGainHF;
- ALfp WetGain[MAX_SENDS];
- ALfp WetGainHF[MAX_SENDS];
- ALint NumSends, Frequency;
- ALboolean DupStereo;
- ALfp Pitch;
- ALfp cw;
- ALint i;
-
- /* Get device properties */
- DevChans = ALContext->Device->FmtChans;
- DupStereo = ALContext->Device->DuplicateStereo;
- NumSends = ALContext->Device->NumAuxSends;
- Frequency = ALContext->Device->Frequency;
-
- /* Get listener properties */
- ListenerGain = ALContext->Listener.Gain;
-
- /* Get source properties */
- SourceVolume = ALSource->flGain;
- MinVolume = ALSource->flMinGain;
- MaxVolume = ALSource->flMaxGain;
- Pitch = ALSource->flPitch;
-
- /* Calculate the stepping value */
- Channels = FmtMono;
- BufferListItem = ALSource->queue;
- while(BufferListItem != NULL)
- {
- ALbuffer *ALBuffer;
- if((ALBuffer=BufferListItem->buffer) != NULL)
- {
- ALint maxstep = STACK_DATA_SIZE / FrameSizeFromFmt(ALBuffer->FmtChannels,
- ALBuffer->FmtType);
- maxstep -= ResamplerPadding[ALSource->Resampler] +
- ResamplerPrePadding[ALSource->Resampler] + 1;
- maxstep = min(maxstep, INT_MAX>>FRACTIONBITS);
-
- Pitch = ALfpDiv(ALfpMult(Pitch, int2ALfp(ALBuffer->Frequency)), int2ALfp(Frequency));
- if(Pitch > int2ALfp(maxstep))
- ALSource->Params.Step = maxstep<Params.Step = ALfp2int(ALfpMult(Pitch, int2ALfp(FRACTIONONE)));
- if(ALSource->Params.Step == 0)
- ALSource->Params.Step = 1;
- }
-
- Channels = ALBuffer->FmtChannels;
- break;
- }
- BufferListItem = BufferListItem->next;
- }
-
- /* Calculate gains */
- DryGain = SourceVolume;
- DryGain = __min(DryGain,MaxVolume);
- DryGain = __max(DryGain,MinVolume);
- DryGainHF = int2ALfp(1);
-
- switch(ALSource->DirectFilter.type)
- {
- case AL_FILTER_LOWPASS:
- DryGain = ALfpMult(DryGain, ALSource->DirectFilter.Gain);
- DryGainHF = ALfpMult(DryGainHF, ALSource->DirectFilter.GainHF);
- break;
- }
-
- for(i = 0;i < MAXCHANNELS;i++)
- {
- ALuint i2;
- for(i2 = 0;i2 < MAXCHANNELS;i2++)
- ALSource->Params.DryGains[i][i2] = int2ALfp(0);
- }
-
- switch(Channels)
- {
- case FmtMono:
- ALSource->Params.DryGains[0][FRONT_CENTER] = ALfpMult(DryGain, ListenerGain);
- break;
- case FmtStereo:
- if(DupStereo == AL_FALSE)
- {
- ALSource->Params.DryGains[0][FRONT_LEFT] = ALfpMult(DryGain, ListenerGain);
- ALSource->Params.DryGains[1][FRONT_RIGHT] = ALfpMult(DryGain, ListenerGain);
- }
- else
- {
- switch(DevChans)
- {
- case DevFmtMono:
- case DevFmtStereo:
- ALSource->Params.DryGains[0][FRONT_LEFT] = ALfpMult(DryGain, ListenerGain);
- ALSource->Params.DryGains[1][FRONT_RIGHT] = ALfpMult(DryGain, ListenerGain);
- break;
-
-#ifdef STEREO_ONLY
- case DevFmtQuad:
- case DevFmtX51:
- case DevFmtX61:
- case DevFmtX71:
- break;
-#else
- case DevFmtQuad:
- case DevFmtX51:
- DryGain = ALfpMult(DryGain, aluSqrt(float2ALfp(2.0f/4.0f)));
- ALSource->Params.DryGains[0][FRONT_LEFT] = ALfpMult(DryGain, ListenerGain);
- ALSource->Params.DryGains[1][FRONT_RIGHT] = ALfpMult(DryGain, ListenerGain);
- ALSource->Params.DryGains[0][BACK_LEFT] = ALfpMult(DryGain, ListenerGain);
- ALSource->Params.DryGains[1][BACK_RIGHT] = ALfpMult(DryGain, ListenerGain);
- break;
-
- case DevFmtX61:
- DryGain = ALfpMult(DryGain, aluSqrt(float2ALfp(2.0f/4.0f)));
- ALSource->Params.DryGains[0][FRONT_LEFT] = ALfpMult(DryGain, ListenerGain);
- ALSource->Params.DryGains[1][FRONT_RIGHT] = ALfpMult(DryGain, ListenerGain);
- ALSource->Params.DryGains[0][SIDE_LEFT] = ALfpMult(DryGain, ListenerGain);
- ALSource->Params.DryGains[1][SIDE_RIGHT] = ALfpMult(DryGain, ListenerGain);
- break;
-
- case DevFmtX71:
- DryGain = ALfpMult(DryGain, aluSqrt(float2ALfp(2.0f/6.0f)));
- ALSource->Params.DryGains[0][FRONT_LEFT] = ALfpMult(DryGain, ListenerGain);
- ALSource->Params.DryGains[1][FRONT_RIGHT] = ALfpMult(DryGain, ListenerGain);
- ALSource->Params.DryGains[0][BACK_LEFT] = ALfpMult(DryGain, ListenerGain);
- ALSource->Params.DryGains[1][BACK_RIGHT] = ALfpMult(DryGain, ListenerGain);
- ALSource->Params.DryGains[0][SIDE_LEFT] = ALfpMult(DryGain, ListenerGain);
- ALSource->Params.DryGains[1][SIDE_RIGHT] = ALfpMult(DryGain, ListenerGain);
- break;
-#endif
- }
- }
- break;
-
- case FmtRear:
-#ifndef STEREO_ONLY
- ALSource->Params.DryGains[0][BACK_LEFT] = ALfpMult(DryGain, ListenerGain);
- ALSource->Params.DryGains[1][BACK_RIGHT] = ALfpMult(DryGain, ListenerGain);
-#endif
- break;
-
- case FmtQuad:
- ALSource->Params.DryGains[0][FRONT_LEFT] = ALfpMult(DryGain, ListenerGain);
- ALSource->Params.DryGains[1][FRONT_RIGHT] = ALfpMult(DryGain, ListenerGain);
-#ifndef STEREO_ONLY
- ALSource->Params.DryGains[2][BACK_LEFT] = ALfpMult(DryGain, ListenerGain);
- ALSource->Params.DryGains[3][BACK_RIGHT] = ALfpMult(DryGain, ListenerGain);
-#endif
- break;
-
- case FmtX51:
- ALSource->Params.DryGains[0][FRONT_LEFT] = ALfpMult(DryGain, ListenerGain);
- ALSource->Params.DryGains[1][FRONT_RIGHT] = ALfpMult(DryGain, ListenerGain);
-#ifndef STEREO_ONLY
- ALSource->Params.DryGains[2][FRONT_CENTER] = ALfpMult(DryGain, ListenerGain);
- ALSource->Params.DryGains[3][LFE] = ALfpMult(DryGain, ListenerGain);
- ALSource->Params.DryGains[4][BACK_LEFT] = ALfpMult(DryGain, ListenerGain);
- ALSource->Params.DryGains[5][BACK_RIGHT] = ALfpMult(DryGain, ListenerGain);
-#endif
- break;
-
- case FmtX61:
- ALSource->Params.DryGains[0][FRONT_LEFT] = ALfpMult(DryGain, ListenerGain);
- ALSource->Params.DryGains[1][FRONT_RIGHT] = ALfpMult(DryGain, ListenerGain);
-#ifndef STEREO_ONLY
- ALSource->Params.DryGains[2][FRONT_CENTER] = ALfpMult(DryGain, ListenerGain);
- ALSource->Params.DryGains[3][LFE] = ALfpMult(DryGain, ListenerGain);
- ALSource->Params.DryGains[4][BACK_CENTER] = ALfpMult(DryGain, ListenerGain);
- ALSource->Params.DryGains[5][SIDE_LEFT] = ALfpMult(DryGain, ListenerGain);
- ALSource->Params.DryGains[6][SIDE_RIGHT] = ALfpMult(DryGain, ListenerGain);
-#endif
- break;
-
- case FmtX71:
- ALSource->Params.DryGains[0][FRONT_LEFT] = ALfpMult(DryGain, ListenerGain);
- ALSource->Params.DryGains[1][FRONT_RIGHT] = ALfpMult(DryGain, ListenerGain);
-#ifndef STEREO_ONLY
- ALSource->Params.DryGains[2][FRONT_CENTER] = ALfpMult(DryGain, ListenerGain);
- ALSource->Params.DryGains[3][LFE] = ALfpMult(DryGain, ListenerGain);
- ALSource->Params.DryGains[4][BACK_LEFT] = ALfpMult(DryGain, ListenerGain);
- ALSource->Params.DryGains[5][BACK_RIGHT] = ALfpMult(DryGain, ListenerGain);
- ALSource->Params.DryGains[6][SIDE_LEFT] = ALfpMult(DryGain, ListenerGain);
- ALSource->Params.DryGains[7][SIDE_RIGHT] = ALfpMult(DryGain, ListenerGain);
-#endif
- break;
- }
-
- for(i = 0;i < NumSends;i++)
- {
- WetGain[i] = SourceVolume;
- WetGain[i] = __min(WetGain[i],MaxVolume);
- WetGain[i] = __max(WetGain[i],MinVolume);
- WetGainHF[i] = int2ALfp(1);
-
- switch(ALSource->Send[i].WetFilter.type)
- {
- case AL_FILTER_LOWPASS:
- WetGain[i] = ALfpMult(WetGain[i], ALSource->Send[i].WetFilter.Gain);
- WetGainHF[i] = ALfpMult(WetGainHF[i], ALSource->Send[i].WetFilter.GainHF);
- break;
- }
-
- ALSource->Params.Send[i].WetGain = ALfpMult(WetGain[i], ListenerGain);
- }
-
- /* Update filter coefficients. Calculations based on the I3DL2
- * spec. */
- cw = float2ALfp(cos(2.0*M_PI * LOWPASSFREQCUTOFF / Frequency));
-
- /* We use two chained one-pole filters, so we need to take the
- * square root of the squared gain, which is the same as the base
- * gain. */
- ALSource->Params.iirFilter.coeff = lpCoeffCalc(DryGainHF, cw);
-
- for(i = 0;i < NumSends;i++)
- {
- /* We use a one-pole filter, so we need to take the squared gain */
- ALfp a = lpCoeffCalc(ALfpMult(WetGainHF[i],WetGainHF[i]), cw);
- ALSource->Params.Send[i].iirFilter.coeff = a;
- }
-}
-
-ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
-{
- const ALCdevice *Device = ALContext->Device;
- ALfp InnerAngle,OuterAngle,Angle,Distance,OrigDist;
- ALfp Direction[3],Position[3],SourceToListener[3];
- ALfp Velocity[3],ListenerVel[3];
- ALfp MinVolume,MaxVolume,MinDist,MaxDist,Rolloff,OuterGainHF;
- ALfp ConeVolume,ConeHF,SourceVolume,ListenerGain;
- ALfp DopplerFactor, DopplerVelocity, SpeedOfSound;
- ALfp AirAbsorptionFactor;
- ALbufferlistitem *BufferListItem;
- ALfp Attenuation, EffectiveDist;
- ALfp RoomAttenuation[MAX_SENDS];
- ALfp MetersPerUnit;
- ALfp RoomRolloff[MAX_SENDS];
- ALfp DryGain;
- ALfp DryGainHF;
- ALfp WetGain[MAX_SENDS];
- ALfp WetGainHF[MAX_SENDS];
- ALfp DirGain, AmbientGain;
- const ALfp *SpeakerGain;
- ALfp Pitch;
- ALfp length;
- ALuint Frequency;
- ALint NumSends;
- ALint pos, s, i;
- ALfp cw;
-
- DryGainHF = int2ALfp(1);
- for(i = 0;i < MAX_SENDS;i++)
- WetGainHF[i] = int2ALfp(1);
-
- //Get context properties
- DopplerFactor = ALfpMult(ALContext->DopplerFactor, ALSource->DopplerFactor);
- DopplerVelocity = ALContext->DopplerVelocity;
- SpeedOfSound = ALContext->flSpeedOfSound;
- NumSends = Device->NumAuxSends;
- Frequency = Device->Frequency;
-
- //Get listener properties
- ListenerGain = ALContext->Listener.Gain;
- MetersPerUnit = ALContext->Listener.MetersPerUnit;
- memcpy(ListenerVel, ALContext->Listener.Velocity, sizeof(ALContext->Listener.Velocity));
-
- //Get source properties
- SourceVolume = ALSource->flGain;
- memcpy(Position, ALSource->vPosition, sizeof(ALSource->vPosition));
- memcpy(Direction, ALSource->vOrientation, sizeof(ALSource->vOrientation));
- memcpy(Velocity, ALSource->vVelocity, sizeof(ALSource->vVelocity));
- MinVolume = ALSource->flMinGain;
- MaxVolume = ALSource->flMaxGain;
- MinDist = ALSource->flRefDistance;
- MaxDist = ALSource->flMaxDistance;
- Rolloff = ALSource->flRollOffFactor;
- InnerAngle = ALSource->flInnerAngle;
- OuterAngle = ALSource->flOuterAngle;
- OuterGainHF = ALSource->OuterGainHF;
- AirAbsorptionFactor = ALSource->AirAbsorptionFactor;
-
- //1. Translate Listener to origin (convert to head relative)
- if(ALSource->bHeadRelative == AL_FALSE)
- {
- ALfp U[3],V[3],N[3];
- ALfp Matrix[4][4];
-
- // Build transform matrix
- memcpy(N, ALContext->Listener.Forward, sizeof(N)); // At-vector
- aluNormalize(N); // Normalized At-vector
- memcpy(V, ALContext->Listener.Up, sizeof(V)); // Up-vector
- aluNormalize(V); // Normalized Up-vector
- aluCrossproduct(N, V, U); // Right-vector
- aluNormalize(U); // Normalized Right-vector
- Matrix[0][0] = U[0]; Matrix[0][1] = V[0]; Matrix[0][2] = -1*N[0]; Matrix[0][3] = int2ALfp(0);
- Matrix[1][0] = U[1]; Matrix[1][1] = V[1]; Matrix[1][2] = -1*N[1]; Matrix[1][3] = int2ALfp(0);
- Matrix[2][0] = U[2]; Matrix[2][1] = V[2]; Matrix[2][2] = -1*N[2]; Matrix[2][3] = int2ALfp(0);
- Matrix[3][0] = int2ALfp(0); Matrix[3][1] = int2ALfp(0); Matrix[3][2] = int2ALfp(0); Matrix[3][3] = int2ALfp(1);
-
- // Translate position
- Position[0] -= ALContext->Listener.Position[0];
- Position[1] -= ALContext->Listener.Position[1];
- Position[2] -= ALContext->Listener.Position[2];
-
- // Transform source position and direction into listener space
- aluMatrixVector(Position, int2ALfp(1), Matrix);
- aluMatrixVector(Direction, int2ALfp(0), Matrix);
- // Transform source and listener velocity into listener space
- aluMatrixVector(Velocity, int2ALfp(0), Matrix);
- aluMatrixVector(ListenerVel, int2ALfp(0), Matrix);
- }
- else
- ListenerVel[0] = ListenerVel[1] = ListenerVel[2] = int2ALfp(0);
-
- SourceToListener[0] = -1*Position[0];
- SourceToListener[1] = -1*Position[1];
- SourceToListener[2] = -1*Position[2];
- aluNormalize(SourceToListener);
- aluNormalize(Direction);
-
- //2. Calculate distance attenuation
- Distance = aluSqrt(aluDotproduct(Position, Position));
- OrigDist = Distance;
-
- Attenuation = int2ALfp(1);
- for(i = 0;i < NumSends;i++)
- {
- RoomAttenuation[i] = int2ALfp(1);
-
- RoomRolloff[i] = ALSource->RoomRolloffFactor;
- if(ALSource->Send[i].Slot &&
- (ALSource->Send[i].Slot->effect.type == AL_EFFECT_REVERB ||
- ALSource->Send[i].Slot->effect.type == AL_EFFECT_EAXREVERB))
- RoomRolloff[i] += ALSource->Send[i].Slot->effect.Reverb.RoomRolloffFactor;
- }
-
- switch(ALContext->SourceDistanceModel ? ALSource->DistanceModel :
- ALContext->DistanceModel)
- {
- case AL_INVERSE_DISTANCE_CLAMPED:
- Distance=__max(Distance,MinDist);
- Distance=__min(Distance,MaxDist);
- if(MaxDist < MinDist)
- break;
- //fall-through
- case AL_INVERSE_DISTANCE:
- if(MinDist > int2ALfp(0))
- {
- if((MinDist + ALfpMult(Rolloff, (Distance - MinDist))) > int2ALfp(0))
- Attenuation = ALfpDiv(MinDist, (MinDist + ALfpMult(Rolloff, (Distance - MinDist))));
- for(i = 0;i < NumSends;i++)
- {
- if((MinDist + ALfpMult(RoomRolloff[i], (Distance - MinDist))) > int2ALfp(0))
- RoomAttenuation[i] = ALfpDiv(MinDist, (MinDist + ALfpMult(RoomRolloff[i], (Distance - MinDist))));
- }
- }
- break;
-
- case AL_LINEAR_DISTANCE_CLAMPED:
- Distance=__max(Distance,MinDist);
- Distance=__min(Distance,MaxDist);
- if(MaxDist < MinDist)
- break;
- //fall-through
- case AL_LINEAR_DISTANCE:
- if(MaxDist != MinDist)
- {
- Attenuation = int2ALfp(1) - ALfpDiv(ALfpMult(Rolloff,(Distance-MinDist)), (MaxDist - MinDist));
- Attenuation = __max(Attenuation, int2ALfp(0));
- for(i = 0;i < NumSends;i++)
- {
- RoomAttenuation[i] = int2ALfp(1) - ALfpDiv(ALfpMult(RoomRolloff[i],(Distance-MinDist)),(MaxDist - MinDist));
- RoomAttenuation[i] = __max(RoomAttenuation[i], int2ALfp(0));
- }
- }
- break;
-
- case AL_EXPONENT_DISTANCE_CLAMPED:
- Distance=__max(Distance,MinDist);
- Distance=__min(Distance,MaxDist);
- if(MaxDist < MinDist)
- break;
- //fall-through
- case AL_EXPONENT_DISTANCE:
- if(Distance > int2ALfp(0) && MinDist > int2ALfp(0))
- {
- Attenuation = aluPow(ALfpDiv(Distance,MinDist), (-1*Rolloff));
- for(i = 0;i < NumSends;i++)
- RoomAttenuation[i] = aluPow(ALfpDiv(Distance,MinDist), (-1*RoomRolloff[i]));
- }
- break;
-
- case AL_NONE:
- break;
- }
-
- // Source Gain + Attenuation
- DryGain = ALfpMult(SourceVolume, Attenuation);
- for(i = 0;i < NumSends;i++)
- WetGain[i] = ALfpMult(SourceVolume, RoomAttenuation[i]);
-
- EffectiveDist = int2ALfp(0);
- if(MinDist > int2ALfp(0) && Attenuation < int2ALfp(1))
- EffectiveDist = ALfpMult((ALfpDiv(MinDist,Attenuation) - MinDist),MetersPerUnit);
-
- // Distance-based air absorption
- if(AirAbsorptionFactor > int2ALfp(0) && EffectiveDist > int2ALfp(0))
- {
- ALfp absorb;
-
- // Absorption calculation is done in dB
- absorb = ALfpMult(ALfpMult(AirAbsorptionFactor,float2ALfp(AIRABSORBGAINDBHF)),
- EffectiveDist);
- // Convert dB to linear gain before applying
- absorb = aluPow(int2ALfp(10), ALfpDiv(absorb,int2ALfp(20)));
-
- DryGainHF = ALfpMult(DryGainHF,absorb);
- }
-
- //3. Apply directional soundcones
- Angle = ALfpMult(aluAcos(aluDotproduct(Direction,SourceToListener)), float2ALfp(180.0f/M_PI));
- if(Angle >= InnerAngle && Angle <= OuterAngle)
- {
- ALfp scale; scale = ALfpDiv((Angle-InnerAngle), (OuterAngle-InnerAngle));
- ConeVolume = int2ALfp(1) + ALfpMult((ALSource->flOuterGain - int2ALfp(1)),scale);
- ConeHF = (int2ALfp(1)+ALfpMult((OuterGainHF-int2ALfp(1)),scale));
- }
- else if(Angle > OuterAngle)
- {
- ConeVolume = (int2ALfp(1)+(ALSource->flOuterGain-int2ALfp(1)));
- ConeHF = (int2ALfp(1)+(OuterGainHF-int2ALfp(1)));
- }
- else
- {
- ConeVolume = int2ALfp(1);
- ConeHF = int2ALfp(1);
- }
-
- // Apply some high-frequency attenuation for sources behind the listener
- // NOTE: This should be aluDotproduct({0,0,-1}, ListenerToSource), however
- // that is equivalent to aluDotproduct({0,0,1}, SourceToListener), which is
- // the same as SourceToListener[2]
- Angle = ALfpMult(aluAcos(SourceToListener[2]), float2ALfp(180.0f/M_PI));
- // Sources within the minimum distance attenuate less
- if(OrigDist < MinDist)
- Angle = ALfpMult(Angle, ALfpDiv(OrigDist,MinDist));
- if(Angle > int2ALfp(90))
- {
- ALfp scale; scale = ALfpDiv((Angle-int2ALfp(90)), float2ALfp(180.1f-90.0f)); // .1 to account for fp errors
- ConeHF = ALfpMult(ConeHF, (int2ALfp(1) - ALfpMult(Device->HeadDampen,scale)));
- }
-
- DryGain = ALfpMult(DryGain, ConeVolume);
- if(ALSource->DryGainHFAuto)
- DryGainHF = ALfpMult(DryGainHF, ConeHF);
-
- // Clamp to Min/Max Gain
- DryGain = __min(DryGain,MaxVolume);
- DryGain = __max(DryGain,MinVolume);
-
- for(i = 0;i < NumSends;i++)
- {
- ALeffectslot *Slot = ALSource->Send[i].Slot;
-
- if(!Slot || Slot->effect.type == AL_EFFECT_NULL)
- {
- ALSource->Params.Send[i].WetGain = int2ALfp(0);
- WetGainHF[i] = int2ALfp(1);
- continue;
- }
-
- if(Slot->AuxSendAuto)
- {
- if(ALSource->WetGainAuto)
- WetGain[i] = ALfpMult(WetGain[i], ConeVolume);
- if(ALSource->WetGainHFAuto)
- WetGainHF[i] = ALfpMult(WetGainHF[i], ConeHF);
-
- // Clamp to Min/Max Gain
- WetGain[i] = __min(WetGain[i],MaxVolume);
- WetGain[i] = __max(WetGain[i],MinVolume);
-
- if(Slot->effect.type == AL_EFFECT_REVERB ||
- Slot->effect.type == AL_EFFECT_EAXREVERB)
- {
- /* Apply a decay-time transformation to the wet path, based on
- * the attenuation of the dry path.
- *
- * Using the approximate (effective) source to listener
- * distance, the initial decay of the reverb effect is
- * calculated and applied to the wet path.
- */
- WetGain[i] = ALfpMult(WetGain[i],
- aluPow(int2ALfp(10),
- ALfpDiv(ALfpMult(ALfpDiv(EffectiveDist,
- ALfpMult(float2ALfp(SPEEDOFSOUNDMETRESPERSEC), Slot->effect.Reverb.DecayTime)),
- int2ALfp(-60)),
- int2ALfp(20))));
-
- WetGainHF[i] = ALfpMult(WetGainHF[i],
- aluPow(Slot->effect.Reverb.AirAbsorptionGainHF,
- ALfpMult(AirAbsorptionFactor, EffectiveDist)));
- }
- }
- else
- {
- /* If the slot's auxiliary send auto is off, the data sent to the
- * effect slot is the same as the dry path, sans filter effects */
- WetGain[i] = DryGain;
- WetGainHF[i] = DryGainHF;
- }
-
- switch(ALSource->Send[i].WetFilter.type)
- {
- case AL_FILTER_LOWPASS:
- WetGain[i] = ALfpMult(WetGain[i], ALSource->Send[i].WetFilter.Gain);
- WetGainHF[i] = ALfpMult(WetGainHF[i], ALSource->Send[i].WetFilter.GainHF);
- break;
- }
- ALSource->Params.Send[i].WetGain = ALfpMult(WetGain[i], ListenerGain);
- }
-
- // Apply filter gains and filters
- switch(ALSource->DirectFilter.type)
- {
- case AL_FILTER_LOWPASS:
- DryGain = ALfpMult(DryGain, ALSource->DirectFilter.Gain);
- DryGainHF = ALfpMult(DryGainHF, ALSource->DirectFilter.GainHF);
- break;
- }
- DryGain = ALfpMult(DryGain, ListenerGain);
-
- // Calculate Velocity
- Pitch = ALSource->flPitch;
- if(DopplerFactor != int2ALfp(0))
- {
- ALfp VSS, VLS;
- ALfp MaxVelocity; MaxVelocity = ALfpDiv(ALfpMult(SpeedOfSound,DopplerVelocity),
- DopplerFactor);
-
- VSS = aluDotproduct(Velocity, SourceToListener);
- if(VSS >= MaxVelocity)
- VSS = (MaxVelocity - int2ALfp(1));
- else if(VSS <= -MaxVelocity)
- VSS = (-MaxVelocity + int2ALfp(1));
-
- VLS = aluDotproduct(ListenerVel, SourceToListener);
- if(VLS >= MaxVelocity)
- VLS = (MaxVelocity - int2ALfp(1));
- else if(VLS <= -MaxVelocity)
- VLS = -MaxVelocity + int2ALfp(1);
-
- Pitch = ALfpMult(Pitch,
- ALfpDiv((ALfpMult(SpeedOfSound,DopplerVelocity) - ALfpMult(DopplerFactor,VLS)),
- (ALfpMult(SpeedOfSound,DopplerVelocity) - ALfpMult(DopplerFactor,VSS))));
- }
-
- BufferListItem = ALSource->queue;
- while(BufferListItem != NULL)
- {
- ALbuffer *ALBuffer;
- if((ALBuffer=BufferListItem->buffer) != NULL)
- {
- ALint maxstep = STACK_DATA_SIZE / FrameSizeFromFmt(ALBuffer->FmtChannels,
- ALBuffer->FmtType);
- maxstep -= ResamplerPadding[ALSource->Resampler] +
- ResamplerPrePadding[ALSource->Resampler] + 1;
- maxstep = min(maxstep, INT_MAX>>FRACTIONBITS);
-
- Pitch = ALfpDiv(ALfpMult(Pitch, int2ALfp(ALBuffer->Frequency)), int2ALfp(Frequency));
- if(Pitch > int2ALfp(maxstep))
- ALSource->Params.Step = maxstep<Params.Step = ALfp2int(ALfpMult(Pitch,float2ALfp(FRACTIONONE)));
- if(ALSource->Params.Step == 0)
- ALSource->Params.Step = 1;
- }
- break;
- }
- BufferListItem = BufferListItem->next;
- }
-
- // Use energy-preserving panning algorithm for multi-speaker playback
- length = __max(OrigDist, MinDist);
- if(length > int2ALfp(0))
- {
- ALfp invlen = ALfpDiv(int2ALfp(1), length);
- Position[0] = ALfpMult(Position[0],invlen);
- Position[1] = ALfpMult(Position[1],invlen);
- Position[2] = ALfpMult(Position[2],invlen);
- }
-
- pos = aluCart2LUTpos((-1*Position[2]), Position[0]);
- SpeakerGain = &Device->PanningLUT[MAXCHANNELS * pos];
-
- DirGain = aluSqrt((ALfpMult(Position[0],Position[0]) + ALfpMult(Position[2],Position[2])));
- // elevation adjustment for directional gain. this sucks, but
- // has low complexity
- AmbientGain = aluSqrt(float2ALfp(1.0f/Device->NumChan));
- for(s = 0;s < MAXCHANNELS;s++)
- {
- ALuint s2;
- for(s2 = 0;s2 < MAXCHANNELS;s2++)
- ALSource->Params.DryGains[s][s2] = int2ALfp(0);
- }
- for(s = 0;s < (ALsizei)Device->NumChan;s++)
- {
- Channel chan = Device->Speaker2Chan[s];
- ALfp gain; gain = AmbientGain + ALfpMult((SpeakerGain[chan]-AmbientGain),DirGain);
- ALSource->Params.DryGains[0][chan] = ALfpMult(DryGain, gain);
- }
-
- /* Update filter coefficients. */
- cw = __cos(ALfpDiv(float2ALfp(2.0*M_PI*LOWPASSFREQCUTOFF), int2ALfp(Frequency)));
-
- /* Spatialized sources use four chained one-pole filters, so we need to
- * take the fourth root of the squared gain, which is the same as the
- * square root of the base gain. */
- ALSource->Params.iirFilter.coeff = lpCoeffCalc(aluSqrt(DryGainHF), cw);
-
- for(i = 0;i < NumSends;i++)
- {
- /* The wet path uses two chained one-pole filters, so take the
- * base gain (square root of the squared gain) */
- ALSource->Params.Send[i].iirFilter.coeff = lpCoeffCalc(WetGainHF[i], cw);
- }
-}
-
-
-static __inline ALfloat aluF2F(ALfp val)
-{
- return ALfp2float(val);
-}
-static __inline ALushort aluF2US(ALfp val)
-{
- if(val > int2ALfp(1)) return 65535;
- if(val < int2ALfp(-1)) return 0;
- return (ALushort)(ALfp2int(ALfpMult(val,int2ALfp(32767))) + 32768);
-}
-static __inline ALshort aluF2S(ALfp val)
-{
- if(val > int2ALfp(1)) return 32767;
- if(val < int2ALfp(-1)) return -32768;
- return (ALshort)(ALfp2int(ALfpMult(val,int2ALfp(32767))));
-}
-static __inline ALubyte aluF2UB(ALfp val)
-{
- ALushort i = aluF2US(val);
- return i>>8;
-}
-static __inline ALbyte aluF2B(ALfp val)
-{
- ALshort i = aluF2S(val);
- return i>>8;
-}
-
-static const Channel MonoChans[] = { FRONT_CENTER };
-static const Channel StereoChans[] = { FRONT_LEFT, FRONT_RIGHT };
-static const Channel QuadChans[] = { FRONT_LEFT, FRONT_RIGHT,
- BACK_LEFT, BACK_RIGHT };
-static const Channel X51Chans[] = { FRONT_LEFT, FRONT_RIGHT,
- FRONT_CENTER, LFE,
- BACK_LEFT, BACK_RIGHT };
-static const Channel X61Chans[] = { FRONT_LEFT, FRONT_LEFT,
- FRONT_CENTER, LFE, BACK_CENTER,
- SIDE_LEFT, SIDE_RIGHT };
-static const Channel X71Chans[] = { FRONT_LEFT, FRONT_RIGHT,
- FRONT_CENTER, LFE,
- BACK_LEFT, BACK_RIGHT,
- SIDE_LEFT, SIDE_RIGHT };
-
-#define DECL_TEMPLATE(T, chans,N, func) \
-static void Write_##T##_##chans(ALCdevice *device, T *buffer, ALuint SamplesToDo)\
-{ \
- ALfp (*DryBuffer)[MAXCHANNELS] = device->DryBuffer; \
- ALfp (*Matrix)[MAXCHANNELS] = device->ChannelMatrix; \
- const ALuint *ChanMap = device->DevChannels; \
- ALuint i, j, c; \
- \
- for(i = 0;i < SamplesToDo;i++) \
- { \
- for(j = 0;j < N;j++) \
- { \
- ALfp samp; samp = int2ALfp(0); \
- for(c = 0;c < MAXCHANNELS;c++) { \
- ALfp m = Matrix[c][chans[j]]; \
- if (m != 0) \
- samp += ALfpMult(DryBuffer[i][c], m); \
- } \
- ((T*)buffer)[ChanMap[chans[j]]] = func(samp); \
- } \
- buffer = ((T*)buffer) + N; \
- } \
-}
-
-DECL_TEMPLATE(ALfloat, MonoChans,1, aluF2F)
-DECL_TEMPLATE(ALfloat, QuadChans,4, aluF2F)
-DECL_TEMPLATE(ALfloat, X51Chans,6, aluF2F)
-DECL_TEMPLATE(ALfloat, X61Chans,7, aluF2F)
-DECL_TEMPLATE(ALfloat, X71Chans,8, aluF2F)
-
-DECL_TEMPLATE(ALushort, MonoChans,1, aluF2US)
-DECL_TEMPLATE(ALushort, QuadChans,4, aluF2US)
-DECL_TEMPLATE(ALushort, X51Chans,6, aluF2US)
-DECL_TEMPLATE(ALushort, X61Chans,7, aluF2US)
-DECL_TEMPLATE(ALushort, X71Chans,8, aluF2US)
-
-DECL_TEMPLATE(ALshort, MonoChans,1, aluF2S)
-DECL_TEMPLATE(ALshort, QuadChans,4, aluF2S)
-DECL_TEMPLATE(ALshort, X51Chans,6, aluF2S)
-DECL_TEMPLATE(ALshort, X61Chans,7, aluF2S)
-DECL_TEMPLATE(ALshort, X71Chans,8, aluF2S)
-
-DECL_TEMPLATE(ALubyte, MonoChans,1, aluF2UB)
-DECL_TEMPLATE(ALubyte, QuadChans,4, aluF2UB)
-DECL_TEMPLATE(ALubyte, X51Chans,6, aluF2UB)
-DECL_TEMPLATE(ALubyte, X61Chans,7, aluF2UB)
-DECL_TEMPLATE(ALubyte, X71Chans,8, aluF2UB)
-
-DECL_TEMPLATE(ALbyte, MonoChans,1, aluF2B)
-DECL_TEMPLATE(ALbyte, QuadChans,4, aluF2B)
-DECL_TEMPLATE(ALbyte, X51Chans,6, aluF2B)
-DECL_TEMPLATE(ALbyte, X61Chans,7, aluF2B)
-DECL_TEMPLATE(ALbyte, X71Chans,8, aluF2B)
-
-#undef DECL_TEMPLATE
-
-#define DECL_TEMPLATE(T, chans,N, func) \
-static void Write_##T##_##chans(ALCdevice *device, T *buffer, ALuint SamplesToDo)\
-{ \
- ALfp (*DryBuffer)[MAXCHANNELS] = device->DryBuffer; \
- ALfp (*Matrix)[MAXCHANNELS] = device->ChannelMatrix; \
- const ALuint *ChanMap = device->DevChannels; \
- ALuint i, j, c; \
- \
- if(device->Bs2b) \
- { \
- for(i = 0;i < SamplesToDo;i++) \
- { \
- ALfp samples[2] = { int2ALfp(0), int2ALfp(0) }; \
- for(c = 0;c < MAXCHANNELS;c++) \
- { \
- samples[0] += ALfpMult(DryBuffer[i][c],Matrix[c][FRONT_LEFT]); \
- samples[1] += ALfpMult(DryBuffer[i][c],Matrix[c][FRONT_RIGHT]); \
- } \
- bs2b_cross_feed(device->Bs2b, samples); \
- ((T*)buffer)[ChanMap[FRONT_LEFT]] = func(samples[0]); \
- ((T*)buffer)[ChanMap[FRONT_RIGHT]] = func(samples[1]); \
- buffer = ((T*)buffer) + 2; \
- } \
- } \
- else \
- { \
- for(i = 0;i < SamplesToDo;i++) \
- { \
- for(j = 0;j < N;j++) \
- { \
- ALfp samp = int2ALfp(0); \
- for(c = 0;c < MAXCHANNELS;c++) \
- samp += ALfpMult(DryBuffer[i][c], Matrix[c][chans[j]]); \
- ((T*)buffer)[ChanMap[chans[j]]] = func(samp); \
- } \
- buffer = ((T*)buffer) + N; \
- } \
- } \
-}
-
-DECL_TEMPLATE(ALfloat, StereoChans,2, aluF2F)
-DECL_TEMPLATE(ALushort, StereoChans,2, aluF2US)
-DECL_TEMPLATE(ALshort, StereoChans,2, aluF2S)
-DECL_TEMPLATE(ALubyte, StereoChans,2, aluF2UB)
-DECL_TEMPLATE(ALbyte, StereoChans,2, aluF2B)
-
-#undef DECL_TEMPLATE
-
-#define DECL_TEMPLATE(T, func) \
-static void Write_##T(ALCdevice *device, T *buffer, ALuint SamplesToDo) \
-{ \
- switch(device->FmtChans) \
- { \
- case DevFmtMono: \
- Write_##T##_MonoChans(device, buffer, SamplesToDo); \
- break; \
- case DevFmtStereo: \
- Write_##T##_StereoChans(device, buffer, SamplesToDo); \
- break; \
- case DevFmtQuad: \
- Write_##T##_QuadChans(device, buffer, SamplesToDo); \
- break; \
- case DevFmtX51: \
- Write_##T##_X51Chans(device, buffer, SamplesToDo); \
- break; \
- case DevFmtX61: \
- Write_##T##_X61Chans(device, buffer, SamplesToDo); \
- break; \
- case DevFmtX71: \
- Write_##T##_X71Chans(device, buffer, SamplesToDo); \
- break; \
- } \
-}
-
-DECL_TEMPLATE(ALfloat, aluF2F)
-DECL_TEMPLATE(ALushort, aluF2US)
-DECL_TEMPLATE(ALshort, aluF2S)
-DECL_TEMPLATE(ALubyte, aluF2UB)
-DECL_TEMPLATE(ALbyte, aluF2B)
-
-#undef DECL_TEMPLATE
-
-static __inline ALvoid aluMixDataPrivate(ALCdevice *device, ALvoid *buffer, ALsizei size)
-{
- ALuint SamplesToDo;
- ALeffectslot *ALEffectSlot;
- ALCcontext **ctx, **ctx_end;
- ALsource **src, **src_end;
- int fpuState;
- ALuint i, c;
- ALsizei e;
-
-#if defined(HAVE_FESETROUND)
- fpuState = fegetround();
- fesetround(FE_TOWARDZERO);
-#elif defined(HAVE__CONTROLFP)
- fpuState = _controlfp(_RC_CHOP, _MCW_RC);
-#else
- (void)fpuState;
-#endif
-
- while(size > 0)
- {
- /* Setup variables */
- SamplesToDo = min(size, BUFFERSIZE);
-
- /* Clear mixing buffer */
- memset(device->DryBuffer, 0, SamplesToDo*MAXCHANNELS*sizeof(ALfp));
-
- SuspendContext(NULL);
- ctx = device->Contexts;
- ctx_end = ctx + device->NumContexts;
- while(ctx != ctx_end)
- {
- SuspendContext(*ctx);
-
- src = (*ctx)->ActiveSources;
- src_end = src + (*ctx)->ActiveSourceCount;
- while(src != src_end)
- {
- if((*src)->state != AL_PLAYING)
- {
- --((*ctx)->ActiveSourceCount);
- *src = *(--src_end);
- continue;
- }
-
- if((*src)->NeedsUpdate)
- {
- ALsource_Update(*src, *ctx);
- (*src)->NeedsUpdate = AL_FALSE;
- }
-
- MixSource(*src, device, SamplesToDo);
- src++;
- }
-
- /* effect slot processing */
- for(e = 0;e < (*ctx)->EffectSlotMap.size;e++)
- {
- ALEffectSlot = (*ctx)->EffectSlotMap.array[e].value;
-
- for(i = 0;i < SamplesToDo;i++)
- {
- ALEffectSlot->ClickRemoval[0] -= ALfpDiv(ALEffectSlot->ClickRemoval[0], int2ALfp(256));
- ALEffectSlot->WetBuffer[i] += ALEffectSlot->ClickRemoval[0];
- }
- for(i = 0;i < 1;i++)
- {
- ALEffectSlot->ClickRemoval[i] += ALEffectSlot->PendingClicks[i];
- ALEffectSlot->PendingClicks[i] = int2ALfp(0);
- }
-
- ALEffect_Process(ALEffectSlot->EffectState, ALEffectSlot,
- SamplesToDo, ALEffectSlot->WetBuffer,
- device->DryBuffer);
-
- for(i = 0;i < SamplesToDo;i++)
- ALEffectSlot->WetBuffer[i] = int2ALfp(0);
- }
-
- ProcessContext(*ctx);
- ctx++;
- }
- ProcessContext(NULL);
-
- //Post processing loop
- for(i = 0;i < SamplesToDo;i++)
- {
- for(c = 0;c < MAXCHANNELS;c++)
- {
- device->ClickRemoval[c] -= ALfpDiv(device->ClickRemoval[c], int2ALfp(256));
- device->DryBuffer[i][c] += device->ClickRemoval[c];
- }
- }
- for(i = 0;i < MAXCHANNELS;i++)
- {
- device->ClickRemoval[i] += device->PendingClicks[i];
- device->PendingClicks[i] = int2ALfp(0);
- }
-
- switch(device->FmtType)
- {
- case DevFmtByte:
- Write_ALbyte(device, buffer, SamplesToDo);
- break;
- case DevFmtUByte:
- Write_ALubyte(device, buffer, SamplesToDo);
- break;
- case DevFmtShort:
- Write_ALshort(device, buffer, SamplesToDo);
- break;
- case DevFmtUShort:
- Write_ALushort(device, buffer, SamplesToDo);
- break;
- case DevFmtFloat:
- Write_ALfloat(device, buffer, SamplesToDo);
- break;
- }
-
- size -= SamplesToDo;
- }
-
-#if defined(HAVE_FESETROUND)
- fesetround(fpuState);
-#elif defined(HAVE__CONTROLFP)
- _controlfp(fpuState, _MCW_RC);
-#endif
-}
-
-static inline long timespecdiff(struct timespec *starttime, struct timespec *finishtime)
-{
- long usec;
- usec=(finishtime->tv_sec-starttime->tv_sec)*1000000;
- usec+=(finishtime->tv_nsec-starttime->tv_nsec)/1000;
- return usec;
-}
-
-ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
-{
-#ifdef MAX_SOURCES_LOW
- // Profile aluMixDataPrivate to set admission control parameters
- static struct timespec ts_start;
- static struct timespec ts_end;
- long ts_diff;
- int time_per_source;
- int max_sources_within_deadline;
- int mix_deadline_usec;
- int max;
-
- if (alc_num_cores == 0) {
- // FIXME(Apportable) this is Linux specific
- alc_num_cores = sysconf( _SC_NPROCESSORS_ONLN );
- LOGI("_SC_NPROCESSORS_ONLN=%d", alc_num_cores);
- }
-
- if (alc_num_cores > 1) {
- // Allow OpenAL to monopolize one core
- mix_deadline_usec = ((size*1000000) / device->Frequency) / 2;
- } else {
- // Try to cap mixing at 20% CPU
- mix_deadline_usec = ((size*1000000) / device->Frequency) / 5;
- }
-
- clock_gettime(CLOCK_MONOTONIC, &ts_start);
- aluMixDataPrivate(device, buffer, size);
- clock_gettime(CLOCK_MONOTONIC, &ts_end);
-
- // Time in micro-seconds that aluMixData has taken to run
- ts_diff = timespecdiff(&ts_start, &ts_end);
-
- // Try to adjust the max sources limit adaptively, within a range
- if (alc_active_sources > 0) {
- time_per_source = max(1, ts_diff / alc_active_sources);
- max_sources_within_deadline = mix_deadline_usec / time_per_source;
- max = min(max(max_sources_within_deadline, MAX_SOURCES_LOW), MAX_SOURCES_HIGH);
- if (max > alc_max_sources) {
- alc_max_sources++;
- } else if (max < alc_max_sources) {
- alc_max_sources = max;
- }
- } else {
- alc_max_sources = MAX_SOURCES_START;
- }
-#else
- aluMixDataPrivate(device, buffer, size);
-#endif
-}
-
-ALvoid aluHandleDisconnect(ALCdevice *device)
-{
- ALuint i;
-
- SuspendContext(NULL);
- for(i = 0;i < device->NumContexts;i++)
- {
- ALCcontext *Context = device->Contexts[i];
- ALsource *source;
- ALsizei pos;
-
- SuspendContext(Context);
-
- for(pos = 0;pos < Context->SourceMap.size;pos++)
- {
- source = Context->SourceMap.array[pos].value;
- if(source->state == AL_PLAYING)
- {
- source->state = AL_STOPPED;
- source->BuffersPlayed = source->BuffersInQueue;
- source->position = 0;
- source->position_fraction = 0;
- }
- }
- ProcessContext(Context);
- }
-
- device->Connected = ALC_FALSE;
- ProcessContext(NULL);
-}
diff --git a/internal/c/parts/audio/out/android/OpenAL/Alc/alAuxEffectSlot.h b/internal/c/parts/audio/out/android/OpenAL/Alc/alAuxEffectSlot.h
deleted file mode 100644
index 1c592ac8e..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Alc/alAuxEffectSlot.h
+++ /dev/null
@@ -1,63 +0,0 @@
-#ifndef _AL_AUXEFFECTSLOT_H_
-#define _AL_AUXEFFECTSLOT_H_
-
-#include "AL/al.h"
-#include "alEffect.h"
-#include "alFilter.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct ALeffectState ALeffectState;
-
-typedef struct ALeffectslot
-{
- ALeffect effect;
-
- ALfp Gain;
- ALboolean AuxSendAuto;
-
- ALeffectState *EffectState;
-
- ALfp WetBuffer[BUFFERSIZE];
-
- ALfp ClickRemoval[1];
- ALfp PendingClicks[1];
-
- ALuint refcount;
-
- // Index to itself
- ALuint effectslot;
-
- struct ALeffectslot *next;
-} ALeffectslot;
-
-
-ALvoid ReleaseALAuxiliaryEffectSlots(ALCcontext *Context);
-
-
-struct ALeffectState {
- ALvoid (*Destroy)(ALeffectState *State);
- ALboolean (*DeviceUpdate)(ALeffectState *State, ALCdevice *Device);
- ALvoid (*Update)(ALeffectState *State, ALCcontext *Context, const ALeffect *Effect);
- ALvoid (*Process)(ALeffectState *State, const ALeffectslot *Slot, ALuint SamplesToDo, const ALfp *SamplesIn, ALfp (*SamplesOut)[MAXCHANNELS]);
-};
-
-ALeffectState *NoneCreate(void);
-ALeffectState *EAXVerbCreate(void);
-ALeffectState *VerbCreate(void);
-ALeffectState *EchoCreate(void);
-ALeffectState *ModulatorCreate(void);
-
-#define ALEffect_Destroy(a) ((a)->Destroy((a)))
-#define ALEffect_DeviceUpdate(a,b) ((a)->DeviceUpdate((a),(b)))
-#define ALEffect_Update(a,b,c) ((a)->Update((a),(b),(c)))
-#define ALEffect_Process(a,b,c,d,e) ((a)->Process((a),(b),(c),(d),(e)))
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/internal/c/parts/audio/out/android/OpenAL/Alc/alBuffer.h b/internal/c/parts/audio/out/android/OpenAL/Alc/alBuffer.h
deleted file mode 100644
index e22d839d5..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Alc/alBuffer.h
+++ /dev/null
@@ -1,98 +0,0 @@
-#ifndef _AL_BUFFER_H_
-#define _AL_BUFFER_H_
-
-#include "AL/al.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Input formats (some are currently theoretical) */
-enum UserFmtType {
- UserFmtByte, /* AL_BYTE */
- UserFmtUByte, /* AL_UNSIGNED_BYTE */
- UserFmtShort, /* AL_SHORT */
- UserFmtUShort, /* AL_UNSIGNED_SHORT */
- UserFmtInt, /* AL_INT */
- UserFmtUInt, /* AL_UNSIGNED_INT */
- UserFmtFloat, /* AL_FLOAT */
- UserFmtDouble, /* AL_DOUBLE */
- UserFmtMulaw, /* AL_MULAW */
- UserFmtIMA4, /* AL_IMA4 */
-};
-enum UserFmtChannels {
- UserFmtMono, /* AL_MONO */
- UserFmtStereo, /* AL_STEREO */
- UserFmtRear, /* AL_REAR */
- UserFmtQuad, /* AL_QUAD */
- UserFmtX51, /* AL_5POINT1 (WFX order) */
- UserFmtX61, /* AL_6POINT1 (WFX order) */
- UserFmtX71, /* AL_7POINT1 (WFX order) */
-};
-
-ALboolean DecomposeUserFormat(ALenum format, enum UserFmtChannels *chans,
- enum UserFmtType *type);
-ALuint BytesFromUserFmt(enum UserFmtType type);
-ALuint ChannelsFromUserFmt(enum UserFmtChannels chans);
-static __inline ALuint FrameSizeFromUserFmt(enum UserFmtChannels chans,
- enum UserFmtType type)
-{
- return ChannelsFromUserFmt(chans) * BytesFromUserFmt(type);
-}
-
-
-/* Storable formats */
-enum FmtType {
- FmtUByte = UserFmtUByte,
- FmtShort = UserFmtShort,
- FmtFloat = UserFmtFloat,
-};
-enum FmtChannels {
- FmtMono = UserFmtMono,
- FmtStereo = UserFmtStereo,
- FmtRear = UserFmtRear,
- FmtQuad = UserFmtQuad,
- FmtX51 = UserFmtX51,
- FmtX61 = UserFmtX61,
- FmtX71 = UserFmtX71,
-};
-
-ALboolean DecomposeFormat(ALenum format, enum FmtChannels *chans, enum FmtType *type);
-ALuint BytesFromFmt(enum FmtType type);
-ALuint ChannelsFromFmt(enum FmtChannels chans);
-static __inline ALuint FrameSizeFromFmt(enum FmtChannels chans, enum FmtType type)
-{
- return ChannelsFromFmt(chans) * BytesFromFmt(type);
-}
-
-
-typedef struct ALbuffer
-{
- ALvoid *data;
- ALsizei size;
-
- ALsizei Frequency;
- enum FmtChannels FmtChannels;
- enum FmtType FmtType;
-
- enum UserFmtChannels OriginalChannels;
- enum UserFmtType OriginalType;
- ALsizei OriginalSize;
- ALsizei OriginalAlign;
-
- ALsizei LoopStart;
- ALsizei LoopEnd;
-
- ALuint refcount; // Number of sources using this buffer (deletion can only occur when this is 0)
-
- // Index to itself
- ALuint buffer;
-} ALbuffer;
-
-ALvoid ReleaseALBuffers(ALCdevice *device);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/internal/c/parts/audio/out/android/OpenAL/Alc/alDatabuffer.h b/internal/c/parts/audio/out/android/OpenAL/Alc/alDatabuffer.h
deleted file mode 100644
index 221855283..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Alc/alDatabuffer.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef _AL_DATABUFFER_H_
-#define _AL_DATABUFFER_H_
-
-#include "AL/al.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define UNMAPPED 0
-#define MAPPED 1
-
-typedef struct ALdatabuffer
-{
- ALubyte *data;
- ALintptrEXT size;
-
- ALenum state;
- ALenum usage;
-
- /* Index to self */
- ALuint databuffer;
-
- struct ALdatabuffer *next;
-} ALdatabuffer;
-
-ALvoid ReleaseALDatabuffers(ALCdevice *device);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/internal/c/parts/audio/out/android/OpenAL/Alc/alEffect.h b/internal/c/parts/audio/out/android/OpenAL/Alc/alEffect.h
deleted file mode 100644
index 041aa3edc..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Alc/alEffect.h
+++ /dev/null
@@ -1,83 +0,0 @@
-// NOTE: The effect structure is getting too large, it may be a good idea to
-// start using a union or another form of unified storage.
-#ifndef _AL_EFFECT_H_
-#define _AL_EFFECT_H_
-
-#include "AL/al.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-enum {
- EAXREVERB = 0,
- REVERB,
- ECHO,
- MODULATOR,
-
- MAX_EFFECTS
-};
-extern ALboolean DisabledEffects[MAX_EFFECTS];
-
-typedef struct ALeffect
-{
- // Effect type (AL_EFFECT_NULL, ...)
- ALenum type;
-
- struct {
- // Shared Reverb Properties
- ALfp Density;
- ALfp Diffusion;
- ALfp Gain;
- ALfp GainHF;
- ALfp DecayTime;
- ALfp DecayHFRatio;
- ALfp ReflectionsGain;
- ALfp ReflectionsDelay;
- ALfp LateReverbGain;
- ALfp LateReverbDelay;
- ALfp AirAbsorptionGainHF;
- ALfp RoomRolloffFactor;
- ALboolean DecayHFLimit;
-
- // Additional EAX Reverb Properties
- ALfp GainLF;
- ALfp DecayLFRatio;
- ALfp ReflectionsPan[3];
- ALfp LateReverbPan[3];
- ALfp EchoTime;
- ALfp EchoDepth;
- ALfp ModulationTime;
- ALfp ModulationDepth;
- ALfp HFReference;
- ALfp LFReference;
- } Reverb;
-
- struct {
- ALfp Delay;
- ALfp LRDelay;
-
- ALfp Damping;
- ALfp Feedback;
-
- ALfp Spread;
- } Echo;
-
- struct {
- ALfp Frequency;
- ALfp HighPassCutoff;
- ALint Waveform;
- } Modulator;
-
- // Index to itself
- ALuint effect;
-} ALeffect;
-
-
-ALvoid ReleaseALEffects(ALCdevice *device);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/internal/c/parts/audio/out/android/OpenAL/Alc/alError.h b/internal/c/parts/audio/out/android/OpenAL/Alc/alError.h
deleted file mode 100644
index 7976e50f9..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Alc/alError.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef _AL_ERROR_H_
-#define _AL_ERROR_H_
-
-#include "AL/al.h"
-#include "AL/alc.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-ALvoid alSetError(ALCcontext *Context, ALenum errorCode);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/internal/c/parts/audio/out/android/OpenAL/Alc/alFilter.h b/internal/c/parts/audio/out/android/OpenAL/Alc/alFilter.h
deleted file mode 100644
index 3b17b1f1e..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Alc/alFilter.h
+++ /dev/null
@@ -1,139 +0,0 @@
-#ifndef _AL_FILTER_H_
-#define _AL_FILTER_H_
-
-#include "AL/al.h"
-#include "alu.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct {
- ALfp coeff;
-#ifndef _MSC_VER
- ALfp history[0];
-#else
- ALfp history[1];
-#endif
-} FILTER;
-
-static __inline ALfp lpFilter4P(FILTER *iir, ALuint offset, ALfp input)
-{
- ALfp *history = &iir->history[offset];
- ALfp a = iir->coeff;
- ALfp output = input;
-
- output = output + ALfpMult((history[0]-output),a);
- history[0] = output;
- output = output + ALfpMult((history[1]-output),a);
- history[1] = output;
- output = output + ALfpMult((history[2]-output),a);
- history[2] = output;
- output = output + ALfpMult((history[3]-output),a);
- history[3] = output;
-
- return output;
-}
-
-static __inline ALfp lpFilter2P(FILTER *iir, ALuint offset, ALfp input)
-{
- ALfp *history = &iir->history[offset];
- ALfp a = iir->coeff;
- ALfp output = input;
-
- output = output + ALfpMult((history[0]-output),a);
- history[0] = output;
- output = output + ALfpMult((history[1]-output),a);
- history[1] = output;
-
- return output;
-}
-
-static __inline ALfp lpFilter1P(FILTER *iir, ALuint offset, ALfp input)
-{
- ALfp *history = &iir->history[offset];
- ALfp a = iir->coeff;
- ALfp output = input;
-
- output = output + ALfpMult((history[0]-output),a);
- history[0] = output;
-
- return output;
-}
-
-static __inline ALfp lpFilter4PC(const FILTER *iir, ALuint offset, ALfp input)
-{
- const ALfp *history = &iir->history[offset];
- ALfp a = iir->coeff;
- ALfp output = input;
-
- output = output + ALfpMult((history[0]-output),a);
- output = output + ALfpMult((history[1]-output),a);
- output = output + ALfpMult((history[2]-output),a);
- output = output + ALfpMult((history[3]-output),a);
-
- return output;
-}
-
-static __inline ALfp lpFilter2PC(const FILTER *iir, ALuint offset, ALfp input)
-{
- const ALfp *history = &iir->history[offset];
- ALfp a = iir->coeff;
- ALfp output = input;
-
- output = output + ALfpMult((history[0]-output),a);
- output = output + ALfpMult((history[1]-output),a);
-
- return output;
-}
-
-static __inline ALfp lpFilter1PC(FILTER *iir, ALuint offset, ALfp input)
-{
- const ALfp *history = &iir->history[offset];
- ALfp a = iir->coeff;
- ALfp output = input;
-
- output = output + ALfpMult((history[0]-output),a);
-
- return output;
-}
-
-/* Calculates the low-pass filter coefficient given the pre-scaled gain and
- * cos(w) value. Note that g should be pre-scaled (sqr(gain) for one-pole,
- * sqrt(gain) for four-pole, etc) */
-static __inline ALfp lpCoeffCalc(ALfp g, ALfp cw)
-{
- ALfp a = int2ALfp(0);
-
- /* Be careful with gains < 0.01, as that causes the coefficient
- * head towards 1, which will flatten the signal */
- g = __max(g, float2ALfp(0.01f));
- if(g < float2ALfp(0.9999f)) /* 1-epsilon */ {
- ALfp tmp; tmp = ALfpMult(ALfpMult(int2ALfp(2),g),(int2ALfp(1)-cw)) - ALfpMult(ALfpMult(g,g),(int2ALfp(1) - ALfpMult(cw,cw)));
- a = ALfpDiv((int2ALfp(1) - ALfpMult(g,cw) - aluSqrt(tmp)), (int2ALfp(1) - g));
- }
-
- return a;
-}
-
-
-typedef struct ALfilter
-{
- // Filter type (AL_FILTER_NULL, ...)
- ALenum type;
-
- ALfp Gain;
- ALfp GainHF;
-
- // Index to itself
- ALuint filter;
-} ALfilter;
-
-
-ALvoid ReleaseALFilters(ALCdevice *device);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/internal/c/parts/audio/out/android/OpenAL/Alc/alListener.h b/internal/c/parts/audio/out/android/OpenAL/Alc/alListener.h
deleted file mode 100644
index a2fc3ba0f..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Alc/alListener.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef _AL_LISTENER_H_
-#define _AL_LISTENER_H_
-
-#include "AL/al.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct ALlistener_struct
-{
- ALfp Position[3];
- ALfp Velocity[3];
- ALfp Forward[3];
- ALfp Up[3];
- ALfp Gain;
- ALfp MetersPerUnit;
-} ALlistener;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/internal/c/parts/audio/out/android/OpenAL/Alc/alMain.h b/internal/c/parts/audio/out/android/OpenAL/Alc/alMain.h
deleted file mode 100644
index 61448b205..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Alc/alMain.h
+++ /dev/null
@@ -1,503 +0,0 @@
-#ifndef AL_MAIN_H
-#define AL_MAIN_H
-
-#include
-#include
-#include
-
-#ifdef HAVE_FENV_H
-#include
-#endif
-
-#include "AL/al.h"
-#include "AL/alc.h"
-#include "AL/alext.h"
-
-#ifndef AL_EXT_sample_buffer_object
-#define AL_EXT_sample_buffer_object 1
-typedef ptrdiff_t ALintptrEXT;
-typedef ptrdiff_t ALsizeiptrEXT;
-#define AL_SAMPLE_SOURCE_EXT 0x1040
-#define AL_SAMPLE_SINK_EXT 0x1041
-#define AL_READ_ONLY_EXT 0x1042
-#define AL_WRITE_ONLY_EXT 0x1043
-#define AL_READ_WRITE_EXT 0x1044
-#define AL_STREAM_WRITE_EXT 0x1045
-#define AL_STREAM_READ_EXT 0x1046
-#define AL_STREAM_COPY_EXT 0x1047
-#define AL_STATIC_WRITE_EXT 0x1048
-#define AL_STATIC_READ_EXT 0x1049
-#define AL_STATIC_COPY_EXT 0x104A
-#define AL_DYNAMIC_WRITE_EXT 0x104B
-#define AL_DYNAMIC_READ_EXT 0x104C
-#define AL_DYNAMIC_COPY_EXT 0x104D
-typedef ALvoid (AL_APIENTRY*PFNALGENDATABUFFERSEXTPROC)(ALsizei n,ALuint *puiBuffers);
-typedef ALvoid (AL_APIENTRY*PFNALDELETEDATABUFFERSEXTPROC)(ALsizei n, const ALuint *puiBuffers);
-typedef ALboolean (AL_APIENTRY*PFNALISDATABUFFEREXTPROC)(ALuint uiBuffer);
-typedef ALvoid (AL_APIENTRY*PFNALDATABUFFERDATAEXTPROC)(ALuint buffer,const ALvoid *data,ALsizeiptrEXT size,ALenum usage);
-typedef ALvoid (AL_APIENTRY*PFNALDATABUFFERSUBDATAEXTPROC)(ALuint buffer, ALintptrEXT start, ALsizeiptrEXT length, const ALvoid *);
-typedef ALvoid (AL_APIENTRY*PFNALGETDATABUFFERSUBDATAEXTPROC)(ALuint buffer, ALintptrEXT start, ALsizeiptrEXT length, ALvoid *);
-typedef ALvoid (AL_APIENTRY*PFNALDATABUFFERFEXTPROC)(ALuint buffer, ALenum eParam, ALfloat flValue);
-typedef ALvoid (AL_APIENTRY*PFNALDATABUFFERFVEXTPROC)(ALuint buffer, ALenum eParam, const ALfloat* flValues);
-typedef ALvoid (AL_APIENTRY*PFNALDATABUFFERIEXTPROC)(ALuint buffer, ALenum eParam, ALint lValue);
-typedef ALvoid (AL_APIENTRY*PFNALDATABUFFERIVEXTPROC)(ALuint buffer, ALenum eParam, const ALint* plValues);
-typedef ALvoid (AL_APIENTRY*PFNALGETDATABUFFERFEXTPROC)(ALuint buffer, ALenum eParam, ALfloat *pflValue);
-typedef ALvoid (AL_APIENTRY*PFNALGETDATABUFFERFVEXTPROC)(ALuint buffer, ALenum eParam, ALfloat* pflValues);
-typedef ALvoid (AL_APIENTRY*PFNALGETDATABUFFERIEXTPROC)(ALuint buffer, ALenum eParam, ALint *plValue);
-typedef ALvoid (AL_APIENTRY*PFNALGETDATABUFFERIVEXTPROC)(ALuint buffer, ALenum eParam, ALint* plValues);
-typedef ALvoid (AL_APIENTRY*PFNALSELECTDATABUFFEREXTPROC)(ALenum target, ALuint uiBuffer);
-typedef ALvoid* (AL_APIENTRY*PFNALMAPDATABUFFEREXTPROC)(ALuint uiBuffer, ALintptrEXT start, ALsizeiptrEXT length, ALenum access);
-typedef ALvoid (AL_APIENTRY*PFNALUNMAPDATABUFFEREXTPROC)(ALuint uiBuffer);
-#ifdef AL_ALEXT_PROTOTYPES
-AL_API ALvoid AL_APIENTRY alGenDatabuffersEXT(ALsizei n,ALuint *puiBuffers);
-AL_API ALvoid AL_APIENTRY alDeleteDatabuffersEXT(ALsizei n, const ALuint *puiBuffers);
-AL_API ALboolean AL_APIENTRY alIsDatabufferEXT(ALuint uiBuffer);
-AL_API ALvoid AL_APIENTRY alDatabufferDataEXT(ALuint buffer,const ALvoid *data,ALsizeiptrEXT size,ALenum usage);
-AL_API ALvoid AL_APIENTRY alDatabufferSubDataEXT(ALuint buffer, ALintptrEXT start, ALsizeiptrEXT length, const ALvoid *data);
-AL_API ALvoid AL_APIENTRY alGetDatabufferSubDataEXT(ALuint buffer, ALintptrEXT start, ALsizeiptrEXT length, ALvoid *data);
-AL_API ALvoid AL_APIENTRY alDatabufferfEXT(ALuint buffer, ALenum eParam, ALfloat flValue);
-AL_API ALvoid AL_APIENTRY alDatabufferfvEXT(ALuint buffer, ALenum eParam, const ALfloat* flValues);
-AL_API ALvoid AL_APIENTRY alDatabufferiEXT(ALuint buffer, ALenum eParam, ALint lValue);
-AL_API ALvoid AL_APIENTRY alDatabufferivEXT(ALuint buffer, ALenum eParam, const ALint* plValues);
-AL_API ALvoid AL_APIENTRY alGetDatabufferfEXT(ALuint buffer, ALenum eParam, ALfloat *pflValue);
-AL_API ALvoid AL_APIENTRY alGetDatabufferfvEXT(ALuint buffer, ALenum eParam, ALfloat* pflValues);
-AL_API ALvoid AL_APIENTRY alGetDatabufferiEXT(ALuint buffer, ALenum eParam, ALint *plValue);
-AL_API ALvoid AL_APIENTRY alGetDatabufferivEXT(ALuint buffer, ALenum eParam, ALint* plValues);
-AL_API ALvoid AL_APIENTRY alSelectDatabufferEXT(ALenum target, ALuint uiBuffer);
-AL_API ALvoid* AL_APIENTRY alMapDatabufferEXT(ALuint uiBuffer, ALintptrEXT start, ALsizeiptrEXT length, ALenum access);
-AL_API ALvoid AL_APIENTRY alUnmapDatabufferEXT(ALuint uiBuffer);
-#endif
-#endif
-
-
-#if defined(HAVE_STDINT_H)
-#include
-typedef int64_t ALint64;
-typedef uint64_t ALuint64;
-#elif defined(HAVE___INT64)
-typedef __int64 ALint64;
-typedef unsigned __int64 ALuint64;
-#elif (SIZEOF_LONG == 8)
-typedef long ALint64;
-typedef unsigned long ALuint64;
-#elif (SIZEOF_LONG_LONG == 8)
-typedef long long ALint64;
-typedef unsigned long long ALuint64;
-#endif
-
-#ifdef HAVE_GCC_FORMAT
-#define PRINTF_STYLE(x, y) __attribute__((format(__printf__, (x), (y))))
-#else
-#define PRINTF_STYLE(x, y)
-#endif
-
-#ifdef _WIN32
-
-#ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x0500
-#endif
-#include
-
-typedef DWORD tls_type;
-#define tls_create(x) (*(x) = TlsAlloc())
-#define tls_delete(x) TlsFree((x))
-#define tls_get(x) TlsGetValue((x))
-#define tls_set(x, a) TlsSetValue((x), (a))
-
-#else
-
-#include
-#include
-#include
-#ifdef HAVE_PTHREAD_NP_H
-#include
-#endif
-#include
-#include
-#include
-
-#define IsBadWritePtr(a,b) ((a) == NULL && (b) != 0)
-
-typedef pthread_key_t tls_type;
-#define tls_create(x) pthread_key_create((x), NULL)
-#define tls_delete(x) pthread_key_delete((x))
-#define tls_get(x) pthread_getspecific((x))
-#define tls_set(x, a) pthread_setspecific((x), (a))
-
-typedef pthread_mutex_t CRITICAL_SECTION;
-static __inline void EnterCriticalSection(CRITICAL_SECTION *cs)
-{
- int ret;
- ret = pthread_mutex_lock(cs);
- assert(ret == 0);
-}
-static __inline void LeaveCriticalSection(CRITICAL_SECTION *cs)
-{
- int ret;
- ret = pthread_mutex_unlock(cs);
- assert(ret == 0);
-}
-static __inline void InitializeCriticalSection(CRITICAL_SECTION *cs)
-{
- pthread_mutexattr_t attrib;
- int ret;
-
- ret = pthread_mutexattr_init(&attrib);
- assert(ret == 0);
-
- ret = pthread_mutexattr_settype(&attrib, PTHREAD_MUTEX_RECURSIVE);
-#ifdef HAVE_PTHREAD_NP_H
- if(ret != 0)
- ret = pthread_mutexattr_setkind_np(&attrib, PTHREAD_MUTEX_RECURSIVE);
-#endif
- assert(ret == 0);
- ret = pthread_mutex_init(cs, &attrib);
- assert(ret == 0);
-
- pthread_mutexattr_destroy(&attrib);
-}
-
-static __inline void DeleteCriticalSection(CRITICAL_SECTION *cs)
-{
- int ret;
- ret = pthread_mutex_destroy(cs);
- assert(ret == 0);
-}
-
-/* NOTE: This wrapper isn't quite accurate as it returns an ALuint, as opposed
- * to the expected DWORD. Both are defined as unsigned 32-bit types, however.
- * Additionally, Win32 is supposed to measure the time since Windows started,
- * as opposed to the actual time. */
-static __inline ALuint timeGetTime(void)
-{
-#if _POSIX_TIMERS > 0
- struct timespec ts;
- int ret = -1;
-
-#if defined(_POSIX_MONOTONIC_CLOCK) && (_POSIX_MONOTONIC_CLOCK >= 0)
-#if _POSIX_MONOTONIC_CLOCK == 0
- static int hasmono = 0;
- if(hasmono > 0 || (hasmono == 0 &&
- (hasmono=sysconf(_SC_MONOTONIC_CLOCK)) > 0))
-#endif
- ret = clock_gettime(CLOCK_MONOTONIC, &ts);
-#endif
- if(ret != 0)
- ret = clock_gettime(CLOCK_REALTIME, &ts);
- assert(ret == 0);
-
- return ts.tv_nsec/1000000 + ts.tv_sec*1000;
-#else
- struct timeval tv;
- int ret;
-
- ret = gettimeofday(&tv, NULL);
- assert(ret == 0);
-
- return tv.tv_usec/1000 + tv.tv_sec*1000;
-#endif
-}
-
-static __inline void Sleep(ALuint t)
-{
- struct timespec tv, rem;
- tv.tv_nsec = (t*1000000)%1000000000;
- tv.tv_sec = t/1000;
-
- while(nanosleep(&tv, &rem) == -1 && errno == EINTR)
- tv = rem;
-}
-#define min(x,y) (((x)<(y))?(x):(y))
-#define max(x,y) (((x)>(y))?(x):(y))
-#endif
-
-#include "alListener.h"
-#include "alu.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-#define SWMIXER_OUTPUT_RATE 44100
-
-#define SPEEDOFSOUNDMETRESPERSEC (343.3f)
-#define AIRABSORBGAINDBHF (-0.05f)
-
-#define LOWPASSFREQCUTOFF (5000)
-
-#define DEFAULT_HEAD_DAMPEN (0.25f)
-
-
-// Find the next power-of-2 for non-power-of-2 numbers.
-static __inline ALuint NextPowerOf2(ALuint value)
-{
- ALuint powerOf2 = 1;
-
- if(value)
- {
- value--;
- while(value)
- {
- value >>= 1;
- powerOf2 <<= 1;
- }
- }
- return powerOf2;
-}
-
-
-typedef struct {
- ALCboolean (*OpenPlayback)(ALCdevice*, const ALCchar*);
- void (*ClosePlayback)(ALCdevice*);
- ALCboolean (*ResetPlayback)(ALCdevice*);
- void (*StopPlayback)(ALCdevice*);
-
- ALCboolean (*OpenCapture)(ALCdevice*, const ALCchar*);
- void (*CloseCapture)(ALCdevice*);
- void (*StartCapture)(ALCdevice*);
- void (*StopCapture)(ALCdevice*);
- void (*CaptureSamples)(ALCdevice*, void*, ALCuint);
- ALCuint (*AvailableSamples)(ALCdevice*);
-} BackendFuncs;
-
-enum {
- DEVICE_PROBE,
- ALL_DEVICE_PROBE,
- CAPTURE_DEVICE_PROBE
-};
-
-void alc_alsa_init(BackendFuncs *func_list);
-void alc_alsa_deinit(void);
-void alc_alsa_probe(int type);
-void alc_oss_init(BackendFuncs *func_list);
-void alc_oss_deinit(void);
-void alc_oss_probe(int type);
-void alc_solaris_init(BackendFuncs *func_list);
-void alc_solaris_deinit(void);
-void alc_solaris_probe(int type);
-void alcDSoundInit(BackendFuncs *func_list);
-void alcDSoundDeinit(void);
-void alcDSoundProbe(int type);
-void alcWinMMInit(BackendFuncs *FuncList);
-void alcWinMMDeinit(void);
-void alcWinMMProbe(int type);
-void alc_pa_init(BackendFuncs *func_list);
-void alc_pa_deinit(void);
-void alc_pa_probe(int type);
-void alc_wave_init(BackendFuncs *func_list);
-void alc_wave_deinit(void);
-void alc_wave_probe(int type);
-void alc_pulse_init(BackendFuncs *func_list);
-void alc_pulse_deinit(void);
-void alc_pulse_probe(int type);
-void alc_audiotrack_init(BackendFuncs *func_list);
-void alc_audiotrack_deinit(void);
-void alc_audiotrack_probe(int type);
-void alc_opensles_init(BackendFuncs *func_list);
-void alc_opensles_deinit(void);
-void alc_opensles_probe(int type);
-void alc_null_init(BackendFuncs *func_list);
-void alc_null_deinit(void);
-void alc_null_probe(int type);
-
-
-typedef struct UIntMap {
- struct {
- ALuint key;
- ALvoid *value;
- } *array;
- ALsizei size;
- ALsizei maxsize;
-} UIntMap;
-
-void InitUIntMap(UIntMap *map);
-void ResetUIntMap(UIntMap *map);
-ALenum InsertUIntMapEntry(UIntMap *map, ALuint key, ALvoid *value);
-void RemoveUIntMapKey(UIntMap *map, ALuint key);
-ALvoid *LookupUIntMapKey(UIntMap *map, ALuint key);
-
-/* Device formats */
-enum DevFmtType {
- DevFmtByte, /* AL_BYTE */
- DevFmtUByte, /* AL_UNSIGNED_BYTE */
- DevFmtShort, /* AL_SHORT */
- DevFmtUShort, /* AL_UNSIGNED_SHORT */
- DevFmtFloat, /* AL_FLOAT */
-};
-enum DevFmtChannels {
- DevFmtMono, /* AL_MONO */
- DevFmtStereo, /* AL_STEREO */
- DevFmtQuad, /* AL_QUAD */
- DevFmtX51, /* AL_5POINT1 */
- DevFmtX61, /* AL_6POINT1 */
- DevFmtX71, /* AL_7POINT1 */
-};
-
-ALuint BytesFromDevFmt(enum DevFmtType type);
-ALuint ChannelsFromDevFmt(enum DevFmtChannels chans);
-static __inline ALuint FrameSizeFromDevFmt(enum DevFmtChannels chans,
- enum DevFmtType type)
-{
- return ChannelsFromDevFmt(chans) * BytesFromDevFmt(type);
-}
-
-
-struct ALCdevice_struct
-{
- ALCboolean Connected;
- ALboolean IsCaptureDevice;
-
- ALuint Frequency;
- ALuint UpdateSize;
- ALuint NumUpdates;
- enum DevFmtChannels FmtChans;
- enum DevFmtType FmtType;
-
- ALCchar *szDeviceName;
-
- ALCenum LastError;
-
- // Maximum number of sources that can be created
- ALuint MaxNoOfSources;
- // Maximum number of slots that can be created
- ALuint AuxiliaryEffectSlotMax;
-
- ALCuint NumMonoSources;
- ALCuint NumStereoSources;
- ALuint NumAuxSends;
-
- // Map of Buffers for this device
- UIntMap BufferMap;
-
- // Map of Effects for this device
- UIntMap EffectMap;
-
- // Map of Filters for this device
- UIntMap FilterMap;
-
- // Map of Databuffers for this device
- UIntMap DatabufferMap;
-
- // Stereo-to-binaural filter
- struct bs2b *Bs2b;
- ALCint Bs2bLevel;
-
- // Simulated dampening from head occlusion
- ALfp HeadDampen;
-
- // Duplicate stereo sources on the side/rear channels
- ALboolean DuplicateStereo;
-
- // Dry path buffer mix
- ALfp DryBuffer[BUFFERSIZE][MAXCHANNELS];
-
- ALuint DevChannels[MAXCHANNELS];
-
- ALfp ChannelMatrix[MAXCHANNELS][MAXCHANNELS];
-
- Channel Speaker2Chan[MAXCHANNELS];
- ALfp PanningLUT[MAXCHANNELS * LUT_NUM];
- ALuint NumChan;
-
- ALfp ClickRemoval[MAXCHANNELS];
- ALfp PendingClicks[MAXCHANNELS];
-
- // Contexts created on this device
- ALCcontext **Contexts;
- ALuint NumContexts;
-
- BackendFuncs *Funcs;
- void *ExtraData; // For the backend's use
-
- ALCdevice *next;
-};
-
-#define ALCdevice_OpenPlayback(a,b) ((a)->Funcs->OpenPlayback((a), (b)))
-#define ALCdevice_ClosePlayback(a) ((a)->Funcs->ClosePlayback((a)))
-#define ALCdevice_ResetPlayback(a) ((a)->Funcs->ResetPlayback((a)))
-#define ALCdevice_StopPlayback(a) ((a)->Funcs->StopPlayback((a)))
-#define ALCdevice_OpenCapture(a,b) ((a)->Funcs->OpenCapture((a), (b)))
-#define ALCdevice_CloseCapture(a) ((a)->Funcs->CloseCapture((a)))
-#define ALCdevice_StartCapture(a) ((a)->Funcs->StartCapture((a)))
-#define ALCdevice_StopCapture(a) ((a)->Funcs->StopCapture((a)))
-#define ALCdevice_CaptureSamples(a,b,c) ((a)->Funcs->CaptureSamples((a), (b), (c)))
-#define ALCdevice_AvailableSamples(a) ((a)->Funcs->AvailableSamples((a)))
-
-struct ALCcontext_struct
-{
- ALlistener Listener;
-
- UIntMap SourceMap;
- UIntMap EffectSlotMap;
-
- struct ALdatabuffer *SampleSource;
- struct ALdatabuffer *SampleSink;
-
- ALenum LastError;
-
- ALboolean Suspended;
-
- ALenum DistanceModel;
- ALboolean SourceDistanceModel;
-
- ALfp DopplerFactor;
- ALfp DopplerVelocity;
- ALfp flSpeedOfSound;
-
- struct ALsource **ActiveSources;
- ALsizei ActiveSourceCount;
- ALsizei MaxActiveSources;
-
- // Apportable Extension
- ALsizei PrioritySlots;
-
- ALCdevice *Device;
- const ALCchar *ExtensionList;
-
- ALCcontext *next;
-};
-
-void AppendDeviceList(const ALCchar *name);
-void AppendAllDeviceList(const ALCchar *name);
-void AppendCaptureDeviceList(const ALCchar *name);
-
-ALCvoid alcSetError(ALCdevice *device, ALenum errorCode);
-
-ALCvoid SuspendContext(ALCcontext *context);
-ALCvoid ProcessContext(ALCcontext *context);
-
-ALvoid *StartThread(ALuint (*func)(ALvoid*), ALvoid *ptr);
-ALuint StopThread(ALvoid *thread);
-
-ALCcontext *GetContextSuspended(void);
-
-typedef struct RingBuffer RingBuffer;
-RingBuffer *CreateRingBuffer(ALsizei frame_size, ALsizei length);
-void DestroyRingBuffer(RingBuffer *ring);
-ALsizei RingBufferSize(RingBuffer *ring);
-void WriteRingBuffer(RingBuffer *ring, const ALubyte *data, ALsizei len);
-void ReadRingBuffer(RingBuffer *ring, ALubyte *data, ALsizei len);
-
-void ReadALConfig(void);
-void FreeALConfig(void);
-int ConfigValueExists(const char *blockName, const char *keyName);
-const char *GetConfigValue(const char *blockName, const char *keyName, const char *def);
-int GetConfigValueInt(const char *blockName, const char *keyName, int def);
-float GetConfigValueFloat(const char *blockName, const char *keyName, float def);
-int GetConfigValueBool(const char *blockName, const char *keyName, int def);
-
-void SetRTPriority(void);
-
-void SetDefaultChannelOrder(ALCdevice *device);
-void SetDefaultWFXChannelOrder(ALCdevice *device);
-
-void al_print(const char *fname, unsigned int line, const char *fmt, ...)
- PRINTF_STYLE(3,4);
-#define AL_PRINT(...) al_print(__FILE__, __LINE__, __VA_ARGS__)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/internal/c/parts/audio/out/android/OpenAL/Alc/alSource.h b/internal/c/parts/audio/out/android/OpenAL/Alc/alSource.h
deleted file mode 100644
index b4a91e9d1..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Alc/alSource.h
+++ /dev/null
@@ -1,124 +0,0 @@
-#ifndef _AL_SOURCE_H_
-#define _AL_SOURCE_H_
-
-#define MAX_SENDS 4
-
-#include "alFilter.h"
-#include "alu.h"
-#include "AL/al.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
- POINT_RESAMPLER = 0,
- LINEAR_RESAMPLER,
- CUBIC_RESAMPLER,
-
- RESAMPLER_MAX,
- RESAMPLER_MIN = -1,
- RESAMPLER_DEFAULT = LINEAR_RESAMPLER
-} resampler_t;
-extern resampler_t DefaultResampler;
-
-extern const ALsizei ResamplerPadding[RESAMPLER_MAX];
-extern const ALsizei ResamplerPrePadding[RESAMPLER_MAX];
-
-
-typedef struct ALbufferlistitem
-{
- struct ALbuffer *buffer;
- struct ALbufferlistitem *next;
- struct ALbufferlistitem *prev;
-} ALbufferlistitem;
-
-typedef struct ALsource
-{
- ALfp flPitch;
- ALfp flGain;
- ALfp flOuterGain;
- ALfp flMinGain;
- ALfp flMaxGain;
- ALfp flInnerAngle;
- ALfp flOuterAngle;
- ALfp flRefDistance;
- ALfp flMaxDistance;
- ALfp flRollOffFactor;
- ALfp vPosition[3];
- ALfp vVelocity[3];
- ALfp vOrientation[3];
- ALboolean bHeadRelative;
- ALboolean bLooping;
- ALenum DistanceModel;
-
- // Apportably Extension
- ALuint priority;
-
- resampler_t Resampler;
-
- ALenum state;
- ALuint position;
- ALuint position_fraction;
-
- struct ALbuffer *Buffer;
-
- ALbufferlistitem *queue; // Linked list of buffers in queue
- ALuint BuffersInQueue; // Number of buffers in queue
- ALuint BuffersPlayed; // Number of buffers played on this loop
-
- ALfilter DirectFilter;
-
- struct {
- struct ALeffectslot *Slot;
- ALfilter WetFilter;
- } Send[MAX_SENDS];
-
- ALboolean DryGainHFAuto;
- ALboolean WetGainAuto;
- ALboolean WetGainHFAuto;
- ALfp OuterGainHF;
-
- ALfp AirAbsorptionFactor;
- ALfp RoomRolloffFactor;
- ALfp DopplerFactor;
-
- ALint lOffset;
- ALint lOffsetType;
-
- // Source Type (Static, Streaming, or Undetermined)
- ALint lSourceType;
-
- // Current target parameters used for mixing
- ALboolean NeedsUpdate;
- struct {
- ALint Step;
-
- /* A mixing matrix. First subscript is the channel number of the input
- * data (regardless of channel configuration) and the second is the
- * channel target (eg. FRONT_LEFT) */
- ALfp DryGains[MAXCHANNELS][MAXCHANNELS];
- FILTER iirFilter;
- ALfp history[MAXCHANNELS*2];
-
- struct {
- ALfp WetGain;
- FILTER iirFilter;
- ALfp history[MAXCHANNELS];
- } Send[MAX_SENDS];
- } Params;
-
- ALvoid (*Update)(struct ALsource *self, const ALCcontext *context);
-
- // Index to itself
- ALuint source;
-} ALsource;
-#define ALsource_Update(s,a) ((s)->Update(s,a))
-
-ALvoid ReleaseALSources(ALCcontext *Context);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/internal/c/parts/audio/out/android/OpenAL/Alc/alState.h b/internal/c/parts/audio/out/android/OpenAL/Alc/alState.h
deleted file mode 100644
index 332176b03..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Alc/alState.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef _AL_STATE_H_
-#define _AL_STATE_H_
-
-#include "AL/al.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/internal/c/parts/audio/out/android/OpenAL/Alc/alThunk.h b/internal/c/parts/audio/out/android/OpenAL/Alc/alThunk.h
deleted file mode 100644
index 902f00e54..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Alc/alThunk.h
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef _AL_THUNK_H_
-#define _AL_THUNK_H_
-
-#include "config.h"
-
-#include "AL/al.h"
-#include "AL/alc.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void alThunkInit(void);
-void alThunkExit(void);
-ALuint alThunkAddEntry(ALvoid *ptr);
-void alThunkRemoveEntry(ALuint index);
-ALvoid *alThunkLookupEntry(ALuint index);
-
-#if (SIZEOF_VOIDP > SIZEOF_UINT)
-
-#define ALTHUNK_INIT() alThunkInit()
-#define ALTHUNK_EXIT() alThunkExit()
-#define ALTHUNK_ADDENTRY(p) alThunkAddEntry(p)
-#define ALTHUNK_REMOVEENTRY(i) alThunkRemoveEntry(i)
-#define ALTHUNK_LOOKUPENTRY(i) alThunkLookupEntry(i)
-
-#else
-
-#define ALTHUNK_INIT()
-#define ALTHUNK_EXIT()
-#define ALTHUNK_ADDENTRY(p) ((ALuint)p)
-#define ALTHUNK_REMOVEENTRY(i) ((ALvoid)i)
-#define ALTHUNK_LOOKUPENTRY(i) ((ALvoid*)(i))
-
-#endif // (SIZEOF_VOIDP > SIZEOF_INT)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //_AL_THUNK_H_
-
diff --git a/internal/c/parts/audio/out/android/OpenAL/Alc/alcConfig.c b/internal/c/parts/audio/out/android/OpenAL/Alc/alcConfig.c
deleted file mode 100644
index 847e5d13f..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Alc/alcConfig.c
+++ /dev/null
@@ -1,338 +0,0 @@
-/**
- * OpenAL cross platform audio library
- * Copyright (C) 1999-2007 by authors.
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- * Or go to http://www.gnu.org/copyleft/lgpl.html
- */
-
-#ifdef _WIN32
-#ifdef __MINGW64__
-#define _WIN32_IE 0x501
-#else
-#define _WIN32_IE 0x400
-#endif
-#endif
-
-#include "config.h"
-
-#include
-#include
-#include
-#include
-
-#include "alMain.h"
-
-#ifdef _WIN32_IE
-#include
-#endif
-
-typedef struct ConfigEntry {
- char *key;
- char *value;
-} ConfigEntry;
-
-typedef struct ConfigBlock {
- char *name;
- ConfigEntry *entries;
- size_t entryCount;
-} ConfigBlock;
-
-static ConfigBlock *cfgBlocks;
-static size_t cfgCount;
-
-static char buffer[1024];
-
-static void LoadConfigFromFile(FILE *f)
-{
- ConfigBlock *curBlock = cfgBlocks;
- ConfigEntry *ent;
-
- while(fgets(buffer, sizeof(buffer), f))
- {
- size_t i = 0;
-
- while(isspace(buffer[i]))
- i++;
- if(!buffer[i] || buffer[i] == '#')
- continue;
-
- memmove(buffer, buffer+i, strlen(buffer+i)+1);
-
- if(buffer[0] == '[')
- {
- ConfigBlock *nextBlock;
-
- i = 1;
- while(buffer[i] && buffer[i] != ']')
- i++;
-
- if(!buffer[i])
- {
- AL_PRINT("config parse error: bad line \"%s\"\n", buffer);
- continue;
- }
- buffer[i] = 0;
-
- do {
- i++;
- if(buffer[i] && !isspace(buffer[i]))
- {
- if(buffer[i] != '#')
- AL_PRINT("config warning: extra data after block: \"%s\"\n", buffer+i);
- break;
- }
- } while(buffer[i]);
-
- nextBlock = NULL;
- for(i = 0;i < cfgCount;i++)
- {
- if(strcasecmp(cfgBlocks[i].name, buffer+1) == 0)
- {
- nextBlock = cfgBlocks+i;
-// AL_PRINT("found block '%s'\n", nextBlock->name);
- break;
- }
- }
-
- if(!nextBlock)
- {
- nextBlock = realloc(cfgBlocks, (cfgCount+1)*sizeof(ConfigBlock));
- if(!nextBlock)
- {
- AL_PRINT("config parse error: error reallocating config blocks\n");
- continue;
- }
- cfgBlocks = nextBlock;
- nextBlock = cfgBlocks+cfgCount;
- cfgCount++;
-
- nextBlock->name = strdup(buffer+1);
- nextBlock->entries = NULL;
- nextBlock->entryCount = 0;
-
-// AL_PRINT("found new block '%s'\n", nextBlock->name);
- }
- curBlock = nextBlock;
- continue;
- }
-
- /* Look for the option name */
- i = 0;
- while(buffer[i] && buffer[i] != '#' && buffer[i] != '=' &&
- !isspace(buffer[i]))
- i++;
-
- if(!buffer[i] || buffer[i] == '#' || i == 0)
- {
- AL_PRINT("config parse error: malformed option line: \"%s\"\n", buffer);
- continue;
- }
-
- /* Seperate the option */
- if(buffer[i] != '=')
- {
- buffer[i++] = 0;
-
- while(isspace(buffer[i]))
- i++;
- if(buffer[i] != '=')
- {
- AL_PRINT("config parse error: option without a value: \"%s\"\n", buffer);
- continue;
- }
- }
- /* Find the start of the value */
- buffer[i++] = 0;
- while(isspace(buffer[i]))
- i++;
-
- /* Check if we already have this option set */
- ent = curBlock->entries;
- while((size_t)(ent-curBlock->entries) < curBlock->entryCount)
- {
- if(strcasecmp(ent->key, buffer) == 0)
- break;
- ent++;
- }
-
- if((size_t)(ent-curBlock->entries) >= curBlock->entryCount)
- {
- /* Allocate a new option entry */
- ent = realloc(curBlock->entries, (curBlock->entryCount+1)*sizeof(ConfigEntry));
- if(!ent)
- {
- AL_PRINT("config parse error: error reallocating config entries\n");
- continue;
- }
- curBlock->entries = ent;
- ent = curBlock->entries + curBlock->entryCount;
- curBlock->entryCount++;
-
- ent->key = strdup(buffer);
- ent->value = NULL;
- }
-
- /* Look for the end of the line (Null term, new-line, or #-symbol) and
- eat up the trailing whitespace */
- memmove(buffer, buffer+i, strlen(buffer+i)+1);
-
- i = 0;
- while(buffer[i] && buffer[i] != '#' && buffer[i] != '\n')
- i++;
- do {
- i--;
- } while(isspace(buffer[i]));
- buffer[++i] = 0;
-
- free(ent->value);
- ent->value = strdup(buffer);
-
-// AL_PRINT("found '%s' = '%s'\n", ent->key, ent->value);
- }
-}
-
-void ReadALConfig(void)
-{
- FILE *f;
-
- cfgBlocks = calloc(1, sizeof(ConfigBlock));
- cfgBlocks->name = strdup("general");
- cfgCount = 1;
-
-#ifdef _WIN32
- if(SHGetSpecialFolderPathA(NULL, buffer, CSIDL_APPDATA, FALSE) != FALSE)
- {
- size_t p = strlen(buffer);
- snprintf(buffer+p, sizeof(buffer)-p, "\\alsoft.ini");
- f = fopen(buffer, "rt");
- if(f)
- {
- LoadConfigFromFile(f);
- fclose(f);
- }
- }
-#else
- f = fopen("/etc/openal/alsoft.conf", "r");
- if(f)
- {
- LoadConfigFromFile(f);
- fclose(f);
- }
- if(getenv("HOME") && *(getenv("HOME")))
- {
- snprintf(buffer, sizeof(buffer), "%s/.alsoftrc", getenv("HOME"));
- f = fopen(buffer, "r");
- if(f)
- {
- LoadConfigFromFile(f);
- fclose(f);
- }
- }
-#endif
- if(getenv("ALSOFT_CONF"))
- {
- f = fopen(getenv("ALSOFT_CONF"), "r");
- if(f)
- {
- LoadConfigFromFile(f);
- fclose(f);
- }
- }
-}
-
-void FreeALConfig(void)
-{
- size_t i;
-
- for(i = 0;i < cfgCount;i++)
- {
- size_t j;
- for(j = 0;j < cfgBlocks[i].entryCount;j++)
- {
- free(cfgBlocks[i].entries[j].key);
- free(cfgBlocks[i].entries[j].value);
- }
- free(cfgBlocks[i].entries);
- free(cfgBlocks[i].name);
- }
- free(cfgBlocks);
- cfgBlocks = NULL;
- cfgCount = 0;
-}
-
-const char *GetConfigValue(const char *blockName, const char *keyName, const char *def)
-{
- size_t i, j;
-
- if(!keyName)
- return def;
-
- if(!blockName)
- blockName = "general";
-
- for(i = 0;i < cfgCount;i++)
- {
- if(strcasecmp(cfgBlocks[i].name, blockName) != 0)
- continue;
-
- for(j = 0;j < cfgBlocks[i].entryCount;j++)
- {
- if(strcasecmp(cfgBlocks[i].entries[j].key, keyName) == 0)
- {
- if(cfgBlocks[i].entries[j].value[0])
- return cfgBlocks[i].entries[j].value;
- return def;
- }
- }
- }
-
- return def;
-}
-
-int ConfigValueExists(const char *blockName, const char *keyName)
-{
- const char *val = GetConfigValue(blockName, keyName, "");
- return !!val[0];
-}
-
-int GetConfigValueInt(const char *blockName, const char *keyName, int def)
-{
- const char *val = GetConfigValue(blockName, keyName, "");
-
- if(!val[0]) return def;
- return strtol(val, NULL, 0);
-}
-
-float GetConfigValueFloat(const char *blockName, const char *keyName, float def)
-{
- const char *val = GetConfigValue(blockName, keyName, "");
-
- if(!val[0]) return def;
-#ifdef HAVE_STRTOF
- return strtof(val, NULL);
-#else
- return (float)strtod(val, NULL);
-#endif
-}
-
-int GetConfigValueBool(const char *blockName, const char *keyName, int def)
-{
- const char *val = GetConfigValue(blockName, keyName, "");
-
- if(!val[0]) return !!def;
- return (strcasecmp(val, "true") == 0 || strcasecmp(val, "yes") == 0 ||
- strcasecmp(val, "on") == 0 || atoi(val) != 0);
-}
diff --git a/internal/c/parts/audio/out/android/OpenAL/Alc/alcEcho.c b/internal/c/parts/audio/out/android/OpenAL/Alc/alcEcho.c
deleted file mode 100644
index 1abf0b2ec..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Alc/alcEcho.c
+++ /dev/null
@@ -1,203 +0,0 @@
-/**
- * OpenAL cross platform audio library
- * Copyright (C) 2009 by Chris Robinson.
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- * Or go to http://www.gnu.org/copyleft/lgpl.html
- */
-
-#include "config.h"
-
-#include
-#include
-
-#include "alMain.h"
-#include "alFilter.h"
-#include "alAuxEffectSlot.h"
-#include "alError.h"
-#include "alu.h"
-
-
-typedef struct ALechoState {
- // Must be first in all effects!
- ALeffectState state;
-
- ALfp *SampleBuffer;
- ALuint BufferLength;
-
- // The echo is two tap. The delay is the number of samples from before the
- // current offset
- struct {
- ALuint delay;
- } Tap[2];
- ALuint Offset;
- // The LR gains for the first tap. The second tap uses the reverse
- ALfp GainL;
- ALfp GainR;
-
- ALfp FeedGain;
-
- ALfp Gain[MAXCHANNELS];
-
- FILTER iirFilter;
- ALfp history[2];
-} ALechoState;
-
-static ALvoid EchoDestroy(ALeffectState *effect)
-{
- ALechoState *state = (ALechoState*)effect;
- if(state)
- {
- free(state->SampleBuffer);
- state->SampleBuffer = NULL;
- free(state);
- }
-}
-
-static ALboolean EchoDeviceUpdate(ALeffectState *effect, ALCdevice *Device)
-{
- ALechoState *state = (ALechoState*)effect;
- ALuint maxlen, i;
-
- // Use the next power of 2 for the buffer length, so the tap offsets can be
- // wrapped using a mask instead of a modulo
- maxlen = (ALuint)(AL_ECHO_MAX_DELAY * Device->Frequency) + 1;
- maxlen += (ALuint)(AL_ECHO_MAX_LRDELAY * Device->Frequency) + 1;
- maxlen = NextPowerOf2(maxlen);
-
- if(maxlen != state->BufferLength)
- {
- void *temp;
-
- temp = realloc(state->SampleBuffer, maxlen * sizeof(ALfp));
- if(!temp)
- return AL_FALSE;
- state->SampleBuffer = temp;
- state->BufferLength = maxlen;
- }
- for(i = 0;i < state->BufferLength;i++)
- state->SampleBuffer[i] = int2ALfp(0);
-
- for(i = 0;i < MAXCHANNELS;i++)
- state->Gain[i] = int2ALfp(0);
- for(i = 0;i < Device->NumChan;i++)
- {
- Channel chan = Device->Speaker2Chan[i];
- state->Gain[chan] = int2ALfp(1);
- }
-
- return AL_TRUE;
-}
-
-static ALvoid EchoUpdate(ALeffectState *effect, ALCcontext *Context, const ALeffect *Effect)
-{
- ALechoState *state = (ALechoState*)effect;
- ALuint frequency = Context->Device->Frequency;
- ALfp lrpan, cw, a, g;
-
- state->Tap[0].delay = (ALuint)ALfp2int((ALfpMult(Effect->Echo.Delay, int2ALfp(frequency)) + int2ALfp(1)));
- state->Tap[1].delay = (ALuint)ALfp2int(ALfpMult(Effect->Echo.LRDelay, int2ALfp(frequency)));
- state->Tap[1].delay += state->Tap[0].delay;
-
- lrpan = (ALfpMult(Effect->Echo.Spread, float2ALfp(0.5f)) + float2ALfp(0.5f));
- state->GainL = aluSqrt( lrpan);
- state->GainR = aluSqrt((int2ALfp(1)-lrpan));
-
- state->FeedGain = Effect->Echo.Feedback;
-
- cw = __cos(ALfpDiv(float2ALfp(2.0*M_PI * LOWPASSFREQCUTOFF), int2ALfp(frequency)));
- g = (int2ALfp(1) - Effect->Echo.Damping);
- a = int2ALfp(0);
- if(g < float2ALfp(0.9999f)) /* 1-epsilon */ {
- // a = (1 - g*cw - aluSqrt(2*g*(1-cw) - g*g*(1 - cw*cw))) / (1 - g);
- a = ALfpDiv((int2ALfp(1) - ALfpMult(g,cw) - aluSqrt((ALfpMult(ALfpMult(int2ALfp(2),g),(int2ALfp(1)-cw)) -
- ALfpMult(ALfpMult(g,g),(int2ALfp(1) - ALfpMult(cw,cw)))))),
- (int2ALfp(1) - g));
- }
- state->iirFilter.coeff = a;
-}
-
-static ALvoid EchoProcess(ALeffectState *effect, const ALeffectslot *Slot, ALuint SamplesToDo, const ALfp *SamplesIn, ALfp (*SamplesOut)[MAXCHANNELS])
-{
- ALechoState *state = (ALechoState*)effect;
- const ALuint mask = state->BufferLength-1;
- const ALuint tap1 = state->Tap[0].delay;
- const ALuint tap2 = state->Tap[1].delay;
- ALuint offset = state->Offset;
- const ALfp gain = Slot->Gain;
- ALfp samp[2], smp;
- ALuint i;
-
- for(i = 0;i < SamplesToDo;i++,offset++)
- {
- // Sample first tap
- smp = state->SampleBuffer[(offset-tap1) & mask];
- samp[0] = ALfpMult(smp, state->GainL);
- samp[1] = ALfpMult(smp, state->GainR);
- // Sample second tap. Reverse LR panning
- smp = state->SampleBuffer[(offset-tap2) & mask];
- samp[0] += ALfpMult(smp, state->GainR);
- samp[1] += ALfpMult(smp, state->GainL);
-
- // Apply damping and feedback gain to the second tap, and mix in the
- // new sample
- smp = lpFilter2P(&state->iirFilter, 0, (smp+SamplesIn[i]));
- state->SampleBuffer[offset&mask] = ALfpMult(smp, state->FeedGain);
-
- // Apply slot gain
- samp[0] = ALfpMult(samp[0], gain);
- samp[1] = ALfpMult(samp[1], gain);
-
- SamplesOut[i][FRONT_LEFT] += ALfpMult(state->Gain[FRONT_LEFT], samp[0]);
- SamplesOut[i][FRONT_RIGHT] += ALfpMult(state->Gain[FRONT_RIGHT], samp[1]);
-#ifdef APPORTABLE_OPTIMIZED_OUT
- SamplesOut[i][SIDE_LEFT] += ALfpMult(state->Gain[SIDE_LEFT], samp[0]);
- SamplesOut[i][SIDE_RIGHT] += ALfpMult(state->Gain[SIDE_RIGHT], samp[1]);
- SamplesOut[i][BACK_LEFT] += ALfpMult(state->Gain[BACK_LEFT], samp[0]);
- SamplesOut[i][BACK_RIGHT] += ALfpMult(state->Gain[BACK_RIGHT], samp[1]);
-#endif
-
- }
- state->Offset = offset;
-}
-
-ALeffectState *EchoCreate(void)
-{
- ALechoState *state;
-
- state = malloc(sizeof(*state));
- if(!state)
- return NULL;
-
- state->state.Destroy = EchoDestroy;
- state->state.DeviceUpdate = EchoDeviceUpdate;
- state->state.Update = EchoUpdate;
- state->state.Process = EchoProcess;
-
- state->BufferLength = 0;
- state->SampleBuffer = NULL;
-
- state->Tap[0].delay = 0;
- state->Tap[1].delay = 0;
- state->Offset = 0;
- state->GainL = int2ALfp(0);
- state->GainR = int2ALfp(0);
-
- state->iirFilter.coeff = int2ALfp(0);
- state->iirFilter.history[0] = int2ALfp(0);
- state->iirFilter.history[1] = int2ALfp(0);
-
- return &state->state;
-}
diff --git a/internal/c/parts/audio/out/android/OpenAL/Alc/alcModulator.c b/internal/c/parts/audio/out/android/OpenAL/Alc/alcModulator.c
deleted file mode 100644
index 445bf13ad..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Alc/alcModulator.c
+++ /dev/null
@@ -1,229 +0,0 @@
-/**
- * OpenAL cross platform audio library
- * Copyright (C) 2009 by Chris Robinson.
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- * Or go to http://www.gnu.org/copyleft/lgpl.html
- */
-
-#include "config.h"
-
-#include
-#include
-
-#include "alMain.h"
-#include "alFilter.h"
-#include "alAuxEffectSlot.h"
-#include "alError.h"
-#include "alu.h"
-
-
-typedef struct ALmodulatorState {
- // Must be first in all effects!
- ALeffectState state;
-
- enum {
- SINUSOID,
- SAWTOOTH,
- SQUARE
- } Waveform;
-
- ALuint index;
- ALuint step;
-
- ALfp Gain[MAXCHANNELS];
-
- FILTER iirFilter;
- ALfp history[1];
-} ALmodulatorState;
-
-#define WAVEFORM_FRACBITS 16
-#define WAVEFORM_FRACMASK ((1<>(WAVEFORM_FRACBITS-1))&1) ? -1 : 1);
-}
-
-
-static __inline ALfp hpFilter1P(FILTER *iir, ALuint offset, ALfp input)
-{
- ALfp *history = &iir->history[offset];
- ALfp a = iir->coeff;
- ALfp output = input;
-
- output = (output + ALfpMult((history[0]-output),a));
- history[0] = output;
-
- return (input - output);
-}
-
-
-static ALvoid ModulatorDestroy(ALeffectState *effect)
-{
- ALmodulatorState *state = (ALmodulatorState*)effect;
- free(state);
-}
-
-static ALboolean ModulatorDeviceUpdate(ALeffectState *effect, ALCdevice *Device)
-{
- ALmodulatorState *state = (ALmodulatorState*)effect;
- ALuint index;
-
- for(index = 0;index < MAXCHANNELS;index++)
- state->Gain[index] = int2ALfp(0);
- for(index = 0;index < Device->NumChan;index++)
- {
- Channel chan = Device->Speaker2Chan[index];
- state->Gain[chan] = int2ALfp(1);
- }
-
- return AL_TRUE;
-}
-
-static ALvoid ModulatorUpdate(ALeffectState *effect, ALCcontext *Context, const ALeffect *Effect)
-{
- ALmodulatorState *state = (ALmodulatorState*)effect;
- ALfp cw, a;
- a = int2ALfp(0);
-
- if(Effect->Modulator.Waveform == AL_RING_MODULATOR_SINUSOID)
- state->Waveform = SINUSOID;
- else if(Effect->Modulator.Waveform == AL_RING_MODULATOR_SAWTOOTH)
- state->Waveform = SAWTOOTH;
- else if(Effect->Modulator.Waveform == AL_RING_MODULATOR_SQUARE)
- state->Waveform = SQUARE;
-
- state->step = ALfp2int(ALfpDiv(ALfpMult(Effect->Modulator.Frequency,
- int2ALfp(1<Device->Frequency)));
- if(!state->step)
- state->step = 1;
-
- cw = __cos(ALfpDiv(ALfpMult(float2ALfp(2.0*M_PI),
- Effect->Modulator.HighPassCutoff),
- int2ALfp(Context->Device->Frequency)));
- a = ((int2ALfp(2)-cw) -
- aluSqrt((aluPow((int2ALfp(2)-cw), int2ALfp(2)) - int2ALfp(1))));
- state->iirFilter.coeff = a;
-}
-
-static ALvoid ModulatorProcess(ALeffectState *effect, const ALeffectslot *Slot, ALuint SamplesToDo, const ALfp *SamplesIn, ALfp (*SamplesOut)[MAXCHANNELS])
-{
- ALmodulatorState *state = (ALmodulatorState*)effect;
- const ALfp gain = Slot->Gain;
- const ALuint step = state->step;
- ALuint index = state->index;
- ALfp samp;
- ALuint i;
-
- switch(state->Waveform)
- {
- case SINUSOID:
- for(i = 0;i < SamplesToDo;i++)
- {
-#ifdef APPORTABLE_OPTIMIZED_OUT
-#define FILTER_OUT(func) do { \
- samp = SamplesIn[i]; \
- \
- index += step; \
- index &= WAVEFORM_FRACMASK; \
- samp *= func(index); \
- \
- samp = hpFilter1P(&state->iirFilter, 0, samp); \
- \
- /* Apply slot gain */ \
- samp *= gain; \
- \
- SamplesOut[i][FRONT_LEFT] += state->Gain[FRONT_LEFT] * samp; \
- SamplesOut[i][FRONT_RIGHT] += state->Gain[FRONT_RIGHT] * samp; \
- SamplesOut[i][FRONT_CENTER] += state->Gain[FRONT_CENTER] * samp; \
- SamplesOut[i][SIDE_LEFT] += state->Gain[SIDE_LEFT] * samp; \
- SamplesOut[i][SIDE_RIGHT] += state->Gain[SIDE_RIGHT] * samp; \
- SamplesOut[i][BACK_LEFT] += state->Gain[BACK_LEFT] * samp; \
- SamplesOut[i][BACK_RIGHT] += state->Gain[BACK_RIGHT] * samp; \
- SamplesOut[i][BACK_CENTER] += state->Gain[BACK_CENTER] * samp; \
-} while(0)
-#else
-//Apportable optimized version
-#define FILTER_OUT(func) do { \
- samp = SamplesIn[i]; \
- \
- index += step; \
- index &= WAVEFORM_FRACMASK; \
- samp = ALfpMult(samp, func(index)); \
- \
- samp = hpFilter1P(&state->iirFilter, 0, samp); \
- \
- /* Apply slot gain */ \
- samp = ALfpMult(samp, gain); \
- \
- SamplesOut[i][FRONT_LEFT] += ALfpMult(state->Gain[FRONT_LEFT], samp); \
- SamplesOut[i][FRONT_RIGHT] += ALfpMult(state->Gain[FRONT_RIGHT], samp); \
-} while(0)
-#endif
- FILTER_OUT(sin_func);
- }
- break;
-
- case SAWTOOTH:
- for(i = 0;i < SamplesToDo;i++)
- {
- FILTER_OUT(saw_func);
- }
- break;
-
- case SQUARE:
- for(i = 0;i < SamplesToDo;i++)
- {
- FILTER_OUT(square_func);
-#undef FILTER_OUT
- }
- break;
- }
- state->index = index;
-}
-
-ALeffectState *ModulatorCreate(void)
-{
- ALmodulatorState *state;
-
- state = malloc(sizeof(*state));
- if(!state)
- return NULL;
-
- state->state.Destroy = ModulatorDestroy;
- state->state.DeviceUpdate = ModulatorDeviceUpdate;
- state->state.Update = ModulatorUpdate;
- state->state.Process = ModulatorProcess;
-
- state->index = 0;
- state->step = 1;
-
- state->iirFilter.coeff = int2ALfp(0);
- state->iirFilter.history[0] = int2ALfp(0);
-
- return &state->state;
-}
diff --git a/internal/c/parts/audio/out/android/OpenAL/Alc/alcReverb.c b/internal/c/parts/audio/out/android/OpenAL/Alc/alcReverb.c
deleted file mode 100644
index 496a15db2..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Alc/alcReverb.c
+++ /dev/null
@@ -1,1371 +0,0 @@
-/**
- * Reverb for the OpenAL cross platform audio library
- * Copyright (C) 2008-2009 by Christopher Fitzgerald.
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- * Or go to http://www.gnu.org/copyleft/lgpl.html
- */
-
-#include "config.h"
-
-#include
-#include
-#include
-
-#include "AL/al.h"
-#include "AL/alc.h"
-#include "alMain.h"
-#include "alAuxEffectSlot.h"
-#include "alEffect.h"
-#include "alError.h"
-#include "alu.h"
-
-typedef struct DelayLine
-{
- // The delay lines use sample lengths that are powers of 2 to allow the
- // use of bit-masking instead of a modulus for wrapping.
- ALuint Mask;
- ALfp *Line;
-} DelayLine;
-
-typedef struct ALverbState {
- // Must be first in all effects!
- ALeffectState state;
-
- // All delay lines are allocated as a single buffer to reduce memory
- // fragmentation and management code.
- ALfp *SampleBuffer;
- ALuint TotalSamples;
- // Master effect low-pass filter (2 chained 1-pole filters).
- FILTER LpFilter;
- ALfp LpHistory[2];
- struct {
- // Modulator delay line.
- DelayLine Delay;
- // The vibrato time is tracked with an index over a modulus-wrapped
- // range (in samples).
- ALuint Index;
- ALuint Range;
- // The depth of frequency change (also in samples) and its filter.
- ALfp Depth;
- ALfp Coeff;
- ALfp Filter;
- } Mod;
- // Initial effect delay.
- DelayLine Delay;
- // The tap points for the initial delay. First tap goes to early
- // reflections, the last to late reverb.
- ALuint DelayTap[2];
- struct {
- // Output gain for early reflections.
- ALfp Gain;
- // Early reflections are done with 4 delay lines.
- ALfp Coeff[4];
- DelayLine Delay[4];
- ALuint Offset[4];
- // The gain for each output channel based on 3D panning (only for the
- // EAX path).
- ALfp PanGain[MAXCHANNELS];
- } Early;
- // Decorrelator delay line.
- DelayLine Decorrelator;
- // There are actually 4 decorrelator taps, but the first occurs at the
- // initial sample.
- ALuint DecoTap[3];
- struct {
- // Output gain for late reverb.
- ALfp Gain;
- // Attenuation to compensate for the modal density and decay rate of
- // the late lines.
- ALfp DensityGain;
- // The feed-back and feed-forward all-pass coefficient.
- ALfp ApFeedCoeff;
- // Mixing matrix coefficient.
- ALfp MixCoeff;
- // Late reverb has 4 parallel all-pass filters.
- ALfp ApCoeff[4];
- DelayLine ApDelay[4];
- ALuint ApOffset[4];
- // In addition to 4 cyclical delay lines.
- ALfp Coeff[4];
- DelayLine Delay[4];
- ALuint Offset[4];
- // The cyclical delay lines are 1-pole low-pass filtered.
- ALfp LpCoeff[4];
- ALfp LpSample[4];
- // The gain for each output channel based on 3D panning (only for the
- // EAX path).
- ALfp PanGain[MAXCHANNELS];
- } Late;
- struct {
- // Attenuation to compensate for the modal density and decay rate of
- // the echo line.
- ALfp DensityGain;
- // Echo delay and all-pass lines.
- DelayLine Delay;
- DelayLine ApDelay;
- ALfp Coeff;
- ALfp ApFeedCoeff;
- ALfp ApCoeff;
- ALuint Offset;
- ALuint ApOffset;
- // The echo line is 1-pole low-pass filtered.
- ALfp LpCoeff;
- ALfp LpSample;
- // Echo mixing coefficients.
- ALfp MixCoeff[2];
- } Echo;
- // The current read offset for all delay lines.
- ALuint Offset;
-
- // The gain for each output channel (non-EAX path only; aliased from
- // Late.PanGain)
- ALfp *Gain;
-} ALverbState;
-
-/* This coefficient is used to define the maximum frequency range controlled
- * by the modulation depth. The current value of 0.1 will allow it to swing
- * from 0.9x to 1.1x. This value must be below 1. At 1 it will cause the
- * sampler to stall on the downswing, and above 1 it will cause it to sample
- * backwards.
- */
-static const ALfp MODULATION_DEPTH_COEFF = toALfpConst(0.1f);
-
-/* A filter is used to avoid the terrible distortion caused by changing
- * modulation time and/or depth. To be consistent across different sample
- * rates, the coefficient must be raised to a constant divided by the sample
- * rate: coeff^(constant / rate).
- */
-static const ALfp MODULATION_FILTER_COEFF = toALfpConst(0.048f);
-static const ALfp MODULATION_FILTER_CONST = toALfpConst(100000.0f);
-
-// When diffusion is above 0, an all-pass filter is used to take the edge off
-// the echo effect. It uses the following line length (in seconds).
-static const ALfp ECHO_ALLPASS_LENGTH = toALfpConst(0.0133f);
-
-// Input into the late reverb is decorrelated between four channels. Their
-// timings are dependent on a fraction and multiplier. See the
-// UpdateDecorrelator() routine for the calculations involved.
-static const ALfp DECO_FRACTION = toALfpConst(0.15f);
-static const ALfp DECO_MULTIPLIER = toALfpConst(2.0f);
-
-// All delay line lengths are specified in seconds.
-
-// The lengths of the early delay lines.
-static const ALfp EARLY_LINE_LENGTH[4] =
-{
- toALfpConst(0.0015f), toALfpConst(0.0045f), toALfpConst(0.0135f), toALfpConst(0.0405f)
-};
-
-// The lengths of the late all-pass delay lines.
-static const ALfp ALLPASS_LINE_LENGTH[4] =
-{
- toALfpConst(0.0151f), toALfpConst(0.0167f), toALfpConst(0.0183f), toALfpConst(0.0200f),
-};
-
-// The lengths of the late cyclical delay lines.
-static const ALfp LATE_LINE_LENGTH[4] =
-{
- toALfpConst(0.0211f), toALfpConst(0.0311f), toALfpConst(0.0461f), toALfpConst(0.0680f)
-};
-
-// The late cyclical delay lines have a variable length dependent on the
-// effect's density parameter (inverted for some reason) and this multiplier.
-static const ALfp LATE_LINE_MULTIPLIER = toALfpConst(4.0f);
-
-// Calculate the length of a delay line and store its mask and offset.
-static ALuint CalcLineLength(ALfp length, ALintptrEXT offset, ALuint frequency, DelayLine *Delay)
-{
- ALuint samples;
-
- // All line lengths are powers of 2, calculated from their lengths, with
- // an additional sample in case of rounding errors.
- samples = NextPowerOf2((ALuint)(ALfp2int(ALfpMult(length, int2ALfp(frequency)))) + 1);
- // All lines share a single sample buffer.
- Delay->Mask = samples - 1;
- Delay->Line = (ALfp*)offset;
- // Return the sample count for accumulation.
- return samples;
-}
-
-// Given the allocated sample buffer, this function updates each delay line
-// offset.
-static __inline ALvoid RealizeLineOffset(ALfp * sampleBuffer, DelayLine *Delay)
-{
- Delay->Line = &sampleBuffer[(ALintptrEXT)Delay->Line];
-}
-
-/* Calculates the delay line metrics and allocates the shared sample buffer
- * for all lines given a flag indicating whether or not to allocate the EAX-
- * related delays (eaxFlag) and the sample rate (frequency). If an
- * allocation failure occurs, it returns AL_FALSE.
- */
-static ALboolean AllocLines(ALboolean eaxFlag, ALuint frequency, ALverbState *State)
-{
- ALuint totalSamples, index;
- ALfp length;
- ALfp *newBuffer = NULL;
-
- // All delay line lengths are calculated to accomodate the full range of
- // lengths given their respective paramters.
- totalSamples = 0;
- if(eaxFlag)
- {
- /* The modulator's line length is calculated from the maximum
- * modulation time and depth coefficient, and halfed for the low-to-
- * high frequency swing. An additional sample is added to keep it
- * stable when there is no modulation.
- */
- length = ((ALfpDiv(ALfpMult(float2ALfp(AL_EAXREVERB_MAX_MODULATION_TIME), MODULATION_DEPTH_COEFF),
- int2ALfp(2))) +
- ALfpDiv(int2ALfp(1), int2ALfp(frequency)));
- totalSamples += CalcLineLength(length, totalSamples, frequency,
- &State->Mod.Delay);
- }
-
- // The initial delay is the sum of the reflections and late reverb
- // delays.
- if(eaxFlag)
- length = float2ALfp(AL_EAXREVERB_MAX_REFLECTIONS_DELAY +
- AL_EAXREVERB_MAX_LATE_REVERB_DELAY);
- else
- length = float2ALfp(AL_REVERB_MAX_REFLECTIONS_DELAY +
- AL_REVERB_MAX_LATE_REVERB_DELAY);
- totalSamples += CalcLineLength(length, totalSamples, frequency,
- &State->Delay);
-
- // The early reflection lines.
- for(index = 0;index < 4;index++)
- totalSamples += CalcLineLength(EARLY_LINE_LENGTH[index], totalSamples,
- frequency, &State->Early.Delay[index]);
-
- // The decorrelator line is calculated from the lowest reverb density (a
- // parameter value of 1).
- length = ALfpMult(ALfpMult(ALfpMult(ALfpMult(DECO_FRACTION,
- DECO_MULTIPLIER),
- DECO_MULTIPLIER),
- LATE_LINE_LENGTH[0]),
- (int2ALfp(1) + LATE_LINE_MULTIPLIER));
- totalSamples += CalcLineLength(length, totalSamples, frequency,
- &State->Decorrelator);
-
- // The late all-pass lines.
- for(index = 0;index < 4;index++)
- totalSamples += CalcLineLength(ALLPASS_LINE_LENGTH[index], totalSamples,
- frequency, &State->Late.ApDelay[index]);
-
- // The late delay lines are calculated from the lowest reverb density.
- for(index = 0;index < 4;index++)
- {
- length = ALfpMult(LATE_LINE_LENGTH[index], (int2ALfp(1) + LATE_LINE_MULTIPLIER));
- totalSamples += CalcLineLength(length, totalSamples, frequency,
- &State->Late.Delay[index]);
- }
-
- if(eaxFlag)
- {
- // The echo all-pass and delay lines.
- totalSamples += CalcLineLength(ECHO_ALLPASS_LENGTH, totalSamples,
- frequency, &State->Echo.ApDelay);
- totalSamples += CalcLineLength(float2ALfp(AL_EAXREVERB_MAX_ECHO_TIME), totalSamples,
- frequency, &State->Echo.Delay);
- }
-
- if(totalSamples != State->TotalSamples)
- {
- newBuffer = realloc(State->SampleBuffer, sizeof(ALfp) * totalSamples);
- if(newBuffer == NULL)
- return AL_FALSE;
- State->SampleBuffer = newBuffer;
- State->TotalSamples = totalSamples;
- }
-
- // Update all delays to reflect the new sample buffer.
- RealizeLineOffset(State->SampleBuffer, &State->Delay);
- RealizeLineOffset(State->SampleBuffer, &State->Decorrelator);
- for(index = 0;index < 4;index++)
- {
- RealizeLineOffset(State->SampleBuffer, &State->Early.Delay[index]);
- RealizeLineOffset(State->SampleBuffer, &State->Late.ApDelay[index]);
- RealizeLineOffset(State->SampleBuffer, &State->Late.Delay[index]);
- }
- if(eaxFlag)
- {
- RealizeLineOffset(State->SampleBuffer, &State->Mod.Delay);
- RealizeLineOffset(State->SampleBuffer, &State->Echo.ApDelay);
- RealizeLineOffset(State->SampleBuffer, &State->Echo.Delay);
- }
-
- // Clear the sample buffer.
- for(index = 0;index < State->TotalSamples;index++)
- State->SampleBuffer[index] = int2ALfp(0);
-
- return AL_TRUE;
-}
-
-// Calculate a decay coefficient given the length of each cycle and the time
-// until the decay reaches -60 dB.
-static __inline ALfp CalcDecayCoeff(ALfp length, ALfp decayTime)
-{
- return aluPow(int2ALfp(10), ALfpDiv(length,
- ALfpDiv(ALfpMult(decayTime,
- int2ALfp(-60)),
- int2ALfp(20))));
-}
-
-// Calculate a decay length from a coefficient and the time until the decay
-// reaches -60 dB.
-static __inline ALfp CalcDecayLength(ALfp coeff, ALfp decayTime)
-{
- return ALfpMult(ALfpMult(ALfpDiv(__log10(coeff), int2ALfp(-60)), int2ALfp(20)), decayTime);
-}
-
-// Calculate the high frequency parameter for the I3DL2 coefficient
-// calculation.
-static __inline ALfp CalcI3DL2HFreq(ALfp hfRef, ALuint frequency)
-{
- return __cos(ALfpDiv(ALfpMult(float2ALfp(2.0f * M_PI), hfRef), int2ALfp(frequency)));
-}
-
-// Calculate an attenuation to be applied to the input of any echo models to
-// compensate for modal density and decay time.
-static __inline ALfp CalcDensityGain(ALfp a)
-{
- /* The energy of a signal can be obtained by finding the area under the
- * squared signal. This takes the form of Sum(x_n^2), where x is the
- * amplitude for the sample n.
- *
- * Decaying feedback matches exponential decay of the form Sum(a^n),
- * where a is the attenuation coefficient, and n is the sample. The area
- * under this decay curve can be calculated as: 1 / (1 - a).
- *
- * Modifying the above equation to find the squared area under the curve
- * (for energy) yields: 1 / (1 - a^2). Input attenuation can then be
- * calculated by inverting the square root of this approximation,
- * yielding: 1 / sqrt(1 / (1 - a^2)), simplified to: sqrt(1 - a^2).
- */
- return aluSqrt((int2ALfp(1) - ALfpMult(a, a)));
-}
-
-// Calculate the mixing matrix coefficients given a diffusion factor.
-static __inline ALvoid CalcMatrixCoeffs(ALfp diffusion, ALfp *x, ALfp *y)
-{
- ALfp n, t;
-
- // The matrix is of order 4, so n is sqrt (4 - 1).
- n = aluSqrt(int2ALfp(3));
- t = ALfpMult(diffusion, __atan(n));
-
- // Calculate the first mixing matrix coefficient.
- *x = __cos(t);
- // Calculate the second mixing matrix coefficient.
- *y = ALfpDiv(__sin(t), n);
-}
-
-// Calculate the limited HF ratio for use with the late reverb low-pass
-// filters.
-static ALfp CalcLimitedHfRatio(ALfp hfRatio, ALfp airAbsorptionGainHF, ALfp decayTime)
-{
- ALfp limitRatio;
-
- /* Find the attenuation due to air absorption in dB (converting delay
- * time to meters using the speed of sound). Then reversing the decay
- * equation, solve for HF ratio. The delay length is cancelled out of
- * the equation, so it can be calculated once for all lines.
- */
- limitRatio = ALfpDiv(int2ALfp(1),
- ALfpMult(CalcDecayLength(airAbsorptionGainHF, decayTime),
- float2ALfp(SPEEDOFSOUNDMETRESPERSEC)));
- // Need to limit the result to a minimum of 0.1, just like the HF ratio
- // parameter.
- limitRatio = __max(limitRatio, float2ALfp(0.1f));
-
- // Using the limit calculated above, apply the upper bound to the HF
- // ratio.
- return __min(hfRatio, limitRatio);
-}
-
-// Calculate the coefficient for a HF (and eventually LF) decay damping
-// filter.
-static __inline ALfp CalcDampingCoeff(ALfp hfRatio, ALfp length, ALfp decayTime, ALfp decayCoeff, ALfp cw)
-{
- ALfp coeff, g;
-
- // Eventually this should boost the high frequencies when the ratio
- // exceeds 1.
- coeff = int2ALfp(0);
- if (hfRatio < int2ALfp(1))
- {
- // Calculate the low-pass coefficient by dividing the HF decay
- // coefficient by the full decay coefficient.
- g = ALfpDiv(CalcDecayCoeff(length, ALfpMult(decayTime, hfRatio)), decayCoeff);
-
- // Damping is done with a 1-pole filter, so g needs to be squared.
- g = ALfpMult(g, g);
- coeff = lpCoeffCalc(g, cw);
-
- // Very low decay times will produce minimal output, so apply an
- // upper bound to the coefficient.
- coeff = __min(coeff, float2ALfp(0.98f));
- }
- return coeff;
-}
-
-// Update the EAX modulation index, range, and depth. Keep in mind that this
-// kind of vibrato is additive and not multiplicative as one may expect. The
-// downswing will sound stronger than the upswing.
-static ALvoid UpdateModulator(ALfp modTime, ALfp modDepth, ALuint frequency, ALverbState *State)
-{
- ALfp length;
-
- /* Modulation is calculated in two parts.
- *
- * The modulation time effects the sinus applied to the change in
- * frequency. An index out of the current time range (both in samples)
- * is incremented each sample. The range is bound to a reasonable
- * minimum (1 sample) and when the timing changes, the index is rescaled
- * to the new range (to keep the sinus consistent).
- */
- length = ALfpMult(modTime, int2ALfp(frequency));
- if (length >= int2ALfp(1)) {
- State->Mod.Index = (ALuint)(ALfp2int(ALfpDiv(ALfpMult(int2ALfp(State->Mod.Index),
- length),
- int2ALfp(State->Mod.Range))));
- State->Mod.Range = (ALuint)ALfp2int(length);
- } else {
- State->Mod.Index = 0;
- State->Mod.Range = 1;
- }
-
- /* The modulation depth effects the amount of frequency change over the
- * range of the sinus. It needs to be scaled by the modulation time so
- * that a given depth produces a consistent change in frequency over all
- * ranges of time. Since the depth is applied to a sinus value, it needs
- * to be halfed once for the sinus range and again for the sinus swing
- * in time (half of it is spent decreasing the frequency, half is spent
- * increasing it).
- */
- State->Mod.Depth = ALfpMult(ALfpDiv(ALfpDiv(ALfpMult(ALfpMult(modDepth,
- MODULATION_DEPTH_COEFF),
- modTime),
- int2ALfp(2)),
- int2ALfp(2)),
- int2ALfp(frequency));
-}
-
-// Update the offsets for the initial effect delay line.
-static ALvoid UpdateDelayLine(ALfp earlyDelay, ALfp lateDelay, ALuint frequency, ALverbState *State)
-{
- // Calculate the initial delay taps.
- State->DelayTap[0] = (ALuint)(ALfp2int(ALfpMult(earlyDelay, int2ALfp(frequency))));
- State->DelayTap[1] = (ALuint)(ALfp2int(ALfpMult((earlyDelay + lateDelay), int2ALfp(frequency))));
-}
-
-// Update the early reflections gain and line coefficients.
-static ALvoid UpdateEarlyLines(ALfp reverbGain, ALfp earlyGain, ALfp lateDelay, ALverbState *State)
-{
- ALuint index;
-
- // Calculate the early reflections gain (from the master effect gain, and
- // reflections gain parameters) with a constant attenuation of 0.5.
- State->Early.Gain = ALfpMult(ALfpMult(float2ALfp(0.5f), reverbGain), earlyGain);
-
- // Calculate the gain (coefficient) for each early delay line using the
- // late delay time. This expands the early reflections to the start of
- // the late reverb.
- for(index = 0;index < 4;index++)
- State->Early.Coeff[index] = CalcDecayCoeff(EARLY_LINE_LENGTH[index],
- lateDelay);
-}
-
-// Update the offsets for the decorrelator line.
-static ALvoid UpdateDecorrelator(ALfp density, ALuint frequency, ALverbState *State)
-{
- ALuint index;
- ALfp length;
-
- /* The late reverb inputs are decorrelated to smooth the reverb tail and
- * reduce harsh echos. The first tap occurs immediately, while the
- * remaining taps are delayed by multiples of a fraction of the smallest
- * cyclical delay time.
- *
- * offset[index] = (FRACTION (MULTIPLIER^index)) smallest_delay
- */
- for(index = 0;index < 3;index++)
- {
- length = ALfpMult(ALfpMult(ALfpMult(DECO_FRACTION,
- aluPow(DECO_MULTIPLIER, int2ALfp(index))),
- LATE_LINE_LENGTH[0]),
- (int2ALfp(1) + ALfpMult(density, LATE_LINE_MULTIPLIER)));
- State->DecoTap[index] = (ALuint)ALfp2int(ALfpMult(length, int2ALfp(frequency)));
- }
-}
-
-// Update the late reverb gains, line lengths, and line coefficients.
-static ALvoid UpdateLateLines(ALfp reverbGain, ALfp lateGain, ALfp xMix, ALfp density, ALfp decayTime, ALfp diffusion, ALfp hfRatio, ALfp cw, ALuint frequency, ALverbState *State)
-{
- ALfp length;
- ALuint index;
-
- /* Calculate the late reverb gain (from the master effect gain, and late
- * reverb gain parameters). Since the output is tapped prior to the
- * application of the next delay line coefficients, this gain needs to be
- * attenuated by the 'x' mixing matrix coefficient as well.
- */
- State->Late.Gain = ALfpMult(ALfpMult(reverbGain, lateGain), xMix);
-
- /* To compensate for changes in modal density and decay time of the late
- * reverb signal, the input is attenuated based on the maximal energy of
- * the outgoing signal. This approximation is used to keep the apparent
- * energy of the signal equal for all ranges of density and decay time.
- *
- * The average length of the cyclcical delay lines is used to calculate
- * the attenuation coefficient.
- */
- length = ALfpDiv((LATE_LINE_LENGTH[0] + LATE_LINE_LENGTH[1] +
- LATE_LINE_LENGTH[2] + LATE_LINE_LENGTH[3]),
- int2ALfp(4));
- length = ALfpMult(length, (int2ALfp(1) + ALfpMult(density, LATE_LINE_MULTIPLIER)));
- State->Late.DensityGain = CalcDensityGain(CalcDecayCoeff(length,
- decayTime));
-
- // Calculate the all-pass feed-back and feed-forward coefficient.
- State->Late.ApFeedCoeff = ALfpMult(float2ALfp(0.5f), aluPow(diffusion, int2ALfp(2)));
-
- for(index = 0;index < 4;index++)
- {
- // Calculate the gain (coefficient) for each all-pass line.
- State->Late.ApCoeff[index] = CalcDecayCoeff(ALLPASS_LINE_LENGTH[index],
- decayTime);
-
- // Calculate the length (in seconds) of each cyclical delay line.
- length = ALfpMult(LATE_LINE_LENGTH[index],
- (int2ALfp(1) + ALfpMult(density, LATE_LINE_MULTIPLIER)));
-
- // Calculate the delay offset for each cyclical delay line.
- State->Late.Offset[index] = (ALuint)(ALfp2int(ALfpMult(length, int2ALfp(frequency))));
-
- // Calculate the gain (coefficient) for each cyclical line.
- State->Late.Coeff[index] = CalcDecayCoeff(length, decayTime);
-
- // Calculate the damping coefficient for each low-pass filter.
- State->Late.LpCoeff[index] =
- CalcDampingCoeff(hfRatio, length, decayTime,
- State->Late.Coeff[index], cw);
-
- // Attenuate the cyclical line coefficients by the mixing coefficient
- // (x).
- State->Late.Coeff[index] = ALfpMult(State->Late.Coeff[index], xMix);
- }
-}
-
-// Update the echo gain, line offset, line coefficients, and mixing
-// coefficients.
-static ALvoid UpdateEchoLine(ALfp reverbGain, ALfp lateGain, ALfp echoTime, ALfp decayTime, ALfp diffusion, ALfp echoDepth, ALfp hfRatio, ALfp cw, ALuint frequency, ALverbState *State)
-{
- // Update the offset and coefficient for the echo delay line.
- State->Echo.Offset = (ALuint)(ALfp2int(ALfpMult(echoTime, int2ALfp(frequency))));
-
- // Calculate the decay coefficient for the echo line.
- State->Echo.Coeff = CalcDecayCoeff(echoTime, decayTime);
-
- // Calculate the energy-based attenuation coefficient for the echo delay
- // line.
- State->Echo.DensityGain = CalcDensityGain(State->Echo.Coeff);
-
- // Calculate the echo all-pass feed coefficient.
- State->Echo.ApFeedCoeff = ALfpMult(float2ALfp(0.5f), aluPow(diffusion, int2ALfp(2)));
-
- // Calculate the echo all-pass attenuation coefficient.
- State->Echo.ApCoeff = CalcDecayCoeff(ECHO_ALLPASS_LENGTH, decayTime);
-
- // Calculate the damping coefficient for each low-pass filter.
- State->Echo.LpCoeff = CalcDampingCoeff(hfRatio, echoTime, decayTime,
- State->Echo.Coeff, cw);
-
- /* Calculate the echo mixing coefficients. The first is applied to the
- * echo itself. The second is used to attenuate the late reverb when
- * echo depth is high and diffusion is low, so the echo is slightly
- * stronger than the decorrelated echos in the reverb tail.
- */
- State->Echo.MixCoeff[0] = ALfpMult(ALfpMult(reverbGain, lateGain), echoDepth);
- State->Echo.MixCoeff[1] = (int2ALfp(1) - ALfpMult(ALfpMult(echoDepth, float2ALfp(0.5f)), (int2ALfp(1) - diffusion)));
-}
-
-// Update the early and late 3D panning gains.
-static ALvoid Update3DPanning(const ALCdevice *Device, const ALfp *ReflectionsPan, const ALfp *LateReverbPan, ALverbState *State)
-{
- ALfp earlyPan[3] = { ReflectionsPan[0], ReflectionsPan[1],
- ReflectionsPan[2] };
- ALfp latePan[3] = { LateReverbPan[0], LateReverbPan[1],
- LateReverbPan[2] };
- const ALfp *speakerGain;
- ALfp dirGain;
- ALfp length;
- ALuint index;
- ALint pos;
-
- // Calculate the 3D-panning gains for the early reflections and late
- // reverb.
- length = (ALfpMult(earlyPan[0],earlyPan[0]) + ALfpMult(earlyPan[1],earlyPan[1]) + ALfpMult(earlyPan[2],earlyPan[2]));
- if(length > int2ALfp(1))
- {
- length = ALfpDiv(int2ALfp(1), aluSqrt(length));
- earlyPan[0] = ALfpMult(earlyPan[0], length);
- earlyPan[1] = ALfpMult(earlyPan[1], length);
- earlyPan[2] = ALfpMult(earlyPan[2], length);
- }
- length = (ALfpMult(latePan[0],latePan[0]) + ALfpMult(latePan[1],latePan[1]) + ALfpMult(latePan[2],latePan[2]));
- if(length > int2ALfp(1))
- {
- length = ALfpDiv(int2ALfp(1), aluSqrt(length));
- latePan[0] = ALfpMult(latePan[0], length);
- latePan[1] = ALfpMult(latePan[1], length);
- latePan[2] = ALfpMult(latePan[2], length);
- }
-
- /* This code applies directional reverb just like the mixer applies
- * directional sources. It diffuses the sound toward all speakers as the
- * magnitude of the panning vector drops, which is only a rough
- * approximation of the expansion of sound across the speakers from the
- * panning direction.
- */
- pos = aluCart2LUTpos(earlyPan[2], earlyPan[0]);
- speakerGain = &Device->PanningLUT[MAXCHANNELS * pos];
- dirGain = aluSqrt((ALfpMult(earlyPan[0], earlyPan[0]) + ALfpMult(earlyPan[2], earlyPan[2])));
-
- for(index = 0;index < MAXCHANNELS;index++)
- State->Early.PanGain[index] = int2ALfp(0);
- for(index = 0;index < Device->NumChan;index++)
- {
- Channel chan = Device->Speaker2Chan[index];
- State->Early.PanGain[chan] = (int2ALfp(1) + ALfpMult((speakerGain[chan]-int2ALfp(1)),dirGain));
- }
-
-
- pos = aluCart2LUTpos(latePan[2], latePan[0]);
- speakerGain = &Device->PanningLUT[MAXCHANNELS * pos];
- dirGain = aluSqrt((ALfpMult(latePan[0], latePan[0]) + ALfpMult(latePan[2], latePan[2])));
-
- for(index = 0;index < MAXCHANNELS;index++)
- State->Late.PanGain[index] = int2ALfp(0);
- for(index = 0;index < Device->NumChan;index++)
- {
- Channel chan = Device->Speaker2Chan[index];
- State->Late.PanGain[chan] = (int2ALfp(1) + ALfpMult((speakerGain[chan]-int2ALfp(1)),dirGain));
- }
-}
-
-// Basic delay line input/output routines.
-static __inline ALfp DelayLineOut(DelayLine *Delay, ALuint offset)
-{
- return Delay->Line[offset&Delay->Mask];
-}
-
-static __inline ALvoid DelayLineIn(DelayLine *Delay, ALuint offset, ALfp in)
-{
- Delay->Line[offset&Delay->Mask] = in;
-}
-
-// Attenuated delay line output routine.
-static __inline ALfp AttenuatedDelayLineOut(DelayLine *Delay, ALuint offset, ALfp coeff)
-{
- return ALfpMult(coeff, Delay->Line[offset&Delay->Mask]);
-}
-
-// Basic attenuated all-pass input/output routine.
-static __inline ALfp AllpassInOut(DelayLine *Delay, ALuint outOffset, ALuint inOffset, ALfp in, ALfp feedCoeff, ALfp coeff)
-{
- ALfp out, feed;
-
- out = DelayLineOut(Delay, outOffset);
- feed = ALfpMult(feedCoeff, in);
- DelayLineIn(Delay, inOffset, (ALfpMult(feedCoeff, (out - feed)) + in));
-
- // The time-based attenuation is only applied to the delay output to
- // keep it from affecting the feed-back path (which is already controlled
- // by the all-pass feed coefficient).
- return (ALfpMult(coeff, out) - feed);
-}
-
-// Given an input sample, this function produces modulation for the late
-// reverb.
-static __inline ALfp EAXModulation(ALverbState *State, ALfp in)
-{
- ALfp sinus, frac;
- ALuint offset;
- ALfp out0, out1;
-
- // Calculate the sinus rythm (dependent on modulation time and the
- // sampling rate). The center of the sinus is moved to reduce the delay
- // of the effect when the time or depth are low.
- sinus = (int2ALfp(1) - __cos(ALfpDiv(ALfpMult(float2ALfp(2.0f * M_PI), int2ALfp(State->Mod.Index)), int2ALfp(State->Mod.Range))));
-
- // The depth determines the range over which to read the input samples
- // from, so it must be filtered to reduce the distortion caused by even
- // small parameter changes.
- State->Mod.Filter = lerp(State->Mod.Filter, State->Mod.Depth,
- State->Mod.Coeff);
-
- // Calculate the read offset and fraction between it and the next sample.
- frac = (int2ALfp(1) + ALfpMult(State->Mod.Filter, sinus));
- offset = (ALuint)ALfp2int(frac);
- frac = (frac - int2ALfp(offset));
-
- // Get the two samples crossed by the offset, and feed the delay line
- // with the next input sample.
- out0 = DelayLineOut(&State->Mod.Delay, State->Offset - offset);
- out1 = DelayLineOut(&State->Mod.Delay, State->Offset - offset - 1);
- DelayLineIn(&State->Mod.Delay, State->Offset, in);
-
- // Step the modulation index forward, keeping it bound to its range.
- State->Mod.Index = (State->Mod.Index + 1) % State->Mod.Range;
-
- // The output is obtained by linearly interpolating the two samples that
- // were acquired above.
- return lerp(out0, out1, frac);
-}
-
-// Delay line output routine for early reflections.
-static __inline ALfp EarlyDelayLineOut(ALverbState *State, ALuint index)
-{
- return AttenuatedDelayLineOut(&State->Early.Delay[index],
- State->Offset - State->Early.Offset[index],
- State->Early.Coeff[index]);
-}
-
-// Given an input sample, this function produces four-channel output for the
-// early reflections.
-static __inline ALvoid EarlyReflection(ALverbState *State, ALfp in, ALfp *out)
-{
- ALfp d[4], v, f[4];
-
- // Obtain the decayed results of each early delay line.
- d[0] = EarlyDelayLineOut(State, 0);
- d[1] = EarlyDelayLineOut(State, 1);
- d[2] = EarlyDelayLineOut(State, 2);
- d[3] = EarlyDelayLineOut(State, 3);
-
- /* The following uses a lossless scattering junction from waveguide
- * theory. It actually amounts to a householder mixing matrix, which
- * will produce a maximally diffuse response, and means this can probably
- * be considered a simple feed-back delay network (FDN).
- * N
- * ---
- * \
- * v = 2/N / d_i
- * ---
- * i=1
- */
- v = ALfpMult((d[0] + d[1] + d[2] + d[3]), float2ALfp(0.5f));
- // The junction is loaded with the input here.
- v = (v + in);
-
- // Calculate the feed values for the delay lines.
- f[0] = (v - d[0]);
- f[1] = (v - d[1]);
- f[2] = (v - d[2]);
- f[3] = (v - d[3]);
-
- // Re-feed the delay lines.
- DelayLineIn(&State->Early.Delay[0], State->Offset, f[0]);
- DelayLineIn(&State->Early.Delay[1], State->Offset, f[1]);
- DelayLineIn(&State->Early.Delay[2], State->Offset, f[2]);
- DelayLineIn(&State->Early.Delay[3], State->Offset, f[3]);
-
- // Output the results of the junction for all four channels.
- out[0] = ALfpMult(State->Early.Gain, f[0]);
- out[1] = ALfpMult(State->Early.Gain, f[1]);
- out[2] = ALfpMult(State->Early.Gain, f[2]);
- out[3] = ALfpMult(State->Early.Gain, f[3]);
-}
-
-// All-pass input/output routine for late reverb.
-static __inline ALfp LateAllPassInOut(ALverbState *State, ALuint index, ALfp in)
-{
- return AllpassInOut(&State->Late.ApDelay[index],
- State->Offset - State->Late.ApOffset[index],
- State->Offset, in, State->Late.ApFeedCoeff,
- State->Late.ApCoeff[index]);
-}
-
-// Delay line output routine for late reverb.
-static __inline ALfp LateDelayLineOut(ALverbState *State, ALuint index)
-{
- return AttenuatedDelayLineOut(&State->Late.Delay[index],
- State->Offset - State->Late.Offset[index],
- State->Late.Coeff[index]);
-}
-
-// Low-pass filter input/output routine for late reverb.
-static __inline ALfp LateLowPassInOut(ALverbState *State, ALuint index, ALfp in)
-{
- in = lerp(in, State->Late.LpSample[index], State->Late.LpCoeff[index]);
- State->Late.LpSample[index] = in;
- return in;
-}
-
-// Given four decorrelated input samples, this function produces four-channel
-// output for the late reverb.
-static __inline ALvoid LateReverb(ALverbState *State, ALfp *in, ALfp *out)
-{
- ALfp d[4], f[4];
-
- // Obtain the decayed results of the cyclical delay lines, and add the
- // corresponding input channels. Then pass the results through the
- // low-pass filters.
-
- // This is where the feed-back cycles from line 0 to 1 to 3 to 2 and back
- // to 0.
- d[0] = LateLowPassInOut(State, 2, (in[2] + LateDelayLineOut(State, 2)));
- d[1] = LateLowPassInOut(State, 0, (in[0] + LateDelayLineOut(State, 0)));
- d[2] = LateLowPassInOut(State, 3, (in[3] + LateDelayLineOut(State, 3)));
- d[3] = LateLowPassInOut(State, 1, (in[1] + LateDelayLineOut(State, 1)));
-
- // To help increase diffusion, run each line through an all-pass filter.
- // When there is no diffusion, the shortest all-pass filter will feed the
- // shortest delay line.
- d[0] = LateAllPassInOut(State, 0, d[0]);
- d[1] = LateAllPassInOut(State, 1, d[1]);
- d[2] = LateAllPassInOut(State, 2, d[2]);
- d[3] = LateAllPassInOut(State, 3, d[3]);
-
- /* Late reverb is done with a modified feed-back delay network (FDN)
- * topology. Four input lines are each fed through their own all-pass
- * filter and then into the mixing matrix. The four outputs of the
- * mixing matrix are then cycled back to the inputs. Each output feeds
- * a different input to form a circlular feed cycle.
- *
- * The mixing matrix used is a 4D skew-symmetric rotation matrix derived
- * using a single unitary rotational parameter:
- *
- * [ d, a, b, c ] 1 = a^2 + b^2 + c^2 + d^2
- * [ -a, d, c, -b ]
- * [ -b, -c, d, a ]
- * [ -c, b, -a, d ]
- *
- * The rotation is constructed from the effect's diffusion parameter,
- * yielding: 1 = x^2 + 3 y^2; where a, b, and c are the coefficient y
- * with differing signs, and d is the coefficient x. The matrix is thus:
- *
- * [ x, y, -y, y ] n = sqrt(matrix_order - 1)
- * [ -y, x, y, y ] t = diffusion_parameter * atan(n)
- * [ y, -y, x, y ] x = cos(t)
- * [ -y, -y, -y, x ] y = sin(t) / n
- *
- * To reduce the number of multiplies, the x coefficient is applied with
- * the cyclical delay line coefficients. Thus only the y coefficient is
- * applied when mixing, and is modified to be: y / x.
- */
- f[0] = (d[0] + ALfpMult(State->Late.MixCoeff, ( d[1] + -1*d[2] + d[3])));
- f[1] = (d[1] + ALfpMult(State->Late.MixCoeff, (-1*d[0] + d[2] + d[3])));
- f[2] = (d[2] + ALfpMult(State->Late.MixCoeff, ( d[0] + -1*d[1] + d[3])));
- f[3] = (d[3] + ALfpMult(State->Late.MixCoeff, (-1*d[0] + -1*d[1] + -1*d[2] )));
-
- // Output the results of the matrix for all four channels, attenuated by
- // the late reverb gain (which is attenuated by the 'x' mix coefficient).
- out[0] = ALfpMult(State->Late.Gain, f[0]);
- out[1] = ALfpMult(State->Late.Gain, f[1]);
- out[2] = ALfpMult(State->Late.Gain, f[2]);
- out[3] = ALfpMult(State->Late.Gain, f[3]);
-
- // Re-feed the cyclical delay lines.
- DelayLineIn(&State->Late.Delay[0], State->Offset, f[0]);
- DelayLineIn(&State->Late.Delay[1], State->Offset, f[1]);
- DelayLineIn(&State->Late.Delay[2], State->Offset, f[2]);
- DelayLineIn(&State->Late.Delay[3], State->Offset, f[3]);
-}
-
-// Given an input sample, this function mixes echo into the four-channel late
-// reverb.
-static __inline ALvoid EAXEcho(ALverbState *State, ALfp in, ALfp *late)
-{
- ALfp out, feed;
-
- // Get the latest attenuated echo sample for output.
- feed = AttenuatedDelayLineOut(&State->Echo.Delay,
- State->Offset - State->Echo.Offset,
- State->Echo.Coeff);
-
- // Mix the output into the late reverb channels.
- out = ALfpMult(State->Echo.MixCoeff[0], feed);
- late[0] = (ALfpMult(State->Echo.MixCoeff[1], late[0]) + out);
- late[1] = (ALfpMult(State->Echo.MixCoeff[1], late[1]) + out);
- late[2] = (ALfpMult(State->Echo.MixCoeff[1], late[2]) + out);
- late[3] = (ALfpMult(State->Echo.MixCoeff[1], late[3]) + out);
-
- // Mix the energy-attenuated input with the output and pass it through
- // the echo low-pass filter.
- feed = (feed + ALfpMult(State->Echo.DensityGain, in));
- feed = lerp(feed, State->Echo.LpSample, State->Echo.LpCoeff);
- State->Echo.LpSample = feed;
-
- // Then the echo all-pass filter.
- feed = AllpassInOut(&State->Echo.ApDelay,
- State->Offset - State->Echo.ApOffset,
- State->Offset, feed, State->Echo.ApFeedCoeff,
- State->Echo.ApCoeff);
-
- // Feed the delay with the mixed and filtered sample.
- DelayLineIn(&State->Echo.Delay, State->Offset, feed);
-}
-
-// Perform the non-EAX reverb pass on a given input sample, resulting in
-// four-channel output.
-static __inline ALvoid VerbPass(ALverbState *State, ALfp in, ALfp *early, ALfp *late)
-{
- ALfp feed, taps[4];
-
- // Low-pass filter the incoming sample.
- in = lpFilter2P(&State->LpFilter, 0, in);
-
- // Feed the initial delay line.
- DelayLineIn(&State->Delay, State->Offset, in);
-
- // Calculate the early reflection from the first delay tap.
- in = DelayLineOut(&State->Delay, State->Offset - State->DelayTap[0]);
- EarlyReflection(State, in, early);
-
- // Feed the decorrelator from the energy-attenuated output of the second
- // delay tap.
- in = DelayLineOut(&State->Delay, State->Offset - State->DelayTap[1]);
- feed = ALfpMult(in, State->Late.DensityGain);
- DelayLineIn(&State->Decorrelator, State->Offset, feed);
-
- // Calculate the late reverb from the decorrelator taps.
- taps[0] = feed;
- taps[1] = DelayLineOut(&State->Decorrelator, State->Offset - State->DecoTap[0]);
- taps[2] = DelayLineOut(&State->Decorrelator, State->Offset - State->DecoTap[1]);
- taps[3] = DelayLineOut(&State->Decorrelator, State->Offset - State->DecoTap[2]);
- LateReverb(State, taps, late);
-
- // Step all delays forward one sample.
- State->Offset++;
-}
-
-// Perform the EAX reverb pass on a given input sample, resulting in four-
-// channel output.
-static __inline ALvoid EAXVerbPass(ALverbState *State, ALfp in, ALfp *early, ALfp *late)
-{
- ALfp feed, taps[4];
-
- // Low-pass filter the incoming sample.
- in = lpFilter2P(&State->LpFilter, 0, in);
-
- // Perform any modulation on the input.
- in = EAXModulation(State, in);
-
- // Feed the initial delay line.
- DelayLineIn(&State->Delay, State->Offset, in);
-
- // Calculate the early reflection from the first delay tap.
- in = DelayLineOut(&State->Delay, State->Offset - State->DelayTap[0]);
- EarlyReflection(State, in, early);
-
- // Feed the decorrelator from the energy-attenuated output of the second
- // delay tap.
- in = DelayLineOut(&State->Delay, State->Offset - State->DelayTap[1]);
- feed = ALfpMult(in, State->Late.DensityGain);
- DelayLineIn(&State->Decorrelator, State->Offset, feed);
-
- // Calculate the late reverb from the decorrelator taps.
- taps[0] = feed;
- taps[1] = DelayLineOut(&State->Decorrelator, State->Offset - State->DecoTap[0]);
- taps[2] = DelayLineOut(&State->Decorrelator, State->Offset - State->DecoTap[1]);
- taps[3] = DelayLineOut(&State->Decorrelator, State->Offset - State->DecoTap[2]);
- LateReverb(State, taps, late);
-
- // Calculate and mix in any echo.
- EAXEcho(State, in, late);
-
- // Step all delays forward one sample.
- State->Offset++;
-}
-
-// This destroys the reverb state. It should be called only when the effect
-// slot has a different (or no) effect loaded over the reverb effect.
-static ALvoid VerbDestroy(ALeffectState *effect)
-{
- ALverbState *State = (ALverbState*)effect;
- if(State)
- {
- free(State->SampleBuffer);
- State->SampleBuffer = NULL;
- free(State);
- }
-}
-
-// This updates the device-dependant reverb state. This is called on
-// initialization and any time the device parameters (eg. playback frequency,
-// or format) have been changed.
-static ALboolean VerbDeviceUpdate(ALeffectState *effect, ALCdevice *Device)
-{
- ALverbState *State = (ALverbState*)effect;
- ALuint frequency = Device->Frequency;
- ALuint index;
-
- // Allocate the delay lines.
- if(!AllocLines(AL_FALSE, frequency, State))
- return AL_FALSE;
-
- // The early reflection and late all-pass filter line lengths are static,
- // so their offsets only need to be calculated once.
- for(index = 0;index < 4;index++)
- {
- State->Early.Offset[index] = ALfp2int(ALfpMult(EARLY_LINE_LENGTH[index],
- int2ALfp(frequency)));
- State->Late.ApOffset[index] = ALfp2int(ALfpMult(ALLPASS_LINE_LENGTH[index],
- int2ALfp(frequency)));
- }
-
- for(index = 0;index < MAXCHANNELS;index++)
- State->Gain[index] = int2ALfp(0);
- for(index = 0;index < Device->NumChan;index++)
- {
- Channel chan = Device->Speaker2Chan[index];
- State->Gain[chan] = int2ALfp(1);
- }
-
- return AL_TRUE;
-}
-
-// This updates the device-dependant EAX reverb state. This is called on
-// initialization and any time the device parameters (eg. playback frequency,
-// format) have been changed.
-static ALboolean EAXVerbDeviceUpdate(ALeffectState *effect, ALCdevice *Device)
-{
- ALverbState *State = (ALverbState*)effect;
- ALuint frequency = Device->Frequency, index;
-
- // Allocate the delay lines.
- if(!AllocLines(AL_TRUE, frequency, State))
- return AL_FALSE;
-
- // Calculate the modulation filter coefficient. Notice that the exponent
- // is calculated given the current sample rate. This ensures that the
- // resulting filter response over time is consistent across all sample
- // rates.
- State->Mod.Coeff = aluPow(MODULATION_FILTER_COEFF,
- ALfpDiv(MODULATION_FILTER_CONST, int2ALfp(frequency)));
-
- // The early reflection and late all-pass filter line lengths are static,
- // so their offsets only need to be calculated once.
- for(index = 0;index < 4;index++)
- {
- State->Early.Offset[index] = ALfp2int(ALfpMult(EARLY_LINE_LENGTH[index],
- int2ALfp(frequency)));
- State->Late.ApOffset[index] = ALfp2int(ALfpMult(ALLPASS_LINE_LENGTH[index],
- int2ALfp(frequency)));
- }
-
- // The echo all-pass filter line length is static, so its offset only
- // needs to be calculated once.
- State->Echo.ApOffset = ALfp2int(ALfpMult(ECHO_ALLPASS_LENGTH, int2ALfp(frequency)));
-
- return AL_TRUE;
-}
-
-// This updates the reverb state. This is called any time the reverb effect
-// is loaded into a slot.
-static ALvoid VerbUpdate(ALeffectState *effect, ALCcontext *Context, const ALeffect *Effect)
-{
- ALverbState *State = (ALverbState*)effect;
- ALuint frequency = Context->Device->Frequency;
- ALfp cw, x, y, hfRatio;
-
- // Calculate the master low-pass filter (from the master effect HF gain).
- cw = CalcI3DL2HFreq(Effect->Reverb.HFReference, frequency);
- // This is done with 2 chained 1-pole filters, so no need to square g.
- State->LpFilter.coeff = lpCoeffCalc(Effect->Reverb.GainHF, cw);
-
- // Update the initial effect delay.
- UpdateDelayLine(Effect->Reverb.ReflectionsDelay,
- Effect->Reverb.LateReverbDelay, frequency, State);
-
- // Update the early lines.
- UpdateEarlyLines(Effect->Reverb.Gain, Effect->Reverb.ReflectionsGain,
- Effect->Reverb.LateReverbDelay, State);
-
- // Update the decorrelator.
- UpdateDecorrelator(Effect->Reverb.Density, frequency, State);
-
- // Get the mixing matrix coefficients (x and y).
- CalcMatrixCoeffs(Effect->Reverb.Diffusion, &x, &y);
- // Then divide x into y to simplify the matrix calculation.
- State->Late.MixCoeff = ALfpDiv(y, x);
-
- // If the HF limit parameter is flagged, calculate an appropriate limit
- // based on the air absorption parameter.
- hfRatio = Effect->Reverb.DecayHFRatio;
- if(Effect->Reverb.DecayHFLimit && Effect->Reverb.AirAbsorptionGainHF < int2ALfp(1))
- hfRatio = CalcLimitedHfRatio(hfRatio, Effect->Reverb.AirAbsorptionGainHF,
- Effect->Reverb.DecayTime);
-
- // Update the late lines.
- UpdateLateLines(Effect->Reverb.Gain, Effect->Reverb.LateReverbGain,
- x, Effect->Reverb.Density, Effect->Reverb.DecayTime,
- Effect->Reverb.Diffusion, hfRatio, cw, frequency, State);
-}
-
-// This updates the EAX reverb state. This is called any time the EAX reverb
-// effect is loaded into a slot.
-static ALvoid EAXVerbUpdate(ALeffectState *effect, ALCcontext *Context, const ALeffect *Effect)
-{
- ALverbState *State = (ALverbState*)effect;
- ALuint frequency = Context->Device->Frequency;
- ALfp cw, x, y, hfRatio;
-
- // Calculate the master low-pass filter (from the master effect HF gain).
- cw = CalcI3DL2HFreq(Effect->Reverb.HFReference, frequency);
- // This is done with 2 chained 1-pole filters, so no need to square g.
- State->LpFilter.coeff = lpCoeffCalc(Effect->Reverb.GainHF, cw);
-
- // Update the modulator line.
- UpdateModulator(Effect->Reverb.ModulationTime,
- Effect->Reverb.ModulationDepth, frequency, State);
-
- // Update the initial effect delay.
- UpdateDelayLine(Effect->Reverb.ReflectionsDelay,
- Effect->Reverb.LateReverbDelay, frequency, State);
-
- // Update the early lines.
- UpdateEarlyLines(Effect->Reverb.Gain, Effect->Reverb.ReflectionsGain,
- Effect->Reverb.LateReverbDelay, State);
-
- // Update the decorrelator.
- UpdateDecorrelator(Effect->Reverb.Density, frequency, State);
-
- // Get the mixing matrix coefficients (x and y).
- CalcMatrixCoeffs(Effect->Reverb.Diffusion, &x, &y);
- // Then divide x into y to simplify the matrix calculation.
- State->Late.MixCoeff = ALfpDiv(y, x);
-
- // If the HF limit parameter is flagged, calculate an appropriate limit
- // based on the air absorption parameter.
- hfRatio = Effect->Reverb.DecayHFRatio;
- if(Effect->Reverb.DecayHFLimit && Effect->Reverb.AirAbsorptionGainHF < int2ALfp(1))
- hfRatio = CalcLimitedHfRatio(hfRatio, Effect->Reverb.AirAbsorptionGainHF,
- Effect->Reverb.DecayTime);
-
- // Update the late lines.
- UpdateLateLines(Effect->Reverb.Gain, Effect->Reverb.LateReverbGain,
- x, Effect->Reverb.Density, Effect->Reverb.DecayTime,
- Effect->Reverb.Diffusion, hfRatio, cw, frequency, State);
-
- // Update the echo line.
- UpdateEchoLine(Effect->Reverb.Gain, Effect->Reverb.LateReverbGain,
- Effect->Reverb.EchoTime, Effect->Reverb.DecayTime,
- Effect->Reverb.Diffusion, Effect->Reverb.EchoDepth,
- hfRatio, cw, frequency, State);
-
- // Update early and late 3D panning.
- Update3DPanning(Context->Device, Effect->Reverb.ReflectionsPan,
- Effect->Reverb.LateReverbPan, State);
-}
-
-// This processes the reverb state, given the input samples and an output
-// buffer.
-static ALvoid VerbProcess(ALeffectState *effect, const ALeffectslot *Slot, ALuint SamplesToDo, const ALfp *SamplesIn, ALfp (*SamplesOut)[MAXCHANNELS])
-{
- ALverbState *State = (ALverbState*)effect;
- ALuint index;
- ALfp early[4], late[4], out[4];
- ALfp gain = Slot->Gain;
- const ALfp *panGain = State->Gain;
-
- for(index = 0;index < SamplesToDo;index++)
- {
- // Process reverb for this sample.
- VerbPass(State, SamplesIn[index], early, late);
-
- // Mix early reflections and late reverb.
- out[0] = ALfpMult((early[0] + late[0]), gain);
- out[1] = ALfpMult((early[1] + late[1]), gain);
-#ifdef APPORTABLE_OPTIMIZED_OUT
- out[2] = ALfpMult((early[2] + late[2]), gain);
- out[3] = ALfpMult((early[3] + late[3]), gain);
-#endif
-
- // Output the results.
- SamplesOut[index][FRONT_LEFT] = (SamplesOut[index][FRONT_LEFT] + ALfpMult(panGain[FRONT_LEFT] , out[0]));
- SamplesOut[index][FRONT_RIGHT] = (SamplesOut[index][FRONT_RIGHT] + ALfpMult(panGain[FRONT_RIGHT] , out[1]));
-#ifdef APPORTABLE_OPTIMIZED_OUT
- SamplesOut[index][FRONT_CENTER] = (SamplesOut[index][FRONT_CENTER] + ALfpMult(panGain[FRONT_CENTER] , out[3]));
- SamplesOut[index][SIDE_LEFT] = (SamplesOut[index][SIDE_LEFT] + ALfpMult(panGain[SIDE_LEFT] , out[0]));
- SamplesOut[index][SIDE_RIGHT] = (SamplesOut[index][SIDE_RIGHT] + ALfpMult(panGain[SIDE_RIGHT] , out[1]));
- SamplesOut[index][BACK_LEFT] = (SamplesOut[index][BACK_LEFT] + ALfpMult(panGain[BACK_LEFT] , out[0]));
- SamplesOut[index][BACK_RIGHT] = (SamplesOut[index][BACK_RIGHT] + ALfpMult(panGain[BACK_RIGHT] , out[1]));
- SamplesOut[index][BACK_CENTER] = (SamplesOut[index][BACK_CENTER] + ALfpMult(panGain[BACK_CENTER] , out[2]));
-#endif
- }
-}
-
-// This processes the EAX reverb state, given the input samples and an output
-// buffer.
-static ALvoid EAXVerbProcess(ALeffectState *effect, const ALeffectslot *Slot, ALuint SamplesToDo, const ALfp *SamplesIn, ALfp (*SamplesOut)[MAXCHANNELS])
-{
- ALverbState *State = (ALverbState*)effect;
- ALuint index;
- ALfp early[4], late[4];
- ALfp gain = Slot->Gain;
-
- for(index = 0;index < SamplesToDo;index++)
- {
- // Process reverb for this sample.
- EAXVerbPass(State, SamplesIn[index], early, late);
-
- // Unfortunately, while the number and configuration of gains for
- // panning adjust according to MAXCHANNELS, the output from the
- // reverb engine is not so scalable.
- SamplesOut[index][FRONT_LEFT] = (SamplesOut[index][FRONT_LEFT] +
- ALfpMult((ALfpMult(State->Early.PanGain[FRONT_LEFT],early[0]) +
- ALfpMult(State->Late.PanGain[FRONT_LEFT],late[0])), gain));
- SamplesOut[index][FRONT_RIGHT] = (SamplesOut[index][FRONT_RIGHT] +
- ALfpMult((ALfpMult(State->Early.PanGain[FRONT_RIGHT],early[1]) +
- ALfpMult(State->Late.PanGain[FRONT_RIGHT],late[1])), gain));
-#ifdef APPORTABLE_OPTIMIZED_OUT
- SamplesOut[index][FRONT_CENTER] = (SamplesOut[index][FRONT_CENTER] +
- ALfpMult((ALfpMult(State->Early.PanGain[FRONT_LEFT],early[3]) +
- ALfpMult(State->Late.PanGain[FRONT_CENTER],late[3])), gain));
- SamplesOut[index][SIDE_LEFT] = (SamplesOut[index][SIDE_LEFT] +
- ALfpMult((ALfpMult(State->Early.PanGain[SIDE_LEFT],early[0]) +
- ALfpMult(State->Late.PanGain[SIDE_LEFT],late[0])), gain));
- SamplesOut[index][SIDE_RIGHT] = (SamplesOut[index][SIDE_RIGHT] +
- ALfpMult((ALfpMult(State->Early.PanGain[SIDE_RIGHT],early[1]) +
- ALfpMult(State->Late.PanGain[SIDE_RIGHT],late[1])), gain));
- SamplesOut[index][BACK_LEFT] = (SamplesOut[index][BACK_LEFT] +
- ALfpMult((ALfpMult(State->Early.PanGain[BACK_LEFT],early[0]) +
- ALfpMult(State->Late.PanGain[BACK_LEFT],late[0])), gain));
- SamplesOut[index][BACK_RIGHT] = (SamplesOut[index][BACK_RIGHT] +
- ALfpMult((ALfpMult(State->Early.PanGain[BACK_RIGHT],early[1]) +
- ALfpMult(State->Late.PanGain[BACK_RIGHT],late[1])), gain));
- SamplesOut[index][BACK_CENTER] = (SamplesOut[index][BACK_CENTER] +
- ALfpMult((ALfpMult(State->Early.PanGain[BACK_CENTER],early[2]) +
- ALfpMult(State->Late.PanGain[BACK_CENTER],late[2])), gain));
-#endif
-
- }
-}
-
-// This creates the reverb state. It should be called only when the reverb
-// effect is loaded into a slot that doesn't already have a reverb effect.
-ALeffectState *VerbCreate(void)
-{
- ALverbState *State = NULL;
- ALuint index;
-
- State = malloc(sizeof(ALverbState));
- if(!State)
- return NULL;
-
- State->state.Destroy = VerbDestroy;
- State->state.DeviceUpdate = VerbDeviceUpdate;
- State->state.Update = VerbUpdate;
- State->state.Process = VerbProcess;
-
- State->TotalSamples = 0;
- State->SampleBuffer = NULL;
-
- State->LpFilter.coeff = int2ALfp(0);
- State->LpFilter.history[0] = int2ALfp(0);
- State->LpFilter.history[1] = int2ALfp(0);
-
- State->Mod.Delay.Mask = 0;
- State->Mod.Delay.Line = NULL;
- State->Mod.Index = 0;
- State->Mod.Range = 1;
- State->Mod.Depth = int2ALfp(0);
- State->Mod.Coeff = int2ALfp(0);
- State->Mod.Filter = int2ALfp(0);
-
- State->Delay.Mask = 0;
- State->Delay.Line = NULL;
- State->DelayTap[0] = 0;
- State->DelayTap[1] = 0;
-
- State->Early.Gain = int2ALfp(0);
- for(index = 0;index < 4;index++)
- {
- State->Early.Coeff[index] = int2ALfp(0);
- State->Early.Delay[index].Mask = 0;
- State->Early.Delay[index].Line = NULL;
- State->Early.Offset[index] = 0;
- }
-
- State->Decorrelator.Mask = 0;
- State->Decorrelator.Line = NULL;
- State->DecoTap[0] = 0;
- State->DecoTap[1] = 0;
- State->DecoTap[2] = 0;
-
- State->Late.Gain = int2ALfp(0);
- State->Late.DensityGain = int2ALfp(0);
- State->Late.ApFeedCoeff = int2ALfp(0);
- State->Late.MixCoeff = int2ALfp(0);
- for(index = 0;index < 4;index++)
- {
- State->Late.ApCoeff[index] = int2ALfp(0);
- State->Late.ApDelay[index].Mask = 0;
- State->Late.ApDelay[index].Line = NULL;
- State->Late.ApOffset[index] = 0;
-
- State->Late.Coeff[index] = int2ALfp(0);
- State->Late.Delay[index].Mask = 0;
- State->Late.Delay[index].Line = NULL;
- State->Late.Offset[index] = 0;
-
- State->Late.LpCoeff[index] = int2ALfp(0);
- State->Late.LpSample[index] = int2ALfp(0);
- }
-
- for(index = 0;index < MAXCHANNELS;index++)
- {
- State->Early.PanGain[index] = int2ALfp(0);
- State->Late.PanGain[index] = int2ALfp(0);
- }
-
- State->Echo.DensityGain = int2ALfp(0);
- State->Echo.Delay.Mask = 0;
- State->Echo.Delay.Line = NULL;
- State->Echo.ApDelay.Mask = 0;
- State->Echo.ApDelay.Line = NULL;
- State->Echo.Coeff = int2ALfp(0);
- State->Echo.ApFeedCoeff = int2ALfp(0);
- State->Echo.ApCoeff = int2ALfp(0);
- State->Echo.Offset = 0;
- State->Echo.ApOffset = 0;
- State->Echo.LpCoeff = int2ALfp(0);
- State->Echo.LpSample = int2ALfp(0);
- State->Echo.MixCoeff[0] = int2ALfp(0);
- State->Echo.MixCoeff[1] = int2ALfp(0);
-
- State->Offset = 0;
-
- State->Gain = State->Late.PanGain;
-
- return &State->state;
-}
-
-ALeffectState *EAXVerbCreate(void)
-{
- ALeffectState *State = VerbCreate();
- if(State)
- {
- State->DeviceUpdate = EAXVerbDeviceUpdate;
- State->Update = EAXVerbUpdate;
- State->Process = EAXVerbProcess;
- }
- return State;
-}
diff --git a/internal/c/parts/audio/out/android/OpenAL/Alc/alcRing.c b/internal/c/parts/audio/out/android/OpenAL/Alc/alcRing.c
deleted file mode 100644
index 3361eb6e5..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Alc/alcRing.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/**
- * OpenAL cross platform audio library
- * Copyright (C) 1999-2007 by authors.
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- * Or go to http://www.gnu.org/copyleft/lgpl.html
- */
-
-#include "config.h"
-
-#include
-#include
-
-#include "alMain.h"
-
-
-struct RingBuffer {
- ALubyte *mem;
-
- ALsizei frame_size;
- ALsizei length;
- ALint read_pos;
- ALint write_pos;
-
- CRITICAL_SECTION cs;
-};
-
-
-RingBuffer *CreateRingBuffer(ALsizei frame_size, ALsizei length)
-{
- RingBuffer *ring = calloc(1, sizeof(*ring));
- if(ring)
- {
- ring->frame_size = frame_size;
- ring->length = length+1;
- ring->write_pos = 1;
- ring->mem = malloc(ring->length * ring->frame_size);
- if(!ring->mem)
- {
- free(ring);
- ring = NULL;
- }
-
- InitializeCriticalSection(&ring->cs);
- }
- return ring;
-}
-
-void DestroyRingBuffer(RingBuffer *ring)
-{
- if(ring)
- {
- DeleteCriticalSection(&ring->cs);
- free(ring->mem);
- free(ring);
- }
-}
-
-ALsizei RingBufferSize(RingBuffer *ring)
-{
- ALsizei s;
-
- EnterCriticalSection(&ring->cs);
- s = (ring->write_pos-ring->read_pos-1+ring->length) % ring->length;
- LeaveCriticalSection(&ring->cs);
-
- return s;
-}
-
-void WriteRingBuffer(RingBuffer *ring, const ALubyte *data, ALsizei len)
-{
- int remain;
-
- EnterCriticalSection(&ring->cs);
-
- remain = (ring->read_pos-ring->write_pos+ring->length) % ring->length;
- if(remain < len) len = remain;
-
- if(len > 0)
- {
- remain = ring->length - ring->write_pos;
- if(remain < len)
- {
- memcpy(ring->mem+(ring->write_pos*ring->frame_size), data,
- remain*ring->frame_size);
- memcpy(ring->mem, data+(remain*ring->frame_size),
- (len-remain)*ring->frame_size);
- }
- else
- memcpy(ring->mem+(ring->write_pos*ring->frame_size), data,
- len*ring->frame_size);
-
- ring->write_pos += len;
- ring->write_pos %= ring->length;
- }
-
- LeaveCriticalSection(&ring->cs);
-}
-
-void ReadRingBuffer(RingBuffer *ring, ALubyte *data, ALsizei len)
-{
- int remain;
-
- EnterCriticalSection(&ring->cs);
-
- remain = ring->length - ring->read_pos;
- if(remain < len)
- {
- memcpy(data, ring->mem+(ring->read_pos*ring->frame_size), remain*ring->frame_size);
- memcpy(data+(remain*ring->frame_size), ring->mem, (len-remain)*ring->frame_size);
- }
- else
- memcpy(data, ring->mem+(ring->read_pos*ring->frame_size), len*ring->frame_size);
-
- ring->read_pos += len;
- ring->read_pos %= ring->length;
-
- LeaveCriticalSection(&ring->cs);
-}
diff --git a/internal/c/parts/audio/out/android/OpenAL/Alc/alcThread.c b/internal/c/parts/audio/out/android/OpenAL/Alc/alcThread.c
deleted file mode 100644
index 582dfd8c2..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Alc/alcThread.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/**
- * OpenAL cross platform audio library
- * Copyright (C) 1999-2007 by authors.
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- * Or go to http://www.gnu.org/copyleft/lgpl.html
- */
-
-#include "config.h"
-
-#include
-
-#include "alMain.h"
-#include "alThunk.h"
-
-
-#ifdef _WIN32
-
-typedef struct {
- ALuint (*func)(ALvoid*);
- ALvoid *ptr;
- HANDLE thread;
-} ThreadInfo;
-
-static DWORD CALLBACK StarterFunc(void *ptr)
-{
- ThreadInfo *inf = (ThreadInfo*)ptr;
- ALint ret;
-
- ret = inf->func(inf->ptr);
- ExitThread((DWORD)ret);
-
- return (DWORD)ret;
-}
-
-ALvoid *StartThread(ALuint (*func)(ALvoid*), ALvoid *ptr)
-{
- DWORD dummy;
- ThreadInfo *inf = malloc(sizeof(ThreadInfo));
- if(!inf) return 0;
-
- inf->func = func;
- inf->ptr = ptr;
-
- inf->thread = CreateThread(NULL, 0, StarterFunc, inf, 0, &dummy);
- if(!inf->thread)
- {
- free(inf);
- return NULL;
- }
-
- return inf;
-}
-
-ALuint StopThread(ALvoid *thread)
-{
- ThreadInfo *inf = thread;
- DWORD ret = 0;
-
- WaitForSingleObject(inf->thread, INFINITE);
- GetExitCodeThread(inf->thread, &ret);
- CloseHandle(inf->thread);
-
- free(inf);
-
- return (ALuint)ret;
-}
-
-#else
-
-#include
-
-typedef struct {
- ALuint (*func)(ALvoid*);
- ALvoid *ptr;
- ALuint ret;
- pthread_t thread;
-} ThreadInfo;
-
-static void *StarterFunc(void *ptr)
-{
- ThreadInfo *inf = (ThreadInfo*)ptr;
- inf->ret = inf->func(inf->ptr);
- return NULL;
-}
-
-ALvoid *StartThread(ALuint (*func)(ALvoid*), ALvoid *ptr)
-{
- ThreadInfo *inf = malloc(sizeof(ThreadInfo));
- if(!inf) return NULL;
-
- inf->func = func;
- inf->ptr = ptr;
- if(pthread_create(&inf->thread, NULL, StarterFunc, inf) != 0)
- {
- free(inf);
- return NULL;
- }
-
- return inf;
-}
-
-ALuint StopThread(ALvoid *thread)
-{
- ThreadInfo *inf = thread;
- ALuint ret;
-
- pthread_join(inf->thread, NULL);
- ret = inf->ret;
-
- free(inf);
-
- return ret;
-}
-
-#endif
diff --git a/internal/c/parts/audio/out/android/OpenAL/Alc/alsa.c b/internal/c/parts/audio/out/android/OpenAL/Alc/alsa.c
deleted file mode 100644
index a7e87587b..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Alc/alsa.c
+++ /dev/null
@@ -1,1048 +0,0 @@
-/**
- * OpenAL cross platform audio library
- * Copyright (C) 1999-2007 by authors.
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- * Or go to http://www.gnu.org/copyleft/lgpl.html
- */
-
-#include "config.h"
-
-#include
-#include
-#include
-#ifdef HAVE_DLFCN_H
-#include
-#endif
-#include "alMain.h"
-#include "AL/al.h"
-#include "AL/alc.h"
-
-#include
-
-
-typedef struct {
- snd_pcm_t *pcmHandle;
-
- ALvoid *buffer;
- ALsizei size;
-
- ALboolean doCapture;
- RingBuffer *ring;
-
- volatile int killNow;
- ALvoid *thread;
-} alsa_data;
-
-typedef struct {
- ALCchar *name;
- int card, dev;
-} DevMap;
-
-static void *alsa_handle;
-#define MAKE_FUNC(f) static typeof(f) * p##f
-MAKE_FUNC(snd_strerror);
-MAKE_FUNC(snd_pcm_open);
-MAKE_FUNC(snd_pcm_close);
-MAKE_FUNC(snd_pcm_nonblock);
-MAKE_FUNC(snd_pcm_frames_to_bytes);
-MAKE_FUNC(snd_pcm_bytes_to_frames);
-MAKE_FUNC(snd_pcm_hw_params_malloc);
-MAKE_FUNC(snd_pcm_hw_params_free);
-MAKE_FUNC(snd_pcm_hw_params_any);
-MAKE_FUNC(snd_pcm_hw_params_set_access);
-MAKE_FUNC(snd_pcm_hw_params_set_format);
-MAKE_FUNC(snd_pcm_hw_params_set_channels);
-MAKE_FUNC(snd_pcm_hw_params_set_periods_near);
-MAKE_FUNC(snd_pcm_hw_params_set_rate_near);
-MAKE_FUNC(snd_pcm_hw_params_set_rate);
-MAKE_FUNC(snd_pcm_hw_params_set_rate_resample);
-MAKE_FUNC(snd_pcm_hw_params_set_buffer_time_near);
-MAKE_FUNC(snd_pcm_hw_params_set_period_time_near);
-MAKE_FUNC(snd_pcm_hw_params_set_buffer_size_near);
-MAKE_FUNC(snd_pcm_hw_params_set_period_size_near);
-MAKE_FUNC(snd_pcm_hw_params_set_buffer_size_min);
-MAKE_FUNC(snd_pcm_hw_params_get_buffer_size);
-MAKE_FUNC(snd_pcm_hw_params_get_period_size);
-MAKE_FUNC(snd_pcm_hw_params_get_access);
-MAKE_FUNC(snd_pcm_hw_params_get_periods);
-MAKE_FUNC(snd_pcm_hw_params);
-MAKE_FUNC(snd_pcm_sw_params_malloc);
-MAKE_FUNC(snd_pcm_sw_params_current);
-MAKE_FUNC(snd_pcm_sw_params_set_avail_min);
-MAKE_FUNC(snd_pcm_sw_params);
-MAKE_FUNC(snd_pcm_sw_params_free);
-MAKE_FUNC(snd_pcm_prepare);
-MAKE_FUNC(snd_pcm_start);
-MAKE_FUNC(snd_pcm_resume);
-MAKE_FUNC(snd_pcm_wait);
-MAKE_FUNC(snd_pcm_state);
-MAKE_FUNC(snd_pcm_avail_update);
-MAKE_FUNC(snd_pcm_areas_silence);
-MAKE_FUNC(snd_pcm_mmap_begin);
-MAKE_FUNC(snd_pcm_mmap_commit);
-MAKE_FUNC(snd_pcm_readi);
-MAKE_FUNC(snd_pcm_writei);
-MAKE_FUNC(snd_pcm_drain);
-MAKE_FUNC(snd_pcm_recover);
-MAKE_FUNC(snd_pcm_info_malloc);
-MAKE_FUNC(snd_pcm_info_free);
-MAKE_FUNC(snd_pcm_info_set_device);
-MAKE_FUNC(snd_pcm_info_set_subdevice);
-MAKE_FUNC(snd_pcm_info_set_stream);
-MAKE_FUNC(snd_pcm_info_get_name);
-MAKE_FUNC(snd_ctl_pcm_next_device);
-MAKE_FUNC(snd_ctl_pcm_info);
-MAKE_FUNC(snd_ctl_open);
-MAKE_FUNC(snd_ctl_close);
-MAKE_FUNC(snd_ctl_card_info_malloc);
-MAKE_FUNC(snd_ctl_card_info_free);
-MAKE_FUNC(snd_ctl_card_info);
-MAKE_FUNC(snd_ctl_card_info_get_name);
-MAKE_FUNC(snd_card_next);
-#undef MAKE_FUNC
-
-
-static const ALCchar alsaDevice[] = "ALSA Default";
-static DevMap *allDevNameMap;
-static ALuint numDevNames;
-static DevMap *allCaptureDevNameMap;
-static ALuint numCaptureDevNames;
-
-
-void *alsa_load(void)
-{
- if(!alsa_handle)
- {
- char *str;
-
-#ifdef HAVE_DLFCN_H
- alsa_handle = dlopen("libasound.so.2", RTLD_NOW);
- if(!alsa_handle)
- return NULL;
- dlerror();
-
-#define LOAD_FUNC(f) do { \
- p##f = dlsym(alsa_handle, #f); \
- if((str=dlerror()) != NULL) \
- { \
- dlclose(alsa_handle); \
- alsa_handle = NULL; \
- AL_PRINT("Could not load %s from libasound.so.2: %s\n", #f, str); \
- return NULL; \
- } \
-} while(0)
-#else
- str = NULL;
- alsa_handle = (void*)0xDEADBEEF;
-#define LOAD_FUNC(f) p##f = f
-#endif
-
-LOAD_FUNC(snd_strerror);
-LOAD_FUNC(snd_pcm_open);
-LOAD_FUNC(snd_pcm_close);
-LOAD_FUNC(snd_pcm_nonblock);
-LOAD_FUNC(snd_pcm_frames_to_bytes);
-LOAD_FUNC(snd_pcm_bytes_to_frames);
-LOAD_FUNC(snd_pcm_hw_params_malloc);
-LOAD_FUNC(snd_pcm_hw_params_free);
-LOAD_FUNC(snd_pcm_hw_params_any);
-LOAD_FUNC(snd_pcm_hw_params_set_access);
-LOAD_FUNC(snd_pcm_hw_params_set_format);
-LOAD_FUNC(snd_pcm_hw_params_set_channels);
-LOAD_FUNC(snd_pcm_hw_params_set_periods_near);
-LOAD_FUNC(snd_pcm_hw_params_set_rate_near);
-LOAD_FUNC(snd_pcm_hw_params_set_rate);
-LOAD_FUNC(snd_pcm_hw_params_set_rate_resample);
-LOAD_FUNC(snd_pcm_hw_params_set_buffer_time_near);
-LOAD_FUNC(snd_pcm_hw_params_set_period_time_near);
-LOAD_FUNC(snd_pcm_hw_params_set_buffer_size_near);
-LOAD_FUNC(snd_pcm_hw_params_set_buffer_size_min);
-LOAD_FUNC(snd_pcm_hw_params_set_period_size_near);
-LOAD_FUNC(snd_pcm_hw_params_get_buffer_size);
-LOAD_FUNC(snd_pcm_hw_params_get_period_size);
-LOAD_FUNC(snd_pcm_hw_params_get_access);
-LOAD_FUNC(snd_pcm_hw_params_get_periods);
-LOAD_FUNC(snd_pcm_hw_params);
-LOAD_FUNC(snd_pcm_sw_params_malloc);
-LOAD_FUNC(snd_pcm_sw_params_current);
-LOAD_FUNC(snd_pcm_sw_params_set_avail_min);
-LOAD_FUNC(snd_pcm_sw_params);
-LOAD_FUNC(snd_pcm_sw_params_free);
-LOAD_FUNC(snd_pcm_prepare);
-LOAD_FUNC(snd_pcm_start);
-LOAD_FUNC(snd_pcm_resume);
-LOAD_FUNC(snd_pcm_wait);
-LOAD_FUNC(snd_pcm_state);
-LOAD_FUNC(snd_pcm_avail_update);
-LOAD_FUNC(snd_pcm_areas_silence);
-LOAD_FUNC(snd_pcm_mmap_begin);
-LOAD_FUNC(snd_pcm_mmap_commit);
-LOAD_FUNC(snd_pcm_readi);
-LOAD_FUNC(snd_pcm_writei);
-LOAD_FUNC(snd_pcm_drain);
-LOAD_FUNC(snd_pcm_recover);
-
-LOAD_FUNC(snd_pcm_info_malloc);
-LOAD_FUNC(snd_pcm_info_free);
-LOAD_FUNC(snd_pcm_info_set_device);
-LOAD_FUNC(snd_pcm_info_set_subdevice);
-LOAD_FUNC(snd_pcm_info_set_stream);
-LOAD_FUNC(snd_pcm_info_get_name);
-LOAD_FUNC(snd_ctl_pcm_next_device);
-LOAD_FUNC(snd_ctl_pcm_info);
-LOAD_FUNC(snd_ctl_open);
-LOAD_FUNC(snd_ctl_close);
-LOAD_FUNC(snd_ctl_card_info_malloc);
-LOAD_FUNC(snd_ctl_card_info_free);
-LOAD_FUNC(snd_ctl_card_info);
-LOAD_FUNC(snd_ctl_card_info_get_name);
-LOAD_FUNC(snd_card_next);
-
-#undef LOAD_FUNC
- }
- return alsa_handle;
-}
-
-static DevMap *probe_devices(snd_pcm_stream_t stream, ALuint *count)
-{
- snd_ctl_t *handle;
- int card, err, dev, idx;
- snd_ctl_card_info_t *info;
- snd_pcm_info_t *pcminfo;
- DevMap *DevList;
- char name[1024];
-
- psnd_ctl_card_info_malloc(&info);
- psnd_pcm_info_malloc(&pcminfo);
-
- card = -1;
- if((err=psnd_card_next(&card)) < 0)
- AL_PRINT("Failed to find a card: %s\n", psnd_strerror(err));
-
- DevList = malloc(sizeof(DevMap) * 1);
- DevList[0].name = strdup("ALSA Default");
- idx = 1;
- while(card >= 0)
- {
- sprintf(name, "hw:%d", card);
- if((err = psnd_ctl_open(&handle, name, 0)) < 0)
- {
- AL_PRINT("control open (%i): %s\n", card, psnd_strerror(err));
- goto next_card;
- }
- if((err = psnd_ctl_card_info(handle, info)) < 0)
- {
- AL_PRINT("control hardware info (%i): %s\n", card, psnd_strerror(err));
- psnd_ctl_close(handle);
- goto next_card;
- }
-
- dev = -1;
- while(1)
- {
- const char *cname, *dname;
- void *temp;
-
- if(psnd_ctl_pcm_next_device(handle, &dev) < 0)
- AL_PRINT("snd_ctl_pcm_next_device failed\n");
- if(dev < 0)
- break;
-
- psnd_pcm_info_set_device(pcminfo, dev);
- psnd_pcm_info_set_subdevice(pcminfo, 0);
- psnd_pcm_info_set_stream(pcminfo, stream);
- if((err = psnd_ctl_pcm_info(handle, pcminfo)) < 0) {
- if(err != -ENOENT)
- AL_PRINT("control digital audio info (%i): %s\n", card, psnd_strerror(err));
- continue;
- }
-
- temp = realloc(DevList, sizeof(DevMap) * (idx+1));
- if(temp)
- {
- DevList = temp;
- cname = psnd_ctl_card_info_get_name(info);
- dname = psnd_pcm_info_get_name(pcminfo);
- snprintf(name, sizeof(name), "%s [%s] (hw:%d,%d) via ALSA",
- cname, dname, card, dev);
- DevList[idx].name = strdup(name);
- DevList[idx].card = card;
- DevList[idx].dev = dev;
- idx++;
- }
- }
- psnd_ctl_close(handle);
- next_card:
- if(psnd_card_next(&card) < 0) {
- AL_PRINT("snd_card_next failed\n");
- break;
- }
- }
-
- psnd_pcm_info_free(pcminfo);
- psnd_ctl_card_info_free(info);
-
- *count = idx;
- return DevList;
-}
-
-
-static int xrun_recovery(snd_pcm_t *handle, int err)
-{
- err = psnd_pcm_recover(handle, err, 1);
- if(err < 0)
- AL_PRINT("recover failed: %s\n", psnd_strerror(err));
- return err;
-}
-
-static int verify_state(snd_pcm_t *handle)
-{
- snd_pcm_state_t state = psnd_pcm_state(handle);
- if(state == SND_PCM_STATE_DISCONNECTED)
- return -ENODEV;
- if(state == SND_PCM_STATE_XRUN)
- {
- int err = xrun_recovery(handle, -EPIPE);
- if(err < 0) return err;
- }
- else if(state == SND_PCM_STATE_SUSPENDED)
- {
- int err = xrun_recovery(handle, -ESTRPIPE);
- if(err < 0) return err;
- }
-
- return state;
-}
-
-
-static ALuint ALSAProc(ALvoid *ptr)
-{
- ALCdevice *pDevice = (ALCdevice*)ptr;
- alsa_data *data = (alsa_data*)pDevice->ExtraData;
- const snd_pcm_channel_area_t *areas = NULL;
- snd_pcm_sframes_t avail, commitres;
- snd_pcm_uframes_t offset, frames;
- char *WritePtr;
- int err;
-
- SetRTPriority();
-
- while(!data->killNow)
- {
- int state = verify_state(data->pcmHandle);
- if(state < 0)
- {
- AL_PRINT("Invalid state detected: %s\n", psnd_strerror(state));
- aluHandleDisconnect(pDevice);
- break;
- }
-
- avail = psnd_pcm_avail_update(data->pcmHandle);
- if(avail < 0)
- {
- AL_PRINT("available update failed: %s\n", psnd_strerror(avail));
- continue;
- }
-
- // make sure there's frames to process
- if((snd_pcm_uframes_t)avail < pDevice->UpdateSize)
- {
- if(state != SND_PCM_STATE_RUNNING)
- {
- err = psnd_pcm_start(data->pcmHandle);
- if(err < 0)
- {
- AL_PRINT("start failed: %s\n", psnd_strerror(err));
- continue;
- }
- }
- if(psnd_pcm_wait(data->pcmHandle, 1000) == 0)
- AL_PRINT("Wait timeout... buffer size too low?\n");
- continue;
- }
- avail -= avail%pDevice->UpdateSize;
-
- // it is possible that contiguous areas are smaller, thus we use a loop
- while(avail > 0)
- {
- frames = avail;
-
- err = psnd_pcm_mmap_begin(data->pcmHandle, &areas, &offset, &frames);
- if(err < 0)
- {
- AL_PRINT("mmap begin error: %s\n", psnd_strerror(err));
- break;
- }
-
- WritePtr = (char*)areas->addr + (offset * areas->step / 8);
- aluMixData(pDevice, WritePtr, frames);
-
- commitres = psnd_pcm_mmap_commit(data->pcmHandle, offset, frames);
- if(commitres < 0 || (commitres-frames) != 0)
- {
- AL_PRINT("mmap commit error: %s\n",
- psnd_strerror(commitres >= 0 ? -EPIPE : commitres));
- break;
- }
-
- avail -= frames;
- }
- }
-
- return 0;
-}
-
-static ALuint ALSANoMMapProc(ALvoid *ptr)
-{
- ALCdevice *pDevice = (ALCdevice*)ptr;
- alsa_data *data = (alsa_data*)pDevice->ExtraData;
- snd_pcm_sframes_t avail;
- char *WritePtr;
-
- SetRTPriority();
-
- while(!data->killNow)
- {
- int state = verify_state(data->pcmHandle);
- if(state < 0)
- {
- AL_PRINT("Invalid state detected: %s\n", psnd_strerror(state));
- aluHandleDisconnect(pDevice);
- break;
- }
-
- WritePtr = data->buffer;
- avail = data->size / psnd_pcm_frames_to_bytes(data->pcmHandle, 1);
- aluMixData(pDevice, WritePtr, avail);
-
- while(avail > 0)
- {
- int ret = psnd_pcm_writei(data->pcmHandle, WritePtr, avail);
- switch (ret)
- {
- case -EAGAIN:
- continue;
- case -ESTRPIPE:
- case -EPIPE:
- case -EINTR:
- ret = psnd_pcm_recover(data->pcmHandle, ret, 1);
- if(ret < 0)
- avail = 0;
- break;
- default:
- if (ret >= 0)
- {
- WritePtr += psnd_pcm_frames_to_bytes(data->pcmHandle, ret);
- avail -= ret;
- }
- break;
- }
- if (ret < 0)
- {
- ret = psnd_pcm_prepare(data->pcmHandle);
- if(ret < 0)
- break;
- }
- }
- }
-
- return 0;
-}
-
-static ALCboolean alsa_open_playback(ALCdevice *device, const ALCchar *deviceName)
-{
- alsa_data *data;
- char driver[64];
- int i;
-
- if(!alsa_load())
- return ALC_FALSE;
-
- strncpy(driver, GetConfigValue("alsa", "device", "default"), sizeof(driver)-1);
- driver[sizeof(driver)-1] = 0;
-
- if(!deviceName)
- deviceName = alsaDevice;
- else if(strcmp(deviceName, alsaDevice) != 0)
- {
- size_t idx;
-
- if(!allDevNameMap)
- allDevNameMap = probe_devices(SND_PCM_STREAM_PLAYBACK, &numDevNames);
-
- for(idx = 0;idx < numDevNames;idx++)
- {
- if(allDevNameMap[idx].name &&
- strcmp(deviceName, allDevNameMap[idx].name) == 0)
- {
- if(idx > 0)
- sprintf(driver, "hw:%d,%d", allDevNameMap[idx].card, allDevNameMap[idx].dev);
- break;
- }
- }
- if(idx == numDevNames)
- return ALC_FALSE;
- }
-
- data = (alsa_data*)calloc(1, sizeof(alsa_data));
-
- i = psnd_pcm_open(&data->pcmHandle, driver, SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK);
- if(i >= 0)
- {
- i = psnd_pcm_nonblock(data->pcmHandle, 0);
- if(i < 0)
- psnd_pcm_close(data->pcmHandle);
- }
- if(i < 0)
- {
- free(data);
- AL_PRINT("Could not open playback device '%s': %s\n", driver, psnd_strerror(i));
- return ALC_FALSE;
- }
-
- device->szDeviceName = strdup(deviceName);
- device->ExtraData = data;
- return ALC_TRUE;
-}
-
-static void alsa_close_playback(ALCdevice *device)
-{
- alsa_data *data = (alsa_data*)device->ExtraData;
-
- psnd_pcm_close(data->pcmHandle);
- free(data);
- device->ExtraData = NULL;
-}
-
-static ALCboolean alsa_reset_playback(ALCdevice *device)
-{
- alsa_data *data = (alsa_data*)device->ExtraData;
- snd_pcm_uframes_t periodSizeInFrames;
- unsigned int periodLen, bufferLen;
- snd_pcm_sw_params_t *sp = NULL;
- snd_pcm_hw_params_t *p = NULL;
- snd_pcm_access_t access;
- snd_pcm_format_t format;
- unsigned int periods;
- unsigned int rate;
- int allowmmap;
- char *err;
- int i;
-
-
- format = -1;
- switch(device->FmtType)
- {
- case DevFmtByte:
- format = SND_PCM_FORMAT_S8;
- break;
- case DevFmtUByte:
- format = SND_PCM_FORMAT_U8;
- break;
- case DevFmtShort:
- format = SND_PCM_FORMAT_S16;
- break;
- case DevFmtUShort:
- format = SND_PCM_FORMAT_U16;
- break;
- case DevFmtFloat:
- format = SND_PCM_FORMAT_FLOAT;
- break;
- }
-
- allowmmap = GetConfigValueBool("alsa", "mmap", 1);
- periods = device->NumUpdates;
- periodLen = (ALuint64)device->UpdateSize * 1000000 / device->Frequency;
- bufferLen = periodLen * periods;
- rate = device->Frequency;
-
- err = NULL;
- psnd_pcm_hw_params_malloc(&p);
-
- if((i=psnd_pcm_hw_params_any(data->pcmHandle, p)) < 0)
- err = "any";
- /* set interleaved access */
- if(i >= 0 && (!allowmmap || (i=psnd_pcm_hw_params_set_access(data->pcmHandle, p, SND_PCM_ACCESS_MMAP_INTERLEAVED)) < 0))
- {
- if(periods > 2)
- {
- periods--;
- bufferLen = periodLen * periods;
- }
- if((i=psnd_pcm_hw_params_set_access(data->pcmHandle, p, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0)
- err = "set access";
- }
- /* set format (implicitly sets sample bits) */
- if(i >= 0 && (i=psnd_pcm_hw_params_set_format(data->pcmHandle, p, format)) < 0)
- {
- device->FmtType = DevFmtFloat;
- if(format == SND_PCM_FORMAT_FLOAT ||
- (i=psnd_pcm_hw_params_set_format(data->pcmHandle, p, SND_PCM_FORMAT_FLOAT)) < 0)
- {
- device->FmtType = DevFmtShort;
- if(format == SND_PCM_FORMAT_S16 ||
- (i=psnd_pcm_hw_params_set_format(data->pcmHandle, p, SND_PCM_FORMAT_S16)) < 0)
- {
- device->FmtType = DevFmtUByte;
- if(format == SND_PCM_FORMAT_U8 ||
- (i=psnd_pcm_hw_params_set_format(data->pcmHandle, p, SND_PCM_FORMAT_U8)) < 0)
- err = "set format";
- }
- }
- }
- /* set channels (implicitly sets frame bits) */
- if(i >= 0 && (i=psnd_pcm_hw_params_set_channels(data->pcmHandle, p, ChannelsFromDevFmt(device->FmtChans))) < 0)
- {
- device->FmtChans = DevFmtStereo;
- if((i=psnd_pcm_hw_params_set_channels(data->pcmHandle, p, 2)) < 0)
- {
- device->FmtChans = DevFmtMono;
- if((i=psnd_pcm_hw_params_set_channels(data->pcmHandle, p, 1)) < 0)
- err = "set channels";
- }
- }
- if(i >= 0 && (i=psnd_pcm_hw_params_set_rate_resample(data->pcmHandle, p, 0)) < 0)
- {
- AL_PRINT("Failed to disable ALSA resampler\n");
- i = 0;
- }
- /* set rate (implicitly constrains period/buffer parameters) */
- if(i >= 0 && (i=psnd_pcm_hw_params_set_rate_near(data->pcmHandle, p, &rate, NULL)) < 0)
- err = "set rate near";
- /* set buffer time (implicitly constrains period/buffer parameters) */
- if(i >= 0 && (i=psnd_pcm_hw_params_set_buffer_time_near(data->pcmHandle, p, &bufferLen, NULL)) < 0)
- err = "set buffer time near";
- /* set period time in frame units (implicitly sets buffer size/bytes/time and period size/bytes) */
- if(i >= 0 && (i=psnd_pcm_hw_params_set_period_time_near(data->pcmHandle, p, &periodLen, NULL)) < 0)
- err = "set period time near";
- /* install and prepare hardware configuration */
- if(i >= 0 && (i=psnd_pcm_hw_params(data->pcmHandle, p)) < 0)
- err = "set params";
- if(i >= 0 && (i=psnd_pcm_hw_params_get_access(p, &access)) < 0)
- err = "get access";
- if(i >= 0 && (i=psnd_pcm_hw_params_get_period_size(p, &periodSizeInFrames, NULL)) < 0)
- err = "get period size";
- if(i >= 0 && (i=psnd_pcm_hw_params_get_periods(p, &periods, NULL)) < 0)
- err = "get periods";
- if(i < 0)
- {
- AL_PRINT("%s failed: %s\n", err, psnd_strerror(i));
- psnd_pcm_hw_params_free(p);
- return ALC_FALSE;
- }
-
- psnd_pcm_hw_params_free(p);
-
- err = NULL;
- psnd_pcm_sw_params_malloc(&sp);
-
- if((i=psnd_pcm_sw_params_current(data->pcmHandle, sp)) != 0)
- err = "sw current";
- if(i == 0 && (i=psnd_pcm_sw_params_set_avail_min(data->pcmHandle, sp, periodSizeInFrames)) != 0)
- err = "sw set avail min";
- if(i == 0 && (i=psnd_pcm_sw_params(data->pcmHandle, sp)) != 0)
- err = "sw set params";
- if(i != 0)
- {
- AL_PRINT("%s failed: %s\n", err, psnd_strerror(i));
- psnd_pcm_sw_params_free(sp);
- return ALC_FALSE;
- }
-
- psnd_pcm_sw_params_free(sp);
-
- device->Frequency = rate;
-
- SetDefaultChannelOrder(device);
-
- data->size = psnd_pcm_frames_to_bytes(data->pcmHandle, periodSizeInFrames);
- if(access == SND_PCM_ACCESS_RW_INTERLEAVED)
- {
- /* Increase periods by one, since the temp buffer counts as an extra
- * period */
- periods++;
- data->buffer = malloc(data->size);
- if(!data->buffer)
- {
- AL_PRINT("buffer malloc failed\n");
- return ALC_FALSE;
- }
- device->UpdateSize = periodSizeInFrames;
- device->NumUpdates = periods;
- data->thread = StartThread(ALSANoMMapProc, device);
- }
- else
- {
- i = psnd_pcm_prepare(data->pcmHandle);
- if(i < 0)
- {
- AL_PRINT("prepare error: %s\n", psnd_strerror(i));
- return ALC_FALSE;
- }
- device->UpdateSize = periodSizeInFrames;
- device->NumUpdates = periods;
- data->thread = StartThread(ALSAProc, device);
- }
- if(data->thread == NULL)
- {
- AL_PRINT("Could not create playback thread\n");
- free(data->buffer);
- data->buffer = NULL;
- return ALC_FALSE;
- }
-
- return ALC_TRUE;
-}
-
-static void alsa_stop_playback(ALCdevice *device)
-{
- alsa_data *data = (alsa_data*)device->ExtraData;
-
- if(data->thread)
- {
- data->killNow = 1;
- StopThread(data->thread);
- data->thread = NULL;
- }
- data->killNow = 0;
- free(data->buffer);
- data->buffer = NULL;
-}
-
-
-static ALCboolean alsa_open_capture(ALCdevice *pDevice, const ALCchar *deviceName)
-{
- snd_pcm_hw_params_t *p;
- snd_pcm_uframes_t bufferSizeInFrames;
- snd_pcm_format_t format;
- ALuint frameSize;
- alsa_data *data;
- char driver[64];
- char *err;
- int i;
-
- if(!alsa_load())
- return ALC_FALSE;
-
- strncpy(driver, GetConfigValue("alsa", "capture", "default"), sizeof(driver)-1);
- driver[sizeof(driver)-1] = 0;
-
- if(!allCaptureDevNameMap)
- allCaptureDevNameMap = probe_devices(SND_PCM_STREAM_CAPTURE, &numCaptureDevNames);
-
- if(!deviceName)
- deviceName = allCaptureDevNameMap[0].name;
- else
- {
- size_t idx;
-
- for(idx = 0;idx < numCaptureDevNames;idx++)
- {
- if(allCaptureDevNameMap[idx].name &&
- strcmp(deviceName, allCaptureDevNameMap[idx].name) == 0)
- {
- if(idx > 0)
- sprintf(driver, "plughw:%d,%d", allCaptureDevNameMap[idx].card, allCaptureDevNameMap[idx].dev);
- break;
- }
- }
- if(idx == numCaptureDevNames)
- return ALC_FALSE;
- }
-
- data = (alsa_data*)calloc(1, sizeof(alsa_data));
-
- i = psnd_pcm_open(&data->pcmHandle, driver, SND_PCM_STREAM_CAPTURE, SND_PCM_NONBLOCK);
- if(i < 0)
- {
- AL_PRINT("Could not open capture device '%s': %s\n", driver, psnd_strerror(i));
- free(data);
- return ALC_FALSE;
- }
-
- format = -1;
- switch(pDevice->FmtType)
- {
- case DevFmtByte:
- format = SND_PCM_FORMAT_S8;
- break;
- case DevFmtUByte:
- format = SND_PCM_FORMAT_U8;
- break;
- case DevFmtShort:
- format = SND_PCM_FORMAT_S16;
- break;
- case DevFmtUShort:
- format = SND_PCM_FORMAT_U16;
- break;
- case DevFmtFloat:
- format = SND_PCM_FORMAT_FLOAT;
- break;
- }
-
- err = NULL;
- bufferSizeInFrames = pDevice->UpdateSize * pDevice->NumUpdates;
- psnd_pcm_hw_params_malloc(&p);
-
- if((i=psnd_pcm_hw_params_any(data->pcmHandle, p)) < 0)
- err = "any";
- /* set interleaved access */
- if(i >= 0 && (i=psnd_pcm_hw_params_set_access(data->pcmHandle, p, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0)
- err = "set access";
- /* set format (implicitly sets sample bits) */
- if(i >= 0 && (i=psnd_pcm_hw_params_set_format(data->pcmHandle, p, format)) < 0)
- err = "set format";
- /* set channels (implicitly sets frame bits) */
- if(i >= 0 && (i=psnd_pcm_hw_params_set_channels(data->pcmHandle, p, ChannelsFromDevFmt(pDevice->FmtChans))) < 0)
- err = "set channels";
- /* set rate (implicitly constrains period/buffer parameters) */
- if(i >= 0 && (i=psnd_pcm_hw_params_set_rate(data->pcmHandle, p, pDevice->Frequency, 0)) < 0)
- err = "set rate near";
- /* set buffer size in frame units (implicitly sets period size/bytes/time and buffer time/bytes) */
- if(i >= 0 && (i=psnd_pcm_hw_params_set_buffer_size_near(data->pcmHandle, p, &bufferSizeInFrames)) < 0)
- err = "set buffer size near";
- /* install and prepare hardware configuration */
- if(i >= 0 && (i=psnd_pcm_hw_params(data->pcmHandle, p)) < 0)
- err = "set params";
- if(i < 0)
- {
- AL_PRINT("%s failed: %s\n", err, psnd_strerror(i));
- psnd_pcm_hw_params_free(p);
- goto error;
- }
-
- if((i=psnd_pcm_hw_params_get_period_size(p, &bufferSizeInFrames, NULL)) < 0)
- {
- AL_PRINT("get size failed: %s\n", psnd_strerror(i));
- psnd_pcm_hw_params_free(p);
- goto error;
- }
-
- psnd_pcm_hw_params_free(p);
-
- frameSize = FrameSizeFromDevFmt(pDevice->FmtChans, pDevice->FmtType);
-
- data->ring = CreateRingBuffer(frameSize, pDevice->UpdateSize*pDevice->NumUpdates);
- if(!data->ring)
- {
- AL_PRINT("ring buffer create failed\n");
- goto error;
- }
-
- data->size = psnd_pcm_frames_to_bytes(data->pcmHandle, bufferSizeInFrames);
- data->buffer = malloc(data->size);
- if(!data->buffer)
- {
- AL_PRINT("buffer malloc failed\n");
- goto error;
- }
-
- pDevice->szDeviceName = strdup(deviceName);
-
- pDevice->ExtraData = data;
- return ALC_TRUE;
-
-error:
- free(data->buffer);
- DestroyRingBuffer(data->ring);
- psnd_pcm_close(data->pcmHandle);
- free(data);
-
- pDevice->ExtraData = NULL;
- return ALC_FALSE;
-}
-
-static void alsa_close_capture(ALCdevice *pDevice)
-{
- alsa_data *data = (alsa_data*)pDevice->ExtraData;
-
- psnd_pcm_close(data->pcmHandle);
- DestroyRingBuffer(data->ring);
-
- free(data->buffer);
- free(data);
- pDevice->ExtraData = NULL;
-}
-
-static void alsa_start_capture(ALCdevice *Device)
-{
- alsa_data *data = (alsa_data*)Device->ExtraData;
- int err;
-
- err = psnd_pcm_start(data->pcmHandle);
- if(err < 0)
- {
- AL_PRINT("start failed: %s\n", psnd_strerror(err));
- aluHandleDisconnect(Device);
- }
- else
- data->doCapture = AL_TRUE;
-}
-
-static void alsa_stop_capture(ALCdevice *Device)
-{
- alsa_data *data = (alsa_data*)Device->ExtraData;
- psnd_pcm_drain(data->pcmHandle);
- data->doCapture = AL_FALSE;
-}
-
-static ALCuint alsa_available_samples(ALCdevice *Device)
-{
- alsa_data *data = (alsa_data*)Device->ExtraData;
- snd_pcm_sframes_t avail;
-
- avail = (Device->Connected ? psnd_pcm_avail_update(data->pcmHandle) : 0);
- if(avail < 0)
- {
- AL_PRINT("avail update failed: %s\n", psnd_strerror(avail));
-
- if((avail=psnd_pcm_recover(data->pcmHandle, avail, 1)) >= 0)
- {
- if(data->doCapture)
- avail = psnd_pcm_start(data->pcmHandle);
- if(avail >= 0)
- avail = psnd_pcm_avail_update(data->pcmHandle);
- }
- if(avail < 0)
- {
- AL_PRINT("restore error: %s\n", psnd_strerror(avail));
- aluHandleDisconnect(Device);
- }
- }
- while(avail > 0)
- {
- snd_pcm_sframes_t amt;
-
- amt = psnd_pcm_bytes_to_frames(data->pcmHandle, data->size);
- if(avail < amt) amt = avail;
-
- amt = psnd_pcm_readi(data->pcmHandle, data->buffer, amt);
- if(amt < 0)
- {
- AL_PRINT("read error: %s\n", psnd_strerror(amt));
-
- if(amt == -EAGAIN)
- continue;
- if((amt=psnd_pcm_recover(data->pcmHandle, amt, 1)) >= 0)
- {
- if(data->doCapture)
- amt = psnd_pcm_start(data->pcmHandle);
- if(amt >= 0)
- amt = psnd_pcm_avail_update(data->pcmHandle);
- }
- if(amt < 0)
- {
- AL_PRINT("restore error: %s\n", psnd_strerror(amt));
- aluHandleDisconnect(Device);
- break;
- }
- avail = amt;
- continue;
- }
-
- WriteRingBuffer(data->ring, data->buffer, amt);
- avail -= amt;
- }
-
- return RingBufferSize(data->ring);
-}
-
-static void alsa_capture_samples(ALCdevice *Device, ALCvoid *Buffer, ALCuint Samples)
-{
- alsa_data *data = (alsa_data*)Device->ExtraData;
-
- if(Samples <= alsa_available_samples(Device))
- ReadRingBuffer(data->ring, Buffer, Samples);
- else
- alcSetError(Device, ALC_INVALID_VALUE);
-}
-
-
-BackendFuncs alsa_funcs = {
- alsa_open_playback,
- alsa_close_playback,
- alsa_reset_playback,
- alsa_stop_playback,
- alsa_open_capture,
- alsa_close_capture,
- alsa_start_capture,
- alsa_stop_capture,
- alsa_capture_samples,
- alsa_available_samples
-};
-
-void alc_alsa_init(BackendFuncs *func_list)
-{
- *func_list = alsa_funcs;
-}
-
-void alc_alsa_deinit(void)
-{
- ALuint i;
-
- for(i = 0;i < numDevNames;++i)
- free(allDevNameMap[i].name);
- free(allDevNameMap);
- allDevNameMap = NULL;
- numDevNames = 0;
-
- for(i = 0;i < numCaptureDevNames;++i)
- free(allCaptureDevNameMap[i].name);
- free(allCaptureDevNameMap);
- allCaptureDevNameMap = NULL;
- numCaptureDevNames = 0;
-
- if(alsa_handle)
- {
-#ifdef HAVE_DLFCN_H
- dlclose(alsa_handle);
-#endif
- alsa_handle = NULL;
- }
-}
-
-void alc_alsa_probe(int type)
-{
- ALuint i;
-
- if(!alsa_load())
- return;
-
- if(type == DEVICE_PROBE)
- AppendDeviceList(alsaDevice);
- else if(type == ALL_DEVICE_PROBE)
- {
- for(i = 0;i < numDevNames;++i)
- free(allDevNameMap[i].name);
-
- free(allDevNameMap);
- allDevNameMap = probe_devices(SND_PCM_STREAM_PLAYBACK, &numDevNames);
-
- for(i = 0;i < numDevNames;++i)
- AppendAllDeviceList(allDevNameMap[i].name);
- }
- else if(type == CAPTURE_DEVICE_PROBE)
- {
- for(i = 0;i < numCaptureDevNames;++i)
- free(allCaptureDevNameMap[i].name);
-
- free(allCaptureDevNameMap);
- allCaptureDevNameMap = probe_devices(SND_PCM_STREAM_CAPTURE, &numCaptureDevNames);
-
- for(i = 0;i < numCaptureDevNames;++i)
- AppendCaptureDeviceList(allCaptureDevNameMap[i].name);
- }
-}
diff --git a/internal/c/parts/audio/out/android/OpenAL/Alc/alu.h b/internal/c/parts/audio/out/android/OpenAL/Alc/alu.h
deleted file mode 100644
index 508eb3800..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Alc/alu.h
+++ /dev/null
@@ -1,140 +0,0 @@
-#ifndef _ALU_H_
-#define _ALU_H_
-
-#include "config.h"
-
-#include "AL/al.h"
-#include "AL/alc.h"
-#include "AL/alext.h"
-
-#include
-#include
-#ifdef HAVE_FLOAT_H
-#include
-#endif
-
-#ifndef M_PI
-#define M_PI 3.14159265358979323846 /* pi */
-#define M_PI_2 1.57079632679489661923 /* pi/2 */
-#endif
-
-#ifdef HAVE_POWF
-#define aluPow(x,y) (float2ALfp(powf(ALfp2float(x), ALfp2float(y))))
-#else
-#define aluPow(x,y) (float2ALfp((float)pow((double)ALfp2float(x), (double)ALfp2float(y))))
-#endif
-
-#ifdef HAVE_SQRTF
-#define aluSqrt(x) (float2ALfp(sqrtf(ALfp2float(x))))
-#else
-#define aluSqrt(x) (float2ALfp((float)sqrt((double)ALfp2float(x))))
-#endif
-
-#ifdef HAVE_ACOSF
-#define aluAcos(x) (float2ALfp(acosf(ALfp2float(x))))
-#else
-#define aluAcos(x) (float2ALfp((float)acos((double)ALfp2float(x))))
-#endif
-
-#ifdef HAVE_ATANF
-#define aluAtan(x) (float2ALfp(atanf(ALfp2float(x))))
-#else
-#define aluAtan(x) (float2ALfp((float)atan((double)ALfp2float(x))))
-#endif
-
-#ifdef HAVE_FABSF
-#define aluFabs(x) (float2ALfp(fabsf(ALfp2float(x))))
-#else
-#define aluFabs(x) (float2ALfp((float)fabs((double)ALfp2float(x))))
-#endif
-
-// FIXME make this better
-#if defined(max) && !defined(__max)
-#define __max(x,y) float2ALfp(max(ALfp2float(x),ALfp2float(y)))
-#endif
-#if defined(min) && !defined(__min)
-#define __min(x,y) float2ALfp(min(ALfp2float(x),ALfp2float(y)))
-#endif
-
-#define QUADRANT_NUM 128
-#define LUT_NUM (4 * QUADRANT_NUM)
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
- FRONT_LEFT = 0,
- FRONT_RIGHT,
- FRONT_CENTER,
- LFE,
- BACK_LEFT,
- BACK_RIGHT,
- BACK_CENTER,
- SIDE_LEFT,
- SIDE_RIGHT,
-} Channel;
-
-#ifndef MAXCHANNELS
-#define MAXCHANNELS (SIDE_RIGHT+1)
-#error MAXCHANNELS
-#endif
-
-#define BUFFERSIZE 4096
-
-#define FRACTIONBITS (14)
-#define FRACTIONONE (1<
-#include "alMain.h"
-#include "apportable_openal_funcs.h"
-
-static JavaVM *javaVM = NULL;
-JavaVM *alcGetJavaVM(void) {
- return javaVM;
-}
-
-jint JNI_OnLoad(JavaVM *vm, void *reserved) {
- BackendFuncs func_list;
- if (apportableOpenALFuncs.alc_android_set_java_vm) {
- apportableOpenALFuncs.alc_android_set_java_vm(vm);
- }
- javaVM = vm;
- return JNI_VERSION_1_4;
-}
-
-void JNICALL JNI_OnUnload (JavaVM *vm, void *reserved)
-{
- if (apportableOpenALFuncs.alc_android_set_java_vm) {
- apportableOpenALFuncs.alc_android_set_java_vm(NULL);
- }
-}
-
-ALC_API void ALC_APIENTRY alcSuspend(void) {
- if (apportableOpenALFuncs.alc_android_suspend) {
- apportableOpenALFuncs.alc_android_suspend();
- }
-}
-
-ALC_API void ALC_APIENTRY alcResume(void) {
- if (apportableOpenALFuncs.alc_android_resume) {
- apportableOpenALFuncs.alc_android_resume();
- }
-}
-
-#endif
diff --git a/internal/c/parts/audio/out/android/OpenAL/Alc/apportable_openal_funcs.h b/internal/c/parts/audio/out/android/OpenAL/Alc/apportable_openal_funcs.h
deleted file mode 100644
index 1e8d4b71f..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Alc/apportable_openal_funcs.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef __APPORTABLE_OPENAL_FUNCS_H__
-#define __APPORTABLE_OPENAL_FUNCS_H__
-#include
-
-typedef struct {
- void (*alc_android_suspend)();
- void (*alc_android_resume)();
- void (*alc_android_set_java_vm)(JavaVM*);
-} ApportableOpenALFuncs;
-ApportableOpenALFuncs apportableOpenALFuncs;
-
-#endif
diff --git a/internal/c/parts/audio/out/android/OpenAL/Alc/audiotrack.c b/internal/c/parts/audio/out/android/OpenAL/Alc/audiotrack.c
deleted file mode 100644
index ab685e45b..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Alc/audiotrack.c
+++ /dev/null
@@ -1,334 +0,0 @@
-/**
- * OpenAL cross platform audio library
- * Copyright (C) 2010 by Chris Robinson
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- * Or go to http://www.gnu.org/copyleft/lgpl.html
- */
-
-#include "config.h"
-
-#include
-#include
-#include
-#include "alMain.h"
-#include "AL/al.h"
-#include "AL/alc.h"
-
-#include "apportable_openal_funcs.h"
-
-static const ALCchar android_device[] = "Android Default";
-
-JavaVM* alcGetJavaVM(void);
-static JNIEnv* env;
-
-static jclass cAudioTrack = NULL;
-
-static jmethodID mAudioTrack;
-static jmethodID mGetMinBufferSize;
-static jmethodID mPlay;
-static jmethodID mPause;
-static jmethodID mStop;
-static jmethodID mRelease;
-static jmethodID mWrite;
-
-static int suspended = 0;
-static int audioTrackPlaying = 0;
-static int audioTrackWasPlaying = 0;
-
-typedef struct
-{
- pthread_t thread;
- volatile int running;
-} AndroidData;
-
-#define STREAM_MUSIC 3
-#define CHANNEL_CONFIGURATION_MONO 2
-#define CHANNEL_CONFIGURATION_STEREO 3
-#define ENCODING_PCM_8BIT 3
-#define ENCODING_PCM_16BIT 2
-#define MODE_STREAM 1
-
-static void* thread_function(void* arg)
-{
- ALCdevice* device = (ALCdevice*)arg;
- AndroidData* data = (AndroidData*)device->ExtraData;
-
- JavaVM *javaVM = alcGetJavaVM();
- (*javaVM)->AttachCurrentThread(javaVM, &env, NULL);
-
- (*env)->PushLocalFrame(env, 2);
-
- int sampleRateInHz = device->Frequency;
- int channelConfig = ChannelsFromDevFmt(device->FmtChans) == 1 ? CHANNEL_CONFIGURATION_MONO : CHANNEL_CONFIGURATION_STEREO;
- int audioFormat = BytesFromDevFmt(device->FmtType) == 1 ? ENCODING_PCM_8BIT : ENCODING_PCM_16BIT;
-
- int bufferSizeInBytes = (*env)->CallStaticIntMethod(env, cAudioTrack,
- mGetMinBufferSize, sampleRateInHz, channelConfig, audioFormat);
-
- // Suggestion from Eric Wing
- /* According to the author Martins Mozelko, I should multiply bufferSizeInBytes to tune performance.
- Say, multiply by 2.
- But making this number smaller seems to reduce latency...
- I have tried dividing by 2, 4, and 8. 8 refuses to play any sound.
- It seems that this just divides out the multiplication of NumUpdates (default=4)
- which returns it to min buffer size.
- bufferSizeInBytes is used in multiple places and
- bufferSizeInSamples is tied directly to bufferSizeInBytes though, so we need to be careful
- about what we want to change.
- I'm assuming Martins is correct and this is the indeed the place we want to change it.
- Dividing out the bufferSizeInSamples separately and skipping the multiply did not work.
- Omitting the multiply and not dividing did work, but the buffers may be unnecessarily large.
- */
- bufferSizeInBytes = bufferSizeInBytes / device->NumUpdates;
-
- int bufferSizeInSamples = bufferSizeInBytes / FrameSizeFromDevFmt(device->FmtChans, device->FmtType);
-
- jobject track = (*env)->NewObject(env, cAudioTrack, mAudioTrack,
- STREAM_MUSIC, sampleRateInHz, channelConfig, audioFormat, device->NumUpdates * bufferSizeInBytes, MODE_STREAM);
-
- (*env)->CallNonvirtualVoidMethod(env, track, cAudioTrack, mPlay);
- audioTrackPlaying = 1;
-
- jarray buffer = (*env)->NewByteArray(env, bufferSizeInBytes);
-
- while (data->running)
- {
- if (suspended) {
- if (audioTrackPlaying) {
- (*env)->CallNonvirtualVoidMethod(env, track, cAudioTrack, mPause);
- audioTrackPlaying = 0;
- }
- usleep(5000);
- continue;
- } else if (!audioTrackPlaying) {
- (*env)->CallNonvirtualVoidMethod(env, track, cAudioTrack, mPlay);
- audioTrackPlaying = 1;
- }
-
- void* pBuffer = (*env)->GetPrimitiveArrayCritical(env, buffer, NULL);
-
- if (pBuffer)
- {
- aluMixData(device, pBuffer, bufferSizeInSamples);
- (*env)->ReleasePrimitiveArrayCritical(env, buffer, pBuffer, 0);
-
- (*env)->CallNonvirtualIntMethod(env, track, cAudioTrack, mWrite, buffer, 0, bufferSizeInBytes);
- }
- else
- {
- AL_PRINT("Failed to get pointer to array bytes");
- }
- }
-
- (*env)->CallNonvirtualVoidMethod(env, track, cAudioTrack, mStop);
- (*env)->CallNonvirtualVoidMethod(env, track, cAudioTrack, mRelease);
- audioTrackPlaying = 0;
-
- (*env)->PopLocalFrame(env, NULL);
-
- (*javaVM)->DetachCurrentThread(javaVM);
- return NULL;
-}
-
-static ALCboolean android_open_playback(ALCdevice *device, const ALCchar *deviceName)
-{
- JavaVM *javaVM = alcGetJavaVM();
- (*javaVM)->AttachCurrentThread(javaVM, &env, NULL);
- AndroidData* data;
- int channels;
- int bytes;
-
- if (!cAudioTrack)
- {
- /* Cache AudioTrack class and it's method id's
- * And do this only once!
- */
-
- cAudioTrack = (*env)->FindClass(env, "android/media/AudioTrack");
- if (!cAudioTrack)
- {
- AL_PRINT("android.media.AudioTrack class is not found. Are you running at least 1.5 version?");
- return ALC_FALSE;
- }
-
- cAudioTrack = (*env)->NewGlobalRef(env, cAudioTrack);
-
- mAudioTrack = (*env)->GetMethodID(env, cAudioTrack, "", "(IIIIII)V");
- mGetMinBufferSize = (*env)->GetStaticMethodID(env, cAudioTrack, "getMinBufferSize", "(III)I");
- mPlay = (*env)->GetMethodID(env, cAudioTrack, "play", "()V");
- mPause = (*env)->GetMethodID(env, cAudioTrack, "pause", "()V");
- mStop = (*env)->GetMethodID(env, cAudioTrack, "stop", "()V");
- mRelease = (*env)->GetMethodID(env, cAudioTrack, "release", "()V");
- mWrite = (*env)->GetMethodID(env, cAudioTrack, "write", "([BII)I");
- }
-
- if (!deviceName)
- {
- deviceName = android_device;
- }
- else if (strcmp(deviceName, android_device) != 0)
- {
- return ALC_FALSE;
- }
-
- data = (AndroidData*)calloc(1, sizeof(*data));
- device->szDeviceName = strdup(deviceName);
- device->ExtraData = data;
- return ALC_TRUE;
-}
-
-static void android_close_playback(ALCdevice *device)
-{
- AndroidData* data = (AndroidData*)device->ExtraData;
- if (data != NULL)
- {
- free(data);
- device->ExtraData = NULL;
- }
-}
-
-static ALCboolean android_reset_playback(ALCdevice *device)
-{
- AndroidData* data = (AndroidData*)device->ExtraData;
-
- // if (ChannelsFromDevFmt(device->FmtChans) >= 2)
- // {
- // device->Format = BytesFromDevFmt(device->FmtType) >= 2 ? AL_FORMAT_STEREO16 : AL_FORMAT_STEREO8;
- // }
- // else
- // {
- // device->Format = BytesFromDevFmt(device->FmtType) >= 2 ? AL_FORMAT_MONO16 : AL_FORMAT_MONO8;
- // }
-
- SetDefaultChannelOrder(device);
-
- data->running = 1;
- pthread_create(&data->thread, NULL, thread_function, device);
-
- return ALC_TRUE;
-}
-
-static void android_stop_playback(ALCdevice *device)
-{
- AndroidData* data = (AndroidData*)device->ExtraData;
-
- if (data->running)
- {
- data->running = 0;
- pthread_join(data->thread, NULL);
- }
- suspended = 0;
-}
-
-static ALCboolean android_open_capture(ALCdevice *pDevice, const ALCchar *deviceName)
-{
- (void)pDevice;
- (void)deviceName;
- return ALC_FALSE;
-}
-
-static void android_close_capture(ALCdevice *pDevice)
-{
- (void)pDevice;
-}
-
-static void android_start_capture(ALCdevice *pDevice)
-{
- (void)pDevice;
-}
-
-static void android_stop_capture(ALCdevice *pDevice)
-{
- (void)pDevice;
-}
-
-static void android_capture_samples(ALCdevice *pDevice, ALCvoid *pBuffer, ALCuint lSamples)
-{
- (void)pDevice;
- (void)pBuffer;
- (void)lSamples;
-}
-
-static ALCuint android_available_samples(ALCdevice *pDevice)
-{
- (void)pDevice;
- return 0;
-}
-
-static const BackendFuncs android_funcs = {
- android_open_playback,
- android_close_playback,
- android_reset_playback,
- android_stop_playback,
- android_open_capture,
- android_close_capture,
- android_start_capture,
- android_stop_capture,
- android_capture_samples,
- android_available_samples
-};
-
-static void alc_audiotrack_suspend()
-{
- suspended = 1;
- audioTrackWasPlaying = audioTrackPlaying;
-}
-
-static void alc_audiotrack_resume()
-{
- suspended = 0;
- if (audioTrackWasPlaying)
- {
- while (!audioTrackPlaying)
- {
- sched_yield();
- }
- audioTrackWasPlaying = 0;
- }
-}
-
-
-void alc_audiotrack_init(BackendFuncs *func_list)
-{
- *func_list = android_funcs;
-
- if (apportableOpenALFuncs.alc_android_suspend == NULL
- && apportableOpenALFuncs.alc_android_set_java_vm == NULL) {
- apportableOpenALFuncs.alc_android_suspend = alc_audiotrack_suspend;
- apportableOpenALFuncs.alc_android_resume = alc_audiotrack_resume;
- }
-}
-
-void alc_audiotrack_deinit(void)
-{
- /* release cached AudioTrack class */
- JavaVM *javaVM = alcGetJavaVM();
- (*env)->DeleteGlobalRef(env, cAudioTrack);
- (*javaVM)->DetachCurrentThread(javaVM);
- cAudioTrack = NULL;
-}
-
-void alc_audiotrack_probe(int type)
-{
- if (type == DEVICE_PROBE)
- {
- AppendDeviceList(android_device);
- }
- else if (type == ALL_DEVICE_PROBE)
- {
- AppendAllDeviceList(android_device);
- }
-}
diff --git a/internal/c/parts/audio/out/android/OpenAL/Alc/audiotrack.m b/internal/c/parts/audio/out/android/OpenAL/Alc/audiotrack.m
deleted file mode 100644
index 8fe664a21..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Alc/audiotrack.m
+++ /dev/null
@@ -1,304 +0,0 @@
-/**
- * OpenAL cross platform audio library
- *
- * Copyright 2013 Apportable Inc.
- *
- * Copyright (C) 2010 by Chris Robinson
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- * Or go to http://www.gnu.org/copyleft/lgpl.html
- */
-
-#import "config.h"
-
-#import
-#import
-#import
-#import "alMain.h"
-#import "AL/al.h"
-#import "AL/alc.h"
-
-#import "apportable_openal_funcs.h"
-#import
-#import
-
-static const ALCchar android_device[] = "Android Default";
-
-static int suspended = 0;
-static int audioTrackPlaying = 0;
-static int audioTrackWasPlaying = 0;
-
-typedef struct
-{
- pthread_t thread;
- volatile int running;
-} AndroidData;
-
-#define STREAM_MUSIC 3
-#define CHANNEL_CONFIGURATION_MONO 2
-#define CHANNEL_CONFIGURATION_STEREO 3
-#define ENCODING_PCM_8BIT 3
-#define ENCODING_PCM_16BIT 2
-#define MODE_STREAM 1
-
-static void* thread_function(void* arg)
-{
- @autoreleasepool
- {
- ALCdevice* device = (ALCdevice*)arg;
- AndroidData* data = (AndroidData*)device->ExtraData;
-
- int sampleRateInHz = device->Frequency;
- int channelConfig = ChannelsFromDevFmt(device->FmtChans) == 1 ? CHANNEL_CONFIGURATION_MONO : CHANNEL_CONFIGURATION_STEREO;
- int audioFormat = BytesFromDevFmt(device->FmtType) == 1 ? ENCODING_PCM_8BIT : ENCODING_PCM_16BIT;
- int bufferSizeInBytes = [AndroidAudioTrack minBufferSizeWithSampleRate:sampleRateInHz channelConfig:channelConfig audioFormat:audioFormat];
-
- // Suggestion from Eric Wing
- /* According to the author Martins Mozelko, I should multiply bufferSizeInBytes to tune performance.
- Say, multiply by 2.
- But making this number smaller seems to reduce latency...
- I have tried dividing by 2, 4, and 8. 8 refuses to play any sound.
- It seems that this just divides out the multiplication of NumUpdates (default=4)
- which returns it to min buffer size.
- bufferSizeInBytes is used in multiple places and
- bufferSizeInSamples is tied directly to bufferSizeInBytes though, so we need to be careful
- about what we want to change.
- I'm assuming Martins is correct and this is the indeed the place we want to change it.
- Dividing out the bufferSizeInSamples separately and skipping the multiply did not work.
- Omitting the multiply and not dividing did work, but the buffers may be unnecessarily large.
- */
- bufferSizeInBytes = bufferSizeInBytes / device->NumUpdates;
-
- int bufferSizeInSamples = bufferSizeInBytes / FrameSizeFromDevFmt(device->FmtChans, device->FmtType);
-
- AndroidAudioTrack *track = [[AndroidAudioTrack alloc]
- initWithStreamType:STREAM_MUSIC
- sampleRate:sampleRateInHz
- channelConfig:channelConfig
- audioFormat:audioFormat
- bufferSize:device->NumUpdates * bufferSizeInBytes
- mode:MODE_STREAM];
-
- [track play];
- audioTrackPlaying = 1;
-
- // Use JNI to avoid an extra copy of the audio buffer. Calling write through BridgeKit
- // would require using an NSMutableData for the buffer, which would be copied to a new
- // byte[] object on every write call.
-
- JNIEnv *env = [[NSThread currentThread] env];
- (*env)->PushLocalFrame(env, 1);
- jarray buffer = (*env)->NewByteArray(env, bufferSizeInBytes);
- jclass trackClass = [track javaClass].javaClass;
- jmethodID writeMethod = (*env)->GetMethodID(env, trackClass, "write", "([BII)I");
-
- while (data->running)
- {
- if (suspended) {
- if (audioTrackPlaying) {
- [track pause];
- audioTrackPlaying = 0;
- }
- usleep(5000);
- continue;
- } else if (!audioTrackPlaying) {
- [track play];
- audioTrackPlaying = 1;
- }
-
- void* pBuffer = (*env)->GetPrimitiveArrayCritical(env, buffer, NULL);
-
- if (pBuffer)
- {
- aluMixData(device, pBuffer, bufferSizeInSamples);
- (*env)->ReleasePrimitiveArrayCritical(env, buffer, pBuffer, 0);
-
- (*env)->CallNonvirtualIntMethod(env, track->_object, trackClass, writeMethod, buffer, 0, bufferSizeInBytes);
- }
- else
- {
- AL_PRINT("Failed to get pointer to array bytes");
- }
- }
-
- [track stop];
- [track release];
- audioTrackPlaying = 0;
-
- (*env)->PopLocalFrame(env, NULL);
-
- return NULL;
- }
-}
-
-static ALCboolean android_open_playback(ALCdevice *device, const ALCchar *deviceName)
-{
- AndroidData* data;
- int channels;
- int bytes;
-
- if (!deviceName)
- {
- deviceName = android_device;
- }
- else if (strcmp(deviceName, android_device) != 0)
- {
- return ALC_FALSE;
- }
-
- data = (AndroidData*)calloc(1, sizeof(*data));
- device->szDeviceName = strdup(deviceName);
- device->ExtraData = data;
- return ALC_TRUE;
-}
-
-static void android_close_playback(ALCdevice *device)
-{
- AndroidData* data = (AndroidData*)device->ExtraData;
- if (data != NULL)
- {
- free(data);
- device->ExtraData = NULL;
- }
-}
-
-static ALCboolean android_reset_playback(ALCdevice *device)
-{
- AndroidData* data = (AndroidData*)device->ExtraData;
-
- // if (ChannelsFromDevFmt(device->FmtChans) >= 2)
- // {
- // device->Format = BytesFromDevFmt(device->FmtType) >= 2 ? AL_FORMAT_STEREO16 : AL_FORMAT_STEREO8;
- // }
- // else
- // {
- // device->Format = BytesFromDevFmt(device->FmtType) >= 2 ? AL_FORMAT_MONO16 : AL_FORMAT_MONO8;
- // }
-
- SetDefaultChannelOrder(device);
-
- data->running = 1;
- pthread_create(&data->thread, NULL, thread_function, device);
-
- return ALC_TRUE;
-}
-
-static void android_stop_playback(ALCdevice *device)
-{
- AndroidData* data = (AndroidData*)device->ExtraData;
-
- if (data->running)
- {
- data->running = 0;
- pthread_join(data->thread, NULL);
- }
- suspended = 0;
-}
-
-static ALCboolean android_open_capture(ALCdevice *pDevice, const ALCchar *deviceName)
-{
- (void)pDevice;
- (void)deviceName;
- return ALC_FALSE;
-}
-
-static void android_close_capture(ALCdevice *pDevice)
-{
- (void)pDevice;
-}
-
-static void android_start_capture(ALCdevice *pDevice)
-{
- (void)pDevice;
-}
-
-static void android_stop_capture(ALCdevice *pDevice)
-{
- (void)pDevice;
-}
-
-static void android_capture_samples(ALCdevice *pDevice, ALCvoid *pBuffer, ALCuint lSamples)
-{
- (void)pDevice;
- (void)pBuffer;
- (void)lSamples;
-}
-
-static ALCuint android_available_samples(ALCdevice *pDevice)
-{
- (void)pDevice;
- return 0;
-}
-
-static const BackendFuncs android_funcs = {
- android_open_playback,
- android_close_playback,
- android_reset_playback,
- android_stop_playback,
- android_open_capture,
- android_close_capture,
- android_start_capture,
- android_stop_capture,
- android_capture_samples,
- android_available_samples
-};
-
-static void alc_audiotrack_suspend()
-{
- suspended = 1;
- audioTrackWasPlaying = audioTrackPlaying;
-}
-
-static void alc_audiotrack_resume()
-{
- suspended = 0;
- if (audioTrackWasPlaying)
- {
- while (!audioTrackPlaying)
- {
- sched_yield();
- }
- audioTrackWasPlaying = 0;
- }
-}
-
-
-void alc_audiotrack_init(BackendFuncs *func_list)
-{
- *func_list = android_funcs;
-
- if (apportableOpenALFuncs.alc_android_suspend == NULL
- && apportableOpenALFuncs.alc_android_set_java_vm == NULL) {
- apportableOpenALFuncs.alc_android_suspend = alc_audiotrack_suspend;
- apportableOpenALFuncs.alc_android_resume = alc_audiotrack_resume;
- }
-}
-
-void alc_audiotrack_deinit(void)
-{
-}
-
-void alc_audiotrack_probe(int type)
-{
- if (type == DEVICE_PROBE)
- {
- AppendDeviceList(android_device);
- }
- else if (type == ALL_DEVICE_PROBE)
- {
- AppendAllDeviceList(android_device);
- }
-}
diff --git a/internal/c/parts/audio/out/android/OpenAL/Alc/bs2b.c b/internal/c/parts/audio/out/android/OpenAL/Alc/bs2b.c
deleted file mode 100644
index 36f946a1f..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Alc/bs2b.c
+++ /dev/null
@@ -1,209 +0,0 @@
-/*-
- * Copyright (c) 2005 Boris Mikhaylov
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include "config.h"
-
-#include
-
-#include "bs2b.h"
-
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
-/* Single pole IIR filter.
- * O[n] = a0*I[n] + a1*I[n-1] + b1*O[n-1]
- */
-
-/* Lowpass filter */
-#define lo_filter(in, out_1) (bs2b->a0_lo*(in) + bs2b->b1_lo*(out_1))
-
-/* Highboost filter */
-#define hi_filter(in, in_1, out_1) (bs2b->a0_hi*(in) + bs2b->a1_hi*(in_1) + bs2b->b1_hi*(out_1))
-
-/* Set up all data. */
-static void init(struct bs2b *bs2b)
-{
- double Fc_lo, Fc_hi;
- double G_lo, G_hi;
- double x;
-
- if ((bs2b->srate > 192000) || (bs2b->srate < 2000))
- bs2b->srate = BS2B_DEFAULT_SRATE;
-
- switch(bs2b->level)
- {
- case BS2B_LOW_CLEVEL: /* Low crossfeed level */
- Fc_lo = 360.0;
- Fc_hi = 501.0;
- G_lo = 0.398107170553497;
- G_hi = 0.205671765275719;
- break;
-
- case BS2B_MIDDLE_CLEVEL: /* Middle crossfeed level */
- Fc_lo = 500.0;
- Fc_hi = 711.0;
- G_lo = 0.459726988530872;
- G_hi = 0.228208484414988;
- break;
-
- case BS2B_HIGH_CLEVEL: /* High crossfeed level (virtual speakers are closer to itself) */
- Fc_lo = 700.0;
- Fc_hi = 1021.0;
- G_lo = 0.530884444230988;
- G_hi = 0.250105790667544;
- break;
-
- case BS2B_LOW_ECLEVEL: /* Low easy crossfeed level */
- Fc_lo = 360.0;
- Fc_hi = 494.0;
- G_lo = 0.316227766016838;
- G_hi = 0.168236228897329;
- break;
-
- case BS2B_MIDDLE_ECLEVEL: /* Middle easy crossfeed level */
- Fc_lo = 500.0;
- Fc_hi = 689.0;
- G_lo = 0.354813389233575;
- G_hi = 0.187169483835901;
- break;
-
- default: /* High easy crossfeed level */
- bs2b->level = BS2B_HIGH_ECLEVEL;
-
- Fc_lo = 700.0;
- Fc_hi = 975.0;
- G_lo = 0.398107170553497;
- G_hi = 0.205671765275719;
- break;
- } /* switch */
-
- /* $fc = $Fc / $s;
- * $d = 1 / 2 / pi / $fc;
- * $x = exp(-1 / $d);
- */
-
- x = exp(-2.0 * M_PI * Fc_lo / bs2b->srate);
- bs2b->b1_lo = x;
- bs2b->a0_lo = G_lo * (1.0 - x);
-
- x = exp(-2.0 * M_PI * Fc_hi / bs2b->srate);
- bs2b->b1_hi = x;
- bs2b->a0_hi = 1.0 - G_hi * (1.0 - x);
- bs2b->a1_hi = -x;
-
- bs2b->gain = 1.0 / (1.0 - G_hi + G_lo);
-} /* init */
-
-/* Exported functions.
- * See descriptions in "bs2b.h"
- */
-
-void bs2b_set_level(struct bs2b *bs2b, int level)
-{
- if(level == bs2b->level)
- return;
- bs2b->level = level;
- init(bs2b);
-} /* bs2b_set_level */
-
-int bs2b_get_level(struct bs2b *bs2b)
-{
- return bs2b->level;
-} /* bs2b_get_level */
-
-void bs2b_set_srate(struct bs2b *bs2b, int srate)
-{
- if (srate == bs2b->srate)
- return;
- bs2b->srate = srate;
- init(bs2b);
-} /* bs2b_set_srate */
-
-int bs2b_get_srate(struct bs2b *bs2b)
-{
- return bs2b->srate;
-} /* bs2b_get_srate */
-
-void bs2b_clear(struct bs2b *bs2b)
-{
- int loopv = sizeof(bs2b->last_sample);
-
- while (loopv)
- {
- ((char *)&bs2b->last_sample)[--loopv] = 0;
- }
-} /* bs2b_clear */
-
-int bs2b_is_clear(struct bs2b *bs2b)
-{
- int loopv = sizeof(bs2b->last_sample);
-
- while (loopv)
- {
- if (((char *)&bs2b->last_sample)[--loopv] != 0)
- return 0;
- }
- return 1;
-} /* bs2b_is_clear */
-
-void bs2b_cross_feed(struct bs2b *bs2b, ALfp *ALsample)
-{
- //FIXME fully convert to fixed point math
- float sample[2];
- sample[0] = ALfp2float(ALsample[0]);
- sample[1] = ALfp2float(ALsample[1]);
-
- /* Lowpass filter */
- bs2b->last_sample.lo[0] = lo_filter(sample[0], bs2b->last_sample.lo[0]);
- bs2b->last_sample.lo[1] = lo_filter(sample[1], bs2b->last_sample.lo[1]);
-
- /* Highboost filter */
- bs2b->last_sample.hi[0] = hi_filter(sample[0], bs2b->last_sample.asis[0], bs2b->last_sample.hi[0]);
- bs2b->last_sample.hi[1] = hi_filter(sample[1], bs2b->last_sample.asis[1], bs2b->last_sample.hi[1]);
- bs2b->last_sample.asis[0] = sample[0];
- bs2b->last_sample.asis[1] = sample[1];
-
- /* Crossfeed */
- sample[0] = bs2b->last_sample.hi[0] + bs2b->last_sample.lo[1];
- sample[1] = bs2b->last_sample.hi[1] + bs2b->last_sample.lo[0];
-
- /* Bass boost cause allpass attenuation */
- sample[0] *= bs2b->gain;
- sample[1] *= bs2b->gain;
-
- /* Clipping of overloaded samples */
-#if 0
- if (sample[0] > 1.0)
- sample[0] = 1.0;
- if (sample[0] < -1.0)
- sample[0] = -1.0;
- if (sample[1] > 1.0)
- sample[1] = 1.0;
- if (sample[1] < -1.0)
- sample[1] = -1.0;
-#endif
-
- ALsample[0] = float2ALfp(sample[0]);
- ALsample[1] = float2ALfp(sample[1]);
-} /* bs2b_cross_feed */
diff --git a/internal/c/parts/audio/out/android/OpenAL/Alc/bs2b.h b/internal/c/parts/audio/out/android/OpenAL/Alc/bs2b.h
deleted file mode 100644
index 46696d970..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Alc/bs2b.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*-
- * Copyright (c) 2005 Boris Mikhaylov
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#ifndef BS2B_H
-#define BS2B_H
-
-#include "AL/al.h"
-
-/* Number of crossfeed levels */
-#define BS2B_CLEVELS 3
-
-/* Normal crossfeed levels */
-#define BS2B_HIGH_CLEVEL 3
-#define BS2B_MIDDLE_CLEVEL 2
-#define BS2B_LOW_CLEVEL 1
-
-/* Easy crossfeed levels */
-#define BS2B_HIGH_ECLEVEL BS2B_HIGH_CLEVEL + BS2B_CLEVELS
-#define BS2B_MIDDLE_ECLEVEL BS2B_MIDDLE_CLEVEL + BS2B_CLEVELS
-#define BS2B_LOW_ECLEVEL BS2B_LOW_CLEVEL + BS2B_CLEVELS
-
-/* Default crossfeed levels */
-#define BS2B_DEFAULT_CLEVEL BS2B_HIGH_ECLEVEL
-/* Default sample rate (Hz) */
-#define BS2B_DEFAULT_SRATE 44100
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-struct bs2b {
- int level; /* Crossfeed level */
- int srate; /* Sample rate (Hz) */
-
- /* Lowpass IIR filter coefficients */
- double a0_lo;
- double b1_lo;
-
- /* Highboost IIR filter coefficients */
- double a0_hi;
- double a1_hi;
- double b1_hi;
-
- /* Global gain against overloading */
- double gain;
-
- /* Buffer of last filtered sample.
- * [0] - first channel, [1] - second channel
- */
- struct t_last_sample {
- double asis[2];
- double lo[2];
- double hi[2];
- } last_sample;
-};
-
-/* Clear buffers and set new coefficients with new crossfeed level value.
- * level - crossfeed level of *LEVEL values.
- */
-void bs2b_set_level(struct bs2b *bs2b, int level);
-
-/* Return current crossfeed level value */
-int bs2b_get_level(struct bs2b *bs2b);
-
-/* Clear buffers and set new coefficients with new sample rate value.
- * srate - sample rate by Hz.
- */
-void bs2b_set_srate(struct bs2b *bs2b, int srate);
-
-/* Return current sample rate value */
-int bs2b_get_srate(struct bs2b *bs2b);
-
-/* Clear buffer */
-void bs2b_clear(struct bs2b *bs2b);
-
-/* Return 1 if buffer is clear */
-int bs2b_is_clear(struct bs2b *bs2b);
-
-/* Crossfeeds one stereo sample that are pointed by sample.
- * [0] - first channel, [1] - second channel.
- * Returns crossfided samle by sample pointer.
- */
-
-/* sample points to floats */
-void bs2b_cross_feed(struct bs2b *bs2b, ALfp *sample);
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif /* __cplusplus */
-
-#endif /* BS2B_H */
diff --git a/internal/c/parts/audio/out/android/OpenAL/Alc/config.h b/internal/c/parts/audio/out/android/OpenAL/Alc/config.h
deleted file mode 100644
index 7016963e1..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Alc/config.h
+++ /dev/null
@@ -1,125 +0,0 @@
-#ifndef CONFIG_H
-#define CONFIG_H
-
-/* Define to the library version */
-#define ALSOFT_VERSION "1.12.854"
-
-#define AL_BUILD_LIBRARY
-
-/* Define if we have the Android backend */
-#if defined(ANDROID)
-
-// Stereo only on Android back-ends
-#define MAXCHANNELS 3
-#define STEREO_ONLY 1
-
-#if defined(POST_FROYO)
-#define HAVE_OPENSLES 1
-#endif
-
-#define HAVE_AUDIOTRACK 1
-
-// For throttling AlSource.c
-
-#ifndef MAX_SOURCES_LOW
-#define MAX_SOURCES_LOW 4
-#endif
-#ifndef MAX_SOURCES_START
-#define MAX_SOURCES_START 8
-#endif
-#ifndef MAX_SOURCES_HIGH
-#define MAX_SOURCES_HIGH 64
-#endif
-#endif
-
-/* Define if we have the ALSA backend */
-/* #cmakedefine HAVE_ALSA */
-
-/* Define if we have the OSS backend */
-/* #cmakedefine HAVE_OSS */
-
-/* Define if we have the Solaris backend */
-/* #cmakedefine HAVE_SOLARIS */
-
-/* Define if we have the DSound backend */
-/* #cmakedefine HAVE_DSOUND */
-
-/* Define if we have the Wave Writer backend */
-/* #cmakedefine HAVE_WAVE */
-
-/* Define if we have the Windows Multimedia backend */
-/* #cmakedefine HAVE_WINMM */
-
-/* Define if we have the PortAudio backend */
-/* #cmakedefine HAVE_PORTAUDIO */
-
-/* Define if we have the PulseAudio backend */
-/* #cmakedefine HAVE_PULSEAUDIO */
-
-/* Define if we have dlfcn.h */
-#define HAVE_DLFCN_H 1
-
-/* Define if we have the stat function */
-#define HAVE_STAT 1
-
-/* Define if we have the powf function */
-#define HAVE_POWF 1
-
-/* Define if we have the sqrtf function */
-#define HAVE_SQRTF 1
-
-/* Define if we have the acosf function */
-#define HAVE_ACOSF 1
-
-/* Define if we have the atanf function */
-#define HAVE_ATANF 1
-
-/* Define if we have the fabsf function */
-#define HAVE_FABSF 1
-
-/* Define if we have the strtof function */
-#define HAVE_STRTOF 1
-
-/* Define if we have stdint.h */
-#define HAVE_STDINT_H 1
-
-/* Define if we have the __int64 type */
-/* #cmakedefine HAVE___INT64 */
-
-/* Define to the size of a long int type */
-#define SIZEOF_LONG 4
-
-/* Define to the size of a long long int type */
-#define SIZEOF_LONG_LONG 8
-
-/* Define to the size of an unsigned int type */
-#define SIZEOF_UINT 4
-
-/* Define to the size of a void pointer type */
-#define SIZEOF_VOIDP 4
-
-/* Define if we have GCC's destructor attribute */
-#define HAVE_GCC_DESTRUCTOR 1
-
-/* Define if we have GCC's format attribute */
-#define HAVE_GCC_FORMAT 1
-
-/* Define if we have pthread_np.h */
-/* #cmakedefine HAVE_PTHREAD_NP_H */
-
-/* Define if we have float.h */
-/* #cmakedefine HAVE_FLOAT_H */
-
-/* Define if we have fenv.h */
-#define HAVE_FENV_H 1
-
-/* Define if we have fesetround() */
-/* #cmakedefine HAVE_FESETROUND */
-
-/* Define if we have _controlfp() */
-/* #cmakedefine HAVE__CONTROLFP */
-
-/* Define if we have pthread_setschedparam() */
-#define HAVE_PTHREAD_SETSCHEDPARAM 1
-
-#endif
diff --git a/internal/c/parts/audio/out/android/OpenAL/Alc/dsound.c b/internal/c/parts/audio/out/android/OpenAL/Alc/dsound.c
deleted file mode 100644
index 26e6d46f9..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Alc/dsound.c
+++ /dev/null
@@ -1,612 +0,0 @@
-/**
- * OpenAL cross platform audio library
- * Copyright (C) 1999-2007 by authors.
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- * Or go to http://www.gnu.org/copyleft/lgpl.html
- */
-
-#include "config.h"
-
-#define _WIN32_WINNT 0x0500
-#define INITGUID
-#include
-#include
-#include
-
-#include
-#include
-#include
-#ifndef _WAVEFORMATEXTENSIBLE_
-#include
-#include
-#endif
-
-#include "alMain.h"
-#include "AL/al.h"
-#include "AL/alc.h"
-
-#ifndef DSSPEAKER_5POINT1
-#define DSSPEAKER_5POINT1 6
-#endif
-#ifndef DSSPEAKER_7POINT1
-#define DSSPEAKER_7POINT1 7
-#endif
-
-DEFINE_GUID(KSDATAFORMAT_SUBTYPE_PCM, 0x00000001, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
-DEFINE_GUID(KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, 0x00000003, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
-
-static void *ds_handle;
-static HRESULT (WINAPI *pDirectSoundCreate)(LPCGUID pcGuidDevice, LPDIRECTSOUND *ppDS, LPUNKNOWN pUnkOuter);
-static HRESULT (WINAPI *pDirectSoundEnumerateA)(LPDSENUMCALLBACKA pDSEnumCallback, LPVOID pContext);
-
-
-typedef struct {
- // DirectSound Playback Device
- LPDIRECTSOUND lpDS;
- LPDIRECTSOUNDBUFFER DSpbuffer;
- LPDIRECTSOUNDBUFFER DSsbuffer;
-
- volatile int killNow;
- ALvoid *thread;
-} DSoundData;
-
-
-typedef struct {
- ALCchar *name;
- GUID guid;
-} DevMap;
-
-static const ALCchar dsDevice[] = "DirectSound Default";
-static DevMap *DeviceList;
-static ALuint NumDevices;
-
-
-void *DSoundLoad(void)
-{
- if(!ds_handle)
- {
-#ifdef _WIN32
- ds_handle = LoadLibraryA("dsound.dll");
- if(ds_handle == NULL)
- {
- AL_PRINT("Failed to load dsound.dll\n");
- return NULL;
- }
-
-#define LOAD_FUNC(f) do { \
- p##f = (void*)GetProcAddress((HMODULE)ds_handle, #f); \
- if(p##f == NULL) \
- { \
- FreeLibrary(ds_handle); \
- ds_handle = NULL; \
- AL_PRINT("Could not load %s from dsound.dll\n", #f); \
- return NULL; \
- } \
-} while(0)
-#else
- ds_handle = (void*)0xDEADBEEF;
-#define LOAD_FUNC(f) p##f = f
-#endif
-
-LOAD_FUNC(DirectSoundCreate);
-LOAD_FUNC(DirectSoundEnumerateA);
-#undef LOAD_FUNC
- }
- return ds_handle;
-}
-
-
-static BOOL CALLBACK DSoundEnumDevices(LPGUID guid, LPCSTR desc, LPCSTR drvname, LPVOID data)
-{
- char str[1024];
- void *temp;
- int count;
- ALuint i;
-
- (void)data;
- (void)drvname;
-
- if(NumDevices == 0)
- {
- temp = realloc(DeviceList, sizeof(DevMap) * (NumDevices+1));
- if(temp)
- {
- DeviceList = temp;
- DeviceList[NumDevices].name = strdup(dsDevice);
- DeviceList[NumDevices].guid = GUID_NULL;
- NumDevices++;
- }
- }
-
- if(!guid)
- return TRUE;
-
- count = 0;
- do {
- if(count == 0)
- snprintf(str, sizeof(str), "%s via DirectSound", desc);
- else
- snprintf(str, sizeof(str), "%s #%d via DirectSound", desc, count+1);
- count++;
-
- for(i = 0;i < NumDevices;i++)
- {
- if(strcmp(str, DeviceList[i].name) == 0)
- break;
- }
- } while(i != NumDevices);
-
- temp = realloc(DeviceList, sizeof(DevMap) * (NumDevices+1));
- if(temp)
- {
- DeviceList = temp;
- DeviceList[NumDevices].name = strdup(str);
- DeviceList[NumDevices].guid = *guid;
- NumDevices++;
- }
-
- return TRUE;
-}
-
-
-static ALuint DSoundProc(ALvoid *ptr)
-{
- ALCdevice *pDevice = (ALCdevice*)ptr;
- DSoundData *pData = (DSoundData*)pDevice->ExtraData;
- DSBCAPS DSBCaps;
- DWORD LastCursor = 0;
- DWORD PlayCursor;
- VOID *WritePtr1, *WritePtr2;
- DWORD WriteCnt1, WriteCnt2;
- BOOL Playing = FALSE;
- DWORD FrameSize;
- DWORD FragSize;
- DWORD avail;
- HRESULT err;
-
- SetRTPriority();
-
- memset(&DSBCaps, 0, sizeof(DSBCaps));
- DSBCaps.dwSize = sizeof(DSBCaps);
- err = IDirectSoundBuffer_GetCaps(pData->DSsbuffer, &DSBCaps);
- if(FAILED(err))
- {
- AL_PRINT("Failed to get buffer caps: 0x%lx\n", err);
- aluHandleDisconnect(pDevice);
- return 1;
- }
-
- FrameSize = FrameSizeFromDevFmt(pDevice->FmtChans, pDevice->FmtType);
- FragSize = pDevice->UpdateSize * FrameSize;
-
- IDirectSoundBuffer_GetCurrentPosition(pData->DSsbuffer, &LastCursor, NULL);
- while(!pData->killNow)
- {
- // Get current play and write cursors
- IDirectSoundBuffer_GetCurrentPosition(pData->DSsbuffer, &PlayCursor, NULL);
- avail = (PlayCursor-LastCursor+DSBCaps.dwBufferBytes) % DSBCaps.dwBufferBytes;
-
- if(avail < FragSize)
- {
- if(!Playing)
- {
- err = IDirectSoundBuffer_Play(pData->DSsbuffer, 0, 0, DSBPLAY_LOOPING);
- if(FAILED(err))
- {
- AL_PRINT("Failed to play buffer: 0x%lx\n", err);
- aluHandleDisconnect(pDevice);
- return 1;
- }
- Playing = TRUE;
- }
- Sleep(1);
- continue;
- }
- avail -= avail%FragSize;
-
- // Lock output buffer
- WriteCnt1 = 0;
- WriteCnt2 = 0;
- err = IDirectSoundBuffer_Lock(pData->DSsbuffer, LastCursor, avail, &WritePtr1, &WriteCnt1, &WritePtr2, &WriteCnt2, 0);
-
- // If the buffer is lost, restore it and lock
- if(err == DSERR_BUFFERLOST)
- {
- err = IDirectSoundBuffer_Restore(pData->DSsbuffer);
- if(SUCCEEDED(err))
- {
- Playing = FALSE;
- LastCursor = 0;
- err = IDirectSoundBuffer_Lock(pData->DSsbuffer, 0, DSBCaps.dwBufferBytes, &WritePtr1, &WriteCnt1, &WritePtr2, &WriteCnt2, 0);
- }
- }
-
- // Successfully locked the output buffer
- if(SUCCEEDED(err))
- {
- // If we have an active context, mix data directly into output buffer otherwise fill with silence
- aluMixData(pDevice, WritePtr1, WriteCnt1/FrameSize);
- aluMixData(pDevice, WritePtr2, WriteCnt2/FrameSize);
-
- // Unlock output buffer only when successfully locked
- IDirectSoundBuffer_Unlock(pData->DSsbuffer, WritePtr1, WriteCnt1, WritePtr2, WriteCnt2);
- }
- else
- {
- AL_PRINT("Buffer lock error: %#lx\n", err);
- aluHandleDisconnect(pDevice);
- return 1;
- }
-
- // Update old write cursor location
- LastCursor += WriteCnt1+WriteCnt2;
- LastCursor %= DSBCaps.dwBufferBytes;
- }
-
- return 0;
-}
-
-static ALCboolean DSoundOpenPlayback(ALCdevice *device, const ALCchar *deviceName)
-{
- DSoundData *pData = NULL;
- LPGUID guid = NULL;
- HRESULT hr;
-
- if(!DSoundLoad())
- return ALC_FALSE;
-
- if(!deviceName)
- deviceName = dsDevice;
- else if(strcmp(deviceName, dsDevice) != 0)
- {
- ALuint i;
-
- if(!DeviceList)
- {
- hr = pDirectSoundEnumerateA(DSoundEnumDevices, NULL);
- if(FAILED(hr))
- AL_PRINT("Error enumerating DirectSound devices (%#x)!\n", (unsigned int)hr);
- }
-
- for(i = 0;i < NumDevices;i++)
- {
- if(strcmp(deviceName, DeviceList[i].name) == 0)
- {
- if(i > 0)
- guid = &DeviceList[i].guid;
- break;
- }
- }
- if(i == NumDevices)
- return ALC_FALSE;
- }
-
- //Initialise requested device
- pData = calloc(1, sizeof(DSoundData));
- if(!pData)
- {
- alcSetError(device, ALC_OUT_OF_MEMORY);
- return ALC_FALSE;
- }
-
- //DirectSound Init code
- hr = pDirectSoundCreate(guid, &pData->lpDS, NULL);
- if(SUCCEEDED(hr))
- hr = IDirectSound_SetCooperativeLevel(pData->lpDS, GetForegroundWindow(), DSSCL_PRIORITY);
- if(FAILED(hr))
- {
- if(pData->lpDS)
- IDirectSound_Release(pData->lpDS);
- free(pData);
- AL_PRINT("Device init failed: 0x%08lx\n", hr);
- return ALC_FALSE;
- }
-
- device->szDeviceName = strdup(deviceName);
- device->ExtraData = pData;
- return ALC_TRUE;
-}
-
-static void DSoundClosePlayback(ALCdevice *device)
-{
- DSoundData *pData = device->ExtraData;
-
- IDirectSound_Release(pData->lpDS);
- free(pData);
- device->ExtraData = NULL;
-}
-
-static ALCboolean DSoundResetPlayback(ALCdevice *device)
-{
- DSoundData *pData = (DSoundData*)device->ExtraData;
- DSBUFFERDESC DSBDescription;
- WAVEFORMATEXTENSIBLE OutputType;
- DWORD speakers;
- HRESULT hr;
-
- memset(&OutputType, 0, sizeof(OutputType));
-
- switch(device->FmtType)
- {
- case DevFmtByte:
- device->FmtType = DevFmtUByte;
- break;
- case DevFmtUShort:
- device->FmtType = DevFmtShort;
- break;
- case DevFmtUByte:
- case DevFmtShort:
- case DevFmtFloat:
- break;
- }
-
- hr = IDirectSound_GetSpeakerConfig(pData->lpDS, &speakers);
- if(SUCCEEDED(hr) && ConfigValueExists(NULL, "format"))
- {
- switch(device->FmtChans)
- {
- case DevFmtMono:
- speakers = DSSPEAKER_COMBINED(DSSPEAKER_MONO, 0);
- break;
- case DevFmtStereo:
- speakers = DSSPEAKER_COMBINED(DSSPEAKER_STEREO, 0);
- break;
- case DevFmtQuad:
- speakers = DSSPEAKER_COMBINED(DSSPEAKER_QUAD, 0);
- break;
- case DevFmtX51:
- speakers = DSSPEAKER_COMBINED(DSSPEAKER_5POINT1, 0);
- break;
- case DevFmtX61:
- /* ??? */;
- break;
- case DevFmtX71:
- speakers = DSSPEAKER_COMBINED(DSSPEAKER_7POINT1, 0);
- break;
- }
- }
- if(SUCCEEDED(hr))
- {
- speakers = DSSPEAKER_CONFIG(speakers);
- if(speakers == DSSPEAKER_MONO)
- {
- device->FmtChans = DevFmtMono;
- OutputType.dwChannelMask = SPEAKER_FRONT_CENTER;
- }
- else if(speakers == DSSPEAKER_STEREO || speakers == DSSPEAKER_HEADPHONE)
- {
- device->FmtChans = DevFmtStereo;
- OutputType.dwChannelMask = SPEAKER_FRONT_LEFT |
- SPEAKER_FRONT_RIGHT;
- }
- else if(speakers == DSSPEAKER_QUAD)
- {
- device->FmtChans = DevFmtQuad;
- OutputType.dwChannelMask = SPEAKER_FRONT_LEFT |
- SPEAKER_FRONT_RIGHT |
- SPEAKER_BACK_LEFT |
- SPEAKER_BACK_RIGHT;
- }
- else if(speakers == DSSPEAKER_5POINT1)
- {
- device->FmtChans = DevFmtX51;
- OutputType.dwChannelMask = SPEAKER_FRONT_LEFT |
- SPEAKER_FRONT_RIGHT |
- SPEAKER_FRONT_CENTER |
- SPEAKER_LOW_FREQUENCY |
- SPEAKER_BACK_LEFT |
- SPEAKER_BACK_RIGHT;
- }
- else if(speakers == DSSPEAKER_7POINT1)
- {
- device->FmtChans = DevFmtX71;
- OutputType.dwChannelMask = SPEAKER_FRONT_LEFT |
- SPEAKER_FRONT_RIGHT |
- SPEAKER_FRONT_CENTER |
- SPEAKER_LOW_FREQUENCY |
- SPEAKER_BACK_LEFT |
- SPEAKER_BACK_RIGHT |
- SPEAKER_SIDE_LEFT |
- SPEAKER_SIDE_RIGHT;
- }
-
- OutputType.Format.wFormatTag = WAVE_FORMAT_PCM;
- OutputType.Format.nChannels = ChannelsFromDevFmt(device->FmtChans);
- OutputType.Format.wBitsPerSample = BytesFromDevFmt(device->FmtType) * 8;
- OutputType.Format.nBlockAlign = OutputType.Format.nChannels*OutputType.Format.wBitsPerSample/8;
- OutputType.Format.nSamplesPerSec = device->Frequency;
- OutputType.Format.nAvgBytesPerSec = OutputType.Format.nSamplesPerSec*OutputType.Format.nBlockAlign;
- OutputType.Format.cbSize = 0;
- }
-
- if(OutputType.Format.nChannels > 2 || OutputType.Format.wBitsPerSample > 16)
- {
- OutputType.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
- OutputType.Samples.wValidBitsPerSample = OutputType.Format.wBitsPerSample;
- OutputType.Format.cbSize = 22;
- if(OutputType.Format.wBitsPerSample == 32)
- OutputType.SubFormat = KSDATAFORMAT_SUBTYPE_IEEE_FLOAT;
- else
- OutputType.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
- }
- else
- {
- if(SUCCEEDED(hr))
- {
- memset(&DSBDescription,0,sizeof(DSBUFFERDESC));
- DSBDescription.dwSize=sizeof(DSBUFFERDESC);
- DSBDescription.dwFlags=DSBCAPS_PRIMARYBUFFER;
- hr = IDirectSound_CreateSoundBuffer(pData->lpDS, &DSBDescription, &pData->DSpbuffer, NULL);
- }
- if(SUCCEEDED(hr))
- hr = IDirectSoundBuffer_SetFormat(pData->DSpbuffer,&OutputType.Format);
- }
-
- if(SUCCEEDED(hr))
- {
- memset(&DSBDescription,0,sizeof(DSBUFFERDESC));
- DSBDescription.dwSize=sizeof(DSBUFFERDESC);
- DSBDescription.dwFlags=DSBCAPS_GLOBALFOCUS|DSBCAPS_GETCURRENTPOSITION2;
- DSBDescription.dwBufferBytes=device->UpdateSize * device->NumUpdates *
- OutputType.Format.nBlockAlign;
- DSBDescription.lpwfxFormat=&OutputType.Format;
- hr = IDirectSound_CreateSoundBuffer(pData->lpDS, &DSBDescription, &pData->DSsbuffer, NULL);
- }
-
- if(SUCCEEDED(hr))
- {
- SetDefaultWFXChannelOrder(device);
- pData->thread = StartThread(DSoundProc, device);
- if(!pData->thread)
- hr = E_FAIL;
- }
-
- if(FAILED(hr))
- {
- if (pData->DSsbuffer)
- IDirectSoundBuffer_Release(pData->DSsbuffer);
- pData->DSsbuffer = NULL;
- if (pData->DSpbuffer)
- IDirectSoundBuffer_Release(pData->DSpbuffer);
- pData->DSpbuffer = NULL;
- return ALC_FALSE;
- }
-
- return ALC_TRUE;
-}
-
-static void DSoundStopPlayback(ALCdevice *device)
-{
- DSoundData *pData = device->ExtraData;
-
- if(!pData->thread)
- return;
-
- pData->killNow = 1;
- StopThread(pData->thread);
- pData->thread = NULL;
-
- pData->killNow = 0;
-
- IDirectSoundBuffer_Release(pData->DSsbuffer);
- pData->DSsbuffer = NULL;
- if (pData->DSpbuffer)
- IDirectSoundBuffer_Release(pData->DSpbuffer);
- pData->DSpbuffer = NULL;
-}
-
-
-static ALCboolean DSoundOpenCapture(ALCdevice *pDevice, const ALCchar *deviceName)
-{
- (void)pDevice;
- (void)deviceName;
- return ALC_FALSE;
-}
-
-static void DSoundCloseCapture(ALCdevice *pDevice)
-{
- (void)pDevice;
-}
-
-static void DSoundStartCapture(ALCdevice *pDevice)
-{
- (void)pDevice;
-}
-
-static void DSoundStopCapture(ALCdevice *pDevice)
-{
- (void)pDevice;
-}
-
-static void DSoundCaptureSamples(ALCdevice *pDevice, ALCvoid *pBuffer, ALCuint lSamples)
-{
- (void)pDevice;
- (void)pBuffer;
- (void)lSamples;
-}
-
-static ALCuint DSoundAvailableSamples(ALCdevice *pDevice)
-{
- (void)pDevice;
- return 0;
-}
-
-
-BackendFuncs DSoundFuncs = {
- DSoundOpenPlayback,
- DSoundClosePlayback,
- DSoundResetPlayback,
- DSoundStopPlayback,
- DSoundOpenCapture,
- DSoundCloseCapture,
- DSoundStartCapture,
- DSoundStopCapture,
- DSoundCaptureSamples,
- DSoundAvailableSamples
-};
-
-
-void alcDSoundInit(BackendFuncs *FuncList)
-{
- *FuncList = DSoundFuncs;
-}
-
-void alcDSoundDeinit(void)
-{
- ALuint i;
-
- for(i = 0;i < NumDevices;++i)
- free(DeviceList[i].name);
- free(DeviceList);
- DeviceList = NULL;
- NumDevices = 0;
-
- if(ds_handle)
- {
-#ifdef _WIN32
- FreeLibrary(ds_handle);
-#endif
- ds_handle = NULL;
- }
-}
-
-void alcDSoundProbe(int type)
-{
- if(!DSoundLoad()) return;
-
- if(type == DEVICE_PROBE)
- AppendDeviceList(dsDevice);
- else if(type == ALL_DEVICE_PROBE)
- {
- HRESULT hr;
- ALuint i;
-
- for(i = 0;i < NumDevices;++i)
- free(DeviceList[i].name);
- free(DeviceList);
- DeviceList = NULL;
- NumDevices = 0;
-
- hr = pDirectSoundEnumerateA(DSoundEnumDevices, NULL);
- if(FAILED(hr))
- AL_PRINT("Error enumerating DirectSound devices (%#x)!\n", (unsigned int)hr);
- else
- {
- for(i = 0;i < NumDevices;i++)
- AppendAllDeviceList(DeviceList[i].name);
- }
- }
-}
diff --git a/internal/c/parts/audio/out/android/OpenAL/Alc/mixer.c b/internal/c/parts/audio/out/android/OpenAL/Alc/mixer.c
deleted file mode 100644
index 036441fd3..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Alc/mixer.c
+++ /dev/null
@@ -1,813 +0,0 @@
-/**
- * OpenAL cross platform audio library
- * Copyright (C) 1999-2007 by authors.
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- * Or go to http://www.gnu.org/copyleft/lgpl.html
- */
-
-#include "config.h"
-
-#include
-#include
-#include
-#include
-#include
-
-#include "alMain.h"
-#include "AL/al.h"
-#include "AL/alc.h"
-#include "alSource.h"
-#include "alBuffer.h"
-#include "alListener.h"
-#include "alAuxEffectSlot.h"
-#include "alu.h"
-#include "bs2b.h"
-
-
-static __inline ALdfp point32(const ALfp *vals, ALint step, ALint frac)
-{ return vals[0]; (void)step; (void)frac; }
-static __inline ALdfp lerp32(const ALfp *vals, ALint step, ALint frac)
-{ return lerp(vals[0], vals[step], ALfpMult(int2ALfp(frac), ALfpDiv(int2ALfp(1),int2ALfp(FRACTIONONE)))); }
-static __inline ALdfp cubic32(const ALfp *vals, ALint step, ALint frac)
-{ return cubic(vals[-step], vals[0], vals[step], vals[step+step],
- ALfpMult(int2ALfp(frac), ALfpDiv(int2ALfp(1),int2ALfp(FRACTIONONE)))); }
-
-static __inline ALdfp point16(const ALshort *vals, ALint step, ALint frac)
-{ return ALfpMult(int2ALfp(vals[0]), float2ALfp(1.0/32767.0)); (void)step; (void)frac; }
-static __inline ALdfp lerp16(const ALshort *vals, ALint step, ALint frac)
-{ return ALfpMult(lerp(int2ALfp(vals[0]), int2ALfp(vals[step]), ALfpMult(int2ALfp(frac), ALfpDiv(int2ALfp(1),int2ALfp(FRACTIONONE)))),
- float2ALfp(1.0/32767.0)); }
-static __inline ALdfp cubic16(const ALshort *vals, ALint step, ALint frac)
-{ return ALfpMult(cubic(int2ALfp(vals[-step]), int2ALfp(vals[0]), int2ALfp(vals[step]), int2ALfp(vals[step+step]),
- ALfpMult(int2ALfp(frac), ALfpDiv(int2ALfp(1),int2ALfp(FRACTIONONE)))), float2ALfp(1.0/32767.0)); }
-
-static __inline ALdfp point8(const ALubyte *vals, ALint step, ALint frac)
-{ return ALfpMult(int2ALfp((int)vals[0]-128), float2ALfp(1.0/127.0)); (void)step; (void)frac; }
-static __inline ALdfp lerp8(const ALubyte *vals, ALint step, ALint frac)
-{ return ALfpMult((lerp(int2ALfp(vals[0]), int2ALfp(vals[step]),
- ALfpMult(int2ALfp(frac), ALfpDiv(int2ALfp(1),int2ALfp(FRACTIONONE))))-
- int2ALfp(128)),
- float2ALfp(1.0/127.0)); }
-static __inline ALdfp cubic8(const ALubyte *vals, ALint step, ALint frac)
-{ return ALfpMult((cubic(int2ALfp(vals[-step]), int2ALfp(vals[0]), int2ALfp(vals[step]), int2ALfp(vals[step+step]),
- ALfpMult(int2ALfp(frac), ALfpDiv(int2ALfp(1),int2ALfp(FRACTIONONE))))-
- int2ALfp(128)),
- float2ALfp(1.0/127.0)); }
-
-
-#define DECL_TEMPLATE(T, sampler) \
-static void Mix_##T##_1_##sampler(ALsource *Source, ALCdevice *Device, \
- const T *data, ALuint *DataPosInt, ALuint *DataPosFrac, \
- ALuint OutPos, ALuint SamplesToDo, ALuint BufferSize) \
-{ \
- ALfp (*DryBuffer)[MAXCHANNELS]; \
- ALfp *ClickRemoval, *PendingClicks; \
- ALuint pos, frac; \
- ALfp DrySend[MAXCHANNELS]; \
- FILTER *DryFilter; \
- ALuint BufferIdx; \
- ALuint increment; \
- ALuint out, c; \
- ALfp value; \
- \
- increment = Source->Params.Step; \
- \
- DryBuffer = Device->DryBuffer; \
- ClickRemoval = Device->ClickRemoval; \
- PendingClicks = Device->PendingClicks; \
- DryFilter = &Source->Params.iirFilter; \
- for(c = 0;c < MAXCHANNELS;c++) \
- DrySend[c] = Source->Params.DryGains[0][c]; \
- \
- pos = 0; \
- frac = *DataPosFrac; \
- \
- if(OutPos == 0) \
- { \
- value = sampler(data+pos, 1, frac); \
- \
- value = lpFilter4PC(DryFilter, 0, value); \
- for(c = 0;c < MAXCHANNELS;c++) \
- ClickRemoval[c] = (ClickRemoval[c] - ALfpMult(value,DrySend[c])); \
- } \
- for(BufferIdx = 0;BufferIdx < BufferSize;BufferIdx++) \
- { \
- /* First order interpolator */ \
- value = sampler(data+pos, 1, frac); \
- \
- /* Direct path final mix buffer and panning */ \
- value = lpFilter4P(DryFilter, 0, value); \
- for(c = 0;c < MAXCHANNELS;c++) \
- DryBuffer[OutPos][c] = (DryBuffer[OutPos][c] + ALfpMult(value,DrySend[c])); \
- \
- frac += increment; \
- pos += frac>>FRACTIONBITS; \
- frac &= FRACTIONMASK; \
- OutPos++; \
- } \
- if(OutPos == SamplesToDo) \
- { \
- value = sampler(data+pos, 1, frac); \
- \
- value = lpFilter4PC(DryFilter, 0, value); \
- for(c = 0;c < MAXCHANNELS;c++) \
- PendingClicks[c] = (PendingClicks[c] + ALfpMult(value,DrySend[c])); \
- } \
- \
- for(out = 0;out < Device->NumAuxSends;out++) \
- { \
- ALfp WetSend; \
- ALfp *WetBuffer; \
- ALfp *WetClickRemoval; \
- ALfp *WetPendingClicks; \
- FILTER *WetFilter; \
- \
- if(!Source->Send[out].Slot || \
- Source->Send[out].Slot->effect.type == AL_EFFECT_NULL) \
- continue; \
- \
- WetBuffer = Source->Send[out].Slot->WetBuffer; \
- WetClickRemoval = Source->Send[out].Slot->ClickRemoval; \
- WetPendingClicks = Source->Send[out].Slot->PendingClicks; \
- WetFilter = &Source->Params.Send[out].iirFilter; \
- WetSend = Source->Params.Send[out].WetGain; \
- \
- pos = 0; \
- frac = *DataPosFrac; \
- OutPos -= BufferSize; \
- \
- if(OutPos == 0) \
- { \
- value = sampler(data+pos, 1, frac); \
- \
- value = lpFilter2PC(WetFilter, 0, value); \
- WetClickRemoval[0] = (WetClickRemoval[0] - ALfpMult(value,WetSend)); \
- } \
- for(BufferIdx = 0;BufferIdx < BufferSize;BufferIdx++) \
- { \
- /* First order interpolator */ \
- value = sampler(data+pos, 1, frac); \
- \
- /* Room path final mix buffer and panning */ \
- value = lpFilter2P(WetFilter, 0, value); \
- WetBuffer[OutPos] = (WetBuffer[OutPos] + ALfpMult(value,WetSend)); \
- \
- frac += increment; \
- pos += frac>>FRACTIONBITS; \
- frac &= FRACTIONMASK; \
- OutPos++; \
- } \
- if(OutPos == SamplesToDo) \
- { \
- value = sampler(data+pos, 1, frac); \
- \
- value = lpFilter2PC(WetFilter, 0, value); \
- WetPendingClicks[0] = (WetPendingClicks[0] + ALfpMult(value,WetSend)); \
- } \
- } \
- *DataPosInt += pos; \
- *DataPosFrac = frac; \
-}
-
-DECL_TEMPLATE(ALfp, point32)
-DECL_TEMPLATE(ALfp, lerp32)
-DECL_TEMPLATE(ALfp, cubic32)
-
-DECL_TEMPLATE(ALshort, point16)
-DECL_TEMPLATE(ALshort, lerp16)
-DECL_TEMPLATE(ALshort, cubic16)
-
-DECL_TEMPLATE(ALubyte, point8)
-DECL_TEMPLATE(ALubyte, lerp8)
-DECL_TEMPLATE(ALubyte, cubic8)
-
-#undef DECL_TEMPLATE
-
-
-#define DECL_TEMPLATE(T, chnct, sampler) \
-static void Mix_##T##_##chnct##_##sampler(ALsource *Source, ALCdevice *Device,\
- const T *data, ALuint *DataPosInt, ALuint *DataPosFrac, \
- ALuint OutPos, ALuint SamplesToDo, ALuint BufferSize) \
-{ \
- const ALuint Channels = chnct; \
- const ALfp scaler = ALfpDiv(int2ALfp(1),int2ALfp(chnct)); \
- ALfp (*DryBuffer)[MAXCHANNELS]; \
- ALfp *ClickRemoval, *PendingClicks; \
- ALuint pos, frac; \
- ALfp DrySend[chnct][MAXCHANNELS]; \
- FILTER *DryFilter; \
- ALuint BufferIdx; \
- ALuint increment; \
- ALuint i, out, c; \
- ALfp value; \
- \
- increment = Source->Params.Step; \
- \
- DryBuffer = Device->DryBuffer; \
- ClickRemoval = Device->ClickRemoval; \
- PendingClicks = Device->PendingClicks; \
- DryFilter = &Source->Params.iirFilter; \
- for(i = 0;i < Channels;i++) \
- { \
- for(c = 0;c < MAXCHANNELS;c++) \
- DrySend[i][c] = Source->Params.DryGains[i][c]; \
- } \
- \
- pos = 0; \
- frac = *DataPosFrac; \
- \
- if(OutPos == 0) \
- { \
- for(i = 0;i < Channels;i++) \
- { \
- value = sampler(data + pos*Channels + i, Channels, frac); \
- \
- value = lpFilter2PC(DryFilter, i*2, value); \
- for(c = 0;c < MAXCHANNELS;c++) \
- ClickRemoval[c] = (ClickRemoval[c] - ALfpMult(value,DrySend[i][c])); \
- } \
- } \
- for(BufferIdx = 0;BufferIdx < BufferSize;BufferIdx++) \
- { \
- for(i = 0;i < Channels;i++) \
- { \
- value = sampler(data + pos*Channels + i, Channels, frac); \
- \
- value = lpFilter2P(DryFilter, i*2, value); \
- for(c = 0;c < MAXCHANNELS;c++) \
- DryBuffer[OutPos][c] = (DryBuffer[OutPos][c] + ALfpMult(value,DrySend[i][c])); \
- } \
- \
- frac += increment; \
- pos += frac>>FRACTIONBITS; \
- frac &= FRACTIONMASK; \
- OutPos++; \
- } \
- if(OutPos == SamplesToDo) \
- { \
- for(i = 0;i < Channels;i++) \
- { \
- value = sampler(data + pos*Channels + i, Channels, frac); \
- \
- value = lpFilter2PC(DryFilter, i*2, value); \
- for(c = 0;c < MAXCHANNELS;c++) \
- PendingClicks[c] = (PendingClicks[c] + ALfpMult(value,DrySend[i][c])); \
- } \
- } \
- \
- for(out = 0;out < Device->NumAuxSends;out++) \
- { \
- ALfp WetSend; \
- ALfp *WetBuffer; \
- ALfp *WetClickRemoval; \
- ALfp *WetPendingClicks; \
- FILTER *WetFilter; \
- \
- if(!Source->Send[out].Slot || \
- Source->Send[out].Slot->effect.type == AL_EFFECT_NULL) \
- continue; \
- \
- WetBuffer = Source->Send[out].Slot->WetBuffer; \
- WetClickRemoval = Source->Send[out].Slot->ClickRemoval; \
- WetPendingClicks = Source->Send[out].Slot->PendingClicks; \
- WetFilter = &Source->Params.Send[out].iirFilter; \
- WetSend = Source->Params.Send[out].WetGain; \
- \
- pos = 0; \
- frac = *DataPosFrac; \
- OutPos -= BufferSize; \
- \
- if(OutPos == 0) \
- { \
- for(i = 0;i < Channels;i++) \
- { \
- value = sampler(data + pos*Channels + i, Channels, frac); \
- \
- value = lpFilter1PC(WetFilter, i, value); \
- WetClickRemoval[0] = (WetClickRemoval[0] - ALfpMult(ALfpMult(value,WetSend), scaler)); \
- } \
- } \
- for(BufferIdx = 0;BufferIdx < BufferSize;BufferIdx++) \
- { \
- for(i = 0;i < Channels;i++) \
- { \
- value = sampler(data + pos*Channels + i, Channels, frac); \
- \
- value = lpFilter1P(WetFilter, i, value); \
- WetBuffer[OutPos] = (WetBuffer[OutPos] + ALfpMult(ALfpMult(value,WetSend), scaler)); \
- } \
- \
- frac += increment; \
- pos += frac>>FRACTIONBITS; \
- frac &= FRACTIONMASK; \
- OutPos++; \
- } \
- if(OutPos == SamplesToDo) \
- { \
- for(i = 0;i < Channels;i++) \
- { \
- value = sampler(data + pos*Channels + i, Channels, frac); \
- \
- value = lpFilter1PC(WetFilter, i, value); \
- WetPendingClicks[0] = (WetPendingClicks[0] + ALfpMult(ALfpMult(value,WetSend), scaler)); \
- } \
- } \
- } \
- *DataPosInt += pos; \
- *DataPosFrac = frac; \
-}
-
-DECL_TEMPLATE(ALfp, 2, point32)
-DECL_TEMPLATE(ALfp, 2, lerp32)
-DECL_TEMPLATE(ALfp, 2, cubic32)
-
-DECL_TEMPLATE(ALshort, 2, point16)
-DECL_TEMPLATE(ALshort, 2, lerp16)
-DECL_TEMPLATE(ALshort, 2, cubic16)
-
-DECL_TEMPLATE(ALubyte, 2, point8)
-DECL_TEMPLATE(ALubyte, 2, lerp8)
-DECL_TEMPLATE(ALubyte, 2, cubic8)
-
-
-DECL_TEMPLATE(ALfp, 4, point32)
-DECL_TEMPLATE(ALfp, 4, lerp32)
-DECL_TEMPLATE(ALfp, 4, cubic32)
-
-DECL_TEMPLATE(ALshort, 4, point16)
-DECL_TEMPLATE(ALshort, 4, lerp16)
-DECL_TEMPLATE(ALshort, 4, cubic16)
-
-DECL_TEMPLATE(ALubyte, 4, point8)
-DECL_TEMPLATE(ALubyte, 4, lerp8)
-DECL_TEMPLATE(ALubyte, 4, cubic8)
-
-
-DECL_TEMPLATE(ALfp, 6, point32)
-DECL_TEMPLATE(ALfp, 6, lerp32)
-DECL_TEMPLATE(ALfp, 6, cubic32)
-
-DECL_TEMPLATE(ALshort, 6, point16)
-DECL_TEMPLATE(ALshort, 6, lerp16)
-DECL_TEMPLATE(ALshort, 6, cubic16)
-
-DECL_TEMPLATE(ALubyte, 6, point8)
-DECL_TEMPLATE(ALubyte, 6, lerp8)
-DECL_TEMPLATE(ALubyte, 6, cubic8)
-
-
-DECL_TEMPLATE(ALfp, 7, point32)
-DECL_TEMPLATE(ALfp, 7, lerp32)
-DECL_TEMPLATE(ALfp, 7, cubic32)
-
-DECL_TEMPLATE(ALshort, 7, point16)
-DECL_TEMPLATE(ALshort, 7, lerp16)
-DECL_TEMPLATE(ALshort, 7, cubic16)
-
-DECL_TEMPLATE(ALubyte, 7, point8)
-DECL_TEMPLATE(ALubyte, 7, lerp8)
-DECL_TEMPLATE(ALubyte, 7, cubic8)
-
-
-DECL_TEMPLATE(ALfp, 8, point32)
-DECL_TEMPLATE(ALfp, 8, lerp32)
-DECL_TEMPLATE(ALfp, 8, cubic32)
-
-DECL_TEMPLATE(ALshort, 8, point16)
-DECL_TEMPLATE(ALshort, 8, lerp16)
-DECL_TEMPLATE(ALshort, 8, cubic16)
-
-DECL_TEMPLATE(ALubyte, 8, point8)
-DECL_TEMPLATE(ALubyte, 8, lerp8)
-DECL_TEMPLATE(ALubyte, 8, cubic8)
-
-#undef DECL_TEMPLATE
-
-
-#define DECL_TEMPLATE(T, sampler) \
-static void Mix_##T##_##sampler(ALsource *Source, ALCdevice *Device, \
- enum FmtChannels FmtChannels, \
- const ALvoid *Data, ALuint *DataPosInt, ALuint *DataPosFrac, \
- ALuint OutPos, ALuint SamplesToDo, ALuint BufferSize) \
-{ \
- switch(FmtChannels) \
- { \
- case FmtMono: \
- Mix_##T##_1_##sampler(Source, Device, Data, DataPosInt, DataPosFrac, \
- OutPos, SamplesToDo, BufferSize); \
- break; \
- case FmtStereo: \
- case FmtRear: \
- Mix_##T##_2_##sampler(Source, Device, Data, DataPosInt, DataPosFrac, \
- OutPos, SamplesToDo, BufferSize); \
- break; \
- case FmtQuad: \
- Mix_##T##_4_##sampler(Source, Device, Data, DataPosInt, DataPosFrac, \
- OutPos, SamplesToDo, BufferSize); \
- break; \
- case FmtX51: \
- Mix_##T##_6_##sampler(Source, Device, Data, DataPosInt, DataPosFrac, \
- OutPos, SamplesToDo, BufferSize); \
- break; \
- case FmtX61: \
- Mix_##T##_7_##sampler(Source, Device, Data, DataPosInt, DataPosFrac, \
- OutPos, SamplesToDo, BufferSize); \
- break; \
- case FmtX71: \
- Mix_##T##_8_##sampler(Source, Device, Data, DataPosInt, DataPosFrac, \
- OutPos, SamplesToDo, BufferSize); \
- break; \
- } \
-}
-
-DECL_TEMPLATE(ALfp, point32)
-DECL_TEMPLATE(ALfp, lerp32)
-DECL_TEMPLATE(ALfp, cubic32)
-
-DECL_TEMPLATE(ALshort, point16)
-DECL_TEMPLATE(ALshort, lerp16)
-DECL_TEMPLATE(ALshort, cubic16)
-
-DECL_TEMPLATE(ALubyte, point8)
-DECL_TEMPLATE(ALubyte, lerp8)
-DECL_TEMPLATE(ALubyte, cubic8)
-
-#undef DECL_TEMPLATE
-
-
-#define DECL_TEMPLATE(sampler) \
-static void Mix_##sampler(ALsource *Source, ALCdevice *Device, \
- enum FmtChannels FmtChannels, enum FmtType FmtType, \
- const ALvoid *Data, ALuint *DataPosInt, ALuint *DataPosFrac, \
- ALuint OutPos, ALuint SamplesToDo, ALuint BufferSize) \
-{ \
- switch(FmtType) \
- { \
- case FmtUByte: \
- Mix_ALubyte_##sampler##8(Source, Device, FmtChannels, \
- Data, DataPosInt, DataPosFrac, \
- OutPos, SamplesToDo, BufferSize); \
- break; \
- \
- case FmtShort: \
- Mix_ALshort_##sampler##16(Source, Device, FmtChannels, \
- Data, DataPosInt, DataPosFrac, \
- OutPos, SamplesToDo, BufferSize); \
- break; \
- \
- case FmtFloat: \
- Mix_ALfp_##sampler##32(Source, Device, FmtChannels, \
- Data, DataPosInt, DataPosFrac, \
- OutPos, SamplesToDo, BufferSize); \
- break; \
- } \
-}
-
-DECL_TEMPLATE(point)
-DECL_TEMPLATE(lerp)
-DECL_TEMPLATE(cubic)
-
-#undef DECL_TEMPLATE
-
-
-ALvoid MixSource(ALsource *Source, ALCdevice *Device, ALuint SamplesToDo)
-{
- ALbufferlistitem *BufferListItem;
- ALuint DataPosInt, DataPosFrac;
- enum FmtChannels FmtChannels;
- enum FmtType FmtType;
- ALuint BuffersPlayed;
- ALboolean Looping;
- ALuint increment;
- resampler_t Resampler;
- ALenum State;
- ALuint OutPos;
- ALuint FrameSize;
- ALint64 DataSize64;
- ALuint i;
-
- /* Get source info */
- State = Source->state;
- BuffersPlayed = Source->BuffersPlayed;
- DataPosInt = Source->position;
- DataPosFrac = Source->position_fraction;
- Looping = Source->bLooping;
- increment = Source->Params.Step;
- Resampler = (increment == FRACTIONONE) ? POINT_RESAMPLER :
- Source->Resampler;
-
- /* Get buffer info */
- FrameSize = 0;
- FmtChannels = FmtMono;
- FmtType = FmtUByte;
- BufferListItem = Source->queue;
- for(i = 0;i < Source->BuffersInQueue;i++)
- {
- const ALbuffer *ALBuffer;
- if((ALBuffer=BufferListItem->buffer) != NULL)
- {
- FmtChannels = ALBuffer->FmtChannels;
- FmtType = ALBuffer->FmtType;
- FrameSize = FrameSizeFromFmt(FmtChannels, FmtType);
- break;
- }
- BufferListItem = BufferListItem->next;
- }
-
- /* Get current buffer queue item */
- BufferListItem = Source->queue;
- for(i = 0;i < BuffersPlayed;i++)
- BufferListItem = BufferListItem->next;
-
- OutPos = 0;
- do {
- const ALuint BufferPrePadding = ResamplerPrePadding[Resampler];
- const ALuint BufferPadding = ResamplerPadding[Resampler];
- ALubyte StackData[STACK_DATA_SIZE];
- ALubyte *SrcData = StackData;
- ALuint SrcDataSize = 0;
- ALuint BufferSize;
-
- /* Figure out how many buffer bytes will be needed */
- DataSize64 = SamplesToDo-OutPos+1;
- DataSize64 *= increment;
- DataSize64 += DataPosFrac+FRACTIONMASK;
- DataSize64 >>= FRACTIONBITS;
- DataSize64 += BufferPadding+BufferPrePadding;
- DataSize64 *= FrameSize;
-
- BufferSize = min(DataSize64, STACK_DATA_SIZE);
- BufferSize -= BufferSize%FrameSize;
-
- if(Source->lSourceType == AL_STATIC)
- {
- const ALbuffer *ALBuffer = Source->Buffer;
- const ALubyte *Data = ALBuffer->data;
- ALuint DataSize;
- ALuint pos;
-
- /* If current pos is beyond the loop range, do not loop */
- if(Looping == AL_FALSE || DataPosInt >= (ALuint)ALBuffer->LoopEnd)
- {
- Looping = AL_FALSE;
-
- if(DataPosInt >= BufferPrePadding)
- pos = (DataPosInt-BufferPrePadding)*FrameSize;
- else
- {
- DataSize = (BufferPrePadding-DataPosInt)*FrameSize;
- DataSize = min(BufferSize, DataSize);
-
- memset(&SrcData[SrcDataSize], (FmtType==FmtUByte)?0x80:0, DataSize);
- SrcDataSize += DataSize;
- BufferSize -= DataSize;
-
- pos = 0;
- }
-
- /* Copy what's left to play in the source buffer, and clear the
- * rest of the temp buffer */
- DataSize = ALBuffer->size - pos;
- DataSize = min(BufferSize, DataSize);
-
- memcpy(&SrcData[SrcDataSize], &Data[pos], DataSize);
- SrcDataSize += DataSize;
- BufferSize -= DataSize;
-
- memset(&SrcData[SrcDataSize], (FmtType==FmtUByte)?0x80:0, BufferSize);
- SrcDataSize += BufferSize;
- BufferSize -= BufferSize;
- }
- else
- {
- ALuint LoopStart = ALBuffer->LoopStart;
- ALuint LoopEnd = ALBuffer->LoopEnd;
-
- if(DataPosInt >= LoopStart)
- {
- pos = DataPosInt-LoopStart;
- while(pos < BufferPrePadding)
- pos += LoopEnd-LoopStart;
- pos -= BufferPrePadding;
- pos += LoopStart;
- pos *= FrameSize;
- }
- else if(DataPosInt >= BufferPrePadding)
- pos = (DataPosInt-BufferPrePadding)*FrameSize;
- else
- {
- DataSize = (BufferPrePadding-DataPosInt)*FrameSize;
- DataSize = min(BufferSize, DataSize);
-
- memset(&SrcData[SrcDataSize], (FmtType==FmtUByte)?0x80:0, DataSize);
- SrcDataSize += DataSize;
- BufferSize -= DataSize;
-
- pos = 0;
- }
-
- /* Copy what's left of this loop iteration, then copy repeats
- * of the loop section */
- DataSize = LoopEnd*FrameSize - pos;
- DataSize = min(BufferSize, DataSize);
-
- memcpy(&SrcData[SrcDataSize], &Data[pos], DataSize);
- SrcDataSize += DataSize;
- BufferSize -= DataSize;
-
- DataSize = (LoopEnd-LoopStart) * FrameSize;
- while(BufferSize > 0)
- {
- DataSize = min(BufferSize, DataSize);
-
- memcpy(&SrcData[SrcDataSize], &Data[LoopStart*FrameSize], DataSize);
- SrcDataSize += DataSize;
- BufferSize -= DataSize;
- }
- }
- }
- else
- {
- /* Crawl the buffer queue to fill in the temp buffer */
- ALbufferlistitem *BufferListIter = BufferListItem;
- ALuint pos;
-
- if(DataPosInt >= BufferPrePadding)
- pos = (DataPosInt-BufferPrePadding)*FrameSize;
- else
- {
- pos = (BufferPrePadding-DataPosInt)*FrameSize;
- while(pos > 0)
- {
- if(!BufferListIter->prev && !Looping)
- {
- ALuint DataSize = min(BufferSize, pos);
-
- memset(&SrcData[SrcDataSize], (FmtType==FmtUByte)?0x80:0, DataSize);
- SrcDataSize += DataSize;
- BufferSize -= DataSize;
-
- pos = 0;
- break;
- }
-
- if(BufferListIter->prev)
- BufferListIter = BufferListIter->prev;
- else
- {
- while(BufferListIter->next)
- BufferListIter = BufferListIter->next;
- }
-
- if(BufferListIter->buffer)
- {
- if((ALuint)BufferListIter->buffer->size > pos)
- {
- pos = BufferListIter->buffer->size - pos;
- break;
- }
- pos -= BufferListIter->buffer->size;
- }
- }
- }
-
- while(BufferListIter && BufferSize > 0)
- {
- const ALbuffer *ALBuffer;
- if((ALBuffer=BufferListIter->buffer) != NULL)
- {
- const ALubyte *Data = ALBuffer->data;
- ALuint DataSize = ALBuffer->size;
-
- /* Skip the data already played */
- if(DataSize <= pos)
- pos -= DataSize;
- else
- {
- Data += pos;
- DataSize -= pos;
- pos -= pos;
-
- DataSize = min(BufferSize, DataSize);
- memcpy(&SrcData[SrcDataSize], Data, DataSize);
- SrcDataSize += DataSize;
- BufferSize -= DataSize;
- }
- }
- BufferListIter = BufferListIter->next;
- if(!BufferListIter && Looping)
- BufferListIter = Source->queue;
- else if(!BufferListIter)
- {
- memset(&SrcData[SrcDataSize], (FmtType==FmtUByte)?0x80:0, BufferSize);
- SrcDataSize += BufferSize;
- BufferSize -= BufferSize;
- }
- }
- }
-
- /* Figure out how many samples we can mix. */
- DataSize64 = SrcDataSize / FrameSize;
- DataSize64 -= BufferPadding+BufferPrePadding;
- DataSize64 <<= FRACTIONBITS;
- DataSize64 -= increment;
- DataSize64 -= DataPosFrac;
-
- BufferSize = (ALuint)((DataSize64+(increment-1)) / increment);
- BufferSize = min(BufferSize, (SamplesToDo-OutPos));
-
- SrcData += BufferPrePadding*FrameSize;
- switch(Resampler)
- {
- case POINT_RESAMPLER:
- Mix_point(Source, Device, FmtChannels, FmtType,
- SrcData, &DataPosInt, &DataPosFrac,
- OutPos, SamplesToDo, BufferSize);
- break;
- case LINEAR_RESAMPLER:
- Mix_lerp(Source, Device, FmtChannels, FmtType,
- SrcData, &DataPosInt, &DataPosFrac,
- OutPos, SamplesToDo, BufferSize);
- break;
- case CUBIC_RESAMPLER:
- Mix_cubic(Source, Device, FmtChannels, FmtType,
- SrcData, &DataPosInt, &DataPosFrac,
- OutPos, SamplesToDo, BufferSize);
- break;
- case RESAMPLER_MIN:
- case RESAMPLER_MAX:
- break;
- }
- OutPos += BufferSize;
-
- /* Handle looping sources */
- while(1)
- {
- const ALbuffer *ALBuffer;
- ALuint DataSize = 0;
- ALuint LoopStart = 0;
- ALuint LoopEnd = 0;
-
- if((ALBuffer=BufferListItem->buffer) != NULL)
- {
- DataSize = ALBuffer->size / FrameSize;
- LoopStart = ALBuffer->LoopStart;
- LoopEnd = ALBuffer->LoopEnd;
- if(LoopEnd > DataPosInt)
- break;
- }
-
- if(Looping && Source->lSourceType == AL_STATIC)
- {
- BufferListItem = Source->queue;
- DataPosInt = ((DataPosInt-LoopStart)%(LoopEnd-LoopStart)) + LoopStart;
- break;
- }
-
- if(DataSize > DataPosInt)
- break;
-
- if(BufferListItem->next)
- {
- BufferListItem = BufferListItem->next;
- BuffersPlayed++;
- }
- else if(Looping)
- {
- BufferListItem = Source->queue;
- BuffersPlayed = 0;
- }
- else
- {
- State = AL_STOPPED;
- BufferListItem = Source->queue;
- BuffersPlayed = Source->BuffersInQueue;
- DataPosInt = 0;
- DataPosFrac = 0;
- break;
- }
-
- DataPosInt -= DataSize;
- }
- } while(State == AL_PLAYING && OutPos < SamplesToDo);
-
- /* Update source info */
- Source->state = State;
- Source->BuffersPlayed = BuffersPlayed;
- Source->position = DataPosInt;
- Source->position_fraction = DataPosFrac;
- Source->Buffer = BufferListItem->buffer;
-}
diff --git a/internal/c/parts/audio/out/android/OpenAL/Alc/null.c b/internal/c/parts/audio/out/android/OpenAL/Alc/null.c
deleted file mode 100644
index 75fc883cd..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Alc/null.c
+++ /dev/null
@@ -1,182 +0,0 @@
-/**
- * OpenAL cross platform audio library
- * Copyright (C) 2010 by Chris Robinson
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- * Or go to http://www.gnu.org/copyleft/lgpl.html
- */
-
-#include "config.h"
-
-#include
-#include "alMain.h"
-#include "AL/al.h"
-#include "AL/alc.h"
-
-
-typedef struct {
- ALvoid *buffer;
- ALuint size;
-
- volatile int killNow;
- ALvoid *thread;
-} null_data;
-
-
-static const ALCchar nullDevice[] = "No Output";
-
-static ALuint NullProc(ALvoid *ptr)
-{
- ALCdevice *Device = (ALCdevice*)ptr;
- null_data *data = (null_data*)Device->ExtraData;
- ALuint now, start;
- ALuint64 avail, done;
- const ALuint restTime = ((ALuint)((ALuint64)Device->UpdateSize * 1000 /
- Device->Frequency)) / 2;
-
- done = 0;
- start = timeGetTime();
- while(!data->killNow && Device->Connected)
- {
- now = timeGetTime();
-
- avail = (ALuint64)(now-start) * Device->Frequency / 1000;
- if(avail < done)
- {
- /* Timer wrapped. Add the remainder of the cycle to the available
- * count and reset the number of samples done */
- avail += (ALuint64)0xFFFFFFFFu*Device->Frequency/1000 - done;
- done = 0;
- }
- if(avail-done < Device->UpdateSize)
- {
- Sleep(restTime);
- continue;
- }
-
- while(avail-done >= Device->UpdateSize)
- {
- aluMixData(Device, data->buffer, Device->UpdateSize);
- done += Device->UpdateSize;
- }
- }
-
- return 0;
-}
-
-static ALCboolean null_open_playback(ALCdevice *device, const ALCchar *deviceName)
-{
- null_data *data;
-
- if(!deviceName)
- deviceName = nullDevice;
- else if(strcmp(deviceName, nullDevice) != 0)
- return ALC_FALSE;
-
- data = (null_data*)calloc(1, sizeof(*data));
-
- device->szDeviceName = strdup(deviceName);
- device->ExtraData = data;
- return ALC_TRUE;
-}
-
-static void null_close_playback(ALCdevice *device)
-{
- null_data *data = (null_data*)device->ExtraData;
-
- free(data);
- device->ExtraData = NULL;
-}
-
-static ALCboolean null_reset_playback(ALCdevice *device)
-{
- null_data *data = (null_data*)device->ExtraData;
-
- data->size = device->UpdateSize * FrameSizeFromDevFmt(device->FmtChans,
- device->FmtType);
- data->buffer = malloc(data->size);
- if(!data->buffer)
- {
- AL_PRINT("buffer malloc failed\n");
- return ALC_FALSE;
- }
- SetDefaultWFXChannelOrder(device);
-
- data->thread = StartThread(NullProc, device);
- if(data->thread == NULL)
- {
- free(data->buffer);
- data->buffer = NULL;
- return ALC_FALSE;
- }
-
- return ALC_TRUE;
-}
-
-static void null_stop_playback(ALCdevice *device)
-{
- null_data *data = (null_data*)device->ExtraData;
-
- if(!data->thread)
- return;
-
- data->killNow = 1;
- StopThread(data->thread);
- data->thread = NULL;
-
- data->killNow = 0;
-
- free(data->buffer);
- data->buffer = NULL;
-}
-
-
-static ALCboolean null_open_capture(ALCdevice *device, const ALCchar *deviceName)
-{
- (void)device;
- (void)deviceName;
- return ALC_FALSE;
-}
-
-
-BackendFuncs null_funcs = {
- null_open_playback,
- null_close_playback,
- null_reset_playback,
- null_stop_playback,
- null_open_capture,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-void alc_null_init(BackendFuncs *func_list)
-{
- *func_list = null_funcs;
-}
-
-void alc_null_deinit(void)
-{
-}
-
-void alc_null_probe(int type)
-{
- if(type == DEVICE_PROBE)
- AppendDeviceList(nullDevice);
- else if(type == ALL_DEVICE_PROBE)
- AppendAllDeviceList(nullDevice);
-}
diff --git a/internal/c/parts/audio/out/android/OpenAL/Alc/opensles.c b/internal/c/parts/audio/out/android/OpenAL/Alc/opensles.c
deleted file mode 100644
index f9ccb5a9e..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Alc/opensles.c
+++ /dev/null
@@ -1,800 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* This is an OpenAL backend for Android using the native audio APIs based on OpenSL ES 1.0.1.
- * It is based on source code for the native-audio sample app bundled with NDK.
- */
-
-#include
-#include
-#include
-#include
-#include
-
-#include
-
-#include "alMain.h"
-#include "AL/al.h"
-#include "AL/alc.h"
-
-#include
-#include
-#include
-
-#include
-
-
-#define LOG_NDEBUG 0
-#define LOG_TAG "OpenAL_SLES"
-
-#if 1
-#define LOGV(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
-#else
-#define LOGV(...)
-#endif
-
-// for native audio
-#include
-#include
-
-#include "apportable_openal_funcs.h"
-
-#define MAKE_SYM_POINTER(sym) static typeof(sym) * p##sym = NULL
-MAKE_SYM_POINTER(SL_IID_ENGINE);
-MAKE_SYM_POINTER(SL_IID_ANDROIDSIMPLEBUFFERQUEUE);
-MAKE_SYM_POINTER(SL_IID_PLAY);
-MAKE_SYM_POINTER(SL_IID_BUFFERQUEUE);
-MAKE_SYM_POINTER(slCreateEngine);
-
-// engine interfaces
-static SLObjectItf engineObject = NULL;
-static SLEngineItf engineEngine;
-
-// output mix interfaces
-static SLObjectItf outputMixObject = NULL;
-
-// JNI stuff so we can get the runtime OS version number
-static JavaVM* javaVM = NULL;
-
-static int alc_opensles_get_android_api()
-{
- jclass androidVersionClass = NULL;
- jfieldID androidSdkIntField = NULL;
- int androidApiLevel = 0;
- JNIEnv* env = NULL;
-
- (*javaVM)->GetEnv(javaVM, (void**)&env, JNI_VERSION_1_4);
- androidVersionClass = (*env)->FindClass(env, "android/os/Build$VERSION");
- if (androidVersionClass)
- {
- androidSdkIntField = (*env)->GetStaticFieldID(env, androidVersionClass, "SDK_INT", "I");
- if (androidSdkIntField != NULL)
- {
- androidApiLevel = (int)((*env)->GetStaticIntField(env, androidVersionClass, androidSdkIntField));
- }
- (*env)->DeleteLocalRef(env, androidVersionClass);
- }
- LOGV("API:%d", androidApiLevel);
- return androidApiLevel;
-}
-static char *androidModel = NULL;
-static char *alc_opensles_get_android_model()
-{
- if (!androidModel) {
- jclass androidBuildClass = NULL;
- jfieldID androidModelField = NULL;
- jstring androidModelString = NULL;
- int androidApiLevel = 0;
- JNIEnv* env = NULL;
-
- (*javaVM)->GetEnv(javaVM, (void**)&env, JNI_VERSION_1_4);
- (*env)->PushLocalFrame(env, 5);
- androidBuildClass = (*env)->FindClass(env, "android/os/Build");
- if (androidBuildClass)
- {
- androidModelField = (*env)->GetStaticFieldID(env, androidBuildClass, "MODEL", "Ljava/lang/String;");
- androidModelString = (*env)->GetStaticObjectField(env, androidBuildClass, androidModelField);
- const char *unichars = (*env)->GetStringUTFChars(env, androidModelString, NULL);
- if (!(*env)->ExceptionOccurred(env))
- {
- jsize sz = (*env)->GetStringLength(env, androidModelString);
- androidModel = malloc(sz+1);
- if (androidModel) {
- strncpy(androidModel, unichars, sz);
- androidModel[sz] = '\0';
- }
- }
- (*env)->ReleaseStringUTFChars(env, androidModelString, unichars);
- }
- (*env)->PopLocalFrame(env, NULL);
- }
- LOGV("Model:%s", androidModel);
- return androidModel;
-}
-
-static long timespecdiff(struct timespec *starttime, struct timespec *finishtime)
-{
- long msec;
- msec=(finishtime->tv_sec-starttime->tv_sec)*1000;
- msec+=(finishtime->tv_nsec-starttime->tv_nsec)/1000000;
- return msec;
- }
-
-// Cannot be a constant because we need to tweak differently depending on OS version.
-static size_t bufferCount = 8;
-static size_t bufferSize = (1024*4);
-static size_t defaultBufferSize = (1024*4);
-static size_t premixCount = 3;
-#define bufferSizeMax (1024*4)
-
-typedef enum {
- OUTPUT_BUFFER_STATE_UNKNOWN,
- OUTPUT_BUFFER_STATE_FREE,
- OUTPUT_BUFFER_STATE_MIXED,
- OUTPUT_BUFFER_STATE_ENQUEUED,
-} outputBuffer_state_t;
-
-typedef struct outputBuffer_s {
- pthread_mutex_t mutex;
- pthread_cond_t cond;
- outputBuffer_state_t state;
- char buffer[bufferSizeMax];
-} outputBuffer_t;
-
-// Will dynamically create the number of buffers (array elements) based on OS version.
-
-
-typedef struct {
- pthread_t playbackThread;
- char threadShouldRun;
- char threadIsReady;
- char lastBufferEnqueued;
- char lastBufferMixed;
-
- outputBuffer_t *outputBuffers;
-
- // buffer queue player interfaces
- SLObjectItf bqPlayerObject;
- SLPlayItf bqPlayerPlay;
- SLAndroidSimpleBufferQueueItf bqPlayerBufferQueue;
-} opesles_data_t;
-#define MAX_DEVICES 3
-static ALCdevice *deviceList[MAX_DEVICES] = {NULL};
-static pthread_mutex_t deviceListMutex = PTHREAD_MUTEX_INITIALIZER;
-
-typedef void (*deviceListFn)(ALCdevice *);
-
-static void devlist_add(ALCdevice *pDevice) {
- int i;
- pthread_mutex_lock(&(deviceListMutex));
- for (i = 0; i < MAX_DEVICES; i++) {
- if (deviceList[i] == pDevice) {
- break;
- } else if (deviceList[i] == NULL) {
- deviceList[i] = pDevice;
- break;
- }
- }
- pthread_mutex_unlock(&(deviceListMutex));
-}
-
-static void devlist_remove(ALCdevice *pDevice) {
- int i;
- pthread_mutex_lock(&(deviceListMutex));
- for (i = 0; i < MAX_DEVICES; i++) {
- if (deviceList[i] == pDevice) {
- deviceList[i] = NULL;
- }
- }
- pthread_mutex_unlock(&(deviceListMutex));
-}
-
-static void devlist_process(deviceListFn mapFunction) {
- int i;
- pthread_mutex_lock(&(deviceListMutex));
- for (i = 0; i < MAX_DEVICES; i++) {
- if (deviceList[i]) {
- pthread_mutex_unlock(&(deviceListMutex));
- mapFunction(deviceList[i]);
- pthread_mutex_lock(&(deviceListMutex));
- }
- }
- pthread_mutex_unlock(&(deviceListMutex));
-}
-
-
-static void *playback_function(void * context) {
- LOGV("playback_function started");
- outputBuffer_t *buffer = NULL;
- SLresult result;
- struct timespec ts;
- assert(NULL != context);
- ALCdevice *pDevice = (ALCdevice *) context;
- opesles_data_t *devState = (opesles_data_t *) pDevice->ExtraData;
- unsigned int bufferIndex = devState->lastBufferMixed;
-
- ALint frameSize = FrameSizeFromDevFmt(pDevice->FmtChans, pDevice->FmtType);
-
- // Show a sensible name for the thread in debug tools
- prctl(PR_SET_NAME, (unsigned long)"OpenAL/sl/m", 0, 0, 0);
-
- while (1) {
- if (devState->threadShouldRun == 0) {
- return NULL;
- }
-
- bufferIndex = (++bufferIndex) % bufferCount;
- buffer = &(devState->outputBuffers[bufferIndex]);
-
- pthread_mutex_lock(&(buffer->mutex));
-
-
- while (1) {
- if (devState->threadShouldRun == 0) {
- pthread_mutex_unlock(&(buffer->mutex));
- return NULL;
- }
-
- // This is a little hacky, but here we avoid mixing too much data
- if (buffer->state == OUTPUT_BUFFER_STATE_FREE) {
- int i = (bufferIndex - premixCount) % bufferCount;
- outputBuffer_t *buffer1 = &(devState->outputBuffers[i]);
- if (buffer1->state == OUTPUT_BUFFER_STATE_ENQUEUED ||
- buffer1->state == OUTPUT_BUFFER_STATE_FREE) {
- break;
- }
- }
-
- // No buffer available, wait for a buffer to become available
- // or until playback is stopped/suspended
- clock_gettime(CLOCK_REALTIME, &ts);
- ts.tv_nsec += 5000000;
- pthread_cond_timedwait(&(buffer->cond), &(buffer->mutex), &ts);
- }
- devState->threadIsReady = 1;
-
- aluMixData(pDevice, buffer->buffer, bufferSize/frameSize);
- buffer->state = OUTPUT_BUFFER_STATE_MIXED;
- pthread_cond_signal(&(buffer->cond));
- pthread_mutex_unlock(&(buffer->mutex));
-
- devState->lastBufferMixed = bufferIndex;
- }
-}
-
-SLresult alc_opensles_init_extradata(ALCdevice *pDevice)
-{
- opesles_data_t *devState = NULL;
- int i;
- devState = malloc(sizeof(opesles_data_t));
- if (!devState) {
- return SL_RESULT_MEMORY_FAILURE;
- }
- bzero(devState, sizeof(opesles_data_t));
- devState->outputBuffers = (outputBuffer_t*) malloc(sizeof(outputBuffer_t)*bufferCount);
- if (!devState->outputBuffers) {
- free(devState);
- return SL_RESULT_MEMORY_FAILURE;
- }
- pDevice->ExtraData = devState;
- bzero(devState->outputBuffers, sizeof(outputBuffer_t)*bufferCount);
- devState->lastBufferEnqueued = -1;
- devState->lastBufferMixed = -1;
- for (i = 0; i < bufferCount; i++) {
- if (pthread_mutex_init(&(devState->outputBuffers[i].mutex), (pthread_mutexattr_t*) NULL) != 0) {
- LOGV("Error on init of mutex");
- free(devState->outputBuffers);
- free(devState);
- return SL_RESULT_UNKNOWN_ERROR;
- }
- if (pthread_cond_init(&(devState->outputBuffers[i].cond), (pthread_condattr_t*) NULL) != 0) {
- LOGV("Error on init of cond");
- free(devState->outputBuffers);
- free(devState);
- return SL_RESULT_UNKNOWN_ERROR;
- }
- devState->outputBuffers[i].state = OUTPUT_BUFFER_STATE_FREE;
- }
- // For the Android suspend/resume functionaly, keep track of all device contexts
- devlist_add(pDevice);
- return SL_RESULT_SUCCESS;
-}
-
-static void start_playback(ALCdevice *pDevice) {
- opesles_data_t *devState = NULL;
- int i;
-
- if (pDevice->ExtraData == NULL) {
- alc_opensles_init_extradata(pDevice);
- devState = pDevice->ExtraData;
- assert(devState != NULL);
- } else {
- devState = (opesles_data_t *) pDevice->ExtraData;
- }
-
- if (devState->threadShouldRun == 1) {
- // Gratuitous resume
- return;
- }
-
- // start/restart playback thread
- devState->threadShouldRun = 1;
-
- pthread_attr_t playbackThreadAttr;
- pthread_attr_init(&playbackThreadAttr);
- struct sched_param playbackThreadParam;
- playbackThreadParam.sched_priority = sched_get_priority_max(SCHED_RR);
- pthread_attr_setschedpolicy(&playbackThreadAttr, SCHED_RR);
- pthread_attr_setschedparam(&playbackThreadAttr, &playbackThreadParam);
- pthread_create(&(devState->playbackThread), &playbackThreadAttr, playback_function, (void *) pDevice);
- while (devState->threadShouldRun && (0 == devState->threadIsReady))
- {
- sched_yield();
- }
-}
-
-static void stop_playback(ALCdevice *pDevice) {
- opesles_data_t *devState = (opesles_data_t *) pDevice->ExtraData;
- devState->threadShouldRun = 0;
- pthread_join(devState->playbackThread, NULL);
- return;
-}
-
-// this callback handler is called every time a buffer finishes playing
-static void opensles_callback(SLAndroidSimpleBufferQueueItf bq, void *context)
-{
- ALCdevice *pDevice = (ALCdevice *) context;
- opesles_data_t *devState = (opesles_data_t *) pDevice->ExtraData;
- unsigned int bufferIndex = devState->lastBufferEnqueued;
- unsigned int i;
- struct timespec ts;
- int rc;
- SLresult result;
- outputBuffer_t *buffer = NULL;
-
- bufferIndex = (++bufferIndex) % bufferCount;
- buffer = &(devState->outputBuffers[bufferIndex]);
-
- pthread_mutex_lock(&(buffer->mutex));
- // We will block until 'next' buffer has mixed audio, but first flag oldest equeued buffer as free
- for (i = 1; i <= bufferCount; i++) {
- unsigned int j = (devState->lastBufferEnqueued+i) % bufferCount;
- outputBuffer_t *bufferFree = &(devState->outputBuffers[j]);
- if (bufferFree->state == OUTPUT_BUFFER_STATE_ENQUEUED) {
- bufferFree->state = OUTPUT_BUFFER_STATE_FREE;
- break;
- }
- }
- while (buffer->state != OUTPUT_BUFFER_STATE_MIXED) {
- clock_gettime(CLOCK_REALTIME, &ts);
- ts.tv_nsec += 100000;
- rc = pthread_cond_timedwait(&(buffer->cond), &(buffer->mutex), &ts);
- if (rc != 0) {
- if (devState->threadShouldRun == 0) {
- // we are probably suspended
- pthread_mutex_unlock(&(buffer->mutex));
- return;
- }
- }
- }
-
- if (devState->bqPlayerBufferQueue) {
- result = (*devState->bqPlayerBufferQueue)->Enqueue(devState->bqPlayerBufferQueue, buffer->buffer, bufferSize);
- if (SL_RESULT_SUCCESS == result) {
- buffer->state = OUTPUT_BUFFER_STATE_ENQUEUED;
- devState->lastBufferEnqueued = bufferIndex;
- pthread_cond_signal(&(buffer->cond));
- } else {
- bufferIndex--;
- }
- }
- pthread_mutex_unlock(&(buffer->mutex));
-}
-
-
-static const ALCchar opensles_device[] = "OpenSL ES";
-
-// Apportable extensions
-SLresult alc_opensles_create_native_audio_engine()
-{
- if (engineObject)
- return SL_RESULT_SUCCESS;
-
- SLresult result;
-
- // create engine
- result = pslCreateEngine(&engineObject, 0, NULL, 0, NULL, NULL);
- assert(SL_RESULT_SUCCESS == result);
-
- // realize the engine
- result = (*engineObject)->Realize(engineObject, SL_BOOLEAN_FALSE);
- assert(SL_RESULT_SUCCESS == result);
-
- // get the engine interface, which is needed in order to create other objects
- result = (*engineObject)->GetInterface(engineObject, *pSL_IID_ENGINE, &engineEngine);
- assert(SL_RESULT_SUCCESS == result);
-
- // create output mix
- result = (*engineEngine)->CreateOutputMix(engineEngine, &outputMixObject, 0, NULL, NULL);
- assert(SL_RESULT_SUCCESS == result);
-
- // realize the output mix
- result = (*outputMixObject)->Realize(outputMixObject, SL_BOOLEAN_FALSE);
- assert(SL_RESULT_SUCCESS == result);
-
- return result;
-}
-
-// Backend functions, in same order as type BackendFuncs
-static ALCboolean opensles_open_playback(ALCdevice *pDevice, const ALCchar *deviceName)
-{
- LOGV("opensles_open_playback pDevice=%p, deviceName=%s", pDevice, deviceName);
-
- // Check if probe has linked the opensl symbols
- if (pslCreateEngine == NULL) {
- alc_opensles_probe(DEVICE_PROBE);
- if (pslCreateEngine == NULL) {
- return ALC_FALSE;
- }
- }
-
- if (pDevice->ExtraData == NULL) {
- alc_opensles_init_extradata(pDevice);
- }
-
- // create the engine and output mix objects
- alc_opensles_create_native_audio_engine();
-
- return ALC_TRUE;
-}
-
-
-static void opensles_close_playback(ALCdevice *pDevice)
-{
- LOGV("opensles_close_playback pDevice=%p", pDevice);
- opesles_data_t *devState = (opesles_data_t *) pDevice->ExtraData;
-
- // shut down the native audio system
-
- // destroy buffer queue audio player object, and invalidate all associated interfaces
- if (devState->bqPlayerObject != NULL) {
- (*devState->bqPlayerObject)->Destroy(devState->bqPlayerObject);
- devState->bqPlayerObject = NULL;
- devState->bqPlayerPlay = NULL;
- devState->bqPlayerBufferQueue = NULL;
- }
-
-
-
- devlist_remove(pDevice);
-}
-
-static ALCboolean opensles_reset_playback(ALCdevice *pDevice)
-{
- if (pDevice == NULL) {
- LOGE("Received a NULL ALCdevice! Returning ALC_FALSE from opensles_reset_playback");
- return ALC_FALSE;
- }
- LOGV("opensles_reset_playback pDevice=%p", pDevice);
- opesles_data_t *devState;
- unsigned bits = BytesFromDevFmt(pDevice->FmtType) * 8;
- unsigned channels = ChannelsFromDevFmt(pDevice->FmtChans);
- unsigned samples = pDevice->UpdateSize;
- unsigned size = samples * channels * bits / 8;
- SLuint32 sampling_rate = pDevice->Frequency * 1000;
- SLresult result;
- LOGV("bits=%u, channels=%u, samples=%u, size=%u, freq=%u", bits, channels, samples, size, pDevice->Frequency);
- if (pDevice->Frequency <= 22050) {
- bufferSize = defaultBufferSize / 2;
- }
-
- devState = (opesles_data_t *) pDevice->ExtraData;
-
- // create buffer queue audio player
-
- // configure audio source
- SLDataLocator_AndroidSimpleBufferQueue loc_bufq = {SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, 2};
-// SLDataFormat_PCM format_pcm = {SL_DATAFORMAT_PCM, 2, SL_SAMPLINGRATE_44_1,
- SLDataFormat_PCM format_pcm = {SL_DATAFORMAT_PCM, 2, sampling_rate,
- SL_PCMSAMPLEFORMAT_FIXED_16, SL_PCMSAMPLEFORMAT_FIXED_16,
- SL_SPEAKER_FRONT_LEFT|SL_SPEAKER_FRONT_RIGHT, SL_BYTEORDER_LITTLEENDIAN};
- SLDataSource audioSrc = {&loc_bufq, &format_pcm};
-
- // configure audio sink
- SLDataLocator_OutputMix loc_outmix = {SL_DATALOCATOR_OUTPUTMIX, outputMixObject};
- SLDataSink audioSnk = {&loc_outmix, NULL};
-
- // create audio player
- LOGV("create audio player");
- const SLInterfaceID ids[1] = {*pSL_IID_ANDROIDSIMPLEBUFFERQUEUE};
- const SLboolean req[1] = {SL_BOOLEAN_TRUE};
- result = (*engineEngine)->CreateAudioPlayer(engineEngine, &devState->bqPlayerObject, &audioSrc, &audioSnk,
- 1, ids, req);
- if ((result != SL_RESULT_SUCCESS) || (devState->bqPlayerObject == NULL)) {
- //RELEASE_LOG("create audio player is null or errored: %lx", result);
- return ALC_FALSE;
- }
-
- // realize the player
- result = (*devState->bqPlayerObject)->Realize(devState->bqPlayerObject, SL_BOOLEAN_FALSE);
- assert(SL_RESULT_SUCCESS == result);
-
- // get the play interface
- result = (*devState->bqPlayerObject)->GetInterface(devState->bqPlayerObject, *pSL_IID_PLAY, &devState->bqPlayerPlay);
- assert(SL_RESULT_SUCCESS == result);
-
- // get the buffer queue interface
- result = (*devState->bqPlayerObject)->GetInterface(devState->bqPlayerObject, *pSL_IID_BUFFERQUEUE,
- &devState->bqPlayerBufferQueue);
- if ((result != SL_RESULT_SUCCESS) || (devState->bqPlayerBufferQueue == NULL)) {
- //RELEASE_LOG("get the buffer queue interface is null or errored: %lx", result);
- return ALC_FALSE;
- }
-
- // register callback on the buffer queue
- result = (*devState->bqPlayerBufferQueue)->RegisterCallback(devState->bqPlayerBufferQueue, opensles_callback, (void *) pDevice);
- assert(SL_RESULT_SUCCESS == result);
-
- // playback_lock = createThreadLock();
- start_playback(pDevice);
-
- // set the player's state to playing
- result = (*devState->bqPlayerPlay)->SetPlayState(devState->bqPlayerPlay, SL_PLAYSTATE_PLAYING);
- assert(SL_RESULT_SUCCESS == result);
-
- // enqueue the first buffer to kick off the callbacks
- result = (*devState->bqPlayerBufferQueue)->Enqueue(devState->bqPlayerBufferQueue, "\0", 1);
- assert(SL_RESULT_SUCCESS == result);
-
-
- SetDefaultWFXChannelOrder(pDevice);
- devlist_add(pDevice);
-
- return ALC_TRUE;
-}
-
-
-static void opensles_stop_playback(ALCdevice *pDevice)
-{
- LOGV("opensles_stop_playback device=%p", pDevice);
- stop_playback(pDevice);
-}
-
-static ALCboolean opensles_open_capture(ALCdevice *pDevice, const ALCchar *deviceName)
-{
- LOGV("opensles_open_capture device=%p, deviceName=%s", pDevice, deviceName);
- return ALC_FALSE;
-}
-
-static void opensles_close_capture(ALCdevice *pDevice)
-{
- LOGV("opensles_closed_capture device=%p", pDevice);
-}
-
-static void opensles_start_capture(ALCdevice *pDevice)
-{
- LOGV("opensles_start_capture device=%p", pDevice);
-}
-
-static void opensles_stop_capture(ALCdevice *pDevice)
-{
- LOGV("opensles_stop_capture device=%p", pDevice);
-}
-
-static void opensles_capture_samples(ALCdevice *pDevice, ALCvoid *pBuffer, ALCuint lSamples)
-{
- LOGV("opensles_capture_samples device=%p, pBuffer=%p, lSamples=%u", pDevice, pBuffer, lSamples);
-}
-
-static ALCuint opensles_available_samples(ALCdevice *pDevice)
-{
- LOGV("opensles_available_samples device=%p", pDevice);
- return 0;
-}
-
-// table of backend function pointers
-
-BackendFuncs opensles_funcs = {
- opensles_open_playback,
- opensles_close_playback,
- opensles_reset_playback,
- opensles_stop_playback,
- opensles_open_capture,
- opensles_close_capture,
- opensles_start_capture,
- opensles_stop_capture,
- opensles_capture_samples,
- opensles_available_samples
-};
-
-// global entry points called from XYZZY
-
-
-static void suspend_device(ALCdevice *pDevice) {
- SLresult result;
- if (pDevice) {
- opesles_data_t *devState = (opesles_data_t *) pDevice->ExtraData;
- if (devState->bqPlayerPlay) {
- result = (*devState->bqPlayerPlay)->SetPlayState(devState->bqPlayerPlay, SL_PLAYSTATE_PAUSED);
- if ((SL_RESULT_SUCCESS == result) && (devState->bqPlayerBufferQueue)) {
- result = (*devState->bqPlayerBufferQueue)->Clear(devState->bqPlayerBufferQueue);
- assert(SL_RESULT_SUCCESS == result);
- }
- }
- stop_playback(pDevice);
- }
-}
-
-static void resume_device(ALCdevice *pDevice) {
- SLresult result;
- if (pDevice) {
- opesles_data_t *devState = (opesles_data_t *) pDevice->ExtraData;
- if (devState->bqPlayerPlay) {
- result = (*devState->bqPlayerPlay)->SetPlayState(devState->bqPlayerPlay, SL_PLAYSTATE_PLAYING);
- // Pump some blank data into the buffer to stimulate the callback
- if ((SL_RESULT_SUCCESS == result) && (devState->bqPlayerBufferQueue)) {
- result = (*devState->bqPlayerBufferQueue)->Enqueue(devState->bqPlayerBufferQueue, "\0", 1);
- assert(SL_RESULT_SUCCESS == result);
- }
- }
- start_playback(pDevice);
- }
- }
-
-void alc_opensles_suspend()
-{
- devlist_process(&suspend_device);
-}
-
-void alc_opensles_resume()
-{
- devlist_process(&resume_device);
-}
-
-static void alc_opensles_set_java_vm(JavaVM *vm)
-{
- // Called once and only once from JNI_OnLoad
- javaVM = vm;
- int i;
- char *android_model;
- char *low_buffer_models[] = {
- "GT-I9300",
- "GT-I9305",
- "SHV-E210",
- "SGH-T999",
- "SGH-I747",
- "SGH-N064",
- "SC-06D",
- "SGH-N035",
- "SC-03E",
- "SCH-R530",
- "SCH-I535",
- "SPH-L710",
- "GT-I9308",
- "SCH-I939",
- "Kindle Fire",
- NULL};
-
- if(NULL != javaVM)
- {
- int android_os_version = alc_opensles_get_android_api();
- // If running on 4.1 (Jellybean) or later, use 8 buffers to avoid breakup/stuttering.
- if(android_os_version >= 16)
- {
- premixCount = 5;
- }
- // Else, use 4 buffers to reduce latency
- else
- {
- premixCount = 1;
- }
- android_model = alc_opensles_get_android_model();
- for (i = 0; low_buffer_models[i] != NULL; i++) {
- if (strncmp(android_model, low_buffer_models[i], strlen(low_buffer_models[i])) == 0) {
- LOGV("Using less buffering");
- defaultBufferSize = 1024;
- bufferSize = 1024;
- premixCount = 1;
- break;
- }
- }
- }
-}
-
-void alc_opensles_init(BackendFuncs *func_list)
-{
- LOGV("alc_opensles_init");
-
- struct stat statinfo;
- if (stat("/system/lib/libOpenSLES.so", &statinfo) != 0) {
- return;
- }
-
- *func_list = opensles_funcs;
-
- // We need the JavaVM for JNI so we can detect the OS version number at runtime.
- // This is because we need to use different bufferCount values for Android 4.1 vs. pre-4.1.
- // This must be set at constructor time before JNI_OnLoad is invoked.
- apportableOpenALFuncs.alc_android_set_java_vm = alc_opensles_set_java_vm;
-}
-
-void alc_opensles_deinit(void)
-{
- LOGV("alc_opensles_deinit");
-
- // destroy output mix object, and invalidate all associated interfaces
- if (outputMixObject != NULL) {
- (*outputMixObject)->Destroy(outputMixObject);
- outputMixObject = NULL;
- }
-
- // destroy engine object, and invalidate all associated interfaces
- if (engineObject != NULL) {
- (*engineObject)->Destroy(engineObject);
- engineObject = NULL;
- engineEngine = NULL;
- }
-}
-
-void alc_opensles_probe(int type)
-{
- char *error;
- struct stat statinfo;
- if (stat("/system/lib/libOpenSLES.so", &statinfo) != 0) {
- LOGV("alc_opensles_probe OpenSLES support not found.");
- return;
- }
-
- dlerror(); // Clear dl errors
- void *dlHandle = dlopen("/system/lib/libOpenSLES.so", RTLD_NOW | RTLD_GLOBAL);
- if (!dlHandle || (error = (typeof(error))dlerror()) != NULL) {
- LOGV("OpenSLES could not be loaded.");
- return;
- }
-
-#define LOAD_SYM_POINTER(sym) \
- do { \
- p##sym = dlsym(dlHandle, #sym); \
- if((error=(typeof(error))dlerror()) != NULL) { \
- LOGV("alc_opensles_probe could not load %s, error: %s", #sym, error); \
- dlclose(dlHandle); \
- return; \
- } \
- } while(0)
-
- LOAD_SYM_POINTER(slCreateEngine);
- LOAD_SYM_POINTER(SL_IID_ENGINE);
- LOAD_SYM_POINTER(SL_IID_ANDROIDSIMPLEBUFFERQUEUE);
- LOAD_SYM_POINTER(SL_IID_PLAY);
- LOAD_SYM_POINTER(SL_IID_BUFFERQUEUE);
-
- apportableOpenALFuncs.alc_android_suspend = alc_opensles_suspend;
- apportableOpenALFuncs.alc_android_resume = alc_opensles_resume;
-
- switch (type) {
- case DEVICE_PROBE:
- LOGV("alc_opensles_probe DEVICE_PROBE");
- AppendDeviceList(opensles_device);
- break;
- case ALL_DEVICE_PROBE:
- LOGV("alc_opensles_probe ALL_DEVICE_PROBE");
- AppendAllDeviceList(opensles_device);
- break;
- default:
- LOGV("alc_opensles_probe type=%d", type);
- break;
- }
-}
diff --git a/internal/c/parts/audio/out/android/OpenAL/Alc/oss.c b/internal/c/parts/audio/out/android/OpenAL/Alc/oss.c
deleted file mode 100644
index ea18689d7..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Alc/oss.c
+++ /dev/null
@@ -1,521 +0,0 @@
-/**
- * OpenAL cross platform audio library
- * Copyright (C) 1999-2007 by authors.
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- * Or go to http://www.gnu.org/copyleft/lgpl.html
- */
-
-#include "config.h"
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include "alMain.h"
-#include "AL/al.h"
-#include "AL/alc.h"
-
-#include
-
-/*
- * The OSS documentation talks about SOUND_MIXER_READ, but the header
- * only contains MIXER_READ. Play safe. Same for WRITE.
- */
-#ifndef SOUND_MIXER_READ
-#define SOUND_MIXER_READ MIXER_READ
-#endif
-#ifndef SOUND_MIXER_WRITE
-#define SOUND_MIXER_WRITE MIXER_WRITE
-#endif
-
-static const ALCchar oss_device[] = "OSS Default";
-
-typedef struct {
- int fd;
- volatile int killNow;
- ALvoid *thread;
-
- ALubyte *mix_data;
- int data_size;
-
- RingBuffer *ring;
- int doCapture;
-} oss_data;
-
-
-static int log2i(ALCuint x)
-{
- int y = 0;
- while (x > 1)
- {
- x >>= 1;
- y++;
- }
- return y;
-}
-
-
-static ALuint OSSProc(ALvoid *ptr)
-{
- ALCdevice *pDevice = (ALCdevice*)ptr;
- oss_data *data = (oss_data*)pDevice->ExtraData;
- ALint frameSize;
- ssize_t wrote;
-
- SetRTPriority();
-
- frameSize = FrameSizeFromDevFmt(pDevice->FmtChans, pDevice->FmtType);
-
- while(!data->killNow && pDevice->Connected)
- {
- ALint len = data->data_size;
- ALubyte *WritePtr = data->mix_data;
-
- aluMixData(pDevice, WritePtr, len/frameSize);
- while(len > 0 && !data->killNow)
- {
- wrote = write(data->fd, WritePtr, len);
- if(wrote < 0)
- {
- if(errno != EAGAIN && errno != EWOULDBLOCK && errno != EINTR)
- {
- AL_PRINT("write failed: %s\n", strerror(errno));
- aluHandleDisconnect(pDevice);
- break;
- }
-
- Sleep(1);
- continue;
- }
-
- len -= wrote;
- WritePtr += wrote;
- }
- }
-
- return 0;
-}
-
-static ALuint OSSCaptureProc(ALvoid *ptr)
-{
- ALCdevice *pDevice = (ALCdevice*)ptr;
- oss_data *data = (oss_data*)pDevice->ExtraData;
- int frameSize;
- int amt;
-
- SetRTPriority();
-
- frameSize = FrameSizeFromDevFmt(pDevice->FmtChans, pDevice->FmtType);
-
- while(!data->killNow)
- {
- amt = read(data->fd, data->mix_data, data->data_size);
- if(amt < 0)
- {
- AL_PRINT("read failed: %s\n", strerror(errno));
- aluHandleDisconnect(pDevice);
- break;
- }
- if(amt == 0)
- {
- Sleep(1);
- continue;
- }
- if(data->doCapture)
- WriteRingBuffer(data->ring, data->mix_data, amt/frameSize);
- }
-
- return 0;
-}
-
-static ALCboolean oss_open_playback(ALCdevice *device, const ALCchar *deviceName)
-{
- char driver[64];
- oss_data *data;
-
- strncpy(driver, GetConfigValue("oss", "device", "/dev/dsp"), sizeof(driver)-1);
- driver[sizeof(driver)-1] = 0;
- if(!deviceName)
- deviceName = oss_device;
- else if(strcmp(deviceName, oss_device) != 0)
- return ALC_FALSE;
-
- data = (oss_data*)calloc(1, sizeof(oss_data));
- data->killNow = 0;
-
- data->fd = open(driver, O_WRONLY);
- if(data->fd == -1)
- {
- free(data);
- AL_PRINT("Could not open %s: %s\n", driver, strerror(errno));
- return ALC_FALSE;
- }
-
- device->szDeviceName = strdup(deviceName);
- device->ExtraData = data;
- return ALC_TRUE;
-}
-
-static void oss_close_playback(ALCdevice *device)
-{
- oss_data *data = (oss_data*)device->ExtraData;
-
- close(data->fd);
- free(data);
- device->ExtraData = NULL;
-}
-
-static ALCboolean oss_reset_playback(ALCdevice *device)
-{
- oss_data *data = (oss_data*)device->ExtraData;
- int numFragmentsLogSize;
- int log2FragmentSize;
- unsigned int periods;
- audio_buf_info info;
- ALuint frameSize;
- int numChannels;
- int ossFormat;
- int ossSpeed;
- char *err;
-
- switch(device->FmtType)
- {
- case DevFmtByte:
- ossFormat = AFMT_S8;
- break;
- case DevFmtUByte:
- ossFormat = AFMT_U8;
- break;
- case DevFmtUShort:
- case DevFmtFloat:
- device->FmtType = DevFmtShort;
- /* fall-through */
- case DevFmtShort:
- ossFormat = AFMT_S16_NE;
- break;
- }
-
- periods = device->NumUpdates;
- numChannels = ChannelsFromDevFmt(device->FmtChans);
- frameSize = numChannels * BytesFromDevFmt(device->FmtType);
-
- ossSpeed = device->Frequency;
- log2FragmentSize = log2i(device->UpdateSize * frameSize);
-
- /* according to the OSS spec, 16 bytes are the minimum */
- if (log2FragmentSize < 4)
- log2FragmentSize = 4;
- /* Subtract one period since the temp mixing buffer counts as one. Still
- * need at least two on the card, though. */
- if(periods > 2) periods--;
- numFragmentsLogSize = (periods << 16) | log2FragmentSize;
-
-#define CHECKERR(func) if((func) < 0) { \
- err = #func; \
- goto err; \
-}
- /* Don't fail if SETFRAGMENT fails. We can handle just about anything
- * that's reported back via GETOSPACE */
- ioctl(data->fd, SNDCTL_DSP_SETFRAGMENT, &numFragmentsLogSize);
- CHECKERR(ioctl(data->fd, SNDCTL_DSP_SETFMT, &ossFormat));
- CHECKERR(ioctl(data->fd, SNDCTL_DSP_CHANNELS, &numChannels));
- CHECKERR(ioctl(data->fd, SNDCTL_DSP_SPEED, &ossSpeed));
- CHECKERR(ioctl(data->fd, SNDCTL_DSP_GETOSPACE, &info));
- if(0)
- {
- err:
- AL_PRINT("%s failed: %s\n", err, strerror(errno));
- return ALC_FALSE;
- }
-#undef CHECKERR
-
- if((int)ChannelsFromDevFmt(device->FmtChans) != numChannels)
- {
- AL_PRINT("Could not set %d channels, got %d instead\n", ChannelsFromDevFmt(device->FmtChans), numChannels);
- return ALC_FALSE;
- }
-
- if(!((ossFormat == AFMT_S8 && device->FmtType == DevFmtByte) ||
- (ossFormat == AFMT_U8 && device->FmtType == DevFmtUByte) ||
- (ossFormat == AFMT_S16_NE && device->FmtType == DevFmtShort)))
- {
- AL_PRINT("Could not set %#x format type, got OSS format %#x\n", device->FmtType, ossFormat);
- return ALC_FALSE;
- }
-
- device->Frequency = ossSpeed;
- device->UpdateSize = info.fragsize / frameSize;
- device->NumUpdates = info.fragments + 1;
-
- data->data_size = device->UpdateSize * frameSize;
- data->mix_data = calloc(1, data->data_size);
-
- SetDefaultChannelOrder(device);
-
- data->thread = StartThread(OSSProc, device);
- if(data->thread == NULL)
- {
- free(data->mix_data);
- data->mix_data = NULL;
- return ALC_FALSE;
- }
-
- return ALC_TRUE;
-}
-
-static void oss_stop_playback(ALCdevice *device)
-{
- oss_data *data = (oss_data*)device->ExtraData;
-
- if(!data->thread)
- return;
-
- data->killNow = 1;
- StopThread(data->thread);
- data->thread = NULL;
-
- data->killNow = 0;
- if(ioctl(data->fd, SNDCTL_DSP_RESET) != 0)
- AL_PRINT("Error resetting device: %s\n", strerror(errno));
-
- free(data->mix_data);
- data->mix_data = NULL;
-}
-
-
-static ALCboolean oss_open_capture(ALCdevice *device, const ALCchar *deviceName)
-{
- int numFragmentsLogSize;
- int log2FragmentSize;
- unsigned int periods;
- audio_buf_info info;
- ALuint frameSize;
- int numChannels;
- char driver[64];
- oss_data *data;
- int ossFormat;
- int ossSpeed;
- char *err;
-
- strncpy(driver, GetConfigValue("oss", "capture", "/dev/dsp"), sizeof(driver)-1);
- driver[sizeof(driver)-1] = 0;
- if(!deviceName)
- deviceName = oss_device;
- else if(strcmp(deviceName, oss_device) != 0)
- return ALC_FALSE;
-
- data = (oss_data*)calloc(1, sizeof(oss_data));
- data->killNow = 0;
-
- data->fd = open(driver, O_RDONLY);
- if(data->fd == -1)
- {
- free(data);
- AL_PRINT("Could not open %s: %s\n", driver, strerror(errno));
- return ALC_FALSE;
- }
-
- switch(device->FmtType)
- {
- case DevFmtByte:
- ossFormat = AFMT_S8;
- break;
- case DevFmtUByte:
- ossFormat = AFMT_U8;
- break;
- case DevFmtShort:
- ossFormat = AFMT_S16_NE;
- break;
- case DevFmtUShort:
- case DevFmtFloat:
- free(data);
- AL_PRINT("Format type %#x capture not supported on OSS\n", device->FmtType);
- return ALC_FALSE;
- }
-
- periods = 4;
- numChannels = ChannelsFromDevFmt(device->FmtChans);
- frameSize = numChannels * BytesFromDevFmt(device->FmtType);
- ossSpeed = device->Frequency;
- log2FragmentSize = log2i(device->UpdateSize * device->NumUpdates *
- frameSize / periods);
-
- /* according to the OSS spec, 16 bytes are the minimum */
- if (log2FragmentSize < 4)
- log2FragmentSize = 4;
- numFragmentsLogSize = (periods << 16) | log2FragmentSize;
-
-#define CHECKERR(func) if((func) < 0) { \
- err = #func; \
- goto err; \
-}
- CHECKERR(ioctl(data->fd, SNDCTL_DSP_SETFRAGMENT, &numFragmentsLogSize));
- CHECKERR(ioctl(data->fd, SNDCTL_DSP_SETFMT, &ossFormat));
- CHECKERR(ioctl(data->fd, SNDCTL_DSP_CHANNELS, &numChannels));
- CHECKERR(ioctl(data->fd, SNDCTL_DSP_SPEED, &ossSpeed));
- CHECKERR(ioctl(data->fd, SNDCTL_DSP_GETISPACE, &info));
- if(0)
- {
- err:
- AL_PRINT("%s failed: %s\n", err, strerror(errno));
- close(data->fd);
- free(data);
- return ALC_FALSE;
- }
-#undef CHECKERR
-
- if((int)ChannelsFromDevFmt(device->FmtChans) != numChannels)
- {
- AL_PRINT("Could not set %d channels, got %d instead\n", ChannelsFromDevFmt(device->FmtChans), numChannels);
- close(data->fd);
- free(data);
- return ALC_FALSE;
- }
-
- if(!((ossFormat == AFMT_S8 && device->FmtType == DevFmtByte) ||
- (ossFormat == AFMT_U8 && device->FmtType == DevFmtUByte) ||
- (ossFormat == AFMT_S16_NE && device->FmtType == DevFmtShort)))
- {
- AL_PRINT("Could not set %#x format type, got OSS format %#x\n", device->FmtType, ossFormat);
- close(data->fd);
- free(data);
- return ALC_FALSE;
- }
-
- data->ring = CreateRingBuffer(frameSize, device->UpdateSize * device->NumUpdates);
- if(!data->ring)
- {
- AL_PRINT("ring buffer create failed\n");
- close(data->fd);
- free(data);
- return ALC_FALSE;
- }
-
- data->data_size = info.fragsize;
- data->mix_data = calloc(1, data->data_size);
-
- device->ExtraData = data;
- data->thread = StartThread(OSSCaptureProc, device);
- if(data->thread == NULL)
- {
- device->ExtraData = NULL;
- free(data->mix_data);
- free(data);
- return ALC_FALSE;
- }
-
- device->szDeviceName = strdup(deviceName);
- return ALC_TRUE;
-}
-
-static void oss_close_capture(ALCdevice *device)
-{
- oss_data *data = (oss_data*)device->ExtraData;
- data->killNow = 1;
- StopThread(data->thread);
-
- close(data->fd);
-
- DestroyRingBuffer(data->ring);
-
- free(data->mix_data);
- free(data);
- device->ExtraData = NULL;
-}
-
-static void oss_start_capture(ALCdevice *pDevice)
-{
- oss_data *data = (oss_data*)pDevice->ExtraData;
- data->doCapture = 1;
-}
-
-static void oss_stop_capture(ALCdevice *pDevice)
-{
- oss_data *data = (oss_data*)pDevice->ExtraData;
- data->doCapture = 0;
-}
-
-static void oss_capture_samples(ALCdevice *pDevice, ALCvoid *pBuffer, ALCuint lSamples)
-{
- oss_data *data = (oss_data*)pDevice->ExtraData;
- if(lSamples <= (ALCuint)RingBufferSize(data->ring))
- ReadRingBuffer(data->ring, pBuffer, lSamples);
- else
- alcSetError(pDevice, ALC_INVALID_VALUE);
-}
-
-static ALCuint oss_available_samples(ALCdevice *pDevice)
-{
- oss_data *data = (oss_data*)pDevice->ExtraData;
- return RingBufferSize(data->ring);
-}
-
-
-BackendFuncs oss_funcs = {
- oss_open_playback,
- oss_close_playback,
- oss_reset_playback,
- oss_stop_playback,
- oss_open_capture,
- oss_close_capture,
- oss_start_capture,
- oss_stop_capture,
- oss_capture_samples,
- oss_available_samples
-};
-
-void alc_oss_init(BackendFuncs *func_list)
-{
- *func_list = oss_funcs;
-}
-
-void alc_oss_deinit(void)
-{
-}
-
-void alc_oss_probe(int type)
-{
- if(type == DEVICE_PROBE)
- {
-#ifdef HAVE_STAT
- struct stat buf;
- if(stat(GetConfigValue("oss", "device", "/dev/dsp"), &buf) == 0)
-#endif
- AppendDeviceList(oss_device);
- }
- else if(type == ALL_DEVICE_PROBE)
- {
-#ifdef HAVE_STAT
- struct stat buf;
- if(stat(GetConfigValue("oss", "device", "/dev/dsp"), &buf) == 0)
-#endif
- AppendAllDeviceList(oss_device);
- }
- else if(type == CAPTURE_DEVICE_PROBE)
- {
-#ifdef HAVE_STAT
- struct stat buf;
- if(stat(GetConfigValue("oss", "capture", "/dev/dsp"), &buf) == 0)
-#endif
- AppendCaptureDeviceList(oss_device);
- }
-}
diff --git a/internal/c/parts/audio/out/android/OpenAL/Alc/panning.c b/internal/c/parts/audio/out/android/OpenAL/Alc/panning.c
deleted file mode 100644
index 5e33d9f5e..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Alc/panning.c
+++ /dev/null
@@ -1,372 +0,0 @@
-/**
- * OpenAL cross platform audio library
- * Copyright (C) 1999-2010 by authors.
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- * Or go to http://www.gnu.org/copyleft/lgpl.html
- */
-
-#include "config.h"
-
-#include
-#include
-#include
-#include
-#include
-
-#include "alMain.h"
-#include "AL/al.h"
-#include "AL/alc.h"
-#include "alu.h"
-
-static void SetSpeakerArrangement(const char *name, ALfp SpeakerAngle[MAXCHANNELS],
- Channel Speaker2Chan[MAXCHANNELS], ALint chans)
-{
- char layout_str[256];
- char *confkey, *next;
- char *sep, *end;
- Channel val;
- int i;
-
- if(!ConfigValueExists(NULL, name))
- name = "layout";
-
- strncpy(layout_str, GetConfigValue(NULL, name, ""), sizeof(layout_str));
- layout_str[sizeof(layout_str)-1] = 0;
-
- if(!layout_str[0])
- return;
-
- next = confkey = layout_str;
- while(next && *next)
- {
- confkey = next;
- next = strchr(confkey, ',');
- if(next)
- {
- *next = 0;
- do {
- next++;
- } while(isspace(*next) || *next == ',');
- }
-
- sep = strchr(confkey, '=');
- if(!sep || confkey == sep)
- continue;
-
- end = sep - 1;
- while(isspace(*end) && end != confkey)
- end--;
- *(++end) = 0;
-
- if(strcmp(confkey, "fl") == 0 || strcmp(confkey, "front-left") == 0)
- val = FRONT_LEFT;
- else if(strcmp(confkey, "fr") == 0 || strcmp(confkey, "front-right") == 0)
- val = FRONT_RIGHT;
- else if(strcmp(confkey, "fc") == 0 || strcmp(confkey, "front-center") == 0)
- val = FRONT_CENTER;
- else if(strcmp(confkey, "bl") == 0 || strcmp(confkey, "back-left") == 0)
- val = BACK_LEFT;
- else if(strcmp(confkey, "br") == 0 || strcmp(confkey, "back-right") == 0)
- val = BACK_RIGHT;
- else if(strcmp(confkey, "bc") == 0 || strcmp(confkey, "back-center") == 0)
- val = BACK_CENTER;
- else if(strcmp(confkey, "sl") == 0 || strcmp(confkey, "side-left") == 0)
- val = SIDE_LEFT;
- else if(strcmp(confkey, "sr") == 0 || strcmp(confkey, "side-right") == 0)
- val = SIDE_RIGHT;
- else
- {
- AL_PRINT("Unknown speaker for %s: \"%s\"\n", name, confkey);
- continue;
- }
-
- *(sep++) = 0;
- while(isspace(*sep))
- sep++;
-
- for(i = 0;i < chans;i++)
- {
- if(Speaker2Chan[i] == val)
- {
- long angle = strtol(sep, NULL, 10);
- if(angle >= -180 && angle <= 180)
- SpeakerAngle[i] = ALfpMult(int2ALfp(angle), float2ALfp(M_PI/180.0f));
- else
- AL_PRINT("Invalid angle for speaker \"%s\": %ld\n", confkey, angle);
- break;
- }
- }
- }
-
- for(i = 0;i < chans;i++)
- {
- int min = i;
- int i2;
-
- for(i2 = i+1;i2 < chans;i2++)
- {
- if(SpeakerAngle[i2] < SpeakerAngle[min])
- min = i2;
- }
-
- if(min != i)
- {
- ALfp tmpf;
- Channel tmpc;
-
- tmpf = SpeakerAngle[i];
- SpeakerAngle[i] = SpeakerAngle[min];
- SpeakerAngle[min] = tmpf;
-
- tmpc = Speaker2Chan[i];
- Speaker2Chan[i] = Speaker2Chan[min];
- Speaker2Chan[min] = tmpc;
- }
- }
-}
-
-static ALfp aluLUTpos2Angle(ALint pos)
-{
- if(pos < QUADRANT_NUM)
- return aluAtan(ALfpDiv(int2ALfp(pos), int2ALfp(QUADRANT_NUM - pos)));
- if(pos < 2 * QUADRANT_NUM)
- return (float2ALfp(M_PI_2) + aluAtan(ALfpDiv(int2ALfp(pos - QUADRANT_NUM),int2ALfp(2 * QUADRANT_NUM - pos))));
- if(pos < 3 * QUADRANT_NUM)
- return (aluAtan(ALfpDiv(int2ALfp(pos - 2 * QUADRANT_NUM), int2ALfp(3 * QUADRANT_NUM - pos))) - float2ALfp(M_PI));
- return (aluAtan(ALfpDiv(int2ALfp(pos - 3 * QUADRANT_NUM), int2ALfp(4 * QUADRANT_NUM - pos))) - float2ALfp(M_PI));
-}
-
-ALint aluCart2LUTpos(ALfp re, ALfp im)
-{
- ALint pos = 0;
- ALfp denom = (aluFabs(re) + aluFabs(im));
- if(denom > int2ALfp(0))
- pos = (ALint)ALfp2int(ALfpDiv(ALfpMult(int2ALfp(QUADRANT_NUM),aluFabs(im)), (denom + float2ALfp(0.5))));
-
- if(re < int2ALfp(0))
- pos = 2 * QUADRANT_NUM - pos;
- if(im < int2ALfp(0))
- pos = LUT_NUM - pos;
- return pos%LUT_NUM;
-}
-
-ALvoid aluInitPanning(ALCdevice *Device)
-{
- ALfp SpeakerAngle[MAXCHANNELS];
- ALfp (*Matrix)[MAXCHANNELS];
- Channel *Speaker2Chan;
- ALfp Alpha, Theta;
- ALfp *PanningLUT;
- ALint pos, offset;
- ALuint s, s2;
-
- for(s = 0;s < MAXCHANNELS;s++)
- {
- for(s2 = 0;s2 < MAXCHANNELS;s2++)
- Device->ChannelMatrix[s][s2] = ((s==s2) ? int2ALfp(1) : int2ALfp(0));
- }
-
- Speaker2Chan = Device->Speaker2Chan;
- Matrix = Device->ChannelMatrix;
- switch(Device->FmtChans)
- {
- case DevFmtMono:
- Matrix[FRONT_LEFT][FRONT_CENTER] = aluSqrt(float2ALfp(0.5));
- Matrix[FRONT_RIGHT][FRONT_CENTER] = aluSqrt(float2ALfp(0.5));
- Matrix[SIDE_LEFT][FRONT_CENTER] = aluSqrt(float2ALfp(0.5));
- Matrix[SIDE_RIGHT][FRONT_CENTER] = aluSqrt(float2ALfp(0.5));
- Matrix[BACK_LEFT][FRONT_CENTER] = aluSqrt(float2ALfp(0.5));
- Matrix[BACK_RIGHT][FRONT_CENTER] = aluSqrt(float2ALfp(0.5));
- Matrix[BACK_CENTER][FRONT_CENTER] = int2ALfp(1);
- Device->NumChan = 1;
- Speaker2Chan[0] = FRONT_CENTER;
- SpeakerAngle[0] = int2ALfp(0);
- break;
-
- case DevFmtStereo:
-#ifdef APPORTABLE_OPTIMIZED_OUT
- // Leave as identity matrix if Apportable-optimized
- Matrix[FRONT_CENTER][FRONT_LEFT] = aluSqrt(float2ALfp(0.5));
- Matrix[FRONT_CENTER][FRONT_RIGHT] = aluSqrt(float2ALfp(0.5));
- Matrix[SIDE_LEFT][FRONT_LEFT] = int2ALfp(1);
- Matrix[SIDE_RIGHT][FRONT_RIGHT] = int2ALfp(1);
- Matrix[BACK_LEFT][FRONT_LEFT] = int2ALfp(1);
- Matrix[BACK_RIGHT][FRONT_RIGHT] = int2ALfp(1);
- Matrix[BACK_CENTER][FRONT_LEFT] = aluSqrt(float2ALfp(0.5));
- Matrix[BACK_CENTER][FRONT_RIGHT] = aluSqrt(float2ALfp(0.5));
-#endif
- Device->NumChan = 2;
- Speaker2Chan[0] = FRONT_LEFT;
- Speaker2Chan[1] = FRONT_RIGHT;
- SpeakerAngle[0] = float2ALfp(-90.0f * M_PI/180.0f);
- SpeakerAngle[1] = float2ALfp( 90.0f * M_PI/180.0f);
- SetSpeakerArrangement("layout_STEREO", SpeakerAngle, Speaker2Chan, Device->NumChan);
- break;
-
-#ifdef STEREO_ONLY
- case DevFmtQuad:
- case DevFmtX51:
- case DevFmtX61:
- case DevFmtX71:
- break;
-#else
- case DevFmtQuad:
- Matrix[FRONT_CENTER][FRONT_LEFT] = aluSqrt(float2ALfp(0.5));
- Matrix[FRONT_CENTER][FRONT_RIGHT] = aluSqrt(float2ALfp(0.5));
- Matrix[SIDE_LEFT][FRONT_LEFT] = aluSqrt(float2ALfp(0.5));
- Matrix[SIDE_LEFT][BACK_LEFT] = aluSqrt(float2ALfp(0.5));
- Matrix[SIDE_RIGHT][FRONT_RIGHT] = aluSqrt(float2ALfp(0.5));
- Matrix[SIDE_RIGHT][BACK_RIGHT] = aluSqrt(float2ALfp(0.5));
- Matrix[BACK_CENTER][BACK_LEFT] = aluSqrt(float2ALfp(0.5));
- Matrix[BACK_CENTER][BACK_RIGHT] = aluSqrt(float2ALfp(0.5));
- Device->NumChan = 4;
- Speaker2Chan[0] = BACK_LEFT;
- Speaker2Chan[1] = FRONT_LEFT;
- Speaker2Chan[2] = FRONT_RIGHT;
- Speaker2Chan[3] = BACK_RIGHT;
- SpeakerAngle[0] = float2ALfp(-135.0f * M_PI/180.0f);
- SpeakerAngle[1] = float2ALfp( -45.0f * M_PI/180.0f);
- SpeakerAngle[2] = float2ALfp( 45.0f * M_PI/180.0f);
- SpeakerAngle[3] = float2ALfp( 135.0f * M_PI/180.0f);
- SetSpeakerArrangement("layout_QUAD", SpeakerAngle, Speaker2Chan, Device->NumChan);
- break;
-
- case DevFmtX51:
- Matrix[SIDE_LEFT][FRONT_LEFT] = aluSqrt(float2ALfp(0.5));
- Matrix[SIDE_LEFT][BACK_LEFT] = aluSqrt(float2ALfp(0.5));
- Matrix[SIDE_RIGHT][FRONT_RIGHT] = aluSqrt(float2ALfp(0.5));
- Matrix[SIDE_RIGHT][BACK_RIGHT] = aluSqrt(float2ALfp(0.5));
- Matrix[BACK_CENTER][BACK_LEFT] = aluSqrt(float2ALfp(0.5));
- Matrix[BACK_CENTER][BACK_RIGHT] = aluSqrt(float2ALfp(0.5));
- Device->NumChan = 5;
- Speaker2Chan[0] = BACK_LEFT;
- Speaker2Chan[1] = FRONT_LEFT;
- Speaker2Chan[2] = FRONT_CENTER;
- Speaker2Chan[3] = FRONT_RIGHT;
- Speaker2Chan[4] = BACK_RIGHT;
- SpeakerAngle[0] = float2ALfp(-110.0f * M_PI/180.0f);
- SpeakerAngle[1] = float2ALfp( -30.0f * M_PI/180.0f);
- SpeakerAngle[2] = float2ALfp( 0.0f * M_PI/180.0f);
- SpeakerAngle[3] = float2ALfp( 30.0f * M_PI/180.0f);
- SpeakerAngle[4] = float2ALfp( 110.0f * M_PI/180.0f);
- SetSpeakerArrangement("layout_51CHN", SpeakerAngle, Speaker2Chan, Device->NumChan);
- break;
-
- case DevFmtX61:
- Matrix[BACK_LEFT][BACK_CENTER] = aluSqrt(float2ALfp(0.5));
- Matrix[BACK_LEFT][SIDE_LEFT] = aluSqrt(float2ALfp(0.5));
- Matrix[BACK_RIGHT][BACK_CENTER] = aluSqrt(float2ALfp(0.5));
- Matrix[BACK_RIGHT][SIDE_RIGHT] = aluSqrt(float2ALfp(0.5));
- Device->NumChan = 6;
- Speaker2Chan[0] = SIDE_LEFT;
- Speaker2Chan[1] = FRONT_LEFT;
- Speaker2Chan[2] = FRONT_CENTER;
- Speaker2Chan[3] = FRONT_RIGHT;
- Speaker2Chan[4] = SIDE_RIGHT;
- Speaker2Chan[5] = BACK_CENTER;
- SpeakerAngle[0] = float2ALfp(-90.0f * M_PI/180.0f);
- SpeakerAngle[1] = float2ALfp(-30.0f * M_PI/180.0f);
- SpeakerAngle[2] = float2ALfp( 0.0f * M_PI/180.0f);
- SpeakerAngle[3] = float2ALfp( 30.0f * M_PI/180.0f);
- SpeakerAngle[4] = float2ALfp( 90.0f * M_PI/180.0f);
- SpeakerAngle[5] = float2ALfp(180.0f * M_PI/180.0f);
- SetSpeakerArrangement("layout_61CHN", SpeakerAngle, Speaker2Chan, Device->NumChan);
- break;
-
- case DevFmtX71:
- Matrix[BACK_CENTER][BACK_LEFT] = aluSqrt(float2ALfp(0.5));
- Matrix[BACK_CENTER][BACK_RIGHT] = aluSqrt(float2ALfp(0.5));
- Device->NumChan = 7;
- Speaker2Chan[0] = BACK_LEFT;
- Speaker2Chan[1] = SIDE_LEFT;
- Speaker2Chan[2] = FRONT_LEFT;
- Speaker2Chan[3] = FRONT_CENTER;
- Speaker2Chan[4] = FRONT_RIGHT;
- Speaker2Chan[5] = SIDE_RIGHT;
- Speaker2Chan[6] = BACK_RIGHT;
- SpeakerAngle[0] = float2ALfp(-150.0f * M_PI/180.0f);
- SpeakerAngle[1] = float2ALfp( -90.0f * M_PI/180.0f);
- SpeakerAngle[2] = float2ALfp( -30.0f * M_PI/180.0f);
- SpeakerAngle[3] = float2ALfp( 0.0f * M_PI/180.0f);
- SpeakerAngle[4] = float2ALfp( 30.0f * M_PI/180.0f);
- SpeakerAngle[5] = float2ALfp( 90.0f * M_PI/180.0f);
- SpeakerAngle[6] = float2ALfp( 150.0f * M_PI/180.0f);
- SetSpeakerArrangement("layout_71CHN", SpeakerAngle, Speaker2Chan, Device->NumChan);
- break;
-#endif
- }
-
- if(GetConfigValueBool(NULL, "scalemix", 0))
- {
- ALfp maxout = int2ALfp(1);;
- for(s = 0;s < MAXCHANNELS;s++)
- {
- ALfp out = int2ALfp(0);
- for(s2 = 0;s2 < MAXCHANNELS;s2++)
- out = (out + Device->ChannelMatrix[s2][s]);
- maxout = __max(maxout, out);
- }
-
- maxout = ALfpDiv(int2ALfp(1),maxout);
- for(s = 0;s < MAXCHANNELS;s++)
- {
- for(s2 = 0;s2 < MAXCHANNELS;s2++)
- Device->ChannelMatrix[s2][s] = ALfpMult(Device->ChannelMatrix[s2][s],maxout);
- }
- }
-
- PanningLUT = Device->PanningLUT;
- for(pos = 0; pos < LUT_NUM; pos++)
- {
- /* clear all values */
- offset = MAXCHANNELS * pos;
- for(s = 0; s < MAXCHANNELS; s++)
- PanningLUT[offset+s] = int2ALfp(0);
-
- if(Device->NumChan == 1)
- {
- PanningLUT[offset + Speaker2Chan[0]] = int2ALfp(1);
- continue;
- }
-
- /* source angle */
- Theta = aluLUTpos2Angle(pos);
-
- /* set panning values */
- for(s = 0; s < Device->NumChan - 1; s++)
- {
- if(Theta >= SpeakerAngle[s] && Theta < SpeakerAngle[s+1])
- {
- /* source between speaker s and speaker s+1 */
- Alpha = ALfpDiv(ALfpMult(float2ALfp(M_PI_2), (Theta-SpeakerAngle[s])),
- (SpeakerAngle[s+1]-SpeakerAngle[s]));
- PanningLUT[offset + Speaker2Chan[s]] = __cos(Alpha);
- PanningLUT[offset + Speaker2Chan[s+1]] = __sin(Alpha);
- break;
- }
- }
- if(s == Device->NumChan - 1)
- {
- /* source between last and first speaker */
- if(Theta < SpeakerAngle[0])
- Theta = (Theta + float2ALfp(2.0f * M_PI));
- Alpha = ALfpDiv(ALfpMult(float2ALfp(M_PI_2), (Theta-SpeakerAngle[s])),
- (float2ALfp(2.0f * M_PI) + SpeakerAngle[0]-SpeakerAngle[s]));
- PanningLUT[offset + Speaker2Chan[s]] = __cos(Alpha);
- PanningLUT[offset + Speaker2Chan[0]] = __sin(Alpha);
- }
- }
-}
diff --git a/internal/c/parts/audio/out/android/OpenAL/Alc/portaudio.c b/internal/c/parts/audio/out/android/OpenAL/Alc/portaudio.c
deleted file mode 100644
index 77c7236fa..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Alc/portaudio.c
+++ /dev/null
@@ -1,442 +0,0 @@
-/**
- * OpenAL cross platform audio library
- * Copyright (C) 1999-2007 by authors.
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- * Or go to http://www.gnu.org/copyleft/lgpl.html
- */
-
-#include "config.h"
-
-#include
-#include
-#include
-#include "alMain.h"
-#include "AL/al.h"
-#include "AL/alc.h"
-#ifdef HAVE_DLFCN_H
-#include
-#endif
-
-#include
-
-static void *pa_handle;
-#define MAKE_FUNC(x) static typeof(x) * p##x
-MAKE_FUNC(Pa_Initialize);
-MAKE_FUNC(Pa_Terminate);
-MAKE_FUNC(Pa_GetErrorText);
-MAKE_FUNC(Pa_StartStream);
-MAKE_FUNC(Pa_StopStream);
-MAKE_FUNC(Pa_OpenStream);
-MAKE_FUNC(Pa_CloseStream);
-MAKE_FUNC(Pa_GetDefaultOutputDevice);
-MAKE_FUNC(Pa_GetStreamInfo);
-#undef MAKE_FUNC
-
-
-static const ALCchar pa_device[] = "PortAudio Default";
-
-
-void *pa_load(void)
-{
- if(!pa_handle)
- {
- PaError err;
-
-#ifdef _WIN32
- pa_handle = LoadLibrary("portaudio.dll");
-#define LOAD_FUNC(x) do { \
- p##x = (typeof(p##x))GetProcAddress(pa_handle, #x); \
- if(!(p##x)) { \
- AL_PRINT("Could not load %s from portaudio.dll\n", #x); \
- FreeLibrary(pa_handle); \
- pa_handle = NULL; \
- return NULL; \
- } \
-} while(0)
-
-#elif defined(HAVE_DLFCN_H)
-
- const char *str;
-#if defined(__APPLE__) && defined(__MACH__)
-# define PALIB "libportaudio.2.dylib"
-#else
-# define PALIB "libportaudio.so.2"
-#endif
- pa_handle = dlopen(PALIB, RTLD_NOW);
- dlerror();
-
-#define LOAD_FUNC(f) do { \
- p##f = (typeof(f)*)dlsym(pa_handle, #f); \
- if((str=dlerror()) != NULL) \
- { \
- dlclose(pa_handle); \
- pa_handle = NULL; \
- AL_PRINT("Could not load %s from "PALIB": %s\n", #f, str); \
- return NULL; \
- } \
-} while(0)
-
-#else
- pa_handle = (void*)0xDEADBEEF;
-#define LOAD_FUNC(f) p##f = f
-#endif
-
- if(!pa_handle)
- return NULL;
-
-LOAD_FUNC(Pa_Initialize);
-LOAD_FUNC(Pa_Terminate);
-LOAD_FUNC(Pa_GetErrorText);
-LOAD_FUNC(Pa_StartStream);
-LOAD_FUNC(Pa_StopStream);
-LOAD_FUNC(Pa_OpenStream);
-LOAD_FUNC(Pa_CloseStream);
-LOAD_FUNC(Pa_GetDefaultOutputDevice);
-LOAD_FUNC(Pa_GetStreamInfo);
-
-#undef LOAD_FUNC
-
- if((err=pPa_Initialize()) != paNoError)
- {
- AL_PRINT("Pa_Initialize() returned an error: %s\n", pPa_GetErrorText(err));
-#ifdef _WIN32
- FreeLibrary(pa_handle);
-#elif defined(HAVE_DLFCN_H)
- dlclose(pa_handle);
-#endif
- pa_handle = NULL;
- return NULL;
- }
- }
- return pa_handle;
-}
-
-
-typedef struct {
- PaStream *stream;
- ALuint update_size;
-
- RingBuffer *ring;
-} pa_data;
-
-
-static int pa_callback(const void *inputBuffer, void *outputBuffer,
- unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo *timeInfo,
- const PaStreamCallbackFlags statusFlags, void *userData)
-{
- ALCdevice *device = (ALCdevice*)userData;
-
- (void)inputBuffer;
- (void)timeInfo;
- (void)statusFlags;
-
- aluMixData(device, outputBuffer, framesPerBuffer);
- return 0;
-}
-
-static int pa_capture_cb(const void *inputBuffer, void *outputBuffer,
- unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo *timeInfo,
- const PaStreamCallbackFlags statusFlags, void *userData)
-{
- ALCdevice *device = (ALCdevice*)userData;
- pa_data *data = (pa_data*)device->ExtraData;
-
- (void)outputBuffer;
- (void)timeInfo;
- (void)statusFlags;
-
- WriteRingBuffer(data->ring, inputBuffer, framesPerBuffer);
- return 0;
-}
-
-
-static ALCboolean pa_open_playback(ALCdevice *device, const ALCchar *deviceName)
-{
- const PaStreamInfo *streamInfo;
- PaStreamParameters outParams;
- pa_data *data;
- PaError err;
-
- if(!deviceName)
- deviceName = pa_device;
- else if(strcmp(deviceName, pa_device) != 0)
- return ALC_FALSE;
-
- if(!pa_load())
- return ALC_FALSE;
-
- data = (pa_data*)calloc(1, sizeof(pa_data));
- data->update_size = device->UpdateSize;
-
- device->ExtraData = data;
-
- outParams.device = GetConfigValueInt("port", "device", -1);
- if(outParams.device < 0)
- outParams.device = pPa_GetDefaultOutputDevice();
- outParams.suggestedLatency = (device->UpdateSize*device->NumUpdates) /
- (float)device->Frequency;
- outParams.hostApiSpecificStreamInfo = NULL;
-
- switch(device->FmtType)
- {
- case DevFmtByte:
- outParams.sampleFormat = paInt8;
- break;
- case DevFmtUByte:
- outParams.sampleFormat = paUInt8;
- break;
- case DevFmtUShort:
- device->FmtType = DevFmtShort;
- /* fall-through */
- case DevFmtShort:
- outParams.sampleFormat = paInt16;
- break;
- case DevFmtFloat:
- outParams.sampleFormat = paFloat32;
- break;
- }
- outParams.channelCount = ChannelsFromDevFmt(device->FmtChans);
-
- SetDefaultChannelOrder(device);
-
- err = pPa_OpenStream(&data->stream, NULL, &outParams, device->Frequency,
- device->UpdateSize, paNoFlag, pa_callback, device);
- if(err != paNoError)
- {
- AL_PRINT("Pa_OpenStream() returned an error: %s\n", pPa_GetErrorText(err));
- device->ExtraData = NULL;
- free(data);
- return ALC_FALSE;
- }
- streamInfo = pPa_GetStreamInfo(data->stream);
-
- device->szDeviceName = strdup(deviceName);
- device->Frequency = streamInfo->sampleRate;
-
- return ALC_TRUE;
-}
-
-static void pa_close_playback(ALCdevice *device)
-{
- pa_data *data = (pa_data*)device->ExtraData;
- PaError err;
-
- err = pPa_CloseStream(data->stream);
- if(err != paNoError)
- AL_PRINT("Error closing stream: %s\n", pPa_GetErrorText(err));
-
- free(data);
- device->ExtraData = NULL;
-}
-
-static ALCboolean pa_reset_playback(ALCdevice *device)
-{
- pa_data *data = (pa_data*)device->ExtraData;
- const PaStreamInfo *streamInfo;
- PaError err;
-
- streamInfo = pPa_GetStreamInfo(data->stream);
- device->Frequency = streamInfo->sampleRate;
- device->UpdateSize = data->update_size;
-
- err = pPa_StartStream(data->stream);
- if(err != paNoError)
- {
- AL_PRINT("Pa_StartStream() returned an error: %s\n", pPa_GetErrorText(err));
- return ALC_FALSE;
- }
-
- return ALC_TRUE;
-}
-
-static void pa_stop_playback(ALCdevice *device)
-{
- pa_data *data = (pa_data*)device->ExtraData;
- PaError err;
-
- err = pPa_StopStream(data->stream);
- if(err != paNoError)
- AL_PRINT("Error stopping stream: %s\n", pPa_GetErrorText(err));
-}
-
-
-static ALCboolean pa_open_capture(ALCdevice *device, const ALCchar *deviceName)
-{
- PaStreamParameters inParams;
- ALuint frame_size;
- pa_data *data;
- PaError err;
-
- if(!deviceName)
- deviceName = pa_device;
- else if(strcmp(deviceName, pa_device) != 0)
- return ALC_FALSE;
-
- if(!pa_load())
- return ALC_FALSE;
-
- data = (pa_data*)calloc(1, sizeof(pa_data));
- if(data == NULL)
- {
- alcSetError(device, ALC_OUT_OF_MEMORY);
- return ALC_FALSE;
- }
-
- frame_size = FrameSizeFromDevFmt(device->FmtChans, device->FmtType);
- data->ring = CreateRingBuffer(frame_size, device->UpdateSize*device->NumUpdates);
- if(data->ring == NULL)
- {
- alcSetError(device, ALC_OUT_OF_MEMORY);
- goto error;
- }
-
- inParams.device = GetConfigValueInt("port", "capture", -1);
- if(inParams.device < 0)
- inParams.device = pPa_GetDefaultOutputDevice();
- inParams.suggestedLatency = 0.0f;
- inParams.hostApiSpecificStreamInfo = NULL;
-
- switch(device->FmtType)
- {
- case DevFmtByte:
- inParams.sampleFormat = paInt8;
- break;
- case DevFmtUByte:
- inParams.sampleFormat = paUInt8;
- break;
- case DevFmtShort:
- inParams.sampleFormat = paInt16;
- break;
- case DevFmtFloat:
- inParams.sampleFormat = paFloat32;
- break;
- case DevFmtUShort:
- AL_PRINT("Unsigned short not supported\n");
- goto error;
- }
- inParams.channelCount = ChannelsFromDevFmt(device->FmtChans);
-
- err = pPa_OpenStream(&data->stream, &inParams, NULL, device->Frequency,
- paFramesPerBufferUnspecified, paNoFlag, pa_capture_cb, device);
- if(err != paNoError)
- {
- AL_PRINT("Pa_OpenStream() returned an error: %s\n", pPa_GetErrorText(err));
- goto error;
- }
-
- device->szDeviceName = strdup(deviceName);
-
- device->ExtraData = data;
- return ALC_TRUE;
-
-error:
- DestroyRingBuffer(data->ring);
- free(data);
- return ALC_FALSE;
-}
-
-static void pa_close_capture(ALCdevice *device)
-{
- pa_data *data = (pa_data*)device->ExtraData;
- PaError err;
-
- err = pPa_CloseStream(data->stream);
- if(err != paNoError)
- AL_PRINT("Error closing stream: %s\n", pPa_GetErrorText(err));
-
- free(data);
- device->ExtraData = NULL;
-}
-
-static void pa_start_capture(ALCdevice *device)
-{
- pa_data *data = device->ExtraData;
- PaError err;
-
- err = pPa_StartStream(data->stream);
- if(err != paNoError)
- AL_PRINT("Error starting stream: %s\n", pPa_GetErrorText(err));
-}
-
-static void pa_stop_capture(ALCdevice *device)
-{
- pa_data *data = (pa_data*)device->ExtraData;
- PaError err;
-
- err = pPa_StopStream(data->stream);
- if(err != paNoError)
- AL_PRINT("Error stopping stream: %s\n", pPa_GetErrorText(err));
-}
-
-static void pa_capture_samples(ALCdevice *device, ALCvoid *buffer, ALCuint samples)
-{
- pa_data *data = device->ExtraData;
- if(samples <= (ALCuint)RingBufferSize(data->ring))
- ReadRingBuffer(data->ring, buffer, samples);
- else
- alcSetError(device, ALC_INVALID_VALUE);
-}
-
-static ALCuint pa_available_samples(ALCdevice *device)
-{
- pa_data *data = device->ExtraData;
- return RingBufferSize(data->ring);
-}
-
-
-static const BackendFuncs pa_funcs = {
- pa_open_playback,
- pa_close_playback,
- pa_reset_playback,
- pa_stop_playback,
- pa_open_capture,
- pa_close_capture,
- pa_start_capture,
- pa_stop_capture,
- pa_capture_samples,
- pa_available_samples
-};
-
-void alc_pa_init(BackendFuncs *func_list)
-{
- *func_list = pa_funcs;
-}
-
-void alc_pa_deinit(void)
-{
- if(pa_handle)
- {
- pPa_Terminate();
-#ifdef _WIN32
- FreeLibrary(pa_handle);
-#elif defined(HAVE_DLFCN_H)
- dlclose(pa_handle);
-#endif
- pa_handle = NULL;
- }
-}
-
-void alc_pa_probe(int type)
-{
- if(!pa_load()) return;
-
- if(type == DEVICE_PROBE)
- AppendDeviceList(pa_device);
- else if(type == ALL_DEVICE_PROBE)
- AppendAllDeviceList(pa_device);
- else if(type == CAPTURE_DEVICE_PROBE)
- AppendCaptureDeviceList(pa_device);
-}
diff --git a/internal/c/parts/audio/out/android/OpenAL/Alc/pulseaudio.c b/internal/c/parts/audio/out/android/OpenAL/Alc/pulseaudio.c
deleted file mode 100644
index 348f2d533..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Alc/pulseaudio.c
+++ /dev/null
@@ -1,1358 +0,0 @@
-/**
- * OpenAL cross platform audio library
- * Copyright (C) 2009 by Konstantinos Natsakis
- * Copyright (C) 2010 by Chris Robinson
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- * Or go to http://www.gnu.org/copyleft/lgpl.html
- */
-
-#include "config.h"
-
-#include "alMain.h"
-#ifdef HAVE_DLFCN_H
-#include
-#endif
-
-#include
-
-#if PA_API_VERSION == 11
-#define PA_STREAM_ADJUST_LATENCY 0x2000U
-#define PA_STREAM_EARLY_REQUESTS 0x4000U
-static __inline int PA_STREAM_IS_GOOD(pa_stream_state_t x)
-{
- return (x == PA_STREAM_CREATING || x == PA_STREAM_READY);
-}
-static __inline int PA_CONTEXT_IS_GOOD(pa_context_state_t x)
-{
- return (x == PA_CONTEXT_CONNECTING || x == PA_CONTEXT_AUTHORIZING ||
- x == PA_CONTEXT_SETTING_NAME || x == PA_CONTEXT_READY);
-}
-#define PA_STREAM_IS_GOOD PA_STREAM_IS_GOOD
-#define PA_CONTEXT_IS_GOOD PA_CONTEXT_IS_GOOD
-#elif PA_API_VERSION != 12
-#error Invalid PulseAudio API version
-#endif
-
-#ifndef PA_CHECK_VERSION
-#define PA_CHECK_VERSION(major,minor,micro) \
- ((PA_MAJOR > (major)) || \
- (PA_MAJOR == (major) && PA_MINOR > (minor)) || \
- (PA_MAJOR == (major) && PA_MINOR == (minor) && PA_MICRO >= (micro)))
-#endif
-
-static void *pa_handle;
-#define MAKE_FUNC(x) static typeof(x) * p##x
-MAKE_FUNC(pa_context_unref);
-MAKE_FUNC(pa_sample_spec_valid);
-MAKE_FUNC(pa_stream_drop);
-MAKE_FUNC(pa_strerror);
-MAKE_FUNC(pa_context_get_state);
-MAKE_FUNC(pa_stream_get_state);
-MAKE_FUNC(pa_threaded_mainloop_signal);
-MAKE_FUNC(pa_stream_peek);
-MAKE_FUNC(pa_threaded_mainloop_wait);
-MAKE_FUNC(pa_threaded_mainloop_unlock);
-MAKE_FUNC(pa_threaded_mainloop_in_thread);
-MAKE_FUNC(pa_context_new);
-MAKE_FUNC(pa_threaded_mainloop_stop);
-MAKE_FUNC(pa_context_disconnect);
-MAKE_FUNC(pa_threaded_mainloop_start);
-MAKE_FUNC(pa_threaded_mainloop_get_api);
-MAKE_FUNC(pa_context_set_state_callback);
-MAKE_FUNC(pa_stream_write);
-MAKE_FUNC(pa_xfree);
-MAKE_FUNC(pa_stream_connect_record);
-MAKE_FUNC(pa_stream_connect_playback);
-MAKE_FUNC(pa_stream_readable_size);
-MAKE_FUNC(pa_stream_writable_size);
-MAKE_FUNC(pa_stream_cork);
-MAKE_FUNC(pa_stream_is_suspended);
-MAKE_FUNC(pa_stream_get_device_name);
-MAKE_FUNC(pa_path_get_filename);
-MAKE_FUNC(pa_get_binary_name);
-MAKE_FUNC(pa_threaded_mainloop_free);
-MAKE_FUNC(pa_context_errno);
-MAKE_FUNC(pa_xmalloc);
-MAKE_FUNC(pa_stream_unref);
-MAKE_FUNC(pa_threaded_mainloop_accept);
-MAKE_FUNC(pa_stream_set_write_callback);
-MAKE_FUNC(pa_threaded_mainloop_new);
-MAKE_FUNC(pa_context_connect);
-MAKE_FUNC(pa_stream_set_buffer_attr);
-MAKE_FUNC(pa_stream_get_buffer_attr);
-MAKE_FUNC(pa_stream_get_sample_spec);
-MAKE_FUNC(pa_stream_get_time);
-MAKE_FUNC(pa_stream_set_read_callback);
-MAKE_FUNC(pa_stream_set_state_callback);
-MAKE_FUNC(pa_stream_set_moved_callback);
-MAKE_FUNC(pa_stream_set_underflow_callback);
-MAKE_FUNC(pa_stream_new);
-MAKE_FUNC(pa_stream_disconnect);
-MAKE_FUNC(pa_threaded_mainloop_lock);
-MAKE_FUNC(pa_channel_map_init_auto);
-MAKE_FUNC(pa_channel_map_parse);
-MAKE_FUNC(pa_channel_map_snprint);
-MAKE_FUNC(pa_channel_map_equal);
-MAKE_FUNC(pa_context_get_server_info);
-MAKE_FUNC(pa_context_get_sink_info_by_name);
-MAKE_FUNC(pa_context_get_sink_info_list);
-MAKE_FUNC(pa_context_get_source_info_list);
-MAKE_FUNC(pa_operation_get_state);
-MAKE_FUNC(pa_operation_unref);
-#if PA_CHECK_VERSION(0,9,15)
-MAKE_FUNC(pa_channel_map_superset);
-MAKE_FUNC(pa_stream_set_buffer_attr_callback);
-#endif
-#if PA_CHECK_VERSION(0,9,16)
-MAKE_FUNC(pa_stream_begin_write);
-#endif
-#undef MAKE_FUNC
-
-#ifndef PATH_MAX
-#define PATH_MAX 4096
-#endif
-
-typedef struct {
- char *device_name;
-
- ALCuint samples;
- ALCuint frame_size;
-
- RingBuffer *ring;
-
- pa_buffer_attr attr;
- pa_sample_spec spec;
-
- pa_threaded_mainloop *loop;
-
- ALvoid *thread;
- volatile ALboolean killNow;
-
- pa_stream *stream;
- pa_context *context;
-} pulse_data;
-
-typedef struct {
- char *name;
- char *device_name;
-} DevMap;
-
-
-static const ALCchar pulse_device[] = "PulseAudio Default";
-static DevMap *allDevNameMap;
-static ALuint numDevNames;
-static DevMap *allCaptureDevNameMap;
-static ALuint numCaptureDevNames;
-static pa_context_flags_t pulse_ctx_flags;
-
-
-void *pulse_load(void) //{{{
-{
- if(!pa_handle)
- {
-#ifdef _WIN32
- pa_handle = LoadLibrary("libpulse-0.dll");
-#define LOAD_FUNC(x) do { \
- p##x = (typeof(p##x))GetProcAddress(pa_handle, #x); \
- if(!(p##x)) { \
- AL_PRINT("Could not load %s from libpulse-0.dll\n", #x); \
- FreeLibrary(pa_handle); \
- pa_handle = NULL; \
- return NULL; \
- } \
-} while(0)
-#define LOAD_OPTIONAL_FUNC(x) do { \
- p##x = (typeof(p##x))GetProcAddress(pa_handle, #x); \
-} while(0)
-
-#elif defined (HAVE_DLFCN_H)
-
- const char *err;
-#if defined(__APPLE__) && defined(__MACH__)
- pa_handle = dlopen("libpulse.0.dylib", RTLD_NOW);
-#else
- pa_handle = dlopen("libpulse.so.0", RTLD_NOW);
-#endif
- dlerror();
-
-#define LOAD_FUNC(x) do { \
- p##x = dlsym(pa_handle, #x); \
- if((err=dlerror()) != NULL) { \
- AL_PRINT("Could not load %s from libpulse: %s\n", #x, err); \
- dlclose(pa_handle); \
- pa_handle = NULL; \
- return NULL; \
- } \
-} while(0)
-#define LOAD_OPTIONAL_FUNC(x) do { \
- p##x = dlsym(pa_handle, #x); \
- if((err=dlerror()) != NULL) { \
- p##x = NULL; \
- } \
-} while(0)
-
-#else
-
- pa_handle = (void*)0xDEADBEEF;
-#define LOAD_FUNC(x) p##x = (x)
-#define LOAD_OPTIONAL_FUNC(x) p##x = (x)
-
-#endif
- if(!pa_handle)
- return NULL;
-
-LOAD_FUNC(pa_context_unref);
-LOAD_FUNC(pa_sample_spec_valid);
-LOAD_FUNC(pa_stream_drop);
-LOAD_FUNC(pa_strerror);
-LOAD_FUNC(pa_context_get_state);
-LOAD_FUNC(pa_stream_get_state);
-LOAD_FUNC(pa_threaded_mainloop_signal);
-LOAD_FUNC(pa_stream_peek);
-LOAD_FUNC(pa_threaded_mainloop_wait);
-LOAD_FUNC(pa_threaded_mainloop_unlock);
-LOAD_FUNC(pa_threaded_mainloop_in_thread);
-LOAD_FUNC(pa_context_new);
-LOAD_FUNC(pa_threaded_mainloop_stop);
-LOAD_FUNC(pa_context_disconnect);
-LOAD_FUNC(pa_threaded_mainloop_start);
-LOAD_FUNC(pa_threaded_mainloop_get_api);
-LOAD_FUNC(pa_context_set_state_callback);
-LOAD_FUNC(pa_stream_write);
-LOAD_FUNC(pa_xfree);
-LOAD_FUNC(pa_stream_connect_record);
-LOAD_FUNC(pa_stream_connect_playback);
-LOAD_FUNC(pa_stream_readable_size);
-LOAD_FUNC(pa_stream_writable_size);
-LOAD_FUNC(pa_stream_cork);
-LOAD_FUNC(pa_stream_is_suspended);
-LOAD_FUNC(pa_stream_get_device_name);
-LOAD_FUNC(pa_path_get_filename);
-LOAD_FUNC(pa_get_binary_name);
-LOAD_FUNC(pa_threaded_mainloop_free);
-LOAD_FUNC(pa_context_errno);
-LOAD_FUNC(pa_xmalloc);
-LOAD_FUNC(pa_stream_unref);
-LOAD_FUNC(pa_threaded_mainloop_accept);
-LOAD_FUNC(pa_stream_set_write_callback);
-LOAD_FUNC(pa_threaded_mainloop_new);
-LOAD_FUNC(pa_context_connect);
-LOAD_FUNC(pa_stream_set_buffer_attr);
-LOAD_FUNC(pa_stream_get_buffer_attr);
-LOAD_FUNC(pa_stream_get_sample_spec);
-LOAD_FUNC(pa_stream_get_time);
-LOAD_FUNC(pa_stream_set_read_callback);
-LOAD_FUNC(pa_stream_set_state_callback);
-LOAD_FUNC(pa_stream_set_moved_callback);
-LOAD_FUNC(pa_stream_set_underflow_callback);
-LOAD_FUNC(pa_stream_new);
-LOAD_FUNC(pa_stream_disconnect);
-LOAD_FUNC(pa_threaded_mainloop_lock);
-LOAD_FUNC(pa_channel_map_init_auto);
-LOAD_FUNC(pa_channel_map_parse);
-LOAD_FUNC(pa_channel_map_snprint);
-LOAD_FUNC(pa_channel_map_equal);
-LOAD_FUNC(pa_context_get_server_info);
-LOAD_FUNC(pa_context_get_sink_info_by_name);
-LOAD_FUNC(pa_context_get_sink_info_list);
-LOAD_FUNC(pa_context_get_source_info_list);
-LOAD_FUNC(pa_operation_get_state);
-LOAD_FUNC(pa_operation_unref);
-#if PA_CHECK_VERSION(0,9,15)
-LOAD_OPTIONAL_FUNC(pa_channel_map_superset);
-LOAD_OPTIONAL_FUNC(pa_stream_set_buffer_attr_callback);
-#endif
-#if PA_CHECK_VERSION(0,9,16)
-LOAD_OPTIONAL_FUNC(pa_stream_begin_write);
-#endif
-
-#undef LOAD_OPTIONAL_FUNC
-#undef LOAD_FUNC
- }
- return pa_handle;
-} //}}}
-
-// PulseAudio Event Callbacks //{{{
-static void context_state_callback(pa_context *context, void *pdata) //{{{
-{
- pa_threaded_mainloop *loop = pdata;
- pa_context_state_t state;
-
- state = ppa_context_get_state(context);
- if(state == PA_CONTEXT_READY || !PA_CONTEXT_IS_GOOD(state))
- ppa_threaded_mainloop_signal(loop, 0);
-}//}}}
-
-static void stream_state_callback(pa_stream *stream, void *pdata) //{{{
-{
- pa_threaded_mainloop *loop = pdata;
- pa_stream_state_t state;
-
- state = ppa_stream_get_state(stream);
- if(state == PA_STREAM_READY || !PA_STREAM_IS_GOOD(state))
- ppa_threaded_mainloop_signal(loop, 0);
-}//}}}
-
-static void stream_signal_callback(pa_stream *stream, void *pdata) //{{{
-{
- ALCdevice *Device = pdata;
- pulse_data *data = Device->ExtraData;
- (void)stream;
-
- ppa_threaded_mainloop_signal(data->loop, 0);
-}//}}}
-
-static void stream_buffer_attr_callback(pa_stream *stream, void *pdata) //{{{
-{
- ALCdevice *Device = pdata;
- pulse_data *data = Device->ExtraData;
-
- SuspendContext(NULL);
-
- data->attr = *(ppa_stream_get_buffer_attr(stream));
- Device->UpdateSize = data->attr.minreq / data->frame_size;
- Device->NumUpdates = (data->attr.tlength/data->frame_size) / Device->UpdateSize;
- if(Device->NumUpdates <= 1)
- {
- Device->NumUpdates = 1;
- AL_PRINT("PulseAudio returned minreq > tlength/2; expect break up\n");
- }
-
- ProcessContext(NULL);
-}//}}}
-
-static void stream_device_callback(pa_stream *stream, void *pdata) //{{{
-{
- ALCdevice *Device = pdata;
- pulse_data *data = Device->ExtraData;
-
- free(data->device_name);
- data->device_name = strdup(ppa_stream_get_device_name(stream));
-}//}}}
-
-static void context_state_callback2(pa_context *context, void *pdata) //{{{
-{
- ALCdevice *Device = pdata;
- pulse_data *data = Device->ExtraData;
-
- if(ppa_context_get_state(context) == PA_CONTEXT_FAILED)
- {
- AL_PRINT("Received context failure!\n");
- aluHandleDisconnect(Device);
- }
- ppa_threaded_mainloop_signal(data->loop, 0);
-}//}}}
-
-static void stream_state_callback2(pa_stream *stream, void *pdata) //{{{
-{
- ALCdevice *Device = pdata;
- pulse_data *data = Device->ExtraData;
-
- if(ppa_stream_get_state(stream) == PA_STREAM_FAILED)
- {
- AL_PRINT("Received stream failure!\n");
- aluHandleDisconnect(Device);
- }
- ppa_threaded_mainloop_signal(data->loop, 0);
-}//}}}
-
-static void stream_success_callback(pa_stream *stream, int success, void *pdata) //{{{
-{
- ALCdevice *Device = pdata;
- pulse_data *data = Device->ExtraData;
- (void)stream;
- (void)success;
-
- ppa_threaded_mainloop_signal(data->loop, 0);
-}//}}}
-
-static void sink_info_callback(pa_context *context, const pa_sink_info *info, int eol, void *pdata) //{{{
-{
- ALCdevice *device = pdata;
- pulse_data *data = device->ExtraData;
- char chanmap_str[256] = "";
- const struct {
- const char *str;
- enum DevFmtChannels chans;
- } chanmaps[] = {
- { "front-left,front-right,front-center,lfe,rear-left,rear-right,side-left,side-right",
- DevFmtX71 },
- { "front-left,front-right,front-center,lfe,rear-center,side-left,side-right",
- DevFmtX61 },
- { "front-left,front-right,front-center,lfe,rear-left,rear-right",
- DevFmtX51 },
- { "front-left,front-right,rear-left,rear-right", DevFmtQuad },
- { "front-left,front-right", DevFmtStereo },
- { "mono", DevFmtMono },
- { NULL, 0 }
- };
- int i;
- (void)context;
-
- if(eol)
- {
- ppa_threaded_mainloop_signal(data->loop, 0);
- return;
- }
-
- for(i = 0;chanmaps[i].str;i++)
- {
- pa_channel_map map;
- if(!ppa_channel_map_parse(&map, chanmaps[i].str))
- continue;
-
- if(ppa_channel_map_equal(&info->channel_map, &map)
-#if PA_CHECK_VERSION(0,9,15)
- || (ppa_channel_map_superset &&
- ppa_channel_map_superset(&info->channel_map, &map))
-#endif
- )
- {
- device->FmtChans = chanmaps[i].chans;
- return;
- }
- }
-
- ppa_channel_map_snprint(chanmap_str, sizeof(chanmap_str), &info->channel_map);
- AL_PRINT("Failed to find format for channel map:\n %s\n", chanmap_str);
-}//}}}
-
-static void sink_device_callback(pa_context *context, const pa_sink_info *info, int eol, void *pdata) //{{{
-{
- pa_threaded_mainloop *loop = pdata;
- char str[1024];
- void *temp;
- int count;
- ALuint i;
-
- (void)context;
-
- if(eol)
- {
- ppa_threaded_mainloop_signal(loop, 0);
- return;
- }
-
- count = 0;
- do {
- if(count == 0)
- snprintf(str, sizeof(str), "%s via PulseAudio", info->description);
- else
- snprintf(str, sizeof(str), "%s #%d via PulseAudio", info->description, count+1);
- count++;
-
- for(i = 0;i < numDevNames;i++)
- {
- if(strcmp(str, allDevNameMap[i].name) == 0)
- break;
- }
- } while(i != numDevNames);
-
- temp = realloc(allDevNameMap, (numDevNames+1) * sizeof(*allDevNameMap));
- if(temp)
- {
- allDevNameMap = temp;
- allDevNameMap[numDevNames].name = strdup(str);
- allDevNameMap[numDevNames].device_name = strdup(info->name);
- numDevNames++;
- }
-}//}}}
-
-static void source_device_callback(pa_context *context, const pa_source_info *info, int eol, void *pdata) //{{{
-{
- pa_threaded_mainloop *loop = pdata;
- char str[1024];
- void *temp;
- int count;
- ALuint i;
-
- (void)context;
-
- if(eol)
- {
- ppa_threaded_mainloop_signal(loop, 0);
- return;
- }
-
- count = 0;
- do {
- if(count == 0)
- snprintf(str, sizeof(str), "%s via PulseAudio", info->description);
- else
- snprintf(str, sizeof(str), "%s #%d via PulseAudio", info->description, count+1);
- count++;
-
- for(i = 0;i < numCaptureDevNames;i++)
- {
- if(strcmp(str, allCaptureDevNameMap[i].name) == 0)
- break;
- }
- } while(i != numCaptureDevNames);
-
- temp = realloc(allCaptureDevNameMap, (numCaptureDevNames+1) * sizeof(*allCaptureDevNameMap));
- if(temp)
- {
- allCaptureDevNameMap = temp;
- allCaptureDevNameMap[numCaptureDevNames].name = strdup(str);
- allCaptureDevNameMap[numCaptureDevNames].device_name = strdup(info->name);
- numCaptureDevNames++;
- }
-}//}}}
-//}}}
-
-// PulseAudio I/O Callbacks //{{{
-static void stream_write_callback(pa_stream *stream, size_t len, void *pdata) //{{{
-{
- ALCdevice *Device = pdata;
- pulse_data *data = Device->ExtraData;
- (void)stream;
- (void)len;
-
- ppa_threaded_mainloop_signal(data->loop, 0);
-} //}}}
-//}}}
-
-static ALuint PulseProc(ALvoid *param)
-{
- ALCdevice *Device = param;
- pulse_data *data = Device->ExtraData;
- ssize_t len;
-
- SetRTPriority();
-
- ppa_threaded_mainloop_lock(data->loop);
- do {
- len = (Device->Connected ? ppa_stream_writable_size(data->stream) : 0);
- len -= len%(Device->UpdateSize*data->frame_size);
- if(len == 0)
- {
- ppa_threaded_mainloop_wait(data->loop);
- continue;
- }
-
- while(len > 0)
- {
- size_t newlen = len;
- void *buf;
- pa_free_cb_t free_func = NULL;
-
-#if PA_CHECK_VERSION(0,9,16)
- if(!ppa_stream_begin_write ||
- ppa_stream_begin_write(data->stream, &buf, &newlen) < 0)
-#endif
- {
- buf = ppa_xmalloc(newlen);
- free_func = ppa_xfree;
- }
- ppa_threaded_mainloop_unlock(data->loop);
-
- aluMixData(Device, buf, newlen/data->frame_size);
-
- ppa_threaded_mainloop_lock(data->loop);
- ppa_stream_write(data->stream, buf, newlen, free_func, 0, PA_SEEK_RELATIVE);
- len -= newlen;
- }
- } while(Device->Connected && !data->killNow);
- ppa_threaded_mainloop_unlock(data->loop);
-
- return 0;
-}
-
-static pa_context *connect_context(pa_threaded_mainloop *loop)
-{
- const char *name = "OpenAL Soft";
- char path_name[PATH_MAX];
- pa_context_state_t state;
- pa_context *context;
- int err;
-
- if(ppa_get_binary_name(path_name, sizeof(path_name)))
- name = ppa_path_get_filename(path_name);
-
- context = ppa_context_new(ppa_threaded_mainloop_get_api(loop), name);
- if(!context)
- {
- AL_PRINT("pa_context_new() failed\n");
- return NULL;
- }
-
- ppa_context_set_state_callback(context, context_state_callback, loop);
-
- if((err=ppa_context_connect(context, NULL, pulse_ctx_flags, NULL)) >= 0)
- {
- while((state=ppa_context_get_state(context)) != PA_CONTEXT_READY)
- {
- if(!PA_CONTEXT_IS_GOOD(state))
- {
- err = ppa_context_errno(context);
- if(err > 0) err = -err;
- break;
- }
-
- ppa_threaded_mainloop_wait(loop);
- }
- }
- ppa_context_set_state_callback(context, NULL, NULL);
-
- if(err < 0)
- {
- AL_PRINT("Context did not connect: %s\n", ppa_strerror(err));
- ppa_context_unref(context);
- return NULL;
- }
-
- return context;
-}
-
-static pa_stream *connect_playback_stream(ALCdevice *device,
- pa_stream_flags_t flags, pa_buffer_attr *attr, pa_sample_spec *spec,
- pa_channel_map *chanmap)
-{
- pulse_data *data = device->ExtraData;
- pa_stream_state_t state;
- pa_stream *stream;
-
- stream = ppa_stream_new(data->context, "Playback Stream", spec, chanmap);
- if(!stream)
- {
- AL_PRINT("pa_stream_new() failed: %s\n",
- ppa_strerror(ppa_context_errno(data->context)));
- return NULL;
- }
-
- ppa_stream_set_state_callback(stream, stream_state_callback, data->loop);
-
- if(ppa_stream_connect_playback(stream, data->device_name, attr, flags, NULL, NULL) < 0)
- {
- AL_PRINT("Stream did not connect: %s\n",
- ppa_strerror(ppa_context_errno(data->context)));
- ppa_stream_unref(stream);
- return NULL;
- }
-
- while((state=ppa_stream_get_state(stream)) != PA_STREAM_READY)
- {
- if(!PA_STREAM_IS_GOOD(state))
- {
- AL_PRINT("Stream did not get ready: %s\n",
- ppa_strerror(ppa_context_errno(data->context)));
- ppa_stream_unref(stream);
- return NULL;
- }
-
- ppa_threaded_mainloop_wait(data->loop);
- }
- ppa_stream_set_state_callback(stream, NULL, NULL);
-
- return stream;
-}
-
-static void probe_devices(ALboolean capture)
-{
- pa_threaded_mainloop *loop;
-
- if(capture == AL_FALSE)
- allDevNameMap = malloc(sizeof(DevMap) * 1);
- else
- allCaptureDevNameMap = malloc(sizeof(DevMap) * 1);
-
- if((loop=ppa_threaded_mainloop_new()) &&
- ppa_threaded_mainloop_start(loop) >= 0)
- {
- pa_context *context;
-
- ppa_threaded_mainloop_lock(loop);
- context = connect_context(loop);
- if(context)
- {
- pa_operation *o;
-
- if(capture == AL_FALSE)
- {
- allDevNameMap[0].name = strdup(pulse_device);
- allDevNameMap[0].device_name = NULL;
- numDevNames = 1;
-
- o = ppa_context_get_sink_info_list(context, sink_device_callback, loop);
- }
- else
- {
- allCaptureDevNameMap[0].name = strdup(pulse_device);
- allCaptureDevNameMap[0].device_name = NULL;
- numCaptureDevNames = 1;
-
- o = ppa_context_get_source_info_list(context, source_device_callback, loop);
- }
- while(ppa_operation_get_state(o) == PA_OPERATION_RUNNING)
- ppa_threaded_mainloop_wait(loop);
- ppa_operation_unref(o);
-
- ppa_context_disconnect(context);
- ppa_context_unref(context);
- }
- ppa_threaded_mainloop_unlock(loop);
- ppa_threaded_mainloop_stop(loop);
- }
- if(loop)
- ppa_threaded_mainloop_free(loop);
-}
-
-
-static ALCboolean pulse_open(ALCdevice *device, const ALCchar *device_name) //{{{
-{
- pulse_data *data = ppa_xmalloc(sizeof(pulse_data));
- memset(data, 0, sizeof(*data));
-
- if(!(data->loop = ppa_threaded_mainloop_new()))
- {
- AL_PRINT("pa_threaded_mainloop_new() failed!\n");
- goto out;
- }
- if(ppa_threaded_mainloop_start(data->loop) < 0)
- {
- AL_PRINT("pa_threaded_mainloop_start() failed\n");
- goto out;
- }
-
- ppa_threaded_mainloop_lock(data->loop);
- device->ExtraData = data;
-
- data->context = connect_context(data->loop);
- if(!data->context)
- {
- ppa_threaded_mainloop_unlock(data->loop);
- goto out;
- }
- ppa_context_set_state_callback(data->context, context_state_callback2, device);
-
- device->szDeviceName = strdup(device_name);
-
- ppa_threaded_mainloop_unlock(data->loop);
- return ALC_TRUE;
-
-out:
- if(data->loop)
- {
- ppa_threaded_mainloop_stop(data->loop);
- ppa_threaded_mainloop_free(data->loop);
- }
-
- device->ExtraData = NULL;
- ppa_xfree(data);
- return ALC_FALSE;
-} //}}}
-
-static void pulse_close(ALCdevice *device) //{{{
-{
- pulse_data *data = device->ExtraData;
-
- ppa_threaded_mainloop_lock(data->loop);
-
- if(data->stream)
- {
- ppa_stream_disconnect(data->stream);
- ppa_stream_unref(data->stream);
- }
-
- ppa_context_disconnect(data->context);
- ppa_context_unref(data->context);
-
- ppa_threaded_mainloop_unlock(data->loop);
-
- ppa_threaded_mainloop_stop(data->loop);
- ppa_threaded_mainloop_free(data->loop);
-
- DestroyRingBuffer(data->ring);
- free(data->device_name);
-
- device->ExtraData = NULL;
- ppa_xfree(data);
-} //}}}
-//}}}
-
-// OpenAL {{{
-static ALCboolean pulse_open_playback(ALCdevice *device, const ALCchar *device_name) //{{{
-{
- char *pulse_name = NULL;
- pa_sample_spec spec;
- pulse_data *data;
-
- if(!pulse_load())
- return ALC_FALSE;
-
- if(!allDevNameMap)
- probe_devices(AL_FALSE);
-
- if(!device_name && numDevNames > 0)
- device_name = allDevNameMap[0].name;
- else
- {
- ALuint i;
-
- for(i = 0;i < numDevNames;i++)
- {
- if(strcmp(device_name, allDevNameMap[i].name) == 0)
- {
- pulse_name = allDevNameMap[i].device_name;
- break;
- }
- }
- if(i == numDevNames)
- return ALC_FALSE;
- }
-
- if(pulse_open(device, device_name) == ALC_FALSE)
- return ALC_FALSE;
-
- data = device->ExtraData;
-
- ppa_threaded_mainloop_lock(data->loop);
-
- spec.format = PA_SAMPLE_S16NE;
- spec.rate = 44100;
- spec.channels = 2;
-
- data->device_name = pulse_name;
- pa_stream *stream = connect_playback_stream(device, 0, NULL, &spec, NULL);
- if(!stream)
- {
- ppa_threaded_mainloop_unlock(data->loop);
- goto fail;
- }
-
- if(ppa_stream_is_suspended(stream))
- {
- AL_PRINT("Device is suspended\n");
- ppa_stream_disconnect(stream);
- ppa_stream_unref(stream);
- ppa_threaded_mainloop_unlock(data->loop);
- goto fail;
- }
- data->device_name = strdup(ppa_stream_get_device_name(stream));
-
- ppa_stream_disconnect(stream);
- ppa_stream_unref(stream);
-
- ppa_threaded_mainloop_unlock(data->loop);
-
- return ALC_TRUE;
-
-fail:
- pulse_close(device);
- return ALC_FALSE;
-} //}}}
-
-static void pulse_close_playback(ALCdevice *device) //{{{
-{
- pulse_close(device);
-} //}}}
-
-static ALCboolean pulse_reset_playback(ALCdevice *device) //{{{
-{
- pulse_data *data = device->ExtraData;
- pa_stream_flags_t flags = 0;
- pa_channel_map chanmap;
-
- ppa_threaded_mainloop_lock(data->loop);
-
- if(!ConfigValueExists(NULL, "format"))
- {
- pa_operation *o;
- o = ppa_context_get_sink_info_by_name(data->context, data->device_name, sink_info_callback, device);
- while(ppa_operation_get_state(o) == PA_OPERATION_RUNNING)
- ppa_threaded_mainloop_wait(data->loop);
- ppa_operation_unref(o);
- }
- if(!ConfigValueExists(NULL, "frequency"))
- flags |= PA_STREAM_FIX_RATE;
-
- data->frame_size = FrameSizeFromDevFmt(device->FmtChans, device->FmtType);
- data->attr.prebuf = -1;
- data->attr.fragsize = -1;
- data->attr.minreq = device->UpdateSize * data->frame_size;
- data->attr.tlength = data->attr.minreq * device->NumUpdates;
- if(data->attr.tlength < data->attr.minreq*2)
- data->attr.tlength = data->attr.minreq*2;
- data->attr.maxlength = data->attr.tlength;
- flags |= PA_STREAM_EARLY_REQUESTS;
- flags |= PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_AUTO_TIMING_UPDATE;
-
- switch(device->FmtType)
- {
- case DevFmtByte:
- device->FmtType = DevFmtUByte;
- /* fall-through */
- case DevFmtUByte:
- data->spec.format = PA_SAMPLE_U8;
- break;
- case DevFmtUShort:
- device->FmtType = DevFmtShort;
- /* fall-through */
- case DevFmtShort:
- data->spec.format = PA_SAMPLE_S16NE;
- break;
- case DevFmtFloat:
- data->spec.format = PA_SAMPLE_FLOAT32NE;
- break;
- }
- data->spec.rate = device->Frequency;
- data->spec.channels = ChannelsFromDevFmt(device->FmtChans);
-
- if(ppa_sample_spec_valid(&data->spec) == 0)
- {
- AL_PRINT("Invalid sample format\n");
- ppa_threaded_mainloop_unlock(data->loop);
- return ALC_FALSE;
- }
-
- if(!ppa_channel_map_init_auto(&chanmap, data->spec.channels, PA_CHANNEL_MAP_WAVEEX))
- {
- AL_PRINT("Couldn't build map for channel count (%d)!\n", data->spec.channels);
- ppa_threaded_mainloop_unlock(data->loop);
- return ALC_FALSE;
- }
- SetDefaultWFXChannelOrder(device);
-
- data->stream = connect_playback_stream(device, flags, &data->attr, &data->spec, &chanmap);
- if(!data->stream)
- {
- ppa_threaded_mainloop_unlock(data->loop);
- return ALC_FALSE;
- }
-
- ppa_stream_set_state_callback(data->stream, stream_state_callback2, device);
-
- data->spec = *(ppa_stream_get_sample_spec(data->stream));
- if(device->Frequency != data->spec.rate)
- {
- pa_operation *o;
-
- /* Server updated our playback rate, so modify the buffer attribs
- * accordingly. */
- data->attr.minreq = (ALuint64)(data->attr.minreq/data->frame_size) *
- data->spec.rate / device->Frequency * data->frame_size;
- data->attr.tlength = data->attr.minreq * device->NumUpdates;
- data->attr.maxlength = data->attr.tlength;
-
- o = ppa_stream_set_buffer_attr(data->stream, &data->attr,
- stream_success_callback, device);
- while(ppa_operation_get_state(o) == PA_OPERATION_RUNNING)
- ppa_threaded_mainloop_wait(data->loop);
- ppa_operation_unref(o);
-
- device->Frequency = data->spec.rate;
- }
-
- stream_buffer_attr_callback(data->stream, device);
-#if PA_CHECK_VERSION(0,9,15)
- if(ppa_stream_set_buffer_attr_callback)
- ppa_stream_set_buffer_attr_callback(data->stream, stream_buffer_attr_callback, device);
-#endif
- ppa_stream_set_moved_callback(data->stream, stream_device_callback, device);
- ppa_stream_set_write_callback(data->stream, stream_write_callback, device);
- ppa_stream_set_underflow_callback(data->stream, stream_signal_callback, device);
-
- data->thread = StartThread(PulseProc, device);
- if(!data->thread)
- {
-#if PA_CHECK_VERSION(0,9,15)
- if(ppa_stream_set_buffer_attr_callback)
- ppa_stream_set_buffer_attr_callback(data->stream, NULL, NULL);
-#endif
- ppa_stream_set_moved_callback(data->stream, NULL, NULL);
- ppa_stream_set_write_callback(data->stream, NULL, NULL);
- ppa_stream_set_underflow_callback(data->stream, NULL, NULL);
- ppa_stream_disconnect(data->stream);
- ppa_stream_unref(data->stream);
- data->stream = NULL;
-
- ppa_threaded_mainloop_unlock(data->loop);
- return ALC_FALSE;
- }
-
- ppa_threaded_mainloop_unlock(data->loop);
- return ALC_TRUE;
-} //}}}
-
-static void pulse_stop_playback(ALCdevice *device) //{{{
-{
- pulse_data *data = device->ExtraData;
-
- if(!data->stream)
- return;
-
- data->killNow = AL_TRUE;
- if(data->thread)
- {
- ppa_threaded_mainloop_signal(data->loop, 0);
- StopThread(data->thread);
- data->thread = NULL;
- }
- data->killNow = AL_FALSE;
-
- ppa_threaded_mainloop_lock(data->loop);
-
-#if PA_CHECK_VERSION(0,9,15)
- if(ppa_stream_set_buffer_attr_callback)
- ppa_stream_set_buffer_attr_callback(data->stream, NULL, NULL);
-#endif
- ppa_stream_set_moved_callback(data->stream, NULL, NULL);
- ppa_stream_set_write_callback(data->stream, NULL, NULL);
- ppa_stream_set_underflow_callback(data->stream, NULL, NULL);
- ppa_stream_disconnect(data->stream);
- ppa_stream_unref(data->stream);
- data->stream = NULL;
-
- ppa_threaded_mainloop_unlock(data->loop);
-} //}}}
-
-
-static ALCboolean pulse_open_capture(ALCdevice *device, const ALCchar *device_name) //{{{
-{
- char *pulse_name = NULL;
- pulse_data *data;
- pa_stream_flags_t flags = 0;
- pa_stream_state_t state;
- pa_channel_map chanmap;
-
- if(!pulse_load())
- return ALC_FALSE;
-
- if(!allCaptureDevNameMap)
- probe_devices(AL_TRUE);
-
- if(!device_name && numCaptureDevNames > 0)
- device_name = allCaptureDevNameMap[0].name;
- else
- {
- ALuint i;
-
- for(i = 0;i < numCaptureDevNames;i++)
- {
- if(strcmp(device_name, allCaptureDevNameMap[i].name) == 0)
- {
- pulse_name = allCaptureDevNameMap[i].device_name;
- break;
- }
- }
- if(i == numCaptureDevNames)
- return ALC_FALSE;
- }
-
- if(pulse_open(device, device_name) == ALC_FALSE)
- return ALC_FALSE;
-
- data = device->ExtraData;
- ppa_threaded_mainloop_lock(data->loop);
-
- data->samples = device->UpdateSize * device->NumUpdates;
- data->frame_size = FrameSizeFromDevFmt(device->FmtChans, device->FmtType);
- if(data->samples < 100 * device->Frequency / 1000)
- data->samples = 100 * device->Frequency / 1000;
-
- if(!(data->ring = CreateRingBuffer(data->frame_size, data->samples)))
- {
- ppa_threaded_mainloop_unlock(data->loop);
- goto fail;
- }
-
- data->attr.minreq = -1;
- data->attr.prebuf = -1;
- data->attr.maxlength = data->samples * data->frame_size;
- data->attr.tlength = -1;
- data->attr.fragsize = min(data->samples, 50 * device->Frequency / 1000) *
- data->frame_size;
-
- data->spec.rate = device->Frequency;
- data->spec.channels = ChannelsFromDevFmt(device->FmtChans);
-
- switch(device->FmtType)
- {
- case DevFmtUByte:
- data->spec.format = PA_SAMPLE_U8;
- break;
- case DevFmtShort:
- data->spec.format = PA_SAMPLE_S16NE;
- break;
- case DevFmtFloat:
- data->spec.format = PA_SAMPLE_FLOAT32NE;
- break;
- case DevFmtByte:
- case DevFmtUShort:
- AL_PRINT("Capture format type %#x capture not supported on PulseAudio\n", device->FmtType);
- ppa_threaded_mainloop_unlock(data->loop);
- goto fail;
- }
-
- if(ppa_sample_spec_valid(&data->spec) == 0)
- {
- AL_PRINT("Invalid sample format\n");
- ppa_threaded_mainloop_unlock(data->loop);
- goto fail;
- }
-
- if(!ppa_channel_map_init_auto(&chanmap, data->spec.channels, PA_CHANNEL_MAP_WAVEEX))
- {
- AL_PRINT("Couldn't build map for channel count (%d)!\n", data->spec.channels);
- ppa_threaded_mainloop_unlock(data->loop);
- goto fail;
- }
-
- data->stream = ppa_stream_new(data->context, "Capture Stream", &data->spec, &chanmap);
- if(!data->stream)
- {
- AL_PRINT("pa_stream_new() failed: %s\n",
- ppa_strerror(ppa_context_errno(data->context)));
-
- ppa_threaded_mainloop_unlock(data->loop);
- goto fail;
- }
-
- ppa_stream_set_state_callback(data->stream, stream_state_callback, data->loop);
-
- flags |= PA_STREAM_START_CORKED|PA_STREAM_ADJUST_LATENCY;
- if(ppa_stream_connect_record(data->stream, pulse_name, &data->attr, flags) < 0)
- {
- AL_PRINT("Stream did not connect: %s\n",
- ppa_strerror(ppa_context_errno(data->context)));
-
- ppa_stream_unref(data->stream);
- data->stream = NULL;
-
- ppa_threaded_mainloop_unlock(data->loop);
- goto fail;
- }
-
- while((state=ppa_stream_get_state(data->stream)) != PA_STREAM_READY)
- {
- if(!PA_STREAM_IS_GOOD(state))
- {
- AL_PRINT("Stream did not get ready: %s\n",
- ppa_strerror(ppa_context_errno(data->context)));
-
- ppa_stream_unref(data->stream);
- data->stream = NULL;
-
- ppa_threaded_mainloop_unlock(data->loop);
- goto fail;
- }
-
- ppa_threaded_mainloop_wait(data->loop);
- }
- ppa_stream_set_state_callback(data->stream, stream_state_callback2, device);
-
- ppa_threaded_mainloop_unlock(data->loop);
- return ALC_TRUE;
-
-fail:
- pulse_close(device);
- return ALC_FALSE;
-} //}}}
-
-static void pulse_close_capture(ALCdevice *device) //{{{
-{
- pulse_close(device);
-} //}}}
-
-static void pulse_start_capture(ALCdevice *device) //{{{
-{
- pulse_data *data = device->ExtraData;
- pa_operation *o;
-
- ppa_threaded_mainloop_lock(data->loop);
- o = ppa_stream_cork(data->stream, 0, stream_success_callback, device);
- while(ppa_operation_get_state(o) == PA_OPERATION_RUNNING)
- ppa_threaded_mainloop_wait(data->loop);
- ppa_operation_unref(o);
- ppa_threaded_mainloop_unlock(data->loop);
-} //}}}
-
-static void pulse_stop_capture(ALCdevice *device) //{{{
-{
- pulse_data *data = device->ExtraData;
- pa_operation *o;
-
- ppa_threaded_mainloop_lock(data->loop);
- o = ppa_stream_cork(data->stream, 1, stream_success_callback, device);
- while(ppa_operation_get_state(o) == PA_OPERATION_RUNNING)
- ppa_threaded_mainloop_wait(data->loop);
- ppa_operation_unref(o);
- ppa_threaded_mainloop_unlock(data->loop);
-} //}}}
-
-static ALCuint pulse_available_samples(ALCdevice *device) //{{{
-{
- pulse_data *data = device->ExtraData;
- size_t samples;
-
- ppa_threaded_mainloop_lock(data->loop);
- /* Capture is done in fragment-sized chunks, so we loop until we get all
- * that's available */
- samples = (device->Connected ? ppa_stream_readable_size(data->stream) : 0);
- while(samples > 0)
- {
- const void *buf;
- size_t length;
-
- if(ppa_stream_peek(data->stream, &buf, &length) < 0)
- {
- AL_PRINT("pa_stream_peek() failed: %s\n",
- ppa_strerror(ppa_context_errno(data->context)));
- break;
- }
-
- WriteRingBuffer(data->ring, buf, length/data->frame_size);
- samples -= length;
-
- ppa_stream_drop(data->stream);
- }
- ppa_threaded_mainloop_unlock(data->loop);
-
- return RingBufferSize(data->ring);
-} //}}}
-
-static void pulse_capture_samples(ALCdevice *device, ALCvoid *buffer, ALCuint samples) //{{{
-{
- pulse_data *data = device->ExtraData;
-
- if(pulse_available_samples(device) >= samples)
- ReadRingBuffer(data->ring, buffer, samples);
- else
- alcSetError(device, ALC_INVALID_VALUE);
-} //}}}
-
-
-BackendFuncs pulse_funcs = { //{{{
- pulse_open_playback,
- pulse_close_playback,
- pulse_reset_playback,
- pulse_stop_playback,
- pulse_open_capture,
- pulse_close_capture,
- pulse_start_capture,
- pulse_stop_capture,
- pulse_capture_samples,
- pulse_available_samples
-}; //}}}
-
-void alc_pulse_init(BackendFuncs *func_list) //{{{
-{
- *func_list = pulse_funcs;
-
- pulse_ctx_flags = 0;
- if(!GetConfigValueBool("pulse", "spawn-server", 0))
- pulse_ctx_flags |= PA_CONTEXT_NOAUTOSPAWN;
-} //}}}
-
-void alc_pulse_deinit(void) //{{{
-{
- ALuint i;
-
- for(i = 0;i < numDevNames;++i)
- {
- free(allDevNameMap[i].name);
- free(allDevNameMap[i].device_name);
- }
- free(allDevNameMap);
- allDevNameMap = NULL;
- numDevNames = 0;
-
- for(i = 0;i < numCaptureDevNames;++i)
- {
- free(allCaptureDevNameMap[i].name);
- free(allCaptureDevNameMap[i].device_name);
- }
- free(allCaptureDevNameMap);
- allCaptureDevNameMap = NULL;
- numCaptureDevNames = 0;
-
- if(pa_handle)
- {
-#ifdef _WIN32
- FreeLibrary(pa_handle);
-#elif defined (HAVE_DLFCN_H)
- dlclose(pa_handle);
-#endif
- pa_handle = NULL;
- }
-} //}}}
-
-void alc_pulse_probe(int type) //{{{
-{
- if(!pulse_load()) return;
-
- if(type == DEVICE_PROBE)
- {
- pa_threaded_mainloop *loop;
-
- if((loop=ppa_threaded_mainloop_new()) &&
- ppa_threaded_mainloop_start(loop) >= 0)
- {
- pa_context *context;
-
- ppa_threaded_mainloop_lock(loop);
- context = connect_context(loop);
- if(context)
- {
- AppendDeviceList(pulse_device);
-
- ppa_context_disconnect(context);
- ppa_context_unref(context);
- }
- ppa_threaded_mainloop_unlock(loop);
- ppa_threaded_mainloop_stop(loop);
- }
- if(loop)
- ppa_threaded_mainloop_free(loop);
- }
- else if(type == ALL_DEVICE_PROBE)
- {
- ALuint i;
-
- for(i = 0;i < numDevNames;++i)
- {
- free(allDevNameMap[i].name);
- free(allDevNameMap[i].device_name);
- }
- free(allDevNameMap);
- allDevNameMap = NULL;
- numDevNames = 0;
-
- probe_devices(AL_FALSE);
-
- for(i = 0;i < numDevNames;i++)
- AppendAllDeviceList(allDevNameMap[i].name);
- }
- else if(type == CAPTURE_DEVICE_PROBE)
- {
- ALuint i;
-
- for(i = 0;i < numCaptureDevNames;++i)
- {
- free(allCaptureDevNameMap[i].name);
- free(allCaptureDevNameMap[i].device_name);
- }
- free(allCaptureDevNameMap);
- allCaptureDevNameMap = NULL;
- numCaptureDevNames = 0;
-
- probe_devices(AL_TRUE);
-
- for(i = 0;i < numCaptureDevNames;i++)
- AppendCaptureDeviceList(allCaptureDevNameMap[i].name);
- }
-} //}}}
-//}}}
diff --git a/internal/c/parts/audio/out/android/OpenAL/Alc/solaris.c b/internal/c/parts/audio/out/android/OpenAL/Alc/solaris.c
deleted file mode 100644
index 18c733439..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Alc/solaris.c
+++ /dev/null
@@ -1,304 +0,0 @@
-/**
- * OpenAL cross platform audio library
- * Copyright (C) 1999-2007 by authors.
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- * Or go to http://www.gnu.org/copyleft/lgpl.html
- */
-
-#include "config.h"
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include "alMain.h"
-#include "AL/al.h"
-#include "AL/alc.h"
-
-#include
-
-
-static const ALCchar solaris_device[] = "Solaris Default";
-
-typedef struct {
- int fd;
- volatile int killNow;
- ALvoid *thread;
-
- ALubyte *mix_data;
- int data_size;
-} solaris_data;
-
-
-static ALuint SolarisProc(ALvoid *ptr)
-{
- ALCdevice *pDevice = (ALCdevice*)ptr;
- solaris_data *data = (solaris_data*)pDevice->ExtraData;
- ALint frameSize;
- int wrote;
-
- SetRTPriority();
-
- frameSize = FrameSizeFromDevFmt(pDevice->FmtChans, pDevice->FmtType);
-
- while(!data->killNow && pDevice->Connected)
- {
- ALint len = data->data_size;
- ALubyte *WritePtr = data->mix_data;
-
- aluMixData(pDevice, WritePtr, len/frameSize);
- while(len > 0 && !data->killNow)
- {
- wrote = write(data->fd, WritePtr, len);
- if(wrote < 0)
- {
- if(errno != EAGAIN && errno != EWOULDBLOCK && errno != EINTR)
- {
- AL_PRINT("write failed: %s\n", strerror(errno));
- aluHandleDisconnect(pDevice);
- break;
- }
-
- Sleep(1);
- continue;
- }
-
- len -= wrote;
- WritePtr += wrote;
- }
- }
-
- return 0;
-}
-
-
-static ALCboolean solaris_open_playback(ALCdevice *device, const ALCchar *deviceName)
-{
- char driver[64];
- solaris_data *data;
-
- strncpy(driver, GetConfigValue("solaris", "device", "/dev/audio"), sizeof(driver)-1);
- driver[sizeof(driver)-1] = 0;
-
- if(!deviceName)
- deviceName = solaris_device;
- else if(strcmp(deviceName, solaris_device) != 0)
- return ALC_FALSE;
-
- data = (solaris_data*)calloc(1, sizeof(solaris_data));
- data->killNow = 0;
-
- data->fd = open(driver, O_WRONLY);
- if(data->fd == -1)
- {
- free(data);
- AL_PRINT("Could not open %s: %s\n", driver, strerror(errno));
- return ALC_FALSE;
- }
-
- device->szDeviceName = strdup(deviceName);
- device->ExtraData = data;
- return ALC_TRUE;
-}
-
-static void solaris_close_playback(ALCdevice *device)
-{
- solaris_data *data = (solaris_data*)device->ExtraData;
-
- close(data->fd);
- free(data);
- device->ExtraData = NULL;
-}
-
-static ALCboolean solaris_reset_playback(ALCdevice *device)
-{
- solaris_data *data = (solaris_data*)device->ExtraData;
- audio_info_t info;
- ALuint frameSize;
- int numChannels;
-
- AUDIO_INITINFO(&info);
-
- info.play.sample_rate = device->Frequency;
-
- if(device->FmtChans != DevFmtMono)
- device->FmtChans = DevFmtStereo;
- numChannels = ChannelsFromDevFmt(device->FmtChans);
- info.play.channels = numChannels;
-
- switch(device->FmtType)
- {
- case DevFmtByte:
- info.play.precision = 8;
- info.play.encoding = AUDIO_ENCODING_LINEAR;
- break;
- case DevFmtUByte:
- info.play.precision = 8;
- info.play.encoding = AUDIO_ENCODING_LINEAR8;
- break;
- case DevFmtUShort:
- case DevFmtFloat:
- device->FmtType = DevFmtShort;
- /* fall-through */
- case DevFmtShort:
- info.play.precision = 16;
- info.play.encoding = AUDIO_ENCODING_LINEAR;
- break;
- }
-
- frameSize = numChannels * BytesFromDevFmt(device->FmtType);
- info.play.buffer_size = device->UpdateSize*device->NumUpdates * frameSize;
-
- if(ioctl(data->fd, AUDIO_SETINFO, &info) < 0)
- {
- AL_PRINT("ioctl failed: %s\n", strerror(errno));
- return ALC_FALSE;
- }
-
- if(ChannelsFromDevFmt(device->FmtChans) != info.play.channels)
- {
- AL_PRINT("Could not set %d channels, got %d instead\n", ChannelsFromDevFmt(device->FmtChans), info.play.channels);
- return ALC_FALSE;
- }
-
- if(!((info.play.precision == 8 && info.play.encoding == AUDIO_ENCODING_LINEAR &&
- device->FmtType == DevFmtByte) ||
- (info.play.precision == 8 && info.play.encoding == AUDIO_ENCODING_LINEAR8 &&
- device->FmtType == DevFmtUByte) ||
- (info.play.precision == 16 && info.play.encoding == AUDIO_ENCODING_LINEAR &&
- device->FmtType == DevFmtShort)))
- {
- AL_PRINT("Could not set %#x sample type, got %d (%#x)\n",
- device->FmtType, info.play.precision, info.play.encoding);
- return ALC_FALSE;
- }
-
- device->Frequency = info.play.sample_rate;
- device->UpdateSize = (info.play.buffer_size/device->NumUpdates) + 1;
-
- data->data_size = device->UpdateSize * frameSize;
- data->mix_data = calloc(1, data->data_size);
-
- SetDefaultChannelOrder(device);
-
- data->thread = StartThread(SolarisProc, device);
- if(data->thread == NULL)
- {
- free(data->mix_data);
- data->mix_data = NULL;
- return ALC_FALSE;
- }
-
- return ALC_TRUE;
-}
-
-static void solaris_stop_playback(ALCdevice *device)
-{
- solaris_data *data = (solaris_data*)device->ExtraData;
-
- if(!data->thread)
- return;
-
- data->killNow = 1;
- StopThread(data->thread);
- data->thread = NULL;
-
- data->killNow = 0;
- if(ioctl(data->fd, AUDIO_DRAIN) < 0)
- AL_PRINT("Error draining device: %s\n", strerror(errno));
-
- free(data->mix_data);
- data->mix_data = NULL;
-}
-
-
-static ALCboolean solaris_open_capture(ALCdevice *device, const ALCchar *deviceName)
-{
- (void)device;
- (void)deviceName;
- return ALC_FALSE;
-}
-
-static void solaris_close_capture(ALCdevice *device)
-{
- (void)device;
-}
-
-static void solaris_start_capture(ALCdevice *pDevice)
-{
- (void)pDevice;
-}
-
-static void solaris_stop_capture(ALCdevice *pDevice)
-{
- (void)pDevice;
-}
-
-static void solaris_capture_samples(ALCdevice *pDevice, ALCvoid *pBuffer, ALCuint lSamples)
-{
- (void)pDevice;
- (void)pBuffer;
- (void)lSamples;
-}
-
-static ALCuint solaris_available_samples(ALCdevice *pDevice)
-{
- (void)pDevice;
- return 0;
-}
-
-
-BackendFuncs solaris_funcs = {
- solaris_open_playback,
- solaris_close_playback,
- solaris_reset_playback,
- solaris_stop_playback,
- solaris_open_capture,
- solaris_close_capture,
- solaris_start_capture,
- solaris_stop_capture,
- solaris_capture_samples,
- solaris_available_samples
-};
-
-void alc_solaris_init(BackendFuncs *func_list)
-{
- *func_list = solaris_funcs;
-}
-
-void alc_solaris_deinit(void)
-{
-}
-
-void alc_solaris_probe(int type)
-{
-#ifdef HAVE_STAT
- struct stat buf;
- if(stat(GetConfigValue("solaris", "device", "/dev/audio"), &buf) != 0)
- return;
-#endif
-
- if(type == DEVICE_PROBE)
- AppendDeviceList(solaris_device);
- else if(type == ALL_DEVICE_PROBE)
- AppendAllDeviceList(solaris_device);
-}
diff --git a/internal/c/parts/audio/out/android/OpenAL/Alc/wave.c b/internal/c/parts/audio/out/android/OpenAL/Alc/wave.c
deleted file mode 100644
index 6ba662cf1..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Alc/wave.c
+++ /dev/null
@@ -1,355 +0,0 @@
-/**
- * OpenAL cross platform audio library
- * Copyright (C) 1999-2007 by authors.
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- * Or go to http://www.gnu.org/copyleft/lgpl.html
- */
-
-#include "config.h"
-
-#include
-#include
-#include
-#include "alMain.h"
-#include "AL/al.h"
-#include "AL/alc.h"
-
-
-typedef struct {
- FILE *f;
- long DataStart;
-
- ALvoid *buffer;
- ALuint size;
-
- volatile int killNow;
- ALvoid *thread;
-} wave_data;
-
-
-static const ALCchar waveDevice[] = "Wave File Writer";
-
-static const ALubyte SUBTYPE_PCM[] = {
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0xaa,
- 0x00, 0x38, 0x9b, 0x71
-};
-static const ALubyte SUBTYPE_FLOAT[] = {
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0xaa,
- 0x00, 0x38, 0x9b, 0x71
-};
-
-static const ALuint channel_masks[] = {
- 0, /* invalid */
- 0x4, /* Mono */
- 0x1 | 0x2, /* Stereo */
- 0, /* 3 channel */
- 0x1 | 0x2 | 0x10 | 0x20, /* Quad */
- 0, /* 5 channel */
- 0x1 | 0x2 | 0x4 | 0x8 | 0x10 | 0x20, /* 5.1 */
- 0x1 | 0x2 | 0x4 | 0x8 | 0x100 | 0x200 | 0x400, /* 6.1 */
- 0x1 | 0x2 | 0x4 | 0x8 | 0x10 | 0x20 | 0x200 | 0x400, /* 7.1 */
-};
-
-
-static void fwrite16le(ALushort val, FILE *f)
-{
- fputc(val&0xff, f);
- fputc((val>>8)&0xff, f);
-}
-
-static void fwrite32le(ALuint val, FILE *f)
-{
- fputc(val&0xff, f);
- fputc((val>>8)&0xff, f);
- fputc((val>>16)&0xff, f);
- fputc((val>>24)&0xff, f);
-}
-
-
-static ALuint WaveProc(ALvoid *ptr)
-{
- ALCdevice *pDevice = (ALCdevice*)ptr;
- wave_data *data = (wave_data*)pDevice->ExtraData;
- ALuint frameSize;
- ALuint now, start;
- ALuint64 avail, done;
- size_t fs;
- union {
- short s;
- char b[sizeof(short)];
- } uSB;
- const ALuint restTime = (ALuint64)pDevice->UpdateSize * 1000 /
- pDevice->Frequency / 2;
-
- uSB.s = 1;
- frameSize = FrameSizeFromDevFmt(pDevice->FmtChans, pDevice->FmtType);
-
- done = 0;
- start = timeGetTime();
- while(!data->killNow && pDevice->Connected)
- {
- now = timeGetTime();
-
- avail = (ALuint64)(now-start) * pDevice->Frequency / 1000;
- if(avail < done)
- {
- /* Timer wrapped. Add the remainder of the cycle to the available
- * count and reset the number of samples done */
- avail += (ALuint64)0xFFFFFFFFu*pDevice->Frequency/1000 - done;
- done = 0;
- }
- if(avail-done < pDevice->UpdateSize)
- {
- Sleep(restTime);
- continue;
- }
-
- while(avail-done >= pDevice->UpdateSize)
- {
- aluMixData(pDevice, data->buffer, pDevice->UpdateSize);
- done += pDevice->UpdateSize;
-
- if(uSB.b[0] != 1)
- {
- ALuint bytesize = BytesFromDevFmt(pDevice->FmtType);
- ALubyte *bytes = data->buffer;
- ALuint i;
-
- if(bytesize == 1)
- {
- for(i = 0;i < data->size;i++)
- fputc(bytes[i], data->f);
- }
- else if(bytesize == 2)
- {
- for(i = 0;i < data->size;i++)
- fputc(bytes[i^1], data->f);
- }
- else if(bytesize == 4)
- {
- for(i = 0;i < data->size;i++)
- fputc(bytes[i^3], data->f);
- }
- }
- else
- fs = fwrite(data->buffer, frameSize, pDevice->UpdateSize,
- data->f);
- if(ferror(data->f))
- {
- AL_PRINT("Error writing to file\n");
- aluHandleDisconnect(pDevice);
- break;
- }
- }
- }
-
- return 0;
-}
-
-static ALCboolean wave_open_playback(ALCdevice *device, const ALCchar *deviceName)
-{
- wave_data *data;
- const char *fname;
-
- fname = GetConfigValue("wave", "file", "");
- if(!fname[0])
- return ALC_FALSE;
-
- if(!deviceName)
- deviceName = waveDevice;
- else if(strcmp(deviceName, waveDevice) != 0)
- return ALC_FALSE;
-
- data = (wave_data*)calloc(1, sizeof(wave_data));
-
- data->f = fopen(fname, "wb");
- if(!data->f)
- {
- free(data);
- AL_PRINT("Could not open file '%s': %s\n", fname, strerror(errno));
- return ALC_FALSE;
- }
-
- device->szDeviceName = strdup(deviceName);
- device->ExtraData = data;
- return ALC_TRUE;
-}
-
-static void wave_close_playback(ALCdevice *device)
-{
- wave_data *data = (wave_data*)device->ExtraData;
-
- fclose(data->f);
- free(data);
- device->ExtraData = NULL;
-}
-
-static ALCboolean wave_reset_playback(ALCdevice *device)
-{
- wave_data *data = (wave_data*)device->ExtraData;
- ALuint channels=0, bits=0;
- size_t val;
-
- fseek(data->f, 0, SEEK_SET);
- clearerr(data->f);
-
- switch(device->FmtType)
- {
- case DevFmtByte:
- device->FmtType = DevFmtUByte;
- break;
- case DevFmtUShort:
- device->FmtType = DevFmtShort;
- break;
- case DevFmtUByte:
- case DevFmtShort:
- case DevFmtFloat:
- break;
- }
- bits = BytesFromDevFmt(device->FmtType) * 8;
- channels = ChannelsFromDevFmt(device->FmtChans);
-
- fprintf(data->f, "RIFF");
- fwrite32le(0xFFFFFFFF, data->f); // 'RIFF' header len; filled in at close
-
- fprintf(data->f, "WAVE");
-
- fprintf(data->f, "fmt ");
- fwrite32le(40, data->f); // 'fmt ' header len; 40 bytes for EXTENSIBLE
-
- // 16-bit val, format type id (extensible: 0xFFFE)
- fwrite16le(0xFFFE, data->f);
- // 16-bit val, channel count
- fwrite16le(channels, data->f);
- // 32-bit val, frequency
- fwrite32le(device->Frequency, data->f);
- // 32-bit val, bytes per second
- fwrite32le(device->Frequency * channels * bits / 8, data->f);
- // 16-bit val, frame size
- fwrite16le(channels * bits / 8, data->f);
- // 16-bit val, bits per sample
- fwrite16le(bits, data->f);
- // 16-bit val, extra byte count
- fwrite16le(22, data->f);
- // 16-bit val, valid bits per sample
- fwrite16le(bits, data->f);
- // 32-bit val, channel mask
- fwrite32le(channel_masks[channels], data->f);
- // 16 byte GUID, sub-type format
- val = fwrite(((bits==32) ? SUBTYPE_FLOAT : SUBTYPE_PCM), 1, 16, data->f);
-
- fprintf(data->f, "data");
- fwrite32le(0xFFFFFFFF, data->f); // 'data' header len; filled in at close
-
- if(ferror(data->f))
- {
- AL_PRINT("Error writing header: %s\n", strerror(errno));
- return ALC_FALSE;
- }
-
- data->DataStart = ftell(data->f);
-
- data->size = device->UpdateSize * channels * bits / 8;
- data->buffer = malloc(data->size);
- if(!data->buffer)
- {
- AL_PRINT("buffer malloc failed\n");
- return ALC_FALSE;
- }
-
- SetDefaultWFXChannelOrder(device);
-
- data->thread = StartThread(WaveProc, device);
- if(data->thread == NULL)
- {
- free(data->buffer);
- data->buffer = NULL;
- return ALC_FALSE;
- }
-
- return ALC_TRUE;
-}
-
-static void wave_stop_playback(ALCdevice *device)
-{
- wave_data *data = (wave_data*)device->ExtraData;
- ALuint dataLen;
- long size;
-
- if(!data->thread)
- return;
-
- data->killNow = 1;
- StopThread(data->thread);
- data->thread = NULL;
-
- data->killNow = 0;
-
- free(data->buffer);
- data->buffer = NULL;
-
- size = ftell(data->f);
- if(size > 0)
- {
- dataLen = size - data->DataStart;
- if(fseek(data->f, data->DataStart-4, SEEK_SET) == 0)
- fwrite32le(dataLen, data->f); // 'data' header len
- if(fseek(data->f, 4, SEEK_SET) == 0)
- fwrite32le(size-8, data->f); // 'WAVE' header len
- }
-}
-
-
-static ALCboolean wave_open_capture(ALCdevice *pDevice, const ALCchar *deviceName)
-{
- (void)pDevice;
- (void)deviceName;
- return ALC_FALSE;
-}
-
-
-BackendFuncs wave_funcs = {
- wave_open_playback,
- wave_close_playback,
- wave_reset_playback,
- wave_stop_playback,
- wave_open_capture,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-void alc_wave_init(BackendFuncs *func_list)
-{
- *func_list = wave_funcs;
-}
-
-void alc_wave_deinit(void)
-{
-}
-
-void alc_wave_probe(int type)
-{
- if(!ConfigValueExists("wave", "file"))
- return;
-
- if(type == DEVICE_PROBE)
- AppendDeviceList(waveDevice);
- else if(type == ALL_DEVICE_PROBE)
- AppendAllDeviceList(waveDevice);
-}
diff --git a/internal/c/parts/audio/out/android/OpenAL/Alc/winmm.c b/internal/c/parts/audio/out/android/OpenAL/Alc/winmm.c
deleted file mode 100644
index 10d0c28fe..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Alc/winmm.c
+++ /dev/null
@@ -1,784 +0,0 @@
-/**
- * OpenAL cross platform audio library
- * Copyright (C) 1999-2007 by authors.
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- * Or go to http://www.gnu.org/copyleft/lgpl.html
- */
-
-#include "config.h"
-
-#define _WIN32_WINNT 0x0500
-#include
-#include
-#include
-
-#include
-#include
-
-#include "alMain.h"
-#include "AL/al.h"
-#include "AL/alc.h"
-
-
-typedef struct {
- // MMSYSTEM Device
- volatile ALboolean bWaveShutdown;
- HANDLE hWaveHdrEvent;
- HANDLE hWaveThreadEvent;
- HANDLE hWaveThread;
- DWORD ulWaveThreadID;
- LONG lWaveBuffersCommitted;
- WAVEHDR WaveBuffer[4];
-
- union {
- HWAVEIN In;
- HWAVEOUT Out;
- } hWaveHandle;
-
- ALsizei Frequency;
-
- RingBuffer *pRing;
-} WinMMData;
-
-
-static const ALCchar woDefault[] = "WaveOut Default";
-
-static ALCchar **PlaybackDeviceList;
-static ALuint NumPlaybackDevices;
-static ALCchar **CaptureDeviceList;
-static ALuint NumCaptureDevices;
-
-
-static void ProbePlaybackDevices(void)
-{
- ALuint i;
-
- for(i = 0;i < NumPlaybackDevices;i++)
- free(PlaybackDeviceList[i]);
-
- NumPlaybackDevices = waveOutGetNumDevs();
- PlaybackDeviceList = realloc(PlaybackDeviceList, sizeof(ALCchar*) * NumPlaybackDevices);
- for(i = 0;i < NumPlaybackDevices;i++)
- {
- WAVEOUTCAPS WaveCaps;
-
- PlaybackDeviceList[i] = NULL;
- if(waveOutGetDevCaps(i, &WaveCaps, sizeof(WaveCaps)) == MMSYSERR_NOERROR)
- {
- char name[1024];
- ALuint count, j;
-
- count = 0;
- do {
- if(count == 0)
- snprintf(name, sizeof(name), "%s via WaveOut", WaveCaps.szPname);
- else
- snprintf(name, sizeof(name), "%s #%d via WaveOut", WaveCaps.szPname, count+1);
- count++;
-
- for(j = 0;j < i;j++)
- {
- if(strcmp(name, PlaybackDeviceList[j]) == 0)
- break;
- }
- } while(j != i);
-
- PlaybackDeviceList[i] = strdup(name);
- }
- }
-}
-
-static void ProbeCaptureDevices(void)
-{
- ALuint i;
-
- for(i = 0;i < NumCaptureDevices;i++)
- free(CaptureDeviceList[i]);
-
- NumCaptureDevices = waveInGetNumDevs();
- CaptureDeviceList = realloc(CaptureDeviceList, sizeof(ALCchar*) * NumCaptureDevices);
- for(i = 0;i < NumCaptureDevices;i++)
- {
- WAVEINCAPS WaveInCaps;
-
- CaptureDeviceList[i] = NULL;
- if(waveInGetDevCaps(i, &WaveInCaps, sizeof(WAVEINCAPS)) == MMSYSERR_NOERROR)
- {
- char name[1024];
- ALuint count, j;
-
- count = 0;
- do {
- if(count == 0)
- snprintf(name, sizeof(name), "%s via WaveIn", WaveInCaps.szPname);
- else
- snprintf(name, sizeof(name), "%s #%d via WaveIn", WaveInCaps.szPname, count+1);
- count++;
-
- for(j = 0;j < i;j++)
- {
- if(strcmp(name, CaptureDeviceList[j]) == 0)
- break;
- }
- } while(j != i);
-
- CaptureDeviceList[i] = strdup(name);
- }
- }
-}
-
-
-/*
- WaveOutProc
-
- Posts a message to 'PlaybackThreadProc' everytime a WaveOut Buffer is completed and
- returns to the application (for more data)
-*/
-static void CALLBACK WaveOutProc(HWAVEOUT hDevice,UINT uMsg,DWORD_PTR dwInstance,DWORD_PTR dwParam1,DWORD_PTR dwParam2)
-{
- ALCdevice *pDevice = (ALCdevice*)dwInstance;
- WinMMData *pData = pDevice->ExtraData;
-
- (void)hDevice;
- (void)dwParam2;
-
- if(uMsg != WOM_DONE)
- return;
-
- // Decrement number of buffers in use
- InterlockedDecrement(&pData->lWaveBuffersCommitted);
-
- if(pData->bWaveShutdown == AL_FALSE)
- {
- // Notify Wave Processor Thread that a Wave Header has returned
- PostThreadMessage(pData->ulWaveThreadID, uMsg, 0, dwParam1);
- }
- else
- {
- if(pData->lWaveBuffersCommitted == 0)
- {
- // Signal Wave Buffers Returned event
- if(pData->hWaveHdrEvent)
- SetEvent(pData->hWaveHdrEvent);
-
- // Post 'Quit' Message to WaveOut Processor Thread
- PostThreadMessage(pData->ulWaveThreadID, WM_QUIT, 0, 0);
- }
- }
-}
-
-/*
- PlaybackThreadProc
-
- Used by "MMSYSTEM" Device. Called when a WaveOut buffer has used up its
- audio data.
-*/
-static DWORD WINAPI PlaybackThreadProc(LPVOID lpParameter)
-{
- ALCdevice *pDevice = (ALCdevice*)lpParameter;
- WinMMData *pData = pDevice->ExtraData;
- LPWAVEHDR pWaveHdr;
- ALuint FrameSize;
- MSG msg;
-
- FrameSize = FrameSizeFromDevFmt(pDevice->FmtChans, pDevice->FmtType);
-
- while(GetMessage(&msg, NULL, 0, 0))
- {
- if(msg.message != WOM_DONE || pData->bWaveShutdown)
- continue;
-
- pWaveHdr = ((LPWAVEHDR)msg.lParam);
-
- aluMixData(pDevice, pWaveHdr->lpData, pWaveHdr->dwBufferLength/FrameSize);
-
- // Send buffer back to play more data
- waveOutWrite(pData->hWaveHandle.Out, pWaveHdr, sizeof(WAVEHDR));
- InterlockedIncrement(&pData->lWaveBuffersCommitted);
- }
-
- // Signal Wave Thread completed event
- if(pData->hWaveThreadEvent)
- SetEvent(pData->hWaveThreadEvent);
-
- ExitThread(0);
-
- return 0;
-}
-
-/*
- WaveInProc
-
- Posts a message to 'CaptureThreadProc' everytime a WaveIn Buffer is completed and
- returns to the application (with more data)
-*/
-static void CALLBACK WaveInProc(HWAVEIN hDevice,UINT uMsg,DWORD_PTR dwInstance,DWORD_PTR dwParam1,DWORD_PTR dwParam2)
-{
- ALCdevice *pDevice = (ALCdevice*)dwInstance;
- WinMMData *pData = pDevice->ExtraData;
-
- (void)hDevice;
- (void)dwParam2;
-
- if(uMsg != WIM_DATA)
- return;
-
- // Decrement number of buffers in use
- InterlockedDecrement(&pData->lWaveBuffersCommitted);
-
- if(pData->bWaveShutdown == AL_FALSE)
- {
- // Notify Wave Processor Thread that a Wave Header has returned
- PostThreadMessage(pData->ulWaveThreadID,uMsg,0,dwParam1);
- }
- else
- {
- if(pData->lWaveBuffersCommitted == 0)
- {
- // Signal Wave Buffers Returned event
- if(pData->hWaveHdrEvent)
- SetEvent(pData->hWaveHdrEvent);
-
- // Post 'Quit' Message to WaveIn Processor Thread
- PostThreadMessage(pData->ulWaveThreadID,WM_QUIT,0,0);
- }
- }
-}
-
-/*
- CaptureThreadProc
-
- Used by "MMSYSTEM" Device. Called when a WaveIn buffer had been filled with new
- audio data.
-*/
-static DWORD WINAPI CaptureThreadProc(LPVOID lpParameter)
-{
- ALCdevice *pDevice = (ALCdevice*)lpParameter;
- WinMMData *pData = pDevice->ExtraData;
- LPWAVEHDR pWaveHdr;
- ALuint FrameSize;
- MSG msg;
-
- FrameSize = FrameSizeFromDevFmt(pDevice->FmtChans, pDevice->FmtType);
-
- while(GetMessage(&msg, NULL, 0, 0))
- {
- if(msg.message != WIM_DATA || pData->bWaveShutdown)
- continue;
-
- pWaveHdr = ((LPWAVEHDR)msg.lParam);
-
- WriteRingBuffer(pData->pRing, (ALubyte*)pWaveHdr->lpData,
- pWaveHdr->dwBytesRecorded/FrameSize);
-
- // Send buffer back to capture more data
- waveInAddBuffer(pData->hWaveHandle.In,pWaveHdr,sizeof(WAVEHDR));
- InterlockedIncrement(&pData->lWaveBuffersCommitted);
- }
-
- // Signal Wave Thread completed event
- if(pData->hWaveThreadEvent)
- SetEvent(pData->hWaveThreadEvent);
-
- ExitThread(0);
-
- return 0;
-}
-
-
-static ALCboolean WinMMOpenPlayback(ALCdevice *pDevice, const ALCchar *deviceName)
-{
- WAVEFORMATEX wfexFormat;
- WinMMData *pData = NULL;
- UINT lDeviceID = 0;
- MMRESULT res;
- ALuint i = 0;
-
- // Find the Device ID matching the deviceName if valid
- if(!deviceName || strcmp(deviceName, woDefault) == 0)
- lDeviceID = WAVE_MAPPER;
- else
- {
- if(!PlaybackDeviceList)
- ProbePlaybackDevices();
-
- for(i = 0;i < NumPlaybackDevices;i++)
- {
- if(PlaybackDeviceList[i] &&
- strcmp(deviceName, PlaybackDeviceList[i]) == 0)
- {
- lDeviceID = i;
- break;
- }
- }
- if(i == NumPlaybackDevices)
- return ALC_FALSE;
- }
-
- pData = calloc(1, sizeof(*pData));
- if(!pData)
- {
- alcSetError(pDevice, ALC_OUT_OF_MEMORY);
- return ALC_FALSE;
- }
- pDevice->ExtraData = pData;
-
- if(pDevice->FmtChans != DevFmtMono)
- pDevice->FmtChans = DevFmtStereo;
- switch(pDevice->FmtType)
- {
- case DevFmtByte:
- pDevice->FmtType = DevFmtUByte;
- break;
- case DevFmtUShort:
- case DevFmtFloat:
- pDevice->FmtType = DevFmtShort;
- break;
- case DevFmtUByte:
- case DevFmtShort:
- break;
- }
-
- memset(&wfexFormat, 0, sizeof(WAVEFORMATEX));
- wfexFormat.wFormatTag = WAVE_FORMAT_PCM;
- wfexFormat.nChannels = ChannelsFromDevFmt(pDevice->FmtChans);
- wfexFormat.wBitsPerSample = BytesFromDevFmt(pDevice->FmtType) * 8;
- wfexFormat.nBlockAlign = wfexFormat.wBitsPerSample *
- wfexFormat.nChannels / 8;
- wfexFormat.nSamplesPerSec = pDevice->Frequency;
- wfexFormat.nAvgBytesPerSec = wfexFormat.nSamplesPerSec *
- wfexFormat.nBlockAlign;
- wfexFormat.cbSize = 0;
-
- if((res=waveOutOpen(&pData->hWaveHandle.Out, lDeviceID, &wfexFormat, (DWORD_PTR)&WaveOutProc, (DWORD_PTR)pDevice, CALLBACK_FUNCTION)) != MMSYSERR_NOERROR)
- {
- AL_PRINT("waveInOpen failed: %u\n", res);
- goto failure;
- }
-
- pData->hWaveHdrEvent = CreateEvent(NULL, AL_TRUE, AL_FALSE, "WaveOutAllHeadersReturned");
- pData->hWaveThreadEvent = CreateEvent(NULL, AL_TRUE, AL_FALSE, "WaveOutThreadDestroyed");
- if(pData->hWaveHdrEvent == NULL || pData->hWaveThreadEvent == NULL)
- {
- AL_PRINT("CreateEvent failed: %lu\n", GetLastError());
- goto failure;
- }
-
- pData->Frequency = pDevice->Frequency;
-
- pDevice->szDeviceName = strdup((lDeviceID==WAVE_MAPPER) ? woDefault :
- PlaybackDeviceList[lDeviceID]);
- return ALC_TRUE;
-
-failure:
- if(pData->hWaveThreadEvent)
- CloseHandle(pData->hWaveThreadEvent);
- if(pData->hWaveHdrEvent)
- CloseHandle(pData->hWaveHdrEvent);
-
- if(pData->hWaveHandle.Out)
- waveOutClose(pData->hWaveHandle.Out);
-
- free(pData);
- pDevice->ExtraData = NULL;
- return ALC_FALSE;
-}
-
-static void WinMMClosePlayback(ALCdevice *device)
-{
- WinMMData *pData = (WinMMData*)device->ExtraData;
-
- // Close the Wave device
- CloseHandle(pData->hWaveThreadEvent);
- pData->hWaveThreadEvent = 0;
-
- CloseHandle(pData->hWaveHdrEvent);
- pData->hWaveHdrEvent = 0;
-
- waveInClose(pData->hWaveHandle.In);
- pData->hWaveHandle.In = 0;
-
- free(pData);
- device->ExtraData = NULL;
-}
-
-static ALCboolean WinMMResetPlayback(ALCdevice *device)
-{
- WinMMData *pData = (WinMMData*)device->ExtraData;
- ALbyte *BufferData;
- ALint lBufferSize;
- ALuint i;
-
- pData->hWaveThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)PlaybackThreadProc, (LPVOID)device, 0, &pData->ulWaveThreadID);
- if(pData->hWaveThread == NULL)
- return ALC_FALSE;
-
- device->UpdateSize = (ALuint)((ALuint64)device->UpdateSize *
- pData->Frequency / device->Frequency);
- device->Frequency = pData->Frequency;
-
- pData->lWaveBuffersCommitted = 0;
-
- // Create 4 Buffers
- lBufferSize = device->UpdateSize*device->NumUpdates / 4;
- lBufferSize *= FrameSizeFromDevFmt(device->FmtChans, device->FmtType);
-
- BufferData = calloc(4, lBufferSize);
- for(i = 0;i < 4;i++)
- {
- memset(&pData->WaveBuffer[i], 0, sizeof(WAVEHDR));
- pData->WaveBuffer[i].dwBufferLength = lBufferSize;
- pData->WaveBuffer[i].lpData = ((i==0) ? (LPSTR)BufferData :
- (pData->WaveBuffer[i-1].lpData +
- pData->WaveBuffer[i-1].dwBufferLength));
- waveOutPrepareHeader(pData->hWaveHandle.Out, &pData->WaveBuffer[i], sizeof(WAVEHDR));
- waveOutWrite(pData->hWaveHandle.Out, &pData->WaveBuffer[i], sizeof(WAVEHDR));
- InterlockedIncrement(&pData->lWaveBuffersCommitted);
- }
-
- return ALC_TRUE;
-}
-
-static void WinMMStopPlayback(ALCdevice *device)
-{
- WinMMData *pData = (WinMMData*)device->ExtraData;
- int i;
-
- if(pData->hWaveThread == NULL)
- return;
-
- // Set flag to stop processing headers
- pData->bWaveShutdown = AL_TRUE;
-
- // Wait for signal that all Wave Buffers have returned
- WaitForSingleObjectEx(pData->hWaveHdrEvent, 5000, FALSE);
-
- // Wait for signal that Wave Thread has been destroyed
- WaitForSingleObjectEx(pData->hWaveThreadEvent, 5000, FALSE);
-
- CloseHandle(pData->hWaveThread);
- pData->hWaveThread = 0;
-
- pData->bWaveShutdown = AL_FALSE;
-
- // Release the wave buffers
- for(i = 0;i < 4;i++)
- {
- waveOutUnprepareHeader(pData->hWaveHandle.Out, &pData->WaveBuffer[i], sizeof(WAVEHDR));
- if(i == 0)
- free(pData->WaveBuffer[i].lpData);
- pData->WaveBuffer[i].lpData = NULL;
- }
-}
-
-
-static ALCboolean WinMMOpenCapture(ALCdevice *pDevice, const ALCchar *deviceName)
-{
- WAVEFORMATEX wfexCaptureFormat;
- DWORD ulCapturedDataSize;
- WinMMData *pData = NULL;
- UINT lDeviceID = 0;
- ALbyte *BufferData;
- ALint lBufferSize;
- MMRESULT res;
- ALuint i;
-
- if(!CaptureDeviceList)
- ProbeCaptureDevices();
-
- // Find the Device ID matching the deviceName if valid
- if(deviceName)
- {
- for(i = 0;i < NumCaptureDevices;i++)
- {
- if(CaptureDeviceList[i] &&
- strcmp(deviceName, CaptureDeviceList[i]) == 0)
- {
- lDeviceID = i;
- break;
- }
- }
- }
- else
- {
- for(i = 0;i < NumCaptureDevices;i++)
- {
- if(CaptureDeviceList[i])
- {
- lDeviceID = i;
- break;
- }
- }
- }
- if(i == NumCaptureDevices)
- return ALC_FALSE;
-
- pData = calloc(1, sizeof(*pData));
- if(!pData)
- {
- alcSetError(pDevice, ALC_OUT_OF_MEMORY);
- return ALC_FALSE;
- }
- pDevice->ExtraData = pData;
-
- if((pDevice->FmtChans != DevFmtMono && pDevice->FmtChans != DevFmtStereo) ||
- (pDevice->FmtType != DevFmtUByte && pDevice->FmtType != DevFmtShort))
- {
- alcSetError(pDevice, ALC_INVALID_ENUM);
- goto failure;
- }
-
- memset(&wfexCaptureFormat, 0, sizeof(WAVEFORMATEX));
- wfexCaptureFormat.wFormatTag = WAVE_FORMAT_PCM;
- wfexCaptureFormat.nChannels = ChannelsFromDevFmt(pDevice->FmtChans);
- wfexCaptureFormat.wBitsPerSample = BytesFromDevFmt(pDevice->FmtType) * 8;
- wfexCaptureFormat.nBlockAlign = wfexCaptureFormat.wBitsPerSample *
- wfexCaptureFormat.nChannels / 8;
- wfexCaptureFormat.nSamplesPerSec = pDevice->Frequency;
- wfexCaptureFormat.nAvgBytesPerSec = wfexCaptureFormat.nSamplesPerSec *
- wfexCaptureFormat.nBlockAlign;
- wfexCaptureFormat.cbSize = 0;
-
- if((res=waveInOpen(&pData->hWaveHandle.In, lDeviceID, &wfexCaptureFormat, (DWORD_PTR)&WaveInProc, (DWORD_PTR)pDevice, CALLBACK_FUNCTION)) != MMSYSERR_NOERROR)
- {
- AL_PRINT("waveInOpen failed: %u\n", res);
- goto failure;
- }
-
- pData->hWaveHdrEvent = CreateEvent(NULL, AL_TRUE, AL_FALSE, "WaveInAllHeadersReturned");
- pData->hWaveThreadEvent = CreateEvent(NULL, AL_TRUE, AL_FALSE, "WaveInThreadDestroyed");
- if(pData->hWaveHdrEvent == NULL || pData->hWaveThreadEvent == NULL)
- {
- AL_PRINT("CreateEvent failed: %lu\n", GetLastError());
- goto failure;
- }
-
- pData->Frequency = pDevice->Frequency;
-
- // Allocate circular memory buffer for the captured audio
- ulCapturedDataSize = pDevice->UpdateSize*pDevice->NumUpdates;
-
- // Make sure circular buffer is at least 100ms in size
- if(ulCapturedDataSize < (wfexCaptureFormat.nSamplesPerSec / 10))
- ulCapturedDataSize = wfexCaptureFormat.nSamplesPerSec / 10;
-
- pData->pRing = CreateRingBuffer(wfexCaptureFormat.nBlockAlign, ulCapturedDataSize);
- if(!pData->pRing)
- goto failure;
-
- pData->lWaveBuffersCommitted = 0;
-
- // Create 4 Buffers of 50ms each
- lBufferSize = wfexCaptureFormat.nAvgBytesPerSec / 20;
- lBufferSize -= (lBufferSize % wfexCaptureFormat.nBlockAlign);
-
- BufferData = calloc(4, lBufferSize);
- if(!BufferData)
- goto failure;
-
- for(i = 0;i < 4;i++)
- {
- memset(&pData->WaveBuffer[i], 0, sizeof(WAVEHDR));
- pData->WaveBuffer[i].dwBufferLength = lBufferSize;
- pData->WaveBuffer[i].lpData = ((i==0) ? (LPSTR)BufferData :
- (pData->WaveBuffer[i-1].lpData +
- pData->WaveBuffer[i-1].dwBufferLength));
- pData->WaveBuffer[i].dwFlags = 0;
- pData->WaveBuffer[i].dwLoops = 0;
- waveInPrepareHeader(pData->hWaveHandle.In, &pData->WaveBuffer[i], sizeof(WAVEHDR));
- waveInAddBuffer(pData->hWaveHandle.In, &pData->WaveBuffer[i], sizeof(WAVEHDR));
- InterlockedIncrement(&pData->lWaveBuffersCommitted);
- }
-
- pData->hWaveThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)CaptureThreadProc, (LPVOID)pDevice, 0, &pData->ulWaveThreadID);
- if (pData->hWaveThread == NULL)
- goto failure;
-
- pDevice->szDeviceName = strdup(CaptureDeviceList[lDeviceID]);
- return ALC_TRUE;
-
-failure:
- if(pData->hWaveThread)
- CloseHandle(pData->hWaveThread);
-
- for(i = 0;i < 4;i++)
- {
- if(pData->WaveBuffer[i].lpData)
- {
- waveInUnprepareHeader(pData->hWaveHandle.In, &pData->WaveBuffer[i], sizeof(WAVEHDR));
- if(i == 0)
- free(pData->WaveBuffer[i].lpData);
- }
- }
-
- if(pData->pRing)
- DestroyRingBuffer(pData->pRing);
-
- if(pData->hWaveThreadEvent)
- CloseHandle(pData->hWaveThreadEvent);
- if(pData->hWaveHdrEvent)
- CloseHandle(pData->hWaveHdrEvent);
-
- if(pData->hWaveHandle.In)
- waveInClose(pData->hWaveHandle.In);
-
- free(pData);
- pDevice->ExtraData = NULL;
- return ALC_FALSE;
-}
-
-static void WinMMCloseCapture(ALCdevice *pDevice)
-{
- WinMMData *pData = (WinMMData*)pDevice->ExtraData;
- int i;
-
- // Call waveOutReset to shutdown wave device
- pData->bWaveShutdown = AL_TRUE;
- waveInReset(pData->hWaveHandle.In);
-
- // Wait for signal that all Wave Buffers have returned
- WaitForSingleObjectEx(pData->hWaveHdrEvent, 5000, FALSE);
-
- // Wait for signal that Wave Thread has been destroyed
- WaitForSingleObjectEx(pData->hWaveThreadEvent, 5000, FALSE);
-
- CloseHandle(pData->hWaveThread);
- pData->hWaveThread = 0;
-
- // Release the wave buffers
- for(i = 0;i < 4;i++)
- {
- waveInUnprepareHeader(pData->hWaveHandle.In, &pData->WaveBuffer[i], sizeof(WAVEHDR));
- if(i == 0)
- free(pData->WaveBuffer[i].lpData);
- pData->WaveBuffer[i].lpData = NULL;
- }
-
- DestroyRingBuffer(pData->pRing);
- pData->pRing = NULL;
-
- // Close the Wave device
- CloseHandle(pData->hWaveThreadEvent);
- pData->hWaveThreadEvent = 0;
-
- CloseHandle(pData->hWaveHdrEvent);
- pData->hWaveHdrEvent = 0;
-
- waveInClose(pData->hWaveHandle.In);
- pData->hWaveHandle.In = 0;
-
- free(pData);
- pDevice->ExtraData = NULL;
-}
-
-static void WinMMStartCapture(ALCdevice *pDevice)
-{
- WinMMData *pData = (WinMMData*)pDevice->ExtraData;
- waveInStart(pData->hWaveHandle.In);
-}
-
-static void WinMMStopCapture(ALCdevice *pDevice)
-{
- WinMMData *pData = (WinMMData*)pDevice->ExtraData;
- waveInStop(pData->hWaveHandle.In);
-}
-
-static ALCuint WinMMAvailableSamples(ALCdevice *pDevice)
-{
- WinMMData *pData = (WinMMData*)pDevice->ExtraData;
- return RingBufferSize(pData->pRing);
-}
-
-static void WinMMCaptureSamples(ALCdevice *pDevice, ALCvoid *pBuffer, ALCuint lSamples)
-{
- WinMMData *pData = (WinMMData*)pDevice->ExtraData;
-
- if(WinMMAvailableSamples(pDevice) >= lSamples)
- ReadRingBuffer(pData->pRing, pBuffer, lSamples);
- else
- alcSetError(pDevice, ALC_INVALID_VALUE);
-}
-
-
-static BackendFuncs WinMMFuncs = {
- WinMMOpenPlayback,
- WinMMClosePlayback,
- WinMMResetPlayback,
- WinMMStopPlayback,
- WinMMOpenCapture,
- WinMMCloseCapture,
- WinMMStartCapture,
- WinMMStopCapture,
- WinMMCaptureSamples,
- WinMMAvailableSamples
-};
-
-void alcWinMMInit(BackendFuncs *FuncList)
-{
- *FuncList = WinMMFuncs;
-}
-
-void alcWinMMDeinit()
-{
- ALuint lLoop;
-
- for(lLoop = 0;lLoop < NumPlaybackDevices;lLoop++)
- free(PlaybackDeviceList[lLoop]);
- free(PlaybackDeviceList);
- PlaybackDeviceList = NULL;
-
- NumPlaybackDevices = 0;
-
-
- for(lLoop = 0; lLoop < NumCaptureDevices; lLoop++)
- free(CaptureDeviceList[lLoop]);
- free(CaptureDeviceList);
- CaptureDeviceList = NULL;
-
- NumCaptureDevices = 0;
-}
-
-void alcWinMMProbe(int type)
-{
- ALuint i;
-
- if(type == DEVICE_PROBE)
- {
- ProbePlaybackDevices();
- if(NumPlaybackDevices > 0)
- AppendDeviceList(woDefault);
- }
- else if(type == ALL_DEVICE_PROBE)
- {
- ProbePlaybackDevices();
- if(NumPlaybackDevices > 0)
- AppendAllDeviceList(woDefault);
- for(i = 0;i < NumPlaybackDevices;i++)
- {
- if(PlaybackDeviceList[i])
- AppendAllDeviceList(PlaybackDeviceList[i]);
- }
- }
- else if(type == CAPTURE_DEVICE_PROBE)
- {
- ProbeCaptureDevices();
- for(i = 0;i < NumCaptureDevices;i++)
- {
- if(CaptureDeviceList[i])
- AppendCaptureDeviceList(CaptureDeviceList[i]);
- }
- }
-}
diff --git a/internal/c/parts/audio/out/android/OpenAL/Makefile b/internal/c/parts/audio/out/android/OpenAL/Makefile
deleted file mode 100644
index 1f84440d3..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-ROOTDIR = ../..
-TARGET = System/OpenAL
-DEPS =
-
-include $(ROOTDIR)/library.mk
diff --git a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/AL/al.h b/internal/c/parts/audio/out/android/OpenAL/OpenAL32/AL/al.h
deleted file mode 100644
index e084b3ed3..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/AL/al.h
+++ /dev/null
@@ -1,825 +0,0 @@
-#ifndef AL_AL_H
-#define AL_AL_H
-
-#ifdef ANDROID
-#include
-#ifndef LOGI
-#define LOGI(...) __android_log_print(ANDROID_LOG_INFO,"OpenAL",__VA_ARGS__)
-#endif
-#ifndef LOGE
-#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,"OpenAL",__VA_ARGS__)
-#endif
-#endif
-
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
-#if defined(AL_LIBTYPE_STATIC)
- #define AL_API
-#elif defined(_WIN32) && !defined(_XBOX)
- #if defined(AL_BUILD_LIBRARY)
- #define AL_API __declspec(dllexport)
- #else
- #define AL_API __declspec(dllimport)
- #endif
-#else
- #if defined(AL_BUILD_LIBRARY) && defined(HAVE_GCC_VISIBILITY)
- #define AL_API __attribute__((visibility("protected")))
- #else
- #define AL_API extern
- #endif
-#endif
-
-#if defined(_WIN32)
- #define AL_APIENTRY __cdecl
-#else
- #define AL_APIENTRY
-#endif
-
-#if defined(TARGET_OS_MAC) && TARGET_OS_MAC
- #pragma export on
-#endif
-
-/*
- * The OPENAL, ALAPI, ALAPIENTRY, AL_INVALID, AL_ILLEGAL_ENUM, and
- * AL_ILLEGAL_COMMAND macros are deprecated, but are included for
- * applications porting code from AL 1.0
- */
-#define OPENAL
-#define ALAPI AL_API
-#define ALAPIENTRY AL_APIENTRY
-#define AL_INVALID (-1)
-#define AL_ILLEGAL_ENUM AL_INVALID_ENUM
-#define AL_ILLEGAL_COMMAND AL_INVALID_OPERATION
-
-#define AL_VERSION_1_0
-#define AL_VERSION_1_1
-
-
-/** 8-bit boolean */
-typedef char ALboolean;
-
-/** character */
-typedef char ALchar;
-
-/** signed 8-bit 2's complement integer */
-typedef signed char ALbyte;
-
-/** unsigned 8-bit integer */
-typedef unsigned char ALubyte;
-
-/** signed 16-bit 2's complement integer */
-typedef short ALshort;
-
-/** unsigned 16-bit integer */
-typedef unsigned short ALushort;
-
-/** signed 32-bit 2's complement integer */
-typedef int ALint;
-
-/** unsigned 32-bit integer */
-typedef unsigned int ALuint;
-
-/** non-negative 32-bit binary integer size */
-typedef int ALsizei;
-
-/** enumerated 32-bit value */
-typedef int ALenum;
-
-/** 32-bit IEEE754 floating-point */
-typedef float ALfloat;
-
-/** 64-bit IEEE754 floating-point */
-typedef double ALdouble;
-
-#ifdef OPENAL_FIXED_POINT
-/* Apportable tries to define int64_t and int32_t if it thinks it is needed.
- * But this is breaking in a complex project involving both pure C and C++
- * something is triggering redefinition errors. The workaround seems to be just using stdint.h.
- */
-#include
-/** Types and Macros for fixed-point math */
-#ifndef INT64_MAX
-typedef long long int64_t;
-#define INT64_MAX 9223372036854775807LL
-
-#endif
-#ifndef INT32_MAX
-typedef int int32_t;
-#define INT32_MAX 2147483647
-#endif
-
-// FIXME(apportable) make this int32_t
-typedef int64_t ALfp;
-typedef int64_t ALdfp;
-
-#define ONE (1<=0 ? 0.5 : -0.5)))
-#define ALfp2float(x) ((float)(x) / (1<=0 ? 0.5 : -0.5)))
-#define ALdfp2double(x) ((double)(x) / (1<> OPENAL_FIXED_POINT_SHIFT))
-
-#define int2ALdfp(x) ((ALdfp)(x) << OPENAL_FIXED_POINT_SHIFT)
-#define ALdfp2int(x) ((ALint)((x) >> OPENAL_FIXED_POINT_SHIFT))
-
-#define ALfpMult(x,y) ((ALfp)((((int64_t)(x))*((int64_t)(y)))>>OPENAL_FIXED_POINT_SHIFT))
-#define ALfpDiv(x,y) ((ALfp)(((int64_t)(x) << OPENAL_FIXED_POINT_SHIFT) / (y)))
-
-#define ALdfpMult(x,y) ALfpMult(x,y)
-#define ALdfpDiv(x,y) ALfpDiv(x,y)
-
-#define __isnan(x) (0)
-#define __cos(x) (float2ALfp(cos(ALfp2float(x))))
-#define __sin(x) (float2ALfp(sin(ALfp2float(x))))
-#define __log10(x) (float2ALfp(log10(ALfp2float(x))))
-#define __atan(x) (float2ALfp(atan(ALfp2float(x))))
-
-#define toALfpConst(x) ((x)*(1< Hz
- */
-#define ALC_FREQUENCY 0x1007
-
-/**
- * followed by Hz
- */
-#define ALC_REFRESH 0x1008
-
-/**
- * followed by AL_TRUE, AL_FALSE
- */
-#define ALC_SYNC 0x1009
-
-/**
- * followed by Num of requested Mono (3D) Sources
- */
-#define ALC_MONO_SOURCES 0x1010
-
-/**
- * followed by Num of requested Stereo Sources
- */
-#define ALC_STEREO_SOURCES 0x1011
-
-/**
- * errors
- */
-
-/**
- * No error
- */
-#define ALC_NO_ERROR ALC_FALSE
-
-/**
- * No device
- */
-#define ALC_INVALID_DEVICE 0xA001
-
-/**
- * invalid context ID
- */
-#define ALC_INVALID_CONTEXT 0xA002
-
-/**
- * bad enum
- */
-#define ALC_INVALID_ENUM 0xA003
-
-/**
- * bad value
- */
-#define ALC_INVALID_VALUE 0xA004
-
-/**
- * Out of memory.
- */
-#define ALC_OUT_OF_MEMORY 0xA005
-
-
-/**
- * The Specifier string for default device
- */
-#define ALC_DEFAULT_DEVICE_SPECIFIER 0x1004
-#define ALC_DEVICE_SPECIFIER 0x1005
-#define ALC_EXTENSIONS 0x1006
-
-#define ALC_MAJOR_VERSION 0x1000
-#define ALC_MINOR_VERSION 0x1001
-
-#define ALC_ATTRIBUTES_SIZE 0x1002
-#define ALC_ALL_ATTRIBUTES 0x1003
-
-
-/**
- * Capture extension
- */
-#define ALC_CAPTURE_DEVICE_SPECIFIER 0x310
-#define ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER 0x311
-#define ALC_CAPTURE_SAMPLES 0x312
-
-
-/*
- * Context Management
- */
-ALC_API ALCcontext * ALC_APIENTRY alcCreateContext( ALCdevice *device, const ALCint* attrlist );
-
-ALC_API ALCboolean ALC_APIENTRY alcMakeContextCurrent( ALCcontext *context );
-
-ALC_API void ALC_APIENTRY alcProcessContext( ALCcontext *context );
-
-ALC_API void ALC_APIENTRY alcSuspendContext( ALCcontext *context );
-
-ALC_API void ALC_APIENTRY alcDestroyContext( ALCcontext *context );
-
-ALC_API ALCcontext * ALC_APIENTRY alcGetCurrentContext( void );
-
-ALC_API ALCdevice* ALC_APIENTRY alcGetContextsDevice( ALCcontext *context );
-
-
-/*
- * Device Management
- */
-ALC_API ALCdevice * ALC_APIENTRY alcOpenDevice( const ALCchar *devicename );
-
-ALC_API ALCboolean ALC_APIENTRY alcCloseDevice( ALCdevice *device );
-
-
-/*
- * Error support.
- * Obtain the most recent Context error
- */
-ALC_API ALCenum ALC_APIENTRY alcGetError( ALCdevice *device );
-
-
-/*
- * Extension support.
- * Query for the presence of an extension, and obtain any appropriate
- * function pointers and enum values.
- */
-ALC_API ALCboolean ALC_APIENTRY alcIsExtensionPresent( ALCdevice *device, const ALCchar *extname );
-
-ALC_API void * ALC_APIENTRY alcGetProcAddress( ALCdevice *device, const ALCchar *funcname );
-
-ALC_API ALCenum ALC_APIENTRY alcGetEnumValue( ALCdevice *device, const ALCchar *enumname );
-
-
-/*
- * Query functions
- */
-ALC_API const ALCchar * ALC_APIENTRY alcGetString( ALCdevice *device, ALCenum param );
-
-ALC_API void ALC_APIENTRY alcGetIntegerv( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *data );
-
-
-/*
- * Capture functions
- */
-ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize );
-
-ALC_API ALCboolean ALC_APIENTRY alcCaptureCloseDevice( ALCdevice *device );
-
-ALC_API void ALC_APIENTRY alcCaptureStart( ALCdevice *device );
-
-ALC_API void ALC_APIENTRY alcCaptureStop( ALCdevice *device );
-
-ALC_API void ALC_APIENTRY alcCaptureSamples( ALCdevice *device, ALCvoid *buffer, ALCsizei samples );
-
-/*
- * Pointer-to-function types, useful for dynamically getting ALC entry points.
- */
-typedef ALCcontext * (ALC_APIENTRY *LPALCCREATECONTEXT) (ALCdevice *device, const ALCint *attrlist);
-typedef ALCboolean (ALC_APIENTRY *LPALCMAKECONTEXTCURRENT)( ALCcontext *context );
-typedef void (ALC_APIENTRY *LPALCPROCESSCONTEXT)( ALCcontext *context );
-typedef void (ALC_APIENTRY *LPALCSUSPENDCONTEXT)( ALCcontext *context );
-typedef void (ALC_APIENTRY *LPALCDESTROYCONTEXT)( ALCcontext *context );
-typedef ALCcontext * (ALC_APIENTRY *LPALCGETCURRENTCONTEXT)( void );
-typedef ALCdevice * (ALC_APIENTRY *LPALCGETCONTEXTSDEVICE)( ALCcontext *context );
-typedef ALCdevice * (ALC_APIENTRY *LPALCOPENDEVICE)( const ALCchar *devicename );
-typedef ALCboolean (ALC_APIENTRY *LPALCCLOSEDEVICE)( ALCdevice *device );
-typedef ALCenum (ALC_APIENTRY *LPALCGETERROR)( ALCdevice *device );
-typedef ALCboolean (ALC_APIENTRY *LPALCISEXTENSIONPRESENT)( ALCdevice *device, const ALCchar *extname );
-typedef void * (ALC_APIENTRY *LPALCGETPROCADDRESS)(ALCdevice *device, const ALCchar *funcname );
-typedef ALCenum (ALC_APIENTRY *LPALCGETENUMVALUE)(ALCdevice *device, const ALCchar *enumname );
-typedef const ALCchar* (ALC_APIENTRY *LPALCGETSTRING)( ALCdevice *device, ALCenum param );
-typedef void (ALC_APIENTRY *LPALCGETINTEGERV)( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *dest );
-typedef ALCdevice * (ALC_APIENTRY *LPALCCAPTUREOPENDEVICE)( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize );
-typedef ALCboolean (ALC_APIENTRY *LPALCCAPTURECLOSEDEVICE)( ALCdevice *device );
-typedef void (ALC_APIENTRY *LPALCCAPTURESTART)( ALCdevice *device );
-typedef void (ALC_APIENTRY *LPALCCAPTURESTOP)( ALCdevice *device );
-typedef void (ALC_APIENTRY *LPALCCAPTURESAMPLES)( ALCdevice *device, ALCvoid *buffer, ALCsizei samples );
-
-#if defined(TARGET_OS_MAC) && TARGET_OS_MAC
- #pragma export off
-#endif
-
-#if defined(ANDROID)
-/*
- * OpenAL extension for suspend/resume of audio throughout application lifecycle
- */
-ALC_API void ALC_APIENTRY alcSuspend( void );
-ALC_API void ALC_APIENTRY alcResume( void );
-#endif
-
-#if defined(__cplusplus)
-}
-#endif
-
-#endif /* AL_ALC_H */
diff --git a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/AL/alext.h b/internal/c/parts/audio/out/android/OpenAL/OpenAL32/AL/alext.h
deleted file mode 100644
index f3c7bcae8..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/AL/alext.h
+++ /dev/null
@@ -1,165 +0,0 @@
-/**
- * OpenAL cross platform audio library
- * Copyright (C) 2008 by authors.
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- * Or go to http://www.gnu.org/copyleft/lgpl.html
- */
-
-#ifndef AL_ALEXT_H
-#define AL_ALEXT_H
-
-#include
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef AL_LOKI_IMA_ADPCM_format
-#define AL_LOKI_IMA_ADPCM_format 1
-#define AL_FORMAT_IMA_ADPCM_MONO16_EXT 0x10000
-#define AL_FORMAT_IMA_ADPCM_STEREO16_EXT 0x10001
-#endif
-
-#ifndef AL_LOKI_WAVE_format
-#define AL_LOKI_WAVE_format 1
-#define AL_FORMAT_WAVE_EXT 0x10002
-#endif
-
-#ifndef AL_EXT_vorbis
-#define AL_EXT_vorbis 1
-#define AL_FORMAT_VORBIS_EXT 0x10003
-#endif
-
-#ifndef AL_LOKI_quadriphonic
-#define AL_LOKI_quadriphonic 1
-#define AL_FORMAT_QUAD8_LOKI 0x10004
-#define AL_FORMAT_QUAD16_LOKI 0x10005
-#endif
-
-#ifndef AL_EXT_float32
-#define AL_EXT_float32 1
-#define AL_FORMAT_MONO_FLOAT32 0x10010
-#define AL_FORMAT_STEREO_FLOAT32 0x10011
-#endif
-
-#ifndef AL_EXT_double
-#define AL_EXT_double 1
-#define AL_FORMAT_MONO_DOUBLE_EXT 0x10012
-#define AL_FORMAT_STEREO_DOUBLE_EXT 0x10013
-#endif
-
-#ifndef ALC_LOKI_audio_channel
-#define ALC_LOKI_audio_channel 1
-#define ALC_CHAN_MAIN_LOKI 0x500001
-#define ALC_CHAN_PCM_LOKI 0x500002
-#define ALC_CHAN_CD_LOKI 0x500003
-#endif
-
-#ifndef ALC_ENUMERATE_ALL_EXT
-#define ALC_ENUMERATE_ALL_EXT 1
-#define ALC_DEFAULT_ALL_DEVICES_SPECIFIER 0x1012
-#define ALC_ALL_DEVICES_SPECIFIER 0x1013
-#endif
-
-#ifndef AL_EXT_MCFORMATS
-#define AL_EXT_MCFORMATS 1
-#define AL_FORMAT_QUAD8 0x1204
-#define AL_FORMAT_QUAD16 0x1205
-#define AL_FORMAT_QUAD32 0x1206
-#define AL_FORMAT_REAR8 0x1207
-#define AL_FORMAT_REAR16 0x1208
-#define AL_FORMAT_REAR32 0x1209
-#define AL_FORMAT_51CHN8 0x120A
-#define AL_FORMAT_51CHN16 0x120B
-#define AL_FORMAT_51CHN32 0x120C
-#define AL_FORMAT_61CHN8 0x120D
-#define AL_FORMAT_61CHN16 0x120E
-#define AL_FORMAT_61CHN32 0x120F
-#define AL_FORMAT_71CHN8 0x1210
-#define AL_FORMAT_71CHN16 0x1211
-#define AL_FORMAT_71CHN32 0x1212
-#endif
-
-#ifndef AL_EXT_MULAW_MCFORMATS
-#define AL_EXT_MULAW_MCFORMATS 1
-#define AL_FORMAT_MONO_MULAW 0x10014
-#define AL_FORMAT_STEREO_MULAW 0x10015
-#define AL_FORMAT_QUAD_MULAW 0x10021
-#define AL_FORMAT_REAR_MULAW 0x10022
-#define AL_FORMAT_51CHN_MULAW 0x10023
-#define AL_FORMAT_61CHN_MULAW 0x10024
-#define AL_FORMAT_71CHN_MULAW 0x10025
-#endif
-
-#ifndef AL_EXT_IMA4
-#define AL_EXT_IMA4 1
-#define AL_FORMAT_MONO_IMA4 0x1300
-#define AL_FORMAT_STEREO_IMA4 0x1301
-#endif
-
-#ifndef AL_EXT_STATIC_BUFFER
-#define AL_EXT_STATIC_BUFFER 1
-typedef ALvoid (AL_APIENTRY*PFNALBUFFERDATASTATICPROC)(const ALint,ALenum,ALvoid*,ALsizei,ALsizei);
-#ifdef AL_ALEXT_PROTOTYPES
-AL_API ALvoid AL_APIENTRY alBufferDataStatic(const ALint buffer, ALenum format, ALvoid *data, ALsizei len, ALsizei freq);
-#endif
-#endif
-
-#ifndef ALC_EXT_EFX
-#define ALC_EXT_EFX 1
-#include "efx.h"
-#endif
-
-#ifndef ALC_EXT_disconnect
-#define ALC_EXT_disconnect 1
-#define ALC_CONNECTED 0x313
-#endif
-
-#ifndef ALC_EXT_thread_local_context
-#define ALC_EXT_thread_local_context 1
-typedef ALCboolean (ALC_APIENTRY*PFNALCSETTHREADCONTEXTPROC)(ALCcontext *context);
-typedef ALCcontext* (ALC_APIENTRY*PFNALCGETTHREADCONTEXTPROC)(void);
-#ifdef AL_ALEXT_PROTOTYPES
-ALC_API ALCboolean ALC_APIENTRY alcSetThreadContext(ALCcontext *context);
-ALC_API ALCcontext* ALC_APIENTRY alcGetThreadContext(void);
-#endif
-#endif
-
-#ifndef AL_EXT_source_distance_model
-#define AL_EXT_source_distance_model 1
-#define AL_SOURCE_DISTANCE_MODEL 0x200
-#endif
-
-#ifndef AL_SOFT_buffer_sub_data
-#define AL_SOFT_buffer_sub_data 1
-#define AL_BYTE_RW_OFFSETS_SOFT 0x1031
-#define AL_SAMPLE_RW_OFFSETS_SOFT 0x1032
-typedef ALvoid (AL_APIENTRY*PFNALBUFFERSUBDATASOFTPROC)(ALuint,ALenum,const ALvoid*,ALsizei,ALsizei);
-#ifdef AL_ALEXT_PROTOTYPES
-AL_API ALvoid AL_APIENTRY alBufferSubDataSOFT(ALuint buffer,ALenum format,const ALvoid *data,ALsizei offset,ALsizei length);
-#endif
-#endif
-
-#ifndef AL_SOFT_loop_points
-#define AL_SOFT_loop_points 1
-#define AL_LOOP_POINTS_SOFT 0x2015
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/AL/efx-creative.h b/internal/c/parts/audio/out/android/OpenAL/OpenAL32/AL/efx-creative.h
deleted file mode 100644
index 0a04c982e..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/AL/efx-creative.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* The tokens that would be defined here are already defined in efx.h. This
- * empty file is here to provide compatibility with Windows-based projects
- * that would include it. */
diff --git a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/AL/efx.h b/internal/c/parts/audio/out/android/OpenAL/OpenAL32/AL/efx.h
deleted file mode 100644
index 0ccef95d6..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/AL/efx.h
+++ /dev/null
@@ -1,758 +0,0 @@
-#ifndef AL_EFX_H
-#define AL_EFX_H
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define ALC_EXT_EFX_NAME "ALC_EXT_EFX"
-
-#define ALC_EFX_MAJOR_VERSION 0x20001
-#define ALC_EFX_MINOR_VERSION 0x20002
-#define ALC_MAX_AUXILIARY_SENDS 0x20003
-
-
-/* Listener properties. */
-#define AL_METERS_PER_UNIT 0x20004
-
-/* Source properties. */
-#define AL_DIRECT_FILTER 0x20005
-#define AL_AUXILIARY_SEND_FILTER 0x20006
-#define AL_AIR_ABSORPTION_FACTOR 0x20007
-#define AL_ROOM_ROLLOFF_FACTOR 0x20008
-#define AL_CONE_OUTER_GAINHF 0x20009
-#define AL_DIRECT_FILTER_GAINHF_AUTO 0x2000A
-#define AL_AUXILIARY_SEND_FILTER_GAIN_AUTO 0x2000B
-#define AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO 0x2000C
-
-
-/* Effect properties. */
-
-/* Reverb effect parameters */
-#define AL_REVERB_DENSITY 0x0001
-#define AL_REVERB_DIFFUSION 0x0002
-#define AL_REVERB_GAIN 0x0003
-#define AL_REVERB_GAINHF 0x0004
-#define AL_REVERB_DECAY_TIME 0x0005
-#define AL_REVERB_DECAY_HFRATIO 0x0006
-#define AL_REVERB_REFLECTIONS_GAIN 0x0007
-#define AL_REVERB_REFLECTIONS_DELAY 0x0008
-#define AL_REVERB_LATE_REVERB_GAIN 0x0009
-#define AL_REVERB_LATE_REVERB_DELAY 0x000A
-#define AL_REVERB_AIR_ABSORPTION_GAINHF 0x000B
-#define AL_REVERB_ROOM_ROLLOFF_FACTOR 0x000C
-#define AL_REVERB_DECAY_HFLIMIT 0x000D
-
-/* EAX Reverb effect parameters */
-#define AL_EAXREVERB_DENSITY 0x0001
-#define AL_EAXREVERB_DIFFUSION 0x0002
-#define AL_EAXREVERB_GAIN 0x0003
-#define AL_EAXREVERB_GAINHF 0x0004
-#define AL_EAXREVERB_GAINLF 0x0005
-#define AL_EAXREVERB_DECAY_TIME 0x0006
-#define AL_EAXREVERB_DECAY_HFRATIO 0x0007
-#define AL_EAXREVERB_DECAY_LFRATIO 0x0008
-#define AL_EAXREVERB_REFLECTIONS_GAIN 0x0009
-#define AL_EAXREVERB_REFLECTIONS_DELAY 0x000A
-#define AL_EAXREVERB_REFLECTIONS_PAN 0x000B
-#define AL_EAXREVERB_LATE_REVERB_GAIN 0x000C
-#define AL_EAXREVERB_LATE_REVERB_DELAY 0x000D
-#define AL_EAXREVERB_LATE_REVERB_PAN 0x000E
-#define AL_EAXREVERB_ECHO_TIME 0x000F
-#define AL_EAXREVERB_ECHO_DEPTH 0x0010
-#define AL_EAXREVERB_MODULATION_TIME 0x0011
-#define AL_EAXREVERB_MODULATION_DEPTH 0x0012
-#define AL_EAXREVERB_AIR_ABSORPTION_GAINHF 0x0013
-#define AL_EAXREVERB_HFREFERENCE 0x0014
-#define AL_EAXREVERB_LFREFERENCE 0x0015
-#define AL_EAXREVERB_ROOM_ROLLOFF_FACTOR 0x0016
-#define AL_EAXREVERB_DECAY_HFLIMIT 0x0017
-
-/* Chorus effect parameters */
-#define AL_CHORUS_WAVEFORM 0x0001
-#define AL_CHORUS_PHASE 0x0002
-#define AL_CHORUS_RATE 0x0003
-#define AL_CHORUS_DEPTH 0x0004
-#define AL_CHORUS_FEEDBACK 0x0005
-#define AL_CHORUS_DELAY 0x0006
-
-/* Distortion effect parameters */
-#define AL_DISTORTION_EDGE 0x0001
-#define AL_DISTORTION_GAIN 0x0002
-#define AL_DISTORTION_LOWPASS_CUTOFF 0x0003
-#define AL_DISTORTION_EQCENTER 0x0004
-#define AL_DISTORTION_EQBANDWIDTH 0x0005
-
-/* Echo effect parameters */
-#define AL_ECHO_DELAY 0x0001
-#define AL_ECHO_LRDELAY 0x0002
-#define AL_ECHO_DAMPING 0x0003
-#define AL_ECHO_FEEDBACK 0x0004
-#define AL_ECHO_SPREAD 0x0005
-
-/* Flanger effect parameters */
-#define AL_FLANGER_WAVEFORM 0x0001
-#define AL_FLANGER_PHASE 0x0002
-#define AL_FLANGER_RATE 0x0003
-#define AL_FLANGER_DEPTH 0x0004
-#define AL_FLANGER_FEEDBACK 0x0005
-#define AL_FLANGER_DELAY 0x0006
-
-/* Frequency shifter effect parameters */
-#define AL_FREQUENCY_SHIFTER_FREQUENCY 0x0001
-#define AL_FREQUENCY_SHIFTER_LEFT_DIRECTION 0x0002
-#define AL_FREQUENCY_SHIFTER_RIGHT_DIRECTION 0x0003
-
-/* Vocal morpher effect parameters */
-#define AL_VOCAL_MORPHER_PHONEMEA 0x0001
-#define AL_VOCAL_MORPHER_PHONEMEA_COARSE_TUNING 0x0002
-#define AL_VOCAL_MORPHER_PHONEMEB 0x0003
-#define AL_VOCAL_MORPHER_PHONEMEB_COARSE_TUNING 0x0004
-#define AL_VOCAL_MORPHER_WAVEFORM 0x0005
-#define AL_VOCAL_MORPHER_RATE 0x0006
-
-/* Pitchshifter effect parameters */
-#define AL_PITCH_SHIFTER_COARSE_TUNE 0x0001
-#define AL_PITCH_SHIFTER_FINE_TUNE 0x0002
-
-/* Ringmodulator effect parameters */
-#define AL_RING_MODULATOR_FREQUENCY 0x0001
-#define AL_RING_MODULATOR_HIGHPASS_CUTOFF 0x0002
-#define AL_RING_MODULATOR_WAVEFORM 0x0003
-
-/* Autowah effect parameters */
-#define AL_AUTOWAH_ATTACK_TIME 0x0001
-#define AL_AUTOWAH_RELEASE_TIME 0x0002
-#define AL_AUTOWAH_RESONANCE 0x0003
-#define AL_AUTOWAH_PEAK_GAIN 0x0004
-
-/* Compressor effect parameters */
-#define AL_COMPRESSOR_ONOFF 0x0001
-
-/* Equalizer effect parameters */
-#define AL_EQUALIZER_LOW_GAIN 0x0001
-#define AL_EQUALIZER_LOW_CUTOFF 0x0002
-#define AL_EQUALIZER_MID1_GAIN 0x0003
-#define AL_EQUALIZER_MID1_CENTER 0x0004
-#define AL_EQUALIZER_MID1_WIDTH 0x0005
-#define AL_EQUALIZER_MID2_GAIN 0x0006
-#define AL_EQUALIZER_MID2_CENTER 0x0007
-#define AL_EQUALIZER_MID2_WIDTH 0x0008
-#define AL_EQUALIZER_HIGH_GAIN 0x0009
-#define AL_EQUALIZER_HIGH_CUTOFF 0x000A
-
-/* Effect type */
-#define AL_EFFECT_FIRST_PARAMETER 0x0000
-#define AL_EFFECT_LAST_PARAMETER 0x8000
-#define AL_EFFECT_TYPE 0x8001
-
-/* Effect types, used with the AL_EFFECT_TYPE property */
-#define AL_EFFECT_NULL 0x0000
-#define AL_EFFECT_REVERB 0x0001
-#define AL_EFFECT_CHORUS 0x0002
-#define AL_EFFECT_DISTORTION 0x0003
-#define AL_EFFECT_ECHO 0x0004
-#define AL_EFFECT_FLANGER 0x0005
-#define AL_EFFECT_FREQUENCY_SHIFTER 0x0006
-#define AL_EFFECT_VOCAL_MORPHER 0x0007
-#define AL_EFFECT_PITCH_SHIFTER 0x0008
-#define AL_EFFECT_RING_MODULATOR 0x0009
-#define AL_EFFECT_AUTOWAH 0x000A
-#define AL_EFFECT_COMPRESSOR 0x000B
-#define AL_EFFECT_EQUALIZER 0x000C
-#define AL_EFFECT_EAXREVERB 0x8000
-
-/* Auxiliary Effect Slot properties. */
-#define AL_EFFECTSLOT_EFFECT 0x0001
-#define AL_EFFECTSLOT_GAIN 0x0002
-#define AL_EFFECTSLOT_AUXILIARY_SEND_AUTO 0x0003
-
-/* NULL Auxiliary Slot ID to disable a source send. */
-#define AL_EFFECTSLOT_NULL 0x0000
-
-
-/* Filter properties. */
-
-/* Lowpass filter parameters */
-#define AL_LOWPASS_GAIN 0x0001
-#define AL_LOWPASS_GAINHF 0x0002
-
-/* Highpass filter parameters */
-#define AL_HIGHPASS_GAIN 0x0001
-#define AL_HIGHPASS_GAINLF 0x0002
-
-/* Bandpass filter parameters */
-#define AL_BANDPASS_GAIN 0x0001
-#define AL_BANDPASS_GAINLF 0x0002
-#define AL_BANDPASS_GAINHF 0x0003
-
-/* Filter type */
-#define AL_FILTER_FIRST_PARAMETER 0x0000
-#define AL_FILTER_LAST_PARAMETER 0x8000
-#define AL_FILTER_TYPE 0x8001
-
-/* Filter types, used with the AL_FILTER_TYPE property */
-#define AL_FILTER_NULL 0x0000
-#define AL_FILTER_LOWPASS 0x0001
-#define AL_FILTER_HIGHPASS 0x0002
-#define AL_FILTER_BANDPASS 0x0003
-
-
-/* Effect object function types. */
-typedef void (AL_APIENTRY *LPALGENEFFECTS)(ALsizei, ALuint*);
-typedef void (AL_APIENTRY *LPALDELETEEFFECTS)(ALsizei, ALuint*);
-typedef ALboolean (AL_APIENTRY *LPALISEFFECT)(ALuint);
-typedef void (AL_APIENTRY *LPALEFFECTI)(ALuint, ALenum, ALint);
-typedef void (AL_APIENTRY *LPALEFFECTIV)(ALuint, ALenum, ALint*);
-typedef void (AL_APIENTRY *LPALEFFECTF)(ALuint, ALenum, ALfloat);
-typedef void (AL_APIENTRY *LPALEFFECTFV)(ALuint, ALenum, ALfloat*);
-typedef void (AL_APIENTRY *LPALGETEFFECTI)(ALuint, ALenum, ALint*);
-typedef void (AL_APIENTRY *LPALGETEFFECTIV)(ALuint, ALenum, ALint*);
-typedef void (AL_APIENTRY *LPALGETEFFECTF)(ALuint, ALenum, ALfloat*);
-typedef void (AL_APIENTRY *LPALGETEFFECTFV)(ALuint, ALenum, ALfloat*);
-
-/* Filter object function types. */
-typedef void (AL_APIENTRY *LPALGENFILTERS)(ALsizei, ALuint*);
-typedef void (AL_APIENTRY *LPALDELETEFILTERS)(ALsizei, ALuint*);
-typedef ALboolean (AL_APIENTRY *LPALISFILTER)(ALuint);
-typedef void (AL_APIENTRY *LPALFILTERI)(ALuint, ALenum, ALint);
-typedef void (AL_APIENTRY *LPALFILTERIV)(ALuint, ALenum, ALint*);
-typedef void (AL_APIENTRY *LPALFILTERF)(ALuint, ALenum, ALfloat);
-typedef void (AL_APIENTRY *LPALFILTERFV)(ALuint, ALenum, ALfloat*);
-typedef void (AL_APIENTRY *LPALGETFILTERI)(ALuint, ALenum, ALint*);
-typedef void (AL_APIENTRY *LPALGETFILTERIV)(ALuint, ALenum, ALint*);
-typedef void (AL_APIENTRY *LPALGETFILTERF)(ALuint, ALenum, ALfloat*);
-typedef void (AL_APIENTRY *LPALGETFILTERFV)(ALuint, ALenum, ALfloat*);
-
-/* Auxiliary Effect Slot object function types. */
-typedef void (AL_APIENTRY *LPALGENAUXILIARYEFFECTSLOTS)(ALsizei, ALuint*);
-typedef void (AL_APIENTRY *LPALDELETEAUXILIARYEFFECTSLOTS)(ALsizei, ALuint*);
-typedef ALboolean (AL_APIENTRY *LPALISAUXILIARYEFFECTSLOT)(ALuint);
-typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTI)(ALuint, ALenum, ALint);
-typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTIV)(ALuint, ALenum, ALint*);
-typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTF)(ALuint, ALenum, ALfloat);
-typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTFV)(ALuint, ALenum, ALfloat*);
-typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTI)(ALuint, ALenum, ALint*);
-typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTIV)(ALuint, ALenum, ALint*);
-typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTF)(ALuint, ALenum, ALfloat*);
-typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTFV)(ALuint, ALenum, ALfloat*);
-
-#ifdef AL_ALEXT_PROTOTYPES
-AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects);
-AL_API ALvoid AL_APIENTRY alDeleteEffects(ALsizei n, ALuint *effects);
-AL_API ALboolean AL_APIENTRY alIsEffect(ALuint effect);
-AL_API ALvoid AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint iValue);
-AL_API ALvoid AL_APIENTRY alEffectiv(ALuint effect, ALenum param, ALint *piValues);
-AL_API ALvoid AL_APIENTRY alEffectf(ALuint effect, ALenum param, ALfloat flValue);
-AL_API ALvoid AL_APIENTRY alEffectfv(ALuint effect, ALenum param, ALfloat *pflValues);
-AL_API ALvoid AL_APIENTRY alGetEffecti(ALuint effect, ALenum param, ALint *piValue);
-AL_API ALvoid AL_APIENTRY alGetEffectiv(ALuint effect, ALenum param, ALint *piValues);
-AL_API ALvoid AL_APIENTRY alGetEffectf(ALuint effect, ALenum param, ALfloat *pflValue);
-AL_API ALvoid AL_APIENTRY alGetEffectfv(ALuint effect, ALenum param, ALfloat *pflValues);
-
-AL_API ALvoid AL_APIENTRY alGenFilters(ALsizei n, ALuint *filters);
-AL_API ALvoid AL_APIENTRY alDeleteFilters(ALsizei n, ALuint *filters);
-AL_API ALboolean AL_APIENTRY alIsFilter(ALuint filter);
-AL_API ALvoid AL_APIENTRY alFilteri(ALuint filter, ALenum param, ALint iValue);
-AL_API ALvoid AL_APIENTRY alFilteriv(ALuint filter, ALenum param, ALint *piValues);
-AL_API ALvoid AL_APIENTRY alFilterf(ALuint filter, ALenum param, ALfloat flValue);
-AL_API ALvoid AL_APIENTRY alFilterfv(ALuint filter, ALenum param, ALfloat *pflValues);
-AL_API ALvoid AL_APIENTRY alGetFilteri(ALuint filter, ALenum param, ALint *piValue);
-AL_API ALvoid AL_APIENTRY alGetFilteriv(ALuint filter, ALenum param, ALint *piValues);
-AL_API ALvoid AL_APIENTRY alGetFilterf(ALuint filter, ALenum param, ALfloat *pflValue);
-AL_API ALvoid AL_APIENTRY alGetFilterfv(ALuint filter, ALenum param, ALfloat *pflValues);
-
-AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslots);
-AL_API ALvoid AL_APIENTRY alDeleteAuxiliaryEffectSlots(ALsizei n, ALuint *effectslots);
-AL_API ALboolean AL_APIENTRY alIsAuxiliaryEffectSlot(ALuint effectslot);
-AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint iValue);
-AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotiv(ALuint effectslot, ALenum param, ALint *piValues);
-AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotf(ALuint effectslot, ALenum param, ALfloat flValue);
-AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotfv(ALuint effectslot, ALenum param, ALfloat *pflValues);
-AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint *piValue);
-AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotiv(ALuint effectslot, ALenum param, ALint *piValues);
-AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotf(ALuint effectslot, ALenum param, ALfloat *pflValue);
-AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotfv(ALuint effectslot, ALenum param, ALfloat *pflValues);
-#endif
-
-/* Filter ranges and defaults. */
-
-/* Lowpass filter */
-#define LOWPASS_MIN_GAIN (0.0f)
-#define LOWPASS_MAX_GAIN (1.0f)
-#define LOWPASS_DEFAULT_GAIN (1.0f)
-
-#define LOWPASS_MIN_GAINHF (0.0f)
-#define LOWPASS_MAX_GAINHF (1.0f)
-#define LOWPASS_DEFAULT_GAINHF (1.0f)
-
-/* Highpass filter */
-#define HIGHPASS_MIN_GAIN (0.0f)
-#define HIGHPASS_MAX_GAIN (1.0f)
-#define HIGHPASS_DEFAULT_GAIN (1.0f)
-
-#define HIGHPASS_MIN_GAINLF (0.0f)
-#define HIGHPASS_MAX_GAINLF (1.0f)
-#define HIGHPASS_DEFAULT_GAINLF (1.0f)
-
-/* Bandpass filter */
-#define BANDPASS_MIN_GAIN (0.0f)
-#define BANDPASS_MAX_GAIN (1.0f)
-#define BANDPASS_DEFAULT_GAIN (1.0f)
-
-#define BANDPASS_MIN_GAINHF (0.0f)
-#define BANDPASS_MAX_GAINHF (1.0f)
-#define BANDPASS_DEFAULT_GAINHF (1.0f)
-
-#define BANDPASS_MIN_GAINLF (0.0f)
-#define BANDPASS_MAX_GAINLF (1.0f)
-#define BANDPASS_DEFAULT_GAINLF (1.0f)
-
-
-/* Effect parameter ranges and defaults. */
-
-/* Standard reverb effect */
-#define AL_REVERB_MIN_DENSITY (0.0f)
-#define AL_REVERB_MAX_DENSITY (1.0f)
-#define AL_REVERB_DEFAULT_DENSITY (1.0f)
-
-#define AL_REVERB_MIN_DIFFUSION (0.0f)
-#define AL_REVERB_MAX_DIFFUSION (1.0f)
-#define AL_REVERB_DEFAULT_DIFFUSION (1.0f)
-
-#define AL_REVERB_MIN_GAIN (0.0f)
-#define AL_REVERB_MAX_GAIN (1.0f)
-#define AL_REVERB_DEFAULT_GAIN (0.32f)
-
-#define AL_REVERB_MIN_GAINHF (0.0f)
-#define AL_REVERB_MAX_GAINHF (1.0f)
-#define AL_REVERB_DEFAULT_GAINHF (0.89f)
-
-#define AL_REVERB_MIN_DECAY_TIME (0.1f)
-#define AL_REVERB_MAX_DECAY_TIME (20.0f)
-#define AL_REVERB_DEFAULT_DECAY_TIME (1.49f)
-
-#define AL_REVERB_MIN_DECAY_HFRATIO (0.1f)
-#define AL_REVERB_MAX_DECAY_HFRATIO (2.0f)
-#define AL_REVERB_DEFAULT_DECAY_HFRATIO (0.83f)
-
-#define AL_REVERB_MIN_REFLECTIONS_GAIN (0.0f)
-#define AL_REVERB_MAX_REFLECTIONS_GAIN (3.16f)
-#define AL_REVERB_DEFAULT_REFLECTIONS_GAIN (0.05f)
-
-#define AL_REVERB_MIN_REFLECTIONS_DELAY (0.0f)
-#define AL_REVERB_MAX_REFLECTIONS_DELAY (0.3f)
-#define AL_REVERB_DEFAULT_REFLECTIONS_DELAY (0.007f)
-
-#define AL_REVERB_MIN_LATE_REVERB_GAIN (0.0f)
-#define AL_REVERB_MAX_LATE_REVERB_GAIN (10.0f)
-#define AL_REVERB_DEFAULT_LATE_REVERB_GAIN (1.26f)
-
-#define AL_REVERB_MIN_LATE_REVERB_DELAY (0.0f)
-#define AL_REVERB_MAX_LATE_REVERB_DELAY (0.1f)
-#define AL_REVERB_DEFAULT_LATE_REVERB_DELAY (0.011f)
-
-#define AL_REVERB_MIN_AIR_ABSORPTION_GAINHF (0.892f)
-#define AL_REVERB_MAX_AIR_ABSORPTION_GAINHF (1.0f)
-#define AL_REVERB_DEFAULT_AIR_ABSORPTION_GAINHF (0.994f)
-
-#define AL_REVERB_MIN_ROOM_ROLLOFF_FACTOR (0.0f)
-#define AL_REVERB_MAX_ROOM_ROLLOFF_FACTOR (10.0f)
-#define AL_REVERB_DEFAULT_ROOM_ROLLOFF_FACTOR (0.0f)
-
-#define AL_REVERB_MIN_DECAY_HFLIMIT AL_FALSE
-#define AL_REVERB_MAX_DECAY_HFLIMIT AL_TRUE
-#define AL_REVERB_DEFAULT_DECAY_HFLIMIT AL_TRUE
-
-/* EAX reverb effect */
-#define AL_EAXREVERB_MIN_DENSITY (0.0f)
-#define AL_EAXREVERB_MAX_DENSITY (1.0f)
-#define AL_EAXREVERB_DEFAULT_DENSITY (1.0f)
-
-#define AL_EAXREVERB_MIN_DIFFUSION (0.0f)
-#define AL_EAXREVERB_MAX_DIFFUSION (1.0f)
-#define AL_EAXREVERB_DEFAULT_DIFFUSION (1.0f)
-
-#define AL_EAXREVERB_MIN_GAIN (0.0f)
-#define AL_EAXREVERB_MAX_GAIN (1.0f)
-#define AL_EAXREVERB_DEFAULT_GAIN (0.32f)
-
-#define AL_EAXREVERB_MIN_GAINHF (0.0f)
-#define AL_EAXREVERB_MAX_GAINHF (1.0f)
-#define AL_EAXREVERB_DEFAULT_GAINHF (0.89f)
-
-#define AL_EAXREVERB_MIN_GAINLF (0.0f)
-#define AL_EAXREVERB_MAX_GAINLF (1.0f)
-#define AL_EAXREVERB_DEFAULT_GAINLF (1.0f)
-
-#define AL_EAXREVERB_MIN_DECAY_TIME (0.1f)
-#define AL_EAXREVERB_MAX_DECAY_TIME (20.0f)
-#define AL_EAXREVERB_DEFAULT_DECAY_TIME (1.49f)
-
-#define AL_EAXREVERB_MIN_DECAY_HFRATIO (0.1f)
-#define AL_EAXREVERB_MAX_DECAY_HFRATIO (2.0f)
-#define AL_EAXREVERB_DEFAULT_DECAY_HFRATIO (0.83f)
-
-#define AL_EAXREVERB_MIN_DECAY_LFRATIO (0.1f)
-#define AL_EAXREVERB_MAX_DECAY_LFRATIO (2.0f)
-#define AL_EAXREVERB_DEFAULT_DECAY_LFRATIO (1.0f)
-
-#define AL_EAXREVERB_MIN_REFLECTIONS_GAIN (0.0f)
-#define AL_EAXREVERB_MAX_REFLECTIONS_GAIN (3.16f)
-#define AL_EAXREVERB_DEFAULT_REFLECTIONS_GAIN (0.05f)
-
-#define AL_EAXREVERB_MIN_REFLECTIONS_DELAY (0.0f)
-#define AL_EAXREVERB_MAX_REFLECTIONS_DELAY (0.3f)
-#define AL_EAXREVERB_DEFAULT_REFLECTIONS_DELAY (0.007f)
-
-#define AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN_XYZ (0.0f)
-
-#define AL_EAXREVERB_MIN_LATE_REVERB_GAIN (0.0f)
-#define AL_EAXREVERB_MAX_LATE_REVERB_GAIN (10.0f)
-#define AL_EAXREVERB_DEFAULT_LATE_REVERB_GAIN (1.26f)
-
-#define AL_EAXREVERB_MIN_LATE_REVERB_DELAY (0.0f)
-#define AL_EAXREVERB_MAX_LATE_REVERB_DELAY (0.1f)
-#define AL_EAXREVERB_DEFAULT_LATE_REVERB_DELAY (0.011f)
-
-#define AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN_XYZ (0.0f)
-
-#define AL_EAXREVERB_MIN_ECHO_TIME (0.075f)
-#define AL_EAXREVERB_MAX_ECHO_TIME (0.25f)
-#define AL_EAXREVERB_DEFAULT_ECHO_TIME (0.25f)
-
-#define AL_EAXREVERB_MIN_ECHO_DEPTH (0.0f)
-#define AL_EAXREVERB_MAX_ECHO_DEPTH (1.0f)
-#define AL_EAXREVERB_DEFAULT_ECHO_DEPTH (0.0f)
-
-#define AL_EAXREVERB_MIN_MODULATION_TIME (0.04f)
-#define AL_EAXREVERB_MAX_MODULATION_TIME (4.0f)
-#define AL_EAXREVERB_DEFAULT_MODULATION_TIME (0.25f)
-
-#define AL_EAXREVERB_MIN_MODULATION_DEPTH (0.0f)
-#define AL_EAXREVERB_MAX_MODULATION_DEPTH (1.0f)
-#define AL_EAXREVERB_DEFAULT_MODULATION_DEPTH (0.0f)
-
-#define AL_EAXREVERB_MIN_AIR_ABSORPTION_GAINHF (0.892f)
-#define AL_EAXREVERB_MAX_AIR_ABSORPTION_GAINHF (1.0f)
-#define AL_EAXREVERB_DEFAULT_AIR_ABSORPTION_GAINHF (0.994f)
-
-#define AL_EAXREVERB_MIN_HFREFERENCE (1000.0f)
-#define AL_EAXREVERB_MAX_HFREFERENCE (20000.0f)
-#define AL_EAXREVERB_DEFAULT_HFREFERENCE (5000.0f)
-
-#define AL_EAXREVERB_MIN_LFREFERENCE (20.0f)
-#define AL_EAXREVERB_MAX_LFREFERENCE (1000.0f)
-#define AL_EAXREVERB_DEFAULT_LFREFERENCE (250.0f)
-
-#define AL_EAXREVERB_MIN_ROOM_ROLLOFF_FACTOR (0.0f)
-#define AL_EAXREVERB_MAX_ROOM_ROLLOFF_FACTOR (10.0f)
-#define AL_EAXREVERB_DEFAULT_ROOM_ROLLOFF_FACTOR (0.0f)
-
-#define AL_EAXREVERB_MIN_DECAY_HFLIMIT AL_FALSE
-#define AL_EAXREVERB_MAX_DECAY_HFLIMIT AL_TRUE
-#define AL_EAXREVERB_DEFAULT_DECAY_HFLIMIT AL_TRUE
-
-/* Chorus effect */
-#define AL_CHORUS_WAVEFORM_SINUSOID (0)
-#define AL_CHORUS_WAVEFORM_TRIANGLE (1)
-
-#define AL_CHORUS_MIN_WAVEFORM (0)
-#define AL_CHORUS_MAX_WAVEFORM (1)
-#define AL_CHORUS_DEFAULT_WAVEFORM (1)
-
-#define AL_CHORUS_MIN_PHASE (-180)
-#define AL_CHORUS_MAX_PHASE (180)
-#define AL_CHORUS_DEFAULT_PHASE (90)
-
-#define AL_CHORUS_MIN_RATE (0.0f)
-#define AL_CHORUS_MAX_RATE (10.0f)
-#define AL_CHORUS_DEFAULT_RATE (1.1f)
-
-#define AL_CHORUS_MIN_DEPTH (0.0f)
-#define AL_CHORUS_MAX_DEPTH (1.0f)
-#define AL_CHORUS_DEFAULT_DEPTH (0.1f)
-
-#define AL_CHORUS_MIN_FEEDBACK (-1.0f)
-#define AL_CHORUS_MAX_FEEDBACK (1.0f)
-#define AL_CHORUS_DEFAULT_FEEDBACK (0.25f)
-
-#define AL_CHORUS_MIN_DELAY (0.0f)
-#define AL_CHORUS_MAX_DELAY (0.016f)
-#define AL_CHORUS_DEFAULT_DELAY (0.016f)
-
-/* Distortion effect */
-#define AL_DISTORTION_MIN_EDGE (0.0f)
-#define AL_DISTORTION_MAX_EDGE (1.0f)
-#define AL_DISTORTION_DEFAULT_EDGE (0.2f)
-
-#define AL_DISTORTION_MIN_GAIN (0.01f)
-#define AL_DISTORTION_MAX_GAIN (1.0f)
-#define AL_DISTORTION_DEFAULT_GAIN (0.05f)
-
-#define AL_DISTORTION_MIN_LOWPASS_CUTOFF (80.0f)
-#define AL_DISTORTION_MAX_LOWPASS_CUTOFF (24000.0f)
-#define AL_DISTORTION_DEFAULT_LOWPASS_CUTOFF (8000.0f)
-
-#define AL_DISTORTION_MIN_EQCENTER (80.0f)
-#define AL_DISTORTION_MAX_EQCENTER (24000.0f)
-#define AL_DISTORTION_DEFAULT_EQCENTER (3600.0f)
-
-#define AL_DISTORTION_MIN_EQBANDWIDTH (80.0f)
-#define AL_DISTORTION_MAX_EQBANDWIDTH (24000.0f)
-#define AL_DISTORTION_DEFAULT_EQBANDWIDTH (3600.0f)
-
-/* Echo effect */
-#define AL_ECHO_MIN_DELAY (0.0f)
-#define AL_ECHO_MAX_DELAY (0.207f)
-#define AL_ECHO_DEFAULT_DELAY (0.1f)
-
-#define AL_ECHO_MIN_LRDELAY (0.0f)
-#define AL_ECHO_MAX_LRDELAY (0.404f)
-#define AL_ECHO_DEFAULT_LRDELAY (0.1f)
-
-#define AL_ECHO_MIN_DAMPING (0.0f)
-#define AL_ECHO_MAX_DAMPING (0.99f)
-#define AL_ECHO_DEFAULT_DAMPING (0.5f)
-
-#define AL_ECHO_MIN_FEEDBACK (0.0f)
-#define AL_ECHO_MAX_FEEDBACK (1.0f)
-#define AL_ECHO_DEFAULT_FEEDBACK (0.5f)
-
-#define AL_ECHO_MIN_SPREAD (-1.0f)
-#define AL_ECHO_MAX_SPREAD (1.0f)
-#define AL_ECHO_DEFAULT_SPREAD (-1.0f)
-
-/* Flanger effect */
-#define AL_FLANGER_WAVEFORM_SINUSOID (0)
-#define AL_FLANGER_WAVEFORM_TRIANGLE (1)
-
-#define AL_FLANGER_MIN_WAVEFORM (0)
-#define AL_FLANGER_MAX_WAVEFORM (1)
-#define AL_FLANGER_DEFAULT_WAVEFORM (1)
-
-#define AL_FLANGER_MIN_PHASE (-180)
-#define AL_FLANGER_MAX_PHASE (180)
-#define AL_FLANGER_DEFAULT_PHASE (0)
-
-#define AL_FLANGER_MIN_RATE (0.0f)
-#define AL_FLANGER_MAX_RATE (10.0f)
-#define AL_FLANGER_DEFAULT_RATE (0.27f)
-
-#define AL_FLANGER_MIN_DEPTH (0.0f)
-#define AL_FLANGER_MAX_DEPTH (1.0f)
-#define AL_FLANGER_DEFAULT_DEPTH (1.0f)
-
-#define AL_FLANGER_MIN_FEEDBACK (-1.0f)
-#define AL_FLANGER_MAX_FEEDBACK (1.0f)
-#define AL_FLANGER_DEFAULT_FEEDBACK (-0.5f)
-
-#define AL_FLANGER_MIN_DELAY (0.0f)
-#define AL_FLANGER_MAX_DELAY (0.004f)
-#define AL_FLANGER_DEFAULT_DELAY (0.002f)
-
-/* Frequency shifter effect */
-#define AL_FREQUENCY_SHIFTER_MIN_FREQUENCY (0.0f)
-#define AL_FREQUENCY_SHIFTER_MAX_FREQUENCY (24000.0f)
-#define AL_FREQUENCY_SHIFTER_DEFAULT_FREQUENCY (0.0f)
-
-#define AL_FREQUENCY_SHIFTER_MIN_LEFT_DIRECTION (0)
-#define AL_FREQUENCY_SHIFTER_MAX_LEFT_DIRECTION (2)
-#define AL_FREQUENCY_SHIFTER_DEFAULT_LEFT_DIRECTION (0)
-
-#define AL_FREQUENCY_SHIFTER_DIRECTION_DOWN (0)
-#define AL_FREQUENCY_SHIFTER_DIRECTION_UP (1)
-#define AL_FREQUENCY_SHIFTER_DIRECTION_OFF (2)
-
-#define AL_FREQUENCY_SHIFTER_MIN_RIGHT_DIRECTION (0)
-#define AL_FREQUENCY_SHIFTER_MAX_RIGHT_DIRECTION (2)
-#define AL_FREQUENCY_SHIFTER_DEFAULT_RIGHT_DIRECTION (0)
-
-/* Vocal morpher effect */
-#define AL_VOCAL_MORPHER_MIN_PHONEMEA (0)
-#define AL_VOCAL_MORPHER_MAX_PHONEMEA (29)
-#define AL_VOCAL_MORPHER_DEFAULT_PHONEMEA (0)
-
-#define AL_VOCAL_MORPHER_MIN_PHONEMEA_COARSE_TUNING (-24)
-#define AL_VOCAL_MORPHER_MAX_PHONEMEA_COARSE_TUNING (24)
-#define AL_VOCAL_MORPHER_DEFAULT_PHONEMEA_COARSE_TUNING (0)
-
-#define AL_VOCAL_MORPHER_MIN_PHONEMEB (0)
-#define AL_VOCAL_MORPHER_MAX_PHONEMEB (29)
-#define AL_VOCAL_MORPHER_DEFAULT_PHONEMEB (10)
-
-#define AL_VOCAL_MORPHER_MIN_PHONEMEB_COARSE_TUNING (-24)
-#define AL_VOCAL_MORPHER_MAX_PHONEMEB_COARSE_TUNING (24)
-#define AL_VOCAL_MORPHER_DEFAULT_PHONEMEB_COARSE_TUNING (0)
-
-#define AL_VOCAL_MORPHER_PHONEME_A (0)
-#define AL_VOCAL_MORPHER_PHONEME_E (1)
-#define AL_VOCAL_MORPHER_PHONEME_I (2)
-#define AL_VOCAL_MORPHER_PHONEME_O (3)
-#define AL_VOCAL_MORPHER_PHONEME_U (4)
-#define AL_VOCAL_MORPHER_PHONEME_AA (5)
-#define AL_VOCAL_MORPHER_PHONEME_AE (6)
-#define AL_VOCAL_MORPHER_PHONEME_AH (7)
-#define AL_VOCAL_MORPHER_PHONEME_AO (8)
-#define AL_VOCAL_MORPHER_PHONEME_EH (9)
-#define AL_VOCAL_MORPHER_PHONEME_ER (10)
-#define AL_VOCAL_MORPHER_PHONEME_IH (11)
-#define AL_VOCAL_MORPHER_PHONEME_IY (12)
-#define AL_VOCAL_MORPHER_PHONEME_UH (13)
-#define AL_VOCAL_MORPHER_PHONEME_UW (14)
-#define AL_VOCAL_MORPHER_PHONEME_B (15)
-#define AL_VOCAL_MORPHER_PHONEME_D (16)
-#define AL_VOCAL_MORPHER_PHONEME_F (17)
-#define AL_VOCAL_MORPHER_PHONEME_G (18)
-#define AL_VOCAL_MORPHER_PHONEME_J (19)
-#define AL_VOCAL_MORPHER_PHONEME_K (20)
-#define AL_VOCAL_MORPHER_PHONEME_L (21)
-#define AL_VOCAL_MORPHER_PHONEME_M (22)
-#define AL_VOCAL_MORPHER_PHONEME_N (23)
-#define AL_VOCAL_MORPHER_PHONEME_P (24)
-#define AL_VOCAL_MORPHER_PHONEME_R (25)
-#define AL_VOCAL_MORPHER_PHONEME_S (26)
-#define AL_VOCAL_MORPHER_PHONEME_T (27)
-#define AL_VOCAL_MORPHER_PHONEME_V (28)
-#define AL_VOCAL_MORPHER_PHONEME_Z (29)
-
-#define AL_VOCAL_MORPHER_WAVEFORM_SINUSOID (0)
-#define AL_VOCAL_MORPHER_WAVEFORM_TRIANGLE (1)
-#define AL_VOCAL_MORPHER_WAVEFORM_SAWTOOTH (2)
-
-#define AL_VOCAL_MORPHER_MIN_WAVEFORM (0)
-#define AL_VOCAL_MORPHER_MAX_WAVEFORM (2)
-#define AL_VOCAL_MORPHER_DEFAULT_WAVEFORM (0)
-
-#define AL_VOCAL_MORPHER_MIN_RATE (0.0f)
-#define AL_VOCAL_MORPHER_MAX_RATE (10.0f)
-#define AL_VOCAL_MORPHER_DEFAULT_RATE (1.41f)
-
-/* Pitch shifter effect */
-#define AL_PITCH_SHIFTER_MIN_COARSE_TUNE (-12)
-#define AL_PITCH_SHIFTER_MAX_COARSE_TUNE (12)
-#define AL_PITCH_SHIFTER_DEFAULT_COARSE_TUNE (12)
-
-#define AL_PITCH_SHIFTER_MIN_FINE_TUNE (-50)
-#define AL_PITCH_SHIFTER_MAX_FINE_TUNE (50)
-#define AL_PITCH_SHIFTER_DEFAULT_FINE_TUNE (0)
-
-/* Ring modulator effect */
-#define AL_RING_MODULATOR_MIN_FREQUENCY (0.0f)
-#define AL_RING_MODULATOR_MAX_FREQUENCY (8000.0f)
-#define AL_RING_MODULATOR_DEFAULT_FREQUENCY (440.0f)
-
-#define AL_RING_MODULATOR_MIN_HIGHPASS_CUTOFF (0.0f)
-#define AL_RING_MODULATOR_MAX_HIGHPASS_CUTOFF (24000.0f)
-#define AL_RING_MODULATOR_DEFAULT_HIGHPASS_CUTOFF (800.0f)
-
-#define AL_RING_MODULATOR_SINUSOID (0)
-#define AL_RING_MODULATOR_SAWTOOTH (1)
-#define AL_RING_MODULATOR_SQUARE (2)
-
-#define AL_RING_MODULATOR_MIN_WAVEFORM (0)
-#define AL_RING_MODULATOR_MAX_WAVEFORM (2)
-#define AL_RING_MODULATOR_DEFAULT_WAVEFORM (0)
-
-/* Autowah effect */
-#define AL_AUTOWAH_MIN_ATTACK_TIME (0.0001f)
-#define AL_AUTOWAH_MAX_ATTACK_TIME (1.0f)
-#define AL_AUTOWAH_DEFAULT_ATTACK_TIME (0.06f)
-
-#define AL_AUTOWAH_MIN_RELEASE_TIME (0.0001f)
-#define AL_AUTOWAH_MAX_RELEASE_TIME (1.0f)
-#define AL_AUTOWAH_DEFAULT_RELEASE_TIME (0.06f)
-
-#define AL_AUTOWAH_MIN_RESONANCE (2.0f)
-#define AL_AUTOWAH_MAX_RESONANCE (1000.0f)
-#define AL_AUTOWAH_DEFAULT_RESONANCE (1000.0f)
-
-#define AL_AUTOWAH_MIN_PEAK_GAIN (0.00003f)
-#define AL_AUTOWAH_MAX_PEAK_GAIN (31621.0f)
-#define AL_AUTOWAH_DEFAULT_PEAK_GAIN (11.22f)
-
-/* Compressor effect */
-#define AL_COMPRESSOR_MIN_ONOFF (0)
-#define AL_COMPRESSOR_MAX_ONOFF (1)
-#define AL_COMPRESSOR_DEFAULT_ONOFF (1)
-
-/* Equalizer effect */
-#define AL_EQUALIZER_MIN_LOW_GAIN (0.126f)
-#define AL_EQUALIZER_MAX_LOW_GAIN (7.943f)
-#define AL_EQUALIZER_DEFAULT_LOW_GAIN (1.0f)
-
-#define AL_EQUALIZER_MIN_LOW_CUTOFF (50.0f)
-#define AL_EQUALIZER_MAX_LOW_CUTOFF (800.0f)
-#define AL_EQUALIZER_DEFAULT_LOW_CUTOFF (200.0f)
-
-#define AL_EQUALIZER_MIN_MID1_GAIN (0.126f)
-#define AL_EQUALIZER_MAX_MID1_GAIN (7.943f)
-#define AL_EQUALIZER_DEFAULT_MID1_GAIN (1.0f)
-
-#define AL_EQUALIZER_MIN_MID1_CENTER (200.0f)
-#define AL_EQUALIZER_MAX_MID1_CENTER (3000.0f)
-#define AL_EQUALIZER_DEFAULT_MID1_CENTER (500.0f)
-
-#define AL_EQUALIZER_MIN_MID1_WIDTH (0.01f)
-#define AL_EQUALIZER_MAX_MID1_WIDTH (1.0f)
-#define AL_EQUALIZER_DEFAULT_MID1_WIDTH (1.0f)
-
-#define AL_EQUALIZER_MIN_MID2_GAIN (0.126f)
-#define AL_EQUALIZER_MAX_MID2_GAIN (7.943f)
-#define AL_EQUALIZER_DEFAULT_MID2_GAIN (1.0f)
-
-#define AL_EQUALIZER_MIN_MID2_CENTER (1000.0f)
-#define AL_EQUALIZER_MAX_MID2_CENTER (8000.0f)
-#define AL_EQUALIZER_DEFAULT_MID2_CENTER (3000.0f)
-
-#define AL_EQUALIZER_MIN_MID2_WIDTH (0.01f)
-#define AL_EQUALIZER_MAX_MID2_WIDTH (1.0f)
-#define AL_EQUALIZER_DEFAULT_MID2_WIDTH (1.0f)
-
-#define AL_EQUALIZER_MIN_HIGH_GAIN (0.126f)
-#define AL_EQUALIZER_MAX_HIGH_GAIN (7.943f)
-#define AL_EQUALIZER_DEFAULT_HIGH_GAIN (1.0f)
-
-#define AL_EQUALIZER_MIN_HIGH_CUTOFF (4000.0f)
-#define AL_EQUALIZER_MAX_HIGH_CUTOFF (16000.0f)
-#define AL_EQUALIZER_DEFAULT_HIGH_CUTOFF (6000.0f)
-
-
-/* Source parameter value ranges and defaults. */
-#define AL_MIN_AIR_ABSORPTION_FACTOR (0.0f)
-#define AL_MAX_AIR_ABSORPTION_FACTOR (10.0f)
-#define AL_DEFAULT_AIR_ABSORPTION_FACTOR (0.0f)
-
-#define AL_MIN_ROOM_ROLLOFF_FACTOR (0.0f)
-#define AL_MAX_ROOM_ROLLOFF_FACTOR (10.0f)
-#define AL_DEFAULT_ROOM_ROLLOFF_FACTOR (0.0f)
-
-#define AL_MIN_CONE_OUTER_GAINHF (0.0f)
-#define AL_MAX_CONE_OUTER_GAINHF (1.0f)
-#define AL_DEFAULT_CONE_OUTER_GAINHF (1.0f)
-
-#define AL_MIN_DIRECT_FILTER_GAINHF_AUTO AL_FALSE
-#define AL_MAX_DIRECT_FILTER_GAINHF_AUTO AL_TRUE
-#define AL_DEFAULT_DIRECT_FILTER_GAINHF_AUTO AL_TRUE
-
-#define AL_MIN_AUXILIARY_SEND_FILTER_GAIN_AUTO AL_FALSE
-#define AL_MAX_AUXILIARY_SEND_FILTER_GAIN_AUTO AL_TRUE
-#define AL_DEFAULT_AUXILIARY_SEND_FILTER_GAIN_AUTO AL_TRUE
-
-#define AL_MIN_AUXILIARY_SEND_FILTER_GAINHF_AUTO AL_FALSE
-#define AL_MAX_AUXILIARY_SEND_FILTER_GAINHF_AUTO AL_TRUE
-#define AL_DEFAULT_AUXILIARY_SEND_FILTER_GAINHF_AUTO AL_TRUE
-
-
-/* Listener parameter value ranges and defaults. */
-#define AL_MIN_METERS_PER_UNIT FLT_MIN
-#define AL_MAX_METERS_PER_UNIT FLT_MAX
-#define AL_DEFAULT_METERS_PER_UNIT (1.0f)
-
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif /* AL_EFX_H */
diff --git a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/AL/oalMacOSX_OALExtensions.h b/internal/c/parts/audio/out/android/OpenAL/OpenAL32/AL/oalMacOSX_OALExtensions.h
deleted file mode 100644
index c3db30546..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/AL/oalMacOSX_OALExtensions.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/**********************************************************************************************************************************
-*
-* OpenAL cross platform audio library
-* Copyright (c) 2004-2006, Apple Computer, Inc. All rights reserved.
-* Copyright (c) 2007-2008, Apple Inc. All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
-* conditions are met:
-*
-* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
-* disclaimer in the documentation and/or other materials provided with the distribution.
-* 3. Neither the name of Apple Inc. ("Apple") nor the names of its contributors may be used to endorse or promote products derived
-* from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS
-* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-**********************************************************************************************************************************/
-
-#ifndef __OAL_MAC_OSX_OAL_EXTENSIONS_H__
-#define __OAL_MAC_OSX_OAL_EXTENSIONS_H__
-
-#include
-
-/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
-
-/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ALC_EXT_MAC_OSX
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
-
-// Retrieve functions via alGetProcAddress() by passing in strings: alcMacOSXMixerOutputRate or alcMacOSXGetMixerOutputRate
-
-// Setting the Mixer Output Rate effectively sets the samnple rate at which the mixer
-typedef ALvoid (*alcMacOSXRenderingQualityProcPtr) (ALint value);
-typedef ALvoid (*alMacOSXRenderChannelCountProcPtr) (ALint value);
-typedef ALvoid (*alcMacOSXMixerMaxiumumBussesProcPtr) (ALint value);
-typedef ALvoid (*alcMacOSXMixerOutputRateProcPtr) (ALdouble value);
-
-typedef ALint (*alcMacOSXGetRenderingQualityProcPtr) ();
-typedef ALint (*alMacOSXGetRenderChannelCountProcPtr) ();
-typedef ALint (*alcMacOSXGetMixerMaxiumumBussesProcPtr) ();
-typedef ALdouble (*alcMacOSXGetMixerOutputRateProcPtr) ();
-
-/* Render Quality. Used with alcMacOSXRenderingQuality() */
-
- #define ALC_MAC_OSX_SPATIAL_RENDERING_QUALITY_HIGH 'rqhi'
- #define ALC_MAC_OSX_SPATIAL_RENDERING_QUALITY_LOW 'rdlo'
-
- // High Quality Spatial Algorithm suitable only for headphone use
- #define ALC_IPHONE_SPATIAL_RENDERING_QUALITY_HEADPHONES 'hdph'
-
-/*
- Render Channels. Used with alMacOSXRenderChannelCount()
- Allows a user to force OpenAL to render to stereo, regardless of the audio hardware being used
-*/
- #define ALC_MAC_OSX_RENDER_CHANNEL_COUNT_STEREO 'rcst'
-
-/* GameKit extension */
-
- #define AL_GAMEKIT 'gksr'
-
-/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- AL_EXT_SOURCE_NOTIFICATIONS
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
-/*
- Source Notifications
-
- Eliminates the need for continuous polling for source state by providing a
- mechanism for the application to receive source state change notifications.
- Upon receiving a notification, the application can retrieve the actual state
- corresponding to the notification ID for which the notification was sent.
- */
-
-#define AL_QUEUE_HAS_LOOPED 0x9000
-
-/*
- Notification Proc: ALSourceNotificationProc
-
- sid - source id
- notificationID - id of state that has changed
- userData - user data provided to alSourceAddNotification()
- */
-
-typedef ALvoid (*alSourceNotificationProc)(ALuint sid, ALuint notificationID, ALvoid* userData);
-
-/*
- API: alSourceAddNotification
-
- sid - source id
- notificationID - id of state for which caller wants to be notified of a change
- notifyProc - notification proc
- userData - ptr to applications user data, will be returned in the notification proc
-
- Returns AL_NO_ERROR if request is successful.
-
- Valid IDs:
- AL_SOURCE_STATE
- AL_BUFFERS_PROCESSED
- AL_QUEUE_HAS_LOOPED - notification sent when a looping source has looped to it's start point
- */
-typedef ALenum (*alSourceAddNotificationProcPtr) (ALuint sid, ALuint notificationID, alSourceNotificationProc notifyProc, ALvoid* userData);
-
-/*
- API: alSourceRemoveStateNotification
-
- sid - source id
- notificationID - id of state for which caller wants to remove an existing notification
- notifyProc - notification proc
- userData - ptr to applications user data, will be returned in the notification proc
- */
-typedef ALvoid (*alSourceRemoveNotificationProcPtr) (ALuint sid, ALuint notificationID, alSourceNotificationProc notifyProc, ALvoid* userData);
-
-/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ALC_EXT_ASA : Apple Spatial Audio Extension
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
-/*
- Used with the ASA API calls: alcASAGetSource(), alcASASetSource(), alcASAGetListener(), alcASASetListener()
-*/
-
-typedef ALenum (*alcASAGetSourceProcPtr) (ALuint property, ALuint source, ALvoid *data, ALuint* dataSize);
-typedef ALenum (*alcASASetSourceProcPtr) (ALuint property, ALuint source, ALvoid *data, ALuint dataSize);
-typedef ALenum (*alcASAGetListenerProcPtr) (ALuint property, ALvoid *data, ALuint* dataSize);
-typedef ALenum (*alcASASetListenerProcPtr) (ALuint property, ALvoid *data, ALuint dataSize);
-
- /* listener properties */
- #define ALC_ASA_REVERB_ON 'rvon' // type ALuint
- #define ALC_ASA_REVERB_GLOBAL_LEVEL 'rvgl' // type ALfloat -40.0 db - 40.0 db
-
- #define ALC_ASA_REVERB_ROOM_TYPE 'rvrt' // type ALint
-
- /* reverb room type presets for the ALC_ASA_REVERB_ROOM_TYPE property */
- #define ALC_ASA_REVERB_ROOM_TYPE_SmallRoom 0
- #define ALC_ASA_REVERB_ROOM_TYPE_MediumRoom 1
- #define ALC_ASA_REVERB_ROOM_TYPE_LargeRoom 2
- #define ALC_ASA_REVERB_ROOM_TYPE_MediumHall 3
- #define ALC_ASA_REVERB_ROOM_TYPE_LargeHall 4
- #define ALC_ASA_REVERB_ROOM_TYPE_Plate 5
- #define ALC_ASA_REVERB_ROOM_TYPE_MediumChamber 6
- #define ALC_ASA_REVERB_ROOM_TYPE_LargeChamber 7
- #define ALC_ASA_REVERB_ROOM_TYPE_Cathedral 8
- #define ALC_ASA_REVERB_ROOM_TYPE_LargeRoom2 9
- #define ALC_ASA_REVERB_ROOM_TYPE_MediumHall2 10
- #define ALC_ASA_REVERB_ROOM_TYPE_MediumHall3 11
- #define ALC_ASA_REVERB_ROOM_TYPE_LargeHall2 12
-
- #define ALC_ASA_REVERB_EQ_GAIN 'rveg' // type ALfloat
- #define ALC_ASA_REVERB_EQ_BANDWITH 'rveb' // type ALfloat
- #define ALC_ASA_REVERB_EQ_FREQ 'rvef' // type ALfloat
-
- /* source properties */
- #define ALC_ASA_REVERB_SEND_LEVEL 'rvsl' // type ALfloat 0.0 (dry) - 1.0 (wet) (0-100% dry/wet mix, 0.0 default)
- #define ALC_ASA_OCCLUSION 'occl' // type ALfloat -100.0 db (most occlusion) - 0.0 db (no occlusion, 0.0 default)
- #define ALC_ASA_OBSTRUCTION 'obst' // type ALfloat -100.0 db (most obstruction) - 0.0 db (no obstruction, 0.0 default)
-
-#endif // __OAL_MAC_OSX_OAL_EXTENSIONS_H__
diff --git a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/Include/alAuxEffectSlot.h b/internal/c/parts/audio/out/android/OpenAL/OpenAL32/Include/alAuxEffectSlot.h
deleted file mode 100644
index 1c592ac8e..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/Include/alAuxEffectSlot.h
+++ /dev/null
@@ -1,63 +0,0 @@
-#ifndef _AL_AUXEFFECTSLOT_H_
-#define _AL_AUXEFFECTSLOT_H_
-
-#include "AL/al.h"
-#include "alEffect.h"
-#include "alFilter.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct ALeffectState ALeffectState;
-
-typedef struct ALeffectslot
-{
- ALeffect effect;
-
- ALfp Gain;
- ALboolean AuxSendAuto;
-
- ALeffectState *EffectState;
-
- ALfp WetBuffer[BUFFERSIZE];
-
- ALfp ClickRemoval[1];
- ALfp PendingClicks[1];
-
- ALuint refcount;
-
- // Index to itself
- ALuint effectslot;
-
- struct ALeffectslot *next;
-} ALeffectslot;
-
-
-ALvoid ReleaseALAuxiliaryEffectSlots(ALCcontext *Context);
-
-
-struct ALeffectState {
- ALvoid (*Destroy)(ALeffectState *State);
- ALboolean (*DeviceUpdate)(ALeffectState *State, ALCdevice *Device);
- ALvoid (*Update)(ALeffectState *State, ALCcontext *Context, const ALeffect *Effect);
- ALvoid (*Process)(ALeffectState *State, const ALeffectslot *Slot, ALuint SamplesToDo, const ALfp *SamplesIn, ALfp (*SamplesOut)[MAXCHANNELS]);
-};
-
-ALeffectState *NoneCreate(void);
-ALeffectState *EAXVerbCreate(void);
-ALeffectState *VerbCreate(void);
-ALeffectState *EchoCreate(void);
-ALeffectState *ModulatorCreate(void);
-
-#define ALEffect_Destroy(a) ((a)->Destroy((a)))
-#define ALEffect_DeviceUpdate(a,b) ((a)->DeviceUpdate((a),(b)))
-#define ALEffect_Update(a,b,c) ((a)->Update((a),(b),(c)))
-#define ALEffect_Process(a,b,c,d,e) ((a)->Process((a),(b),(c),(d),(e)))
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/Include/alBuffer.h b/internal/c/parts/audio/out/android/OpenAL/OpenAL32/Include/alBuffer.h
deleted file mode 100644
index e22d839d5..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/Include/alBuffer.h
+++ /dev/null
@@ -1,98 +0,0 @@
-#ifndef _AL_BUFFER_H_
-#define _AL_BUFFER_H_
-
-#include "AL/al.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Input formats (some are currently theoretical) */
-enum UserFmtType {
- UserFmtByte, /* AL_BYTE */
- UserFmtUByte, /* AL_UNSIGNED_BYTE */
- UserFmtShort, /* AL_SHORT */
- UserFmtUShort, /* AL_UNSIGNED_SHORT */
- UserFmtInt, /* AL_INT */
- UserFmtUInt, /* AL_UNSIGNED_INT */
- UserFmtFloat, /* AL_FLOAT */
- UserFmtDouble, /* AL_DOUBLE */
- UserFmtMulaw, /* AL_MULAW */
- UserFmtIMA4, /* AL_IMA4 */
-};
-enum UserFmtChannels {
- UserFmtMono, /* AL_MONO */
- UserFmtStereo, /* AL_STEREO */
- UserFmtRear, /* AL_REAR */
- UserFmtQuad, /* AL_QUAD */
- UserFmtX51, /* AL_5POINT1 (WFX order) */
- UserFmtX61, /* AL_6POINT1 (WFX order) */
- UserFmtX71, /* AL_7POINT1 (WFX order) */
-};
-
-ALboolean DecomposeUserFormat(ALenum format, enum UserFmtChannels *chans,
- enum UserFmtType *type);
-ALuint BytesFromUserFmt(enum UserFmtType type);
-ALuint ChannelsFromUserFmt(enum UserFmtChannels chans);
-static __inline ALuint FrameSizeFromUserFmt(enum UserFmtChannels chans,
- enum UserFmtType type)
-{
- return ChannelsFromUserFmt(chans) * BytesFromUserFmt(type);
-}
-
-
-/* Storable formats */
-enum FmtType {
- FmtUByte = UserFmtUByte,
- FmtShort = UserFmtShort,
- FmtFloat = UserFmtFloat,
-};
-enum FmtChannels {
- FmtMono = UserFmtMono,
- FmtStereo = UserFmtStereo,
- FmtRear = UserFmtRear,
- FmtQuad = UserFmtQuad,
- FmtX51 = UserFmtX51,
- FmtX61 = UserFmtX61,
- FmtX71 = UserFmtX71,
-};
-
-ALboolean DecomposeFormat(ALenum format, enum FmtChannels *chans, enum FmtType *type);
-ALuint BytesFromFmt(enum FmtType type);
-ALuint ChannelsFromFmt(enum FmtChannels chans);
-static __inline ALuint FrameSizeFromFmt(enum FmtChannels chans, enum FmtType type)
-{
- return ChannelsFromFmt(chans) * BytesFromFmt(type);
-}
-
-
-typedef struct ALbuffer
-{
- ALvoid *data;
- ALsizei size;
-
- ALsizei Frequency;
- enum FmtChannels FmtChannels;
- enum FmtType FmtType;
-
- enum UserFmtChannels OriginalChannels;
- enum UserFmtType OriginalType;
- ALsizei OriginalSize;
- ALsizei OriginalAlign;
-
- ALsizei LoopStart;
- ALsizei LoopEnd;
-
- ALuint refcount; // Number of sources using this buffer (deletion can only occur when this is 0)
-
- // Index to itself
- ALuint buffer;
-} ALbuffer;
-
-ALvoid ReleaseALBuffers(ALCdevice *device);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/Include/alDatabuffer.h b/internal/c/parts/audio/out/android/OpenAL/OpenAL32/Include/alDatabuffer.h
deleted file mode 100644
index 221855283..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/Include/alDatabuffer.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef _AL_DATABUFFER_H_
-#define _AL_DATABUFFER_H_
-
-#include "AL/al.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define UNMAPPED 0
-#define MAPPED 1
-
-typedef struct ALdatabuffer
-{
- ALubyte *data;
- ALintptrEXT size;
-
- ALenum state;
- ALenum usage;
-
- /* Index to self */
- ALuint databuffer;
-
- struct ALdatabuffer *next;
-} ALdatabuffer;
-
-ALvoid ReleaseALDatabuffers(ALCdevice *device);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/Include/alEffect.h b/internal/c/parts/audio/out/android/OpenAL/OpenAL32/Include/alEffect.h
deleted file mode 100644
index 041aa3edc..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/Include/alEffect.h
+++ /dev/null
@@ -1,83 +0,0 @@
-// NOTE: The effect structure is getting too large, it may be a good idea to
-// start using a union or another form of unified storage.
-#ifndef _AL_EFFECT_H_
-#define _AL_EFFECT_H_
-
-#include "AL/al.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-enum {
- EAXREVERB = 0,
- REVERB,
- ECHO,
- MODULATOR,
-
- MAX_EFFECTS
-};
-extern ALboolean DisabledEffects[MAX_EFFECTS];
-
-typedef struct ALeffect
-{
- // Effect type (AL_EFFECT_NULL, ...)
- ALenum type;
-
- struct {
- // Shared Reverb Properties
- ALfp Density;
- ALfp Diffusion;
- ALfp Gain;
- ALfp GainHF;
- ALfp DecayTime;
- ALfp DecayHFRatio;
- ALfp ReflectionsGain;
- ALfp ReflectionsDelay;
- ALfp LateReverbGain;
- ALfp LateReverbDelay;
- ALfp AirAbsorptionGainHF;
- ALfp RoomRolloffFactor;
- ALboolean DecayHFLimit;
-
- // Additional EAX Reverb Properties
- ALfp GainLF;
- ALfp DecayLFRatio;
- ALfp ReflectionsPan[3];
- ALfp LateReverbPan[3];
- ALfp EchoTime;
- ALfp EchoDepth;
- ALfp ModulationTime;
- ALfp ModulationDepth;
- ALfp HFReference;
- ALfp LFReference;
- } Reverb;
-
- struct {
- ALfp Delay;
- ALfp LRDelay;
-
- ALfp Damping;
- ALfp Feedback;
-
- ALfp Spread;
- } Echo;
-
- struct {
- ALfp Frequency;
- ALfp HighPassCutoff;
- ALint Waveform;
- } Modulator;
-
- // Index to itself
- ALuint effect;
-} ALeffect;
-
-
-ALvoid ReleaseALEffects(ALCdevice *device);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/Include/alError.h b/internal/c/parts/audio/out/android/OpenAL/OpenAL32/Include/alError.h
deleted file mode 100644
index 7976e50f9..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/Include/alError.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef _AL_ERROR_H_
-#define _AL_ERROR_H_
-
-#include "AL/al.h"
-#include "AL/alc.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-ALvoid alSetError(ALCcontext *Context, ALenum errorCode);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/Include/alFilter.h b/internal/c/parts/audio/out/android/OpenAL/OpenAL32/Include/alFilter.h
deleted file mode 100644
index 3b17b1f1e..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/Include/alFilter.h
+++ /dev/null
@@ -1,139 +0,0 @@
-#ifndef _AL_FILTER_H_
-#define _AL_FILTER_H_
-
-#include "AL/al.h"
-#include "alu.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct {
- ALfp coeff;
-#ifndef _MSC_VER
- ALfp history[0];
-#else
- ALfp history[1];
-#endif
-} FILTER;
-
-static __inline ALfp lpFilter4P(FILTER *iir, ALuint offset, ALfp input)
-{
- ALfp *history = &iir->history[offset];
- ALfp a = iir->coeff;
- ALfp output = input;
-
- output = output + ALfpMult((history[0]-output),a);
- history[0] = output;
- output = output + ALfpMult((history[1]-output),a);
- history[1] = output;
- output = output + ALfpMult((history[2]-output),a);
- history[2] = output;
- output = output + ALfpMult((history[3]-output),a);
- history[3] = output;
-
- return output;
-}
-
-static __inline ALfp lpFilter2P(FILTER *iir, ALuint offset, ALfp input)
-{
- ALfp *history = &iir->history[offset];
- ALfp a = iir->coeff;
- ALfp output = input;
-
- output = output + ALfpMult((history[0]-output),a);
- history[0] = output;
- output = output + ALfpMult((history[1]-output),a);
- history[1] = output;
-
- return output;
-}
-
-static __inline ALfp lpFilter1P(FILTER *iir, ALuint offset, ALfp input)
-{
- ALfp *history = &iir->history[offset];
- ALfp a = iir->coeff;
- ALfp output = input;
-
- output = output + ALfpMult((history[0]-output),a);
- history[0] = output;
-
- return output;
-}
-
-static __inline ALfp lpFilter4PC(const FILTER *iir, ALuint offset, ALfp input)
-{
- const ALfp *history = &iir->history[offset];
- ALfp a = iir->coeff;
- ALfp output = input;
-
- output = output + ALfpMult((history[0]-output),a);
- output = output + ALfpMult((history[1]-output),a);
- output = output + ALfpMult((history[2]-output),a);
- output = output + ALfpMult((history[3]-output),a);
-
- return output;
-}
-
-static __inline ALfp lpFilter2PC(const FILTER *iir, ALuint offset, ALfp input)
-{
- const ALfp *history = &iir->history[offset];
- ALfp a = iir->coeff;
- ALfp output = input;
-
- output = output + ALfpMult((history[0]-output),a);
- output = output + ALfpMult((history[1]-output),a);
-
- return output;
-}
-
-static __inline ALfp lpFilter1PC(FILTER *iir, ALuint offset, ALfp input)
-{
- const ALfp *history = &iir->history[offset];
- ALfp a = iir->coeff;
- ALfp output = input;
-
- output = output + ALfpMult((history[0]-output),a);
-
- return output;
-}
-
-/* Calculates the low-pass filter coefficient given the pre-scaled gain and
- * cos(w) value. Note that g should be pre-scaled (sqr(gain) for one-pole,
- * sqrt(gain) for four-pole, etc) */
-static __inline ALfp lpCoeffCalc(ALfp g, ALfp cw)
-{
- ALfp a = int2ALfp(0);
-
- /* Be careful with gains < 0.01, as that causes the coefficient
- * head towards 1, which will flatten the signal */
- g = __max(g, float2ALfp(0.01f));
- if(g < float2ALfp(0.9999f)) /* 1-epsilon */ {
- ALfp tmp; tmp = ALfpMult(ALfpMult(int2ALfp(2),g),(int2ALfp(1)-cw)) - ALfpMult(ALfpMult(g,g),(int2ALfp(1) - ALfpMult(cw,cw)));
- a = ALfpDiv((int2ALfp(1) - ALfpMult(g,cw) - aluSqrt(tmp)), (int2ALfp(1) - g));
- }
-
- return a;
-}
-
-
-typedef struct ALfilter
-{
- // Filter type (AL_FILTER_NULL, ...)
- ALenum type;
-
- ALfp Gain;
- ALfp GainHF;
-
- // Index to itself
- ALuint filter;
-} ALfilter;
-
-
-ALvoid ReleaseALFilters(ALCdevice *device);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/Include/alListener.h b/internal/c/parts/audio/out/android/OpenAL/OpenAL32/Include/alListener.h
deleted file mode 100644
index a2fc3ba0f..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/Include/alListener.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef _AL_LISTENER_H_
-#define _AL_LISTENER_H_
-
-#include "AL/al.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct ALlistener_struct
-{
- ALfp Position[3];
- ALfp Velocity[3];
- ALfp Forward[3];
- ALfp Up[3];
- ALfp Gain;
- ALfp MetersPerUnit;
-} ALlistener;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/Include/alMain.h b/internal/c/parts/audio/out/android/OpenAL/OpenAL32/Include/alMain.h
deleted file mode 100644
index 61448b205..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/Include/alMain.h
+++ /dev/null
@@ -1,503 +0,0 @@
-#ifndef AL_MAIN_H
-#define AL_MAIN_H
-
-#include
-#include
-#include
-
-#ifdef HAVE_FENV_H
-#include
-#endif
-
-#include "AL/al.h"
-#include "AL/alc.h"
-#include "AL/alext.h"
-
-#ifndef AL_EXT_sample_buffer_object
-#define AL_EXT_sample_buffer_object 1
-typedef ptrdiff_t ALintptrEXT;
-typedef ptrdiff_t ALsizeiptrEXT;
-#define AL_SAMPLE_SOURCE_EXT 0x1040
-#define AL_SAMPLE_SINK_EXT 0x1041
-#define AL_READ_ONLY_EXT 0x1042
-#define AL_WRITE_ONLY_EXT 0x1043
-#define AL_READ_WRITE_EXT 0x1044
-#define AL_STREAM_WRITE_EXT 0x1045
-#define AL_STREAM_READ_EXT 0x1046
-#define AL_STREAM_COPY_EXT 0x1047
-#define AL_STATIC_WRITE_EXT 0x1048
-#define AL_STATIC_READ_EXT 0x1049
-#define AL_STATIC_COPY_EXT 0x104A
-#define AL_DYNAMIC_WRITE_EXT 0x104B
-#define AL_DYNAMIC_READ_EXT 0x104C
-#define AL_DYNAMIC_COPY_EXT 0x104D
-typedef ALvoid (AL_APIENTRY*PFNALGENDATABUFFERSEXTPROC)(ALsizei n,ALuint *puiBuffers);
-typedef ALvoid (AL_APIENTRY*PFNALDELETEDATABUFFERSEXTPROC)(ALsizei n, const ALuint *puiBuffers);
-typedef ALboolean (AL_APIENTRY*PFNALISDATABUFFEREXTPROC)(ALuint uiBuffer);
-typedef ALvoid (AL_APIENTRY*PFNALDATABUFFERDATAEXTPROC)(ALuint buffer,const ALvoid *data,ALsizeiptrEXT size,ALenum usage);
-typedef ALvoid (AL_APIENTRY*PFNALDATABUFFERSUBDATAEXTPROC)(ALuint buffer, ALintptrEXT start, ALsizeiptrEXT length, const ALvoid *);
-typedef ALvoid (AL_APIENTRY*PFNALGETDATABUFFERSUBDATAEXTPROC)(ALuint buffer, ALintptrEXT start, ALsizeiptrEXT length, ALvoid *);
-typedef ALvoid (AL_APIENTRY*PFNALDATABUFFERFEXTPROC)(ALuint buffer, ALenum eParam, ALfloat flValue);
-typedef ALvoid (AL_APIENTRY*PFNALDATABUFFERFVEXTPROC)(ALuint buffer, ALenum eParam, const ALfloat* flValues);
-typedef ALvoid (AL_APIENTRY*PFNALDATABUFFERIEXTPROC)(ALuint buffer, ALenum eParam, ALint lValue);
-typedef ALvoid (AL_APIENTRY*PFNALDATABUFFERIVEXTPROC)(ALuint buffer, ALenum eParam, const ALint* plValues);
-typedef ALvoid (AL_APIENTRY*PFNALGETDATABUFFERFEXTPROC)(ALuint buffer, ALenum eParam, ALfloat *pflValue);
-typedef ALvoid (AL_APIENTRY*PFNALGETDATABUFFERFVEXTPROC)(ALuint buffer, ALenum eParam, ALfloat* pflValues);
-typedef ALvoid (AL_APIENTRY*PFNALGETDATABUFFERIEXTPROC)(ALuint buffer, ALenum eParam, ALint *plValue);
-typedef ALvoid (AL_APIENTRY*PFNALGETDATABUFFERIVEXTPROC)(ALuint buffer, ALenum eParam, ALint* plValues);
-typedef ALvoid (AL_APIENTRY*PFNALSELECTDATABUFFEREXTPROC)(ALenum target, ALuint uiBuffer);
-typedef ALvoid* (AL_APIENTRY*PFNALMAPDATABUFFEREXTPROC)(ALuint uiBuffer, ALintptrEXT start, ALsizeiptrEXT length, ALenum access);
-typedef ALvoid (AL_APIENTRY*PFNALUNMAPDATABUFFEREXTPROC)(ALuint uiBuffer);
-#ifdef AL_ALEXT_PROTOTYPES
-AL_API ALvoid AL_APIENTRY alGenDatabuffersEXT(ALsizei n,ALuint *puiBuffers);
-AL_API ALvoid AL_APIENTRY alDeleteDatabuffersEXT(ALsizei n, const ALuint *puiBuffers);
-AL_API ALboolean AL_APIENTRY alIsDatabufferEXT(ALuint uiBuffer);
-AL_API ALvoid AL_APIENTRY alDatabufferDataEXT(ALuint buffer,const ALvoid *data,ALsizeiptrEXT size,ALenum usage);
-AL_API ALvoid AL_APIENTRY alDatabufferSubDataEXT(ALuint buffer, ALintptrEXT start, ALsizeiptrEXT length, const ALvoid *data);
-AL_API ALvoid AL_APIENTRY alGetDatabufferSubDataEXT(ALuint buffer, ALintptrEXT start, ALsizeiptrEXT length, ALvoid *data);
-AL_API ALvoid AL_APIENTRY alDatabufferfEXT(ALuint buffer, ALenum eParam, ALfloat flValue);
-AL_API ALvoid AL_APIENTRY alDatabufferfvEXT(ALuint buffer, ALenum eParam, const ALfloat* flValues);
-AL_API ALvoid AL_APIENTRY alDatabufferiEXT(ALuint buffer, ALenum eParam, ALint lValue);
-AL_API ALvoid AL_APIENTRY alDatabufferivEXT(ALuint buffer, ALenum eParam, const ALint* plValues);
-AL_API ALvoid AL_APIENTRY alGetDatabufferfEXT(ALuint buffer, ALenum eParam, ALfloat *pflValue);
-AL_API ALvoid AL_APIENTRY alGetDatabufferfvEXT(ALuint buffer, ALenum eParam, ALfloat* pflValues);
-AL_API ALvoid AL_APIENTRY alGetDatabufferiEXT(ALuint buffer, ALenum eParam, ALint *plValue);
-AL_API ALvoid AL_APIENTRY alGetDatabufferivEXT(ALuint buffer, ALenum eParam, ALint* plValues);
-AL_API ALvoid AL_APIENTRY alSelectDatabufferEXT(ALenum target, ALuint uiBuffer);
-AL_API ALvoid* AL_APIENTRY alMapDatabufferEXT(ALuint uiBuffer, ALintptrEXT start, ALsizeiptrEXT length, ALenum access);
-AL_API ALvoid AL_APIENTRY alUnmapDatabufferEXT(ALuint uiBuffer);
-#endif
-#endif
-
-
-#if defined(HAVE_STDINT_H)
-#include
-typedef int64_t ALint64;
-typedef uint64_t ALuint64;
-#elif defined(HAVE___INT64)
-typedef __int64 ALint64;
-typedef unsigned __int64 ALuint64;
-#elif (SIZEOF_LONG == 8)
-typedef long ALint64;
-typedef unsigned long ALuint64;
-#elif (SIZEOF_LONG_LONG == 8)
-typedef long long ALint64;
-typedef unsigned long long ALuint64;
-#endif
-
-#ifdef HAVE_GCC_FORMAT
-#define PRINTF_STYLE(x, y) __attribute__((format(__printf__, (x), (y))))
-#else
-#define PRINTF_STYLE(x, y)
-#endif
-
-#ifdef _WIN32
-
-#ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x0500
-#endif
-#include
-
-typedef DWORD tls_type;
-#define tls_create(x) (*(x) = TlsAlloc())
-#define tls_delete(x) TlsFree((x))
-#define tls_get(x) TlsGetValue((x))
-#define tls_set(x, a) TlsSetValue((x), (a))
-
-#else
-
-#include
-#include
-#include
-#ifdef HAVE_PTHREAD_NP_H
-#include
-#endif
-#include
-#include
-#include
-
-#define IsBadWritePtr(a,b) ((a) == NULL && (b) != 0)
-
-typedef pthread_key_t tls_type;
-#define tls_create(x) pthread_key_create((x), NULL)
-#define tls_delete(x) pthread_key_delete((x))
-#define tls_get(x) pthread_getspecific((x))
-#define tls_set(x, a) pthread_setspecific((x), (a))
-
-typedef pthread_mutex_t CRITICAL_SECTION;
-static __inline void EnterCriticalSection(CRITICAL_SECTION *cs)
-{
- int ret;
- ret = pthread_mutex_lock(cs);
- assert(ret == 0);
-}
-static __inline void LeaveCriticalSection(CRITICAL_SECTION *cs)
-{
- int ret;
- ret = pthread_mutex_unlock(cs);
- assert(ret == 0);
-}
-static __inline void InitializeCriticalSection(CRITICAL_SECTION *cs)
-{
- pthread_mutexattr_t attrib;
- int ret;
-
- ret = pthread_mutexattr_init(&attrib);
- assert(ret == 0);
-
- ret = pthread_mutexattr_settype(&attrib, PTHREAD_MUTEX_RECURSIVE);
-#ifdef HAVE_PTHREAD_NP_H
- if(ret != 0)
- ret = pthread_mutexattr_setkind_np(&attrib, PTHREAD_MUTEX_RECURSIVE);
-#endif
- assert(ret == 0);
- ret = pthread_mutex_init(cs, &attrib);
- assert(ret == 0);
-
- pthread_mutexattr_destroy(&attrib);
-}
-
-static __inline void DeleteCriticalSection(CRITICAL_SECTION *cs)
-{
- int ret;
- ret = pthread_mutex_destroy(cs);
- assert(ret == 0);
-}
-
-/* NOTE: This wrapper isn't quite accurate as it returns an ALuint, as opposed
- * to the expected DWORD. Both are defined as unsigned 32-bit types, however.
- * Additionally, Win32 is supposed to measure the time since Windows started,
- * as opposed to the actual time. */
-static __inline ALuint timeGetTime(void)
-{
-#if _POSIX_TIMERS > 0
- struct timespec ts;
- int ret = -1;
-
-#if defined(_POSIX_MONOTONIC_CLOCK) && (_POSIX_MONOTONIC_CLOCK >= 0)
-#if _POSIX_MONOTONIC_CLOCK == 0
- static int hasmono = 0;
- if(hasmono > 0 || (hasmono == 0 &&
- (hasmono=sysconf(_SC_MONOTONIC_CLOCK)) > 0))
-#endif
- ret = clock_gettime(CLOCK_MONOTONIC, &ts);
-#endif
- if(ret != 0)
- ret = clock_gettime(CLOCK_REALTIME, &ts);
- assert(ret == 0);
-
- return ts.tv_nsec/1000000 + ts.tv_sec*1000;
-#else
- struct timeval tv;
- int ret;
-
- ret = gettimeofday(&tv, NULL);
- assert(ret == 0);
-
- return tv.tv_usec/1000 + tv.tv_sec*1000;
-#endif
-}
-
-static __inline void Sleep(ALuint t)
-{
- struct timespec tv, rem;
- tv.tv_nsec = (t*1000000)%1000000000;
- tv.tv_sec = t/1000;
-
- while(nanosleep(&tv, &rem) == -1 && errno == EINTR)
- tv = rem;
-}
-#define min(x,y) (((x)<(y))?(x):(y))
-#define max(x,y) (((x)>(y))?(x):(y))
-#endif
-
-#include "alListener.h"
-#include "alu.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-#define SWMIXER_OUTPUT_RATE 44100
-
-#define SPEEDOFSOUNDMETRESPERSEC (343.3f)
-#define AIRABSORBGAINDBHF (-0.05f)
-
-#define LOWPASSFREQCUTOFF (5000)
-
-#define DEFAULT_HEAD_DAMPEN (0.25f)
-
-
-// Find the next power-of-2 for non-power-of-2 numbers.
-static __inline ALuint NextPowerOf2(ALuint value)
-{
- ALuint powerOf2 = 1;
-
- if(value)
- {
- value--;
- while(value)
- {
- value >>= 1;
- powerOf2 <<= 1;
- }
- }
- return powerOf2;
-}
-
-
-typedef struct {
- ALCboolean (*OpenPlayback)(ALCdevice*, const ALCchar*);
- void (*ClosePlayback)(ALCdevice*);
- ALCboolean (*ResetPlayback)(ALCdevice*);
- void (*StopPlayback)(ALCdevice*);
-
- ALCboolean (*OpenCapture)(ALCdevice*, const ALCchar*);
- void (*CloseCapture)(ALCdevice*);
- void (*StartCapture)(ALCdevice*);
- void (*StopCapture)(ALCdevice*);
- void (*CaptureSamples)(ALCdevice*, void*, ALCuint);
- ALCuint (*AvailableSamples)(ALCdevice*);
-} BackendFuncs;
-
-enum {
- DEVICE_PROBE,
- ALL_DEVICE_PROBE,
- CAPTURE_DEVICE_PROBE
-};
-
-void alc_alsa_init(BackendFuncs *func_list);
-void alc_alsa_deinit(void);
-void alc_alsa_probe(int type);
-void alc_oss_init(BackendFuncs *func_list);
-void alc_oss_deinit(void);
-void alc_oss_probe(int type);
-void alc_solaris_init(BackendFuncs *func_list);
-void alc_solaris_deinit(void);
-void alc_solaris_probe(int type);
-void alcDSoundInit(BackendFuncs *func_list);
-void alcDSoundDeinit(void);
-void alcDSoundProbe(int type);
-void alcWinMMInit(BackendFuncs *FuncList);
-void alcWinMMDeinit(void);
-void alcWinMMProbe(int type);
-void alc_pa_init(BackendFuncs *func_list);
-void alc_pa_deinit(void);
-void alc_pa_probe(int type);
-void alc_wave_init(BackendFuncs *func_list);
-void alc_wave_deinit(void);
-void alc_wave_probe(int type);
-void alc_pulse_init(BackendFuncs *func_list);
-void alc_pulse_deinit(void);
-void alc_pulse_probe(int type);
-void alc_audiotrack_init(BackendFuncs *func_list);
-void alc_audiotrack_deinit(void);
-void alc_audiotrack_probe(int type);
-void alc_opensles_init(BackendFuncs *func_list);
-void alc_opensles_deinit(void);
-void alc_opensles_probe(int type);
-void alc_null_init(BackendFuncs *func_list);
-void alc_null_deinit(void);
-void alc_null_probe(int type);
-
-
-typedef struct UIntMap {
- struct {
- ALuint key;
- ALvoid *value;
- } *array;
- ALsizei size;
- ALsizei maxsize;
-} UIntMap;
-
-void InitUIntMap(UIntMap *map);
-void ResetUIntMap(UIntMap *map);
-ALenum InsertUIntMapEntry(UIntMap *map, ALuint key, ALvoid *value);
-void RemoveUIntMapKey(UIntMap *map, ALuint key);
-ALvoid *LookupUIntMapKey(UIntMap *map, ALuint key);
-
-/* Device formats */
-enum DevFmtType {
- DevFmtByte, /* AL_BYTE */
- DevFmtUByte, /* AL_UNSIGNED_BYTE */
- DevFmtShort, /* AL_SHORT */
- DevFmtUShort, /* AL_UNSIGNED_SHORT */
- DevFmtFloat, /* AL_FLOAT */
-};
-enum DevFmtChannels {
- DevFmtMono, /* AL_MONO */
- DevFmtStereo, /* AL_STEREO */
- DevFmtQuad, /* AL_QUAD */
- DevFmtX51, /* AL_5POINT1 */
- DevFmtX61, /* AL_6POINT1 */
- DevFmtX71, /* AL_7POINT1 */
-};
-
-ALuint BytesFromDevFmt(enum DevFmtType type);
-ALuint ChannelsFromDevFmt(enum DevFmtChannels chans);
-static __inline ALuint FrameSizeFromDevFmt(enum DevFmtChannels chans,
- enum DevFmtType type)
-{
- return ChannelsFromDevFmt(chans) * BytesFromDevFmt(type);
-}
-
-
-struct ALCdevice_struct
-{
- ALCboolean Connected;
- ALboolean IsCaptureDevice;
-
- ALuint Frequency;
- ALuint UpdateSize;
- ALuint NumUpdates;
- enum DevFmtChannels FmtChans;
- enum DevFmtType FmtType;
-
- ALCchar *szDeviceName;
-
- ALCenum LastError;
-
- // Maximum number of sources that can be created
- ALuint MaxNoOfSources;
- // Maximum number of slots that can be created
- ALuint AuxiliaryEffectSlotMax;
-
- ALCuint NumMonoSources;
- ALCuint NumStereoSources;
- ALuint NumAuxSends;
-
- // Map of Buffers for this device
- UIntMap BufferMap;
-
- // Map of Effects for this device
- UIntMap EffectMap;
-
- // Map of Filters for this device
- UIntMap FilterMap;
-
- // Map of Databuffers for this device
- UIntMap DatabufferMap;
-
- // Stereo-to-binaural filter
- struct bs2b *Bs2b;
- ALCint Bs2bLevel;
-
- // Simulated dampening from head occlusion
- ALfp HeadDampen;
-
- // Duplicate stereo sources on the side/rear channels
- ALboolean DuplicateStereo;
-
- // Dry path buffer mix
- ALfp DryBuffer[BUFFERSIZE][MAXCHANNELS];
-
- ALuint DevChannels[MAXCHANNELS];
-
- ALfp ChannelMatrix[MAXCHANNELS][MAXCHANNELS];
-
- Channel Speaker2Chan[MAXCHANNELS];
- ALfp PanningLUT[MAXCHANNELS * LUT_NUM];
- ALuint NumChan;
-
- ALfp ClickRemoval[MAXCHANNELS];
- ALfp PendingClicks[MAXCHANNELS];
-
- // Contexts created on this device
- ALCcontext **Contexts;
- ALuint NumContexts;
-
- BackendFuncs *Funcs;
- void *ExtraData; // For the backend's use
-
- ALCdevice *next;
-};
-
-#define ALCdevice_OpenPlayback(a,b) ((a)->Funcs->OpenPlayback((a), (b)))
-#define ALCdevice_ClosePlayback(a) ((a)->Funcs->ClosePlayback((a)))
-#define ALCdevice_ResetPlayback(a) ((a)->Funcs->ResetPlayback((a)))
-#define ALCdevice_StopPlayback(a) ((a)->Funcs->StopPlayback((a)))
-#define ALCdevice_OpenCapture(a,b) ((a)->Funcs->OpenCapture((a), (b)))
-#define ALCdevice_CloseCapture(a) ((a)->Funcs->CloseCapture((a)))
-#define ALCdevice_StartCapture(a) ((a)->Funcs->StartCapture((a)))
-#define ALCdevice_StopCapture(a) ((a)->Funcs->StopCapture((a)))
-#define ALCdevice_CaptureSamples(a,b,c) ((a)->Funcs->CaptureSamples((a), (b), (c)))
-#define ALCdevice_AvailableSamples(a) ((a)->Funcs->AvailableSamples((a)))
-
-struct ALCcontext_struct
-{
- ALlistener Listener;
-
- UIntMap SourceMap;
- UIntMap EffectSlotMap;
-
- struct ALdatabuffer *SampleSource;
- struct ALdatabuffer *SampleSink;
-
- ALenum LastError;
-
- ALboolean Suspended;
-
- ALenum DistanceModel;
- ALboolean SourceDistanceModel;
-
- ALfp DopplerFactor;
- ALfp DopplerVelocity;
- ALfp flSpeedOfSound;
-
- struct ALsource **ActiveSources;
- ALsizei ActiveSourceCount;
- ALsizei MaxActiveSources;
-
- // Apportable Extension
- ALsizei PrioritySlots;
-
- ALCdevice *Device;
- const ALCchar *ExtensionList;
-
- ALCcontext *next;
-};
-
-void AppendDeviceList(const ALCchar *name);
-void AppendAllDeviceList(const ALCchar *name);
-void AppendCaptureDeviceList(const ALCchar *name);
-
-ALCvoid alcSetError(ALCdevice *device, ALenum errorCode);
-
-ALCvoid SuspendContext(ALCcontext *context);
-ALCvoid ProcessContext(ALCcontext *context);
-
-ALvoid *StartThread(ALuint (*func)(ALvoid*), ALvoid *ptr);
-ALuint StopThread(ALvoid *thread);
-
-ALCcontext *GetContextSuspended(void);
-
-typedef struct RingBuffer RingBuffer;
-RingBuffer *CreateRingBuffer(ALsizei frame_size, ALsizei length);
-void DestroyRingBuffer(RingBuffer *ring);
-ALsizei RingBufferSize(RingBuffer *ring);
-void WriteRingBuffer(RingBuffer *ring, const ALubyte *data, ALsizei len);
-void ReadRingBuffer(RingBuffer *ring, ALubyte *data, ALsizei len);
-
-void ReadALConfig(void);
-void FreeALConfig(void);
-int ConfigValueExists(const char *blockName, const char *keyName);
-const char *GetConfigValue(const char *blockName, const char *keyName, const char *def);
-int GetConfigValueInt(const char *blockName, const char *keyName, int def);
-float GetConfigValueFloat(const char *blockName, const char *keyName, float def);
-int GetConfigValueBool(const char *blockName, const char *keyName, int def);
-
-void SetRTPriority(void);
-
-void SetDefaultChannelOrder(ALCdevice *device);
-void SetDefaultWFXChannelOrder(ALCdevice *device);
-
-void al_print(const char *fname, unsigned int line, const char *fmt, ...)
- PRINTF_STYLE(3,4);
-#define AL_PRINT(...) al_print(__FILE__, __LINE__, __VA_ARGS__)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/Include/alSource.h b/internal/c/parts/audio/out/android/OpenAL/OpenAL32/Include/alSource.h
deleted file mode 100644
index b4a91e9d1..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/Include/alSource.h
+++ /dev/null
@@ -1,124 +0,0 @@
-#ifndef _AL_SOURCE_H_
-#define _AL_SOURCE_H_
-
-#define MAX_SENDS 4
-
-#include "alFilter.h"
-#include "alu.h"
-#include "AL/al.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
- POINT_RESAMPLER = 0,
- LINEAR_RESAMPLER,
- CUBIC_RESAMPLER,
-
- RESAMPLER_MAX,
- RESAMPLER_MIN = -1,
- RESAMPLER_DEFAULT = LINEAR_RESAMPLER
-} resampler_t;
-extern resampler_t DefaultResampler;
-
-extern const ALsizei ResamplerPadding[RESAMPLER_MAX];
-extern const ALsizei ResamplerPrePadding[RESAMPLER_MAX];
-
-
-typedef struct ALbufferlistitem
-{
- struct ALbuffer *buffer;
- struct ALbufferlistitem *next;
- struct ALbufferlistitem *prev;
-} ALbufferlistitem;
-
-typedef struct ALsource
-{
- ALfp flPitch;
- ALfp flGain;
- ALfp flOuterGain;
- ALfp flMinGain;
- ALfp flMaxGain;
- ALfp flInnerAngle;
- ALfp flOuterAngle;
- ALfp flRefDistance;
- ALfp flMaxDistance;
- ALfp flRollOffFactor;
- ALfp vPosition[3];
- ALfp vVelocity[3];
- ALfp vOrientation[3];
- ALboolean bHeadRelative;
- ALboolean bLooping;
- ALenum DistanceModel;
-
- // Apportably Extension
- ALuint priority;
-
- resampler_t Resampler;
-
- ALenum state;
- ALuint position;
- ALuint position_fraction;
-
- struct ALbuffer *Buffer;
-
- ALbufferlistitem *queue; // Linked list of buffers in queue
- ALuint BuffersInQueue; // Number of buffers in queue
- ALuint BuffersPlayed; // Number of buffers played on this loop
-
- ALfilter DirectFilter;
-
- struct {
- struct ALeffectslot *Slot;
- ALfilter WetFilter;
- } Send[MAX_SENDS];
-
- ALboolean DryGainHFAuto;
- ALboolean WetGainAuto;
- ALboolean WetGainHFAuto;
- ALfp OuterGainHF;
-
- ALfp AirAbsorptionFactor;
- ALfp RoomRolloffFactor;
- ALfp DopplerFactor;
-
- ALint lOffset;
- ALint lOffsetType;
-
- // Source Type (Static, Streaming, or Undetermined)
- ALint lSourceType;
-
- // Current target parameters used for mixing
- ALboolean NeedsUpdate;
- struct {
- ALint Step;
-
- /* A mixing matrix. First subscript is the channel number of the input
- * data (regardless of channel configuration) and the second is the
- * channel target (eg. FRONT_LEFT) */
- ALfp DryGains[MAXCHANNELS][MAXCHANNELS];
- FILTER iirFilter;
- ALfp history[MAXCHANNELS*2];
-
- struct {
- ALfp WetGain;
- FILTER iirFilter;
- ALfp history[MAXCHANNELS];
- } Send[MAX_SENDS];
- } Params;
-
- ALvoid (*Update)(struct ALsource *self, const ALCcontext *context);
-
- // Index to itself
- ALuint source;
-} ALsource;
-#define ALsource_Update(s,a) ((s)->Update(s,a))
-
-ALvoid ReleaseALSources(ALCcontext *Context);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/Include/alState.h b/internal/c/parts/audio/out/android/OpenAL/OpenAL32/Include/alState.h
deleted file mode 100644
index 332176b03..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/Include/alState.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef _AL_STATE_H_
-#define _AL_STATE_H_
-
-#include "AL/al.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/Include/alThunk.h b/internal/c/parts/audio/out/android/OpenAL/OpenAL32/Include/alThunk.h
deleted file mode 100644
index 902f00e54..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/Include/alThunk.h
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef _AL_THUNK_H_
-#define _AL_THUNK_H_
-
-#include "config.h"
-
-#include "AL/al.h"
-#include "AL/alc.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void alThunkInit(void);
-void alThunkExit(void);
-ALuint alThunkAddEntry(ALvoid *ptr);
-void alThunkRemoveEntry(ALuint index);
-ALvoid *alThunkLookupEntry(ALuint index);
-
-#if (SIZEOF_VOIDP > SIZEOF_UINT)
-
-#define ALTHUNK_INIT() alThunkInit()
-#define ALTHUNK_EXIT() alThunkExit()
-#define ALTHUNK_ADDENTRY(p) alThunkAddEntry(p)
-#define ALTHUNK_REMOVEENTRY(i) alThunkRemoveEntry(i)
-#define ALTHUNK_LOOKUPENTRY(i) alThunkLookupEntry(i)
-
-#else
-
-#define ALTHUNK_INIT()
-#define ALTHUNK_EXIT()
-#define ALTHUNK_ADDENTRY(p) ((ALuint)p)
-#define ALTHUNK_REMOVEENTRY(i) ((ALvoid)i)
-#define ALTHUNK_LOOKUPENTRY(i) ((ALvoid*)(i))
-
-#endif // (SIZEOF_VOIDP > SIZEOF_INT)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //_AL_THUNK_H_
-
diff --git a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/Include/alu.h b/internal/c/parts/audio/out/android/OpenAL/OpenAL32/Include/alu.h
deleted file mode 100644
index 508eb3800..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/Include/alu.h
+++ /dev/null
@@ -1,140 +0,0 @@
-#ifndef _ALU_H_
-#define _ALU_H_
-
-#include "config.h"
-
-#include "AL/al.h"
-#include "AL/alc.h"
-#include "AL/alext.h"
-
-#include
-#include
-#ifdef HAVE_FLOAT_H
-#include
-#endif
-
-#ifndef M_PI
-#define M_PI 3.14159265358979323846 /* pi */
-#define M_PI_2 1.57079632679489661923 /* pi/2 */
-#endif
-
-#ifdef HAVE_POWF
-#define aluPow(x,y) (float2ALfp(powf(ALfp2float(x), ALfp2float(y))))
-#else
-#define aluPow(x,y) (float2ALfp((float)pow((double)ALfp2float(x), (double)ALfp2float(y))))
-#endif
-
-#ifdef HAVE_SQRTF
-#define aluSqrt(x) (float2ALfp(sqrtf(ALfp2float(x))))
-#else
-#define aluSqrt(x) (float2ALfp((float)sqrt((double)ALfp2float(x))))
-#endif
-
-#ifdef HAVE_ACOSF
-#define aluAcos(x) (float2ALfp(acosf(ALfp2float(x))))
-#else
-#define aluAcos(x) (float2ALfp((float)acos((double)ALfp2float(x))))
-#endif
-
-#ifdef HAVE_ATANF
-#define aluAtan(x) (float2ALfp(atanf(ALfp2float(x))))
-#else
-#define aluAtan(x) (float2ALfp((float)atan((double)ALfp2float(x))))
-#endif
-
-#ifdef HAVE_FABSF
-#define aluFabs(x) (float2ALfp(fabsf(ALfp2float(x))))
-#else
-#define aluFabs(x) (float2ALfp((float)fabs((double)ALfp2float(x))))
-#endif
-
-// FIXME make this better
-#if defined(max) && !defined(__max)
-#define __max(x,y) float2ALfp(max(ALfp2float(x),ALfp2float(y)))
-#endif
-#if defined(min) && !defined(__min)
-#define __min(x,y) float2ALfp(min(ALfp2float(x),ALfp2float(y)))
-#endif
-
-#define QUADRANT_NUM 128
-#define LUT_NUM (4 * QUADRANT_NUM)
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
- FRONT_LEFT = 0,
- FRONT_RIGHT,
- FRONT_CENTER,
- LFE,
- BACK_LEFT,
- BACK_RIGHT,
- BACK_CENTER,
- SIDE_LEFT,
- SIDE_RIGHT,
-} Channel;
-
-#ifndef MAXCHANNELS
-#define MAXCHANNELS (SIDE_RIGHT+1)
-#error MAXCHANNELS
-#endif
-
-#define BUFFERSIZE 4096
-
-#define FRACTIONBITS (14)
-#define FRACTIONONE (1<
-#include
-
-#include "AL/al.h"
-#include "AL/alc.h"
-#include "alMain.h"
-#include "alAuxEffectSlot.h"
-#include "alThunk.h"
-#include "alError.h"
-#include "alSource.h"
-
-
-static ALvoid InitializeEffect(ALCcontext *Context, ALeffectslot *EffectSlot, ALeffect *effect);
-
-#define LookupEffectSlot(m, k) ((ALeffectslot*)LookupUIntMapKey(&(m), (k)))
-#define LookupEffect(m, k) ((ALeffect*)LookupUIntMapKey(&(m), (k)))
-
-AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslots)
-{
- ALCcontext *Context;
- ALCdevice *Device;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- Device = Context->Device;
- if(n < 0 || IsBadWritePtr((void*)effectslots, n * sizeof(ALuint)))
- alSetError(Context, AL_INVALID_VALUE);
- else if((ALuint)n > Device->AuxiliaryEffectSlotMax - Context->EffectSlotMap.size)
- alSetError(Context, AL_INVALID_VALUE);
- else
- {
- ALenum err;
- ALsizei i, j;
-
- i = 0;
- while(i < n)
- {
- ALeffectslot *slot = calloc(1, sizeof(ALeffectslot));
- if(!slot || !(slot->EffectState=NoneCreate()))
- {
- free(slot);
- // We must have run out or memory
- alSetError(Context, AL_OUT_OF_MEMORY);
- alDeleteAuxiliaryEffectSlots(i, effectslots);
- break;
- }
-
- slot->effectslot = (ALuint)ALTHUNK_ADDENTRY(slot);
- err = InsertUIntMapEntry(&Context->EffectSlotMap,
- slot->effectslot, slot);
- if(err != AL_NO_ERROR)
- {
- ALTHUNK_REMOVEENTRY(slot->effectslot);
- ALEffect_Destroy(slot->EffectState);
- free(slot);
-
- alSetError(Context, err);
- alDeleteAuxiliaryEffectSlots(i, effectslots);
- break;
- }
-
- effectslots[i++] = slot->effectslot;
-
- slot->Gain = int2ALfp(1);
- slot->AuxSendAuto = AL_TRUE;
- for(j = 0;j < BUFFERSIZE;j++)
- slot->WetBuffer[j] = int2ALfp(0);
- for(j = 0;j < 1;j++)
- {
- slot->ClickRemoval[j] = int2ALfp(0);
- slot->PendingClicks[j] = int2ALfp(0);
- }
- slot->refcount = 0;
- }
- }
-
- ProcessContext(Context);
-}
-
-AL_API ALvoid AL_APIENTRY alDeleteAuxiliaryEffectSlots(ALsizei n, ALuint *effectslots)
-{
- ALCcontext *Context;
- ALeffectslot *EffectSlot;
- ALboolean SlotsValid = AL_FALSE;
- ALsizei i;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- if(n < 0)
- alSetError(Context, AL_INVALID_VALUE);
- else
- {
- SlotsValid = AL_TRUE;
- // Check that all effectslots are valid
- for(i = 0;i < n;i++)
- {
- if((EffectSlot=LookupEffectSlot(Context->EffectSlotMap, effectslots[i])) == NULL)
- {
- alSetError(Context, AL_INVALID_NAME);
- SlotsValid = AL_FALSE;
- break;
- }
- else if(EffectSlot->refcount > 0)
- {
- alSetError(Context, AL_INVALID_NAME);
- SlotsValid = AL_FALSE;
- break;
- }
- }
- }
-
- if(SlotsValid)
- {
- // All effectslots are valid
- for(i = 0;i < n;i++)
- {
- // Recheck that the effectslot is valid, because there could be duplicated names
- if((EffectSlot=LookupEffectSlot(Context->EffectSlotMap, effectslots[i])) == NULL)
- continue;
-
- ALEffect_Destroy(EffectSlot->EffectState);
-
- RemoveUIntMapKey(&Context->EffectSlotMap, EffectSlot->effectslot);
- ALTHUNK_REMOVEENTRY(EffectSlot->effectslot);
-
- memset(EffectSlot, 0, sizeof(ALeffectslot));
- free(EffectSlot);
- }
- }
-
- ProcessContext(Context);
-}
-
-AL_API ALboolean AL_APIENTRY alIsAuxiliaryEffectSlot(ALuint effectslot)
-{
- ALCcontext *Context;
- ALboolean result;
-
- Context = GetContextSuspended();
- if(!Context) return AL_FALSE;
-
- result = (LookupEffectSlot(Context->EffectSlotMap, effectslot) ?
- AL_TRUE : AL_FALSE);
-
- ProcessContext(Context);
-
- return result;
-}
-
-AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint iValue)
-{
- ALCdevice *Device;
- ALCcontext *Context;
- ALboolean updateSources = AL_FALSE;
- ALeffectslot *EffectSlot;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- Device = Context->Device;
- if((EffectSlot=LookupEffectSlot(Context->EffectSlotMap, effectslot)) != NULL)
- {
- switch(param)
- {
- case AL_EFFECTSLOT_EFFECT: {
- ALeffect *effect = NULL;
-
- if(iValue == 0 ||
- (effect=LookupEffect(Device->EffectMap, iValue)) != NULL)
- {
- InitializeEffect(Context, EffectSlot, effect);
- updateSources = AL_TRUE;
- }
- else
- alSetError(Context, AL_INVALID_VALUE);
- } break;
-
- case AL_EFFECTSLOT_AUXILIARY_SEND_AUTO:
- if(iValue == AL_TRUE || iValue == AL_FALSE)
- {
- EffectSlot->AuxSendAuto = iValue;
- updateSources = AL_TRUE;
- }
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(Context, AL_INVALID_NAME);
-
- // Force updating the sources that use this slot, since it affects the
- // sending parameters
- if(updateSources)
- {
- ALsizei pos;
- for(pos = 0;pos < Context->SourceMap.size;pos++)
- {
- ALsource *source = Context->SourceMap.array[pos].value;
- ALuint i;
- for(i = 0;i < Device->NumAuxSends;i++)
- {
- if(!source->Send[i].Slot ||
- source->Send[i].Slot->effectslot != effectslot)
- continue;
- source->NeedsUpdate = AL_TRUE;
- break;
- }
- }
- }
-
- ProcessContext(Context);
-}
-
-AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotiv(ALuint effectslot, ALenum param, ALint *piValues)
-{
- ALCcontext *Context;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- if(LookupEffectSlot(Context->EffectSlotMap, effectslot) != NULL)
- {
- switch(param)
- {
- case AL_EFFECTSLOT_EFFECT:
- case AL_EFFECTSLOT_AUXILIARY_SEND_AUTO:
- alAuxiliaryEffectSloti(effectslot, param, piValues[0]);
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(Context, AL_INVALID_NAME);
-
- ProcessContext(Context);
-}
-
-AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotf(ALuint effectslot, ALenum param, ALfloat flArg)
-{
- ALCcontext *Context;
- ALeffectslot *EffectSlot;
- ALfp flValue = float2ALfp(flArg);
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- if((EffectSlot=LookupEffectSlot(Context->EffectSlotMap, effectslot)) != NULL)
- {
- switch(param)
- {
- case AL_EFFECTSLOT_GAIN:
- if(flValue >= int2ALfp(0) && flValue <= int2ALfp(1))
- EffectSlot->Gain = flValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(Context, AL_INVALID_NAME);
-
- ProcessContext(Context);
-}
-
-AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotfv(ALuint effectslot, ALenum param, ALfloat *pflValues)
-{
- ALCcontext *Context;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- if(LookupEffectSlot(Context->EffectSlotMap, effectslot) != NULL)
- {
- switch(param)
- {
- case AL_EFFECTSLOT_GAIN:
- alAuxiliaryEffectSlotf(effectslot, param, pflValues[0]);
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(Context, AL_INVALID_NAME);
-
- ProcessContext(Context);
-}
-
-AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint *piValue)
-{
- ALCcontext *Context;
- ALeffectslot *EffectSlot;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- if((EffectSlot=LookupEffectSlot(Context->EffectSlotMap, effectslot)) != NULL)
- {
- switch(param)
- {
- case AL_EFFECTSLOT_EFFECT:
- *piValue = EffectSlot->effect.effect;
- break;
-
- case AL_EFFECTSLOT_AUXILIARY_SEND_AUTO:
- *piValue = EffectSlot->AuxSendAuto;
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(Context, AL_INVALID_NAME);
-
- ProcessContext(Context);
-}
-
-AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotiv(ALuint effectslot, ALenum param, ALint *piValues)
-{
- ALCcontext *Context;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- if(LookupEffectSlot(Context->EffectSlotMap, effectslot) != NULL)
- {
- switch(param)
- {
- case AL_EFFECTSLOT_EFFECT:
- case AL_EFFECTSLOT_AUXILIARY_SEND_AUTO:
- alGetAuxiliaryEffectSloti(effectslot, param, piValues);
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(Context, AL_INVALID_NAME);
-
- ProcessContext(Context);
-}
-
-AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotf(ALuint effectslot, ALenum param, ALfloat *pflValue)
-{
- ALCcontext *Context;
- ALeffectslot *EffectSlot;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- if((EffectSlot=LookupEffectSlot(Context->EffectSlotMap, effectslot)) != NULL)
- {
- switch(param)
- {
- case AL_EFFECTSLOT_GAIN:
- *pflValue = ALfp2float(EffectSlot->Gain);
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(Context, AL_INVALID_NAME);
-
- ProcessContext(Context);
-}
-
-AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotfv(ALuint effectslot, ALenum param, ALfloat *pflValues)
-{
- ALCcontext *Context;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- if(LookupEffectSlot(Context->EffectSlotMap, effectslot) != NULL)
- {
- switch(param)
- {
- case AL_EFFECTSLOT_GAIN:
- alGetAuxiliaryEffectSlotf(effectslot, param, pflValues);
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(Context, AL_INVALID_NAME);
-
- ProcessContext(Context);
-}
-
-
-static ALvoid NoneDestroy(ALeffectState *State)
-{ free(State); }
-static ALboolean NoneDeviceUpdate(ALeffectState *State, ALCdevice *Device)
-{
- return AL_TRUE;
- (void)State;
- (void)Device;
-}
-static ALvoid NoneUpdate(ALeffectState *State, ALCcontext *Context, const ALeffect *Effect)
-{
- (void)State;
- (void)Context;
- (void)Effect;
-}
-static ALvoid NoneProcess(ALeffectState *State, const ALeffectslot *Slot, ALuint SamplesToDo, const ALfp *SamplesIn, ALfp (*SamplesOut)[MAXCHANNELS])
-{
- (void)State;
- (void)Slot;
- (void)SamplesToDo;
- (void)SamplesIn;
- (void)SamplesOut;
-}
-ALeffectState *NoneCreate(void)
-{
- ALeffectState *state;
-
- state = calloc(1, sizeof(*state));
- if(!state)
- return NULL;
-
- state->Destroy = NoneDestroy;
- state->DeviceUpdate = NoneDeviceUpdate;
- state->Update = NoneUpdate;
- state->Process = NoneProcess;
-
- return state;
-}
-
-static ALvoid InitializeEffect(ALCcontext *Context, ALeffectslot *EffectSlot, ALeffect *effect)
-{
- if(EffectSlot->effect.type != (effect?effect->type:AL_EFFECT_NULL))
- {
- ALeffectState *NewState = NULL;
- if(!effect || effect->type == AL_EFFECT_NULL)
- NewState = NoneCreate();
- else if(effect->type == AL_EFFECT_EAXREVERB)
- NewState = EAXVerbCreate();
- else if(effect->type == AL_EFFECT_REVERB)
- NewState = VerbCreate();
- else if(effect->type == AL_EFFECT_ECHO)
- NewState = EchoCreate();
- else if(effect->type == AL_EFFECT_RING_MODULATOR)
- NewState = ModulatorCreate();
- /* No new state? An error occured.. */
- if(NewState == NULL ||
- ALEffect_DeviceUpdate(NewState, Context->Device) == AL_FALSE)
- {
- if(NewState)
- ALEffect_Destroy(NewState);
- alSetError(Context, AL_OUT_OF_MEMORY);
- return;
- }
- if(EffectSlot->EffectState)
- ALEffect_Destroy(EffectSlot->EffectState);
- EffectSlot->EffectState = NewState;
- }
- if(!effect)
- memset(&EffectSlot->effect, 0, sizeof(EffectSlot->effect));
- else
- memcpy(&EffectSlot->effect, effect, sizeof(*effect));
- ALEffect_Update(EffectSlot->EffectState, Context, effect);
-}
-
-
-ALvoid ReleaseALAuxiliaryEffectSlots(ALCcontext *Context)
-{
- ALsizei pos;
- for(pos = 0;pos < Context->EffectSlotMap.size;pos++)
- {
- ALeffectslot *temp = Context->EffectSlotMap.array[pos].value;
- Context->EffectSlotMap.array[pos].value = NULL;
-
- // Release effectslot structure
- ALEffect_Destroy(temp->EffectState);
-
- ALTHUNK_REMOVEENTRY(temp->effectslot);
- memset(temp, 0, sizeof(ALeffectslot));
- free(temp);
- }
-}
diff --git a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alAuxEffectSlot.h b/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alAuxEffectSlot.h
deleted file mode 100644
index 1c592ac8e..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alAuxEffectSlot.h
+++ /dev/null
@@ -1,63 +0,0 @@
-#ifndef _AL_AUXEFFECTSLOT_H_
-#define _AL_AUXEFFECTSLOT_H_
-
-#include "AL/al.h"
-#include "alEffect.h"
-#include "alFilter.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct ALeffectState ALeffectState;
-
-typedef struct ALeffectslot
-{
- ALeffect effect;
-
- ALfp Gain;
- ALboolean AuxSendAuto;
-
- ALeffectState *EffectState;
-
- ALfp WetBuffer[BUFFERSIZE];
-
- ALfp ClickRemoval[1];
- ALfp PendingClicks[1];
-
- ALuint refcount;
-
- // Index to itself
- ALuint effectslot;
-
- struct ALeffectslot *next;
-} ALeffectslot;
-
-
-ALvoid ReleaseALAuxiliaryEffectSlots(ALCcontext *Context);
-
-
-struct ALeffectState {
- ALvoid (*Destroy)(ALeffectState *State);
- ALboolean (*DeviceUpdate)(ALeffectState *State, ALCdevice *Device);
- ALvoid (*Update)(ALeffectState *State, ALCcontext *Context, const ALeffect *Effect);
- ALvoid (*Process)(ALeffectState *State, const ALeffectslot *Slot, ALuint SamplesToDo, const ALfp *SamplesIn, ALfp (*SamplesOut)[MAXCHANNELS]);
-};
-
-ALeffectState *NoneCreate(void);
-ALeffectState *EAXVerbCreate(void);
-ALeffectState *VerbCreate(void);
-ALeffectState *EchoCreate(void);
-ALeffectState *ModulatorCreate(void);
-
-#define ALEffect_Destroy(a) ((a)->Destroy((a)))
-#define ALEffect_DeviceUpdate(a,b) ((a)->DeviceUpdate((a),(b)))
-#define ALEffect_Update(a,b,c) ((a)->Update((a),(b),(c)))
-#define ALEffect_Process(a,b,c,d,e) ((a)->Process((a),(b),(c),(d),(e)))
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alBuffer.c b/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alBuffer.c
deleted file mode 100644
index 8d83ac4b8..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alBuffer.c
+++ /dev/null
@@ -1,1897 +0,0 @@
-/**
- * OpenAL cross platform audio library
- * Copyright (C) 1999-2007 by authors.
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- * Or go to http://www.gnu.org/copyleft/lgpl.html
- */
-
-#include "config.h"
-
-#include
-#include
-#include
-#include
-
-#include "alMain.h"
-#include "AL/al.h"
-#include "AL/alc.h"
-#include "alError.h"
-#include "alBuffer.h"
-#include "alDatabuffer.h"
-#include "alThunk.h"
-
-
-static ALenum LoadData(ALbuffer *ALBuf, ALuint freq, ALenum NewFormat, ALsizei size, enum UserFmtChannels chans, enum UserFmtType type, const ALvoid *data);
-static void ConvertData(ALvoid *dst, enum FmtType dstType, const ALvoid *src, enum UserFmtType srcType, ALsizei len);
-static void ConvertDataIMA4(ALvoid *dst, enum FmtType dstType, const ALvoid *src, ALint chans, ALsizei len);
-
-#define LookupBuffer(m, k) ((ALbuffer*)LookupUIntMapKey(&(m), (k)))
-
-
-/*
- * Global Variables
- */
-
-/* IMA ADPCM Stepsize table */
-static const long IMAStep_size[89] = {
- 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 19,
- 21, 23, 25, 28, 31, 34, 37, 41, 45, 50, 55,
- 60, 66, 73, 80, 88, 97, 107, 118, 130, 143, 157,
- 173, 190, 209, 230, 253, 279, 307, 337, 371, 408, 449,
- 494, 544, 598, 658, 724, 796, 876, 963, 1060, 1166, 1282,
- 1411, 1552, 1707, 1878, 2066, 2272, 2499, 2749, 3024, 3327, 3660,
- 4026, 4428, 4871, 5358, 5894, 6484, 7132, 7845, 8630, 9493,10442,
- 11487,12635,13899,15289,16818,18500,20350,22358,24633,27086,29794,
- 32767
-};
-
-/* IMA4 ADPCM Codeword decode table */
-static const long IMA4Codeword[16] = {
- 1, 3, 5, 7, 9, 11, 13, 15,
- -1,-3,-5,-7,-9,-11,-13,-15,
-};
-
-/* IMA4 ADPCM Step index adjust decode table */
-static const long IMA4Index_adjust[16] = {
- -1,-1,-1,-1, 2, 4, 6, 8,
- -1,-1,-1,-1, 2, 4, 6, 8
-};
-
-/* A quick'n'dirty lookup table to decode a muLaw-encoded byte sample into a
- * signed 16-bit sample */
-static const ALshort muLawDecompressionTable[256] = {
- -32124,-31100,-30076,-29052,-28028,-27004,-25980,-24956,
- -23932,-22908,-21884,-20860,-19836,-18812,-17788,-16764,
- -15996,-15484,-14972,-14460,-13948,-13436,-12924,-12412,
- -11900,-11388,-10876,-10364, -9852, -9340, -8828, -8316,
- -7932, -7676, -7420, -7164, -6908, -6652, -6396, -6140,
- -5884, -5628, -5372, -5116, -4860, -4604, -4348, -4092,
- -3900, -3772, -3644, -3516, -3388, -3260, -3132, -3004,
- -2876, -2748, -2620, -2492, -2364, -2236, -2108, -1980,
- -1884, -1820, -1756, -1692, -1628, -1564, -1500, -1436,
- -1372, -1308, -1244, -1180, -1116, -1052, -988, -924,
- -876, -844, -812, -780, -748, -716, -684, -652,
- -620, -588, -556, -524, -492, -460, -428, -396,
- -372, -356, -340, -324, -308, -292, -276, -260,
- -244, -228, -212, -196, -180, -164, -148, -132,
- -120, -112, -104, -96, -88, -80, -72, -64,
- -56, -48, -40, -32, -24, -16, -8, 0,
- 32124, 31100, 30076, 29052, 28028, 27004, 25980, 24956,
- 23932, 22908, 21884, 20860, 19836, 18812, 17788, 16764,
- 15996, 15484, 14972, 14460, 13948, 13436, 12924, 12412,
- 11900, 11388, 10876, 10364, 9852, 9340, 8828, 8316,
- 7932, 7676, 7420, 7164, 6908, 6652, 6396, 6140,
- 5884, 5628, 5372, 5116, 4860, 4604, 4348, 4092,
- 3900, 3772, 3644, 3516, 3388, 3260, 3132, 3004,
- 2876, 2748, 2620, 2492, 2364, 2236, 2108, 1980,
- 1884, 1820, 1756, 1692, 1628, 1564, 1500, 1436,
- 1372, 1308, 1244, 1180, 1116, 1052, 988, 924,
- 876, 844, 812, 780, 748, 716, 684, 652,
- 620, 588, 556, 524, 492, 460, 428, 396,
- 372, 356, 340, 324, 308, 292, 276, 260,
- 244, 228, 212, 196, 180, 164, 148, 132,
- 120, 112, 104, 96, 88, 80, 72, 64,
- 56, 48, 40, 32, 24, 16, 8, 0
-};
-
-/* Values used when encoding a muLaw sample */
-static const int muLawBias = 0x84;
-static const int muLawClip = 32635;
-static const char muLawCompressTable[256] =
-{
- 0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,
- 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
- 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
- 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
- 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7
-};
-
-/*
- * alGenBuffers(ALsizei n, ALuint *buffers)
- *
- * Generates n AL Buffers, and stores the Buffers Names in the array pointed
- * to by buffers
- */
-AL_API ALvoid AL_APIENTRY alGenBuffers(ALsizei n, ALuint *buffers)
-{
- ALCcontext *Context;
- ALsizei i=0;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- /* Check that we are actually generating some Buffers */
- if(n < 0 || IsBadWritePtr((void*)buffers, n * sizeof(ALuint)))
- alSetError(Context, AL_INVALID_VALUE);
- else
- {
- ALCdevice *device = Context->Device;
- ALenum err;
-
- // Create all the new Buffers
- while(i < n)
- {
- ALbuffer *buffer = calloc(1, sizeof(ALbuffer));
- if(!buffer)
- {
- alSetError(Context, AL_OUT_OF_MEMORY);
- alDeleteBuffers(i, buffers);
- break;
- }
-
- buffer->buffer = (ALuint)ALTHUNK_ADDENTRY(buffer);
- err = InsertUIntMapEntry(&device->BufferMap, buffer->buffer, buffer);
- if(err != AL_NO_ERROR)
- {
- ALTHUNK_REMOVEENTRY(buffer->buffer);
- memset(buffer, 0, sizeof(ALbuffer));
- free(buffer);
-
- alSetError(Context, err);
- alDeleteBuffers(i, buffers);
- break;
- }
- buffers[i++] = buffer->buffer;
- }
- }
-
- ProcessContext(Context);
-}
-
-/*
- * alDeleteBuffers(ALsizei n, ALuint *buffers)
- *
- * Deletes the n AL Buffers pointed to by buffers
- */
-AL_API ALvoid AL_APIENTRY alDeleteBuffers(ALsizei n, const ALuint *buffers)
-{
- ALCcontext *Context;
- ALCdevice *device;
- ALboolean Failed;
- ALbuffer *ALBuf;
- ALsizei i;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- Failed = AL_TRUE;
- device = Context->Device;
- /* Check we are actually Deleting some Buffers */
- if(n < 0)
- alSetError(Context, AL_INVALID_VALUE);
- else
- {
- Failed = AL_FALSE;
-
- /* Check that all the buffers are valid and can actually be deleted */
- for(i = 0;i < n;i++)
- {
- if(!buffers[i])
- continue;
-
- /* Check for valid Buffer ID */
- if((ALBuf=LookupBuffer(device->BufferMap, buffers[i])) == NULL)
- {
- alSetError(Context, AL_INVALID_NAME);
- Failed = AL_TRUE;
- break;
- }
- else if(ALBuf->refcount != 0)
- {
- /* Buffer still in use, cannot be deleted */
- alSetError(Context, AL_INVALID_OPERATION);
- Failed = AL_TRUE;
- break;
- }
- }
- }
-
- /* If all the Buffers were valid (and have Reference Counts of 0), then we
- * can delete them */
- if(!Failed)
- {
- for(i = 0;i < n;i++)
- {
- if((ALBuf=LookupBuffer(device->BufferMap, buffers[i])) == NULL)
- continue;
-
- /* Release the memory used to store audio data */
- free(ALBuf->data);
-
- /* Release buffer structure */
- RemoveUIntMapKey(&device->BufferMap, ALBuf->buffer);
- ALTHUNK_REMOVEENTRY(ALBuf->buffer);
-
- memset(ALBuf, 0, sizeof(ALbuffer));
- free(ALBuf);
- }
- }
-
- ProcessContext(Context);
-}
-
-/*
- * alIsBuffer(ALuint buffer)
- *
- * Checks if buffer is a valid Buffer Name
- */
-AL_API ALboolean AL_APIENTRY alIsBuffer(ALuint buffer)
-{
- ALCcontext *Context;
- ALboolean result;
-
- Context = GetContextSuspended();
- if(!Context) return AL_FALSE;
-
- result = ((!buffer || LookupBuffer(Context->Device->BufferMap, buffer)) ?
- AL_TRUE : AL_FALSE);
-
- ProcessContext(Context);
-
- return result;
-}
-
-/*
- * alBufferData(ALuint buffer, ALenum format, const ALvoid *data,
- * ALsizei size, ALsizei freq)
- *
- * Fill buffer with audio data
- */
-AL_API ALvoid AL_APIENTRY alBufferData(ALuint buffer,ALenum format,const ALvoid *data,ALsizei size,ALsizei freq)
-{
- enum UserFmtChannels SrcChannels;
- enum UserFmtType SrcType;
- ALCcontext *Context;
- ALCdevice *device;
- ALbuffer *ALBuf;
- ALenum err;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- if(Context->SampleSource)
- {
- ALintptrEXT offset;
-
- if(Context->SampleSource->state == MAPPED)
- {
- alSetError(Context, AL_INVALID_OPERATION);
- ProcessContext(Context);
- return;
- }
-
- offset = (const ALubyte*)data - (ALubyte*)NULL;
- data = Context->SampleSource->data + offset;
- }
-
- device = Context->Device;
- if((ALBuf=LookupBuffer(device->BufferMap, buffer)) == NULL)
- alSetError(Context, AL_INVALID_NAME);
- else if(ALBuf->refcount != 0)
- alSetError(Context, AL_INVALID_VALUE);
- else if(size < 0 || freq < 0)
- alSetError(Context, AL_INVALID_VALUE);
- else if(DecomposeUserFormat(format, &SrcChannels, &SrcType) == AL_FALSE)
- alSetError(Context, AL_INVALID_ENUM);
- else switch(SrcType)
- {
- case UserFmtByte:
- case UserFmtUByte:
- case UserFmtShort:
- case UserFmtUShort:
- case UserFmtInt:
- case UserFmtUInt:
- case UserFmtFloat:
- err = LoadData(ALBuf, freq, format, size, SrcChannels, SrcType, data);
- if(err != AL_NO_ERROR)
- alSetError(Context, err);
- break;
-
- case UserFmtDouble: {
- ALenum NewFormat = AL_FORMAT_MONO_FLOAT32;
- switch(SrcChannels)
- {
- case UserFmtMono: NewFormat = AL_FORMAT_MONO_FLOAT32; break;
- case UserFmtStereo: NewFormat = AL_FORMAT_STEREO_FLOAT32; break;
- case UserFmtRear: NewFormat = AL_FORMAT_REAR32; break;
- case UserFmtQuad: NewFormat = AL_FORMAT_QUAD32; break;
- case UserFmtX51: NewFormat = AL_FORMAT_51CHN32; break;
- case UserFmtX61: NewFormat = AL_FORMAT_61CHN32; break;
- case UserFmtX71: NewFormat = AL_FORMAT_71CHN32; break;
- }
- err = LoadData(ALBuf, freq, NewFormat, size, SrcChannels, SrcType, data);
- if(err != AL_NO_ERROR)
- alSetError(Context, err);
- } break;
-
- case UserFmtMulaw:
- case UserFmtIMA4: {
- ALenum NewFormat = AL_FORMAT_MONO16;
- switch(SrcChannels)
- {
- case UserFmtMono: NewFormat = AL_FORMAT_MONO16; break;
- case UserFmtStereo: NewFormat = AL_FORMAT_STEREO16; break;
- case UserFmtRear: NewFormat = AL_FORMAT_REAR16; break;
- case UserFmtQuad: NewFormat = AL_FORMAT_QUAD16; break;
- case UserFmtX51: NewFormat = AL_FORMAT_51CHN16; break;
- case UserFmtX61: NewFormat = AL_FORMAT_61CHN16; break;
- case UserFmtX71: NewFormat = AL_FORMAT_71CHN16; break;
- }
- err = LoadData(ALBuf, freq, NewFormat, size, SrcChannels, SrcType, data);
- if(err != AL_NO_ERROR)
- alSetError(Context, err);
- } break;
- }
-
- ProcessContext(Context);
-}
-
-/*
- * alBufferSubDataSOFT(ALuint buffer, ALenum format, const ALvoid *data,
- * ALsizei offset, ALsizei length)
- *
- * Update buffer's audio data
- */
-AL_API ALvoid AL_APIENTRY alBufferSubDataSOFT(ALuint buffer,ALenum format,const ALvoid *data,ALsizei offset,ALsizei length)
-{
- enum UserFmtChannels SrcChannels;
- enum UserFmtType SrcType;
- ALCcontext *Context;
- ALCdevice *device;
- ALbuffer *ALBuf;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- if(Context->SampleSource)
- {
-
- if(Context->SampleSource->state == MAPPED)
- {
- alSetError(Context, AL_INVALID_OPERATION);
- ProcessContext(Context);
- return;
- }
-
- offset = (const ALubyte*)data - (ALubyte*)NULL;
- data = Context->SampleSource->data + offset;
- }
-
- device = Context->Device;
- if((ALBuf=LookupBuffer(device->BufferMap, buffer)) == NULL)
- alSetError(Context, AL_INVALID_NAME);
- else if(length < 0 || offset < 0 || (length > 0 && data == NULL))
- alSetError(Context, AL_INVALID_VALUE);
- else if(DecomposeUserFormat(format, &SrcChannels, &SrcType) == AL_FALSE ||
- SrcChannels != ALBuf->OriginalChannels ||
- SrcType != ALBuf->OriginalType)
- alSetError(Context, AL_INVALID_ENUM);
- else if(offset > ALBuf->OriginalSize ||
- length > ALBuf->OriginalSize-offset ||
- (offset%ALBuf->OriginalAlign) != 0 ||
- (length%ALBuf->OriginalAlign) != 0)
- alSetError(Context, AL_INVALID_VALUE);
- else
- {
- if(SrcType == UserFmtIMA4)
- {
- ALuint Channels = ChannelsFromFmt(ALBuf->FmtChannels);
- ALuint Bytes = BytesFromFmt(ALBuf->FmtType);
-
- /* offset -> byte offset, length -> block count */
- offset /= 36;
- offset *= 65;
- offset *= Bytes;
- length /= ALBuf->OriginalAlign;
-
- ConvertDataIMA4(&((ALubyte*)ALBuf->data)[offset], ALBuf->FmtType,
- data, Channels, length);
- }
- else
- {
- ALuint OldBytes = BytesFromUserFmt(SrcType);
- ALuint Bytes = BytesFromFmt(ALBuf->FmtType);
-
- offset /= OldBytes;
- offset *= Bytes;
- length /= OldBytes;
-
- ConvertData(&((ALubyte*)ALBuf->data)[offset], ALBuf->FmtType,
- data, SrcType, length);
- }
- }
-
- ProcessContext(Context);
-}
-
-
-AL_API void AL_APIENTRY alBufferf(ALuint buffer, ALenum eParam, ALfloat flValue)
-{
- ALCcontext *pContext;
- ALCdevice *device;
-
- (void)flValue;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- device = pContext->Device;
- if(LookupBuffer(device->BufferMap, buffer) == NULL)
- alSetError(pContext, AL_INVALID_NAME);
- else
- {
- switch(eParam)
- {
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
- }
-
- ProcessContext(pContext);
-}
-
-
-AL_API void AL_APIENTRY alBuffer3f(ALuint buffer, ALenum eParam, ALfloat flValue1, ALfloat flValue2, ALfloat flValue3)
-{
- ALCcontext *pContext;
- ALCdevice *device;
-
- (void)flValue1;
- (void)flValue2;
- (void)flValue3;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- device = pContext->Device;
- if(LookupBuffer(device->BufferMap, buffer) == NULL)
- alSetError(pContext, AL_INVALID_NAME);
- else
- {
- switch(eParam)
- {
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
- }
-
- ProcessContext(pContext);
-}
-
-
-AL_API void AL_APIENTRY alBufferfv(ALuint buffer, ALenum eParam, const ALfloat* flValues)
-{
- ALCcontext *pContext;
- ALCdevice *device;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- device = pContext->Device;
- if(!flValues)
- alSetError(pContext, AL_INVALID_VALUE);
- else if(LookupBuffer(device->BufferMap, buffer) == NULL)
- alSetError(pContext, AL_INVALID_NAME);
- else
- {
- switch(eParam)
- {
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
- }
-
- ProcessContext(pContext);
-}
-
-
-AL_API void AL_APIENTRY alBufferi(ALuint buffer, ALenum eParam, ALint lValue)
-{
- ALCcontext *pContext;
- ALCdevice *device;
-
- (void)lValue;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- device = pContext->Device;
- if(LookupBuffer(device->BufferMap, buffer) == NULL)
- alSetError(pContext, AL_INVALID_NAME);
- else
- {
- switch(eParam)
- {
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
- }
-
- ProcessContext(pContext);
-}
-
-
-AL_API void AL_APIENTRY alBuffer3i( ALuint buffer, ALenum eParam, ALint lValue1, ALint lValue2, ALint lValue3)
-{
- ALCcontext *pContext;
- ALCdevice *device;
-
- (void)lValue1;
- (void)lValue2;
- (void)lValue3;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- device = pContext->Device;
- if(LookupBuffer(device->BufferMap, buffer) == NULL)
- alSetError(pContext, AL_INVALID_NAME);
- else
- {
- switch(eParam)
- {
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
- }
-
- ProcessContext(pContext);
-}
-
-
-AL_API void AL_APIENTRY alBufferiv(ALuint buffer, ALenum eParam, const ALint* plValues)
-{
- ALCcontext *pContext;
- ALCdevice *device;
- ALbuffer *ALBuf;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- device = pContext->Device;
- if(!plValues)
- alSetError(pContext, AL_INVALID_VALUE);
- else if((ALBuf=LookupBuffer(device->BufferMap, buffer)) == NULL)
- alSetError(pContext, AL_INVALID_NAME);
- else
- {
- switch(eParam)
- {
- case AL_LOOP_POINTS_SOFT:
- if(ALBuf->refcount > 0)
- alSetError(pContext, AL_INVALID_OPERATION);
- else if(plValues[0] < 0 || plValues[1] < 0 ||
- plValues[0] >= plValues[1] || ALBuf->size == 0)
- alSetError(pContext, AL_INVALID_VALUE);
- else
- {
- ALint maxlen = ALBuf->size /
- FrameSizeFromFmt(ALBuf->FmtChannels, ALBuf->FmtType);
- if(plValues[0] > maxlen || plValues[1] > maxlen)
- alSetError(pContext, AL_INVALID_VALUE);
- else
- {
- ALBuf->LoopStart = plValues[0];
- ALBuf->LoopEnd = plValues[1];
- }
- }
- break;
-
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
- }
-
- ProcessContext(pContext);
-}
-
-
-AL_API ALvoid AL_APIENTRY alGetBufferf(ALuint buffer, ALenum eParam, ALfloat *pflValue)
-{
- ALCcontext *pContext;
- ALCdevice *device;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- device = pContext->Device;
- if(!pflValue)
- alSetError(pContext, AL_INVALID_VALUE);
- else if(LookupBuffer(device->BufferMap, buffer) == NULL)
- alSetError(pContext, AL_INVALID_NAME);
- else
- {
- switch(eParam)
- {
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
- }
-
- ProcessContext(pContext);
-}
-
-
-AL_API void AL_APIENTRY alGetBuffer3f(ALuint buffer, ALenum eParam, ALfloat* pflValue1, ALfloat* pflValue2, ALfloat* pflValue3)
-{
- ALCcontext *pContext;
- ALCdevice *device;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- device = pContext->Device;
- if(!pflValue1 || !pflValue2 || !pflValue3)
- alSetError(pContext, AL_INVALID_VALUE);
- else if(LookupBuffer(device->BufferMap, buffer) == NULL)
- alSetError(pContext, AL_INVALID_NAME);
- else
- {
- switch(eParam)
- {
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
- }
-
- ProcessContext(pContext);
-}
-
-
-AL_API void AL_APIENTRY alGetBufferfv(ALuint buffer, ALenum eParam, ALfloat* pflValues)
-{
- ALCcontext *pContext;
- ALCdevice *device;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- device = pContext->Device;
- if(!pflValues)
- alSetError(pContext, AL_INVALID_VALUE);
- else if(LookupBuffer(device->BufferMap, buffer) == NULL)
- alSetError(pContext, AL_INVALID_NAME);
- else
- {
- switch(eParam)
- {
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
- }
-
- ProcessContext(pContext);
-}
-
-
-AL_API ALvoid AL_APIENTRY alGetBufferi(ALuint buffer, ALenum eParam, ALint *plValue)
-{
- ALCcontext *pContext;
- ALbuffer *pBuffer;
- ALCdevice *device;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- device = pContext->Device;
- if(!plValue)
- alSetError(pContext, AL_INVALID_VALUE);
- else if((pBuffer=LookupBuffer(device->BufferMap, buffer)) == NULL)
- alSetError(pContext, AL_INVALID_NAME);
- else
- {
- switch(eParam)
- {
- case AL_FREQUENCY:
- *plValue = pBuffer->Frequency;
- break;
-
- case AL_BITS:
- *plValue = BytesFromFmt(pBuffer->FmtType) * 8;
- break;
-
- case AL_CHANNELS:
- *plValue = ChannelsFromFmt(pBuffer->FmtChannels);
- break;
-
- case AL_SIZE:
- *plValue = pBuffer->size;
- break;
-
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
- }
-
- ProcessContext(pContext);
-}
-
-
-AL_API void AL_APIENTRY alGetBuffer3i(ALuint buffer, ALenum eParam, ALint* plValue1, ALint* plValue2, ALint* plValue3)
-{
- ALCcontext *pContext;
- ALCdevice *device;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- device = pContext->Device;
- if(!plValue1 || !plValue2 || !plValue3)
- alSetError(pContext, AL_INVALID_VALUE);
- else if(LookupBuffer(device->BufferMap, buffer) == NULL)
- alSetError(pContext, AL_INVALID_NAME);
- else
- {
- switch(eParam)
- {
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
- }
-
- ProcessContext(pContext);
-}
-
-
-AL_API void AL_APIENTRY alGetBufferiv(ALuint buffer, ALenum eParam, ALint* plValues)
-{
- ALCcontext *pContext;
- ALCdevice *device;
- ALbuffer *ALBuf;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- device = pContext->Device;
- if(!plValues)
- alSetError(pContext, AL_INVALID_VALUE);
- else if((ALBuf=LookupBuffer(device->BufferMap, buffer)) == NULL)
- alSetError(pContext, AL_INVALID_NAME);
- else
- {
- switch(eParam)
- {
- case AL_FREQUENCY:
- case AL_BITS:
- case AL_CHANNELS:
- case AL_SIZE:
- alGetBufferi(buffer, eParam, plValues);
- break;
-
- case AL_LOOP_POINTS_SOFT:
- plValues[0] = ALBuf->LoopStart;
- plValues[1] = ALBuf->LoopEnd;
- break;
-
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
- }
-
- ProcessContext(pContext);
-}
-
-
-typedef ALubyte ALmulaw;
-
-static __inline ALshort DecodeMuLaw(ALmulaw val)
-{ return muLawDecompressionTable[val]; }
-
-static ALmulaw EncodeMuLaw(ALshort val)
-{
- ALint mant, exp, sign;
-
- sign = (val>>8) & 0x80;
- if(sign)
- {
- /* -32768 doesn't properly negate on a short; it results in itself.
- * So clamp to -32767 */
- val = max(val, -32767);
- val = -val;
- }
-
- val = min(val, muLawClip);
- val += muLawBias;
-
- exp = muLawCompressTable[(val>>7) & 0xff];
- mant = (val >> (exp+3)) & 0x0f;
-
- return ~(sign | (exp<<4) | mant);
-}
-
-static void DecodeIMA4Block(ALshort *dst, const ALubyte *src, ALint numchans)
-{
- ALint sample[MAXCHANNELS], index[MAXCHANNELS];
- ALuint code[MAXCHANNELS];
- ALsizei j,k,c;
-
- for(c = 0;c < numchans;c++)
- {
- sample[c] = *(src++);
- sample[c] |= *(src++) << 8;
- sample[c] = (sample[c]^0x8000) - 32768;
- index[c] = *(src++);
- index[c] |= *(src++) << 8;
- index[c] = (index[c]^0x8000) - 32768;
-
- index[c] = max(0, index[c]);
- index[c] = min(index[c], 88);
-
- dst[c] = sample[c];
- }
-
- j = 1;
- while(j < 65)
- {
- for(c = 0;c < numchans;c++)
- {
- code[c] = *(src++);
- code[c] |= *(src++) << 8;
- code[c] |= *(src++) << 16;
- code[c] |= *(src++) << 24;
- }
-
- for(k = 0;k < 8;k++,j++)
- {
- for(c = 0;c < numchans;c++)
- {
- int nibble = code[c]&0xf;
- code[c] >>= 4;
-
- sample[c] += IMA4Codeword[nibble] * IMAStep_size[index[c]] / 8;
- sample[c] = max(-32768, sample[c]);
- sample[c] = min(sample[c], 32767);
-
- index[c] += IMA4Index_adjust[nibble];
- index[c] = max(0, index[c]);
- index[c] = min(index[c], 88);
-
- dst[j*numchans + c] = sample[c];
- }
- }
- }
-}
-
-static void EncodeIMA4Block(ALubyte *dst, const ALshort *src, ALint *sample, ALint *index, ALint numchans)
-{
- ALsizei j,k,c;
-
- for(c = 0;c < numchans;c++)
- {
- int diff = src[c] - sample[c];
- int step = IMAStep_size[index[c]];
- int nibble;
-
- nibble = 0;
- if(diff < 0)
- {
- nibble = 0x8;
- diff = -diff;
- }
-
- diff = min(step*2, diff);
- nibble |= (diff*8/step - 1) / 2;
-
- sample[c] += IMA4Codeword[nibble] * step / 8;
- sample[c] = max(-32768, sample[c]);
- sample[c] = min(sample[c], 32767);
-
- index[c] += IMA4Index_adjust[nibble];
- index[c] = max(0, index[c]);
- index[c] = min(index[c], 88);
-
- *(dst++) = sample[c] & 0xff;
- *(dst++) = (sample[c]>>8) & 0xff;
- *(dst++) = index[c] & 0xff;
- *(dst++) = (index[c]>>8) & 0xff;
- }
-
- j = 1;
- while(j < 65)
- {
- for(c = 0;c < numchans;c++)
- {
- for(k = 0;k < 8;k++)
- {
- int diff = src[(j+k)*numchans + c] - sample[c];
- int step = IMAStep_size[index[c]];
- int nibble;
-
- nibble = 0;
- if(diff < 0)
- {
- nibble = 0x8;
- diff = -diff;
- }
-
- diff = min(step*2, diff);
- nibble |= (diff*8/step - 1) / 2;
-
- sample[c] += IMA4Codeword[nibble] * step / 8;
- sample[c] = max(-32768, sample[c]);
- sample[c] = min(sample[c], 32767);
-
- index[c] += IMA4Index_adjust[nibble];
- index[c] = max(0, index[c]);
- index[c] = min(index[c], 88);
-
- if(!(k&1)) *dst = nibble;
- else *(dst++) |= nibble<<4;
- }
- }
- j += 8;
- }
-}
-
-
-static __inline ALbyte Conv_ALbyte_ALbyte(ALbyte val)
-{ return val; }
-static __inline ALbyte Conv_ALbyte_ALubyte(ALubyte val)
-{ return val-128; }
-static __inline ALbyte Conv_ALbyte_ALshort(ALshort val)
-{ return val>>8; }
-static __inline ALbyte Conv_ALbyte_ALushort(ALushort val)
-{ return (val>>8)-128; }
-static __inline ALbyte Conv_ALbyte_ALint(ALint val)
-{ return val>>24; }
-static __inline ALbyte Conv_ALbyte_ALuint(ALuint val)
-{ return (val>>24)-128; }
-static __inline ALbyte Conv_ALbyte_ALfp(ALfp val)
-{
- if(val > int2ALfp(1)) return 127;
- if(val < int2ALfp(-1)) return -128;
- return ALfp2int(ALfpMult(val, int2ALfp(127)));
-}
-static __inline ALbyte Conv_ALbyte_ALdfp(ALdfp val)
-{
- if(val > int2ALdfp(1)) return 127;
- if(val < int2ALdfp(-1)) return -128;
- return ALdfp2int(ALdfpMult(val, int2ALdfp(127)));
-}
-static __inline ALbyte Conv_ALbyte_ALmulaw(ALmulaw val)
-{ return Conv_ALbyte_ALshort(DecodeMuLaw(val)); }
-
-static __inline ALubyte Conv_ALubyte_ALbyte(ALbyte val)
-{ return val+128; }
-static __inline ALubyte Conv_ALubyte_ALubyte(ALubyte val)
-{ return val; }
-static __inline ALubyte Conv_ALubyte_ALshort(ALshort val)
-{ return (val>>8)+128; }
-static __inline ALubyte Conv_ALubyte_ALushort(ALushort val)
-{ return val>>8; }
-static __inline ALubyte Conv_ALubyte_ALint(ALint val)
-{ return (val>>24)+128; }
-static __inline ALubyte Conv_ALubyte_ALuint(ALuint val)
-{ return val>>24; }
-static __inline ALubyte Conv_ALubyte_ALfp(ALfp val)
-{
- if(val > int2ALfp(1)) return 255;
- if(val < int2ALfp(-1)) return 0;
- return ALfp2int(ALfpMult(val, int2ALfp(127))) + 128;
-}
-static __inline ALubyte Conv_ALubyte_ALdfp(ALdfp val)
-{
- if(val > int2ALdfp(1)) return 255;
- if(val < int2ALdfp(-1)) return 0;
- return ALdfp2int(ALdfpMult(val, int2ALdfp(127))) + 128;
-}
-static __inline ALubyte Conv_ALubyte_ALmulaw(ALmulaw val)
-{ return Conv_ALubyte_ALshort(DecodeMuLaw(val)); }
-
-static __inline ALshort Conv_ALshort_ALbyte(ALbyte val)
-{ return val<<8; }
-static __inline ALshort Conv_ALshort_ALubyte(ALubyte val)
-{ return (val-128)<<8; }
-static __inline ALshort Conv_ALshort_ALshort(ALshort val)
-{ return val; }
-static __inline ALshort Conv_ALshort_ALushort(ALushort val)
-{ return val-32768; }
-static __inline ALshort Conv_ALshort_ALint(ALint val)
-{ return val>>16; }
-static __inline ALshort Conv_ALshort_ALuint(ALuint val)
-{ return (val>>16)-32768; }
-static __inline ALshort Conv_ALshort_ALfp(ALfp val)
-{
- if(val > int2ALfp(1)) return 32767;
- if(val < int2ALfp(-1)) return -32768;
- return ALfp2int(ALfpMult(val, int2ALfp(32767)));
-}
-static __inline ALshort Conv_ALshort_ALdfp(ALdfp val)
-{
- if(val > int2ALdfp(1)) return 32767;
- if(val < int2ALdfp(-1)) return -32768;
- return ALdfp2int(ALdfpMult(val, int2ALdfp(32767)));
-}
-static __inline ALshort Conv_ALshort_ALmulaw(ALmulaw val)
-{ return Conv_ALshort_ALshort(DecodeMuLaw(val)); }
-
-static __inline ALushort Conv_ALushort_ALbyte(ALbyte val)
-{ return (val+128)<<8; }
-static __inline ALushort Conv_ALushort_ALubyte(ALubyte val)
-{ return val<<8; }
-static __inline ALushort Conv_ALushort_ALshort(ALshort val)
-{ return val+32768; }
-static __inline ALushort Conv_ALushort_ALushort(ALushort val)
-{ return val; }
-static __inline ALushort Conv_ALushort_ALint(ALint val)
-{ return (val>>16)+32768; }
-static __inline ALushort Conv_ALushort_ALuint(ALuint val)
-{ return val>>16; }
-static __inline ALushort Conv_ALushort_ALfp(ALfp val)
-{
- if(val > int2ALfp(1)) return 65535;
- if(val < int2ALfp(-1)) return 0;
- return ALfp2int(ALfpMult(val, int2ALfp(32767))) + 32768;
-}
-static __inline ALushort Conv_ALushort_ALdfp(ALdfp val)
-{
- if(val > int2ALdfp(1)) return 65535;
- if(val < int2ALdfp(-1)) return 0;
- return ALdfp2int(ALdfpMult(val, int2ALdfp(32767))) + 32768;
-}
-static __inline ALushort Conv_ALushort_ALmulaw(ALmulaw val)
-{ return Conv_ALushort_ALshort(DecodeMuLaw(val)); }
-
-static __inline ALint Conv_ALint_ALbyte(ALbyte val)
-{ return val<<24; }
-static __inline ALint Conv_ALint_ALubyte(ALubyte val)
-{ return (val-128)<<24; }
-static __inline ALint Conv_ALint_ALshort(ALshort val)
-{ return val<<16; }
-static __inline ALint Conv_ALint_ALushort(ALushort val)
-{ return (val-32768)<<16; }
-static __inline ALint Conv_ALint_ALint(ALint val)
-{ return val; }
-static __inline ALint Conv_ALint_ALuint(ALuint val)
-{ return val-2147483648u; }
-static __inline ALint Conv_ALint_ALfp(ALfp val)
-{
- if(val > int2ALfp(1)) return 2147483647;
- if(val < int2ALfp(-1)) return -2147483647-1;
- return ALfp2int(ALfpMult(val, int2ALfp(2147483647)));
-}
-static __inline ALint Conv_ALint_ALdfp(ALdfp val)
-{
- if(val > int2ALdfp(1)) return 2147483647;
- if(val < int2ALdfp(-1)) return -2147483647-1;
- return ALdfp2int(ALdfpMult(val, int2ALdfp(2147483647)));
-}
-static __inline ALint Conv_ALint_ALmulaw(ALmulaw val)
-{ return Conv_ALint_ALshort(DecodeMuLaw(val)); }
-
-static __inline ALuint Conv_ALuint_ALbyte(ALbyte val)
-{ return (val+128)<<24; }
-static __inline ALuint Conv_ALuint_ALubyte(ALubyte val)
-{ return val<<24; }
-static __inline ALuint Conv_ALuint_ALshort(ALshort val)
-{ return (val+32768)<<16; }
-static __inline ALuint Conv_ALuint_ALushort(ALushort val)
-{ return val<<16; }
-static __inline ALuint Conv_ALuint_ALint(ALint val)
-{ return val+2147483648u; }
-static __inline ALuint Conv_ALuint_ALuint(ALuint val)
-{ return val; }
-static __inline ALuint Conv_ALuint_ALfp(ALfp val)
-{
- if(val > int2ALfp(1)) return 4294967295u;
- if(val < int2ALfp(-1)) return 0;
- return ALfp2int(ALfpMult(val, int2ALfp(2147483647))) + 2147483648u;
-}
-static __inline ALuint Conv_ALuint_ALdfp(ALdfp val)
-{
- if(val > int2ALdfp(1)) return 4294967295u;
- if(val < int2ALdfp(-1)) return 0;
- return ALdfp2int(ALdfpMult(val, int2ALdfp(2147483647))) + 2147483648u;
-}
-static __inline ALuint Conv_ALuint_ALmulaw(ALmulaw val)
-{ return Conv_ALuint_ALshort(DecodeMuLaw(val)); }
-
-// FIXME(apportable) make this more efficient with shifts for integer input
-static __inline ALfp Conv_ALfp_ALbyte(ALbyte val)
-{ return float2ALfp(val * (1.0f/127.0f)); }
-static __inline ALfp Conv_ALfp_ALubyte(ALubyte val)
-{ return float2ALfp((val-128) * (1.0f/127.0f)); }
-static __inline ALfp Conv_ALfp_ALshort(ALshort val)
-{ return float2ALfp(val * (1.0f/32767.0f)); }
-static __inline ALfp Conv_ALfp_ALushort(ALushort val)
-{ return float2ALfp((val-32768) * (1.0f/32767.0f)); }
-static __inline ALfp Conv_ALfp_ALint(ALint val)
-{ return float2ALfp(val * (1.0/2147483647.0)); }
-static __inline ALfp Conv_ALfp_ALuint(ALuint val)
-{ return float2ALfp((ALint)(val-2147483648u) * (1.0/2147483647.0)); }
-static __inline ALfp Conv_ALfp_ALfp(ALfp val)
-{ return val; }
-static __inline ALfp Conv_ALfp_ALdfp(ALdfp val)
-{ return (ALfp)val; }
-static __inline ALfp Conv_ALfp_ALmulaw(ALmulaw val)
-{ return Conv_ALfp_ALshort(DecodeMuLaw(val)); }
-
-// FIXME replace with shifts for integer args
-static __inline ALdfp Conv_ALdfp_ALbyte(ALbyte val)
-{ return double2ALdfp(val * (1.0/127.0)); }
-static __inline ALdfp Conv_ALdfp_ALubyte(ALubyte val)
-{ return double2ALdfp((val-128) * (1.0/127.0)); }
-static __inline ALdfp Conv_ALdfp_ALshort(ALshort val)
-{ return double2ALdfp(val * (1.0/32767.0)); }
-static __inline ALdfp Conv_ALdfp_ALushort(ALushort val)
-{ return double2ALdfp((val-32768) * (1.0/32767.0)); }
-static __inline ALdfp Conv_ALdfp_ALint(ALint val)
-{ return double2ALdfp(val * (1.0/2147483647.0)); }
-static __inline ALdfp Conv_ALdfp_ALuint(ALuint val)
-{ return double2ALdfp((ALint)(val-2147483648u) * (1.0/2147483647.0)); }
-static __inline ALdfp Conv_ALdfp_ALfp(ALfp val)
-{ return (ALdfp)val; }
-static __inline ALdfp Conv_ALdfp_ALdfp(ALdfp val)
-{ return val; }
-static __inline ALdfp Conv_ALdfp_ALmulaw(ALmulaw val)
-{ return Conv_ALdfp_ALshort(DecodeMuLaw(val)); }
-
-#define DECL_TEMPLATE(T) \
-static __inline ALmulaw Conv_ALmulaw_##T(T val) \
-{ return EncodeMuLaw(Conv_ALshort_##T(val)); }
-
-DECL_TEMPLATE(ALbyte)
-DECL_TEMPLATE(ALubyte)
-DECL_TEMPLATE(ALshort)
-DECL_TEMPLATE(ALushort)
-DECL_TEMPLATE(ALint)
-DECL_TEMPLATE(ALuint)
-DECL_TEMPLATE(ALfp)
-DECL_TEMPLATE(ALdfp)
-static __inline ALmulaw Conv_ALmulaw_ALmulaw(ALmulaw val)
-{ return val; }
-
-#undef DECL_TEMPLATE
-
-#define DECL_TEMPLATE(T1, T2) \
-static void Convert_##T1##_##T2(T1 *dst, const T2 *src, ALuint len) \
-{ \
- ALuint i; \
- for(i = 0;i < len;i++) \
- *(dst++) = Conv_##T1##_##T2(*(src++)); \
-}
-
-DECL_TEMPLATE(ALbyte, ALbyte)
-DECL_TEMPLATE(ALbyte, ALubyte)
-DECL_TEMPLATE(ALbyte, ALshort)
-DECL_TEMPLATE(ALbyte, ALushort)
-DECL_TEMPLATE(ALbyte, ALint)
-DECL_TEMPLATE(ALbyte, ALuint)
-DECL_TEMPLATE(ALbyte, ALfp)
-DECL_TEMPLATE(ALbyte, ALdfp)
-DECL_TEMPLATE(ALbyte, ALmulaw)
-
-DECL_TEMPLATE(ALubyte, ALbyte)
-DECL_TEMPLATE(ALubyte, ALubyte)
-DECL_TEMPLATE(ALubyte, ALshort)
-DECL_TEMPLATE(ALubyte, ALushort)
-DECL_TEMPLATE(ALubyte, ALint)
-DECL_TEMPLATE(ALubyte, ALuint)
-DECL_TEMPLATE(ALubyte, ALfp)
-DECL_TEMPLATE(ALubyte, ALdfp)
-DECL_TEMPLATE(ALubyte, ALmulaw)
-
-DECL_TEMPLATE(ALshort, ALbyte)
-DECL_TEMPLATE(ALshort, ALubyte)
-DECL_TEMPLATE(ALshort, ALshort)
-DECL_TEMPLATE(ALshort, ALushort)
-DECL_TEMPLATE(ALshort, ALint)
-DECL_TEMPLATE(ALshort, ALuint)
-DECL_TEMPLATE(ALshort, ALfp)
-DECL_TEMPLATE(ALshort, ALdfp)
-DECL_TEMPLATE(ALshort, ALmulaw)
-
-DECL_TEMPLATE(ALushort, ALbyte)
-DECL_TEMPLATE(ALushort, ALubyte)
-DECL_TEMPLATE(ALushort, ALshort)
-DECL_TEMPLATE(ALushort, ALushort)
-DECL_TEMPLATE(ALushort, ALint)
-DECL_TEMPLATE(ALushort, ALuint)
-DECL_TEMPLATE(ALushort, ALfp)
-DECL_TEMPLATE(ALushort, ALdfp)
-DECL_TEMPLATE(ALushort, ALmulaw)
-
-DECL_TEMPLATE(ALint, ALbyte)
-DECL_TEMPLATE(ALint, ALubyte)
-DECL_TEMPLATE(ALint, ALshort)
-DECL_TEMPLATE(ALint, ALushort)
-DECL_TEMPLATE(ALint, ALint)
-DECL_TEMPLATE(ALint, ALuint)
-DECL_TEMPLATE(ALint, ALfp)
-DECL_TEMPLATE(ALint, ALdfp)
-DECL_TEMPLATE(ALint, ALmulaw)
-
-DECL_TEMPLATE(ALuint, ALbyte)
-DECL_TEMPLATE(ALuint, ALubyte)
-DECL_TEMPLATE(ALuint, ALshort)
-DECL_TEMPLATE(ALuint, ALushort)
-DECL_TEMPLATE(ALuint, ALint)
-DECL_TEMPLATE(ALuint, ALuint)
-DECL_TEMPLATE(ALuint, ALfp)
-DECL_TEMPLATE(ALuint, ALdfp)
-DECL_TEMPLATE(ALuint, ALmulaw)
-
-DECL_TEMPLATE(ALfp, ALbyte)
-DECL_TEMPLATE(ALfp, ALubyte)
-DECL_TEMPLATE(ALfp, ALshort)
-DECL_TEMPLATE(ALfp, ALushort)
-DECL_TEMPLATE(ALfp, ALint)
-DECL_TEMPLATE(ALfp, ALuint)
-DECL_TEMPLATE(ALfp, ALfp)
-DECL_TEMPLATE(ALfp, ALdfp)
-DECL_TEMPLATE(ALfp, ALmulaw)
-
-DECL_TEMPLATE(ALdfp, ALbyte)
-DECL_TEMPLATE(ALdfp, ALubyte)
-DECL_TEMPLATE(ALdfp, ALshort)
-DECL_TEMPLATE(ALdfp, ALushort)
-DECL_TEMPLATE(ALdfp, ALint)
-DECL_TEMPLATE(ALdfp, ALuint)
-DECL_TEMPLATE(ALdfp, ALfp)
-DECL_TEMPLATE(ALdfp, ALdfp)
-DECL_TEMPLATE(ALdfp, ALmulaw)
-
-DECL_TEMPLATE(ALmulaw, ALbyte)
-DECL_TEMPLATE(ALmulaw, ALubyte)
-DECL_TEMPLATE(ALmulaw, ALshort)
-DECL_TEMPLATE(ALmulaw, ALushort)
-DECL_TEMPLATE(ALmulaw, ALint)
-DECL_TEMPLATE(ALmulaw, ALuint)
-DECL_TEMPLATE(ALmulaw, ALfp)
-DECL_TEMPLATE(ALmulaw, ALdfp)
-DECL_TEMPLATE(ALmulaw, ALmulaw)
-
-#undef DECL_TEMPLATE
-
-#define DECL_TEMPLATE(T) \
-static void Convert_##T##_IMA4(T *dst, const ALubyte *src, ALuint numchans, \
- ALuint numblocks) \
-{ \
- ALuint i, j; \
- ALshort tmp[65*MAXCHANNELS]; /* Max samples an IMA4 frame can be */ \
- for(i = 0;i < numblocks;i++) \
- { \
- DecodeIMA4Block(tmp, src, numchans); \
- src += 36*numchans; \
- for(j = 0;j < 65*numchans;j++) \
- *(dst++) = Conv_##T##_ALshort(tmp[j]); \
- } \
-}
-
-DECL_TEMPLATE(ALbyte)
-DECL_TEMPLATE(ALubyte)
-DECL_TEMPLATE(ALshort)
-DECL_TEMPLATE(ALushort)
-DECL_TEMPLATE(ALint)
-DECL_TEMPLATE(ALuint)
-DECL_TEMPLATE(ALfp)
-DECL_TEMPLATE(ALdfp)
-DECL_TEMPLATE(ALmulaw)
-
-#undef DECL_TEMPLATE
-
-#define DECL_TEMPLATE(T) \
-static void Convert_IMA4_##T(ALubyte *dst, const T *src, ALuint numchans, \
- ALuint numblocks) \
-{ \
- ALuint i, j; \
- ALshort tmp[65*MAXCHANNELS]; /* Max samples an IMA4 frame can be */ \
- ALint sample[MAXCHANNELS] = {0}; \
- ALint index[MAXCHANNELS] = {0}; \
- for(i = 0;i < numblocks;i++) \
- { \
- for(j = 0;j < 65*numchans;j++) \
- tmp[j] = Conv_ALshort_##T(*(src++)); \
- EncodeIMA4Block(dst, tmp, sample, index, numchans); \
- dst += 36*numchans; \
- } \
-}
-
-DECL_TEMPLATE(ALbyte)
-DECL_TEMPLATE(ALubyte)
-DECL_TEMPLATE(ALshort)
-DECL_TEMPLATE(ALushort)
-DECL_TEMPLATE(ALint)
-DECL_TEMPLATE(ALuint)
-DECL_TEMPLATE(ALfp)
-DECL_TEMPLATE(ALdfp)
-DECL_TEMPLATE(ALmulaw)
-
-#undef DECL_TEMPLATE
-
-static void Convert_IMA4_IMA4(ALubyte *dst, const ALubyte *src, ALuint numchans,
- ALuint numblocks)
-{
- memcpy(dst, src, numblocks*36*numchans);
-}
-
-#define DECL_TEMPLATE(T) \
-static void Convert_##T(T *dst, const ALvoid *src, enum UserFmtType srcType, \
- ALsizei len) \
-{ \
- switch(srcType) \
- { \
- case UserFmtByte: \
- Convert_##T##_ALbyte(dst, src, len); \
- break; \
- case UserFmtUByte: \
- Convert_##T##_ALubyte(dst, src, len); \
- break; \
- case UserFmtShort: \
- Convert_##T##_ALshort(dst, src, len); \
- break; \
- case UserFmtUShort: \
- Convert_##T##_ALushort(dst, src, len); \
- break; \
- case UserFmtInt: \
- Convert_##T##_ALint(dst, src, len); \
- break; \
- case UserFmtUInt: \
- Convert_##T##_ALuint(dst, src, len); \
- break; \
- case UserFmtFloat: \
- Convert_##T##_ALfp(dst, src, len); \
- break; \
- case UserFmtDouble: \
- Convert_##T##_ALdfp(dst, src, len); \
- break; \
- case UserFmtMulaw: \
- Convert_##T##_ALmulaw(dst, src, len); \
- break; \
- case UserFmtIMA4: \
- break; /* not handled here */ \
- } \
-}
-
-DECL_TEMPLATE(ALbyte)
-DECL_TEMPLATE(ALubyte)
-DECL_TEMPLATE(ALshort)
-DECL_TEMPLATE(ALushort)
-DECL_TEMPLATE(ALint)
-DECL_TEMPLATE(ALuint)
-DECL_TEMPLATE(ALfp)
-DECL_TEMPLATE(ALdfp)
-DECL_TEMPLATE(ALmulaw)
-
-#undef DECL_TEMPLATE
-
-static void Convert_IMA4(ALubyte *dst, const ALvoid *src, enum UserFmtType srcType,
- ALint chans, ALsizei len)
-{
- switch(srcType)
- {
- case UserFmtByte:
- Convert_IMA4_ALbyte(dst, src, chans, len);
- break;
- case UserFmtUByte:
- Convert_IMA4_ALubyte(dst, src, chans, len);
- break;
- case UserFmtShort:
- Convert_IMA4_ALshort(dst, src, chans, len);
- break;
- case UserFmtUShort:
- Convert_IMA4_ALushort(dst, src, chans, len);
- break;
- case UserFmtInt:
- Convert_IMA4_ALint(dst, src, chans, len);
- break;
- case UserFmtUInt:
- Convert_IMA4_ALuint(dst, src, chans, len);
- break;
- case UserFmtFloat:
- Convert_IMA4_ALfp(dst, src, chans, len);
- break;
- case UserFmtDouble:
- Convert_IMA4_ALdfp(dst, src, chans, len);
- break;
- case UserFmtMulaw:
- Convert_IMA4_ALmulaw(dst, src, chans, len);
- break;
- case UserFmtIMA4:
- Convert_IMA4_IMA4(dst, src, chans, len);
- break;
- }
-}
-
-
-static void ConvertData(ALvoid *dst, enum FmtType dstType, const ALvoid *src, enum UserFmtType srcType, ALsizei len)
-{
- switch(dstType)
- {
- (void)Convert_ALbyte;
- case FmtUByte:
- Convert_ALubyte(dst, src, srcType, len);
- break;
- case FmtShort:
- Convert_ALshort(dst, src, srcType, len);
- break;
- (void)Convert_ALushort;
- (void)Convert_ALint;
- (void)Convert_ALuint;
- case FmtFloat:
- Convert_ALfp(dst, src, srcType, len);
- break;
- (void)Convert_ALdfp;
- (void)Convert_ALmulaw;
- (void)Convert_IMA4;
- }
-}
-
-static void ConvertDataIMA4(ALvoid *dst, enum FmtType dstType, const ALvoid *src, ALint chans, ALsizei len)
-{
- switch(dstType)
- {
- (void)Convert_ALbyte_IMA4;
- case FmtUByte:
- Convert_ALubyte_IMA4(dst, src, chans, len);
- break;
- case FmtShort:
- Convert_ALshort_IMA4(dst, src, chans, len);
- break;
- (void)Convert_ALushort_IMA4;
- (void)Convert_ALint_IMA4;
- (void)Convert_ALuint_IMA4;
- case FmtFloat:
- Convert_ALfp_IMA4(dst, src, chans, len);
- break;
- (void)Convert_ALdfp_IMA4;
- (void)Convert_ALmulaw_IMA4;
- }
-}
-
-
-/*
- * LoadData
- *
- * Loads the specified data into the buffer, using the specified formats.
- * Currently, the new format must have the same channel configuration as the
- * original format.
- */
-static ALenum LoadData(ALbuffer *ALBuf, ALuint freq, ALenum NewFormat, ALsizei size, enum UserFmtChannels SrcChannels, enum UserFmtType SrcType, const ALvoid *data)
-{
- ALuint NewChannels, NewBytes;
- enum FmtChannels DstChannels;
- enum FmtType DstType;
- ALuint64 newsize;
- ALvoid *temp;
-
- DecomposeFormat(NewFormat, &DstChannels, &DstType);
- NewChannels = ChannelsFromFmt(DstChannels);
- NewBytes = BytesFromFmt(DstType);
-
- assert((int)SrcChannels == (int)DstChannels);
-
- if(SrcType == UserFmtIMA4)
- {
- ALuint OrigChannels = ChannelsFromUserFmt(SrcChannels);
-
- /* Here is where things vary:
- * nVidia and Apple use 64+1 sample frames per block -> block_size=36 bytes per channel
- * Most PC sound software uses 2040+1 sample frames per block -> block_size=1024 bytes per channel
- */
- if((size%(36*OrigChannels)) != 0)
- return AL_INVALID_VALUE;
-
- newsize = size / 36;
- newsize *= 65;
- newsize *= NewBytes;
- if(newsize > INT_MAX)
- return AL_OUT_OF_MEMORY;
-
- temp = realloc(ALBuf->data, newsize);
- if(!temp && newsize) return AL_OUT_OF_MEMORY;
- ALBuf->data = temp;
- ALBuf->size = newsize;
-
- if(data != NULL)
- ConvertDataIMA4(ALBuf->data, DstType, data, OrigChannels,
- newsize/(65*NewChannels*NewBytes));
-
- ALBuf->OriginalChannels = SrcChannels;
- ALBuf->OriginalType = SrcType;
- ALBuf->OriginalSize = size;
- ALBuf->OriginalAlign = 36 * OrigChannels;
- }
- else
- {
- ALuint OrigBytes = BytesFromUserFmt(SrcType);
- ALuint OrigChannels = ChannelsFromUserFmt(SrcChannels);
-
- if((size%(OrigBytes*OrigChannels)) != 0)
- return AL_INVALID_VALUE;
-
- newsize = size / OrigBytes;
- newsize *= NewBytes;
- if(newsize > INT_MAX)
- return AL_OUT_OF_MEMORY;
-
- temp = realloc(ALBuf->data, newsize);
- if(!temp && newsize) return AL_OUT_OF_MEMORY;
- ALBuf->data = temp;
- ALBuf->size = newsize;
-
- if(data != NULL)
- ConvertData(ALBuf->data, DstType, data, SrcType, newsize/NewBytes);
-
- ALBuf->OriginalChannels = SrcChannels;
- ALBuf->OriginalType = SrcType;
- ALBuf->OriginalSize = size;
- ALBuf->OriginalAlign = OrigBytes * OrigChannels;
- }
-
- ALBuf->Frequency = freq;
- ALBuf->FmtChannels = DstChannels;
- ALBuf->FmtType = DstType;
-
- ALBuf->LoopStart = 0;
- ALBuf->LoopEnd = newsize / NewChannels / NewBytes;
-
- return AL_NO_ERROR;
-}
-
-
-ALuint BytesFromUserFmt(enum UserFmtType type)
-{
- switch(type)
- {
- case UserFmtByte: return sizeof(ALbyte);
- case UserFmtUByte: return sizeof(ALubyte);
- case UserFmtShort: return sizeof(ALshort);
- case UserFmtUShort: return sizeof(ALushort);
- case UserFmtInt: return sizeof(ALint);
- case UserFmtUInt: return sizeof(ALuint);
- case UserFmtFloat: return sizeof(ALfp);
- case UserFmtDouble: return sizeof(ALdfp);
- case UserFmtMulaw: return sizeof(ALubyte);
- case UserFmtIMA4: break; /* not handled here */
- }
- return 0;
-}
-ALuint ChannelsFromUserFmt(enum UserFmtChannels chans)
-{
- switch(chans)
- {
- case UserFmtMono: return 1;
- case UserFmtStereo: return 2;
- case UserFmtRear: return 2;
- case UserFmtQuad: return 4;
- case UserFmtX51: return 6;
- case UserFmtX61: return 7;
- case UserFmtX71: return 8;
- }
- return 0;
-}
-ALboolean DecomposeUserFormat(ALenum format, enum UserFmtChannels *chans,
- enum UserFmtType *type)
-{
- switch(format)
- {
- case AL_FORMAT_MONO8:
- *chans = UserFmtMono;
- *type = UserFmtUByte;
- return AL_TRUE;
- case AL_FORMAT_MONO16:
- *chans = UserFmtMono;
- *type = UserFmtShort;
- return AL_TRUE;
- case AL_FORMAT_MONO_FLOAT32:
- *chans = UserFmtMono;
- *type = UserFmtFloat;
- return AL_TRUE;
- case AL_FORMAT_MONO_DOUBLE_EXT:
- *chans = UserFmtMono;
- *type = UserFmtDouble;
- return AL_TRUE;
- case AL_FORMAT_MONO_IMA4:
- *chans = UserFmtMono;
- *type = UserFmtIMA4;
- return AL_TRUE;
- case AL_FORMAT_STEREO8:
- *chans = UserFmtStereo;
- *type = UserFmtUByte;
- return AL_TRUE;
- case AL_FORMAT_STEREO16:
- *chans = UserFmtStereo;
- *type = UserFmtShort;
- return AL_TRUE;
- case AL_FORMAT_STEREO_FLOAT32:
- *chans = UserFmtStereo;
- *type = UserFmtFloat;
- return AL_TRUE;
- case AL_FORMAT_STEREO_DOUBLE_EXT:
- *chans = UserFmtStereo;
- *type = UserFmtDouble;
- return AL_TRUE;
- case AL_FORMAT_STEREO_IMA4:
- *chans = UserFmtStereo;
- *type = UserFmtIMA4;
- return AL_TRUE;
- case AL_FORMAT_QUAD8_LOKI:
- case AL_FORMAT_QUAD8:
- *chans = UserFmtQuad;
- *type = UserFmtUByte;
- return AL_TRUE;
- case AL_FORMAT_QUAD16_LOKI:
- case AL_FORMAT_QUAD16:
- *chans = UserFmtQuad;
- *type = UserFmtShort;
- return AL_TRUE;
- case AL_FORMAT_QUAD32:
- *chans = UserFmtQuad;
- *type = UserFmtFloat;
- return AL_TRUE;
- case AL_FORMAT_REAR8:
- *chans = UserFmtRear;
- *type = UserFmtUByte;
- return AL_TRUE;
- case AL_FORMAT_REAR16:
- *chans = UserFmtRear;
- *type = UserFmtShort;
- return AL_TRUE;
- case AL_FORMAT_REAR32:
- *chans = UserFmtRear;
- *type = UserFmtFloat;
- return AL_TRUE;
- case AL_FORMAT_51CHN8:
- *chans = UserFmtX51;
- *type = UserFmtUByte;
- return AL_TRUE;
- case AL_FORMAT_51CHN16:
- *chans = UserFmtX51;
- *type = UserFmtShort;
- return AL_TRUE;
- case AL_FORMAT_51CHN32:
- *chans = UserFmtX51;
- *type = UserFmtFloat;
- return AL_TRUE;
- case AL_FORMAT_61CHN8:
- *chans = UserFmtX61;
- *type = UserFmtUByte;
- return AL_TRUE;
- case AL_FORMAT_61CHN16:
- *chans = UserFmtX61;
- *type = UserFmtShort;
- return AL_TRUE;
- case AL_FORMAT_61CHN32:
- *chans = UserFmtX61;
- *type = UserFmtFloat;
- return AL_TRUE;
- case AL_FORMAT_71CHN8:
- *chans = UserFmtX71;
- *type = UserFmtUByte;
- return AL_TRUE;
- case AL_FORMAT_71CHN16:
- *chans = UserFmtX71;
- *type = UserFmtShort;
- return AL_TRUE;
- case AL_FORMAT_71CHN32:
- *chans = UserFmtX71;
- *type = UserFmtFloat;
- return AL_TRUE;
- case AL_FORMAT_MONO_MULAW:
- *chans = UserFmtMono;
- *type = UserFmtMulaw;
- return AL_TRUE;
- case AL_FORMAT_STEREO_MULAW:
- *chans = UserFmtStereo;
- *type = UserFmtMulaw;
- return AL_TRUE;
- case AL_FORMAT_QUAD_MULAW:
- *chans = UserFmtQuad;
- *type = UserFmtMulaw;
- return AL_TRUE;
- case AL_FORMAT_REAR_MULAW:
- *chans = UserFmtRear;
- *type = UserFmtMulaw;
- return AL_TRUE;
- case AL_FORMAT_51CHN_MULAW:
- *chans = UserFmtX51;
- *type = UserFmtMulaw;
- return AL_TRUE;
- case AL_FORMAT_61CHN_MULAW:
- *chans = UserFmtX61;
- *type = UserFmtMulaw;
- return AL_TRUE;
- case AL_FORMAT_71CHN_MULAW:
- *chans = UserFmtX71;
- *type = UserFmtMulaw;
- return AL_TRUE;
- }
- return AL_FALSE;
-}
-
-ALuint BytesFromFmt(enum FmtType type)
-{
- switch(type)
- {
- case FmtUByte: return sizeof(ALubyte);
- case FmtShort: return sizeof(ALshort);
- case FmtFloat: return sizeof(ALfp);
- }
- return 0;
-}
-ALuint ChannelsFromFmt(enum FmtChannels chans)
-{
- switch(chans)
- {
- case FmtMono: return 1;
- case FmtStereo: return 2;
- case FmtRear: return 2;
- case FmtQuad: return 4;
- case FmtX51: return 6;
- case FmtX61: return 7;
- case FmtX71: return 8;
- }
- return 0;
-}
-ALboolean DecomposeFormat(ALenum format, enum FmtChannels *chans, enum FmtType *type)
-{
- switch(format)
- {
- case AL_FORMAT_MONO8:
- *chans = FmtMono;
- *type = FmtUByte;
- return AL_TRUE;
- case AL_FORMAT_MONO16:
- *chans = FmtMono;
- *type = FmtShort;
- return AL_TRUE;
- case AL_FORMAT_MONO_FLOAT32:
- *chans = FmtMono;
- *type = FmtFloat;
- return AL_TRUE;
- case AL_FORMAT_STEREO8:
- *chans = FmtStereo;
- *type = FmtUByte;
- return AL_TRUE;
- case AL_FORMAT_STEREO16:
- *chans = FmtStereo;
- *type = FmtShort;
- return AL_TRUE;
- case AL_FORMAT_STEREO_FLOAT32:
- *chans = FmtStereo;
- *type = FmtFloat;
- return AL_TRUE;
- case AL_FORMAT_QUAD8_LOKI:
- case AL_FORMAT_QUAD8:
- *chans = FmtQuad;
- *type = FmtUByte;
- return AL_TRUE;
- case AL_FORMAT_QUAD16_LOKI:
- case AL_FORMAT_QUAD16:
- *chans = FmtQuad;
- *type = FmtShort;
- return AL_TRUE;
- case AL_FORMAT_QUAD32:
- *chans = FmtQuad;
- *type = FmtFloat;
- return AL_TRUE;
- case AL_FORMAT_REAR8:
- *chans = FmtRear;
- *type = FmtUByte;
- return AL_TRUE;
- case AL_FORMAT_REAR16:
- *chans = FmtRear;
- *type = FmtShort;
- return AL_TRUE;
- case AL_FORMAT_REAR32:
- *chans = FmtRear;
- *type = FmtFloat;
- return AL_TRUE;
- case AL_FORMAT_51CHN8:
- *chans = FmtX51;
- *type = FmtUByte;
- return AL_TRUE;
- case AL_FORMAT_51CHN16:
- *chans = FmtX51;
- *type = FmtShort;
- return AL_TRUE;
- case AL_FORMAT_51CHN32:
- *chans = FmtX51;
- *type = FmtFloat;
- return AL_TRUE;
- case AL_FORMAT_61CHN8:
- *chans = FmtX61;
- *type = FmtUByte;
- return AL_TRUE;
- case AL_FORMAT_61CHN16:
- *chans = FmtX61;
- *type = FmtShort;
- return AL_TRUE;
- case AL_FORMAT_61CHN32:
- *chans = FmtX61;
- *type = FmtFloat;
- return AL_TRUE;
- case AL_FORMAT_71CHN8:
- *chans = FmtX71;
- *type = FmtUByte;
- return AL_TRUE;
- case AL_FORMAT_71CHN16:
- *chans = FmtX71;
- *type = FmtShort;
- return AL_TRUE;
- case AL_FORMAT_71CHN32:
- *chans = FmtX71;
- *type = FmtFloat;
- return AL_TRUE;
- }
- return AL_FALSE;
-}
-
-
-/*
- * ReleaseALBuffers()
- *
- * INTERNAL: Called to destroy any buffers that still exist on the device
- */
-ALvoid ReleaseALBuffers(ALCdevice *device)
-{
- ALsizei i;
- for(i = 0;i < device->BufferMap.size;i++)
- {
- ALbuffer *temp = device->BufferMap.array[i].value;
- device->BufferMap.array[i].value = NULL;
-
- free(temp->data);
-
- ALTHUNK_REMOVEENTRY(temp->buffer);
- memset(temp, 0, sizeof(ALbuffer));
- free(temp);
- }
-}
diff --git a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alBuffer.h b/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alBuffer.h
deleted file mode 100644
index e22d839d5..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alBuffer.h
+++ /dev/null
@@ -1,98 +0,0 @@
-#ifndef _AL_BUFFER_H_
-#define _AL_BUFFER_H_
-
-#include "AL/al.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Input formats (some are currently theoretical) */
-enum UserFmtType {
- UserFmtByte, /* AL_BYTE */
- UserFmtUByte, /* AL_UNSIGNED_BYTE */
- UserFmtShort, /* AL_SHORT */
- UserFmtUShort, /* AL_UNSIGNED_SHORT */
- UserFmtInt, /* AL_INT */
- UserFmtUInt, /* AL_UNSIGNED_INT */
- UserFmtFloat, /* AL_FLOAT */
- UserFmtDouble, /* AL_DOUBLE */
- UserFmtMulaw, /* AL_MULAW */
- UserFmtIMA4, /* AL_IMA4 */
-};
-enum UserFmtChannels {
- UserFmtMono, /* AL_MONO */
- UserFmtStereo, /* AL_STEREO */
- UserFmtRear, /* AL_REAR */
- UserFmtQuad, /* AL_QUAD */
- UserFmtX51, /* AL_5POINT1 (WFX order) */
- UserFmtX61, /* AL_6POINT1 (WFX order) */
- UserFmtX71, /* AL_7POINT1 (WFX order) */
-};
-
-ALboolean DecomposeUserFormat(ALenum format, enum UserFmtChannels *chans,
- enum UserFmtType *type);
-ALuint BytesFromUserFmt(enum UserFmtType type);
-ALuint ChannelsFromUserFmt(enum UserFmtChannels chans);
-static __inline ALuint FrameSizeFromUserFmt(enum UserFmtChannels chans,
- enum UserFmtType type)
-{
- return ChannelsFromUserFmt(chans) * BytesFromUserFmt(type);
-}
-
-
-/* Storable formats */
-enum FmtType {
- FmtUByte = UserFmtUByte,
- FmtShort = UserFmtShort,
- FmtFloat = UserFmtFloat,
-};
-enum FmtChannels {
- FmtMono = UserFmtMono,
- FmtStereo = UserFmtStereo,
- FmtRear = UserFmtRear,
- FmtQuad = UserFmtQuad,
- FmtX51 = UserFmtX51,
- FmtX61 = UserFmtX61,
- FmtX71 = UserFmtX71,
-};
-
-ALboolean DecomposeFormat(ALenum format, enum FmtChannels *chans, enum FmtType *type);
-ALuint BytesFromFmt(enum FmtType type);
-ALuint ChannelsFromFmt(enum FmtChannels chans);
-static __inline ALuint FrameSizeFromFmt(enum FmtChannels chans, enum FmtType type)
-{
- return ChannelsFromFmt(chans) * BytesFromFmt(type);
-}
-
-
-typedef struct ALbuffer
-{
- ALvoid *data;
- ALsizei size;
-
- ALsizei Frequency;
- enum FmtChannels FmtChannels;
- enum FmtType FmtType;
-
- enum UserFmtChannels OriginalChannels;
- enum UserFmtType OriginalType;
- ALsizei OriginalSize;
- ALsizei OriginalAlign;
-
- ALsizei LoopStart;
- ALsizei LoopEnd;
-
- ALuint refcount; // Number of sources using this buffer (deletion can only occur when this is 0)
-
- // Index to itself
- ALuint buffer;
-} ALbuffer;
-
-ALvoid ReleaseALBuffers(ALCdevice *device);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alDatabuffer.c b/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alDatabuffer.c
deleted file mode 100644
index cbe65a096..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alDatabuffer.c
+++ /dev/null
@@ -1,648 +0,0 @@
-/**
- * OpenAL cross platform audio library
- * Copyright (C) 1999-2007 by authors.
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- * Or go to http://www.gnu.org/copyleft/lgpl.html
- */
-
-#include "config.h"
-
-#include
-#include
-#include
-#include "alMain.h"
-#include "AL/al.h"
-#include "AL/alc.h"
-#include "AL/alext.h"
-#include "alError.h"
-#include "alDatabuffer.h"
-#include "alThunk.h"
-
-
-#define LookupDatabuffer(m, k) ((ALdatabuffer*)LookupUIntMapKey(&(m), (k)))
-
-/*
-* alGenDatabuffersEXT(ALsizei n, ALuint *puiBuffers)
-*
-* Generates n AL Databuffers, and stores the Databuffers Names in the array pointed to by puiBuffers
-*/
-AL_API ALvoid AL_APIENTRY alGenDatabuffersEXT(ALsizei n,ALuint *puiBuffers)
-{
- ALCcontext *Context;
- ALsizei i=0;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- /* Check that we are actually generation some Databuffers */
- if(n < 0 || IsBadWritePtr((void*)puiBuffers, n * sizeof(ALuint)))
- alSetError(Context, AL_INVALID_VALUE);
- else
- {
- ALCdevice *device = Context->Device;
- ALenum err;
-
- /* Create all the new Databuffers */
- while(i < n)
- {
- ALdatabuffer *buffer = calloc(1, sizeof(ALdatabuffer));
- if(!buffer)
- {
- alSetError(Context, AL_OUT_OF_MEMORY);
- alDeleteDatabuffersEXT(i, puiBuffers);
- break;
- }
-
- buffer->databuffer = ALTHUNK_ADDENTRY(buffer);
- err = InsertUIntMapEntry(&device->DatabufferMap,
- buffer->databuffer, buffer);
- if(err != AL_NO_ERROR)
- {
- ALTHUNK_REMOVEENTRY(buffer->databuffer);
- memset(buffer, 0, sizeof(ALdatabuffer));
- free(buffer);
-
- alSetError(Context, err);
- alDeleteDatabuffersEXT(i, puiBuffers);
- break;
- }
- puiBuffers[i++] = buffer->databuffer;
-
- buffer->state = UNMAPPED;
- }
- }
-
- ProcessContext(Context);
-}
-
-/*
-* alDatabeleteBuffersEXT(ALsizei n, ALuint *puiBuffers)
-*
-* Deletes the n AL Databuffers pointed to by puiBuffers
-*/
-AL_API ALvoid AL_APIENTRY alDeleteDatabuffersEXT(ALsizei n, const ALuint *buffers)
-{
- ALCcontext *Context;
- ALCdevice *device;
- ALdatabuffer *ALBuf;
- ALboolean Failed;
- ALsizei i;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- /* Check we are actually Deleting some Databuffers */
- Failed = AL_TRUE;
- device = Context->Device;
- if(n < 0)
- alSetError(Context, AL_INVALID_VALUE);
- else
- {
- Failed = AL_FALSE;
- /* Check that all the databuffers are valid and can actually be
- * deleted */
- for(i = 0;i < n;i++)
- {
- if(!buffers[i])
- continue;
-
- /* Check for valid Buffer ID */
- if((ALBuf=LookupDatabuffer(device->DatabufferMap, buffers[i])) == NULL)
- {
- /* Invalid Databuffer */
- alSetError(Context, AL_INVALID_NAME);
- Failed = AL_TRUE;
- break;
- }
- else if(ALBuf->state != UNMAPPED)
- {
- /* Databuffer still in use, cannot be deleted */
- alSetError(Context, AL_INVALID_OPERATION);
- Failed = AL_TRUE;
- break;
- }
- }
- }
-
- /* If all the Databuffers were valid (and unmapped), then we can delete them */
- if(!Failed)
- {
- for(i = 0;i < n;i++)
- {
- if((ALBuf=LookupDatabuffer(device->DatabufferMap, buffers[i])) == NULL)
- continue;
-
- if(ALBuf == Context->SampleSource)
- Context->SampleSource = NULL;
- if(ALBuf == Context->SampleSink)
- Context->SampleSink = NULL;
-
- // Release the memory used to store audio data
- free(ALBuf->data);
-
- // Release buffer structure
- RemoveUIntMapKey(&device->DatabufferMap, ALBuf->databuffer);
- ALTHUNK_REMOVEENTRY(ALBuf->databuffer);
-
- memset(ALBuf, 0, sizeof(ALdatabuffer));
- free(ALBuf);
- }
- }
-
- ProcessContext(Context);
-}
-
-/*
-* alIsDatabufferEXT(ALuint uiBuffer)
-*
-* Checks if ulBuffer is a valid Databuffer Name
-*/
-AL_API ALboolean AL_APIENTRY alIsDatabufferEXT(ALuint buffer)
-{
- ALCcontext *Context;
- ALboolean result;
- ALCdevice *device;
-
- Context = GetContextSuspended();
- if(!Context) return AL_FALSE;
-
- device = Context->Device;
- result = ((!buffer || LookupDatabuffer(device->DatabufferMap, buffer)) ?
- AL_TRUE : AL_FALSE);
-
- ProcessContext(Context);
-
- return result;
-}
-
-/*
-* alDatabufferDataEXT(ALuint buffer,ALvoid *data,ALsizei size,ALenum usage)
-*
-* Fill databuffer with data
-*/
-AL_API ALvoid AL_APIENTRY alDatabufferDataEXT(ALuint buffer,const ALvoid *data,ALsizeiptrEXT size,ALenum usage)
-{
- ALCcontext *Context;
- ALdatabuffer *ALBuf;
- ALCdevice *Device;
- ALvoid *temp;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- Device = Context->Device;
- if((ALBuf=LookupDatabuffer(Device->DatabufferMap, buffer)) != NULL)
- {
- if(ALBuf->state == UNMAPPED)
- {
- if(usage == AL_STREAM_WRITE_EXT || usage == AL_STREAM_READ_EXT ||
- usage == AL_STREAM_COPY_EXT || usage == AL_STATIC_WRITE_EXT ||
- usage == AL_STATIC_READ_EXT || usage == AL_STATIC_COPY_EXT ||
- usage == AL_DYNAMIC_WRITE_EXT || usage == AL_DYNAMIC_READ_EXT ||
- usage == AL_DYNAMIC_COPY_EXT)
- {
- if(size >= 0)
- {
- /* (Re)allocate data */
- temp = realloc(ALBuf->data, size);
- if(temp)
- {
- ALBuf->data = temp;
- ALBuf->size = size;
- ALBuf->usage = usage;
- if(data)
- memcpy(ALBuf->data, data, size);
- }
- else
- alSetError(Context, AL_OUT_OF_MEMORY);
- }
- else
- alSetError(Context, AL_INVALID_VALUE);
- }
- else
- alSetError(Context, AL_INVALID_ENUM);
- }
- else
- alSetError(Context, AL_INVALID_OPERATION);
- }
- else
- alSetError(Context, AL_INVALID_NAME);
-
- ProcessContext(Context);
-}
-
-AL_API ALvoid AL_APIENTRY alDatabufferSubDataEXT(ALuint uiBuffer, ALintptrEXT start, ALsizeiptrEXT length, const ALvoid *data)
-{
- ALCcontext *pContext;
- ALdatabuffer *pBuffer;
- ALCdevice *Device;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- Device = pContext->Device;
- if((pBuffer=LookupDatabuffer(Device->DatabufferMap, uiBuffer)) != NULL)
- {
- if(start >= 0 && length >= 0 && start+length <= pBuffer->size)
- {
- if(pBuffer->state == UNMAPPED)
- memcpy(pBuffer->data+start, data, length);
- else
- alSetError(pContext, AL_INVALID_OPERATION);
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
- }
- else
- alSetError(pContext, AL_INVALID_NAME);
-
- ProcessContext(pContext);
-}
-
-AL_API ALvoid AL_APIENTRY alGetDatabufferSubDataEXT(ALuint uiBuffer, ALintptrEXT start, ALsizeiptrEXT length, ALvoid *data)
-{
- ALCcontext *pContext;
- ALdatabuffer *pBuffer;
- ALCdevice *Device;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- Device = pContext->Device;
- if((pBuffer=LookupDatabuffer(Device->DatabufferMap, uiBuffer)) != NULL)
- {
- if(start >= 0 && length >= 0 && start+length <= pBuffer->size)
- {
- if(pBuffer->state == UNMAPPED)
- memcpy(data, pBuffer->data+start, length);
- else
- alSetError(pContext, AL_INVALID_OPERATION);
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
- }
- else
- alSetError(pContext, AL_INVALID_NAME);
-
- ProcessContext(pContext);
-}
-
-
-AL_API ALvoid AL_APIENTRY alDatabufferfEXT(ALuint buffer, ALenum eParam, ALfloat flValue)
-{
- ALCcontext *pContext;
- ALCdevice *Device;
-
- (void)flValue;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- Device = pContext->Device;
- if(LookupDatabuffer(Device->DatabufferMap, buffer) != NULL)
- {
- switch(eParam)
- {
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(pContext, AL_INVALID_NAME);
-
- ProcessContext(pContext);
-}
-
-AL_API ALvoid AL_APIENTRY alDatabufferfvEXT(ALuint buffer, ALenum eParam, const ALfloat* flValues)
-{
- ALCcontext *pContext;
- ALCdevice *Device;
-
- (void)flValues;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- Device = pContext->Device;
- if(LookupDatabuffer(Device->DatabufferMap, buffer) != NULL)
- {
- switch(eParam)
- {
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(pContext, AL_INVALID_NAME);
-
- ProcessContext(pContext);
-}
-
-
-AL_API ALvoid AL_APIENTRY alDatabufferiEXT(ALuint buffer, ALenum eParam, ALint lValue)
-{
- ALCcontext *pContext;
- ALCdevice *Device;
-
- (void)lValue;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- Device = pContext->Device;
- if(LookupDatabuffer(Device->DatabufferMap, buffer) != NULL)
- {
- switch(eParam)
- {
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(pContext, AL_INVALID_NAME);
-
- ProcessContext(pContext);
-}
-
-AL_API ALvoid AL_APIENTRY alDatabufferivEXT(ALuint buffer, ALenum eParam, const ALint* plValues)
-{
- ALCcontext *pContext;
- ALCdevice *Device;
-
- (void)plValues;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- Device = pContext->Device;
- if(LookupDatabuffer(Device->DatabufferMap, buffer) != NULL)
- {
- switch(eParam)
- {
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(pContext, AL_INVALID_NAME);
-
- ProcessContext(pContext);
-}
-
-
-AL_API ALvoid AL_APIENTRY alGetDatabufferfEXT(ALuint buffer, ALenum eParam, ALfloat *pflValue)
-{
- ALCcontext *pContext;
- ALCdevice *Device;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- if(pflValue)
- {
- Device = pContext->Device;
- if(LookupDatabuffer(Device->DatabufferMap, buffer) != NULL)
- {
- switch(eParam)
- {
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(pContext, AL_INVALID_NAME);
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
-
- ProcessContext(pContext);
-}
-
-AL_API ALvoid AL_APIENTRY alGetDatabufferfvEXT(ALuint buffer, ALenum eParam, ALfloat* pflValues)
-{
- ALCcontext *pContext;
- ALCdevice *Device;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- if(pflValues)
- {
- Device = pContext->Device;
- if(LookupDatabuffer(Device->DatabufferMap, buffer) != NULL)
- {
- switch(eParam)
- {
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(pContext, AL_INVALID_NAME);
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
-
- ProcessContext(pContext);
-}
-
-AL_API ALvoid AL_APIENTRY alGetDatabufferiEXT(ALuint buffer, ALenum eParam, ALint *plValue)
-{
- ALCcontext *pContext;
- ALdatabuffer *pBuffer;
- ALCdevice *Device;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- if(plValue)
- {
- Device = pContext->Device;
- if((pBuffer=LookupDatabuffer(Device->DatabufferMap, buffer)) != NULL)
- {
- switch(eParam)
- {
- case AL_SIZE:
- *plValue = (ALint)pBuffer->size;
- break;
-
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(pContext, AL_INVALID_NAME);
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
-
- ProcessContext(pContext);
-}
-
-AL_API ALvoid AL_APIENTRY alGetDatabufferivEXT(ALuint buffer, ALenum eParam, ALint* plValues)
-{
- ALCcontext *pContext;
- ALCdevice *Device;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- if(plValues)
- {
- Device = pContext->Device;
- if(LookupDatabuffer(Device->DatabufferMap, buffer) != NULL)
- {
- switch (eParam)
- {
- case AL_SIZE:
- alGetDatabufferiEXT(buffer, eParam, plValues);
- break;
-
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(pContext, AL_INVALID_NAME);
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
-
- ProcessContext(pContext);
-}
-
-
-AL_API ALvoid AL_APIENTRY alSelectDatabufferEXT(ALenum target, ALuint uiBuffer)
-{
- ALCcontext *pContext;
- ALdatabuffer *pBuffer = NULL;
- ALCdevice *Device;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- Device = pContext->Device;
- if(uiBuffer == 0 ||
- (pBuffer=LookupDatabuffer(Device->DatabufferMap, uiBuffer)) != NULL)
- {
- if(target == AL_SAMPLE_SOURCE_EXT)
- pContext->SampleSource = pBuffer;
- else if(target == AL_SAMPLE_SINK_EXT)
- pContext->SampleSink = pBuffer;
- else
- alSetError(pContext, AL_INVALID_VALUE);
- }
- else
- alSetError(pContext, AL_INVALID_NAME);
-
- ProcessContext(pContext);
-}
-
-
-AL_API ALvoid* AL_APIENTRY alMapDatabufferEXT(ALuint uiBuffer, ALintptrEXT start, ALsizeiptrEXT length, ALenum access)
-{
- ALCcontext *pContext;
- ALdatabuffer *pBuffer;
- ALvoid *ret = NULL;
- ALCdevice *Device;
-
- pContext = GetContextSuspended();
- if(!pContext) return NULL;
-
- Device = pContext->Device;
- if((pBuffer=LookupDatabuffer(Device->DatabufferMap, uiBuffer)) != NULL)
- {
- if(start >= 0 && length >= 0 && start+length <= pBuffer->size)
- {
- if(access == AL_READ_ONLY_EXT || access == AL_WRITE_ONLY_EXT ||
- access == AL_READ_WRITE_EXT)
- {
- if(pBuffer->state == UNMAPPED)
- {
- ret = pBuffer->data + start;
- pBuffer->state = MAPPED;
- }
- else
- alSetError(pContext, AL_INVALID_OPERATION);
- }
- else
- alSetError(pContext, AL_INVALID_ENUM);
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
- }
- else
- alSetError(pContext, AL_INVALID_NAME);
-
- ProcessContext(pContext);
-
- return ret;
-}
-
-AL_API ALvoid AL_APIENTRY alUnmapDatabufferEXT(ALuint uiBuffer)
-{
- ALCcontext *pContext;
- ALdatabuffer *pBuffer;
- ALCdevice *Device;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- Device = pContext->Device;
- if((pBuffer=LookupDatabuffer(Device->DatabufferMap, uiBuffer)) != NULL)
- {
- if(pBuffer->state == MAPPED)
- pBuffer->state = UNMAPPED;
- else
- alSetError(pContext, AL_INVALID_OPERATION);
- }
- else
- alSetError(pContext, AL_INVALID_NAME);
-
- ProcessContext(pContext);
-}
-
-
-/*
-* ReleaseALDatabuffers()
-*
-* INTERNAL FN : Called by DLLMain on exit to destroy any buffers that still exist
-*/
-ALvoid ReleaseALDatabuffers(ALCdevice *device)
-{
- ALsizei i;
- for(i = 0;i < device->DatabufferMap.size;i++)
- {
- ALdatabuffer *temp = device->DatabufferMap.array[i].value;
- device->DatabufferMap.array[i].value = NULL;
-
- // Release buffer data
- free(temp->data);
-
- // Release Buffer structure
- ALTHUNK_REMOVEENTRY(temp->databuffer);
- memset(temp, 0, sizeof(ALdatabuffer));
- free(temp);
- }
-}
diff --git a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alDatabuffer.h b/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alDatabuffer.h
deleted file mode 100644
index 221855283..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alDatabuffer.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef _AL_DATABUFFER_H_
-#define _AL_DATABUFFER_H_
-
-#include "AL/al.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define UNMAPPED 0
-#define MAPPED 1
-
-typedef struct ALdatabuffer
-{
- ALubyte *data;
- ALintptrEXT size;
-
- ALenum state;
- ALenum usage;
-
- /* Index to self */
- ALuint databuffer;
-
- struct ALdatabuffer *next;
-} ALdatabuffer;
-
-ALvoid ReleaseALDatabuffers(ALCdevice *device);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alEffect.c b/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alEffect.c
deleted file mode 100644
index cb07e2164..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alEffect.c
+++ /dev/null
@@ -1,1377 +0,0 @@
-/**
- * OpenAL cross platform audio library
- * Copyright (C) 1999-2007 by authors.
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- * Or go to http://www.gnu.org/copyleft/lgpl.html
- */
-
-#include "config.h"
-
-#include
-#include
-
-#include "AL/al.h"
-#include "AL/alc.h"
-#include "alMain.h"
-#include "alEffect.h"
-#include "alThunk.h"
-#include "alError.h"
-
-
-ALboolean DisabledEffects[MAX_EFFECTS];
-
-
-static void InitEffectParams(ALeffect *effect, ALenum type);
-
-#define LookupEffect(m, k) ((ALeffect*)LookupUIntMapKey(&(m), (k)))
-
-AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects)
-{
- ALCcontext *Context;
- ALsizei i=0;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- if(n < 0 || IsBadWritePtr((void*)effects, n * sizeof(ALuint)))
- alSetError(Context, AL_INVALID_VALUE);
- else
- {
- ALCdevice *device = Context->Device;
- ALenum err;
-
- while(i < n)
- {
- ALeffect *effect = calloc(1, sizeof(ALeffect));
- if(!effect)
- {
- alSetError(Context, AL_OUT_OF_MEMORY);
- alDeleteEffects(i, effects);
- break;
- }
-
- effect->effect = ALTHUNK_ADDENTRY(effect);
- err = InsertUIntMapEntry(&device->EffectMap, effect->effect, effect);
- if(err != AL_NO_ERROR)
- {
- ALTHUNK_REMOVEENTRY(effect->effect);
- memset(effect, 0, sizeof(ALeffect));
- free(effect);
-
- alSetError(Context, err);
- alDeleteEffects(i, effects);
- break;
- }
-
- effects[i++] = effect->effect;
- InitEffectParams(effect, AL_EFFECT_NULL);
- }
- }
-
- ProcessContext(Context);
-}
-
-AL_API ALvoid AL_APIENTRY alDeleteEffects(ALsizei n, ALuint *effects)
-{
- ALCcontext *Context;
- ALCdevice *device;
- ALeffect *ALEffect;
- ALboolean Failed;
- ALsizei i;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- Failed = AL_TRUE;
- device = Context->Device;
- if(n < 0)
- alSetError(Context, AL_INVALID_VALUE);
- else
- {
- Failed = AL_FALSE;
- // Check that all effects are valid
- for(i = 0;i < n;i++)
- {
- if(!effects[i])
- continue;
-
- if(LookupEffect(device->EffectMap, effects[i]) == NULL)
- {
- alSetError(Context, AL_INVALID_NAME);
- Failed = AL_TRUE;
- break;
- }
- }
- }
-
- if(!Failed)
- {
- // All effects are valid
- for(i = 0;i < n;i++)
- {
- // Recheck that the effect is valid, because there could be duplicated names
- if((ALEffect=LookupEffect(device->EffectMap, effects[i])) == NULL)
- continue;
-
- RemoveUIntMapKey(&device->EffectMap, ALEffect->effect);
- ALTHUNK_REMOVEENTRY(ALEffect->effect);
-
- memset(ALEffect, 0, sizeof(ALeffect));
- free(ALEffect);
- }
- }
-
- ProcessContext(Context);
-}
-
-AL_API ALboolean AL_APIENTRY alIsEffect(ALuint effect)
-{
- ALCcontext *Context;
- ALboolean result;
-
- Context = GetContextSuspended();
- if(!Context) return AL_FALSE;
-
- result = ((!effect || LookupEffect(Context->Device->EffectMap, effect)) ?
- AL_TRUE : AL_FALSE);
-
- ProcessContext(Context);
-
- return result;
-}
-
-AL_API ALvoid AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint iValue)
-{
- ALCcontext *Context;
- ALCdevice *Device;
- ALeffect *ALEffect;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- Device = Context->Device;
- if((ALEffect=LookupEffect(Device->EffectMap, effect)) != NULL)
- {
- if(param == AL_EFFECT_TYPE)
- {
- ALboolean isOk = (iValue == AL_EFFECT_NULL ||
- (iValue == AL_EFFECT_EAXREVERB && !DisabledEffects[EAXREVERB]) ||
- (iValue == AL_EFFECT_REVERB && !DisabledEffects[REVERB]) ||
- (iValue == AL_EFFECT_ECHO && !DisabledEffects[ECHO]) ||
- (iValue == AL_EFFECT_RING_MODULATOR && !DisabledEffects[MODULATOR]));
-
- if(isOk)
- InitEffectParams(ALEffect, iValue);
- else
- alSetError(Context, AL_INVALID_VALUE);
- }
- else if(ALEffect->type == AL_EFFECT_EAXREVERB)
- {
- switch(param)
- {
- case AL_EAXREVERB_DECAY_HFLIMIT:
- if(iValue >= AL_EAXREVERB_MIN_DECAY_HFLIMIT &&
- iValue <= AL_EAXREVERB_MAX_DECAY_HFLIMIT)
- ALEffect->Reverb.DecayHFLimit = iValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else if(ALEffect->type == AL_EFFECT_REVERB)
- {
- switch(param)
- {
- case AL_REVERB_DECAY_HFLIMIT:
- if(iValue >= AL_REVERB_MIN_DECAY_HFLIMIT &&
- iValue <= AL_REVERB_MAX_DECAY_HFLIMIT)
- ALEffect->Reverb.DecayHFLimit = iValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else if(ALEffect->type == AL_EFFECT_ECHO)
- {
- switch(param)
- {
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else if(ALEffect->type == AL_EFFECT_RING_MODULATOR)
- {
- switch(param)
- {
- case AL_RING_MODULATOR_FREQUENCY:
- case AL_RING_MODULATOR_HIGHPASS_CUTOFF:
- alEffectf(effect, param, (ALfloat)iValue);
- break;
-
- case AL_RING_MODULATOR_WAVEFORM:
- if(iValue >= AL_RING_MODULATOR_MIN_WAVEFORM &&
- iValue <= AL_RING_MODULATOR_MAX_WAVEFORM)
- ALEffect->Modulator.Waveform = iValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(Context, AL_INVALID_ENUM);
- }
- else
- alSetError(Context, AL_INVALID_NAME);
-
- ProcessContext(Context);
-}
-
-AL_API ALvoid AL_APIENTRY alEffectiv(ALuint effect, ALenum param, ALint *piValues)
-{
- ALCcontext *Context;
- ALCdevice *Device;
- ALeffect *ALEffect;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- Device = Context->Device;
- if((ALEffect=LookupEffect(Device->EffectMap, effect)) != NULL)
- {
- if(param == AL_EFFECT_TYPE)
- {
- alEffecti(effect, param, piValues[0]);
- }
- else if(ALEffect->type == AL_EFFECT_EAXREVERB)
- {
- switch(param)
- {
- case AL_EAXREVERB_DECAY_HFLIMIT:
- alEffecti(effect, param, piValues[0]);
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else if(ALEffect->type == AL_EFFECT_REVERB)
- {
- switch(param)
- {
- case AL_REVERB_DECAY_HFLIMIT:
- alEffecti(effect, param, piValues[0]);
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else if(ALEffect->type == AL_EFFECT_ECHO)
- {
- switch(param)
- {
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else if(ALEffect->type == AL_EFFECT_RING_MODULATOR)
- {
- switch(param)
- {
- case AL_RING_MODULATOR_FREQUENCY:
- case AL_RING_MODULATOR_HIGHPASS_CUTOFF:
- case AL_RING_MODULATOR_WAVEFORM:
- alEffecti(effect, param, piValues[0]);
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(Context, AL_INVALID_ENUM);
- }
- else
- alSetError(Context, AL_INVALID_NAME);
-
- ProcessContext(Context);
-}
-
-AL_API ALvoid AL_APIENTRY alEffectf(ALuint effect, ALenum param, ALfloat flArg)
-{
- ALCcontext *Context;
- ALCdevice *Device;
- ALeffect *ALEffect;
- ALfp flValue = float2ALfp(flArg);
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- Device = Context->Device;
- if((ALEffect=LookupEffect(Device->EffectMap, effect)) != NULL)
- {
- if(ALEffect->type == AL_EFFECT_EAXREVERB)
- {
- switch(param)
- {
- case AL_EAXREVERB_DENSITY:
- if(flValue >= float2ALfp(AL_EAXREVERB_MIN_DENSITY) &&
- flValue <= float2ALfp(AL_EAXREVERB_MAX_DENSITY))
- ALEffect->Reverb.Density = flValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- case AL_EAXREVERB_DIFFUSION:
- if(flValue >= float2ALfp(AL_EAXREVERB_MIN_DIFFUSION) &&
- flValue <= float2ALfp(AL_EAXREVERB_MAX_DIFFUSION))
- ALEffect->Reverb.Diffusion = flValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- case AL_EAXREVERB_GAIN:
- if(flValue >= float2ALfp(AL_EAXREVERB_MIN_GAIN) &&
- flValue <= float2ALfp(AL_EAXREVERB_MAX_GAIN))
- ALEffect->Reverb.Gain = flValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- case AL_EAXREVERB_GAINHF:
- if(flValue >= float2ALfp(AL_EAXREVERB_MIN_GAINHF) &&
- flValue <= float2ALfp(AL_EAXREVERB_MAX_GAIN))
- ALEffect->Reverb.GainHF = flValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- case AL_EAXREVERB_GAINLF:
- if(flValue >= float2ALfp(AL_EAXREVERB_MIN_GAINLF) &&
- flValue <= float2ALfp(AL_EAXREVERB_MAX_GAINLF))
- ALEffect->Reverb.GainLF = flValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- case AL_EAXREVERB_DECAY_TIME:
- if(flValue >= float2ALfp(AL_EAXREVERB_MIN_DECAY_TIME) &&
- flValue <= float2ALfp(AL_EAXREVERB_MAX_DECAY_TIME))
- ALEffect->Reverb.DecayTime = flValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- case AL_EAXREVERB_DECAY_HFRATIO:
- if(flValue >= float2ALfp(AL_EAXREVERB_MIN_DECAY_HFRATIO) &&
- flValue <= float2ALfp(AL_EAXREVERB_MAX_DECAY_HFRATIO))
- ALEffect->Reverb.DecayHFRatio = flValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- case AL_EAXREVERB_DECAY_LFRATIO:
- if(flValue >= float2ALfp(AL_EAXREVERB_MIN_DECAY_LFRATIO) &&
- flValue <= float2ALfp(AL_EAXREVERB_MAX_DECAY_LFRATIO))
- ALEffect->Reverb.DecayLFRatio = flValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- case AL_EAXREVERB_REFLECTIONS_GAIN:
- if(flValue >= float2ALfp(AL_EAXREVERB_MIN_REFLECTIONS_GAIN) &&
- flValue <= float2ALfp(AL_EAXREVERB_MAX_REFLECTIONS_GAIN))
- ALEffect->Reverb.ReflectionsGain = flValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- case AL_EAXREVERB_REFLECTIONS_DELAY:
- if(flValue >= float2ALfp(AL_EAXREVERB_MIN_REFLECTIONS_DELAY) &&
- flValue <= float2ALfp(AL_EAXREVERB_MAX_REFLECTIONS_DELAY))
- ALEffect->Reverb.ReflectionsDelay = flValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- case AL_EAXREVERB_LATE_REVERB_GAIN:
- if(flValue >= float2ALfp(AL_EAXREVERB_MIN_LATE_REVERB_GAIN) &&
- flValue <= float2ALfp(AL_EAXREVERB_MAX_LATE_REVERB_GAIN))
- ALEffect->Reverb.LateReverbGain = flValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- case AL_EAXREVERB_LATE_REVERB_DELAY:
- if(flValue >= float2ALfp(AL_EAXREVERB_MIN_LATE_REVERB_DELAY) &&
- flValue <= float2ALfp(AL_EAXREVERB_MAX_LATE_REVERB_DELAY))
- ALEffect->Reverb.LateReverbDelay = flValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- case AL_EAXREVERB_AIR_ABSORPTION_GAINHF:
- if(flValue >= float2ALfp(AL_EAXREVERB_MIN_AIR_ABSORPTION_GAINHF) &&
- flValue <= float2ALfp(AL_EAXREVERB_MAX_AIR_ABSORPTION_GAINHF))
- ALEffect->Reverb.AirAbsorptionGainHF = flValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- case AL_EAXREVERB_ECHO_TIME:
- if(flValue >= float2ALfp(AL_EAXREVERB_MIN_ECHO_TIME) &&
- flValue <= float2ALfp(AL_EAXREVERB_MAX_ECHO_TIME))
- ALEffect->Reverb.EchoTime = flValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- case AL_EAXREVERB_ECHO_DEPTH:
- if(flValue >= float2ALfp(AL_EAXREVERB_MIN_ECHO_DEPTH) &&
- flValue <= float2ALfp(AL_EAXREVERB_MAX_ECHO_DEPTH))
- ALEffect->Reverb.EchoDepth = flValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- case AL_EAXREVERB_MODULATION_TIME:
- if(flValue >= float2ALfp(AL_EAXREVERB_MIN_MODULATION_TIME) &&
- flValue <= float2ALfp(AL_EAXREVERB_MAX_MODULATION_TIME))
- ALEffect->Reverb.ModulationTime = flValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- case AL_EAXREVERB_MODULATION_DEPTH:
- if(flValue >= float2ALfp(AL_EAXREVERB_MIN_MODULATION_DEPTH) &&
- flValue <= float2ALfp(AL_EAXREVERB_MAX_MODULATION_DEPTH))
- ALEffect->Reverb.ModulationDepth = flValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- case AL_EAXREVERB_HFREFERENCE:
- if(flValue >= float2ALfp(AL_EAXREVERB_MIN_HFREFERENCE) &&
- flValue <= float2ALfp(AL_EAXREVERB_MAX_HFREFERENCE))
- ALEffect->Reverb.HFReference = flValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- case AL_EAXREVERB_LFREFERENCE:
- if(flValue >= float2ALfp(AL_EAXREVERB_MIN_LFREFERENCE) &&
- flValue <= float2ALfp(AL_EAXREVERB_MAX_LFREFERENCE))
- ALEffect->Reverb.LFReference = flValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- case AL_EAXREVERB_ROOM_ROLLOFF_FACTOR:
- if(flValue >= float2ALfp(0.0f) && flValue <= float2ALfp(10.0f))
- ALEffect->Reverb.RoomRolloffFactor = flValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else if(ALEffect->type == AL_EFFECT_REVERB)
- {
- switch(param)
- {
- case AL_REVERB_DENSITY:
- if(flValue >= float2ALfp(AL_REVERB_MIN_DENSITY) &&
- flValue <= float2ALfp(AL_REVERB_MAX_DENSITY))
- ALEffect->Reverb.Density = flValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- case AL_REVERB_DIFFUSION:
- if(flValue >= float2ALfp(AL_REVERB_MIN_DIFFUSION) &&
- flValue <= float2ALfp(AL_REVERB_MAX_DIFFUSION))
- ALEffect->Reverb.Diffusion = flValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- case AL_REVERB_GAIN:
- if(flValue >= float2ALfp(AL_REVERB_MIN_GAIN) &&
- flValue <= float2ALfp(AL_REVERB_MAX_GAIN))
- ALEffect->Reverb.Gain = flValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- case AL_REVERB_GAINHF:
- if(flValue >= float2ALfp(AL_REVERB_MIN_GAINHF) &&
- flValue <= float2ALfp(AL_REVERB_MAX_GAINHF))
- ALEffect->Reverb.GainHF = flValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- case AL_REVERB_DECAY_TIME:
- if(flValue >= float2ALfp(AL_REVERB_MIN_DECAY_TIME) &&
- flValue <= float2ALfp(AL_REVERB_MAX_DECAY_TIME))
- ALEffect->Reverb.DecayTime = flValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- case AL_REVERB_DECAY_HFRATIO:
- if(flValue >= float2ALfp(AL_REVERB_MIN_DECAY_HFRATIO) &&
- flValue <= float2ALfp(AL_REVERB_MAX_DECAY_HFRATIO))
- ALEffect->Reverb.DecayHFRatio = flValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- case AL_REVERB_REFLECTIONS_GAIN:
- if(flValue >= float2ALfp(AL_REVERB_MIN_REFLECTIONS_GAIN) &&
- flValue <= float2ALfp(AL_REVERB_MAX_REFLECTIONS_GAIN))
- ALEffect->Reverb.ReflectionsGain = flValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- case AL_REVERB_REFLECTIONS_DELAY:
- if(flValue >= float2ALfp(AL_REVERB_MIN_REFLECTIONS_DELAY) &&
- flValue <= float2ALfp(AL_REVERB_MAX_REFLECTIONS_DELAY))
- ALEffect->Reverb.ReflectionsDelay = flValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- case AL_REVERB_LATE_REVERB_GAIN:
- if(flValue >= float2ALfp(AL_REVERB_MIN_LATE_REVERB_GAIN) &&
- flValue <= float2ALfp(AL_REVERB_MAX_LATE_REVERB_GAIN))
- ALEffect->Reverb.LateReverbGain = flValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- case AL_REVERB_LATE_REVERB_DELAY:
- if(flValue >= float2ALfp(AL_REVERB_MIN_LATE_REVERB_DELAY) &&
- flValue <= float2ALfp(AL_REVERB_MAX_LATE_REVERB_DELAY))
- ALEffect->Reverb.LateReverbDelay = flValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- case AL_REVERB_AIR_ABSORPTION_GAINHF:
- if(flValue >= float2ALfp(AL_REVERB_MIN_AIR_ABSORPTION_GAINHF) &&
- flValue <= float2ALfp(AL_REVERB_MAX_AIR_ABSORPTION_GAINHF))
- ALEffect->Reverb.AirAbsorptionGainHF = flValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- case AL_REVERB_ROOM_ROLLOFF_FACTOR:
- if(flValue >= float2ALfp(AL_REVERB_MIN_ROOM_ROLLOFF_FACTOR) &&
- flValue <= float2ALfp(AL_REVERB_MAX_ROOM_ROLLOFF_FACTOR))
- ALEffect->Reverb.RoomRolloffFactor = flValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else if(ALEffect->type == AL_EFFECT_ECHO)
- {
- switch(param)
- {
- case AL_ECHO_DELAY:
- if(flValue >= float2ALfp(AL_ECHO_MIN_DELAY) && flValue <= float2ALfp(AL_ECHO_MAX_DELAY))
- ALEffect->Echo.Delay = flValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- case AL_ECHO_LRDELAY:
- if(flValue >= float2ALfp(AL_ECHO_MIN_LRDELAY) && flValue <= float2ALfp(AL_ECHO_MAX_LRDELAY))
- ALEffect->Echo.LRDelay = flValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- case AL_ECHO_DAMPING:
- if(flValue >= float2ALfp(AL_ECHO_MIN_DAMPING) && flValue <= float2ALfp(AL_ECHO_MAX_DAMPING))
- ALEffect->Echo.Damping = flValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- case AL_ECHO_FEEDBACK:
- if(flValue >= float2ALfp(AL_ECHO_MIN_FEEDBACK) && flValue <= float2ALfp(AL_ECHO_MAX_FEEDBACK))
- ALEffect->Echo.Feedback = flValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- case AL_ECHO_SPREAD:
- if(flValue >= float2ALfp(AL_ECHO_MIN_SPREAD) && flValue <= float2ALfp(AL_ECHO_MAX_SPREAD))
- ALEffect->Echo.Spread = flValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else if(ALEffect->type == AL_EFFECT_RING_MODULATOR)
- {
- switch(param)
- {
- case AL_RING_MODULATOR_FREQUENCY:
- if(flValue >= float2ALfp(AL_RING_MODULATOR_MIN_FREQUENCY) &&
- flValue <= float2ALfp(AL_RING_MODULATOR_MAX_FREQUENCY))
- ALEffect->Modulator.Frequency = flValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- case AL_RING_MODULATOR_HIGHPASS_CUTOFF:
- if(flValue >= float2ALfp(AL_RING_MODULATOR_MIN_HIGHPASS_CUTOFF) &&
- flValue <= float2ALfp(AL_RING_MODULATOR_MAX_HIGHPASS_CUTOFF))
- ALEffect->Modulator.HighPassCutoff = flValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(Context, AL_INVALID_ENUM);
- }
- else
- alSetError(Context, AL_INVALID_NAME);
-
- ProcessContext(Context);
-}
-
-AL_API ALvoid AL_APIENTRY alEffectfv(ALuint effect, ALenum param, ALfloat *pflValues)
-{
- ALCcontext *Context;
- ALCdevice *Device;
- ALeffect *ALEffect;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- Device = Context->Device;
- if((ALEffect=LookupEffect(Device->EffectMap, effect)) != NULL)
- {
- if(ALEffect->type == AL_EFFECT_EAXREVERB)
- {
- switch(param)
- {
- case AL_EAXREVERB_DENSITY:
- case AL_EAXREVERB_DIFFUSION:
- case AL_EAXREVERB_GAIN:
- case AL_EAXREVERB_GAINHF:
- case AL_EAXREVERB_GAINLF:
- case AL_EAXREVERB_DECAY_TIME:
- case AL_EAXREVERB_DECAY_HFRATIO:
- case AL_EAXREVERB_DECAY_LFRATIO:
- case AL_EAXREVERB_REFLECTIONS_GAIN:
- case AL_EAXREVERB_REFLECTIONS_DELAY:
- case AL_EAXREVERB_LATE_REVERB_GAIN:
- case AL_EAXREVERB_LATE_REVERB_DELAY:
- case AL_EAXREVERB_AIR_ABSORPTION_GAINHF:
- case AL_EAXREVERB_ECHO_TIME:
- case AL_EAXREVERB_ECHO_DEPTH:
- case AL_EAXREVERB_MODULATION_TIME:
- case AL_EAXREVERB_MODULATION_DEPTH:
- case AL_EAXREVERB_HFREFERENCE:
- case AL_EAXREVERB_LFREFERENCE:
- case AL_EAXREVERB_ROOM_ROLLOFF_FACTOR:
- alEffectf(effect, param, pflValues[0]);
- break;
-
- case AL_EAXREVERB_REFLECTIONS_PAN:
- if(!__isnan(pflValues[0]) && !__isnan(pflValues[1]) && !__isnan(pflValues[2]))
- {
- ALEffect->Reverb.ReflectionsPan[0] = float2ALfp(pflValues[0]);
- ALEffect->Reverb.ReflectionsPan[1] = float2ALfp(pflValues[1]);
- ALEffect->Reverb.ReflectionsPan[2] = float2ALfp(pflValues[2]);
- }
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
- case AL_EAXREVERB_LATE_REVERB_PAN:
- if(!__isnan(pflValues[0]) && !__isnan(pflValues[1]) && !__isnan(pflValues[2]))
- {
- ALEffect->Reverb.LateReverbPan[0] = float2ALfp(pflValues[0]);
- ALEffect->Reverb.LateReverbPan[1] = float2ALfp(pflValues[1]);
- ALEffect->Reverb.LateReverbPan[2] = float2ALfp(pflValues[2]);
- }
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else if(ALEffect->type == AL_EFFECT_REVERB)
- {
- switch(param)
- {
- case AL_REVERB_DENSITY:
- case AL_REVERB_DIFFUSION:
- case AL_REVERB_GAIN:
- case AL_REVERB_GAINHF:
- case AL_REVERB_DECAY_TIME:
- case AL_REVERB_DECAY_HFRATIO:
- case AL_REVERB_REFLECTIONS_GAIN:
- case AL_REVERB_REFLECTIONS_DELAY:
- case AL_REVERB_LATE_REVERB_GAIN:
- case AL_REVERB_LATE_REVERB_DELAY:
- case AL_REVERB_AIR_ABSORPTION_GAINHF:
- case AL_REVERB_ROOM_ROLLOFF_FACTOR:
- alEffectf(effect, param, pflValues[0]);
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else if(ALEffect->type == AL_EFFECT_ECHO)
- {
- switch(param)
- {
- case AL_ECHO_DELAY:
- case AL_ECHO_LRDELAY:
- case AL_ECHO_DAMPING:
- case AL_ECHO_FEEDBACK:
- case AL_ECHO_SPREAD:
- alEffectf(effect, param, pflValues[0]);
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else if(ALEffect->type == AL_EFFECT_RING_MODULATOR)
- {
- switch(param)
- {
- case AL_RING_MODULATOR_FREQUENCY:
- case AL_RING_MODULATOR_HIGHPASS_CUTOFF:
- alEffectf(effect, param, pflValues[0]);
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(Context, AL_INVALID_ENUM);
- }
- else
- alSetError(Context, AL_INVALID_NAME);
-
- ProcessContext(Context);
-}
-
-AL_API ALvoid AL_APIENTRY alGetEffecti(ALuint effect, ALenum param, ALint *piValue)
-{
- ALCcontext *Context;
- ALCdevice *Device;
- ALeffect *ALEffect;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- Device = Context->Device;
- if((ALEffect=LookupEffect(Device->EffectMap, effect)) != NULL)
- {
- if(param == AL_EFFECT_TYPE)
- {
- *piValue = ALEffect->type;
- }
- else if(ALEffect->type == AL_EFFECT_EAXREVERB)
- {
- switch(param)
- {
- case AL_EAXREVERB_DECAY_HFLIMIT:
- *piValue = ALEffect->Reverb.DecayHFLimit;
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else if(ALEffect->type == AL_EFFECT_REVERB)
- {
- switch(param)
- {
- case AL_REVERB_DECAY_HFLIMIT:
- *piValue = ALEffect->Reverb.DecayHFLimit;
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else if(ALEffect->type == AL_EFFECT_ECHO)
- {
- switch(param)
- {
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else if(ALEffect->type == AL_EFFECT_RING_MODULATOR)
- {
- switch(param)
- {
- case AL_RING_MODULATOR_FREQUENCY:
- *piValue = (ALint)ALfp2float(ALEffect->Modulator.Frequency);
- break;
- case AL_RING_MODULATOR_HIGHPASS_CUTOFF:
- *piValue = (ALint)ALfp2float(ALEffect->Modulator.HighPassCutoff);
- break;
- case AL_RING_MODULATOR_WAVEFORM:
- *piValue = ALEffect->Modulator.Waveform;
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(Context, AL_INVALID_ENUM);
- }
- else
- alSetError(Context, AL_INVALID_NAME);
-
- ProcessContext(Context);
-}
-
-AL_API ALvoid AL_APIENTRY alGetEffectiv(ALuint effect, ALenum param, ALint *piValues)
-{
- ALCcontext *Context;
- ALCdevice *Device;
- ALeffect *ALEffect;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- Device = Context->Device;
- if((ALEffect=LookupEffect(Device->EffectMap, effect)) != NULL)
- {
- if(param == AL_EFFECT_TYPE)
- {
- alGetEffecti(effect, param, piValues);
- }
- else if(ALEffect->type == AL_EFFECT_EAXREVERB)
- {
- switch(param)
- {
- case AL_EAXREVERB_DECAY_HFLIMIT:
- alGetEffecti(effect, param, piValues);
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else if(ALEffect->type == AL_EFFECT_REVERB)
- {
- switch(param)
- {
- case AL_REVERB_DECAY_HFLIMIT:
- alGetEffecti(effect, param, piValues);
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else if(ALEffect->type == AL_EFFECT_ECHO)
- {
- switch(param)
- {
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else if(ALEffect->type == AL_EFFECT_RING_MODULATOR)
- {
- switch(param)
- {
- case AL_RING_MODULATOR_FREQUENCY:
- case AL_RING_MODULATOR_HIGHPASS_CUTOFF:
- case AL_RING_MODULATOR_WAVEFORM:
- alGetEffecti(effect, param, piValues);
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(Context, AL_INVALID_ENUM);
- }
- else
- alSetError(Context, AL_INVALID_NAME);
-
- ProcessContext(Context);
-}
-
-AL_API ALvoid AL_APIENTRY alGetEffectf(ALuint effect, ALenum param, ALfloat *pflValue)
-{
- ALCcontext *Context;
- ALCdevice *Device;
- ALeffect *ALEffect;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- Device = Context->Device;
- if((ALEffect=LookupEffect(Device->EffectMap, effect)) != NULL)
- {
- if(ALEffect->type == AL_EFFECT_EAXREVERB)
- {
- switch(param)
- {
- case AL_EAXREVERB_DENSITY:
- *pflValue = ALfp2float(ALEffect->Reverb.Density);
- break;
-
- case AL_EAXREVERB_DIFFUSION:
- *pflValue = ALfp2float(ALEffect->Reverb.Diffusion);
- break;
-
- case AL_EAXREVERB_GAIN:
- *pflValue = ALfp2float(ALEffect->Reverb.Gain);
- break;
-
- case AL_EAXREVERB_GAINHF:
- *pflValue = ALfp2float(ALEffect->Reverb.GainHF);
- break;
-
- case AL_EAXREVERB_GAINLF:
- *pflValue = ALfp2float(ALEffect->Reverb.GainLF);
- break;
-
- case AL_EAXREVERB_DECAY_TIME:
- *pflValue = ALfp2float(ALEffect->Reverb.DecayTime);
- break;
-
- case AL_EAXREVERB_DECAY_HFRATIO:
- *pflValue = ALfp2float(ALEffect->Reverb.DecayHFRatio);
- break;
-
- case AL_EAXREVERB_DECAY_LFRATIO:
- *pflValue = ALfp2float(ALEffect->Reverb.DecayLFRatio);
- break;
-
- case AL_EAXREVERB_REFLECTIONS_GAIN:
- *pflValue = ALfp2float(ALEffect->Reverb.ReflectionsGain);
- break;
-
- case AL_EAXREVERB_REFLECTIONS_DELAY:
- *pflValue = ALfp2float(ALEffect->Reverb.ReflectionsDelay);
- break;
-
- case AL_EAXREVERB_LATE_REVERB_GAIN:
- *pflValue = ALfp2float(ALEffect->Reverb.LateReverbGain);
- break;
-
- case AL_EAXREVERB_LATE_REVERB_DELAY:
- *pflValue = ALfp2float(ALEffect->Reverb.LateReverbDelay);
- break;
-
- case AL_EAXREVERB_AIR_ABSORPTION_GAINHF:
- *pflValue = ALfp2float(ALEffect->Reverb.AirAbsorptionGainHF);
- break;
-
- case AL_EAXREVERB_ECHO_TIME:
- *pflValue = ALfp2float(ALEffect->Reverb.EchoTime);
- break;
-
- case AL_EAXREVERB_ECHO_DEPTH:
- *pflValue = ALfp2float(ALEffect->Reverb.EchoDepth);
- break;
-
- case AL_EAXREVERB_MODULATION_TIME:
- *pflValue = ALfp2float(ALEffect->Reverb.ModulationTime);
- break;
-
- case AL_EAXREVERB_MODULATION_DEPTH:
- *pflValue = ALfp2float(ALEffect->Reverb.ModulationDepth);
- break;
-
- case AL_EAXREVERB_HFREFERENCE:
- *pflValue = ALfp2float(ALEffect->Reverb.HFReference);
- break;
-
- case AL_EAXREVERB_LFREFERENCE:
- *pflValue = ALfp2float(ALEffect->Reverb.LFReference);
- break;
-
- case AL_EAXREVERB_ROOM_ROLLOFF_FACTOR:
- *pflValue = ALfp2float(ALEffect->Reverb.RoomRolloffFactor);
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else if(ALEffect->type == AL_EFFECT_REVERB)
- {
- switch(param)
- {
- case AL_REVERB_DENSITY:
- *pflValue = ALfp2float(ALEffect->Reverb.Density);
- break;
-
- case AL_REVERB_DIFFUSION:
- *pflValue = ALfp2float(ALEffect->Reverb.Diffusion);
- break;
-
- case AL_REVERB_GAIN:
- *pflValue = ALfp2float(ALEffect->Reverb.Gain);
- break;
-
- case AL_REVERB_GAINHF:
- *pflValue = ALfp2float(ALEffect->Reverb.GainHF);
- break;
-
- case AL_REVERB_DECAY_TIME:
- *pflValue = ALfp2float(ALEffect->Reverb.DecayTime);
- break;
-
- case AL_REVERB_DECAY_HFRATIO:
- *pflValue = ALfp2float(ALEffect->Reverb.DecayHFRatio);
- break;
-
- case AL_REVERB_REFLECTIONS_GAIN:
- *pflValue = ALfp2float(ALEffect->Reverb.ReflectionsGain);
- break;
-
- case AL_REVERB_REFLECTIONS_DELAY:
- *pflValue = ALfp2float(ALEffect->Reverb.ReflectionsDelay);
- break;
-
- case AL_REVERB_LATE_REVERB_GAIN:
- *pflValue = ALfp2float(ALEffect->Reverb.LateReverbGain);
- break;
-
- case AL_REVERB_LATE_REVERB_DELAY:
- *pflValue = ALfp2float(ALEffect->Reverb.LateReverbDelay);
- break;
-
- case AL_REVERB_AIR_ABSORPTION_GAINHF:
- *pflValue = ALfp2float(ALEffect->Reverb.AirAbsorptionGainHF);
- break;
-
- case AL_REVERB_ROOM_ROLLOFF_FACTOR:
- *pflValue = ALfp2float(ALEffect->Reverb.RoomRolloffFactor);
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else if(ALEffect->type == AL_EFFECT_ECHO)
- {
- switch(param)
- {
- case AL_ECHO_DELAY:
- *pflValue = ALfp2float(ALEffect->Echo.Delay);
- break;
-
- case AL_ECHO_LRDELAY:
- *pflValue = ALfp2float(ALEffect->Echo.LRDelay);
- break;
-
- case AL_ECHO_DAMPING:
- *pflValue = ALfp2float(ALEffect->Echo.Damping);
- break;
-
- case AL_ECHO_FEEDBACK:
- *pflValue = ALfp2float(ALEffect->Echo.Feedback);
- break;
-
- case AL_ECHO_SPREAD:
- *pflValue = ALfp2float(ALEffect->Echo.Spread);
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else if(ALEffect->type == AL_EFFECT_RING_MODULATOR)
- {
- switch(param)
- {
- case AL_RING_MODULATOR_FREQUENCY:
- *pflValue = ALfp2float(ALEffect->Modulator.Frequency);
- break;
- case AL_RING_MODULATOR_HIGHPASS_CUTOFF:
- *pflValue = ALfp2float(ALEffect->Modulator.HighPassCutoff);
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(Context, AL_INVALID_ENUM);
- }
- else
- alSetError(Context, AL_INVALID_NAME);
-
- ProcessContext(Context);
-}
-
-AL_API ALvoid AL_APIENTRY alGetEffectfv(ALuint effect, ALenum param, ALfloat *pflValues)
-{
- ALCcontext *Context;
- ALCdevice *Device;
- ALeffect *ALEffect;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- Device = Context->Device;
- if((ALEffect=LookupEffect(Device->EffectMap, effect)) != NULL)
- {
- if(ALEffect->type == AL_EFFECT_EAXREVERB)
- {
- switch(param)
- {
- case AL_EAXREVERB_DENSITY:
- case AL_EAXREVERB_DIFFUSION:
- case AL_EAXREVERB_GAIN:
- case AL_EAXREVERB_GAINHF:
- case AL_EAXREVERB_GAINLF:
- case AL_EAXREVERB_DECAY_TIME:
- case AL_EAXREVERB_DECAY_HFRATIO:
- case AL_EAXREVERB_DECAY_LFRATIO:
- case AL_EAXREVERB_REFLECTIONS_GAIN:
- case AL_EAXREVERB_REFLECTIONS_DELAY:
- case AL_EAXREVERB_LATE_REVERB_GAIN:
- case AL_EAXREVERB_LATE_REVERB_DELAY:
- case AL_EAXREVERB_AIR_ABSORPTION_GAINHF:
- case AL_EAXREVERB_ECHO_TIME:
- case AL_EAXREVERB_ECHO_DEPTH:
- case AL_EAXREVERB_MODULATION_TIME:
- case AL_EAXREVERB_MODULATION_DEPTH:
- case AL_EAXREVERB_HFREFERENCE:
- case AL_EAXREVERB_LFREFERENCE:
- case AL_EAXREVERB_ROOM_ROLLOFF_FACTOR:
- alGetEffectf(effect, param, pflValues);
- break;
-
- case AL_EAXREVERB_REFLECTIONS_PAN:
- pflValues[0] = ALfp2float(ALEffect->Reverb.ReflectionsPan[0]);
- pflValues[1] = ALfp2float(ALEffect->Reverb.ReflectionsPan[1]);
- pflValues[2] = ALfp2float(ALEffect->Reverb.ReflectionsPan[2]);
- break;
- case AL_EAXREVERB_LATE_REVERB_PAN:
- pflValues[0] = ALfp2float(ALEffect->Reverb.LateReverbPan[0]);
- pflValues[1] = ALfp2float(ALEffect->Reverb.LateReverbPan[1]);
- pflValues[2] = ALfp2float(ALEffect->Reverb.LateReverbPan[2]);
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else if(ALEffect->type == AL_EFFECT_REVERB)
- {
- switch(param)
- {
- case AL_REVERB_DENSITY:
- case AL_REVERB_DIFFUSION:
- case AL_REVERB_GAIN:
- case AL_REVERB_GAINHF:
- case AL_REVERB_DECAY_TIME:
- case AL_REVERB_DECAY_HFRATIO:
- case AL_REVERB_REFLECTIONS_GAIN:
- case AL_REVERB_REFLECTIONS_DELAY:
- case AL_REVERB_LATE_REVERB_GAIN:
- case AL_REVERB_LATE_REVERB_DELAY:
- case AL_REVERB_AIR_ABSORPTION_GAINHF:
- case AL_REVERB_ROOM_ROLLOFF_FACTOR:
- alGetEffectf(effect, param, pflValues);
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else if(ALEffect->type == AL_EFFECT_ECHO)
- {
- switch(param)
- {
- case AL_ECHO_DELAY:
- case AL_ECHO_LRDELAY:
- case AL_ECHO_DAMPING:
- case AL_ECHO_FEEDBACK:
- case AL_ECHO_SPREAD:
- alGetEffectf(effect, param, pflValues);
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else if(ALEffect->type == AL_EFFECT_RING_MODULATOR)
- {
- switch(param)
- {
- case AL_RING_MODULATOR_FREQUENCY:
- case AL_RING_MODULATOR_HIGHPASS_CUTOFF:
- alGetEffectf(effect, param, pflValues);
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(Context, AL_INVALID_ENUM);
- }
- else
- alSetError(Context, AL_INVALID_NAME);
-
- ProcessContext(Context);
-}
-
-
-ALvoid ReleaseALEffects(ALCdevice *device)
-{
- ALsizei i;
- for(i = 0;i < device->EffectMap.size;i++)
- {
- ALeffect *temp = device->EffectMap.array[i].value;
- device->EffectMap.array[i].value = NULL;
-
- // Release effect structure
- ALTHUNK_REMOVEENTRY(temp->effect);
- memset(temp, 0, sizeof(ALeffect));
- free(temp);
- }
-}
-
-
-static void InitEffectParams(ALeffect *effect, ALenum type)
-{
- effect->type = type;
- switch(type)
- {
- /* NOTE: Standard reverb and EAX reverb use the same defaults for the
- * shared parameters, and EAX's additional parameters default to
- * values assumed by standard reverb.
- */
- case AL_EFFECT_EAXREVERB:
- case AL_EFFECT_REVERB:
- effect->Reverb.Density = float2ALfp(AL_EAXREVERB_DEFAULT_DENSITY);
- effect->Reverb.Diffusion = float2ALfp(AL_EAXREVERB_DEFAULT_DIFFUSION);
- effect->Reverb.Gain = float2ALfp(AL_EAXREVERB_DEFAULT_GAIN);
- effect->Reverb.GainHF = float2ALfp(AL_EAXREVERB_DEFAULT_GAINHF);
- effect->Reverb.GainLF = float2ALfp(AL_EAXREVERB_DEFAULT_GAINLF);
- effect->Reverb.DecayTime = float2ALfp(AL_EAXREVERB_DEFAULT_DECAY_TIME);
- effect->Reverb.DecayHFRatio = float2ALfp(AL_EAXREVERB_DEFAULT_DECAY_HFRATIO);
- effect->Reverb.DecayLFRatio = float2ALfp(AL_EAXREVERB_DEFAULT_DECAY_LFRATIO);
- effect->Reverb.ReflectionsGain = float2ALfp(AL_EAXREVERB_DEFAULT_REFLECTIONS_GAIN);
- effect->Reverb.ReflectionsDelay = float2ALfp(AL_EAXREVERB_DEFAULT_REFLECTIONS_DELAY);
- effect->Reverb.ReflectionsPan[0] = float2ALfp(AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN_XYZ);
- effect->Reverb.ReflectionsPan[1] = float2ALfp(AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN_XYZ);
- effect->Reverb.ReflectionsPan[2] = float2ALfp(AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN_XYZ);
- effect->Reverb.LateReverbGain = float2ALfp(AL_EAXREVERB_DEFAULT_LATE_REVERB_GAIN);
- effect->Reverb.LateReverbDelay = float2ALfp(AL_EAXREVERB_DEFAULT_LATE_REVERB_DELAY);
- effect->Reverb.LateReverbPan[0] = float2ALfp(AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN_XYZ);
- effect->Reverb.LateReverbPan[1] = float2ALfp(AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN_XYZ);
- effect->Reverb.LateReverbPan[2] = float2ALfp(AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN_XYZ);
- effect->Reverb.EchoTime = float2ALfp(AL_EAXREVERB_DEFAULT_ECHO_TIME);
- effect->Reverb.EchoDepth = float2ALfp(AL_EAXREVERB_DEFAULT_ECHO_DEPTH);
- effect->Reverb.ModulationTime = float2ALfp(AL_EAXREVERB_DEFAULT_MODULATION_TIME);
- effect->Reverb.ModulationDepth = float2ALfp(AL_EAXREVERB_DEFAULT_MODULATION_DEPTH);
- effect->Reverb.AirAbsorptionGainHF = float2ALfp(AL_EAXREVERB_DEFAULT_AIR_ABSORPTION_GAINHF);
- effect->Reverb.HFReference = float2ALfp(AL_EAXREVERB_DEFAULT_HFREFERENCE);
- effect->Reverb.LFReference = float2ALfp(AL_EAXREVERB_DEFAULT_LFREFERENCE);
- effect->Reverb.RoomRolloffFactor = float2ALfp(AL_EAXREVERB_DEFAULT_ROOM_ROLLOFF_FACTOR);
- effect->Reverb.DecayHFLimit = AL_EAXREVERB_DEFAULT_DECAY_HFLIMIT;
- break;
- case AL_EFFECT_ECHO:
- effect->Echo.Delay = float2ALfp(AL_ECHO_DEFAULT_DELAY);
- effect->Echo.LRDelay = float2ALfp(AL_ECHO_DEFAULT_LRDELAY);
- effect->Echo.Damping = float2ALfp(AL_ECHO_DEFAULT_DAMPING);
- effect->Echo.Feedback = float2ALfp(AL_ECHO_DEFAULT_FEEDBACK);
- effect->Echo.Spread = float2ALfp(AL_ECHO_DEFAULT_SPREAD);
- break;
- case AL_EFFECT_RING_MODULATOR:
- effect->Modulator.Frequency = float2ALfp(AL_RING_MODULATOR_DEFAULT_FREQUENCY);
- effect->Modulator.HighPassCutoff = float2ALfp(AL_RING_MODULATOR_DEFAULT_HIGHPASS_CUTOFF);
- effect->Modulator.Waveform = AL_RING_MODULATOR_DEFAULT_WAVEFORM;
- break;
- }
-}
diff --git a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alEffect.h b/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alEffect.h
deleted file mode 100644
index 041aa3edc..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alEffect.h
+++ /dev/null
@@ -1,83 +0,0 @@
-// NOTE: The effect structure is getting too large, it may be a good idea to
-// start using a union or another form of unified storage.
-#ifndef _AL_EFFECT_H_
-#define _AL_EFFECT_H_
-
-#include "AL/al.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-enum {
- EAXREVERB = 0,
- REVERB,
- ECHO,
- MODULATOR,
-
- MAX_EFFECTS
-};
-extern ALboolean DisabledEffects[MAX_EFFECTS];
-
-typedef struct ALeffect
-{
- // Effect type (AL_EFFECT_NULL, ...)
- ALenum type;
-
- struct {
- // Shared Reverb Properties
- ALfp Density;
- ALfp Diffusion;
- ALfp Gain;
- ALfp GainHF;
- ALfp DecayTime;
- ALfp DecayHFRatio;
- ALfp ReflectionsGain;
- ALfp ReflectionsDelay;
- ALfp LateReverbGain;
- ALfp LateReverbDelay;
- ALfp AirAbsorptionGainHF;
- ALfp RoomRolloffFactor;
- ALboolean DecayHFLimit;
-
- // Additional EAX Reverb Properties
- ALfp GainLF;
- ALfp DecayLFRatio;
- ALfp ReflectionsPan[3];
- ALfp LateReverbPan[3];
- ALfp EchoTime;
- ALfp EchoDepth;
- ALfp ModulationTime;
- ALfp ModulationDepth;
- ALfp HFReference;
- ALfp LFReference;
- } Reverb;
-
- struct {
- ALfp Delay;
- ALfp LRDelay;
-
- ALfp Damping;
- ALfp Feedback;
-
- ALfp Spread;
- } Echo;
-
- struct {
- ALfp Frequency;
- ALfp HighPassCutoff;
- ALint Waveform;
- } Modulator;
-
- // Index to itself
- ALuint effect;
-} ALeffect;
-
-
-ALvoid ReleaseALEffects(ALCdevice *device);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alError.c b/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alError.c
deleted file mode 100644
index b074a74be..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alError.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * OpenAL cross platform audio library
- * Copyright (C) 1999-2000 by authors.
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- * Or go to http://www.gnu.org/copyleft/lgpl.html
- */
-
-#include "config.h"
-
-#include "alMain.h"
-#include "AL/alc.h"
-#include "alError.h"
-
-AL_API ALenum AL_APIENTRY alGetError(ALvoid)
-{
- ALCcontext *Context;
- ALenum errorCode;
-
- Context = GetContextSuspended();
- if(!Context) {
- return AL_NO_ERROR;
- }
-
- errorCode = Context->LastError;
- Context->LastError = AL_NO_ERROR;
-
- ProcessContext(Context);
-
- return errorCode;
-}
-
-ALvoid alSetError(ALCcontext *Context, ALenum errorCode)
-{
- if(Context->LastError == AL_NO_ERROR)
- Context->LastError = errorCode;
-}
diff --git a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alError.h b/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alError.h
deleted file mode 100644
index 7976e50f9..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alError.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef _AL_ERROR_H_
-#define _AL_ERROR_H_
-
-#include "AL/al.h"
-#include "AL/alc.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-ALvoid alSetError(ALCcontext *Context, ALenum errorCode);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alExtension.c b/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alExtension.c
deleted file mode 100644
index 2ec8c8041..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alExtension.c
+++ /dev/null
@@ -1,335 +0,0 @@
-/**
- * OpenAL cross platform audio library
- * Copyright (C) 1999-2007 by authors.
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- * Or go to http://www.gnu.org/copyleft/lgpl.html
- */
-
-#include "config.h"
-
-#include
-#include
-#include
-
-#include "alError.h"
-#include "alMain.h"
-#include "alFilter.h"
-#include "alEffect.h"
-#include "alAuxEffectSlot.h"
-#include "alDatabuffer.h"
-#include "alSource.h"
-#include "alBuffer.h"
-#include "AL/al.h"
-#include "AL/alc.h"
-
-typedef struct ALenums {
- const ALchar *enumName;
- ALenum value;
-} ALenums;
-
-
-static const ALenums enumeration[] = {
- // Types
- { "AL_INVALID", AL_INVALID },
- { "AL_NONE", AL_NONE },
- { "AL_FALSE", AL_FALSE },
- { "AL_TRUE", AL_TRUE },
-
- // Source and Listener Properties
- { "AL_SOURCE_RELATIVE", AL_SOURCE_RELATIVE },
- { "AL_CONE_INNER_ANGLE", AL_CONE_INNER_ANGLE },
- { "AL_CONE_OUTER_ANGLE", AL_CONE_OUTER_ANGLE },
- { "AL_PITCH", AL_PITCH },
- { "AL_POSITION", AL_POSITION },
- { "AL_DIRECTION", AL_DIRECTION },
- { "AL_VELOCITY", AL_VELOCITY },
- { "AL_LOOPING", AL_LOOPING },
- { "AL_BUFFER", AL_BUFFER },
- { "AL_GAIN", AL_GAIN },
- { "AL_MIN_GAIN", AL_MIN_GAIN },
- { "AL_MAX_GAIN", AL_MAX_GAIN },
- { "AL_ORIENTATION", AL_ORIENTATION },
- { "AL_REFERENCE_DISTANCE", AL_REFERENCE_DISTANCE },
- { "AL_ROLLOFF_FACTOR", AL_ROLLOFF_FACTOR },
- { "AL_CONE_OUTER_GAIN", AL_CONE_OUTER_GAIN },
- { "AL_MAX_DISTANCE", AL_MAX_DISTANCE },
- { "AL_SEC_OFFSET", AL_SEC_OFFSET },
- { "AL_SAMPLE_OFFSET", AL_SAMPLE_OFFSET },
- { "AL_SAMPLE_RW_OFFSETS_SOFT", AL_SAMPLE_RW_OFFSETS_SOFT },
- { "AL_BYTE_OFFSET", AL_BYTE_OFFSET },
- { "AL_BYTE_RW_OFFSETS_SOFT", AL_BYTE_RW_OFFSETS_SOFT },
- { "AL_SOURCE_TYPE", AL_SOURCE_TYPE },
- { "AL_STATIC", AL_STATIC },
- { "AL_STREAMING", AL_STREAMING },
- { "AL_UNDETERMINED", AL_UNDETERMINED },
- { "AL_METERS_PER_UNIT", AL_METERS_PER_UNIT },
-
- // Source EFX Properties
- { "AL_DIRECT_FILTER", AL_DIRECT_FILTER },
- { "AL_AUXILIARY_SEND_FILTER", AL_AUXILIARY_SEND_FILTER },
- { "AL_AIR_ABSORPTION_FACTOR", AL_AIR_ABSORPTION_FACTOR },
- { "AL_ROOM_ROLLOFF_FACTOR", AL_ROOM_ROLLOFF_FACTOR },
- { "AL_CONE_OUTER_GAINHF", AL_CONE_OUTER_GAINHF },
- { "AL_DIRECT_FILTER_GAINHF_AUTO", AL_DIRECT_FILTER_GAINHF_AUTO },
- { "AL_AUXILIARY_SEND_FILTER_GAIN_AUTO", AL_AUXILIARY_SEND_FILTER_GAIN_AUTO },
- { "AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO", AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO},
-
- // Source State information
- { "AL_SOURCE_STATE", AL_SOURCE_STATE },
- { "AL_INITIAL", AL_INITIAL },
- { "AL_PLAYING", AL_PLAYING },
- { "AL_PAUSED", AL_PAUSED },
- { "AL_STOPPED", AL_STOPPED },
-
- // Queue information
- { "AL_BUFFERS_QUEUED", AL_BUFFERS_QUEUED },
- { "AL_BUFFERS_PROCESSED", AL_BUFFERS_PROCESSED },
-
- // Buffer Formats
- { "AL_FORMAT_MONO8", AL_FORMAT_MONO8 },
- { "AL_FORMAT_MONO16", AL_FORMAT_MONO16 },
- { "AL_FORMAT_MONO_FLOAT32", AL_FORMAT_MONO_FLOAT32 },
- { "AL_FORMAT_MONO_DOUBLE_EXT", AL_FORMAT_MONO_DOUBLE_EXT },
- { "AL_FORMAT_STEREO8", AL_FORMAT_STEREO8 },
- { "AL_FORMAT_STEREO16", AL_FORMAT_STEREO16 },
- { "AL_FORMAT_STEREO_FLOAT32", AL_FORMAT_STEREO_FLOAT32 },
- { "AL_FORMAT_STEREO_DOUBLE_EXT", AL_FORMAT_STEREO_DOUBLE_EXT },
- { "AL_FORMAT_MONO_IMA4", AL_FORMAT_MONO_IMA4 },
- { "AL_FORMAT_STEREO_IMA4", AL_FORMAT_STEREO_IMA4 },
- { "AL_FORMAT_QUAD8_LOKI", AL_FORMAT_QUAD8_LOKI },
- { "AL_FORMAT_QUAD16_LOKI", AL_FORMAT_QUAD16_LOKI },
- { "AL_FORMAT_QUAD8", AL_FORMAT_QUAD8 },
- { "AL_FORMAT_QUAD16", AL_FORMAT_QUAD16 },
- { "AL_FORMAT_QUAD32", AL_FORMAT_QUAD32 },
- { "AL_FORMAT_51CHN8", AL_FORMAT_51CHN8 },
- { "AL_FORMAT_51CHN16", AL_FORMAT_51CHN16 },
- { "AL_FORMAT_51CHN32", AL_FORMAT_51CHN32 },
- { "AL_FORMAT_61CHN8", AL_FORMAT_61CHN8 },
- { "AL_FORMAT_61CHN16", AL_FORMAT_61CHN16 },
- { "AL_FORMAT_61CHN32", AL_FORMAT_61CHN32 },
- { "AL_FORMAT_71CHN8", AL_FORMAT_71CHN8 },
- { "AL_FORMAT_71CHN16", AL_FORMAT_71CHN16 },
- { "AL_FORMAT_71CHN32", AL_FORMAT_71CHN32 },
- { "AL_FORMAT_REAR8", AL_FORMAT_REAR8 },
- { "AL_FORMAT_REAR16", AL_FORMAT_REAR16 },
- { "AL_FORMAT_REAR32", AL_FORMAT_REAR32 },
- { "AL_FORMAT_MONO_MULAW", AL_FORMAT_MONO_MULAW },
- { "AL_FORMAT_MONO_MULAW_EXT", AL_FORMAT_MONO_MULAW },
- { "AL_FORMAT_STEREO_MULAW", AL_FORMAT_STEREO_MULAW },
- { "AL_FORMAT_STEREO_MULAW_EXT", AL_FORMAT_STEREO_MULAW },
- { "AL_FORMAT_QUAD_MULAW", AL_FORMAT_QUAD_MULAW },
- { "AL_FORMAT_51CHN_MULAW", AL_FORMAT_51CHN_MULAW },
- { "AL_FORMAT_61CHN_MULAW", AL_FORMAT_61CHN_MULAW },
- { "AL_FORMAT_71CHN_MULAW", AL_FORMAT_71CHN_MULAW },
- { "AL_FORMAT_REAR_MULAW", AL_FORMAT_REAR_MULAW },
-
- // Buffer attributes
- { "AL_FREQUENCY", AL_FREQUENCY },
- { "AL_BITS", AL_BITS },
- { "AL_CHANNELS", AL_CHANNELS },
- { "AL_SIZE", AL_SIZE },
-
- // Buffer States (not supported yet)
- { "AL_UNUSED", AL_UNUSED },
- { "AL_PENDING", AL_PENDING },
- { "AL_PROCESSED", AL_PROCESSED },
-
- // AL Error Messages
- { "AL_NO_ERROR", AL_NO_ERROR },
- { "AL_INVALID_NAME", AL_INVALID_NAME },
- { "AL_INVALID_ENUM", AL_INVALID_ENUM },
- { "AL_INVALID_VALUE", AL_INVALID_VALUE },
- { "AL_INVALID_OPERATION", AL_INVALID_OPERATION },
- { "AL_OUT_OF_MEMORY", AL_OUT_OF_MEMORY },
-
- // Context strings
- { "AL_VENDOR", AL_VENDOR },
- { "AL_VERSION", AL_VERSION },
- { "AL_RENDERER", AL_RENDERER },
- { "AL_EXTENSIONS", AL_EXTENSIONS },
-
- // Global states
- { "AL_DOPPLER_FACTOR", AL_DOPPLER_FACTOR },
- { "AL_DOPPLER_VELOCITY", AL_DOPPLER_VELOCITY },
- { "AL_DISTANCE_MODEL", AL_DISTANCE_MODEL },
- { "AL_SPEED_OF_SOUND", AL_SPEED_OF_SOUND },
- { "AL_SOURCE_DISTANCE_MODEL", AL_SOURCE_DISTANCE_MODEL },
-
- // Distance Models
- { "AL_INVERSE_DISTANCE", AL_INVERSE_DISTANCE },
- { "AL_INVERSE_DISTANCE_CLAMPED", AL_INVERSE_DISTANCE_CLAMPED },
- { "AL_LINEAR_DISTANCE", AL_LINEAR_DISTANCE },
- { "AL_LINEAR_DISTANCE_CLAMPED", AL_LINEAR_DISTANCE_CLAMPED },
- { "AL_EXPONENT_DISTANCE", AL_EXPONENT_DISTANCE },
- { "AL_EXPONENT_DISTANCE_CLAMPED", AL_EXPONENT_DISTANCE_CLAMPED },
-
- // Apportable Extensions
- { "AL_PRIORITY", AL_PRIORITY },
- { "AL_PRIORITY_SLOTS", AL_PRIORITY_SLOTS },
-
- // Filter types
- { "AL_FILTER_TYPE", AL_FILTER_TYPE },
- { "AL_FILTER_NULL", AL_FILTER_NULL },
- { "AL_FILTER_LOWPASS", AL_FILTER_LOWPASS },
-#if 0
- { "AL_FILTER_HIGHPASS", AL_FILTER_HIGHPASS },
- { "AL_FILTER_BANDPASS", AL_FILTER_BANDPASS },
-#endif
-
- // Filter params
- { "AL_LOWPASS_GAIN", AL_LOWPASS_GAIN },
- { "AL_LOWPASS_GAINHF", AL_LOWPASS_GAINHF },
-
- // Effect types
- { "AL_EFFECT_TYPE", AL_EFFECT_TYPE },
- { "AL_EFFECT_NULL", AL_EFFECT_NULL },
- { "AL_EFFECT_REVERB", AL_EFFECT_REVERB },
- { "AL_EFFECT_EAXREVERB", AL_EFFECT_EAXREVERB },
-#if 0
- { "AL_EFFECT_CHORUS", AL_EFFECT_CHORUS },
- { "AL_EFFECT_DISTORTION", AL_EFFECT_DISTORTION },
-#endif
- { "AL_EFFECT_ECHO", AL_EFFECT_ECHO },
-#if 0
- { "AL_EFFECT_FLANGER", AL_EFFECT_FLANGER },
- { "AL_EFFECT_FREQUENCY_SHIFTER", AL_EFFECT_FREQUENCY_SHIFTER },
- { "AL_EFFECT_VOCAL_MORPHER", AL_EFFECT_VOCAL_MORPHER },
- { "AL_EFFECT_PITCH_SHIFTER", AL_EFFECT_PITCH_SHIFTER },
-#endif
- { "AL_EFFECT_RING_MODULATOR", AL_EFFECT_RING_MODULATOR },
-#if 0
- { "AL_EFFECT_AUTOWAH", AL_EFFECT_AUTOWAH },
- { "AL_EFFECT_COMPRESSOR", AL_EFFECT_COMPRESSOR },
- { "AL_EFFECT_EQUALIZER", AL_EFFECT_EQUALIZER },
-#endif
-
- // Reverb params
- { "AL_REVERB_DENSITY", AL_REVERB_DENSITY },
- { "AL_REVERB_DIFFUSION", AL_REVERB_DIFFUSION },
- { "AL_REVERB_GAIN", AL_REVERB_GAIN },
- { "AL_REVERB_GAINHF", AL_REVERB_GAINHF },
- { "AL_REVERB_DECAY_TIME", AL_REVERB_DECAY_TIME },
- { "AL_REVERB_DECAY_HFRATIO", AL_REVERB_DECAY_HFRATIO },
- { "AL_REVERB_REFLECTIONS_GAIN", AL_REVERB_REFLECTIONS_GAIN },
- { "AL_REVERB_REFLECTIONS_DELAY", AL_REVERB_REFLECTIONS_DELAY },
- { "AL_REVERB_LATE_REVERB_GAIN", AL_REVERB_LATE_REVERB_GAIN },
- { "AL_REVERB_LATE_REVERB_DELAY", AL_REVERB_LATE_REVERB_DELAY },
- { "AL_REVERB_AIR_ABSORPTION_GAINHF", AL_REVERB_AIR_ABSORPTION_GAINHF },
- { "AL_REVERB_ROOM_ROLLOFF_FACTOR", AL_REVERB_ROOM_ROLLOFF_FACTOR },
- { "AL_REVERB_DECAY_HFLIMIT", AL_REVERB_DECAY_HFLIMIT },
-
- // EAX Reverb params
- { "AL_EAXREVERB_DENSITY", AL_EAXREVERB_DENSITY },
- { "AL_EAXREVERB_DIFFUSION", AL_EAXREVERB_DIFFUSION },
- { "AL_EAXREVERB_GAIN", AL_EAXREVERB_GAIN },
- { "AL_EAXREVERB_GAINHF", AL_EAXREVERB_GAINHF },
- { "AL_EAXREVERB_GAINLF", AL_EAXREVERB_GAINLF },
- { "AL_EAXREVERB_DECAY_TIME", AL_EAXREVERB_DECAY_TIME },
- { "AL_EAXREVERB_DECAY_HFRATIO", AL_EAXREVERB_DECAY_HFRATIO },
- { "AL_EAXREVERB_DECAY_LFRATIO", AL_EAXREVERB_DECAY_LFRATIO },
- { "AL_EAXREVERB_REFLECTIONS_GAIN", AL_EAXREVERB_REFLECTIONS_GAIN },
- { "AL_EAXREVERB_REFLECTIONS_DELAY", AL_EAXREVERB_REFLECTIONS_DELAY },
- { "AL_EAXREVERB_REFLECTIONS_PAN", AL_EAXREVERB_REFLECTIONS_PAN },
- { "AL_EAXREVERB_LATE_REVERB_GAIN", AL_EAXREVERB_LATE_REVERB_GAIN },
- { "AL_EAXREVERB_LATE_REVERB_DELAY", AL_EAXREVERB_LATE_REVERB_DELAY },
- { "AL_EAXREVERB_LATE_REVERB_PAN", AL_EAXREVERB_LATE_REVERB_PAN },
- { "AL_EAXREVERB_ECHO_TIME", AL_EAXREVERB_ECHO_TIME },
- { "AL_EAXREVERB_ECHO_DEPTH", AL_EAXREVERB_ECHO_DEPTH },
- { "AL_EAXREVERB_MODULATION_TIME", AL_EAXREVERB_MODULATION_TIME },
- { "AL_EAXREVERB_MODULATION_DEPTH", AL_EAXREVERB_MODULATION_DEPTH },
- { "AL_EAXREVERB_AIR_ABSORPTION_GAINHF", AL_EAXREVERB_AIR_ABSORPTION_GAINHF },
- { "AL_EAXREVERB_HFREFERENCE", AL_EAXREVERB_HFREFERENCE },
- { "AL_EAXREVERB_LFREFERENCE", AL_EAXREVERB_LFREFERENCE },
- { "AL_EAXREVERB_ROOM_ROLLOFF_FACTOR", AL_EAXREVERB_ROOM_ROLLOFF_FACTOR },
- { "AL_EAXREVERB_DECAY_HFLIMIT", AL_EAXREVERB_DECAY_HFLIMIT },
-
- // Echo params
- { "AL_ECHO_DELAY", AL_ECHO_DELAY },
- { "AL_ECHO_LRDELAY", AL_ECHO_LRDELAY },
- { "AL_ECHO_DAMPING", AL_ECHO_DAMPING },
- { "AL_ECHO_FEEDBACK", AL_ECHO_FEEDBACK },
- { "AL_ECHO_SPREAD", AL_ECHO_SPREAD },
-
- // Ring Modulator params
- { "AL_RING_MODULATOR_FREQUENCY", AL_RING_MODULATOR_FREQUENCY },
- { "AL_RING_MODULATOR_HIGHPASS_CUTOFF", AL_RING_MODULATOR_HIGHPASS_CUTOFF },
- { "AL_RING_MODULATOR_WAVEFORM", AL_RING_MODULATOR_WAVEFORM },
-
-
- // Default
- { NULL, (ALenum)0 }
-};
-
-
-
-AL_API ALboolean AL_APIENTRY alIsExtensionPresent(const ALchar *extName)
-{
- ALboolean bIsSupported = AL_FALSE;
- ALCcontext *pContext;
- const char *ptr;
- size_t len;
-
- pContext = GetContextSuspended();
- if(!pContext) return AL_FALSE;
-
- if(!extName)
- {
- alSetError(pContext, AL_INVALID_VALUE);
- ProcessContext(pContext);
- return AL_FALSE;
- }
-
- len = strlen(extName);
- ptr = pContext->ExtensionList;
- while(ptr && *ptr)
- {
- if(strncasecmp(ptr, extName, len) == 0 &&
- (ptr[len] == '\0' || isspace(ptr[len])))
- {
- bIsSupported = AL_TRUE;
- break;
- }
- if((ptr=strchr(ptr, ' ')) != NULL)
- {
- do {
- ++ptr;
- } while(isspace(*ptr));
- }
- }
-
- ProcessContext(pContext);
-
- return bIsSupported;
-}
-
-
-AL_API ALvoid* AL_APIENTRY alGetProcAddress(const ALchar *funcName)
-{
- if(!funcName)
- return NULL;
- return alcGetProcAddress(NULL, funcName);
-}
-
-AL_API ALenum AL_APIENTRY alGetEnumValue(const ALchar *enumName)
-{
- ALsizei i = 0;
-
- while(enumeration[i].enumName &&
- strcmp(enumeration[i].enumName, enumName) != 0)
- i++;
-
- return enumeration[i].value;
-}
diff --git a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alFilter.c b/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alFilter.c
deleted file mode 100644
index 7d6cda809..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alFilter.c
+++ /dev/null
@@ -1,432 +0,0 @@
-/**
- * OpenAL cross platform audio library
- * Copyright (C) 1999-2007 by authors.
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- * Or go to http://www.gnu.org/copyleft/lgpl.html
- */
-
-#include "config.h"
-
-#include
-
-#include "AL/al.h"
-#include "AL/alc.h"
-#include "alMain.h"
-#include "alFilter.h"
-#include "alThunk.h"
-#include "alError.h"
-
-
-static void InitFilterParams(ALfilter *filter, ALenum type);
-
-#define LookupFilter(m, k) ((ALfilter*)LookupUIntMapKey(&(m), (k)))
-
-AL_API ALvoid AL_APIENTRY alGenFilters(ALsizei n, ALuint *filters)
-{
- ALCcontext *Context;
- ALsizei i=0;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- if(n < 0 || IsBadWritePtr((void*)filters, n * sizeof(ALuint)))
- alSetError(Context, AL_INVALID_VALUE);
- else
- {
- ALCdevice *device = Context->Device;
- ALenum err;
-
- while(i < n)
- {
- ALfilter *filter = calloc(1, sizeof(ALfilter));
- if(!filter)
- {
- alSetError(Context, AL_OUT_OF_MEMORY);
- alDeleteFilters(i, filters);
- break;
- }
-
- filter->filter = ALTHUNK_ADDENTRY(filter);
- err = InsertUIntMapEntry(&device->FilterMap, filter->filter, filter);
- if(err != AL_NO_ERROR)
- {
- ALTHUNK_REMOVEENTRY(filter->filter);
- memset(filter, 0, sizeof(ALfilter));
- free(filter);
-
- alSetError(Context, err);
- alDeleteFilters(i, filters);
- break;
- }
-
- filters[i++] = filter->filter;
- InitFilterParams(filter, AL_FILTER_NULL);
- }
- }
-
- ProcessContext(Context);
-}
-
-AL_API ALvoid AL_APIENTRY alDeleteFilters(ALsizei n, ALuint *filters)
-{
- ALCcontext *Context;
- ALCdevice *device;
- ALfilter *ALFilter;
- ALboolean Failed;
- ALsizei i;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- Failed = AL_TRUE;
- device = Context->Device;
- if(n < 0)
- alSetError(Context, AL_INVALID_VALUE);
- else
- {
- Failed = AL_FALSE;
- // Check that all filters are valid
- for(i = 0;i < n;i++)
- {
- if(!filters[i])
- continue;
-
- if(LookupFilter(device->FilterMap, filters[i]) == NULL)
- {
- alSetError(Context, AL_INVALID_NAME);
- Failed = AL_TRUE;
- break;
- }
- }
- }
-
- if(!Failed)
- {
- // All filters are valid
- for(i = 0;i < n;i++)
- {
- // Recheck that the filter is valid, because there could be duplicated names
- if((ALFilter=LookupFilter(device->FilterMap, filters[i])) == NULL)
- continue;
-
- RemoveUIntMapKey(&device->FilterMap, ALFilter->filter);
- ALTHUNK_REMOVEENTRY(ALFilter->filter);
-
- memset(ALFilter, 0, sizeof(ALfilter));
- free(ALFilter);
- }
- }
-
- ProcessContext(Context);
-}
-
-AL_API ALboolean AL_APIENTRY alIsFilter(ALuint filter)
-{
- ALCcontext *Context;
- ALboolean result;
-
- Context = GetContextSuspended();
- if(!Context) return AL_FALSE;
-
- result = ((!filter || LookupFilter(Context->Device->FilterMap, filter)) ?
- AL_TRUE : AL_FALSE);
-
- ProcessContext(Context);
-
- return result;
-}
-
-AL_API ALvoid AL_APIENTRY alFilteri(ALuint filter, ALenum param, ALint iValue)
-{
- ALCcontext *Context;
- ALCdevice *Device;
- ALfilter *ALFilter;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- Device = Context->Device;
- if((ALFilter=LookupFilter(Device->FilterMap, filter)) != NULL)
- {
- switch(param)
- {
- case AL_FILTER_TYPE:
- if(iValue == AL_FILTER_NULL ||
- iValue == AL_FILTER_LOWPASS)
- InitFilterParams(ALFilter, iValue);
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(Context, AL_INVALID_NAME);
-
- ProcessContext(Context);
-}
-
-AL_API ALvoid AL_APIENTRY alFilteriv(ALuint filter, ALenum param, ALint *piValues)
-{
- ALCcontext *Context;
- ALCdevice *Device;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- Device = Context->Device;
- if(LookupFilter(Device->FilterMap, filter) != NULL)
- {
- switch(param)
- {
- case AL_FILTER_TYPE:
- alFilteri(filter, param, piValues[0]);
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(Context, AL_INVALID_NAME);
-
- ProcessContext(Context);
-}
-
-AL_API ALvoid AL_APIENTRY alFilterf(ALuint filter, ALenum param, ALfloat flArg)
-{
- ALCcontext *Context;
- ALCdevice *Device;
- ALfilter *ALFilter;
- ALfp flValue = float2ALfp(flArg);
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- Device = Context->Device;
- if((ALFilter=LookupFilter(Device->FilterMap, filter)) != NULL)
- {
- switch(ALFilter->type)
- {
- case AL_FILTER_LOWPASS:
- switch(param)
- {
- case AL_LOWPASS_GAIN:
- if(flValue >= int2ALfp(0) && flValue <= int2ALfp(1))
- ALFilter->Gain = flValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- case AL_LOWPASS_GAINHF:
- if(flValue >= int2ALfp(0) && flValue <= int2ALfp(1))
- ALFilter->GainHF = flValue;
- else
- alSetError(Context, AL_INVALID_VALUE);
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(Context, AL_INVALID_NAME);
-
- ProcessContext(Context);
-}
-
-AL_API ALvoid AL_APIENTRY alFilterfv(ALuint filter, ALenum param, ALfloat *pflValues)
-{
- ALCcontext *Context;
- ALCdevice *Device;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- Device = Context->Device;
- if(LookupFilter(Device->FilterMap, filter) != NULL)
- {
- switch(param)
- {
- default:
- alFilterf(filter, param, pflValues[0]);
- break;
- }
- }
- else
- alSetError(Context, AL_INVALID_NAME);
-
- ProcessContext(Context);
-}
-
-AL_API ALvoid AL_APIENTRY alGetFilteri(ALuint filter, ALenum param, ALint *piValue)
-{
- ALCcontext *Context;
- ALCdevice *Device;
- ALfilter *ALFilter;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- Device = Context->Device;
- if((ALFilter=LookupFilter(Device->FilterMap, filter)) != NULL)
- {
- switch(param)
- {
- case AL_FILTER_TYPE:
- *piValue = ALFilter->type;
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(Context, AL_INVALID_NAME);
-
- ProcessContext(Context);
-}
-
-AL_API ALvoid AL_APIENTRY alGetFilteriv(ALuint filter, ALenum param, ALint *piValues)
-{
- ALCcontext *Context;
- ALCdevice *Device;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- Device = Context->Device;
- if(LookupFilter(Device->FilterMap, filter) != NULL)
- {
- switch(param)
- {
- case AL_FILTER_TYPE:
- alGetFilteri(filter, param, piValues);
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(Context, AL_INVALID_NAME);
-
- ProcessContext(Context);
-}
-
-AL_API ALvoid AL_APIENTRY alGetFilterf(ALuint filter, ALenum param, ALfloat *pflValue)
-{
- ALCcontext *Context;
- ALCdevice *Device;
- ALfilter *ALFilter;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- Device = Context->Device;
- if((ALFilter=LookupFilter(Device->FilterMap, filter)) != NULL)
- {
- switch(ALFilter->type)
- {
- case AL_FILTER_LOWPASS:
- switch(param)
- {
- case AL_LOWPASS_GAIN:
- *pflValue = ALfp2float(ALFilter->Gain);
- break;
-
- case AL_LOWPASS_GAINHF:
- *pflValue = ALfp2float(ALFilter->GainHF);
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(Context, AL_INVALID_NAME);
-
- ProcessContext(Context);
-}
-
-AL_API ALvoid AL_APIENTRY alGetFilterfv(ALuint filter, ALenum param, ALfloat *pflValues)
-{
- ALCcontext *Context;
- ALCdevice *Device;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- Device = Context->Device;
- if(LookupFilter(Device->FilterMap, filter) != NULL)
- {
- switch(param)
- {
- default:
- alGetFilterf(filter, param, pflValues);
- break;
- }
- }
- else
- alSetError(Context, AL_INVALID_NAME);
-
- ProcessContext(Context);
-}
-
-
-ALvoid ReleaseALFilters(ALCdevice *device)
-{
- ALsizei i;
- for(i = 0;i < device->FilterMap.size;i++)
- {
- ALfilter *temp = device->FilterMap.array[i].value;
- device->FilterMap.array[i].value = NULL;
-
- // Release filter structure
- ALTHUNK_REMOVEENTRY(temp->filter);
- memset(temp, 0, sizeof(ALfilter));
- free(temp);
- }
-}
-
-
-static void InitFilterParams(ALfilter *filter, ALenum type)
-{
- filter->type = type;
-
- filter->Gain = int2ALfp(1);
- filter->GainHF = int2ALfp(1);
-}
diff --git a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alFilter.h b/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alFilter.h
deleted file mode 100644
index 3b17b1f1e..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alFilter.h
+++ /dev/null
@@ -1,139 +0,0 @@
-#ifndef _AL_FILTER_H_
-#define _AL_FILTER_H_
-
-#include "AL/al.h"
-#include "alu.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct {
- ALfp coeff;
-#ifndef _MSC_VER
- ALfp history[0];
-#else
- ALfp history[1];
-#endif
-} FILTER;
-
-static __inline ALfp lpFilter4P(FILTER *iir, ALuint offset, ALfp input)
-{
- ALfp *history = &iir->history[offset];
- ALfp a = iir->coeff;
- ALfp output = input;
-
- output = output + ALfpMult((history[0]-output),a);
- history[0] = output;
- output = output + ALfpMult((history[1]-output),a);
- history[1] = output;
- output = output + ALfpMult((history[2]-output),a);
- history[2] = output;
- output = output + ALfpMult((history[3]-output),a);
- history[3] = output;
-
- return output;
-}
-
-static __inline ALfp lpFilter2P(FILTER *iir, ALuint offset, ALfp input)
-{
- ALfp *history = &iir->history[offset];
- ALfp a = iir->coeff;
- ALfp output = input;
-
- output = output + ALfpMult((history[0]-output),a);
- history[0] = output;
- output = output + ALfpMult((history[1]-output),a);
- history[1] = output;
-
- return output;
-}
-
-static __inline ALfp lpFilter1P(FILTER *iir, ALuint offset, ALfp input)
-{
- ALfp *history = &iir->history[offset];
- ALfp a = iir->coeff;
- ALfp output = input;
-
- output = output + ALfpMult((history[0]-output),a);
- history[0] = output;
-
- return output;
-}
-
-static __inline ALfp lpFilter4PC(const FILTER *iir, ALuint offset, ALfp input)
-{
- const ALfp *history = &iir->history[offset];
- ALfp a = iir->coeff;
- ALfp output = input;
-
- output = output + ALfpMult((history[0]-output),a);
- output = output + ALfpMult((history[1]-output),a);
- output = output + ALfpMult((history[2]-output),a);
- output = output + ALfpMult((history[3]-output),a);
-
- return output;
-}
-
-static __inline ALfp lpFilter2PC(const FILTER *iir, ALuint offset, ALfp input)
-{
- const ALfp *history = &iir->history[offset];
- ALfp a = iir->coeff;
- ALfp output = input;
-
- output = output + ALfpMult((history[0]-output),a);
- output = output + ALfpMult((history[1]-output),a);
-
- return output;
-}
-
-static __inline ALfp lpFilter1PC(FILTER *iir, ALuint offset, ALfp input)
-{
- const ALfp *history = &iir->history[offset];
- ALfp a = iir->coeff;
- ALfp output = input;
-
- output = output + ALfpMult((history[0]-output),a);
-
- return output;
-}
-
-/* Calculates the low-pass filter coefficient given the pre-scaled gain and
- * cos(w) value. Note that g should be pre-scaled (sqr(gain) for one-pole,
- * sqrt(gain) for four-pole, etc) */
-static __inline ALfp lpCoeffCalc(ALfp g, ALfp cw)
-{
- ALfp a = int2ALfp(0);
-
- /* Be careful with gains < 0.01, as that causes the coefficient
- * head towards 1, which will flatten the signal */
- g = __max(g, float2ALfp(0.01f));
- if(g < float2ALfp(0.9999f)) /* 1-epsilon */ {
- ALfp tmp; tmp = ALfpMult(ALfpMult(int2ALfp(2),g),(int2ALfp(1)-cw)) - ALfpMult(ALfpMult(g,g),(int2ALfp(1) - ALfpMult(cw,cw)));
- a = ALfpDiv((int2ALfp(1) - ALfpMult(g,cw) - aluSqrt(tmp)), (int2ALfp(1) - g));
- }
-
- return a;
-}
-
-
-typedef struct ALfilter
-{
- // Filter type (AL_FILTER_NULL, ...)
- ALenum type;
-
- ALfp Gain;
- ALfp GainHF;
-
- // Index to itself
- ALuint filter;
-} ALfilter;
-
-
-ALvoid ReleaseALFilters(ALCdevice *device);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alListener.c b/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alListener.c
deleted file mode 100644
index 78e658306..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alListener.c
+++ /dev/null
@@ -1,497 +0,0 @@
-/**
- * OpenAL cross platform audio library
- * Copyright (C) 1999-2000 by authors.
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- * Or go to http://www.gnu.org/copyleft/lgpl.html
- */
-
-#include "config.h"
-
-#include "alMain.h"
-#include "AL/alc.h"
-#include "alError.h"
-#include "alListener.h"
-#include "alSource.h"
-
-AL_API ALvoid AL_APIENTRY alListenerf(ALenum eParam, ALfloat flArg)
-{
- ALCcontext *pContext;
- ALboolean updateAll = AL_FALSE;
- ALfp flValue = float2ALfp(flArg);
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- switch(eParam)
- {
- case AL_GAIN:
- if(flValue >= int2ALfp(0))
- {
- pContext->Listener.Gain = flValue;
- updateAll = AL_TRUE;
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
- break;
-
- case AL_METERS_PER_UNIT:
- if(flValue > int2ALfp(0))
- {
- pContext->Listener.MetersPerUnit = flValue;
- updateAll = AL_TRUE;
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
- break;
-
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
-
- // Force updating the sources for these parameters, since even head-
- // relative sources are affected
- if(updateAll)
- {
- ALsizei pos;
- for(pos = 0;pos < pContext->SourceMap.size;pos++)
- {
- ALsource *source = pContext->SourceMap.array[pos].value;
- source->NeedsUpdate = AL_TRUE;
- }
- }
-
- ProcessContext(pContext);
-}
-
-
-AL_API ALvoid AL_APIENTRY alListener3f(ALenum eParam, ALfloat flArg1, ALfloat flArg2, ALfloat flArg3)
-{
- ALCcontext *pContext;
- ALboolean updateWorld = AL_FALSE;
- ALfp flValue1 = float2ALfp(flArg1);
- ALfp flValue2 = float2ALfp(flArg2);
- ALfp flValue3 = float2ALfp(flArg3);
-
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- switch(eParam)
- {
- case AL_POSITION:
- pContext->Listener.Position[0] = flValue1;
- pContext->Listener.Position[1] = flValue2;
- pContext->Listener.Position[2] = flValue3;
- updateWorld = AL_TRUE;
- break;
-
- case AL_VELOCITY:
- pContext->Listener.Velocity[0] = flValue1;
- pContext->Listener.Velocity[1] = flValue2;
- pContext->Listener.Velocity[2] = flValue3;
- updateWorld = AL_TRUE;
- break;
-
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
-
- if(updateWorld)
- {
- ALsizei pos;
- for(pos = 0;pos < pContext->SourceMap.size;pos++)
- {
- ALsource *source = pContext->SourceMap.array[pos].value;
- if(!source->bHeadRelative)
- source->NeedsUpdate = AL_TRUE;
- }
- }
-
- ProcessContext(pContext);
-}
-
-
-AL_API ALvoid AL_APIENTRY alListenerfv(ALenum eParam, const ALfloat *pflValues)
-{
- ALCcontext *pContext;
- ALboolean updateWorld = AL_FALSE;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- if(pflValues)
- {
- switch(eParam)
- {
- case AL_GAIN:
- case AL_METERS_PER_UNIT:
- alListenerf(eParam, pflValues[0]);
- break;
-
- case AL_POSITION:
- case AL_VELOCITY:
- alListener3f(eParam, pflValues[0], pflValues[1], pflValues[2]);
- break;
-
- case AL_ORIENTATION:
- // AT then UP
- pContext->Listener.Forward[0] = float2ALfp(pflValues[0]);
- pContext->Listener.Forward[1] = float2ALfp(pflValues[1]);
- pContext->Listener.Forward[2] = float2ALfp(pflValues[2]);
- pContext->Listener.Up[0] = float2ALfp(pflValues[3]);
- pContext->Listener.Up[1] = float2ALfp(pflValues[4]);
- pContext->Listener.Up[2] = float2ALfp(pflValues[5]);
- updateWorld = AL_TRUE;
- break;
-
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
-
- if(updateWorld)
- {
- ALsizei pos;
- for(pos = 0;pos < pContext->SourceMap.size;pos++)
- {
- ALsource *source = pContext->SourceMap.array[pos].value;
- if(!source->bHeadRelative)
- source->NeedsUpdate = AL_TRUE;
- }
- }
-
- ProcessContext(pContext);
-}
-
-
-AL_API ALvoid AL_APIENTRY alListeneri(ALenum eParam, ALint lValue)
-{
- ALCcontext *pContext;
-
- (void)lValue;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- switch(eParam)
- {
- case AL_PRIORITY_SLOTS:
- pContext->PrioritySlots = (ALsizei)lValue;
- break;
-
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
-
- ProcessContext(pContext);
-}
-
-
-AL_API void AL_APIENTRY alListener3i(ALenum eParam, ALint lValue1, ALint lValue2, ALint lValue3)
-{
- ALCcontext *pContext;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- switch(eParam)
- {
- case AL_POSITION:
- case AL_VELOCITY:
- alListener3f(eParam, (ALfloat)lValue1, (ALfloat)lValue2, (ALfloat)lValue3);
- break;
-
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
-
- ProcessContext(pContext);
-}
-
-
-AL_API void AL_APIENTRY alListeneriv( ALenum eParam, const ALint* plValues )
-{
- ALCcontext *pContext;
- ALfloat flValues[6];
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- if(plValues)
- {
- switch(eParam)
- {
- case AL_POSITION:
- case AL_VELOCITY:
- flValues[0] = (ALfloat)plValues[0];
- flValues[1] = (ALfloat)plValues[1];
- flValues[2] = (ALfloat)plValues[2];
- alListenerfv(eParam, flValues);
- break;
-
- case AL_ORIENTATION:
- flValues[0] = (ALfloat)plValues[0];
- flValues[1] = (ALfloat)plValues[1];
- flValues[2] = (ALfloat)plValues[2];
- flValues[3] = (ALfloat)plValues[3];
- flValues[4] = (ALfloat)plValues[4];
- flValues[5] = (ALfloat)plValues[5];
- alListenerfv(eParam, flValues);
- break;
-
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
-
- ProcessContext(pContext);
-}
-
-
-AL_API ALvoid AL_APIENTRY alGetListenerf(ALenum eParam, ALfloat *pflValue)
-{
- ALCcontext *pContext;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- if(pflValue)
- {
- switch(eParam)
- {
- case AL_GAIN:
- *pflValue = ALfp2float(pContext->Listener.Gain);
- break;
-
- case AL_METERS_PER_UNIT:
- *pflValue = ALfp2float(pContext->Listener.MetersPerUnit);
- break;
-
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
-
- ProcessContext(pContext);
-}
-
-
-AL_API ALvoid AL_APIENTRY alGetListener3f(ALenum eParam, ALfloat *pflValue1, ALfloat *pflValue2, ALfloat *pflValue3)
-{
- ALCcontext *pContext;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- if(pflValue1 && pflValue2 && pflValue3)
- {
- switch(eParam)
- {
- case AL_POSITION:
- *pflValue1 = ALfp2float(pContext->Listener.Position[0]);
- *pflValue2 = ALfp2float(pContext->Listener.Position[1]);
- *pflValue3 = ALfp2float(pContext->Listener.Position[2]);
- break;
-
- case AL_VELOCITY:
- *pflValue1 = ALfp2float(pContext->Listener.Velocity[0]);
- *pflValue2 = ALfp2float(pContext->Listener.Velocity[1]);
- *pflValue3 = ALfp2float(pContext->Listener.Velocity[2]);
- break;
-
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
-
- ProcessContext(pContext);
-}
-
-
-AL_API ALvoid AL_APIENTRY alGetListenerfv(ALenum eParam, ALfloat *pflValues)
-{
- ALCcontext *pContext;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- if(pflValues)
- {
- switch(eParam)
- {
- case AL_GAIN:
- pflValues[0] = ALfp2float(pContext->Listener.Gain);
- break;
-
- case AL_METERS_PER_UNIT:
- pflValues[0] = ALfp2float(pContext->Listener.MetersPerUnit);
- break;
-
- case AL_POSITION:
- pflValues[0] = ALfp2float(pContext->Listener.Position[0]);
- pflValues[1] = ALfp2float(pContext->Listener.Position[1]);
- pflValues[2] = ALfp2float(pContext->Listener.Position[2]);
- break;
-
- case AL_VELOCITY:
- pflValues[0] = ALfp2float(pContext->Listener.Velocity[0]);
- pflValues[1] = ALfp2float(pContext->Listener.Velocity[1]);
- pflValues[2] = ALfp2float(pContext->Listener.Velocity[2]);
- break;
-
- case AL_ORIENTATION:
- // AT then UP
- pflValues[0] = ALfp2float(pContext->Listener.Forward[0]);
- pflValues[1] = ALfp2float(pContext->Listener.Forward[1]);
- pflValues[2] = ALfp2float(pContext->Listener.Forward[2]);
- pflValues[3] = ALfp2float(pContext->Listener.Up[0]);
- pflValues[4] = ALfp2float(pContext->Listener.Up[1]);
- pflValues[5] = ALfp2float(pContext->Listener.Up[2]);
- break;
-
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
-
- ProcessContext(pContext);
-}
-
-
-AL_API ALvoid AL_APIENTRY alGetListeneri(ALenum eParam, ALint *plValue)
-{
- ALCcontext *pContext;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- if(plValue)
- {
- switch(eParam)
- {
- case AL_PRIORITY_SLOTS:
- *plValue = (ALint)pContext->PrioritySlots;
- break;
-
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
-
- ProcessContext(pContext);
-}
-
-
-AL_API void AL_APIENTRY alGetListener3i(ALenum eParam, ALint *plValue1, ALint *plValue2, ALint *plValue3)
-{
- ALCcontext *pContext;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- if(plValue1 && plValue2 && plValue3)
- {
- switch (eParam)
- {
- case AL_POSITION:
- *plValue1 = (ALint)ALfp2int(pContext->Listener.Position[0]);
- *plValue2 = (ALint)ALfp2int(pContext->Listener.Position[1]);
- *plValue3 = (ALint)ALfp2int(pContext->Listener.Position[2]);
- break;
-
- case AL_VELOCITY:
- *plValue1 = (ALint)ALfp2int(pContext->Listener.Velocity[0]);
- *plValue2 = (ALint)ALfp2int(pContext->Listener.Velocity[1]);
- *plValue3 = (ALint)ALfp2int(pContext->Listener.Velocity[2]);
- break;
-
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
-
- ProcessContext(pContext);
-}
-
-
-AL_API void AL_APIENTRY alGetListeneriv(ALenum eParam, ALint* plValues)
-{
- ALCcontext *pContext;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- if(plValues)
- {
- switch(eParam)
- {
- case AL_POSITION:
- plValues[0] = (ALint)ALfp2int(pContext->Listener.Position[0]);
- plValues[1] = (ALint)ALfp2int(pContext->Listener.Position[1]);
- plValues[2] = (ALint)ALfp2int(pContext->Listener.Position[2]);
- break;
-
- case AL_VELOCITY:
- plValues[0] = (ALint)ALfp2int(pContext->Listener.Velocity[0]);
- plValues[1] = (ALint)ALfp2int(pContext->Listener.Velocity[1]);
- plValues[2] = (ALint)ALfp2int(pContext->Listener.Velocity[2]);
- break;
-
- case AL_ORIENTATION:
- // AT then UP
- plValues[0] = (ALint)ALfp2int(pContext->Listener.Forward[0]);
- plValues[1] = (ALint)ALfp2int(pContext->Listener.Forward[1]);
- plValues[2] = (ALint)ALfp2int(pContext->Listener.Forward[2]);
- plValues[3] = (ALint)ALfp2int(pContext->Listener.Up[0]);
- plValues[4] = (ALint)ALfp2int(pContext->Listener.Up[1]);
- plValues[5] = (ALint)ALfp2int(pContext->Listener.Up[2]);
- break;
-
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
-
- ProcessContext(pContext);
-}
diff --git a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alListener.h b/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alListener.h
deleted file mode 100644
index a2fc3ba0f..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alListener.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef _AL_LISTENER_H_
-#define _AL_LISTENER_H_
-
-#include "AL/al.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct ALlistener_struct
-{
- ALfp Position[3];
- ALfp Velocity[3];
- ALfp Forward[3];
- ALfp Up[3];
- ALfp Gain;
- ALfp MetersPerUnit;
-} ALlistener;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alMain.h b/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alMain.h
deleted file mode 100644
index 61448b205..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alMain.h
+++ /dev/null
@@ -1,503 +0,0 @@
-#ifndef AL_MAIN_H
-#define AL_MAIN_H
-
-#include
-#include
-#include
-
-#ifdef HAVE_FENV_H
-#include
-#endif
-
-#include "AL/al.h"
-#include "AL/alc.h"
-#include "AL/alext.h"
-
-#ifndef AL_EXT_sample_buffer_object
-#define AL_EXT_sample_buffer_object 1
-typedef ptrdiff_t ALintptrEXT;
-typedef ptrdiff_t ALsizeiptrEXT;
-#define AL_SAMPLE_SOURCE_EXT 0x1040
-#define AL_SAMPLE_SINK_EXT 0x1041
-#define AL_READ_ONLY_EXT 0x1042
-#define AL_WRITE_ONLY_EXT 0x1043
-#define AL_READ_WRITE_EXT 0x1044
-#define AL_STREAM_WRITE_EXT 0x1045
-#define AL_STREAM_READ_EXT 0x1046
-#define AL_STREAM_COPY_EXT 0x1047
-#define AL_STATIC_WRITE_EXT 0x1048
-#define AL_STATIC_READ_EXT 0x1049
-#define AL_STATIC_COPY_EXT 0x104A
-#define AL_DYNAMIC_WRITE_EXT 0x104B
-#define AL_DYNAMIC_READ_EXT 0x104C
-#define AL_DYNAMIC_COPY_EXT 0x104D
-typedef ALvoid (AL_APIENTRY*PFNALGENDATABUFFERSEXTPROC)(ALsizei n,ALuint *puiBuffers);
-typedef ALvoid (AL_APIENTRY*PFNALDELETEDATABUFFERSEXTPROC)(ALsizei n, const ALuint *puiBuffers);
-typedef ALboolean (AL_APIENTRY*PFNALISDATABUFFEREXTPROC)(ALuint uiBuffer);
-typedef ALvoid (AL_APIENTRY*PFNALDATABUFFERDATAEXTPROC)(ALuint buffer,const ALvoid *data,ALsizeiptrEXT size,ALenum usage);
-typedef ALvoid (AL_APIENTRY*PFNALDATABUFFERSUBDATAEXTPROC)(ALuint buffer, ALintptrEXT start, ALsizeiptrEXT length, const ALvoid *);
-typedef ALvoid (AL_APIENTRY*PFNALGETDATABUFFERSUBDATAEXTPROC)(ALuint buffer, ALintptrEXT start, ALsizeiptrEXT length, ALvoid *);
-typedef ALvoid (AL_APIENTRY*PFNALDATABUFFERFEXTPROC)(ALuint buffer, ALenum eParam, ALfloat flValue);
-typedef ALvoid (AL_APIENTRY*PFNALDATABUFFERFVEXTPROC)(ALuint buffer, ALenum eParam, const ALfloat* flValues);
-typedef ALvoid (AL_APIENTRY*PFNALDATABUFFERIEXTPROC)(ALuint buffer, ALenum eParam, ALint lValue);
-typedef ALvoid (AL_APIENTRY*PFNALDATABUFFERIVEXTPROC)(ALuint buffer, ALenum eParam, const ALint* plValues);
-typedef ALvoid (AL_APIENTRY*PFNALGETDATABUFFERFEXTPROC)(ALuint buffer, ALenum eParam, ALfloat *pflValue);
-typedef ALvoid (AL_APIENTRY*PFNALGETDATABUFFERFVEXTPROC)(ALuint buffer, ALenum eParam, ALfloat* pflValues);
-typedef ALvoid (AL_APIENTRY*PFNALGETDATABUFFERIEXTPROC)(ALuint buffer, ALenum eParam, ALint *plValue);
-typedef ALvoid (AL_APIENTRY*PFNALGETDATABUFFERIVEXTPROC)(ALuint buffer, ALenum eParam, ALint* plValues);
-typedef ALvoid (AL_APIENTRY*PFNALSELECTDATABUFFEREXTPROC)(ALenum target, ALuint uiBuffer);
-typedef ALvoid* (AL_APIENTRY*PFNALMAPDATABUFFEREXTPROC)(ALuint uiBuffer, ALintptrEXT start, ALsizeiptrEXT length, ALenum access);
-typedef ALvoid (AL_APIENTRY*PFNALUNMAPDATABUFFEREXTPROC)(ALuint uiBuffer);
-#ifdef AL_ALEXT_PROTOTYPES
-AL_API ALvoid AL_APIENTRY alGenDatabuffersEXT(ALsizei n,ALuint *puiBuffers);
-AL_API ALvoid AL_APIENTRY alDeleteDatabuffersEXT(ALsizei n, const ALuint *puiBuffers);
-AL_API ALboolean AL_APIENTRY alIsDatabufferEXT(ALuint uiBuffer);
-AL_API ALvoid AL_APIENTRY alDatabufferDataEXT(ALuint buffer,const ALvoid *data,ALsizeiptrEXT size,ALenum usage);
-AL_API ALvoid AL_APIENTRY alDatabufferSubDataEXT(ALuint buffer, ALintptrEXT start, ALsizeiptrEXT length, const ALvoid *data);
-AL_API ALvoid AL_APIENTRY alGetDatabufferSubDataEXT(ALuint buffer, ALintptrEXT start, ALsizeiptrEXT length, ALvoid *data);
-AL_API ALvoid AL_APIENTRY alDatabufferfEXT(ALuint buffer, ALenum eParam, ALfloat flValue);
-AL_API ALvoid AL_APIENTRY alDatabufferfvEXT(ALuint buffer, ALenum eParam, const ALfloat* flValues);
-AL_API ALvoid AL_APIENTRY alDatabufferiEXT(ALuint buffer, ALenum eParam, ALint lValue);
-AL_API ALvoid AL_APIENTRY alDatabufferivEXT(ALuint buffer, ALenum eParam, const ALint* plValues);
-AL_API ALvoid AL_APIENTRY alGetDatabufferfEXT(ALuint buffer, ALenum eParam, ALfloat *pflValue);
-AL_API ALvoid AL_APIENTRY alGetDatabufferfvEXT(ALuint buffer, ALenum eParam, ALfloat* pflValues);
-AL_API ALvoid AL_APIENTRY alGetDatabufferiEXT(ALuint buffer, ALenum eParam, ALint *plValue);
-AL_API ALvoid AL_APIENTRY alGetDatabufferivEXT(ALuint buffer, ALenum eParam, ALint* plValues);
-AL_API ALvoid AL_APIENTRY alSelectDatabufferEXT(ALenum target, ALuint uiBuffer);
-AL_API ALvoid* AL_APIENTRY alMapDatabufferEXT(ALuint uiBuffer, ALintptrEXT start, ALsizeiptrEXT length, ALenum access);
-AL_API ALvoid AL_APIENTRY alUnmapDatabufferEXT(ALuint uiBuffer);
-#endif
-#endif
-
-
-#if defined(HAVE_STDINT_H)
-#include
-typedef int64_t ALint64;
-typedef uint64_t ALuint64;
-#elif defined(HAVE___INT64)
-typedef __int64 ALint64;
-typedef unsigned __int64 ALuint64;
-#elif (SIZEOF_LONG == 8)
-typedef long ALint64;
-typedef unsigned long ALuint64;
-#elif (SIZEOF_LONG_LONG == 8)
-typedef long long ALint64;
-typedef unsigned long long ALuint64;
-#endif
-
-#ifdef HAVE_GCC_FORMAT
-#define PRINTF_STYLE(x, y) __attribute__((format(__printf__, (x), (y))))
-#else
-#define PRINTF_STYLE(x, y)
-#endif
-
-#ifdef _WIN32
-
-#ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x0500
-#endif
-#include
-
-typedef DWORD tls_type;
-#define tls_create(x) (*(x) = TlsAlloc())
-#define tls_delete(x) TlsFree((x))
-#define tls_get(x) TlsGetValue((x))
-#define tls_set(x, a) TlsSetValue((x), (a))
-
-#else
-
-#include
-#include
-#include
-#ifdef HAVE_PTHREAD_NP_H
-#include
-#endif
-#include
-#include
-#include
-
-#define IsBadWritePtr(a,b) ((a) == NULL && (b) != 0)
-
-typedef pthread_key_t tls_type;
-#define tls_create(x) pthread_key_create((x), NULL)
-#define tls_delete(x) pthread_key_delete((x))
-#define tls_get(x) pthread_getspecific((x))
-#define tls_set(x, a) pthread_setspecific((x), (a))
-
-typedef pthread_mutex_t CRITICAL_SECTION;
-static __inline void EnterCriticalSection(CRITICAL_SECTION *cs)
-{
- int ret;
- ret = pthread_mutex_lock(cs);
- assert(ret == 0);
-}
-static __inline void LeaveCriticalSection(CRITICAL_SECTION *cs)
-{
- int ret;
- ret = pthread_mutex_unlock(cs);
- assert(ret == 0);
-}
-static __inline void InitializeCriticalSection(CRITICAL_SECTION *cs)
-{
- pthread_mutexattr_t attrib;
- int ret;
-
- ret = pthread_mutexattr_init(&attrib);
- assert(ret == 0);
-
- ret = pthread_mutexattr_settype(&attrib, PTHREAD_MUTEX_RECURSIVE);
-#ifdef HAVE_PTHREAD_NP_H
- if(ret != 0)
- ret = pthread_mutexattr_setkind_np(&attrib, PTHREAD_MUTEX_RECURSIVE);
-#endif
- assert(ret == 0);
- ret = pthread_mutex_init(cs, &attrib);
- assert(ret == 0);
-
- pthread_mutexattr_destroy(&attrib);
-}
-
-static __inline void DeleteCriticalSection(CRITICAL_SECTION *cs)
-{
- int ret;
- ret = pthread_mutex_destroy(cs);
- assert(ret == 0);
-}
-
-/* NOTE: This wrapper isn't quite accurate as it returns an ALuint, as opposed
- * to the expected DWORD. Both are defined as unsigned 32-bit types, however.
- * Additionally, Win32 is supposed to measure the time since Windows started,
- * as opposed to the actual time. */
-static __inline ALuint timeGetTime(void)
-{
-#if _POSIX_TIMERS > 0
- struct timespec ts;
- int ret = -1;
-
-#if defined(_POSIX_MONOTONIC_CLOCK) && (_POSIX_MONOTONIC_CLOCK >= 0)
-#if _POSIX_MONOTONIC_CLOCK == 0
- static int hasmono = 0;
- if(hasmono > 0 || (hasmono == 0 &&
- (hasmono=sysconf(_SC_MONOTONIC_CLOCK)) > 0))
-#endif
- ret = clock_gettime(CLOCK_MONOTONIC, &ts);
-#endif
- if(ret != 0)
- ret = clock_gettime(CLOCK_REALTIME, &ts);
- assert(ret == 0);
-
- return ts.tv_nsec/1000000 + ts.tv_sec*1000;
-#else
- struct timeval tv;
- int ret;
-
- ret = gettimeofday(&tv, NULL);
- assert(ret == 0);
-
- return tv.tv_usec/1000 + tv.tv_sec*1000;
-#endif
-}
-
-static __inline void Sleep(ALuint t)
-{
- struct timespec tv, rem;
- tv.tv_nsec = (t*1000000)%1000000000;
- tv.tv_sec = t/1000;
-
- while(nanosleep(&tv, &rem) == -1 && errno == EINTR)
- tv = rem;
-}
-#define min(x,y) (((x)<(y))?(x):(y))
-#define max(x,y) (((x)>(y))?(x):(y))
-#endif
-
-#include "alListener.h"
-#include "alu.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-#define SWMIXER_OUTPUT_RATE 44100
-
-#define SPEEDOFSOUNDMETRESPERSEC (343.3f)
-#define AIRABSORBGAINDBHF (-0.05f)
-
-#define LOWPASSFREQCUTOFF (5000)
-
-#define DEFAULT_HEAD_DAMPEN (0.25f)
-
-
-// Find the next power-of-2 for non-power-of-2 numbers.
-static __inline ALuint NextPowerOf2(ALuint value)
-{
- ALuint powerOf2 = 1;
-
- if(value)
- {
- value--;
- while(value)
- {
- value >>= 1;
- powerOf2 <<= 1;
- }
- }
- return powerOf2;
-}
-
-
-typedef struct {
- ALCboolean (*OpenPlayback)(ALCdevice*, const ALCchar*);
- void (*ClosePlayback)(ALCdevice*);
- ALCboolean (*ResetPlayback)(ALCdevice*);
- void (*StopPlayback)(ALCdevice*);
-
- ALCboolean (*OpenCapture)(ALCdevice*, const ALCchar*);
- void (*CloseCapture)(ALCdevice*);
- void (*StartCapture)(ALCdevice*);
- void (*StopCapture)(ALCdevice*);
- void (*CaptureSamples)(ALCdevice*, void*, ALCuint);
- ALCuint (*AvailableSamples)(ALCdevice*);
-} BackendFuncs;
-
-enum {
- DEVICE_PROBE,
- ALL_DEVICE_PROBE,
- CAPTURE_DEVICE_PROBE
-};
-
-void alc_alsa_init(BackendFuncs *func_list);
-void alc_alsa_deinit(void);
-void alc_alsa_probe(int type);
-void alc_oss_init(BackendFuncs *func_list);
-void alc_oss_deinit(void);
-void alc_oss_probe(int type);
-void alc_solaris_init(BackendFuncs *func_list);
-void alc_solaris_deinit(void);
-void alc_solaris_probe(int type);
-void alcDSoundInit(BackendFuncs *func_list);
-void alcDSoundDeinit(void);
-void alcDSoundProbe(int type);
-void alcWinMMInit(BackendFuncs *FuncList);
-void alcWinMMDeinit(void);
-void alcWinMMProbe(int type);
-void alc_pa_init(BackendFuncs *func_list);
-void alc_pa_deinit(void);
-void alc_pa_probe(int type);
-void alc_wave_init(BackendFuncs *func_list);
-void alc_wave_deinit(void);
-void alc_wave_probe(int type);
-void alc_pulse_init(BackendFuncs *func_list);
-void alc_pulse_deinit(void);
-void alc_pulse_probe(int type);
-void alc_audiotrack_init(BackendFuncs *func_list);
-void alc_audiotrack_deinit(void);
-void alc_audiotrack_probe(int type);
-void alc_opensles_init(BackendFuncs *func_list);
-void alc_opensles_deinit(void);
-void alc_opensles_probe(int type);
-void alc_null_init(BackendFuncs *func_list);
-void alc_null_deinit(void);
-void alc_null_probe(int type);
-
-
-typedef struct UIntMap {
- struct {
- ALuint key;
- ALvoid *value;
- } *array;
- ALsizei size;
- ALsizei maxsize;
-} UIntMap;
-
-void InitUIntMap(UIntMap *map);
-void ResetUIntMap(UIntMap *map);
-ALenum InsertUIntMapEntry(UIntMap *map, ALuint key, ALvoid *value);
-void RemoveUIntMapKey(UIntMap *map, ALuint key);
-ALvoid *LookupUIntMapKey(UIntMap *map, ALuint key);
-
-/* Device formats */
-enum DevFmtType {
- DevFmtByte, /* AL_BYTE */
- DevFmtUByte, /* AL_UNSIGNED_BYTE */
- DevFmtShort, /* AL_SHORT */
- DevFmtUShort, /* AL_UNSIGNED_SHORT */
- DevFmtFloat, /* AL_FLOAT */
-};
-enum DevFmtChannels {
- DevFmtMono, /* AL_MONO */
- DevFmtStereo, /* AL_STEREO */
- DevFmtQuad, /* AL_QUAD */
- DevFmtX51, /* AL_5POINT1 */
- DevFmtX61, /* AL_6POINT1 */
- DevFmtX71, /* AL_7POINT1 */
-};
-
-ALuint BytesFromDevFmt(enum DevFmtType type);
-ALuint ChannelsFromDevFmt(enum DevFmtChannels chans);
-static __inline ALuint FrameSizeFromDevFmt(enum DevFmtChannels chans,
- enum DevFmtType type)
-{
- return ChannelsFromDevFmt(chans) * BytesFromDevFmt(type);
-}
-
-
-struct ALCdevice_struct
-{
- ALCboolean Connected;
- ALboolean IsCaptureDevice;
-
- ALuint Frequency;
- ALuint UpdateSize;
- ALuint NumUpdates;
- enum DevFmtChannels FmtChans;
- enum DevFmtType FmtType;
-
- ALCchar *szDeviceName;
-
- ALCenum LastError;
-
- // Maximum number of sources that can be created
- ALuint MaxNoOfSources;
- // Maximum number of slots that can be created
- ALuint AuxiliaryEffectSlotMax;
-
- ALCuint NumMonoSources;
- ALCuint NumStereoSources;
- ALuint NumAuxSends;
-
- // Map of Buffers for this device
- UIntMap BufferMap;
-
- // Map of Effects for this device
- UIntMap EffectMap;
-
- // Map of Filters for this device
- UIntMap FilterMap;
-
- // Map of Databuffers for this device
- UIntMap DatabufferMap;
-
- // Stereo-to-binaural filter
- struct bs2b *Bs2b;
- ALCint Bs2bLevel;
-
- // Simulated dampening from head occlusion
- ALfp HeadDampen;
-
- // Duplicate stereo sources on the side/rear channels
- ALboolean DuplicateStereo;
-
- // Dry path buffer mix
- ALfp DryBuffer[BUFFERSIZE][MAXCHANNELS];
-
- ALuint DevChannels[MAXCHANNELS];
-
- ALfp ChannelMatrix[MAXCHANNELS][MAXCHANNELS];
-
- Channel Speaker2Chan[MAXCHANNELS];
- ALfp PanningLUT[MAXCHANNELS * LUT_NUM];
- ALuint NumChan;
-
- ALfp ClickRemoval[MAXCHANNELS];
- ALfp PendingClicks[MAXCHANNELS];
-
- // Contexts created on this device
- ALCcontext **Contexts;
- ALuint NumContexts;
-
- BackendFuncs *Funcs;
- void *ExtraData; // For the backend's use
-
- ALCdevice *next;
-};
-
-#define ALCdevice_OpenPlayback(a,b) ((a)->Funcs->OpenPlayback((a), (b)))
-#define ALCdevice_ClosePlayback(a) ((a)->Funcs->ClosePlayback((a)))
-#define ALCdevice_ResetPlayback(a) ((a)->Funcs->ResetPlayback((a)))
-#define ALCdevice_StopPlayback(a) ((a)->Funcs->StopPlayback((a)))
-#define ALCdevice_OpenCapture(a,b) ((a)->Funcs->OpenCapture((a), (b)))
-#define ALCdevice_CloseCapture(a) ((a)->Funcs->CloseCapture((a)))
-#define ALCdevice_StartCapture(a) ((a)->Funcs->StartCapture((a)))
-#define ALCdevice_StopCapture(a) ((a)->Funcs->StopCapture((a)))
-#define ALCdevice_CaptureSamples(a,b,c) ((a)->Funcs->CaptureSamples((a), (b), (c)))
-#define ALCdevice_AvailableSamples(a) ((a)->Funcs->AvailableSamples((a)))
-
-struct ALCcontext_struct
-{
- ALlistener Listener;
-
- UIntMap SourceMap;
- UIntMap EffectSlotMap;
-
- struct ALdatabuffer *SampleSource;
- struct ALdatabuffer *SampleSink;
-
- ALenum LastError;
-
- ALboolean Suspended;
-
- ALenum DistanceModel;
- ALboolean SourceDistanceModel;
-
- ALfp DopplerFactor;
- ALfp DopplerVelocity;
- ALfp flSpeedOfSound;
-
- struct ALsource **ActiveSources;
- ALsizei ActiveSourceCount;
- ALsizei MaxActiveSources;
-
- // Apportable Extension
- ALsizei PrioritySlots;
-
- ALCdevice *Device;
- const ALCchar *ExtensionList;
-
- ALCcontext *next;
-};
-
-void AppendDeviceList(const ALCchar *name);
-void AppendAllDeviceList(const ALCchar *name);
-void AppendCaptureDeviceList(const ALCchar *name);
-
-ALCvoid alcSetError(ALCdevice *device, ALenum errorCode);
-
-ALCvoid SuspendContext(ALCcontext *context);
-ALCvoid ProcessContext(ALCcontext *context);
-
-ALvoid *StartThread(ALuint (*func)(ALvoid*), ALvoid *ptr);
-ALuint StopThread(ALvoid *thread);
-
-ALCcontext *GetContextSuspended(void);
-
-typedef struct RingBuffer RingBuffer;
-RingBuffer *CreateRingBuffer(ALsizei frame_size, ALsizei length);
-void DestroyRingBuffer(RingBuffer *ring);
-ALsizei RingBufferSize(RingBuffer *ring);
-void WriteRingBuffer(RingBuffer *ring, const ALubyte *data, ALsizei len);
-void ReadRingBuffer(RingBuffer *ring, ALubyte *data, ALsizei len);
-
-void ReadALConfig(void);
-void FreeALConfig(void);
-int ConfigValueExists(const char *blockName, const char *keyName);
-const char *GetConfigValue(const char *blockName, const char *keyName, const char *def);
-int GetConfigValueInt(const char *blockName, const char *keyName, int def);
-float GetConfigValueFloat(const char *blockName, const char *keyName, float def);
-int GetConfigValueBool(const char *blockName, const char *keyName, int def);
-
-void SetRTPriority(void);
-
-void SetDefaultChannelOrder(ALCdevice *device);
-void SetDefaultWFXChannelOrder(ALCdevice *device);
-
-void al_print(const char *fname, unsigned int line, const char *fmt, ...)
- PRINTF_STYLE(3,4);
-#define AL_PRINT(...) al_print(__FILE__, __LINE__, __VA_ARGS__)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alSource.c b/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alSource.c
deleted file mode 100644
index 9ce764023..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alSource.c
+++ /dev/null
@@ -1,2095 +0,0 @@
-/**
- * OpenAL cross platform audio library
- * Copyright (C) 1999-2007 by authors.
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- * Or go to http://www.gnu.org/copyleft/lgpl.html
- */
-
-#include "config.h"
-
-#include
-#include
-#include
-#include "alMain.h"
-#include "AL/al.h"
-#include "AL/alc.h"
-#include "alError.h"
-#include "alSource.h"
-#include "alBuffer.h"
-#include "alThunk.h"
-#include "alAuxEffectSlot.h"
-
-#ifdef ANDROID
-// Apportable: Defines a cap on the maximum number of playing sources
-extern int alc_max_sources;
-extern int alc_active_sources;
-#define LOG_TAG "OpenAL_alSource.c"
-#define LOGV(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
-#else
-#define LOGV(...)
-#endif
-
-resampler_t DefaultResampler;
-const ALsizei ResamplerPadding[RESAMPLER_MAX] = {
- 0, /* Point */
- 1, /* Linear */
- 2, /* Cubic */
-};
-const ALsizei ResamplerPrePadding[RESAMPLER_MAX] = {
- 0, /* Point */
- 0, /* Linear */
- 1, /* Cubic */
-};
-
-
-static ALvoid InitSourceParams(ALsource *Source);
-static ALvoid GetSourceOffset(ALsource *Source, ALenum eName, ALdfp *Offsets, ALdfp updateLen);
-static ALboolean ApplyOffset(ALsource *Source);
-static ALint GetByteOffset(ALsource *Source);
-
-#define LookupSource(m, k) ((ALsource*)LookupUIntMapKey(&(m), (k)))
-#define LookupBuffer(m, k) ((ALbuffer*)LookupUIntMapKey(&(m), (k)))
-#define LookupFilter(m, k) ((ALfilter*)LookupUIntMapKey(&(m), (k)))
-#define LookupEffectSlot(m, k) ((ALeffectslot*)LookupUIntMapKey(&(m), (k)))
-
-AL_API ALvoid AL_APIENTRY alGenSources(ALsizei n,ALuint *sources)
-{
- ALCcontext *Context;
- ALCdevice *Device;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- Device = Context->Device;
- if(n < 0 || IsBadWritePtr((void*)sources, n * sizeof(ALuint)))
- alSetError(Context, AL_INVALID_VALUE);
- else if((ALuint)n > Device->MaxNoOfSources - Context->SourceMap.size)
- alSetError(Context, AL_INVALID_VALUE);
- else
- {
- ALenum err;
- ALsizei i;
-
- // Add additional sources to the list
- i = 0;
- while(i < n)
- {
- ALsource *source = calloc(1, sizeof(ALsource));
- if(!source)
- {
- alSetError(Context, AL_OUT_OF_MEMORY);
- alDeleteSources(i, sources);
- break;
- }
-
- source->source = (ALuint)ALTHUNK_ADDENTRY(source);
- err = InsertUIntMapEntry(&Context->SourceMap, source->source,
- source);
- if(err != AL_NO_ERROR)
- {
- ALTHUNK_REMOVEENTRY(source->source);
- memset(source, 0, sizeof(ALsource));
- free(source);
-
- alSetError(Context, err);
- alDeleteSources(i, sources);
- break;
- }
-
- sources[i++] = source->source;
- InitSourceParams(source);
- }
- }
-
- ProcessContext(Context);
-}
-
-
-AL_API ALvoid AL_APIENTRY alDeleteSources(ALsizei n, const ALuint *sources)
-{
- ALCcontext *Context;
- ALsource *Source;
- ALsizei i, j;
- ALbufferlistitem *BufferList;
- ALboolean SourcesValid = AL_FALSE;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- if(n < 0)
- alSetError(Context, AL_INVALID_VALUE);
- else
- {
- SourcesValid = AL_TRUE;
- // Check that all Sources are valid (and can therefore be deleted)
- for(i = 0;i < n;i++)
- {
- if(LookupSource(Context->SourceMap, sources[i]) == NULL)
- {
- alSetError(Context, AL_INVALID_NAME);
- SourcesValid = AL_FALSE;
- break;
- }
- }
- }
-
- if(SourcesValid)
- {
- // All Sources are valid, and can be deleted
- for(i = 0;i < n;i++)
- {
- // Recheck that the Source is valid, because there could be duplicated Source names
- if((Source=LookupSource(Context->SourceMap, sources[i])) == NULL)
- continue;
-
- for(j = 0;j < Context->ActiveSourceCount;j++)
- {
- if(Context->ActiveSources[j] == Source)
- {
- ALsizei end = --(Context->ActiveSourceCount);
- Context->ActiveSources[j] = Context->ActiveSources[end];
- break;
- }
- }
-
- // For each buffer in the source's queue...
- while(Source->queue != NULL)
- {
- BufferList = Source->queue;
- Source->queue = BufferList->next;
-
- if(BufferList->buffer != NULL)
- BufferList->buffer->refcount--;
- free(BufferList);
- }
-
- for(j = 0;j < MAX_SENDS;++j)
- {
- if(Source->Send[j].Slot)
- Source->Send[j].Slot->refcount--;
- Source->Send[j].Slot = NULL;
- }
-
- // Remove Source from list of Sources
- RemoveUIntMapKey(&Context->SourceMap, Source->source);
- ALTHUNK_REMOVEENTRY(Source->source);
-
- memset(Source,0,sizeof(ALsource));
- free(Source);
- }
- }
-
- ProcessContext(Context);
-}
-
-
-AL_API ALboolean AL_APIENTRY alIsSource(ALuint source)
-{
- ALCcontext *Context;
- ALboolean result;
-
- Context = GetContextSuspended();
- if(!Context) return AL_FALSE;
-
- result = (LookupSource(Context->SourceMap, source) ? AL_TRUE : AL_FALSE);
-
- ProcessContext(Context);
-
- return result;
-}
-
-
-AL_API ALvoid AL_APIENTRY alSourcef(ALuint source, ALenum eParam, ALfloat flValue)
-{
- ALCcontext *pContext;
- ALsource *Source;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- if((Source=LookupSource(pContext->SourceMap, source)) != NULL)
- {
- switch(eParam)
- {
- case AL_PITCH:
- if(flValue >= 0.0f)
- {
- Source->flPitch = float2ALfp(flValue);
- Source->NeedsUpdate = AL_TRUE;
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
- break;
-
- case AL_CONE_INNER_ANGLE:
- if(flValue >= 0.0f && flValue <= 360.0f)
- {
- Source->flInnerAngle = float2ALfp(flValue);
- Source->NeedsUpdate = AL_TRUE;
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
- break;
-
- case AL_CONE_OUTER_ANGLE:
- if(flValue >= 0.0f && flValue <= 360.0f)
- {
- Source->flOuterAngle = float2ALfp(flValue);
- Source->NeedsUpdate = AL_TRUE;
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
- break;
-
- case AL_GAIN:
- if(flValue >= 0.0f)
- {
- Source->flGain = float2ALfp(flValue);
- Source->NeedsUpdate = AL_TRUE;
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
- break;
-
- case AL_MAX_DISTANCE:
- if(flValue >= 0.0f)
- {
- Source->flMaxDistance = float2ALfp(flValue);
- Source->NeedsUpdate = AL_TRUE;
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
- break;
-
- case AL_ROLLOFF_FACTOR:
- if(flValue >= 0.0f)
- {
- Source->flRollOffFactor = float2ALfp(flValue);
- Source->NeedsUpdate = AL_TRUE;
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
- break;
-
- case AL_REFERENCE_DISTANCE:
- if(flValue >= 0.0f)
- {
- Source->flRefDistance = float2ALfp(flValue);
- Source->NeedsUpdate = AL_TRUE;
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
- break;
-
- case AL_MIN_GAIN:
- if(flValue >= 0.0f && flValue <= 1.0f)
- {
- Source->flMinGain = float2ALfp(flValue);
- Source->NeedsUpdate = AL_TRUE;
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
- break;
-
- case AL_MAX_GAIN:
- if(flValue >= 0.0f && flValue <= 1.0f)
- {
- Source->flMaxGain = float2ALfp(flValue);
- Source->NeedsUpdate = AL_TRUE;
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
- break;
-
- case AL_CONE_OUTER_GAIN:
- if(flValue >= 0.0f && flValue <= 1.0f)
- {
- Source->flOuterGain = float2ALfp(flValue);
- Source->NeedsUpdate = AL_TRUE;
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
- break;
-
- case AL_CONE_OUTER_GAINHF:
- if(flValue >= 0.0f && flValue <= 1.0f)
- {
- Source->OuterGainHF = float2ALfp(flValue);
- Source->NeedsUpdate = AL_TRUE;
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
- break;
-
- case AL_AIR_ABSORPTION_FACTOR:
- if(flValue >= 0.0f && flValue <= 10.0f)
- {
- Source->AirAbsorptionFactor = float2ALfp(flValue);
- Source->NeedsUpdate = AL_TRUE;
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
- break;
-
- case AL_ROOM_ROLLOFF_FACTOR:
- if(flValue >= 0.0f && flValue <= 10.0f)
- {
- Source->RoomRolloffFactor = float2ALfp(flValue);
- Source->NeedsUpdate = AL_TRUE;
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
- break;
-
- case AL_DOPPLER_FACTOR:
- if(flValue >= 0.0f && flValue <= 1.0f)
- {
- Source->DopplerFactor = float2ALfp(flValue);
- Source->NeedsUpdate = AL_TRUE;
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
- break;
-
- case AL_SEC_OFFSET:
- case AL_SAMPLE_OFFSET:
- case AL_BYTE_OFFSET:
- if(flValue >= 0.0f)
- {
- Source->lOffsetType = eParam;
-
- // Store Offset (convert Seconds into Milliseconds)
- if(eParam == AL_SEC_OFFSET)
- Source->lOffset = (ALint)(flValue * 1000.0f);
- else
- Source->lOffset = (ALint)flValue;
-
- if ((Source->state == AL_PLAYING) || (Source->state == AL_PAUSED))
- {
- if(ApplyOffset(Source) == AL_FALSE)
- alSetError(pContext, AL_INVALID_VALUE);
- }
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
- break;
-
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
- }
- else
- {
- // Invalid Source Name
- alSetError(pContext, AL_INVALID_NAME);
- }
-
- ProcessContext(pContext);
-}
-
-
-AL_API ALvoid AL_APIENTRY alSource3f(ALuint source, ALenum eParam, ALfloat flValue1,ALfloat flValue2,ALfloat flValue3)
-{
- ALCcontext *pContext;
- ALsource *Source;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- if((Source=LookupSource(pContext->SourceMap, source)) != NULL)
- {
- switch(eParam)
- {
- case AL_POSITION:
- Source->vPosition[0] = float2ALfp(flValue1);
- Source->vPosition[1] = float2ALfp(flValue2);
- Source->vPosition[2] = float2ALfp(flValue3);
- Source->NeedsUpdate = AL_TRUE;
- break;
-
- case AL_VELOCITY:
- Source->vVelocity[0] = float2ALfp(flValue1);
- Source->vVelocity[1] = float2ALfp(flValue2);
- Source->vVelocity[2] = float2ALfp(flValue3);
- Source->NeedsUpdate = AL_TRUE;
- break;
-
- case AL_DIRECTION:
- Source->vOrientation[0] = float2ALfp(flValue1);
- Source->vOrientation[1] = float2ALfp(flValue2);
- Source->vOrientation[2] = float2ALfp(flValue3);
- Source->NeedsUpdate = AL_TRUE;
- break;
-
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(pContext, AL_INVALID_NAME);
-
- ProcessContext(pContext);
-}
-
-
-AL_API ALvoid AL_APIENTRY alSourcefv(ALuint source, ALenum eParam, const ALfloat *pflValues)
-{
- ALCcontext *pContext;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- if(pflValues)
- {
- if(LookupSource(pContext->SourceMap, source) != NULL)
- {
- switch(eParam)
- {
- case AL_PITCH:
- case AL_CONE_INNER_ANGLE:
- case AL_CONE_OUTER_ANGLE:
- case AL_GAIN:
- case AL_MAX_DISTANCE:
- case AL_ROLLOFF_FACTOR:
- case AL_REFERENCE_DISTANCE:
- case AL_MIN_GAIN:
- case AL_MAX_GAIN:
- case AL_CONE_OUTER_GAIN:
- case AL_CONE_OUTER_GAINHF:
- case AL_SEC_OFFSET:
- case AL_SAMPLE_OFFSET:
- case AL_BYTE_OFFSET:
- case AL_AIR_ABSORPTION_FACTOR:
- case AL_ROOM_ROLLOFF_FACTOR:
- alSourcef(source, eParam, pflValues[0]);
- break;
-
- case AL_POSITION:
- case AL_VELOCITY:
- case AL_DIRECTION:
- alSource3f(source, eParam, pflValues[0], pflValues[1], pflValues[2]);
- break;
-
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(pContext, AL_INVALID_NAME);
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
-
- ProcessContext(pContext);
-}
-
-
-AL_API ALvoid AL_APIENTRY alSourcei(ALuint source,ALenum eParam,ALint lValue)
-{
- ALCcontext *pContext;
- ALsource *Source;
- ALbufferlistitem *BufferListItem;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- if((Source=LookupSource(pContext->SourceMap, source)) != NULL)
- {
- ALCdevice *device = pContext->Device;
-
- switch(eParam)
- {
- case AL_MAX_DISTANCE:
- case AL_ROLLOFF_FACTOR:
- case AL_CONE_INNER_ANGLE:
- case AL_CONE_OUTER_ANGLE:
- case AL_REFERENCE_DISTANCE:
- alSourcef(source, eParam, (ALfloat)lValue);
- break;
-
- case AL_SOURCE_RELATIVE:
- if(lValue == AL_FALSE || lValue == AL_TRUE)
- {
- Source->bHeadRelative = (ALboolean)lValue;
- Source->NeedsUpdate = AL_TRUE;
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
- break;
-
- case AL_LOOPING:
- if(lValue == AL_FALSE || lValue == AL_TRUE)
- Source->bLooping = (ALboolean)lValue;
- else
- alSetError(pContext, AL_INVALID_VALUE);
- break;
-
- case AL_BUFFER:
- if(Source->state == AL_STOPPED || Source->state == AL_INITIAL)
- {
- ALbuffer *buffer = NULL;
-
- if(lValue == 0 ||
- (buffer=LookupBuffer(device->BufferMap, lValue)) != NULL)
- {
- // Remove all elements in the queue
- while(Source->queue != NULL)
- {
- BufferListItem = Source->queue;
- Source->queue = BufferListItem->next;
-
- if(BufferListItem->buffer)
- BufferListItem->buffer->refcount--;
- free(BufferListItem);
- }
- Source->BuffersInQueue = 0;
-
- // Add the buffer to the queue (as long as it is NOT the NULL buffer)
- if(buffer != NULL)
- {
- // Source is now in STATIC mode
- Source->lSourceType = AL_STATIC;
-
- // Add the selected buffer to the queue
- BufferListItem = malloc(sizeof(ALbufferlistitem));
- BufferListItem->buffer = buffer;
- BufferListItem->next = NULL;
- BufferListItem->prev = NULL;
-
- Source->queue = BufferListItem;
- Source->BuffersInQueue = 1;
-
- if(buffer->FmtChannels == FmtMono)
- Source->Update = CalcSourceParams;
- else
- Source->Update = CalcNonAttnSourceParams;
-
- // Increment reference counter for buffer
- buffer->refcount++;
- }
- else
- {
- // Source is now in UNDETERMINED mode
- Source->lSourceType = AL_UNDETERMINED;
- }
- Source->BuffersPlayed = 0;
-
- // Update AL_BUFFER parameter
- Source->Buffer = buffer;
- Source->NeedsUpdate = AL_TRUE;
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
- }
- else
- alSetError(pContext, AL_INVALID_OPERATION);
- break;
-
- case AL_SOURCE_STATE:
- // Query only
- alSetError(pContext, AL_INVALID_OPERATION);
- break;
-
- case AL_SEC_OFFSET:
- case AL_SAMPLE_OFFSET:
- case AL_BYTE_OFFSET:
- if(lValue >= 0)
- {
- Source->lOffsetType = eParam;
-
- // Store Offset (convert Seconds into Milliseconds)
- if(eParam == AL_SEC_OFFSET)
- Source->lOffset = lValue * 1000;
- else
- Source->lOffset = lValue;
-
- if(Source->state == AL_PLAYING || Source->state == AL_PAUSED)
- {
- if(ApplyOffset(Source) == AL_FALSE)
- alSetError(pContext, AL_INVALID_VALUE);
- }
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
- break;
-
- case AL_DIRECT_FILTER: {
- ALfilter *filter = NULL;
-
- if(lValue == 0 ||
- (filter=LookupFilter(pContext->Device->FilterMap, lValue)) != NULL)
- {
- if(!filter)
- {
- Source->DirectFilter.type = AL_FILTER_NULL;
- Source->DirectFilter.filter = 0;
- }
- else
- memcpy(&Source->DirectFilter, filter, sizeof(*filter));
- Source->NeedsUpdate = AL_TRUE;
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
- } break;
-
- case AL_DIRECT_FILTER_GAINHF_AUTO:
- if(lValue == AL_TRUE || lValue == AL_FALSE)
- {
- Source->DryGainHFAuto = lValue;
- Source->NeedsUpdate = AL_TRUE;
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
- break;
-
- case AL_AUXILIARY_SEND_FILTER_GAIN_AUTO:
- if(lValue == AL_TRUE || lValue == AL_FALSE)
- {
- Source->WetGainAuto = lValue;
- Source->NeedsUpdate = AL_TRUE;
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
- break;
-
- case AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO:
- if(lValue == AL_TRUE || lValue == AL_FALSE)
- {
- Source->WetGainHFAuto = lValue;
- Source->NeedsUpdate = AL_TRUE;
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
- break;
-
- case AL_DISTANCE_MODEL:
- if(lValue == AL_NONE ||
- lValue == AL_INVERSE_DISTANCE ||
- lValue == AL_INVERSE_DISTANCE_CLAMPED ||
- lValue == AL_LINEAR_DISTANCE ||
- lValue == AL_LINEAR_DISTANCE_CLAMPED ||
- lValue == AL_EXPONENT_DISTANCE ||
- lValue == AL_EXPONENT_DISTANCE_CLAMPED)
- {
- Source->DistanceModel = lValue;
- if(pContext->SourceDistanceModel)
- Source->NeedsUpdate = AL_TRUE;
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
- break;
-
- case AL_PRIORITY:
- Source->priority = lValue;
- break;
-
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(pContext, AL_INVALID_NAME);
-
- ProcessContext(pContext);
-}
-
-
-AL_API void AL_APIENTRY alSource3i(ALuint source, ALenum eParam, ALint lValue1, ALint lValue2, ALint lValue3)
-{
- ALCcontext *pContext;
- ALsource *Source;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- if((Source=LookupSource(pContext->SourceMap, source)) != NULL)
- {
- ALCdevice *device = pContext->Device;
-
- switch (eParam)
- {
- case AL_POSITION:
- case AL_VELOCITY:
- case AL_DIRECTION:
- alSource3f(source, eParam, (ALfloat)lValue1, (ALfloat)lValue2, (ALfloat)lValue3);
- break;
-
- case AL_AUXILIARY_SEND_FILTER: {
- ALeffectslot *ALEffectSlot = NULL;
- ALfilter *ALFilter = NULL;
-
- if((ALuint)lValue2 < device->NumAuxSends &&
- (lValue1 == 0 ||
- (ALEffectSlot=LookupEffectSlot(pContext->EffectSlotMap, lValue1)) != NULL) &&
- (lValue3 == 0 ||
- (ALFilter=LookupFilter(device->FilterMap, lValue3)) != NULL))
- {
- /* Release refcount on the previous slot, and add one for
- * the new slot */
- if(Source->Send[lValue2].Slot)
- Source->Send[lValue2].Slot->refcount--;
- Source->Send[lValue2].Slot = ALEffectSlot;
- if(Source->Send[lValue2].Slot)
- Source->Send[lValue2].Slot->refcount++;
-
- if(!ALFilter)
- {
- /* Disable filter */
- Source->Send[lValue2].WetFilter.type = 0;
- Source->Send[lValue2].WetFilter.filter = 0;
- }
- else
- memcpy(&Source->Send[lValue2].WetFilter, ALFilter, sizeof(*ALFilter));
- Source->NeedsUpdate = AL_TRUE;
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
- } break;
-
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(pContext, AL_INVALID_NAME);
-
- ProcessContext(pContext);
-}
-
-
-AL_API void AL_APIENTRY alSourceiv(ALuint source, ALenum eParam, const ALint* plValues)
-{
- ALCcontext *pContext;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- if(plValues)
- {
- if(LookupSource(pContext->SourceMap, source) != NULL)
- {
- switch(eParam)
- {
- case AL_SOURCE_RELATIVE:
- case AL_CONE_INNER_ANGLE:
- case AL_CONE_OUTER_ANGLE:
- case AL_LOOPING:
- case AL_BUFFER:
- case AL_SOURCE_STATE:
- case AL_SEC_OFFSET:
- case AL_SAMPLE_OFFSET:
- case AL_BYTE_OFFSET:
- case AL_MAX_DISTANCE:
- case AL_ROLLOFF_FACTOR:
- case AL_REFERENCE_DISTANCE:
- case AL_DIRECT_FILTER:
- case AL_DIRECT_FILTER_GAINHF_AUTO:
- case AL_AUXILIARY_SEND_FILTER_GAIN_AUTO:
- case AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO:
- case AL_DISTANCE_MODEL:
- alSourcei(source, eParam, plValues[0]);
- break;
-
- case AL_POSITION:
- case AL_VELOCITY:
- case AL_DIRECTION:
- case AL_AUXILIARY_SEND_FILTER:
- alSource3i(source, eParam, plValues[0], plValues[1], plValues[2]);
- break;
-
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(pContext, AL_INVALID_NAME);
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
-
- ProcessContext(pContext);
-}
-
-
-AL_API ALvoid AL_APIENTRY alGetSourcef(ALuint source, ALenum eParam, ALfloat *pflValue)
-{
- ALCcontext *pContext;
- ALsource *Source;
- ALdfp Offsets[2];
- ALdfp updateLen;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- if(pflValue)
- {
- if((Source=LookupSource(pContext->SourceMap, source)) != NULL)
- {
- switch(eParam)
- {
- case AL_PITCH:
- *pflValue = ALfp2float(Source->flPitch);
- break;
-
- case AL_GAIN:
- *pflValue = ALfp2float(Source->flGain);
- break;
-
- case AL_MIN_GAIN:
- *pflValue = ALfp2float(Source->flMinGain);
- break;
-
- case AL_MAX_GAIN:
- *pflValue = ALfp2float(Source->flMaxGain);
- break;
-
- case AL_MAX_DISTANCE:
- *pflValue = ALfp2float(Source->flMaxDistance);
- break;
-
- case AL_ROLLOFF_FACTOR:
- *pflValue = ALfp2float(Source->flRollOffFactor);
- break;
-
- case AL_CONE_OUTER_GAIN:
- *pflValue = ALfp2float(Source->flOuterGain);
- break;
-
- case AL_CONE_OUTER_GAINHF:
- *pflValue = ALfp2float(Source->OuterGainHF);
- break;
-
- case AL_SEC_OFFSET:
- case AL_SAMPLE_OFFSET:
- case AL_BYTE_OFFSET:
- updateLen = ALdfpDiv(int2ALdfp(pContext->Device->UpdateSize),
- int2ALdfp(pContext->Device->Frequency));
- GetSourceOffset(Source, eParam, Offsets, updateLen);
- *pflValue = (ALfloat)ALdfp2double(Offsets[0]);
- break;
-
- case AL_CONE_INNER_ANGLE:
- *pflValue = ALfp2float(Source->flInnerAngle);
- break;
-
- case AL_CONE_OUTER_ANGLE:
- *pflValue = ALfp2float(Source->flOuterAngle);
- break;
-
- case AL_REFERENCE_DISTANCE:
- *pflValue = ALfp2float(Source->flRefDistance);
- break;
-
- case AL_AIR_ABSORPTION_FACTOR:
- *pflValue = ALfp2float(Source->AirAbsorptionFactor);
- break;
-
- case AL_ROOM_ROLLOFF_FACTOR:
- *pflValue = ALfp2float(Source->RoomRolloffFactor);
- break;
-
- case AL_DOPPLER_FACTOR:
- *pflValue = ALfp2float(Source->DopplerFactor);
- break;
-
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(pContext, AL_INVALID_NAME);
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
-
- ProcessContext(pContext);
-}
-
-
-AL_API ALvoid AL_APIENTRY alGetSource3f(ALuint source, ALenum eParam, ALfloat* pflValue1, ALfloat* pflValue2, ALfloat* pflValue3)
-{
- ALCcontext *pContext;
- ALsource *Source;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- if(pflValue1 && pflValue2 && pflValue3)
- {
- if((Source=LookupSource(pContext->SourceMap, source)) != NULL)
- {
- switch(eParam)
- {
- case AL_POSITION:
- *pflValue1 = ALfp2float(Source->vPosition[0]);
- *pflValue2 = ALfp2float(Source->vPosition[1]);
- *pflValue3 = ALfp2float(Source->vPosition[2]);
- break;
-
- case AL_VELOCITY:
- *pflValue1 = ALfp2float(Source->vVelocity[0]);
- *pflValue2 = ALfp2float(Source->vVelocity[1]);
- *pflValue3 = ALfp2float(Source->vVelocity[2]);
- break;
-
- case AL_DIRECTION:
- *pflValue1 = ALfp2float(Source->vOrientation[0]);
- *pflValue2 = ALfp2float(Source->vOrientation[1]);
- *pflValue3 = ALfp2float(Source->vOrientation[2]);
- break;
-
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(pContext, AL_INVALID_NAME);
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
-
- ProcessContext(pContext);
-}
-
-
-AL_API ALvoid AL_APIENTRY alGetSourcefv(ALuint source, ALenum eParam, ALfloat *pflValues)
-{
- ALCcontext *pContext;
- ALsource *Source;
- ALdfp Offsets[2];
- ALdfp updateLen;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- if(pflValues)
- {
- if((Source=LookupSource(pContext->SourceMap, source)) != NULL)
- {
- switch(eParam)
- {
- case AL_PITCH:
- case AL_GAIN:
- case AL_MIN_GAIN:
- case AL_MAX_GAIN:
- case AL_MAX_DISTANCE:
- case AL_ROLLOFF_FACTOR:
- case AL_DOPPLER_FACTOR:
- case AL_CONE_OUTER_GAIN:
- case AL_SEC_OFFSET:
- case AL_SAMPLE_OFFSET:
- case AL_BYTE_OFFSET:
- case AL_CONE_INNER_ANGLE:
- case AL_CONE_OUTER_ANGLE:
- case AL_REFERENCE_DISTANCE:
- case AL_CONE_OUTER_GAINHF:
- case AL_AIR_ABSORPTION_FACTOR:
- case AL_ROOM_ROLLOFF_FACTOR:
- alGetSourcef(source, eParam, pflValues);
- break;
-
- case AL_POSITION:
- case AL_VELOCITY:
- case AL_DIRECTION:
- alGetSource3f(source, eParam, pflValues+0, pflValues+1, pflValues+2);
- break;
-
- case AL_SAMPLE_RW_OFFSETS_SOFT:
- case AL_BYTE_RW_OFFSETS_SOFT:
- updateLen = ALdfpDiv(int2ALdfp(pContext->Device->UpdateSize),
- int2ALdfp(pContext->Device->Frequency));
- GetSourceOffset(Source, eParam, Offsets, updateLen);
- pflValues[0] = (ALfloat)ALdfp2double(Offsets[0]);
- pflValues[1] = (ALfloat)ALdfp2double(Offsets[1]);
- break;
-
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(pContext, AL_INVALID_NAME);
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
-
- ProcessContext(pContext);
-}
-
-
-AL_API ALvoid AL_APIENTRY alGetSourcei(ALuint source, ALenum eParam, ALint *plValue)
-{
- ALCcontext *pContext;
- ALsource *Source;
- ALdfp Offsets[2];
- ALdfp updateLen;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- if(plValue)
- {
- if((Source=LookupSource(pContext->SourceMap, source)) != NULL)
- {
- switch(eParam)
- {
- case AL_MAX_DISTANCE:
- *plValue = (ALint)ALfp2int(Source->flMaxDistance);
- break;
-
- case AL_ROLLOFF_FACTOR:
- *plValue = (ALint)ALfp2int(Source->flRollOffFactor);
- break;
-
- case AL_REFERENCE_DISTANCE:
- *plValue = (ALint)ALfp2int(Source->flRefDistance);
- break;
-
- case AL_SOURCE_RELATIVE:
- *plValue = Source->bHeadRelative;
- break;
-
- case AL_CONE_INNER_ANGLE:
- *plValue = (ALint)ALfp2int(Source->flInnerAngle);
- break;
-
- case AL_CONE_OUTER_ANGLE:
- *plValue = (ALint)ALfp2int(Source->flOuterAngle);
- break;
-
- case AL_LOOPING:
- *plValue = Source->bLooping;
- break;
-
- case AL_BUFFER:
- *plValue = (Source->Buffer ? Source->Buffer->buffer : 0);
- break;
-
- case AL_SOURCE_STATE:
- *plValue = Source->state;
- break;
-
- case AL_BUFFERS_QUEUED:
- *plValue = Source->BuffersInQueue;
- break;
-
- case AL_BUFFERS_PROCESSED:
- if(Source->bLooping || Source->lSourceType != AL_STREAMING)
- {
- /* Buffers on a looping source are in a perpetual state
- * of PENDING, so don't report any as PROCESSED */
- *plValue = 0;
- }
- else
- *plValue = Source->BuffersPlayed;
- break;
-
- case AL_SOURCE_TYPE:
- *plValue = Source->lSourceType;
- break;
-
- case AL_SEC_OFFSET:
- case AL_SAMPLE_OFFSET:
- case AL_BYTE_OFFSET:
- updateLen = ALdfpDiv(int2ALdfp(pContext->Device->UpdateSize),
- int2ALdfp(pContext->Device->Frequency));
- GetSourceOffset(Source, eParam, Offsets, updateLen);
- *plValue = (ALint)ALfp2int(Offsets[0]);
- break;
-
- case AL_DIRECT_FILTER:
- *plValue = Source->DirectFilter.filter;
- break;
-
- case AL_DIRECT_FILTER_GAINHF_AUTO:
- *plValue = Source->DryGainHFAuto;
- break;
-
- case AL_AUXILIARY_SEND_FILTER_GAIN_AUTO:
- *plValue = Source->WetGainAuto;
- break;
-
- case AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO:
- *plValue = Source->WetGainHFAuto;
- break;
-
- case AL_DOPPLER_FACTOR:
- *plValue = (ALint)ALfp2int(Source->DopplerFactor);
- break;
-
- case AL_DISTANCE_MODEL:
- *plValue = Source->DistanceModel;
- break;
-
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(pContext, AL_INVALID_NAME);
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
-
- ProcessContext(pContext);
-}
-
-
-AL_API void AL_APIENTRY alGetSource3i(ALuint source, ALenum eParam, ALint* plValue1, ALint* plValue2, ALint* plValue3)
-{
- ALCcontext *pContext;
- ALsource *Source;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- if(plValue1 && plValue2 && plValue3)
- {
- if((Source=LookupSource(pContext->SourceMap, source)) != NULL)
- {
- switch(eParam)
- {
- case AL_POSITION:
- *plValue1 = (ALint)ALfp2int(Source->vPosition[0]);
- *plValue2 = (ALint)ALfp2int(Source->vPosition[1]);
- *plValue3 = (ALint)ALfp2int(Source->vPosition[2]);
- break;
-
- case AL_VELOCITY:
- *plValue1 = (ALint)ALfp2int(Source->vVelocity[0]);
- *plValue2 = (ALint)ALfp2int(Source->vVelocity[1]);
- *plValue3 = (ALint)ALfp2int(Source->vVelocity[2]);
- break;
-
- case AL_DIRECTION:
- *plValue1 = (ALint)ALfp2int(Source->vOrientation[0]);
- *plValue2 = (ALint)ALfp2int(Source->vOrientation[1]);
- *plValue3 = (ALint)ALfp2int(Source->vOrientation[2]);
- break;
-
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(pContext, AL_INVALID_NAME);
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
-
- ProcessContext(pContext);
-}
-
-
-AL_API void AL_APIENTRY alGetSourceiv(ALuint source, ALenum eParam, ALint* plValues)
-{
- ALCcontext *pContext;
- ALsource *Source;
- ALdfp Offsets[2];
- ALdfp updateLen;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- if(plValues)
- {
- if((Source=LookupSource(pContext->SourceMap, source)) != NULL)
- {
- switch(eParam)
- {
- case AL_SOURCE_RELATIVE:
- case AL_CONE_INNER_ANGLE:
- case AL_CONE_OUTER_ANGLE:
- case AL_LOOPING:
- case AL_BUFFER:
- case AL_SOURCE_STATE:
- case AL_BUFFERS_QUEUED:
- case AL_BUFFERS_PROCESSED:
- case AL_SEC_OFFSET:
- case AL_SAMPLE_OFFSET:
- case AL_BYTE_OFFSET:
- case AL_MAX_DISTANCE:
- case AL_ROLLOFF_FACTOR:
- case AL_DOPPLER_FACTOR:
- case AL_REFERENCE_DISTANCE:
- case AL_SOURCE_TYPE:
- case AL_DIRECT_FILTER:
- case AL_DIRECT_FILTER_GAINHF_AUTO:
- case AL_AUXILIARY_SEND_FILTER_GAIN_AUTO:
- case AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO:
- case AL_DISTANCE_MODEL:
- alGetSourcei(source, eParam, plValues);
- break;
-
- case AL_POSITION:
- case AL_VELOCITY:
- case AL_DIRECTION:
- alGetSource3i(source, eParam, plValues+0, plValues+1, plValues+2);
- break;
-
- case AL_SAMPLE_RW_OFFSETS_SOFT:
- case AL_BYTE_RW_OFFSETS_SOFT:
- updateLen = ALdfpDiv(int2ALdfp(pContext->Device->UpdateSize),
- int2ALdfp(pContext->Device->Frequency));
- GetSourceOffset(Source, eParam, Offsets, updateLen);
- plValues[0] = (ALint)ALdfp2int(Offsets[0]);
- plValues[1] = (ALint)ALdfp2int(Offsets[1]);
- break;
-
- default:
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
- }
- else
- alSetError(pContext, AL_INVALID_NAME);
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
-
- ProcessContext(pContext);
-}
-
-
-AL_API ALvoid AL_APIENTRY alSourcePlay(ALuint source)
-{
- alSourcePlayv(1, &source);
-}
-
-AL_API ALvoid AL_APIENTRY alSourcePlayv(ALsizei n, const ALuint *sources)
-{
- ALCcontext *Context;
- ALsource *Source;
- ALbufferlistitem *BufferList;
- ALsizei i, j;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- if(n < 0)
- {
- alSetError(Context, AL_INVALID_VALUE);
- goto done;
- }
- if(n > 0 && !sources)
- {
- alSetError(Context, AL_INVALID_VALUE);
- goto done;
- }
-
- // Check that all the Sources are valid
- for(i = 0;i < n;i++)
- {
- if(!LookupSource(Context->SourceMap, sources[i]))
- {
- alSetError(Context, AL_INVALID_NAME);
- goto done;
- }
- }
-
-
- while(Context->MaxActiveSources-Context->ActiveSourceCount < n)
- {
- void *temp = NULL;
- ALsizei newcount;
-
- newcount = Context->MaxActiveSources << 1;
- if(newcount > 0)
- temp = realloc(Context->ActiveSources,
- sizeof(*Context->ActiveSources) * newcount);
- if(!temp)
- {
- alSetError(Context, AL_OUT_OF_MEMORY);
- goto done;
- }
-
- Context->ActiveSources = temp;
- Context->MaxActiveSources = newcount;
- }
-
-
- for(i = 0;i < n;i++)
- {
- Source = (ALsource*)ALTHUNK_LOOKUPENTRY(sources[i]);
-
-#ifdef MAX_SOURCES_LOW
- if (Context->ActiveSourceCount >= (alc_max_sources - Context->PrioritySlots) && Source->priority < 127) {
- LOGV("Skipping starting source %d due to lack of CPU time.", sources[i]);
- continue;
- }
-#endif
-
- // Check that there is a queue containing at least one non-null, non zero length AL Buffer
- BufferList = Source->queue;
- while(BufferList)
- {
- if(BufferList->buffer != NULL && BufferList->buffer->size)
- break;
- BufferList = BufferList->next;
- }
-
- if(!BufferList)
- {
- Source->state = AL_STOPPED;
- Source->BuffersPlayed = Source->BuffersInQueue;
- Source->position = 0;
- Source->position_fraction = 0;
- Source->lOffset = 0;
- continue;
- }
-
- if(Source->state != AL_PAUSED)
- {
- Source->state = AL_PLAYING;
- Source->position = 0;
- Source->position_fraction = 0;
- Source->BuffersPlayed = 0;
-
- Source->Buffer = Source->queue->buffer;
- }
- else
- Source->state = AL_PLAYING;
-
- // Check if an Offset has been set
- if(Source->lOffset)
- ApplyOffset(Source);
-
- // If device is disconnected, go right to stopped
- if(!Context->Device->Connected)
- {
- Source->state = AL_STOPPED;
- Source->BuffersPlayed = Source->BuffersInQueue;
- Source->position = 0;
- Source->position_fraction = 0;
- }
- else
- {
- for(j = 0;j < Context->ActiveSourceCount;j++)
- {
- if(Context->ActiveSources[j] == Source)
- break;
- }
- if(j == Context->ActiveSourceCount)
- Context->ActiveSources[Context->ActiveSourceCount++] = Source;
- }
- }
-
-#ifdef MAX_SOURCES_LOW
- //Apportable Need to give the ALC platform code a hint for setting Source limit based on performance
- alc_active_sources = Context->ActiveSourceCount;
-#endif
-
-done:
- ProcessContext(Context);
-}
-
-AL_API ALvoid AL_APIENTRY alSourcePause(ALuint source)
-{
- alSourcePausev(1, &source);
-}
-
-AL_API ALvoid AL_APIENTRY alSourcePausev(ALsizei n, const ALuint *sources)
-{
- ALCcontext *Context;
- ALsource *Source;
- ALsizei i;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- if(n < 0)
- {
- alSetError(Context, AL_INVALID_VALUE);
- goto done;
- }
- if(n > 0 && !sources)
- {
- alSetError(Context, AL_INVALID_VALUE);
- goto done;
- }
-
- // Check all the Sources are valid
- for(i = 0;i < n;i++)
- {
- if(!LookupSource(Context->SourceMap, sources[i]))
- {
- alSetError(Context, AL_INVALID_NAME);
- goto done;
- }
- }
-
- for(i = 0;i < n;i++)
- {
- Source = (ALsource*)ALTHUNK_LOOKUPENTRY(sources[i]);
- if(Source->state == AL_PLAYING)
- Source->state = AL_PAUSED;
- }
-
-done:
- ProcessContext(Context);
-}
-
-AL_API ALvoid AL_APIENTRY alSourceStop(ALuint source)
-{
- alSourceStopv(1, &source);
-}
-
-AL_API ALvoid AL_APIENTRY alSourceStopv(ALsizei n, const ALuint *sources)
-{
- ALCcontext *Context;
- ALsource *Source;
- ALsizei i;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- if(n < 0)
- {
- alSetError(Context, AL_INVALID_VALUE);
- goto done;
- }
- if(n > 0 && !sources)
- {
- alSetError(Context, AL_INVALID_VALUE);
- goto done;
- }
-
- // Check all the Sources are valid
- for(i = 0;i < n;i++)
- {
- if(!LookupSource(Context->SourceMap, sources[i]))
- {
- alSetError(Context, AL_INVALID_NAME);
- goto done;
- }
- }
-
- for(i = 0;i < n;i++)
- {
- Source = (ALsource*)ALTHUNK_LOOKUPENTRY(sources[i]);
- if(Source->state != AL_INITIAL)
- {
- Source->state = AL_STOPPED;
- Source->BuffersPlayed = Source->BuffersInQueue;
- }
- Source->lOffset = 0;
- }
-
-done:
- ProcessContext(Context);
-}
-
-AL_API ALvoid AL_APIENTRY alSourceRewind(ALuint source)
-{
- alSourceRewindv(1, &source);
-}
-
-AL_API ALvoid AL_APIENTRY alSourceRewindv(ALsizei n, const ALuint *sources)
-{
- ALCcontext *Context;
- ALsource *Source;
- ALsizei i;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- if(n < 0)
- {
- alSetError(Context, AL_INVALID_VALUE);
- goto done;
- }
- if(n > 0 && !sources)
- {
- alSetError(Context, AL_INVALID_VALUE);
- goto done;
- }
-
- // Check all the Sources are valid
- for(i = 0;i < n;i++)
- {
- if(!LookupSource(Context->SourceMap, sources[i]))
- {
- alSetError(Context, AL_INVALID_NAME);
- goto done;
- }
- }
-
- for(i = 0;i < n;i++)
- {
- Source = (ALsource*)ALTHUNK_LOOKUPENTRY(sources[i]);
- if(Source->state != AL_INITIAL)
- {
- Source->state = AL_INITIAL;
- Source->position = 0;
- Source->position_fraction = 0;
- Source->BuffersPlayed = 0;
- if(Source->queue)
- Source->Buffer = Source->queue->buffer;
- }
- Source->lOffset = 0;
- }
-
-done:
- ProcessContext(Context);
-}
-
-
-AL_API ALvoid AL_APIENTRY alSourceQueueBuffers(ALuint source, ALsizei n, const ALuint *buffers)
-{
- ALCcontext *Context;
- ALCdevice *device;
- ALsource *Source;
- ALbuffer *buffer;
- ALsizei i;
- ALbufferlistitem *BufferListStart;
- ALbufferlistitem *BufferList;
- ALbuffer *BufferFmt;
-
- if(n == 0)
- return;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- if(n < 0)
- {
- alSetError(Context, AL_INVALID_VALUE);
- goto done;
- }
-
- // Check that all buffers are valid or zero and that the source is valid
-
- // Check that this is a valid source
- if((Source=LookupSource(Context->SourceMap, source)) == NULL)
- {
- alSetError(Context, AL_INVALID_NAME);
- goto done;
- }
-
- // Check that this is not a STATIC Source
- if(Source->lSourceType == AL_STATIC)
- {
- // Invalid Source Type (can't queue on a Static Source)
- alSetError(Context, AL_INVALID_OPERATION);
- goto done;
- }
-
- device = Context->Device;
-
- BufferFmt = NULL;
-
- // Check existing Queue (if any) for a valid Buffers and get its frequency and format
- BufferList = Source->queue;
- while(BufferList)
- {
- if(BufferList->buffer)
- {
- BufferFmt = BufferList->buffer;
- break;
- }
- BufferList = BufferList->next;
- }
-
- for(i = 0;i < n;i++)
- {
- if(!buffers[i])
- continue;
-
- if((buffer=LookupBuffer(device->BufferMap, buffers[i])) == NULL)
- {
- alSetError(Context, AL_INVALID_NAME);
- goto done;
- }
-
- if(BufferFmt == NULL)
- {
- BufferFmt = buffer;
-
- if(buffer->FmtChannels == FmtMono)
- Source->Update = CalcSourceParams;
- else
- Source->Update = CalcNonAttnSourceParams;
-
- Source->NeedsUpdate = AL_TRUE;
- }
- else if(BufferFmt->Frequency != buffer->Frequency ||
- BufferFmt->OriginalChannels != buffer->OriginalChannels ||
- BufferFmt->OriginalType != buffer->OriginalType)
- {
- alSetError(Context, AL_INVALID_OPERATION);
- goto done;
- }
- }
-
- // Change Source Type
- Source->lSourceType = AL_STREAMING;
-
- buffer = (ALbuffer*)ALTHUNK_LOOKUPENTRY(buffers[0]);
-
- // All buffers are valid - so add them to the list
- BufferListStart = malloc(sizeof(ALbufferlistitem));
- BufferListStart->buffer = buffer;
- BufferListStart->next = NULL;
- BufferListStart->prev = NULL;
-
- // Increment reference counter for buffer
- if(buffer) buffer->refcount++;
-
- BufferList = BufferListStart;
-
- for(i = 1;i < n;i++)
- {
- buffer = (ALbuffer*)ALTHUNK_LOOKUPENTRY(buffers[i]);
-
- BufferList->next = malloc(sizeof(ALbufferlistitem));
- BufferList->next->buffer = buffer;
- BufferList->next->next = NULL;
- BufferList->next->prev = BufferList;
-
- // Increment reference counter for buffer
- if(buffer) buffer->refcount++;
-
- BufferList = BufferList->next;
- }
-
- if(Source->queue == NULL)
- {
- Source->queue = BufferListStart;
- // Update Current Buffer
- Source->Buffer = BufferListStart->buffer;
- }
- else
- {
- // Find end of queue
- BufferList = Source->queue;
- while(BufferList->next != NULL)
- BufferList = BufferList->next;
-
- BufferList->next = BufferListStart;
- BufferList->next->prev = BufferList;
- }
-
- // Update number of buffers in queue
- Source->BuffersInQueue += n;
-
-done:
- ProcessContext(Context);
-}
-
-
-// Implementation assumes that n is the number of buffers to be removed from the queue and buffers is
-// an array of buffer IDs that are to be filled with the names of the buffers removed
-AL_API ALvoid AL_APIENTRY alSourceUnqueueBuffers( ALuint source, ALsizei n, ALuint* buffers )
-{
- ALCcontext *Context;
- ALsource *Source;
- ALsizei i;
- ALbufferlistitem *BufferList;
-
- if(n == 0)
- return;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- if(n < 0)
- {
- alSetError(Context, AL_INVALID_VALUE);
- goto done;
- }
-
- if((Source=LookupSource(Context->SourceMap, source)) == NULL)
- {
- alSetError(Context, AL_INVALID_NAME);
- goto done;
- }
-
- if(Source->bLooping || Source->lSourceType != AL_STREAMING ||
- (ALuint)n > Source->BuffersPlayed)
- {
- // Some buffers can't be unqueue because they have not been processed
- alSetError(Context, AL_INVALID_VALUE);
- goto done;
- }
-
- for(i = 0;i < n;i++)
- {
- BufferList = Source->queue;
- Source->queue = BufferList->next;
-
- if(BufferList->buffer)
- {
- // Record name of buffer
- buffers[i] = BufferList->buffer->buffer;
- // Decrement buffer reference counter
- BufferList->buffer->refcount--;
- }
- else
- buffers[i] = 0;
-
- // Release memory for buffer list item
- free(BufferList);
- Source->BuffersInQueue--;
- }
- if(Source->queue)
- Source->queue->prev = NULL;
-
- if(Source->state != AL_PLAYING)
- {
- if(Source->queue)
- Source->Buffer = Source->queue->buffer;
- else
- Source->Buffer = NULL;
- }
- Source->BuffersPlayed -= n;
-
-done:
- ProcessContext(Context);
-}
-
-
-static ALvoid InitSourceParams(ALsource *Source)
-{
- Source->flInnerAngle = int2ALfp(360);
- Source->flOuterAngle = int2ALfp(360);
- Source->flPitch = int2ALfp(1);
- Source->vPosition[0] = int2ALfp(0);
- Source->vPosition[1] = int2ALfp(0);
- Source->vPosition[2] = int2ALfp(0);
- Source->vOrientation[0] = int2ALfp(0);
- Source->vOrientation[1] = int2ALfp(0);
- Source->vOrientation[2] = int2ALfp(0);
- Source->vVelocity[0] = int2ALfp(0);
- Source->vVelocity[1] = int2ALfp(0);
- Source->vVelocity[2] = int2ALfp(0);
- Source->flRefDistance = int2ALfp(1);
- Source->flMaxDistance = int2ALfp(FLT_MAX);
- Source->flRollOffFactor = int2ALfp(1);
- Source->bLooping = AL_FALSE;
- Source->flGain = int2ALfp(1);
- Source->flMinGain = int2ALfp(0);
- Source->flMaxGain = int2ALfp(1);
- Source->flOuterGain = int2ALfp(0);
- Source->OuterGainHF = int2ALfp(1);
-
- Source->DryGainHFAuto = AL_TRUE;
- Source->WetGainAuto = AL_TRUE;
- Source->WetGainHFAuto = AL_TRUE;
- Source->AirAbsorptionFactor = int2ALfp(0);
- Source->RoomRolloffFactor = int2ALfp(0);
- Source->DopplerFactor = int2ALfp(1);
-
- Source->DistanceModel = AL_INVERSE_DISTANCE_CLAMPED;
-
- Source->Resampler = DefaultResampler;
-
- Source->state = AL_INITIAL;
- Source->lSourceType = AL_UNDETERMINED;
-
- Source->NeedsUpdate = AL_TRUE;
-
- Source->Buffer = NULL;
- Source->priority = 0;
-}
-
-
-/*
- GetSourceOffset
-
- Gets the current playback position in the given Source, in the appropriate format (Bytes, Samples or MilliSeconds)
- The offset is relative to the start of the queue (not the start of the current buffer)
-*/
-static ALvoid GetSourceOffset(ALsource *Source, ALenum name, ALdfp *offset, ALdfp updateLen)
-{
- const ALbufferlistitem *BufferList;
- const ALbuffer *Buffer = NULL;
- enum UserFmtType OriginalType;
- ALsizei BufferFreq;
- ALint Channels, Bytes;
- ALuint readPos, writePos;
- ALuint TotalBufferDataSize;
- ALuint i;
-
- // Find the first non-NULL Buffer in the Queue
- BufferList = Source->queue;
- while(BufferList)
- {
- if(BufferList->buffer)
- {
- Buffer = BufferList->buffer;
- break;
- }
- BufferList = BufferList->next;
- }
-
- if((Source->state != AL_PLAYING && Source->state != AL_PAUSED) || !Buffer)
- {
- offset[0] = int2ALdfp(0);
- offset[1] = int2ALdfp(0);
- return;
- }
-
- // Get Current Buffer Size and frequency (in milliseconds)
- BufferFreq = Buffer->Frequency;
- OriginalType = Buffer->OriginalType;
- Channels = ChannelsFromFmt(Buffer->FmtChannels);
- Bytes = BytesFromFmt(Buffer->FmtType);
-
- // Get Current BytesPlayed (NOTE : This is the byte offset into the *current* buffer)
- readPos = Source->position * Channels * Bytes;
- // Add byte length of any processed buffers in the queue
- TotalBufferDataSize = 0;
- BufferList = Source->queue;
- for(i = 0;BufferList;i++)
- {
- if(BufferList->buffer)
- {
- if(i < Source->BuffersPlayed)
- readPos += BufferList->buffer->size;
- TotalBufferDataSize += BufferList->buffer->size;
- }
- BufferList = BufferList->next;
- }
- if(Source->state == AL_PLAYING)
- writePos = readPos + ((ALuint)(ALdfp2int(ALdfpMult(updateLen,int2ALdfp(BufferFreq)))) * Channels * Bytes);
- else
- writePos = readPos;
-
- if(Source->bLooping)
- {
- readPos %= TotalBufferDataSize;
- writePos %= TotalBufferDataSize;
- }
- else
- {
- // Wrap positions back to 0
- if(readPos >= TotalBufferDataSize)
- readPos = 0;
- if(writePos >= TotalBufferDataSize)
- writePos = 0;
- }
-
- switch(name)
- {
- case AL_SEC_OFFSET:
- offset[0] = ALdfpDiv(readPos, int2ALdfp(Channels * Bytes * BufferFreq));
- offset[1] = ALdfpDiv(writePos, int2ALdfp(Channels * Bytes * BufferFreq));
- break;
- case AL_SAMPLE_OFFSET:
- case AL_SAMPLE_RW_OFFSETS_SOFT:
- offset[0] = int2ALdfp(readPos / (Channels * Bytes));
- offset[1] = int2ALdfp(writePos / (Channels * Bytes));
- break;
- case AL_BYTE_OFFSET:
- case AL_BYTE_RW_OFFSETS_SOFT:
- // Take into account the original format of the Buffer
- if(OriginalType == UserFmtIMA4)
- {
- ALuint FrameBlockSize = 65 * Bytes * Channels;
- ALuint BlockSize = 36 * Channels;
-
- // Round down to nearest ADPCM block
- offset[0] = int2ALdfp(readPos / FrameBlockSize * BlockSize);
- if(Source->state != AL_PLAYING)
- offset[1] = offset[0];
- else
- {
- // Round up to nearest ADPCM block
- offset[1] = int2ALdfp((writePos+FrameBlockSize-1) /
- (FrameBlockSize * BlockSize));
- }
- }
- else
- {
- ALuint OrigBytes = BytesFromUserFmt(OriginalType);
- offset[0] = int2ALdfp(readPos / Bytes * OrigBytes);
- offset[1] = int2ALdfp(writePos / Bytes * OrigBytes);
- }
- break;
- }
-}
-
-
-/*
- ApplyOffset
-
- Apply a playback offset to the Source. This function will update the queue (to correctly
- mark buffers as 'pending' or 'processed' depending upon the new offset.
-*/
-static ALboolean ApplyOffset(ALsource *Source)
-{
- const ALbufferlistitem *BufferList;
- const ALbuffer *Buffer;
- ALint lBufferSize, lTotalBufferSize;
- ALint BuffersPlayed;
- ALint lByteOffset;
-
- // Get true byte offset
- lByteOffset = GetByteOffset(Source);
-
- // If the offset is invalid, don't apply it
- if(lByteOffset == -1)
- return AL_FALSE;
-
- // Sort out the queue (pending and processed states)
- BufferList = Source->queue;
- lTotalBufferSize = 0;
- BuffersPlayed = 0;
-
- while(BufferList)
- {
- Buffer = BufferList->buffer;
- lBufferSize = Buffer ? Buffer->size : 0;
-
- if(lBufferSize <= lByteOffset-lTotalBufferSize)
- {
- // Offset is past this buffer so increment BuffersPlayed
- BuffersPlayed++;
- }
- else if(lTotalBufferSize <= lByteOffset)
- {
- // Offset is within this buffer
- // Set Current Buffer
- Source->Buffer = BufferList->buffer;
- Source->BuffersPlayed = BuffersPlayed;
-
- // SW Mixer Positions are in Samples
- Source->position = (lByteOffset - lTotalBufferSize) /
- FrameSizeFromFmt(Buffer->FmtChannels, Buffer->FmtType);
- return AL_TRUE;
- }
-
- // Increment the TotalBufferSize
- lTotalBufferSize += lBufferSize;
-
- // Move on to next buffer in the Queue
- BufferList = BufferList->next;
- }
- // Offset is out of range of the buffer queue
- return AL_FALSE;
-}
-
-
-/*
- GetByteOffset
-
- Returns the 'true' byte offset into the Source's queue (from the Sample, Byte or Millisecond
- offset supplied by the application). This takes into account the fact that the buffer format
- may have been modifed by AL (e.g 8bit samples are converted to float)
-*/
-static ALint GetByteOffset(ALsource *Source)
-{
- const ALbuffer *Buffer = NULL;
- const ALbufferlistitem *BufferList;
- ALint ByteOffset = -1;
-
- // Find the first non-NULL Buffer in the Queue
- BufferList = Source->queue;
- while(BufferList)
- {
- if(BufferList->buffer)
- {
- Buffer = BufferList->buffer;
- break;
- }
- BufferList = BufferList->next;
- }
-
- if(!Buffer)
- {
- Source->lOffset = 0;
- return -1;
- }
-
- // Determine the ByteOffset (and ensure it is block aligned)
- switch(Source->lOffsetType)
- {
- case AL_BYTE_OFFSET:
- // Take into consideration the original format
- ByteOffset = Source->lOffset;
- if(Buffer->OriginalType == UserFmtIMA4)
- {
- // Round down to nearest ADPCM block
- ByteOffset /= 36 * ChannelsFromUserFmt(Buffer->OriginalChannels);
- // Multiply by compression rate (65 sample frames per block)
- ByteOffset *= 65;
- }
- else
- ByteOffset /= FrameSizeFromUserFmt(Buffer->OriginalChannels, Buffer->OriginalType);
- ByteOffset *= FrameSizeFromFmt(Buffer->FmtChannels, Buffer->FmtType);
- break;
-
- case AL_SAMPLE_OFFSET:
- ByteOffset = Source->lOffset * FrameSizeFromFmt(Buffer->FmtChannels, Buffer->FmtType);
- break;
-
- case AL_SEC_OFFSET:
- // Note - lOffset is internally stored as Milliseconds
- ByteOffset = (ALint)(Source->lOffset / 1000.0 * Buffer->Frequency);
- ByteOffset *= FrameSizeFromFmt(Buffer->FmtChannels, Buffer->FmtType);
- break;
- }
- // Clear Offset
- Source->lOffset = 0;
-
- return ByteOffset;
-}
-
-
-ALvoid ReleaseALSources(ALCcontext *Context)
-{
- ALsizei pos;
- ALuint j;
- for(pos = 0;pos < Context->SourceMap.size;pos++)
- {
- ALsource *temp = Context->SourceMap.array[pos].value;
- Context->SourceMap.array[pos].value = NULL;
-
- // For each buffer in the source's queue, decrement its reference counter and remove it
- while(temp->queue != NULL)
- {
- ALbufferlistitem *BufferList = temp->queue;
- temp->queue = BufferList->next;
-
- if(BufferList->buffer != NULL)
- BufferList->buffer->refcount--;
- free(BufferList);
- }
-
- for(j = 0;j < MAX_SENDS;++j)
- {
- if(temp->Send[j].Slot)
- temp->Send[j].Slot->refcount--;
- temp->Send[j].Slot = NULL;
- }
-
- // Release source structure
- ALTHUNK_REMOVEENTRY(temp->source);
- memset(temp, 0, sizeof(ALsource));
- free(temp);
- }
-}
diff --git a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alSource.h b/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alSource.h
deleted file mode 100644
index b4a91e9d1..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alSource.h
+++ /dev/null
@@ -1,124 +0,0 @@
-#ifndef _AL_SOURCE_H_
-#define _AL_SOURCE_H_
-
-#define MAX_SENDS 4
-
-#include "alFilter.h"
-#include "alu.h"
-#include "AL/al.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
- POINT_RESAMPLER = 0,
- LINEAR_RESAMPLER,
- CUBIC_RESAMPLER,
-
- RESAMPLER_MAX,
- RESAMPLER_MIN = -1,
- RESAMPLER_DEFAULT = LINEAR_RESAMPLER
-} resampler_t;
-extern resampler_t DefaultResampler;
-
-extern const ALsizei ResamplerPadding[RESAMPLER_MAX];
-extern const ALsizei ResamplerPrePadding[RESAMPLER_MAX];
-
-
-typedef struct ALbufferlistitem
-{
- struct ALbuffer *buffer;
- struct ALbufferlistitem *next;
- struct ALbufferlistitem *prev;
-} ALbufferlistitem;
-
-typedef struct ALsource
-{
- ALfp flPitch;
- ALfp flGain;
- ALfp flOuterGain;
- ALfp flMinGain;
- ALfp flMaxGain;
- ALfp flInnerAngle;
- ALfp flOuterAngle;
- ALfp flRefDistance;
- ALfp flMaxDistance;
- ALfp flRollOffFactor;
- ALfp vPosition[3];
- ALfp vVelocity[3];
- ALfp vOrientation[3];
- ALboolean bHeadRelative;
- ALboolean bLooping;
- ALenum DistanceModel;
-
- // Apportably Extension
- ALuint priority;
-
- resampler_t Resampler;
-
- ALenum state;
- ALuint position;
- ALuint position_fraction;
-
- struct ALbuffer *Buffer;
-
- ALbufferlistitem *queue; // Linked list of buffers in queue
- ALuint BuffersInQueue; // Number of buffers in queue
- ALuint BuffersPlayed; // Number of buffers played on this loop
-
- ALfilter DirectFilter;
-
- struct {
- struct ALeffectslot *Slot;
- ALfilter WetFilter;
- } Send[MAX_SENDS];
-
- ALboolean DryGainHFAuto;
- ALboolean WetGainAuto;
- ALboolean WetGainHFAuto;
- ALfp OuterGainHF;
-
- ALfp AirAbsorptionFactor;
- ALfp RoomRolloffFactor;
- ALfp DopplerFactor;
-
- ALint lOffset;
- ALint lOffsetType;
-
- // Source Type (Static, Streaming, or Undetermined)
- ALint lSourceType;
-
- // Current target parameters used for mixing
- ALboolean NeedsUpdate;
- struct {
- ALint Step;
-
- /* A mixing matrix. First subscript is the channel number of the input
- * data (regardless of channel configuration) and the second is the
- * channel target (eg. FRONT_LEFT) */
- ALfp DryGains[MAXCHANNELS][MAXCHANNELS];
- FILTER iirFilter;
- ALfp history[MAXCHANNELS*2];
-
- struct {
- ALfp WetGain;
- FILTER iirFilter;
- ALfp history[MAXCHANNELS];
- } Send[MAX_SENDS];
- } Params;
-
- ALvoid (*Update)(struct ALsource *self, const ALCcontext *context);
-
- // Index to itself
- ALuint source;
-} ALsource;
-#define ALsource_Update(s,a) ((s)->Update(s,a))
-
-ALvoid ReleaseALSources(ALCcontext *Context);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alState.c b/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alState.c
deleted file mode 100644
index 74c6a4079..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alState.c
+++ /dev/null
@@ -1,661 +0,0 @@
-/**
- * OpenAL cross platform audio library
- * Copyright (C) 1999-2000 by authors.
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- * Or go to http://www.gnu.org/copyleft/lgpl.html
- */
-
-#include "config.h"
-
-#include
-#include "alMain.h"
-#include "AL/alc.h"
-#include "AL/alext.h"
-#include "alError.h"
-#include "alSource.h"
-#include "alState.h"
-#include "alDatabuffer.h"
-
-static const ALchar alVendor[] = "OpenAL Community";
-static const ALchar alVersion[] = "1.1 ALSOFT "ALSOFT_VERSION;
-static const ALchar alRenderer[] = "OpenAL Soft";
-
-// Error Messages
-static const ALchar alNoError[] = "No Error";
-static const ALchar alErrInvalidName[] = "Invalid Name";
-static const ALchar alErrInvalidEnum[] = "Invalid Enum";
-static const ALchar alErrInvalidValue[] = "Invalid Value";
-static const ALchar alErrInvalidOp[] = "Invalid Operation";
-static const ALchar alErrOutOfMemory[] = "Out of Memory";
-
-AL_API ALvoid AL_APIENTRY alEnable(ALenum capability)
-{
- ALCcontext *Context;
- ALboolean updateSources = AL_FALSE;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- switch(capability)
- {
- case AL_SOURCE_DISTANCE_MODEL:
- Context->SourceDistanceModel = AL_TRUE;
- updateSources = AL_TRUE;
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
-
- if(updateSources)
- {
- ALsizei pos;
- for(pos = 0;pos < Context->SourceMap.size;pos++)
- {
- ALsource *source = Context->SourceMap.array[pos].value;
- source->NeedsUpdate = AL_TRUE;
- }
- }
-
- ProcessContext(Context);
-}
-
-AL_API ALvoid AL_APIENTRY alDisable(ALenum capability)
-{
- ALCcontext *Context;
- ALboolean updateSources = AL_FALSE;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- switch(capability)
- {
- case AL_SOURCE_DISTANCE_MODEL:
- Context->SourceDistanceModel = AL_FALSE;
- updateSources = AL_TRUE;
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
-
- if(updateSources)
- {
- ALsizei pos;
- for(pos = 0;pos < Context->SourceMap.size;pos++)
- {
- ALsource *source = Context->SourceMap.array[pos].value;
- source->NeedsUpdate = AL_TRUE;
- }
- }
-
- ProcessContext(Context);
-}
-
-AL_API ALboolean AL_APIENTRY alIsEnabled(ALenum capability)
-{
- ALCcontext *Context;
- ALboolean value=AL_FALSE;
-
- Context = GetContextSuspended();
- if(!Context) return AL_FALSE;
-
- switch(capability)
- {
- case AL_SOURCE_DISTANCE_MODEL:
- value = Context->SourceDistanceModel;
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
-
- ProcessContext(Context);
-
- return value;
-}
-
-AL_API ALboolean AL_APIENTRY alGetBoolean(ALenum pname)
-{
- ALCcontext *Context;
- ALboolean value=AL_FALSE;
-
- Context = GetContextSuspended();
- if(!Context) return AL_FALSE;
-
- switch(pname)
- {
- case AL_DOPPLER_FACTOR:
- if(Context->DopplerFactor != int2ALfp(0))
- value = AL_TRUE;
- break;
-
- case AL_DOPPLER_VELOCITY:
- if(Context->DopplerVelocity != int2ALfp(0))
- value = AL_TRUE;
- break;
-
- case AL_DISTANCE_MODEL:
- if(Context->DistanceModel == AL_INVERSE_DISTANCE_CLAMPED)
- value = AL_TRUE;
- break;
-
- case AL_SPEED_OF_SOUND:
- if(Context->flSpeedOfSound != int2ALfp(0))
- value = AL_TRUE;
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
-
- ProcessContext(Context);
-
- return value;
-}
-
-AL_API ALdouble AL_APIENTRY alGetDouble(ALenum pname)
-{
- ALCcontext *Context;
- ALdouble value = 0.0;
-
- Context = GetContextSuspended();
- if(!Context) return 0.0;
-
- switch(pname)
- {
- case AL_DOPPLER_FACTOR:
- value = (double)ALfp2float(Context->DopplerFactor);
- break;
-
- case AL_DOPPLER_VELOCITY:
- value = (double)ALfp2float(Context->DopplerVelocity);
- break;
-
- case AL_DISTANCE_MODEL:
- value = (double)Context->DistanceModel;
- break;
-
- case AL_SPEED_OF_SOUND:
- value = (double)ALfp2float(Context->flSpeedOfSound);
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
-
- ProcessContext(Context);
-
- return value;
-}
-
-AL_API ALfloat AL_APIENTRY alGetFloat(ALenum pname)
-{
- ALCcontext *Context;
- ALfloat value = 0.0f;
-
- Context = GetContextSuspended();
- if(!Context) return 0.0f;
-
- switch(pname)
- {
- case AL_DOPPLER_FACTOR:
- value = ALfp2float(Context->DopplerFactor);
- break;
-
- case AL_DOPPLER_VELOCITY:
- value = ALfp2float(Context->DopplerVelocity);
- break;
-
- case AL_DISTANCE_MODEL:
- value = (float)Context->DistanceModel;
- break;
-
- case AL_SPEED_OF_SOUND:
- value = ALfp2float(Context->flSpeedOfSound);
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
-
- ProcessContext(Context);
-
- return value;
-}
-
-AL_API ALint AL_APIENTRY alGetInteger(ALenum pname)
-{
- ALCcontext *Context;
- ALint value = 0;
-
- Context = GetContextSuspended();
- if(!Context) return 0;
-
- switch(pname)
- {
- case AL_DOPPLER_FACTOR:
- value = (ALint)ALfp2int(Context->DopplerFactor);
- break;
-
- case AL_DOPPLER_VELOCITY:
- value = (ALint)ALfp2int(Context->DopplerVelocity);
- break;
-
- case AL_DISTANCE_MODEL:
- value = (ALint)Context->DistanceModel;
- break;
-
- case AL_SPEED_OF_SOUND:
- value = (ALint)ALfp2int(Context->flSpeedOfSound);
- break;
-
- case AL_SAMPLE_SOURCE_EXT:
- if(Context->SampleSource)
- value = (ALint)Context->SampleSource->databuffer;
- else
- value = 0;
- break;
-
- case AL_SAMPLE_SINK_EXT:
- if(Context->SampleSink)
- value = (ALint)Context->SampleSink->databuffer;
- else
- value = 0;
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
-
- ProcessContext(Context);
-
- return value;
-}
-
-AL_API ALvoid AL_APIENTRY alGetBooleanv(ALenum pname,ALboolean *data)
-{
- ALCcontext *Context;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- if(data)
- {
- switch(pname)
- {
- case AL_DOPPLER_FACTOR:
- *data = (ALboolean)((Context->DopplerFactor != int2ALfp(0)) ? AL_TRUE : AL_FALSE);
- break;
-
- case AL_DOPPLER_VELOCITY:
- *data = (ALboolean)((Context->DopplerVelocity != int2ALfp(0)) ? AL_TRUE : AL_FALSE);
- break;
-
- case AL_DISTANCE_MODEL:
- *data = (ALboolean)((Context->DistanceModel == AL_INVERSE_DISTANCE_CLAMPED) ? AL_TRUE : AL_FALSE);
- break;
-
- case AL_SPEED_OF_SOUND:
- *data = (ALboolean)((Context->flSpeedOfSound != int2ALfp(0)) ? AL_TRUE : AL_FALSE);
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else
- {
- // data is a NULL pointer
- alSetError(Context, AL_INVALID_VALUE);
- }
-
- ProcessContext(Context);
-}
-
-AL_API ALvoid AL_APIENTRY alGetDoublev(ALenum pname,ALdouble *data)
-{
- ALCcontext *Context;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- if(data)
- {
- switch(pname)
- {
- case AL_DOPPLER_FACTOR:
- *data = (double)ALfp2float(Context->DopplerFactor);
- break;
-
- case AL_DOPPLER_VELOCITY:
- *data = (double)ALfp2float(Context->DopplerVelocity);
- break;
-
- case AL_DISTANCE_MODEL:
- *data = (double)Context->DistanceModel;
- break;
-
- case AL_SPEED_OF_SOUND:
- *data = (double)ALfp2float(Context->flSpeedOfSound);
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else
- {
- // data is a NULL pointer
- alSetError(Context, AL_INVALID_VALUE);
- }
-
- ProcessContext(Context);
-}
-
-AL_API ALvoid AL_APIENTRY alGetFloatv(ALenum pname,ALfloat *data)
-{
- ALCcontext *Context;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- if(data)
- {
- switch(pname)
- {
- case AL_DOPPLER_FACTOR:
- *data = ALfp2float(Context->DopplerFactor);
- break;
-
- case AL_DOPPLER_VELOCITY:
- *data = ALfp2float(Context->DopplerVelocity);
- break;
-
- case AL_DISTANCE_MODEL:
- *data = (float)Context->DistanceModel;
- break;
-
- case AL_SPEED_OF_SOUND:
- *data = ALfp2float(Context->flSpeedOfSound);
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else
- {
- // data is a NULL pointer
- alSetError(Context, AL_INVALID_VALUE);
- }
-
- ProcessContext(Context);
-}
-
-AL_API ALvoid AL_APIENTRY alGetIntegerv(ALenum pname,ALint *data)
-{
- ALCcontext *Context;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- if(data)
- {
- switch(pname)
- {
- case AL_DOPPLER_FACTOR:
- *data = (ALint)ALfp2int(Context->DopplerFactor);
- break;
-
- case AL_DOPPLER_VELOCITY:
- *data = (ALint)ALfp2int(Context->DopplerVelocity);
- break;
-
- case AL_DISTANCE_MODEL:
- *data = (ALint)Context->DistanceModel;
- break;
-
- case AL_SPEED_OF_SOUND:
- *data = (ALint)ALfp2int(Context->flSpeedOfSound);
- break;
-
- case AL_SAMPLE_SOURCE_EXT:
- if(Context->SampleSource)
- *data = (ALint)Context->SampleSource->databuffer;
- else
- *data = 0;
- break;
-
- case AL_SAMPLE_SINK_EXT:
- if(Context->SampleSink)
- *data = (ALint)Context->SampleSink->databuffer;
- else
- *data = 0;
- break;
-
- default:
- alSetError(Context, AL_INVALID_ENUM);
- break;
- }
- }
- else
- {
- // data is a NULL pointer
- alSetError(Context, AL_INVALID_VALUE);
- }
-
- ProcessContext(Context);
-}
-
-AL_API const ALchar* AL_APIENTRY alGetString(ALenum pname)
-{
- const ALchar *value;
- ALCcontext *pContext;
-
- pContext = GetContextSuspended();
- if(!pContext) return NULL;
-
- switch(pname)
- {
- case AL_VENDOR:
- value=alVendor;
- break;
-
- case AL_VERSION:
- value=alVersion;
- break;
-
- case AL_RENDERER:
- value=alRenderer;
- break;
-
- case AL_EXTENSIONS:
- value=pContext->ExtensionList;//alExtensions;
- break;
-
- case AL_NO_ERROR:
- value=alNoError;
- break;
-
- case AL_INVALID_NAME:
- value=alErrInvalidName;
- break;
-
- case AL_INVALID_ENUM:
- value=alErrInvalidEnum;
- break;
-
- case AL_INVALID_VALUE:
- value=alErrInvalidValue;
- break;
-
- case AL_INVALID_OPERATION:
- value=alErrInvalidOp;
- break;
-
- case AL_OUT_OF_MEMORY:
- value=alErrOutOfMemory;
- break;
-
- default:
- value=NULL;
- alSetError(pContext, AL_INVALID_ENUM);
- break;
- }
-
- ProcessContext(pContext);
-
- return value;
-}
-
-AL_API ALvoid AL_APIENTRY alDopplerFactor(ALfloat value)
-{
- ALCcontext *Context;
- ALboolean updateSources = AL_FALSE;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- if(value >= 0.0f)
- {
- Context->DopplerFactor = float2ALfp(value);
- updateSources = AL_TRUE;
- }
- else
- alSetError(Context, AL_INVALID_VALUE);
-
- // Force updating the sources for these parameters, since even head-
- // relative sources are affected
- if(updateSources)
- {
- ALsizei pos;
- for(pos = 0;pos < Context->SourceMap.size;pos++)
- {
- ALsource *source = Context->SourceMap.array[pos].value;
- source->NeedsUpdate = AL_TRUE;
- }
- }
-
- ProcessContext(Context);
-}
-
-AL_API ALvoid AL_APIENTRY alDopplerVelocity(ALfloat value)
-{
- ALCcontext *Context;
- ALboolean updateSources = AL_FALSE;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- if(value > 0.0f)
- {
- Context->DopplerVelocity=float2ALfp(value);
- updateSources = AL_TRUE;
- }
- else
- alSetError(Context, AL_INVALID_VALUE);
-
- if(updateSources)
- {
- ALsizei pos;
- for(pos = 0;pos < Context->SourceMap.size;pos++)
- {
- ALsource *source = Context->SourceMap.array[pos].value;
- source->NeedsUpdate = AL_TRUE;
- }
- }
-
- ProcessContext(Context);
-}
-
-AL_API ALvoid AL_APIENTRY alSpeedOfSound(ALfloat flSpeedOfSound)
-{
- ALCcontext *pContext;
- ALboolean updateSources = AL_FALSE;
-
- pContext = GetContextSuspended();
- if(!pContext) return;
-
- if(flSpeedOfSound > 0.0f)
- {
- pContext->flSpeedOfSound = float2ALfp(flSpeedOfSound);
- updateSources = AL_TRUE;
- }
- else
- alSetError(pContext, AL_INVALID_VALUE);
-
- if(updateSources)
- {
- ALsizei pos;
- for(pos = 0;pos < pContext->SourceMap.size;pos++)
- {
- ALsource *source = pContext->SourceMap.array[pos].value;
- source->NeedsUpdate = AL_TRUE;
- }
- }
-
- ProcessContext(pContext);
-}
-
-AL_API ALvoid AL_APIENTRY alDistanceModel(ALenum value)
-{
- ALCcontext *Context;
- ALboolean updateSources = AL_FALSE;
-
- Context = GetContextSuspended();
- if(!Context) return;
-
- switch(value)
- {
- case AL_NONE:
- case AL_INVERSE_DISTANCE:
- case AL_INVERSE_DISTANCE_CLAMPED:
- case AL_LINEAR_DISTANCE:
- case AL_LINEAR_DISTANCE_CLAMPED:
- case AL_EXPONENT_DISTANCE:
- case AL_EXPONENT_DISTANCE_CLAMPED:
- Context->DistanceModel = value;
- updateSources = !Context->SourceDistanceModel;
- break;
-
- default:
- alSetError(Context, AL_INVALID_VALUE);
- break;
- }
-
- if(updateSources)
- {
- ALsizei pos;
- for(pos = 0;pos < Context->SourceMap.size;pos++)
- {
- ALsource *source = Context->SourceMap.array[pos].value;
- source->NeedsUpdate = AL_TRUE;
- }
- }
-
- ProcessContext(Context);
-}
diff --git a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alState.h b/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alState.h
deleted file mode 100644
index 332176b03..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alState.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef _AL_STATE_H_
-#define _AL_STATE_H_
-
-#include "AL/al.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alThunk.c b/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alThunk.c
deleted file mode 100644
index 08b80b067..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alThunk.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/**
- * OpenAL cross platform audio library
- * Copyright (C) 1999-2007 by authors.
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- * Or go to http://www.gnu.org/copyleft/lgpl.html
- */
-
-#include "config.h"
-
-#include
-
-#include "alMain.h"
-#include "alThunk.h"
-
-typedef struct {
- ALvoid *ptr;
- ALboolean InUse;
-} ThunkEntry;
-
-static ThunkEntry *g_ThunkArray;
-static ALuint g_ThunkArraySize;
-
-static CRITICAL_SECTION g_ThunkLock;
-
-void alThunkInit(void)
-{
- InitializeCriticalSection(&g_ThunkLock);
- g_ThunkArraySize = 1;
- g_ThunkArray = calloc(1, g_ThunkArraySize * sizeof(ThunkEntry));
-}
-
-void alThunkExit(void)
-{
- free(g_ThunkArray);
- g_ThunkArray = NULL;
- g_ThunkArraySize = 0;
- DeleteCriticalSection(&g_ThunkLock);
-}
-
-ALuint alThunkAddEntry(ALvoid *ptr)
-{
- ALuint index;
-
- EnterCriticalSection(&g_ThunkLock);
-
- for(index = 0;index < g_ThunkArraySize;index++)
- {
- if(g_ThunkArray[index].InUse == AL_FALSE)
- break;
- }
-
- if(index == g_ThunkArraySize)
- {
- ThunkEntry *NewList;
-
- NewList = realloc(g_ThunkArray, g_ThunkArraySize*2 * sizeof(ThunkEntry));
- if(!NewList)
- {
- LeaveCriticalSection(&g_ThunkLock);
- AL_PRINT("Realloc failed to increase to %u enties!\n", g_ThunkArraySize*2);
- return 0;
- }
- memset(&NewList[g_ThunkArraySize], 0, g_ThunkArraySize*sizeof(ThunkEntry));
- g_ThunkArraySize *= 2;
- g_ThunkArray = NewList;
- }
-
- g_ThunkArray[index].ptr = ptr;
- g_ThunkArray[index].InUse = AL_TRUE;
-
- LeaveCriticalSection(&g_ThunkLock);
-
- return index+1;
-}
-
-void alThunkRemoveEntry(ALuint index)
-{
- EnterCriticalSection(&g_ThunkLock);
-
- if(index > 0 && index <= g_ThunkArraySize)
- g_ThunkArray[index-1].InUse = AL_FALSE;
-
- LeaveCriticalSection(&g_ThunkLock);
-}
-
-ALvoid *alThunkLookupEntry(ALuint index)
-{
- ALvoid *ptr = NULL;
-
- EnterCriticalSection(&g_ThunkLock);
-
- if(index > 0 && index <= g_ThunkArraySize)
- ptr = g_ThunkArray[index-1].ptr;
-
- LeaveCriticalSection(&g_ThunkLock);
-
- return ptr;
-}
diff --git a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alThunk.h b/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alThunk.h
deleted file mode 100644
index 902f00e54..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alThunk.h
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef _AL_THUNK_H_
-#define _AL_THUNK_H_
-
-#include "config.h"
-
-#include "AL/al.h"
-#include "AL/alc.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void alThunkInit(void);
-void alThunkExit(void);
-ALuint alThunkAddEntry(ALvoid *ptr);
-void alThunkRemoveEntry(ALuint index);
-ALvoid *alThunkLookupEntry(ALuint index);
-
-#if (SIZEOF_VOIDP > SIZEOF_UINT)
-
-#define ALTHUNK_INIT() alThunkInit()
-#define ALTHUNK_EXIT() alThunkExit()
-#define ALTHUNK_ADDENTRY(p) alThunkAddEntry(p)
-#define ALTHUNK_REMOVEENTRY(i) alThunkRemoveEntry(i)
-#define ALTHUNK_LOOKUPENTRY(i) alThunkLookupEntry(i)
-
-#else
-
-#define ALTHUNK_INIT()
-#define ALTHUNK_EXIT()
-#define ALTHUNK_ADDENTRY(p) ((ALuint)p)
-#define ALTHUNK_REMOVEENTRY(i) ((ALvoid)i)
-#define ALTHUNK_LOOKUPENTRY(i) ((ALvoid*)(i))
-
-#endif // (SIZEOF_VOIDP > SIZEOF_INT)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //_AL_THUNK_H_
-
diff --git a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alu.h b/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alu.h
deleted file mode 100644
index 508eb3800..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/OpenAL32/alu.h
+++ /dev/null
@@ -1,140 +0,0 @@
-#ifndef _ALU_H_
-#define _ALU_H_
-
-#include "config.h"
-
-#include "AL/al.h"
-#include "AL/alc.h"
-#include "AL/alext.h"
-
-#include
-#include
-#ifdef HAVE_FLOAT_H
-#include
-#endif
-
-#ifndef M_PI
-#define M_PI 3.14159265358979323846 /* pi */
-#define M_PI_2 1.57079632679489661923 /* pi/2 */
-#endif
-
-#ifdef HAVE_POWF
-#define aluPow(x,y) (float2ALfp(powf(ALfp2float(x), ALfp2float(y))))
-#else
-#define aluPow(x,y) (float2ALfp((float)pow((double)ALfp2float(x), (double)ALfp2float(y))))
-#endif
-
-#ifdef HAVE_SQRTF
-#define aluSqrt(x) (float2ALfp(sqrtf(ALfp2float(x))))
-#else
-#define aluSqrt(x) (float2ALfp((float)sqrt((double)ALfp2float(x))))
-#endif
-
-#ifdef HAVE_ACOSF
-#define aluAcos(x) (float2ALfp(acosf(ALfp2float(x))))
-#else
-#define aluAcos(x) (float2ALfp((float)acos((double)ALfp2float(x))))
-#endif
-
-#ifdef HAVE_ATANF
-#define aluAtan(x) (float2ALfp(atanf(ALfp2float(x))))
-#else
-#define aluAtan(x) (float2ALfp((float)atan((double)ALfp2float(x))))
-#endif
-
-#ifdef HAVE_FABSF
-#define aluFabs(x) (float2ALfp(fabsf(ALfp2float(x))))
-#else
-#define aluFabs(x) (float2ALfp((float)fabs((double)ALfp2float(x))))
-#endif
-
-// FIXME make this better
-#if defined(max) && !defined(__max)
-#define __max(x,y) float2ALfp(max(ALfp2float(x),ALfp2float(y)))
-#endif
-#if defined(min) && !defined(__min)
-#define __min(x,y) float2ALfp(min(ALfp2float(x),ALfp2float(y)))
-#endif
-
-#define QUADRANT_NUM 128
-#define LUT_NUM (4 * QUADRANT_NUM)
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
- FRONT_LEFT = 0,
- FRONT_RIGHT,
- FRONT_CENTER,
- LFE,
- BACK_LEFT,
- BACK_RIGHT,
- BACK_CENTER,
- SIDE_LEFT,
- SIDE_RIGHT,
-} Channel;
-
-#ifndef MAXCHANNELS
-#define MAXCHANNELS (SIDE_RIGHT+1)
-#error MAXCHANNELS
-#endif
-
-#define BUFFERSIZE 4096
-
-#define FRACTIONBITS (14)
-#define FRACTIONONE (1< Hz
- */
-#define ALC_FREQUENCY 0x1007
-
-/**
- * followed by Hz
- */
-#define ALC_REFRESH 0x1008
-
-/**
- * followed by AL_TRUE, AL_FALSE
- */
-#define ALC_SYNC 0x1009
-
-/**
- * followed by Num of requested Mono (3D) Sources
- */
-#define ALC_MONO_SOURCES 0x1010
-
-/**
- * followed by Num of requested Stereo Sources
- */
-#define ALC_STEREO_SOURCES 0x1011
-
-/**
- * errors
- */
-
-/**
- * No error
- */
-#define ALC_NO_ERROR ALC_FALSE
-
-/**
- * No device
- */
-#define ALC_INVALID_DEVICE 0xA001
-
-/**
- * invalid context ID
- */
-#define ALC_INVALID_CONTEXT 0xA002
-
-/**
- * bad enum
- */
-#define ALC_INVALID_ENUM 0xA003
-
-/**
- * bad value
- */
-#define ALC_INVALID_VALUE 0xA004
-
-/**
- * Out of memory.
- */
-#define ALC_OUT_OF_MEMORY 0xA005
-
-
-/**
- * The Specifier string for default device
- */
-#define ALC_DEFAULT_DEVICE_SPECIFIER 0x1004
-#define ALC_DEVICE_SPECIFIER 0x1005
-#define ALC_EXTENSIONS 0x1006
-
-#define ALC_MAJOR_VERSION 0x1000
-#define ALC_MINOR_VERSION 0x1001
-
-#define ALC_ATTRIBUTES_SIZE 0x1002
-#define ALC_ALL_ATTRIBUTES 0x1003
-
-
-/**
- * Capture extension
- */
-#define ALC_CAPTURE_DEVICE_SPECIFIER 0x310
-#define ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER 0x311
-#define ALC_CAPTURE_SAMPLES 0x312
-
-
-/*
- * Context Management
- */
-ALC_API ALCcontext * ALC_APIENTRY alcCreateContext( ALCdevice *device, const ALCint* attrlist );
-
-ALC_API ALCboolean ALC_APIENTRY alcMakeContextCurrent( ALCcontext *context );
-
-ALC_API void ALC_APIENTRY alcProcessContext( ALCcontext *context );
-
-ALC_API void ALC_APIENTRY alcSuspendContext( ALCcontext *context );
-
-ALC_API void ALC_APIENTRY alcDestroyContext( ALCcontext *context );
-
-ALC_API ALCcontext * ALC_APIENTRY alcGetCurrentContext( void );
-
-ALC_API ALCdevice* ALC_APIENTRY alcGetContextsDevice( ALCcontext *context );
-
-
-/*
- * Device Management
- */
-ALC_API ALCdevice * ALC_APIENTRY alcOpenDevice( const ALCchar *devicename );
-
-ALC_API ALCboolean ALC_APIENTRY alcCloseDevice( ALCdevice *device );
-
-
-/*
- * Error support.
- * Obtain the most recent Context error
- */
-ALC_API ALCenum ALC_APIENTRY alcGetError( ALCdevice *device );
-
-
-/*
- * Extension support.
- * Query for the presence of an extension, and obtain any appropriate
- * function pointers and enum values.
- */
-ALC_API ALCboolean ALC_APIENTRY alcIsExtensionPresent( ALCdevice *device, const ALCchar *extname );
-
-ALC_API void * ALC_APIENTRY alcGetProcAddress( ALCdevice *device, const ALCchar *funcname );
-
-ALC_API ALCenum ALC_APIENTRY alcGetEnumValue( ALCdevice *device, const ALCchar *enumname );
-
-
-/*
- * Query functions
- */
-ALC_API const ALCchar * ALC_APIENTRY alcGetString( ALCdevice *device, ALCenum param );
-
-ALC_API void ALC_APIENTRY alcGetIntegerv( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *data );
-
-
-/*
- * Capture functions
- */
-ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize );
-
-ALC_API ALCboolean ALC_APIENTRY alcCaptureCloseDevice( ALCdevice *device );
-
-ALC_API void ALC_APIENTRY alcCaptureStart( ALCdevice *device );
-
-ALC_API void ALC_APIENTRY alcCaptureStop( ALCdevice *device );
-
-ALC_API void ALC_APIENTRY alcCaptureSamples( ALCdevice *device, ALCvoid *buffer, ALCsizei samples );
-
-/*
- * Pointer-to-function types, useful for dynamically getting ALC entry points.
- */
-typedef ALCcontext * (ALC_APIENTRY *LPALCCREATECONTEXT) (ALCdevice *device, const ALCint *attrlist);
-typedef ALCboolean (ALC_APIENTRY *LPALCMAKECONTEXTCURRENT)( ALCcontext *context );
-typedef void (ALC_APIENTRY *LPALCPROCESSCONTEXT)( ALCcontext *context );
-typedef void (ALC_APIENTRY *LPALCSUSPENDCONTEXT)( ALCcontext *context );
-typedef void (ALC_APIENTRY *LPALCDESTROYCONTEXT)( ALCcontext *context );
-typedef ALCcontext * (ALC_APIENTRY *LPALCGETCURRENTCONTEXT)( void );
-typedef ALCdevice * (ALC_APIENTRY *LPALCGETCONTEXTSDEVICE)( ALCcontext *context );
-typedef ALCdevice * (ALC_APIENTRY *LPALCOPENDEVICE)( const ALCchar *devicename );
-typedef ALCboolean (ALC_APIENTRY *LPALCCLOSEDEVICE)( ALCdevice *device );
-typedef ALCenum (ALC_APIENTRY *LPALCGETERROR)( ALCdevice *device );
-typedef ALCboolean (ALC_APIENTRY *LPALCISEXTENSIONPRESENT)( ALCdevice *device, const ALCchar *extname );
-typedef void * (ALC_APIENTRY *LPALCGETPROCADDRESS)(ALCdevice *device, const ALCchar *funcname );
-typedef ALCenum (ALC_APIENTRY *LPALCGETENUMVALUE)(ALCdevice *device, const ALCchar *enumname );
-typedef const ALCchar* (ALC_APIENTRY *LPALCGETSTRING)( ALCdevice *device, ALCenum param );
-typedef void (ALC_APIENTRY *LPALCGETINTEGERV)( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *dest );
-typedef ALCdevice * (ALC_APIENTRY *LPALCCAPTUREOPENDEVICE)( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize );
-typedef ALCboolean (ALC_APIENTRY *LPALCCAPTURECLOSEDEVICE)( ALCdevice *device );
-typedef void (ALC_APIENTRY *LPALCCAPTURESTART)( ALCdevice *device );
-typedef void (ALC_APIENTRY *LPALCCAPTURESTOP)( ALCdevice *device );
-typedef void (ALC_APIENTRY *LPALCCAPTURESAMPLES)( ALCdevice *device, ALCvoid *buffer, ALCsizei samples );
-
-#if defined(TARGET_OS_MAC) && TARGET_OS_MAC
- #pragma export off
-#endif
-
-#if defined(__cplusplus)
-}
-#endif
-
-#endif /* AL_ALC_H */
diff --git a/internal/c/parts/audio/out/android/OpenAL/build.mk b/internal/c/parts/audio/out/android/OpenAL/build.mk
deleted file mode 100644
index 6ffe5a25d..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/build.mk
+++ /dev/null
@@ -1,54 +0,0 @@
-MODULE = System/OpenAL
-
-CCFLAGS = \
- -I$(SYSDIR) \
- -I$(SYSDIR)/OpenAL/include \
- -I$(SYSDIR)/OpenAL/OpenAL32/Include \
- -DAL_BUILD_LIBRARY \
- -DAL_ALEXT_PROTOTYPES \
- -DVERDE_USE_REAL_FILE_IO \
-
-OBJECTS = \
-
-ifneq ($(OS), mac)
-OBJECTS += \
- OpenAL32/alAuxEffectSlot.o \
- OpenAL32/alBuffer.o \
- OpenAL32/alDatabuffer.o \
- OpenAL32/alEffect.o \
- OpenAL32/alError.o \
- OpenAL32/alExtension.o \
- OpenAL32/alFilter.o \
- OpenAL32/alListener.o \
- OpenAL32/alSource.o \
- OpenAL32/alState.o \
- OpenAL32/alThunk.o \
- Alc/ALc.o \
- Alc/alcConfig.o \
- Alc/alcEcho.o \
- Alc/alcModulator.o \
- Alc/alcReverb.o \
- Alc/alcRing.o \
- Alc/alcThread.o \
- Alc/ALu.o \
- Alc/bs2b.o \
- Alc/null.o \
- Alc/panning.o \
- Alc/mixer.o \
-
-endif
-
-ifeq ($(TARGET_OS), android)
-OBJECTS += Alc/audiotrack.o
-ifdef POST_FROYO
-OBJECTS += Alc/opensles.o
-endif
-CCFLAGS += -I/Developer/AndroidNDK/platforms/android-9/arch-arm/usr/include
-CCFLAGS += -DOPENAL_FIXED_POINT -DOPENAL_FIXED_POINT_SHIFT=16
-endif
-
-ifeq ($(OS), linux)
-OBJECTS += Alc/oss.o
-endif
-
-include $(ROOTDIR)/module.mk
diff --git a/internal/c/parts/audio/out/android/OpenAL/include/AL/al.h b/internal/c/parts/audio/out/android/OpenAL/include/AL/al.h
deleted file mode 100644
index e084b3ed3..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/include/AL/al.h
+++ /dev/null
@@ -1,825 +0,0 @@
-#ifndef AL_AL_H
-#define AL_AL_H
-
-#ifdef ANDROID
-#include
-#ifndef LOGI
-#define LOGI(...) __android_log_print(ANDROID_LOG_INFO,"OpenAL",__VA_ARGS__)
-#endif
-#ifndef LOGE
-#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,"OpenAL",__VA_ARGS__)
-#endif
-#endif
-
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
-#if defined(AL_LIBTYPE_STATIC)
- #define AL_API
-#elif defined(_WIN32) && !defined(_XBOX)
- #if defined(AL_BUILD_LIBRARY)
- #define AL_API __declspec(dllexport)
- #else
- #define AL_API __declspec(dllimport)
- #endif
-#else
- #if defined(AL_BUILD_LIBRARY) && defined(HAVE_GCC_VISIBILITY)
- #define AL_API __attribute__((visibility("protected")))
- #else
- #define AL_API extern
- #endif
-#endif
-
-#if defined(_WIN32)
- #define AL_APIENTRY __cdecl
-#else
- #define AL_APIENTRY
-#endif
-
-#if defined(TARGET_OS_MAC) && TARGET_OS_MAC
- #pragma export on
-#endif
-
-/*
- * The OPENAL, ALAPI, ALAPIENTRY, AL_INVALID, AL_ILLEGAL_ENUM, and
- * AL_ILLEGAL_COMMAND macros are deprecated, but are included for
- * applications porting code from AL 1.0
- */
-#define OPENAL
-#define ALAPI AL_API
-#define ALAPIENTRY AL_APIENTRY
-#define AL_INVALID (-1)
-#define AL_ILLEGAL_ENUM AL_INVALID_ENUM
-#define AL_ILLEGAL_COMMAND AL_INVALID_OPERATION
-
-#define AL_VERSION_1_0
-#define AL_VERSION_1_1
-
-
-/** 8-bit boolean */
-typedef char ALboolean;
-
-/** character */
-typedef char ALchar;
-
-/** signed 8-bit 2's complement integer */
-typedef signed char ALbyte;
-
-/** unsigned 8-bit integer */
-typedef unsigned char ALubyte;
-
-/** signed 16-bit 2's complement integer */
-typedef short ALshort;
-
-/** unsigned 16-bit integer */
-typedef unsigned short ALushort;
-
-/** signed 32-bit 2's complement integer */
-typedef int ALint;
-
-/** unsigned 32-bit integer */
-typedef unsigned int ALuint;
-
-/** non-negative 32-bit binary integer size */
-typedef int ALsizei;
-
-/** enumerated 32-bit value */
-typedef int ALenum;
-
-/** 32-bit IEEE754 floating-point */
-typedef float ALfloat;
-
-/** 64-bit IEEE754 floating-point */
-typedef double ALdouble;
-
-#ifdef OPENAL_FIXED_POINT
-/* Apportable tries to define int64_t and int32_t if it thinks it is needed.
- * But this is breaking in a complex project involving both pure C and C++
- * something is triggering redefinition errors. The workaround seems to be just using stdint.h.
- */
-#include
-/** Types and Macros for fixed-point math */
-#ifndef INT64_MAX
-typedef long long int64_t;
-#define INT64_MAX 9223372036854775807LL
-
-#endif
-#ifndef INT32_MAX
-typedef int int32_t;
-#define INT32_MAX 2147483647
-#endif
-
-// FIXME(apportable) make this int32_t
-typedef int64_t ALfp;
-typedef int64_t ALdfp;
-
-#define ONE (1<=0 ? 0.5 : -0.5)))
-#define ALfp2float(x) ((float)(x) / (1<=0 ? 0.5 : -0.5)))
-#define ALdfp2double(x) ((double)(x) / (1<> OPENAL_FIXED_POINT_SHIFT))
-
-#define int2ALdfp(x) ((ALdfp)(x) << OPENAL_FIXED_POINT_SHIFT)
-#define ALdfp2int(x) ((ALint)((x) >> OPENAL_FIXED_POINT_SHIFT))
-
-#define ALfpMult(x,y) ((ALfp)((((int64_t)(x))*((int64_t)(y)))>>OPENAL_FIXED_POINT_SHIFT))
-#define ALfpDiv(x,y) ((ALfp)(((int64_t)(x) << OPENAL_FIXED_POINT_SHIFT) / (y)))
-
-#define ALdfpMult(x,y) ALfpMult(x,y)
-#define ALdfpDiv(x,y) ALfpDiv(x,y)
-
-#define __isnan(x) (0)
-#define __cos(x) (float2ALfp(cos(ALfp2float(x))))
-#define __sin(x) (float2ALfp(sin(ALfp2float(x))))
-#define __log10(x) (float2ALfp(log10(ALfp2float(x))))
-#define __atan(x) (float2ALfp(atan(ALfp2float(x))))
-
-#define toALfpConst(x) ((x)*(1< Hz
- */
-#define ALC_FREQUENCY 0x1007
-
-/**
- * followed by Hz
- */
-#define ALC_REFRESH 0x1008
-
-/**
- * followed by AL_TRUE, AL_FALSE
- */
-#define ALC_SYNC 0x1009
-
-/**
- * followed by Num of requested Mono (3D) Sources
- */
-#define ALC_MONO_SOURCES 0x1010
-
-/**
- * followed by Num of requested Stereo Sources
- */
-#define ALC_STEREO_SOURCES 0x1011
-
-/**
- * errors
- */
-
-/**
- * No error
- */
-#define ALC_NO_ERROR ALC_FALSE
-
-/**
- * No device
- */
-#define ALC_INVALID_DEVICE 0xA001
-
-/**
- * invalid context ID
- */
-#define ALC_INVALID_CONTEXT 0xA002
-
-/**
- * bad enum
- */
-#define ALC_INVALID_ENUM 0xA003
-
-/**
- * bad value
- */
-#define ALC_INVALID_VALUE 0xA004
-
-/**
- * Out of memory.
- */
-#define ALC_OUT_OF_MEMORY 0xA005
-
-
-/**
- * The Specifier string for default device
- */
-#define ALC_DEFAULT_DEVICE_SPECIFIER 0x1004
-#define ALC_DEVICE_SPECIFIER 0x1005
-#define ALC_EXTENSIONS 0x1006
-
-#define ALC_MAJOR_VERSION 0x1000
-#define ALC_MINOR_VERSION 0x1001
-
-#define ALC_ATTRIBUTES_SIZE 0x1002
-#define ALC_ALL_ATTRIBUTES 0x1003
-
-
-/**
- * Capture extension
- */
-#define ALC_CAPTURE_DEVICE_SPECIFIER 0x310
-#define ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER 0x311
-#define ALC_CAPTURE_SAMPLES 0x312
-
-
-/*
- * Context Management
- */
-ALC_API ALCcontext * ALC_APIENTRY alcCreateContext( ALCdevice *device, const ALCint* attrlist );
-
-ALC_API ALCboolean ALC_APIENTRY alcMakeContextCurrent( ALCcontext *context );
-
-ALC_API void ALC_APIENTRY alcProcessContext( ALCcontext *context );
-
-ALC_API void ALC_APIENTRY alcSuspendContext( ALCcontext *context );
-
-ALC_API void ALC_APIENTRY alcDestroyContext( ALCcontext *context );
-
-ALC_API ALCcontext * ALC_APIENTRY alcGetCurrentContext( void );
-
-ALC_API ALCdevice* ALC_APIENTRY alcGetContextsDevice( ALCcontext *context );
-
-
-/*
- * Device Management
- */
-ALC_API ALCdevice * ALC_APIENTRY alcOpenDevice( const ALCchar *devicename );
-
-ALC_API ALCboolean ALC_APIENTRY alcCloseDevice( ALCdevice *device );
-
-
-/*
- * Error support.
- * Obtain the most recent Context error
- */
-ALC_API ALCenum ALC_APIENTRY alcGetError( ALCdevice *device );
-
-
-/*
- * Extension support.
- * Query for the presence of an extension, and obtain any appropriate
- * function pointers and enum values.
- */
-ALC_API ALCboolean ALC_APIENTRY alcIsExtensionPresent( ALCdevice *device, const ALCchar *extname );
-
-ALC_API void * ALC_APIENTRY alcGetProcAddress( ALCdevice *device, const ALCchar *funcname );
-
-ALC_API ALCenum ALC_APIENTRY alcGetEnumValue( ALCdevice *device, const ALCchar *enumname );
-
-
-/*
- * Query functions
- */
-ALC_API const ALCchar * ALC_APIENTRY alcGetString( ALCdevice *device, ALCenum param );
-
-ALC_API void ALC_APIENTRY alcGetIntegerv( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *data );
-
-
-/*
- * Capture functions
- */
-ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize );
-
-ALC_API ALCboolean ALC_APIENTRY alcCaptureCloseDevice( ALCdevice *device );
-
-ALC_API void ALC_APIENTRY alcCaptureStart( ALCdevice *device );
-
-ALC_API void ALC_APIENTRY alcCaptureStop( ALCdevice *device );
-
-ALC_API void ALC_APIENTRY alcCaptureSamples( ALCdevice *device, ALCvoid *buffer, ALCsizei samples );
-
-/*
- * Pointer-to-function types, useful for dynamically getting ALC entry points.
- */
-typedef ALCcontext * (ALC_APIENTRY *LPALCCREATECONTEXT) (ALCdevice *device, const ALCint *attrlist);
-typedef ALCboolean (ALC_APIENTRY *LPALCMAKECONTEXTCURRENT)( ALCcontext *context );
-typedef void (ALC_APIENTRY *LPALCPROCESSCONTEXT)( ALCcontext *context );
-typedef void (ALC_APIENTRY *LPALCSUSPENDCONTEXT)( ALCcontext *context );
-typedef void (ALC_APIENTRY *LPALCDESTROYCONTEXT)( ALCcontext *context );
-typedef ALCcontext * (ALC_APIENTRY *LPALCGETCURRENTCONTEXT)( void );
-typedef ALCdevice * (ALC_APIENTRY *LPALCGETCONTEXTSDEVICE)( ALCcontext *context );
-typedef ALCdevice * (ALC_APIENTRY *LPALCOPENDEVICE)( const ALCchar *devicename );
-typedef ALCboolean (ALC_APIENTRY *LPALCCLOSEDEVICE)( ALCdevice *device );
-typedef ALCenum (ALC_APIENTRY *LPALCGETERROR)( ALCdevice *device );
-typedef ALCboolean (ALC_APIENTRY *LPALCISEXTENSIONPRESENT)( ALCdevice *device, const ALCchar *extname );
-typedef void * (ALC_APIENTRY *LPALCGETPROCADDRESS)(ALCdevice *device, const ALCchar *funcname );
-typedef ALCenum (ALC_APIENTRY *LPALCGETENUMVALUE)(ALCdevice *device, const ALCchar *enumname );
-typedef const ALCchar* (ALC_APIENTRY *LPALCGETSTRING)( ALCdevice *device, ALCenum param );
-typedef void (ALC_APIENTRY *LPALCGETINTEGERV)( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *dest );
-typedef ALCdevice * (ALC_APIENTRY *LPALCCAPTUREOPENDEVICE)( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize );
-typedef ALCboolean (ALC_APIENTRY *LPALCCAPTURECLOSEDEVICE)( ALCdevice *device );
-typedef void (ALC_APIENTRY *LPALCCAPTURESTART)( ALCdevice *device );
-typedef void (ALC_APIENTRY *LPALCCAPTURESTOP)( ALCdevice *device );
-typedef void (ALC_APIENTRY *LPALCCAPTURESAMPLES)( ALCdevice *device, ALCvoid *buffer, ALCsizei samples );
-
-#if defined(TARGET_OS_MAC) && TARGET_OS_MAC
- #pragma export off
-#endif
-
-#if defined(ANDROID)
-/*
- * OpenAL extension for suspend/resume of audio throughout application lifecycle
- */
-ALC_API void ALC_APIENTRY alcSuspend( void );
-ALC_API void ALC_APIENTRY alcResume( void );
-#endif
-
-#if defined(__cplusplus)
-}
-#endif
-
-#endif /* AL_ALC_H */
diff --git a/internal/c/parts/audio/out/android/OpenAL/include/AL/alext.h b/internal/c/parts/audio/out/android/OpenAL/include/AL/alext.h
deleted file mode 100644
index f3c7bcae8..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/include/AL/alext.h
+++ /dev/null
@@ -1,165 +0,0 @@
-/**
- * OpenAL cross platform audio library
- * Copyright (C) 2008 by authors.
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- * Or go to http://www.gnu.org/copyleft/lgpl.html
- */
-
-#ifndef AL_ALEXT_H
-#define AL_ALEXT_H
-
-#include
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef AL_LOKI_IMA_ADPCM_format
-#define AL_LOKI_IMA_ADPCM_format 1
-#define AL_FORMAT_IMA_ADPCM_MONO16_EXT 0x10000
-#define AL_FORMAT_IMA_ADPCM_STEREO16_EXT 0x10001
-#endif
-
-#ifndef AL_LOKI_WAVE_format
-#define AL_LOKI_WAVE_format 1
-#define AL_FORMAT_WAVE_EXT 0x10002
-#endif
-
-#ifndef AL_EXT_vorbis
-#define AL_EXT_vorbis 1
-#define AL_FORMAT_VORBIS_EXT 0x10003
-#endif
-
-#ifndef AL_LOKI_quadriphonic
-#define AL_LOKI_quadriphonic 1
-#define AL_FORMAT_QUAD8_LOKI 0x10004
-#define AL_FORMAT_QUAD16_LOKI 0x10005
-#endif
-
-#ifndef AL_EXT_float32
-#define AL_EXT_float32 1
-#define AL_FORMAT_MONO_FLOAT32 0x10010
-#define AL_FORMAT_STEREO_FLOAT32 0x10011
-#endif
-
-#ifndef AL_EXT_double
-#define AL_EXT_double 1
-#define AL_FORMAT_MONO_DOUBLE_EXT 0x10012
-#define AL_FORMAT_STEREO_DOUBLE_EXT 0x10013
-#endif
-
-#ifndef ALC_LOKI_audio_channel
-#define ALC_LOKI_audio_channel 1
-#define ALC_CHAN_MAIN_LOKI 0x500001
-#define ALC_CHAN_PCM_LOKI 0x500002
-#define ALC_CHAN_CD_LOKI 0x500003
-#endif
-
-#ifndef ALC_ENUMERATE_ALL_EXT
-#define ALC_ENUMERATE_ALL_EXT 1
-#define ALC_DEFAULT_ALL_DEVICES_SPECIFIER 0x1012
-#define ALC_ALL_DEVICES_SPECIFIER 0x1013
-#endif
-
-#ifndef AL_EXT_MCFORMATS
-#define AL_EXT_MCFORMATS 1
-#define AL_FORMAT_QUAD8 0x1204
-#define AL_FORMAT_QUAD16 0x1205
-#define AL_FORMAT_QUAD32 0x1206
-#define AL_FORMAT_REAR8 0x1207
-#define AL_FORMAT_REAR16 0x1208
-#define AL_FORMAT_REAR32 0x1209
-#define AL_FORMAT_51CHN8 0x120A
-#define AL_FORMAT_51CHN16 0x120B
-#define AL_FORMAT_51CHN32 0x120C
-#define AL_FORMAT_61CHN8 0x120D
-#define AL_FORMAT_61CHN16 0x120E
-#define AL_FORMAT_61CHN32 0x120F
-#define AL_FORMAT_71CHN8 0x1210
-#define AL_FORMAT_71CHN16 0x1211
-#define AL_FORMAT_71CHN32 0x1212
-#endif
-
-#ifndef AL_EXT_MULAW_MCFORMATS
-#define AL_EXT_MULAW_MCFORMATS 1
-#define AL_FORMAT_MONO_MULAW 0x10014
-#define AL_FORMAT_STEREO_MULAW 0x10015
-#define AL_FORMAT_QUAD_MULAW 0x10021
-#define AL_FORMAT_REAR_MULAW 0x10022
-#define AL_FORMAT_51CHN_MULAW 0x10023
-#define AL_FORMAT_61CHN_MULAW 0x10024
-#define AL_FORMAT_71CHN_MULAW 0x10025
-#endif
-
-#ifndef AL_EXT_IMA4
-#define AL_EXT_IMA4 1
-#define AL_FORMAT_MONO_IMA4 0x1300
-#define AL_FORMAT_STEREO_IMA4 0x1301
-#endif
-
-#ifndef AL_EXT_STATIC_BUFFER
-#define AL_EXT_STATIC_BUFFER 1
-typedef ALvoid (AL_APIENTRY*PFNALBUFFERDATASTATICPROC)(const ALint,ALenum,ALvoid*,ALsizei,ALsizei);
-#ifdef AL_ALEXT_PROTOTYPES
-AL_API ALvoid AL_APIENTRY alBufferDataStatic(const ALint buffer, ALenum format, ALvoid *data, ALsizei len, ALsizei freq);
-#endif
-#endif
-
-#ifndef ALC_EXT_EFX
-#define ALC_EXT_EFX 1
-#include "efx.h"
-#endif
-
-#ifndef ALC_EXT_disconnect
-#define ALC_EXT_disconnect 1
-#define ALC_CONNECTED 0x313
-#endif
-
-#ifndef ALC_EXT_thread_local_context
-#define ALC_EXT_thread_local_context 1
-typedef ALCboolean (ALC_APIENTRY*PFNALCSETTHREADCONTEXTPROC)(ALCcontext *context);
-typedef ALCcontext* (ALC_APIENTRY*PFNALCGETTHREADCONTEXTPROC)(void);
-#ifdef AL_ALEXT_PROTOTYPES
-ALC_API ALCboolean ALC_APIENTRY alcSetThreadContext(ALCcontext *context);
-ALC_API ALCcontext* ALC_APIENTRY alcGetThreadContext(void);
-#endif
-#endif
-
-#ifndef AL_EXT_source_distance_model
-#define AL_EXT_source_distance_model 1
-#define AL_SOURCE_DISTANCE_MODEL 0x200
-#endif
-
-#ifndef AL_SOFT_buffer_sub_data
-#define AL_SOFT_buffer_sub_data 1
-#define AL_BYTE_RW_OFFSETS_SOFT 0x1031
-#define AL_SAMPLE_RW_OFFSETS_SOFT 0x1032
-typedef ALvoid (AL_APIENTRY*PFNALBUFFERSUBDATASOFTPROC)(ALuint,ALenum,const ALvoid*,ALsizei,ALsizei);
-#ifdef AL_ALEXT_PROTOTYPES
-AL_API ALvoid AL_APIENTRY alBufferSubDataSOFT(ALuint buffer,ALenum format,const ALvoid *data,ALsizei offset,ALsizei length);
-#endif
-#endif
-
-#ifndef AL_SOFT_loop_points
-#define AL_SOFT_loop_points 1
-#define AL_LOOP_POINTS_SOFT 0x2015
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/internal/c/parts/audio/out/android/OpenAL/include/AL/efx-creative.h b/internal/c/parts/audio/out/android/OpenAL/include/AL/efx-creative.h
deleted file mode 100644
index 0a04c982e..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/include/AL/efx-creative.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* The tokens that would be defined here are already defined in efx.h. This
- * empty file is here to provide compatibility with Windows-based projects
- * that would include it. */
diff --git a/internal/c/parts/audio/out/android/OpenAL/include/AL/efx.h b/internal/c/parts/audio/out/android/OpenAL/include/AL/efx.h
deleted file mode 100644
index 0ccef95d6..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/include/AL/efx.h
+++ /dev/null
@@ -1,758 +0,0 @@
-#ifndef AL_EFX_H
-#define AL_EFX_H
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define ALC_EXT_EFX_NAME "ALC_EXT_EFX"
-
-#define ALC_EFX_MAJOR_VERSION 0x20001
-#define ALC_EFX_MINOR_VERSION 0x20002
-#define ALC_MAX_AUXILIARY_SENDS 0x20003
-
-
-/* Listener properties. */
-#define AL_METERS_PER_UNIT 0x20004
-
-/* Source properties. */
-#define AL_DIRECT_FILTER 0x20005
-#define AL_AUXILIARY_SEND_FILTER 0x20006
-#define AL_AIR_ABSORPTION_FACTOR 0x20007
-#define AL_ROOM_ROLLOFF_FACTOR 0x20008
-#define AL_CONE_OUTER_GAINHF 0x20009
-#define AL_DIRECT_FILTER_GAINHF_AUTO 0x2000A
-#define AL_AUXILIARY_SEND_FILTER_GAIN_AUTO 0x2000B
-#define AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO 0x2000C
-
-
-/* Effect properties. */
-
-/* Reverb effect parameters */
-#define AL_REVERB_DENSITY 0x0001
-#define AL_REVERB_DIFFUSION 0x0002
-#define AL_REVERB_GAIN 0x0003
-#define AL_REVERB_GAINHF 0x0004
-#define AL_REVERB_DECAY_TIME 0x0005
-#define AL_REVERB_DECAY_HFRATIO 0x0006
-#define AL_REVERB_REFLECTIONS_GAIN 0x0007
-#define AL_REVERB_REFLECTIONS_DELAY 0x0008
-#define AL_REVERB_LATE_REVERB_GAIN 0x0009
-#define AL_REVERB_LATE_REVERB_DELAY 0x000A
-#define AL_REVERB_AIR_ABSORPTION_GAINHF 0x000B
-#define AL_REVERB_ROOM_ROLLOFF_FACTOR 0x000C
-#define AL_REVERB_DECAY_HFLIMIT 0x000D
-
-/* EAX Reverb effect parameters */
-#define AL_EAXREVERB_DENSITY 0x0001
-#define AL_EAXREVERB_DIFFUSION 0x0002
-#define AL_EAXREVERB_GAIN 0x0003
-#define AL_EAXREVERB_GAINHF 0x0004
-#define AL_EAXREVERB_GAINLF 0x0005
-#define AL_EAXREVERB_DECAY_TIME 0x0006
-#define AL_EAXREVERB_DECAY_HFRATIO 0x0007
-#define AL_EAXREVERB_DECAY_LFRATIO 0x0008
-#define AL_EAXREVERB_REFLECTIONS_GAIN 0x0009
-#define AL_EAXREVERB_REFLECTIONS_DELAY 0x000A
-#define AL_EAXREVERB_REFLECTIONS_PAN 0x000B
-#define AL_EAXREVERB_LATE_REVERB_GAIN 0x000C
-#define AL_EAXREVERB_LATE_REVERB_DELAY 0x000D
-#define AL_EAXREVERB_LATE_REVERB_PAN 0x000E
-#define AL_EAXREVERB_ECHO_TIME 0x000F
-#define AL_EAXREVERB_ECHO_DEPTH 0x0010
-#define AL_EAXREVERB_MODULATION_TIME 0x0011
-#define AL_EAXREVERB_MODULATION_DEPTH 0x0012
-#define AL_EAXREVERB_AIR_ABSORPTION_GAINHF 0x0013
-#define AL_EAXREVERB_HFREFERENCE 0x0014
-#define AL_EAXREVERB_LFREFERENCE 0x0015
-#define AL_EAXREVERB_ROOM_ROLLOFF_FACTOR 0x0016
-#define AL_EAXREVERB_DECAY_HFLIMIT 0x0017
-
-/* Chorus effect parameters */
-#define AL_CHORUS_WAVEFORM 0x0001
-#define AL_CHORUS_PHASE 0x0002
-#define AL_CHORUS_RATE 0x0003
-#define AL_CHORUS_DEPTH 0x0004
-#define AL_CHORUS_FEEDBACK 0x0005
-#define AL_CHORUS_DELAY 0x0006
-
-/* Distortion effect parameters */
-#define AL_DISTORTION_EDGE 0x0001
-#define AL_DISTORTION_GAIN 0x0002
-#define AL_DISTORTION_LOWPASS_CUTOFF 0x0003
-#define AL_DISTORTION_EQCENTER 0x0004
-#define AL_DISTORTION_EQBANDWIDTH 0x0005
-
-/* Echo effect parameters */
-#define AL_ECHO_DELAY 0x0001
-#define AL_ECHO_LRDELAY 0x0002
-#define AL_ECHO_DAMPING 0x0003
-#define AL_ECHO_FEEDBACK 0x0004
-#define AL_ECHO_SPREAD 0x0005
-
-/* Flanger effect parameters */
-#define AL_FLANGER_WAVEFORM 0x0001
-#define AL_FLANGER_PHASE 0x0002
-#define AL_FLANGER_RATE 0x0003
-#define AL_FLANGER_DEPTH 0x0004
-#define AL_FLANGER_FEEDBACK 0x0005
-#define AL_FLANGER_DELAY 0x0006
-
-/* Frequency shifter effect parameters */
-#define AL_FREQUENCY_SHIFTER_FREQUENCY 0x0001
-#define AL_FREQUENCY_SHIFTER_LEFT_DIRECTION 0x0002
-#define AL_FREQUENCY_SHIFTER_RIGHT_DIRECTION 0x0003
-
-/* Vocal morpher effect parameters */
-#define AL_VOCAL_MORPHER_PHONEMEA 0x0001
-#define AL_VOCAL_MORPHER_PHONEMEA_COARSE_TUNING 0x0002
-#define AL_VOCAL_MORPHER_PHONEMEB 0x0003
-#define AL_VOCAL_MORPHER_PHONEMEB_COARSE_TUNING 0x0004
-#define AL_VOCAL_MORPHER_WAVEFORM 0x0005
-#define AL_VOCAL_MORPHER_RATE 0x0006
-
-/* Pitchshifter effect parameters */
-#define AL_PITCH_SHIFTER_COARSE_TUNE 0x0001
-#define AL_PITCH_SHIFTER_FINE_TUNE 0x0002
-
-/* Ringmodulator effect parameters */
-#define AL_RING_MODULATOR_FREQUENCY 0x0001
-#define AL_RING_MODULATOR_HIGHPASS_CUTOFF 0x0002
-#define AL_RING_MODULATOR_WAVEFORM 0x0003
-
-/* Autowah effect parameters */
-#define AL_AUTOWAH_ATTACK_TIME 0x0001
-#define AL_AUTOWAH_RELEASE_TIME 0x0002
-#define AL_AUTOWAH_RESONANCE 0x0003
-#define AL_AUTOWAH_PEAK_GAIN 0x0004
-
-/* Compressor effect parameters */
-#define AL_COMPRESSOR_ONOFF 0x0001
-
-/* Equalizer effect parameters */
-#define AL_EQUALIZER_LOW_GAIN 0x0001
-#define AL_EQUALIZER_LOW_CUTOFF 0x0002
-#define AL_EQUALIZER_MID1_GAIN 0x0003
-#define AL_EQUALIZER_MID1_CENTER 0x0004
-#define AL_EQUALIZER_MID1_WIDTH 0x0005
-#define AL_EQUALIZER_MID2_GAIN 0x0006
-#define AL_EQUALIZER_MID2_CENTER 0x0007
-#define AL_EQUALIZER_MID2_WIDTH 0x0008
-#define AL_EQUALIZER_HIGH_GAIN 0x0009
-#define AL_EQUALIZER_HIGH_CUTOFF 0x000A
-
-/* Effect type */
-#define AL_EFFECT_FIRST_PARAMETER 0x0000
-#define AL_EFFECT_LAST_PARAMETER 0x8000
-#define AL_EFFECT_TYPE 0x8001
-
-/* Effect types, used with the AL_EFFECT_TYPE property */
-#define AL_EFFECT_NULL 0x0000
-#define AL_EFFECT_REVERB 0x0001
-#define AL_EFFECT_CHORUS 0x0002
-#define AL_EFFECT_DISTORTION 0x0003
-#define AL_EFFECT_ECHO 0x0004
-#define AL_EFFECT_FLANGER 0x0005
-#define AL_EFFECT_FREQUENCY_SHIFTER 0x0006
-#define AL_EFFECT_VOCAL_MORPHER 0x0007
-#define AL_EFFECT_PITCH_SHIFTER 0x0008
-#define AL_EFFECT_RING_MODULATOR 0x0009
-#define AL_EFFECT_AUTOWAH 0x000A
-#define AL_EFFECT_COMPRESSOR 0x000B
-#define AL_EFFECT_EQUALIZER 0x000C
-#define AL_EFFECT_EAXREVERB 0x8000
-
-/* Auxiliary Effect Slot properties. */
-#define AL_EFFECTSLOT_EFFECT 0x0001
-#define AL_EFFECTSLOT_GAIN 0x0002
-#define AL_EFFECTSLOT_AUXILIARY_SEND_AUTO 0x0003
-
-/* NULL Auxiliary Slot ID to disable a source send. */
-#define AL_EFFECTSLOT_NULL 0x0000
-
-
-/* Filter properties. */
-
-/* Lowpass filter parameters */
-#define AL_LOWPASS_GAIN 0x0001
-#define AL_LOWPASS_GAINHF 0x0002
-
-/* Highpass filter parameters */
-#define AL_HIGHPASS_GAIN 0x0001
-#define AL_HIGHPASS_GAINLF 0x0002
-
-/* Bandpass filter parameters */
-#define AL_BANDPASS_GAIN 0x0001
-#define AL_BANDPASS_GAINLF 0x0002
-#define AL_BANDPASS_GAINHF 0x0003
-
-/* Filter type */
-#define AL_FILTER_FIRST_PARAMETER 0x0000
-#define AL_FILTER_LAST_PARAMETER 0x8000
-#define AL_FILTER_TYPE 0x8001
-
-/* Filter types, used with the AL_FILTER_TYPE property */
-#define AL_FILTER_NULL 0x0000
-#define AL_FILTER_LOWPASS 0x0001
-#define AL_FILTER_HIGHPASS 0x0002
-#define AL_FILTER_BANDPASS 0x0003
-
-
-/* Effect object function types. */
-typedef void (AL_APIENTRY *LPALGENEFFECTS)(ALsizei, ALuint*);
-typedef void (AL_APIENTRY *LPALDELETEEFFECTS)(ALsizei, ALuint*);
-typedef ALboolean (AL_APIENTRY *LPALISEFFECT)(ALuint);
-typedef void (AL_APIENTRY *LPALEFFECTI)(ALuint, ALenum, ALint);
-typedef void (AL_APIENTRY *LPALEFFECTIV)(ALuint, ALenum, ALint*);
-typedef void (AL_APIENTRY *LPALEFFECTF)(ALuint, ALenum, ALfloat);
-typedef void (AL_APIENTRY *LPALEFFECTFV)(ALuint, ALenum, ALfloat*);
-typedef void (AL_APIENTRY *LPALGETEFFECTI)(ALuint, ALenum, ALint*);
-typedef void (AL_APIENTRY *LPALGETEFFECTIV)(ALuint, ALenum, ALint*);
-typedef void (AL_APIENTRY *LPALGETEFFECTF)(ALuint, ALenum, ALfloat*);
-typedef void (AL_APIENTRY *LPALGETEFFECTFV)(ALuint, ALenum, ALfloat*);
-
-/* Filter object function types. */
-typedef void (AL_APIENTRY *LPALGENFILTERS)(ALsizei, ALuint*);
-typedef void (AL_APIENTRY *LPALDELETEFILTERS)(ALsizei, ALuint*);
-typedef ALboolean (AL_APIENTRY *LPALISFILTER)(ALuint);
-typedef void (AL_APIENTRY *LPALFILTERI)(ALuint, ALenum, ALint);
-typedef void (AL_APIENTRY *LPALFILTERIV)(ALuint, ALenum, ALint*);
-typedef void (AL_APIENTRY *LPALFILTERF)(ALuint, ALenum, ALfloat);
-typedef void (AL_APIENTRY *LPALFILTERFV)(ALuint, ALenum, ALfloat*);
-typedef void (AL_APIENTRY *LPALGETFILTERI)(ALuint, ALenum, ALint*);
-typedef void (AL_APIENTRY *LPALGETFILTERIV)(ALuint, ALenum, ALint*);
-typedef void (AL_APIENTRY *LPALGETFILTERF)(ALuint, ALenum, ALfloat*);
-typedef void (AL_APIENTRY *LPALGETFILTERFV)(ALuint, ALenum, ALfloat*);
-
-/* Auxiliary Effect Slot object function types. */
-typedef void (AL_APIENTRY *LPALGENAUXILIARYEFFECTSLOTS)(ALsizei, ALuint*);
-typedef void (AL_APIENTRY *LPALDELETEAUXILIARYEFFECTSLOTS)(ALsizei, ALuint*);
-typedef ALboolean (AL_APIENTRY *LPALISAUXILIARYEFFECTSLOT)(ALuint);
-typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTI)(ALuint, ALenum, ALint);
-typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTIV)(ALuint, ALenum, ALint*);
-typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTF)(ALuint, ALenum, ALfloat);
-typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTFV)(ALuint, ALenum, ALfloat*);
-typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTI)(ALuint, ALenum, ALint*);
-typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTIV)(ALuint, ALenum, ALint*);
-typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTF)(ALuint, ALenum, ALfloat*);
-typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTFV)(ALuint, ALenum, ALfloat*);
-
-#ifdef AL_ALEXT_PROTOTYPES
-AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects);
-AL_API ALvoid AL_APIENTRY alDeleteEffects(ALsizei n, ALuint *effects);
-AL_API ALboolean AL_APIENTRY alIsEffect(ALuint effect);
-AL_API ALvoid AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint iValue);
-AL_API ALvoid AL_APIENTRY alEffectiv(ALuint effect, ALenum param, ALint *piValues);
-AL_API ALvoid AL_APIENTRY alEffectf(ALuint effect, ALenum param, ALfloat flValue);
-AL_API ALvoid AL_APIENTRY alEffectfv(ALuint effect, ALenum param, ALfloat *pflValues);
-AL_API ALvoid AL_APIENTRY alGetEffecti(ALuint effect, ALenum param, ALint *piValue);
-AL_API ALvoid AL_APIENTRY alGetEffectiv(ALuint effect, ALenum param, ALint *piValues);
-AL_API ALvoid AL_APIENTRY alGetEffectf(ALuint effect, ALenum param, ALfloat *pflValue);
-AL_API ALvoid AL_APIENTRY alGetEffectfv(ALuint effect, ALenum param, ALfloat *pflValues);
-
-AL_API ALvoid AL_APIENTRY alGenFilters(ALsizei n, ALuint *filters);
-AL_API ALvoid AL_APIENTRY alDeleteFilters(ALsizei n, ALuint *filters);
-AL_API ALboolean AL_APIENTRY alIsFilter(ALuint filter);
-AL_API ALvoid AL_APIENTRY alFilteri(ALuint filter, ALenum param, ALint iValue);
-AL_API ALvoid AL_APIENTRY alFilteriv(ALuint filter, ALenum param, ALint *piValues);
-AL_API ALvoid AL_APIENTRY alFilterf(ALuint filter, ALenum param, ALfloat flValue);
-AL_API ALvoid AL_APIENTRY alFilterfv(ALuint filter, ALenum param, ALfloat *pflValues);
-AL_API ALvoid AL_APIENTRY alGetFilteri(ALuint filter, ALenum param, ALint *piValue);
-AL_API ALvoid AL_APIENTRY alGetFilteriv(ALuint filter, ALenum param, ALint *piValues);
-AL_API ALvoid AL_APIENTRY alGetFilterf(ALuint filter, ALenum param, ALfloat *pflValue);
-AL_API ALvoid AL_APIENTRY alGetFilterfv(ALuint filter, ALenum param, ALfloat *pflValues);
-
-AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslots);
-AL_API ALvoid AL_APIENTRY alDeleteAuxiliaryEffectSlots(ALsizei n, ALuint *effectslots);
-AL_API ALboolean AL_APIENTRY alIsAuxiliaryEffectSlot(ALuint effectslot);
-AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint iValue);
-AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotiv(ALuint effectslot, ALenum param, ALint *piValues);
-AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotf(ALuint effectslot, ALenum param, ALfloat flValue);
-AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotfv(ALuint effectslot, ALenum param, ALfloat *pflValues);
-AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint *piValue);
-AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotiv(ALuint effectslot, ALenum param, ALint *piValues);
-AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotf(ALuint effectslot, ALenum param, ALfloat *pflValue);
-AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotfv(ALuint effectslot, ALenum param, ALfloat *pflValues);
-#endif
-
-/* Filter ranges and defaults. */
-
-/* Lowpass filter */
-#define LOWPASS_MIN_GAIN (0.0f)
-#define LOWPASS_MAX_GAIN (1.0f)
-#define LOWPASS_DEFAULT_GAIN (1.0f)
-
-#define LOWPASS_MIN_GAINHF (0.0f)
-#define LOWPASS_MAX_GAINHF (1.0f)
-#define LOWPASS_DEFAULT_GAINHF (1.0f)
-
-/* Highpass filter */
-#define HIGHPASS_MIN_GAIN (0.0f)
-#define HIGHPASS_MAX_GAIN (1.0f)
-#define HIGHPASS_DEFAULT_GAIN (1.0f)
-
-#define HIGHPASS_MIN_GAINLF (0.0f)
-#define HIGHPASS_MAX_GAINLF (1.0f)
-#define HIGHPASS_DEFAULT_GAINLF (1.0f)
-
-/* Bandpass filter */
-#define BANDPASS_MIN_GAIN (0.0f)
-#define BANDPASS_MAX_GAIN (1.0f)
-#define BANDPASS_DEFAULT_GAIN (1.0f)
-
-#define BANDPASS_MIN_GAINHF (0.0f)
-#define BANDPASS_MAX_GAINHF (1.0f)
-#define BANDPASS_DEFAULT_GAINHF (1.0f)
-
-#define BANDPASS_MIN_GAINLF (0.0f)
-#define BANDPASS_MAX_GAINLF (1.0f)
-#define BANDPASS_DEFAULT_GAINLF (1.0f)
-
-
-/* Effect parameter ranges and defaults. */
-
-/* Standard reverb effect */
-#define AL_REVERB_MIN_DENSITY (0.0f)
-#define AL_REVERB_MAX_DENSITY (1.0f)
-#define AL_REVERB_DEFAULT_DENSITY (1.0f)
-
-#define AL_REVERB_MIN_DIFFUSION (0.0f)
-#define AL_REVERB_MAX_DIFFUSION (1.0f)
-#define AL_REVERB_DEFAULT_DIFFUSION (1.0f)
-
-#define AL_REVERB_MIN_GAIN (0.0f)
-#define AL_REVERB_MAX_GAIN (1.0f)
-#define AL_REVERB_DEFAULT_GAIN (0.32f)
-
-#define AL_REVERB_MIN_GAINHF (0.0f)
-#define AL_REVERB_MAX_GAINHF (1.0f)
-#define AL_REVERB_DEFAULT_GAINHF (0.89f)
-
-#define AL_REVERB_MIN_DECAY_TIME (0.1f)
-#define AL_REVERB_MAX_DECAY_TIME (20.0f)
-#define AL_REVERB_DEFAULT_DECAY_TIME (1.49f)
-
-#define AL_REVERB_MIN_DECAY_HFRATIO (0.1f)
-#define AL_REVERB_MAX_DECAY_HFRATIO (2.0f)
-#define AL_REVERB_DEFAULT_DECAY_HFRATIO (0.83f)
-
-#define AL_REVERB_MIN_REFLECTIONS_GAIN (0.0f)
-#define AL_REVERB_MAX_REFLECTIONS_GAIN (3.16f)
-#define AL_REVERB_DEFAULT_REFLECTIONS_GAIN (0.05f)
-
-#define AL_REVERB_MIN_REFLECTIONS_DELAY (0.0f)
-#define AL_REVERB_MAX_REFLECTIONS_DELAY (0.3f)
-#define AL_REVERB_DEFAULT_REFLECTIONS_DELAY (0.007f)
-
-#define AL_REVERB_MIN_LATE_REVERB_GAIN (0.0f)
-#define AL_REVERB_MAX_LATE_REVERB_GAIN (10.0f)
-#define AL_REVERB_DEFAULT_LATE_REVERB_GAIN (1.26f)
-
-#define AL_REVERB_MIN_LATE_REVERB_DELAY (0.0f)
-#define AL_REVERB_MAX_LATE_REVERB_DELAY (0.1f)
-#define AL_REVERB_DEFAULT_LATE_REVERB_DELAY (0.011f)
-
-#define AL_REVERB_MIN_AIR_ABSORPTION_GAINHF (0.892f)
-#define AL_REVERB_MAX_AIR_ABSORPTION_GAINHF (1.0f)
-#define AL_REVERB_DEFAULT_AIR_ABSORPTION_GAINHF (0.994f)
-
-#define AL_REVERB_MIN_ROOM_ROLLOFF_FACTOR (0.0f)
-#define AL_REVERB_MAX_ROOM_ROLLOFF_FACTOR (10.0f)
-#define AL_REVERB_DEFAULT_ROOM_ROLLOFF_FACTOR (0.0f)
-
-#define AL_REVERB_MIN_DECAY_HFLIMIT AL_FALSE
-#define AL_REVERB_MAX_DECAY_HFLIMIT AL_TRUE
-#define AL_REVERB_DEFAULT_DECAY_HFLIMIT AL_TRUE
-
-/* EAX reverb effect */
-#define AL_EAXREVERB_MIN_DENSITY (0.0f)
-#define AL_EAXREVERB_MAX_DENSITY (1.0f)
-#define AL_EAXREVERB_DEFAULT_DENSITY (1.0f)
-
-#define AL_EAXREVERB_MIN_DIFFUSION (0.0f)
-#define AL_EAXREVERB_MAX_DIFFUSION (1.0f)
-#define AL_EAXREVERB_DEFAULT_DIFFUSION (1.0f)
-
-#define AL_EAXREVERB_MIN_GAIN (0.0f)
-#define AL_EAXREVERB_MAX_GAIN (1.0f)
-#define AL_EAXREVERB_DEFAULT_GAIN (0.32f)
-
-#define AL_EAXREVERB_MIN_GAINHF (0.0f)
-#define AL_EAXREVERB_MAX_GAINHF (1.0f)
-#define AL_EAXREVERB_DEFAULT_GAINHF (0.89f)
-
-#define AL_EAXREVERB_MIN_GAINLF (0.0f)
-#define AL_EAXREVERB_MAX_GAINLF (1.0f)
-#define AL_EAXREVERB_DEFAULT_GAINLF (1.0f)
-
-#define AL_EAXREVERB_MIN_DECAY_TIME (0.1f)
-#define AL_EAXREVERB_MAX_DECAY_TIME (20.0f)
-#define AL_EAXREVERB_DEFAULT_DECAY_TIME (1.49f)
-
-#define AL_EAXREVERB_MIN_DECAY_HFRATIO (0.1f)
-#define AL_EAXREVERB_MAX_DECAY_HFRATIO (2.0f)
-#define AL_EAXREVERB_DEFAULT_DECAY_HFRATIO (0.83f)
-
-#define AL_EAXREVERB_MIN_DECAY_LFRATIO (0.1f)
-#define AL_EAXREVERB_MAX_DECAY_LFRATIO (2.0f)
-#define AL_EAXREVERB_DEFAULT_DECAY_LFRATIO (1.0f)
-
-#define AL_EAXREVERB_MIN_REFLECTIONS_GAIN (0.0f)
-#define AL_EAXREVERB_MAX_REFLECTIONS_GAIN (3.16f)
-#define AL_EAXREVERB_DEFAULT_REFLECTIONS_GAIN (0.05f)
-
-#define AL_EAXREVERB_MIN_REFLECTIONS_DELAY (0.0f)
-#define AL_EAXREVERB_MAX_REFLECTIONS_DELAY (0.3f)
-#define AL_EAXREVERB_DEFAULT_REFLECTIONS_DELAY (0.007f)
-
-#define AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN_XYZ (0.0f)
-
-#define AL_EAXREVERB_MIN_LATE_REVERB_GAIN (0.0f)
-#define AL_EAXREVERB_MAX_LATE_REVERB_GAIN (10.0f)
-#define AL_EAXREVERB_DEFAULT_LATE_REVERB_GAIN (1.26f)
-
-#define AL_EAXREVERB_MIN_LATE_REVERB_DELAY (0.0f)
-#define AL_EAXREVERB_MAX_LATE_REVERB_DELAY (0.1f)
-#define AL_EAXREVERB_DEFAULT_LATE_REVERB_DELAY (0.011f)
-
-#define AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN_XYZ (0.0f)
-
-#define AL_EAXREVERB_MIN_ECHO_TIME (0.075f)
-#define AL_EAXREVERB_MAX_ECHO_TIME (0.25f)
-#define AL_EAXREVERB_DEFAULT_ECHO_TIME (0.25f)
-
-#define AL_EAXREVERB_MIN_ECHO_DEPTH (0.0f)
-#define AL_EAXREVERB_MAX_ECHO_DEPTH (1.0f)
-#define AL_EAXREVERB_DEFAULT_ECHO_DEPTH (0.0f)
-
-#define AL_EAXREVERB_MIN_MODULATION_TIME (0.04f)
-#define AL_EAXREVERB_MAX_MODULATION_TIME (4.0f)
-#define AL_EAXREVERB_DEFAULT_MODULATION_TIME (0.25f)
-
-#define AL_EAXREVERB_MIN_MODULATION_DEPTH (0.0f)
-#define AL_EAXREVERB_MAX_MODULATION_DEPTH (1.0f)
-#define AL_EAXREVERB_DEFAULT_MODULATION_DEPTH (0.0f)
-
-#define AL_EAXREVERB_MIN_AIR_ABSORPTION_GAINHF (0.892f)
-#define AL_EAXREVERB_MAX_AIR_ABSORPTION_GAINHF (1.0f)
-#define AL_EAXREVERB_DEFAULT_AIR_ABSORPTION_GAINHF (0.994f)
-
-#define AL_EAXREVERB_MIN_HFREFERENCE (1000.0f)
-#define AL_EAXREVERB_MAX_HFREFERENCE (20000.0f)
-#define AL_EAXREVERB_DEFAULT_HFREFERENCE (5000.0f)
-
-#define AL_EAXREVERB_MIN_LFREFERENCE (20.0f)
-#define AL_EAXREVERB_MAX_LFREFERENCE (1000.0f)
-#define AL_EAXREVERB_DEFAULT_LFREFERENCE (250.0f)
-
-#define AL_EAXREVERB_MIN_ROOM_ROLLOFF_FACTOR (0.0f)
-#define AL_EAXREVERB_MAX_ROOM_ROLLOFF_FACTOR (10.0f)
-#define AL_EAXREVERB_DEFAULT_ROOM_ROLLOFF_FACTOR (0.0f)
-
-#define AL_EAXREVERB_MIN_DECAY_HFLIMIT AL_FALSE
-#define AL_EAXREVERB_MAX_DECAY_HFLIMIT AL_TRUE
-#define AL_EAXREVERB_DEFAULT_DECAY_HFLIMIT AL_TRUE
-
-/* Chorus effect */
-#define AL_CHORUS_WAVEFORM_SINUSOID (0)
-#define AL_CHORUS_WAVEFORM_TRIANGLE (1)
-
-#define AL_CHORUS_MIN_WAVEFORM (0)
-#define AL_CHORUS_MAX_WAVEFORM (1)
-#define AL_CHORUS_DEFAULT_WAVEFORM (1)
-
-#define AL_CHORUS_MIN_PHASE (-180)
-#define AL_CHORUS_MAX_PHASE (180)
-#define AL_CHORUS_DEFAULT_PHASE (90)
-
-#define AL_CHORUS_MIN_RATE (0.0f)
-#define AL_CHORUS_MAX_RATE (10.0f)
-#define AL_CHORUS_DEFAULT_RATE (1.1f)
-
-#define AL_CHORUS_MIN_DEPTH (0.0f)
-#define AL_CHORUS_MAX_DEPTH (1.0f)
-#define AL_CHORUS_DEFAULT_DEPTH (0.1f)
-
-#define AL_CHORUS_MIN_FEEDBACK (-1.0f)
-#define AL_CHORUS_MAX_FEEDBACK (1.0f)
-#define AL_CHORUS_DEFAULT_FEEDBACK (0.25f)
-
-#define AL_CHORUS_MIN_DELAY (0.0f)
-#define AL_CHORUS_MAX_DELAY (0.016f)
-#define AL_CHORUS_DEFAULT_DELAY (0.016f)
-
-/* Distortion effect */
-#define AL_DISTORTION_MIN_EDGE (0.0f)
-#define AL_DISTORTION_MAX_EDGE (1.0f)
-#define AL_DISTORTION_DEFAULT_EDGE (0.2f)
-
-#define AL_DISTORTION_MIN_GAIN (0.01f)
-#define AL_DISTORTION_MAX_GAIN (1.0f)
-#define AL_DISTORTION_DEFAULT_GAIN (0.05f)
-
-#define AL_DISTORTION_MIN_LOWPASS_CUTOFF (80.0f)
-#define AL_DISTORTION_MAX_LOWPASS_CUTOFF (24000.0f)
-#define AL_DISTORTION_DEFAULT_LOWPASS_CUTOFF (8000.0f)
-
-#define AL_DISTORTION_MIN_EQCENTER (80.0f)
-#define AL_DISTORTION_MAX_EQCENTER (24000.0f)
-#define AL_DISTORTION_DEFAULT_EQCENTER (3600.0f)
-
-#define AL_DISTORTION_MIN_EQBANDWIDTH (80.0f)
-#define AL_DISTORTION_MAX_EQBANDWIDTH (24000.0f)
-#define AL_DISTORTION_DEFAULT_EQBANDWIDTH (3600.0f)
-
-/* Echo effect */
-#define AL_ECHO_MIN_DELAY (0.0f)
-#define AL_ECHO_MAX_DELAY (0.207f)
-#define AL_ECHO_DEFAULT_DELAY (0.1f)
-
-#define AL_ECHO_MIN_LRDELAY (0.0f)
-#define AL_ECHO_MAX_LRDELAY (0.404f)
-#define AL_ECHO_DEFAULT_LRDELAY (0.1f)
-
-#define AL_ECHO_MIN_DAMPING (0.0f)
-#define AL_ECHO_MAX_DAMPING (0.99f)
-#define AL_ECHO_DEFAULT_DAMPING (0.5f)
-
-#define AL_ECHO_MIN_FEEDBACK (0.0f)
-#define AL_ECHO_MAX_FEEDBACK (1.0f)
-#define AL_ECHO_DEFAULT_FEEDBACK (0.5f)
-
-#define AL_ECHO_MIN_SPREAD (-1.0f)
-#define AL_ECHO_MAX_SPREAD (1.0f)
-#define AL_ECHO_DEFAULT_SPREAD (-1.0f)
-
-/* Flanger effect */
-#define AL_FLANGER_WAVEFORM_SINUSOID (0)
-#define AL_FLANGER_WAVEFORM_TRIANGLE (1)
-
-#define AL_FLANGER_MIN_WAVEFORM (0)
-#define AL_FLANGER_MAX_WAVEFORM (1)
-#define AL_FLANGER_DEFAULT_WAVEFORM (1)
-
-#define AL_FLANGER_MIN_PHASE (-180)
-#define AL_FLANGER_MAX_PHASE (180)
-#define AL_FLANGER_DEFAULT_PHASE (0)
-
-#define AL_FLANGER_MIN_RATE (0.0f)
-#define AL_FLANGER_MAX_RATE (10.0f)
-#define AL_FLANGER_DEFAULT_RATE (0.27f)
-
-#define AL_FLANGER_MIN_DEPTH (0.0f)
-#define AL_FLANGER_MAX_DEPTH (1.0f)
-#define AL_FLANGER_DEFAULT_DEPTH (1.0f)
-
-#define AL_FLANGER_MIN_FEEDBACK (-1.0f)
-#define AL_FLANGER_MAX_FEEDBACK (1.0f)
-#define AL_FLANGER_DEFAULT_FEEDBACK (-0.5f)
-
-#define AL_FLANGER_MIN_DELAY (0.0f)
-#define AL_FLANGER_MAX_DELAY (0.004f)
-#define AL_FLANGER_DEFAULT_DELAY (0.002f)
-
-/* Frequency shifter effect */
-#define AL_FREQUENCY_SHIFTER_MIN_FREQUENCY (0.0f)
-#define AL_FREQUENCY_SHIFTER_MAX_FREQUENCY (24000.0f)
-#define AL_FREQUENCY_SHIFTER_DEFAULT_FREQUENCY (0.0f)
-
-#define AL_FREQUENCY_SHIFTER_MIN_LEFT_DIRECTION (0)
-#define AL_FREQUENCY_SHIFTER_MAX_LEFT_DIRECTION (2)
-#define AL_FREQUENCY_SHIFTER_DEFAULT_LEFT_DIRECTION (0)
-
-#define AL_FREQUENCY_SHIFTER_DIRECTION_DOWN (0)
-#define AL_FREQUENCY_SHIFTER_DIRECTION_UP (1)
-#define AL_FREQUENCY_SHIFTER_DIRECTION_OFF (2)
-
-#define AL_FREQUENCY_SHIFTER_MIN_RIGHT_DIRECTION (0)
-#define AL_FREQUENCY_SHIFTER_MAX_RIGHT_DIRECTION (2)
-#define AL_FREQUENCY_SHIFTER_DEFAULT_RIGHT_DIRECTION (0)
-
-/* Vocal morpher effect */
-#define AL_VOCAL_MORPHER_MIN_PHONEMEA (0)
-#define AL_VOCAL_MORPHER_MAX_PHONEMEA (29)
-#define AL_VOCAL_MORPHER_DEFAULT_PHONEMEA (0)
-
-#define AL_VOCAL_MORPHER_MIN_PHONEMEA_COARSE_TUNING (-24)
-#define AL_VOCAL_MORPHER_MAX_PHONEMEA_COARSE_TUNING (24)
-#define AL_VOCAL_MORPHER_DEFAULT_PHONEMEA_COARSE_TUNING (0)
-
-#define AL_VOCAL_MORPHER_MIN_PHONEMEB (0)
-#define AL_VOCAL_MORPHER_MAX_PHONEMEB (29)
-#define AL_VOCAL_MORPHER_DEFAULT_PHONEMEB (10)
-
-#define AL_VOCAL_MORPHER_MIN_PHONEMEB_COARSE_TUNING (-24)
-#define AL_VOCAL_MORPHER_MAX_PHONEMEB_COARSE_TUNING (24)
-#define AL_VOCAL_MORPHER_DEFAULT_PHONEMEB_COARSE_TUNING (0)
-
-#define AL_VOCAL_MORPHER_PHONEME_A (0)
-#define AL_VOCAL_MORPHER_PHONEME_E (1)
-#define AL_VOCAL_MORPHER_PHONEME_I (2)
-#define AL_VOCAL_MORPHER_PHONEME_O (3)
-#define AL_VOCAL_MORPHER_PHONEME_U (4)
-#define AL_VOCAL_MORPHER_PHONEME_AA (5)
-#define AL_VOCAL_MORPHER_PHONEME_AE (6)
-#define AL_VOCAL_MORPHER_PHONEME_AH (7)
-#define AL_VOCAL_MORPHER_PHONEME_AO (8)
-#define AL_VOCAL_MORPHER_PHONEME_EH (9)
-#define AL_VOCAL_MORPHER_PHONEME_ER (10)
-#define AL_VOCAL_MORPHER_PHONEME_IH (11)
-#define AL_VOCAL_MORPHER_PHONEME_IY (12)
-#define AL_VOCAL_MORPHER_PHONEME_UH (13)
-#define AL_VOCAL_MORPHER_PHONEME_UW (14)
-#define AL_VOCAL_MORPHER_PHONEME_B (15)
-#define AL_VOCAL_MORPHER_PHONEME_D (16)
-#define AL_VOCAL_MORPHER_PHONEME_F (17)
-#define AL_VOCAL_MORPHER_PHONEME_G (18)
-#define AL_VOCAL_MORPHER_PHONEME_J (19)
-#define AL_VOCAL_MORPHER_PHONEME_K (20)
-#define AL_VOCAL_MORPHER_PHONEME_L (21)
-#define AL_VOCAL_MORPHER_PHONEME_M (22)
-#define AL_VOCAL_MORPHER_PHONEME_N (23)
-#define AL_VOCAL_MORPHER_PHONEME_P (24)
-#define AL_VOCAL_MORPHER_PHONEME_R (25)
-#define AL_VOCAL_MORPHER_PHONEME_S (26)
-#define AL_VOCAL_MORPHER_PHONEME_T (27)
-#define AL_VOCAL_MORPHER_PHONEME_V (28)
-#define AL_VOCAL_MORPHER_PHONEME_Z (29)
-
-#define AL_VOCAL_MORPHER_WAVEFORM_SINUSOID (0)
-#define AL_VOCAL_MORPHER_WAVEFORM_TRIANGLE (1)
-#define AL_VOCAL_MORPHER_WAVEFORM_SAWTOOTH (2)
-
-#define AL_VOCAL_MORPHER_MIN_WAVEFORM (0)
-#define AL_VOCAL_MORPHER_MAX_WAVEFORM (2)
-#define AL_VOCAL_MORPHER_DEFAULT_WAVEFORM (0)
-
-#define AL_VOCAL_MORPHER_MIN_RATE (0.0f)
-#define AL_VOCAL_MORPHER_MAX_RATE (10.0f)
-#define AL_VOCAL_MORPHER_DEFAULT_RATE (1.41f)
-
-/* Pitch shifter effect */
-#define AL_PITCH_SHIFTER_MIN_COARSE_TUNE (-12)
-#define AL_PITCH_SHIFTER_MAX_COARSE_TUNE (12)
-#define AL_PITCH_SHIFTER_DEFAULT_COARSE_TUNE (12)
-
-#define AL_PITCH_SHIFTER_MIN_FINE_TUNE (-50)
-#define AL_PITCH_SHIFTER_MAX_FINE_TUNE (50)
-#define AL_PITCH_SHIFTER_DEFAULT_FINE_TUNE (0)
-
-/* Ring modulator effect */
-#define AL_RING_MODULATOR_MIN_FREQUENCY (0.0f)
-#define AL_RING_MODULATOR_MAX_FREQUENCY (8000.0f)
-#define AL_RING_MODULATOR_DEFAULT_FREQUENCY (440.0f)
-
-#define AL_RING_MODULATOR_MIN_HIGHPASS_CUTOFF (0.0f)
-#define AL_RING_MODULATOR_MAX_HIGHPASS_CUTOFF (24000.0f)
-#define AL_RING_MODULATOR_DEFAULT_HIGHPASS_CUTOFF (800.0f)
-
-#define AL_RING_MODULATOR_SINUSOID (0)
-#define AL_RING_MODULATOR_SAWTOOTH (1)
-#define AL_RING_MODULATOR_SQUARE (2)
-
-#define AL_RING_MODULATOR_MIN_WAVEFORM (0)
-#define AL_RING_MODULATOR_MAX_WAVEFORM (2)
-#define AL_RING_MODULATOR_DEFAULT_WAVEFORM (0)
-
-/* Autowah effect */
-#define AL_AUTOWAH_MIN_ATTACK_TIME (0.0001f)
-#define AL_AUTOWAH_MAX_ATTACK_TIME (1.0f)
-#define AL_AUTOWAH_DEFAULT_ATTACK_TIME (0.06f)
-
-#define AL_AUTOWAH_MIN_RELEASE_TIME (0.0001f)
-#define AL_AUTOWAH_MAX_RELEASE_TIME (1.0f)
-#define AL_AUTOWAH_DEFAULT_RELEASE_TIME (0.06f)
-
-#define AL_AUTOWAH_MIN_RESONANCE (2.0f)
-#define AL_AUTOWAH_MAX_RESONANCE (1000.0f)
-#define AL_AUTOWAH_DEFAULT_RESONANCE (1000.0f)
-
-#define AL_AUTOWAH_MIN_PEAK_GAIN (0.00003f)
-#define AL_AUTOWAH_MAX_PEAK_GAIN (31621.0f)
-#define AL_AUTOWAH_DEFAULT_PEAK_GAIN (11.22f)
-
-/* Compressor effect */
-#define AL_COMPRESSOR_MIN_ONOFF (0)
-#define AL_COMPRESSOR_MAX_ONOFF (1)
-#define AL_COMPRESSOR_DEFAULT_ONOFF (1)
-
-/* Equalizer effect */
-#define AL_EQUALIZER_MIN_LOW_GAIN (0.126f)
-#define AL_EQUALIZER_MAX_LOW_GAIN (7.943f)
-#define AL_EQUALIZER_DEFAULT_LOW_GAIN (1.0f)
-
-#define AL_EQUALIZER_MIN_LOW_CUTOFF (50.0f)
-#define AL_EQUALIZER_MAX_LOW_CUTOFF (800.0f)
-#define AL_EQUALIZER_DEFAULT_LOW_CUTOFF (200.0f)
-
-#define AL_EQUALIZER_MIN_MID1_GAIN (0.126f)
-#define AL_EQUALIZER_MAX_MID1_GAIN (7.943f)
-#define AL_EQUALIZER_DEFAULT_MID1_GAIN (1.0f)
-
-#define AL_EQUALIZER_MIN_MID1_CENTER (200.0f)
-#define AL_EQUALIZER_MAX_MID1_CENTER (3000.0f)
-#define AL_EQUALIZER_DEFAULT_MID1_CENTER (500.0f)
-
-#define AL_EQUALIZER_MIN_MID1_WIDTH (0.01f)
-#define AL_EQUALIZER_MAX_MID1_WIDTH (1.0f)
-#define AL_EQUALIZER_DEFAULT_MID1_WIDTH (1.0f)
-
-#define AL_EQUALIZER_MIN_MID2_GAIN (0.126f)
-#define AL_EQUALIZER_MAX_MID2_GAIN (7.943f)
-#define AL_EQUALIZER_DEFAULT_MID2_GAIN (1.0f)
-
-#define AL_EQUALIZER_MIN_MID2_CENTER (1000.0f)
-#define AL_EQUALIZER_MAX_MID2_CENTER (8000.0f)
-#define AL_EQUALIZER_DEFAULT_MID2_CENTER (3000.0f)
-
-#define AL_EQUALIZER_MIN_MID2_WIDTH (0.01f)
-#define AL_EQUALIZER_MAX_MID2_WIDTH (1.0f)
-#define AL_EQUALIZER_DEFAULT_MID2_WIDTH (1.0f)
-
-#define AL_EQUALIZER_MIN_HIGH_GAIN (0.126f)
-#define AL_EQUALIZER_MAX_HIGH_GAIN (7.943f)
-#define AL_EQUALIZER_DEFAULT_HIGH_GAIN (1.0f)
-
-#define AL_EQUALIZER_MIN_HIGH_CUTOFF (4000.0f)
-#define AL_EQUALIZER_MAX_HIGH_CUTOFF (16000.0f)
-#define AL_EQUALIZER_DEFAULT_HIGH_CUTOFF (6000.0f)
-
-
-/* Source parameter value ranges and defaults. */
-#define AL_MIN_AIR_ABSORPTION_FACTOR (0.0f)
-#define AL_MAX_AIR_ABSORPTION_FACTOR (10.0f)
-#define AL_DEFAULT_AIR_ABSORPTION_FACTOR (0.0f)
-
-#define AL_MIN_ROOM_ROLLOFF_FACTOR (0.0f)
-#define AL_MAX_ROOM_ROLLOFF_FACTOR (10.0f)
-#define AL_DEFAULT_ROOM_ROLLOFF_FACTOR (0.0f)
-
-#define AL_MIN_CONE_OUTER_GAINHF (0.0f)
-#define AL_MAX_CONE_OUTER_GAINHF (1.0f)
-#define AL_DEFAULT_CONE_OUTER_GAINHF (1.0f)
-
-#define AL_MIN_DIRECT_FILTER_GAINHF_AUTO AL_FALSE
-#define AL_MAX_DIRECT_FILTER_GAINHF_AUTO AL_TRUE
-#define AL_DEFAULT_DIRECT_FILTER_GAINHF_AUTO AL_TRUE
-
-#define AL_MIN_AUXILIARY_SEND_FILTER_GAIN_AUTO AL_FALSE
-#define AL_MAX_AUXILIARY_SEND_FILTER_GAIN_AUTO AL_TRUE
-#define AL_DEFAULT_AUXILIARY_SEND_FILTER_GAIN_AUTO AL_TRUE
-
-#define AL_MIN_AUXILIARY_SEND_FILTER_GAINHF_AUTO AL_FALSE
-#define AL_MAX_AUXILIARY_SEND_FILTER_GAINHF_AUTO AL_TRUE
-#define AL_DEFAULT_AUXILIARY_SEND_FILTER_GAINHF_AUTO AL_TRUE
-
-
-/* Listener parameter value ranges and defaults. */
-#define AL_MIN_METERS_PER_UNIT FLT_MIN
-#define AL_MAX_METERS_PER_UNIT FLT_MAX
-#define AL_DEFAULT_METERS_PER_UNIT (1.0f)
-
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif /* AL_EFX_H */
diff --git a/internal/c/parts/audio/out/android/OpenAL/include/AL/oalMacOSX_OALExtensions.h b/internal/c/parts/audio/out/android/OpenAL/include/AL/oalMacOSX_OALExtensions.h
deleted file mode 100644
index c3db30546..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/include/AL/oalMacOSX_OALExtensions.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/**********************************************************************************************************************************
-*
-* OpenAL cross platform audio library
-* Copyright (c) 2004-2006, Apple Computer, Inc. All rights reserved.
-* Copyright (c) 2007-2008, Apple Inc. All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
-* conditions are met:
-*
-* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
-* disclaimer in the documentation and/or other materials provided with the distribution.
-* 3. Neither the name of Apple Inc. ("Apple") nor the names of its contributors may be used to endorse or promote products derived
-* from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS
-* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-**********************************************************************************************************************************/
-
-#ifndef __OAL_MAC_OSX_OAL_EXTENSIONS_H__
-#define __OAL_MAC_OSX_OAL_EXTENSIONS_H__
-
-#include
-
-/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
-
-/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ALC_EXT_MAC_OSX
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
-
-// Retrieve functions via alGetProcAddress() by passing in strings: alcMacOSXMixerOutputRate or alcMacOSXGetMixerOutputRate
-
-// Setting the Mixer Output Rate effectively sets the samnple rate at which the mixer
-typedef ALvoid (*alcMacOSXRenderingQualityProcPtr) (ALint value);
-typedef ALvoid (*alMacOSXRenderChannelCountProcPtr) (ALint value);
-typedef ALvoid (*alcMacOSXMixerMaxiumumBussesProcPtr) (ALint value);
-typedef ALvoid (*alcMacOSXMixerOutputRateProcPtr) (ALdouble value);
-
-typedef ALint (*alcMacOSXGetRenderingQualityProcPtr) ();
-typedef ALint (*alMacOSXGetRenderChannelCountProcPtr) ();
-typedef ALint (*alcMacOSXGetMixerMaxiumumBussesProcPtr) ();
-typedef ALdouble (*alcMacOSXGetMixerOutputRateProcPtr) ();
-
-/* Render Quality. Used with alcMacOSXRenderingQuality() */
-
- #define ALC_MAC_OSX_SPATIAL_RENDERING_QUALITY_HIGH 'rqhi'
- #define ALC_MAC_OSX_SPATIAL_RENDERING_QUALITY_LOW 'rdlo'
-
- // High Quality Spatial Algorithm suitable only for headphone use
- #define ALC_IPHONE_SPATIAL_RENDERING_QUALITY_HEADPHONES 'hdph'
-
-/*
- Render Channels. Used with alMacOSXRenderChannelCount()
- Allows a user to force OpenAL to render to stereo, regardless of the audio hardware being used
-*/
- #define ALC_MAC_OSX_RENDER_CHANNEL_COUNT_STEREO 'rcst'
-
-/* GameKit extension */
-
- #define AL_GAMEKIT 'gksr'
-
-/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- AL_EXT_SOURCE_NOTIFICATIONS
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
-/*
- Source Notifications
-
- Eliminates the need for continuous polling for source state by providing a
- mechanism for the application to receive source state change notifications.
- Upon receiving a notification, the application can retrieve the actual state
- corresponding to the notification ID for which the notification was sent.
- */
-
-#define AL_QUEUE_HAS_LOOPED 0x9000
-
-/*
- Notification Proc: ALSourceNotificationProc
-
- sid - source id
- notificationID - id of state that has changed
- userData - user data provided to alSourceAddNotification()
- */
-
-typedef ALvoid (*alSourceNotificationProc)(ALuint sid, ALuint notificationID, ALvoid* userData);
-
-/*
- API: alSourceAddNotification
-
- sid - source id
- notificationID - id of state for which caller wants to be notified of a change
- notifyProc - notification proc
- userData - ptr to applications user data, will be returned in the notification proc
-
- Returns AL_NO_ERROR if request is successful.
-
- Valid IDs:
- AL_SOURCE_STATE
- AL_BUFFERS_PROCESSED
- AL_QUEUE_HAS_LOOPED - notification sent when a looping source has looped to it's start point
- */
-typedef ALenum (*alSourceAddNotificationProcPtr) (ALuint sid, ALuint notificationID, alSourceNotificationProc notifyProc, ALvoid* userData);
-
-/*
- API: alSourceRemoveStateNotification
-
- sid - source id
- notificationID - id of state for which caller wants to remove an existing notification
- notifyProc - notification proc
- userData - ptr to applications user data, will be returned in the notification proc
- */
-typedef ALvoid (*alSourceRemoveNotificationProcPtr) (ALuint sid, ALuint notificationID, alSourceNotificationProc notifyProc, ALvoid* userData);
-
-/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ALC_EXT_ASA : Apple Spatial Audio Extension
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
-/*
- Used with the ASA API calls: alcASAGetSource(), alcASASetSource(), alcASAGetListener(), alcASASetListener()
-*/
-
-typedef ALenum (*alcASAGetSourceProcPtr) (ALuint property, ALuint source, ALvoid *data, ALuint* dataSize);
-typedef ALenum (*alcASASetSourceProcPtr) (ALuint property, ALuint source, ALvoid *data, ALuint dataSize);
-typedef ALenum (*alcASAGetListenerProcPtr) (ALuint property, ALvoid *data, ALuint* dataSize);
-typedef ALenum (*alcASASetListenerProcPtr) (ALuint property, ALvoid *data, ALuint dataSize);
-
- /* listener properties */
- #define ALC_ASA_REVERB_ON 'rvon' // type ALuint
- #define ALC_ASA_REVERB_GLOBAL_LEVEL 'rvgl' // type ALfloat -40.0 db - 40.0 db
-
- #define ALC_ASA_REVERB_ROOM_TYPE 'rvrt' // type ALint
-
- /* reverb room type presets for the ALC_ASA_REVERB_ROOM_TYPE property */
- #define ALC_ASA_REVERB_ROOM_TYPE_SmallRoom 0
- #define ALC_ASA_REVERB_ROOM_TYPE_MediumRoom 1
- #define ALC_ASA_REVERB_ROOM_TYPE_LargeRoom 2
- #define ALC_ASA_REVERB_ROOM_TYPE_MediumHall 3
- #define ALC_ASA_REVERB_ROOM_TYPE_LargeHall 4
- #define ALC_ASA_REVERB_ROOM_TYPE_Plate 5
- #define ALC_ASA_REVERB_ROOM_TYPE_MediumChamber 6
- #define ALC_ASA_REVERB_ROOM_TYPE_LargeChamber 7
- #define ALC_ASA_REVERB_ROOM_TYPE_Cathedral 8
- #define ALC_ASA_REVERB_ROOM_TYPE_LargeRoom2 9
- #define ALC_ASA_REVERB_ROOM_TYPE_MediumHall2 10
- #define ALC_ASA_REVERB_ROOM_TYPE_MediumHall3 11
- #define ALC_ASA_REVERB_ROOM_TYPE_LargeHall2 12
-
- #define ALC_ASA_REVERB_EQ_GAIN 'rveg' // type ALfloat
- #define ALC_ASA_REVERB_EQ_BANDWITH 'rveb' // type ALfloat
- #define ALC_ASA_REVERB_EQ_FREQ 'rvef' // type ALfloat
-
- /* source properties */
- #define ALC_ASA_REVERB_SEND_LEVEL 'rvsl' // type ALfloat 0.0 (dry) - 1.0 (wet) (0-100% dry/wet mix, 0.0 default)
- #define ALC_ASA_OCCLUSION 'occl' // type ALfloat -100.0 db (most occlusion) - 0.0 db (no occlusion, 0.0 default)
- #define ALC_ASA_OBSTRUCTION 'obst' // type ALfloat -100.0 db (most obstruction) - 0.0 db (no obstruction, 0.0 default)
-
-#endif // __OAL_MAC_OSX_OAL_EXTENSIONS_H__
diff --git a/internal/c/parts/audio/out/android/OpenAL/include/config.h b/internal/c/parts/audio/out/android/OpenAL/include/config.h
deleted file mode 100644
index 7016963e1..000000000
--- a/internal/c/parts/audio/out/android/OpenAL/include/config.h
+++ /dev/null
@@ -1,125 +0,0 @@
-#ifndef CONFIG_H
-#define CONFIG_H
-
-/* Define to the library version */
-#define ALSOFT_VERSION "1.12.854"
-
-#define AL_BUILD_LIBRARY
-
-/* Define if we have the Android backend */
-#if defined(ANDROID)
-
-// Stereo only on Android back-ends
-#define MAXCHANNELS 3
-#define STEREO_ONLY 1
-
-#if defined(POST_FROYO)
-#define HAVE_OPENSLES 1
-#endif
-
-#define HAVE_AUDIOTRACK 1
-
-// For throttling AlSource.c
-
-#ifndef MAX_SOURCES_LOW
-#define MAX_SOURCES_LOW 4
-#endif
-#ifndef MAX_SOURCES_START
-#define MAX_SOURCES_START 8
-#endif
-#ifndef MAX_SOURCES_HIGH
-#define MAX_SOURCES_HIGH 64
-#endif
-#endif
-
-/* Define if we have the ALSA backend */
-/* #cmakedefine HAVE_ALSA */
-
-/* Define if we have the OSS backend */
-/* #cmakedefine HAVE_OSS */
-
-/* Define if we have the Solaris backend */
-/* #cmakedefine HAVE_SOLARIS */
-
-/* Define if we have the DSound backend */
-/* #cmakedefine HAVE_DSOUND */
-
-/* Define if we have the Wave Writer backend */
-/* #cmakedefine HAVE_WAVE */
-
-/* Define if we have the Windows Multimedia backend */
-/* #cmakedefine HAVE_WINMM */
-
-/* Define if we have the PortAudio backend */
-/* #cmakedefine HAVE_PORTAUDIO */
-
-/* Define if we have the PulseAudio backend */
-/* #cmakedefine HAVE_PULSEAUDIO */
-
-/* Define if we have dlfcn.h */
-#define HAVE_DLFCN_H 1
-
-/* Define if we have the stat function */
-#define HAVE_STAT 1
-
-/* Define if we have the powf function */
-#define HAVE_POWF 1
-
-/* Define if we have the sqrtf function */
-#define HAVE_SQRTF 1
-
-/* Define if we have the acosf function */
-#define HAVE_ACOSF 1
-
-/* Define if we have the atanf function */
-#define HAVE_ATANF 1
-
-/* Define if we have the fabsf function */
-#define HAVE_FABSF 1
-
-/* Define if we have the strtof function */
-#define HAVE_STRTOF 1
-
-/* Define if we have stdint.h */
-#define HAVE_STDINT_H 1
-
-/* Define if we have the __int64 type */
-/* #cmakedefine HAVE___INT64 */
-
-/* Define to the size of a long int type */
-#define SIZEOF_LONG 4
-
-/* Define to the size of a long long int type */
-#define SIZEOF_LONG_LONG 8
-
-/* Define to the size of an unsigned int type */
-#define SIZEOF_UINT 4
-
-/* Define to the size of a void pointer type */
-#define SIZEOF_VOIDP 4
-
-/* Define if we have GCC's destructor attribute */
-#define HAVE_GCC_DESTRUCTOR 1
-
-/* Define if we have GCC's format attribute */
-#define HAVE_GCC_FORMAT 1
-
-/* Define if we have pthread_np.h */
-/* #cmakedefine HAVE_PTHREAD_NP_H */
-
-/* Define if we have float.h */
-/* #cmakedefine HAVE_FLOAT_H */
-
-/* Define if we have fenv.h */
-#define HAVE_FENV_H 1
-
-/* Define if we have fesetround() */
-/* #cmakedefine HAVE_FESETROUND */
-
-/* Define if we have _controlfp() */
-/* #cmakedefine HAVE__CONTROLFP */
-
-/* Define if we have pthread_setschedparam() */
-#define HAVE_PTHREAD_SETSCHEDPARAM 1
-
-#endif
diff --git a/internal/c/parts/audio/out/android/other/AL/al.h b/internal/c/parts/audio/out/android/other/AL/al.h
deleted file mode 100644
index e084b3ed3..000000000
--- a/internal/c/parts/audio/out/android/other/AL/al.h
+++ /dev/null
@@ -1,825 +0,0 @@
-#ifndef AL_AL_H
-#define AL_AL_H
-
-#ifdef ANDROID
-#include
-#ifndef LOGI
-#define LOGI(...) __android_log_print(ANDROID_LOG_INFO,"OpenAL",__VA_ARGS__)
-#endif
-#ifndef LOGE
-#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,"OpenAL",__VA_ARGS__)
-#endif
-#endif
-
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
-#if defined(AL_LIBTYPE_STATIC)
- #define AL_API
-#elif defined(_WIN32) && !defined(_XBOX)
- #if defined(AL_BUILD_LIBRARY)
- #define AL_API __declspec(dllexport)
- #else
- #define AL_API __declspec(dllimport)
- #endif
-#else
- #if defined(AL_BUILD_LIBRARY) && defined(HAVE_GCC_VISIBILITY)
- #define AL_API __attribute__((visibility("protected")))
- #else
- #define AL_API extern
- #endif
-#endif
-
-#if defined(_WIN32)
- #define AL_APIENTRY __cdecl
-#else
- #define AL_APIENTRY
-#endif
-
-#if defined(TARGET_OS_MAC) && TARGET_OS_MAC
- #pragma export on
-#endif
-
-/*
- * The OPENAL, ALAPI, ALAPIENTRY, AL_INVALID, AL_ILLEGAL_ENUM, and
- * AL_ILLEGAL_COMMAND macros are deprecated, but are included for
- * applications porting code from AL 1.0
- */
-#define OPENAL
-#define ALAPI AL_API
-#define ALAPIENTRY AL_APIENTRY
-#define AL_INVALID (-1)
-#define AL_ILLEGAL_ENUM AL_INVALID_ENUM
-#define AL_ILLEGAL_COMMAND AL_INVALID_OPERATION
-
-#define AL_VERSION_1_0
-#define AL_VERSION_1_1
-
-
-/** 8-bit boolean */
-typedef char ALboolean;
-
-/** character */
-typedef char ALchar;
-
-/** signed 8-bit 2's complement integer */
-typedef signed char ALbyte;
-
-/** unsigned 8-bit integer */
-typedef unsigned char ALubyte;
-
-/** signed 16-bit 2's complement integer */
-typedef short ALshort;
-
-/** unsigned 16-bit integer */
-typedef unsigned short ALushort;
-
-/** signed 32-bit 2's complement integer */
-typedef int ALint;
-
-/** unsigned 32-bit integer */
-typedef unsigned int ALuint;
-
-/** non-negative 32-bit binary integer size */
-typedef int ALsizei;
-
-/** enumerated 32-bit value */
-typedef int ALenum;
-
-/** 32-bit IEEE754 floating-point */
-typedef float ALfloat;
-
-/** 64-bit IEEE754 floating-point */
-typedef double ALdouble;
-
-#ifdef OPENAL_FIXED_POINT
-/* Apportable tries to define int64_t and int32_t if it thinks it is needed.
- * But this is breaking in a complex project involving both pure C and C++
- * something is triggering redefinition errors. The workaround seems to be just using stdint.h.
- */
-#include