Remove legacy app source
No files matched your search
@@ -1,2 +0,0 @@
|
||||
/.cxx
|
||||
/build
|
||||
@@ -1,3 +0,0 @@
|
||||
[submodule "src/main/cpp/OpenXR-SDK"]
|
||||
path = src/main/cpp/OpenXR-SDK
|
||||
url = https://github.com/KhronosGroup/OpenXR-SDK.git
|
||||
@@ -1,46 +0,0 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdk 30
|
||||
|
||||
defaultConfig {
|
||||
applicationId 'com.winlator'
|
||||
minSdkVersion 26
|
||||
targetSdkVersion 28
|
||||
versionCode 16
|
||||
versionName "7.1"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
minifyEnabled true
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
|
||||
ndk {
|
||||
abiFilters 'arm64-v8a', 'armeabi-v7a'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
checkReleaseBuilds false
|
||||
}
|
||||
|
||||
ndkVersion '22.1.7171670'
|
||||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
version '3.22.1'
|
||||
path 'src/main/cpp/CMakeLists.txt'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||
implementation 'androidx.preference:preference:1.1.1'
|
||||
implementation 'com.google.android.material:material:1.4.0'
|
||||
implementation 'com.github.luben:zstd-jni:1.5.2-3@aar'
|
||||
implementation 'org.tukaani:xz:1.7'
|
||||
implementation 'org.apache.commons:commons-compress:1.20'
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in C:\tools\adt-bundle-windows-x86_64-20131030\sdk/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the proguardFiles
|
||||
# directive in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
-dontobfuscate
|
||||
@@ -1,78 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.winlator">
|
||||
<uses-feature
|
||||
android:glEsVersion="0x00020000"
|
||||
android:required="true" />
|
||||
<uses-feature
|
||||
android:name="android.hardware.vr.headtracking"
|
||||
android:required="false" />
|
||||
<uses-feature
|
||||
android:name="com.oculus.feature.PASSTHROUGH"
|
||||
android:required="false" />
|
||||
<uses-feature
|
||||
android:name="oculus.software.handtracking"
|
||||
android:required="false" />
|
||||
<uses-feature
|
||||
android:name="oculus.software.overlay_keyboard"
|
||||
android:required="false" />
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
|
||||
|
||||
<application
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:appCategory="game"
|
||||
android:isGame="true"
|
||||
android:extractNativeLibs="true"
|
||||
android:allowAudioPlaybackCapture="true"
|
||||
android:label="@string/app_name">
|
||||
|
||||
<activity android:name="com.winlator.MainActivity"
|
||||
android:theme="@style/AppTheme"
|
||||
android:exported="true"
|
||||
android:screenOrientation="sensor"
|
||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize|density|navigation">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity android:name="com.winlator.XServerDisplayActivity"
|
||||
android:exported="false"
|
||||
android:theme="@style/AppThemeFullscreen"
|
||||
android:launchMode="singleTask"
|
||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize|density|navigation"
|
||||
android:screenOrientation="sensorLandscape" />
|
||||
|
||||
<activity
|
||||
android:name="com.winlator.XrActivity"
|
||||
android:configChanges="density|orientation|screenSize|keyboard|keyboardHidden|uiMode"
|
||||
android:exported="true"
|
||||
android:launchMode="singleTask"
|
||||
android:resizeableActivity="false"
|
||||
android:screenOrientation="landscape"
|
||||
android:process=":vr_process"
|
||||
android:theme="@style/AppThemeFullscreen">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="com.oculus.intent.category.VR" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity android:name="com.winlator.ControlsEditorActivity"
|
||||
android:exported="false"
|
||||
android:theme="@style/AppThemeFullscreen"
|
||||
android:screenOrientation="sensorLandscape" />
|
||||
|
||||
<activity android:name="com.winlator.ExternalControllerBindingsActivity"
|
||||
android:theme="@style/AppTheme"
|
||||
android:exported="false"
|
||||
android:screenOrientation="sensor" />
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -1 +0,0 @@
|
||||
*.txz filter=lfs diff=lfs merge=lfs -text
|
||||
@@ -1,11 +0,0 @@
|
||||
[
|
||||
{"name" : "BOX64_DYNAREC_SAFEFLAGS", "values" : ["0", "1", "2"], "defaultValue" : "2"},
|
||||
{"name" : "BOX64_DYNAREC_FASTNAN", "values" : ["0", "1"], "toggleSwitch" : true, "defaultValue" : "1"},
|
||||
{"name" : "BOX64_DYNAREC_FASTROUND", "values" : ["0", "1"], "toggleSwitch" : true, "defaultValue" : "1"},
|
||||
{"name" : "BOX64_DYNAREC_X87DOUBLE", "values" : ["0", "1"], "toggleSwitch" : true, "defaultValue" : "0"},
|
||||
{"name" : "BOX64_DYNAREC_BIGBLOCK", "values" : ["0", "1", "2", "3"], "defaultValue" : "1"},
|
||||
{"name" : "BOX64_DYNAREC_STRONGMEM", "values" : ["0", "1", "2", "3"], "defaultValue" : "0"},
|
||||
{"name" : "BOX64_DYNAREC_FORWARD", "values" : ["0", "128", "256", "512", "1024"], "defaultValue" : "128"},
|
||||
{"name" : "BOX64_DYNAREC_CALLRET", "values" : ["0", "1"], "toggleSwitch" : true, "defaultValue" : "1"},
|
||||
{"name" : "BOX64_DYNAREC_WAIT", "values" : ["0", "1"], "toggleSwitch" : true, "defaultValue" : "1"}
|
||||
]
|
||||
@@ -1,11 +0,0 @@
|
||||
[
|
||||
{"name" : "BOX86_DYNAREC_SAFEFLAGS", "values" : ["0", "1", "2"], "defaultValue" : "2"},
|
||||
{"name" : "BOX86_DYNAREC_FASTNAN", "values" : ["0", "1"], "toggleSwitch" : true, "defaultValue" : "1"},
|
||||
{"name" : "BOX86_DYNAREC_FASTROUND", "values" : ["0", "1"], "toggleSwitch" : true, "defaultValue" : "1"},
|
||||
{"name" : "BOX86_DYNAREC_X87DOUBLE", "values" : ["0", "1"], "toggleSwitch" : true, "defaultValue" : "0"},
|
||||
{"name" : "BOX86_DYNAREC_BIGBLOCK", "values" : ["0", "1", "2", "3"], "defaultValue" : "1"},
|
||||
{"name" : "BOX86_DYNAREC_STRONGMEM", "values" : ["0", "1", "2", "3"], "defaultValue" : "0"},
|
||||
{"name" : "BOX86_DYNAREC_FORWARD", "values" : ["0", "128", "256", "512", "1024"], "defaultValue" : "128"},
|
||||
{"name" : "BOX86_DYNAREC_CALLRET", "values" : ["0", "1"], "toggleSwitch" : true, "defaultValue" : "1"},
|
||||
{"name" : "BOX86_DYNAREC_WAIT", "values" : ["0", "1"], "toggleSwitch" : true, "defaultValue" : "1"}
|
||||
]
|
||||
@@ -1 +0,0 @@
|
||||
{"system32":["winedevice.exe","explorer.exe","iexplore.exe","notepad.exe","msxml.dll","msxml2.dll","msxml3.dll","msxml4.dll","msxml6.dll","shdocvw.dll","acledit.dll","aclui.dll","activeds.dll","activeds.tlb","actxprxy.dll","adsldp.dll","adsldpc.dll","advapi32.dll","advpack.dll","amsi.dll","amstream.dll","apisetschema.dll","apphelp.dll","appwiz.cpl","appxdeploymentclient.dll","arp.exe","atl.dll","atl100.dll","atl110.dll","atl80.dll","atl90.dll","atlthunk.dll","atmlib.dll","attrib.exe","authz.dll","avicap32.dll","avifil32.dll","avrt.dll","bcrypt.dll","bcryptprimitives.dll","bluetoothapis.dll","browseui.dll","bthprops.cpl","cabarc.exe","cabinet.dll","cacls.exe","capi2032.dll","cards.dll","cdosys.dll","certutil.exe","cfgmgr32.dll","chcp.com","clock.exe","clusapi.dll","cmd.exe","combase.dll","comcat.dll","comctl32.dll","comdlg32.dll","coml2.dll","compstui.dll","comsvcs.dll","concrt140.dll","conhost.exe","connect.dll","control.exe","credui.dll","crtdll.dll","crypt32.dll","cryptdlg.dll","cryptdll.dll","cryptext.dll","cryptnet.dll","cryptowinrt.dll","cryptsp.dll","cryptui.dll","cscript.exe","ctapi32.dll","ctl3d32.dll","d2d1.dll","d3d10.dll","d3d10core.dll","d3d10_1.dll","d3d11.dll","d3d12.dll","d3d12core.dll","d3d8.dll","d3d8thk.dll","d3d9.dll","d3dcompiler_33.dll","d3dcompiler_34.dll","d3dcompiler_35.dll","d3dcompiler_36.dll","d3dcompiler_37.dll","d3dcompiler_38.dll","d3dcompiler_39.dll","d3dcompiler_40.dll","d3dcompiler_41.dll","d3dcompiler_42.dll","d3dcompiler_43.dll","d3dcompiler_46.dll","d3dcompiler_47.dll","d3dim.dll","d3dim700.dll","d3drm.dll","d3dx10_33.dll","d3dx10_34.dll","d3dx10_35.dll","d3dx10_36.dll","d3dx10_37.dll","d3dx10_38.dll","d3dx10_39.dll","d3dx10_40.dll","d3dx10_41.dll","d3dx10_42.dll","d3dx10_43.dll","d3dx11_42.dll","d3dx11_43.dll","d3dx9_24.dll","d3dx9_25.dll","d3dx9_26.dll","d3dx9_27.dll","d3dx9_28.dll","d3dx9_29.dll","d3dx9_30.dll","d3dx9_31.dll","d3dx9_32.dll","d3dx9_33.dll","d3dx9_34.dll","d3dx9_35.dll","d3dx9_36.dll","d3dx9_37.dll","d3dx9_38.dll","d3dx9_39.dll","d3dx9_40.dll","d3dx9_41.dll","d3dx9_42.dll","d3dx9_43.dll","d3dxof.dll","davclnt.dll","dbgeng.dll","dbghelp.dll","dciman32.dll","dcomp.dll","ddraw.dll","ddrawex.dll","devenum.dll","dhcpcsvc.dll","dhcpcsvc6.dll","dhtmled.ocx","difxapi.dll","dinput.dll","dinput8.dll","directmanipulation.dll","dism.exe","dispex.dll","dllhost.exe","dmband.dll","dmcompos.dll","dmime.dll","dmloader.dll","dmscript.dll","dmstyle.dll","dmsynth.dll","dmusic.dll","dmusic32.dll","dnsapi.dll","dplay.dll","dplaysvr.exe","dplayx.dll","dpnaddr.dll","dpnet.dll","dpnhpast.dll","dpnhupnp.dll","dpnlobby.dll","dpnsvr.exe","dpvoice.dll","dpvsetup.exe","dpwsockx.dll","drmclien.dll","dsdmo.dll","dsound.dll","dsquery.dll","dssenh.dll","dsuiext.dll","dswave.dll","dwrite.dll","dxtrans.dll","dxva2.dll","eject.exe","esent.dll","explorerframe.dll","faultrep.dll","fc.exe","gdiplus.dll","geolocation.dll","hal.dll","hnetcfg.dll","hvsimanagementapi.dll","ia2comproxy.dll","icacls.exe","iccvid.dll","icinfo.exe","icmp.dll","imm32.dll","ir50_32.dll","kernel32.dll","localui.dll","mcicda.dll","mfplay.dll","mmcndmgr.dll","msasn1.dll","mscat32.dll","msctfmonitor.dll","msg711.acm","msidb.exe","msident.dll","msiexec.exe","msisip.dll","msrle32.dll","msscript.ocx","mssign32.dll","mssip32.dll","mstask.dll","msvcirt.dll","msvcp71.dll","msvcp90.dll","msvcr100.dll","msvcr120_app.dll","msvcr71.dll","msvcr90.dll","msvcrtd.dll","msvidc32.dll","ncrypt.dll","net.exe","netutils.dll","nsi.dll","ntdsapi.dll","oleaut32.dll","opcservices.dll","progman.exe","psapi.dll","qmgrprxy.dll","rasapi32.dll","regini.exe","riched32.dll","sas.dll","scardsvr.dll","sccbase.dll","schtasks.exe","sdbinst.exe","sechost.dll","sensapi.dll","shfolder.dll","shutdown.exe","spoolss.dll","systeminfo.exe","tbs.dll","tdh.dll","ucrtbase.dll","url.dll","userenv.dll","utildll.dll","uxtheme.dll","vcomp140.dll","wer.dll","wevtsvc.dll","wiaservc.dll","windows.devices.bluetooth.dll","windows.devices.enumeration.dll","windows.devices.usb.dll","windows.media.mediacontrol.dll","windows.media.speech.dll","windows.perception.stub.dll","windows.storage.applicationdata.dll","windows.system.profile.systemmanufacturers.dll","winealsa.drv","winegstreamer.dll","winepulse.drv","winnls32.dll","wintab32.dll","wlanui.dll","wldp.dll","wmasf.dll","wmp.dll","wmvcore.dll","wnaspi32.dll","wow64cpu.dll","x3daudio1_0.dll","x3daudio1_3.dll","dx8vb.dll","dxdiag.exe","dxgi.dll","evr.dll","extrac32.exe","feclient.dll","find.exe","findstr.exe","fntcache.dll","fsutil.exe","hhctrl.ocx","hostname.exe","ieframe.dll","inetcpl.cpl","ipconfig.exe","iphlpapi.dll","iprop.dll","irprops.cpl","itircl.dll","jscript.dll","kernelbase.dll","mapi32.dll","mciseq.dll","mciwave.dll","mf3216.dll","mfplat.dll","mgmtapi.dll","mp3dmod.dll","mpr.dll","msacm32.dll","msauddecmft.dll","msctfp.dll","msdelta.dll","msimsg.dll","msls31.dll","msvcr110.dll","msvcr120.dll","nddeapi.dll","netcfgx.dll","netprofm.dll","newdev.dll","ninput.dll","npptools.dll","ntprint.dll","odbccp32.dll","olepro32.dll"Line truncated
|
||||
@@ -1,73 +0,0 @@
|
||||
#if defined(VERTEX)
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
#define COMPAT_VARYING out
|
||||
#define COMPAT_ATTRIBUTE in
|
||||
#define COMPAT_TEXTURE texture
|
||||
#else
|
||||
#define COMPAT_VARYING varying
|
||||
#define COMPAT_ATTRIBUTE attribute
|
||||
#define COMPAT_TEXTURE texture2D
|
||||
#endif
|
||||
|
||||
#ifdef GL_ES
|
||||
#define COMPAT_PRECISION mediump
|
||||
#else
|
||||
#define COMPAT_PRECISION
|
||||
#endif
|
||||
|
||||
COMPAT_ATTRIBUTE vec4 VertexCoord;
|
||||
COMPAT_ATTRIBUTE vec4 COLOR;
|
||||
COMPAT_ATTRIBUTE vec4 TexCoord;
|
||||
COMPAT_VARYING vec4 COL0;
|
||||
COMPAT_VARYING vec4 TEX0;
|
||||
|
||||
uniform mat4 MVPMatrix;
|
||||
uniform COMPAT_PRECISION int FrameDirection;
|
||||
uniform COMPAT_PRECISION int FrameCount;
|
||||
uniform COMPAT_PRECISION vec2 OutputSize;
|
||||
uniform COMPAT_PRECISION vec2 TextureSize;
|
||||
uniform COMPAT_PRECISION vec2 InputSize;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = VertexCoord.x * MVPMatrix[0] + VertexCoord.y * MVPMatrix[1] + VertexCoord.z * MVPMatrix[2] + VertexCoord.w * MVPMatrix[3];
|
||||
TEX0.xy = TexCoord.xy;
|
||||
}
|
||||
|
||||
#elif defined(FRAGMENT)
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
#define COMPAT_VARYING in
|
||||
#define COMPAT_TEXTURE texture
|
||||
out vec4 FragColor;
|
||||
#else
|
||||
#define COMPAT_VARYING varying
|
||||
#define FragColor gl_FragColor
|
||||
#define COMPAT_TEXTURE texture2D
|
||||
#endif
|
||||
|
||||
#ifdef GL_ES
|
||||
#ifdef GL_FRAGMENT_PRECISION_HIGH
|
||||
precision highp float;
|
||||
#else
|
||||
precision mediump float;
|
||||
#endif
|
||||
#define COMPAT_PRECISION mediump
|
||||
#else
|
||||
#define COMPAT_PRECISION
|
||||
#endif
|
||||
|
||||
uniform COMPAT_PRECISION int FrameDirection;
|
||||
uniform COMPAT_PRECISION int FrameCount;
|
||||
uniform COMPAT_PRECISION vec2 OutputSize;
|
||||
uniform COMPAT_PRECISION vec2 TextureSize;
|
||||
uniform COMPAT_PRECISION vec2 InputSize;
|
||||
uniform sampler2D Texture;
|
||||
COMPAT_VARYING vec4 TEX0;
|
||||
|
||||
void main()
|
||||
{
|
||||
FragColor = COMPAT_TEXTURE(Texture, TEX0.xy);
|
||||
}
|
||||
#endif
|
||||
@@ -1,137 +0,0 @@
|
||||
/*
|
||||
The following code is licensed under the MIT license: https://gist.github.com/TheRealMJP/bc503b0b87b643d3505d41eab8b332ae
|
||||
Ported from code: https://gist.github.com/TheRealMJP/c83b8c0f46b63f3a88a5986f4fa982b1
|
||||
Samples a texture with Catmull-Rom filtering, using 9 texture fetches instead of 16.
|
||||
See http://vec3.ca/bicubic-filtering-in-fewer-taps/ for more details
|
||||
ATENTION: This code only work using LINEAR filter sampling set on Retroarch!
|
||||
Modified to use 5 texture fetches
|
||||
*/
|
||||
|
||||
#if defined(VERTEX)
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
#define COMPAT_VARYING out
|
||||
#define COMPAT_ATTRIBUTE in
|
||||
#define COMPAT_TEXTURE texture
|
||||
#else
|
||||
#define COMPAT_VARYING varying
|
||||
#define COMPAT_ATTRIBUTE attribute
|
||||
#define COMPAT_TEXTURE texture2D
|
||||
#endif
|
||||
|
||||
#ifdef GL_ES
|
||||
#define COMPAT_PRECISION mediump
|
||||
precision COMPAT_PRECISION float;
|
||||
#else
|
||||
#define COMPAT_PRECISION
|
||||
#endif
|
||||
|
||||
COMPAT_ATTRIBUTE vec4 VertexCoord;
|
||||
COMPAT_ATTRIBUTE vec4 COLOR;
|
||||
COMPAT_ATTRIBUTE vec4 TexCoord;
|
||||
COMPAT_VARYING vec4 COL0;
|
||||
COMPAT_VARYING vec4 TEX0;
|
||||
|
||||
uniform mat4 MVPMatrix;
|
||||
uniform COMPAT_PRECISION int FrameDirection;
|
||||
uniform COMPAT_PRECISION int FrameCount;
|
||||
uniform COMPAT_PRECISION vec2 OutputSize;
|
||||
uniform COMPAT_PRECISION vec2 TextureSize;
|
||||
uniform COMPAT_PRECISION vec2 InputSize;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = MVPMatrix * VertexCoord;
|
||||
COL0 = COLOR;
|
||||
TEX0.xy = TexCoord.xy;
|
||||
}
|
||||
|
||||
#elif defined(FRAGMENT)
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
#define COMPAT_VARYING in
|
||||
#define COMPAT_TEXTURE texture
|
||||
out mediump vec4 FragColor;
|
||||
#else
|
||||
#define COMPAT_VARYING varying
|
||||
#define FragColor gl_FragColor
|
||||
#define COMPAT_TEXTURE texture2D
|
||||
#endif
|
||||
|
||||
#ifdef GL_ES
|
||||
#ifdef GL_FRAGMENT_PRECISION_HIGH
|
||||
precision highp float;
|
||||
#else
|
||||
precision mediump float;
|
||||
#endif
|
||||
#define COMPAT_PRECISION mediump
|
||||
#else
|
||||
#define COMPAT_PRECISION
|
||||
#endif
|
||||
|
||||
uniform COMPAT_PRECISION int FrameDirection;
|
||||
uniform COMPAT_PRECISION int FrameCount;
|
||||
uniform COMPAT_PRECISION vec2 OutputSize;
|
||||
uniform COMPAT_PRECISION vec2 TextureSize;
|
||||
uniform COMPAT_PRECISION vec2 InputSize;
|
||||
uniform sampler2D Texture;
|
||||
COMPAT_VARYING vec4 TEX0;
|
||||
|
||||
// compatibility #defines
|
||||
#define Source Texture
|
||||
#define vTexCoord TEX0.xy
|
||||
|
||||
#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize
|
||||
#define outsize vec4(OutputSize, 1.0 / OutputSize)
|
||||
|
||||
void main()
|
||||
{
|
||||
// We're going to sample a a 4x4 grid of texels surrounding the target UV coordinate. We'll do this by rounding
|
||||
// down the sample location to get the exact center of our "starting" texel. The starting texel will be at
|
||||
// location [1, 1] in the grid, where [0, 0] is the top left corner.
|
||||
vec2 samplePos = vTexCoord * SourceSize.xy;
|
||||
vec2 texPos1 = floor(samplePos - 0.5) + 0.5;
|
||||
|
||||
// Compute the fractional offset from our starting texel to our original sample location, which we'll
|
||||
// feed into the Catmull-Rom spline function to get our filter weights.
|
||||
vec2 f = samplePos - texPos1;
|
||||
|
||||
// Compute the Catmull-Rom weights using the fractional offset that we calculated earlier.
|
||||
// These equations are pre-expanded based on our knowledge of where the texels will be located,
|
||||
// which lets us avoid having to evaluate a piece-wise function.
|
||||
vec2 w0 = f * (-0.5 + f * (1.0 - 0.5 * f));
|
||||
vec2 w1 = 1.0 + f * f * (-2.5 + 1.5 * f);
|
||||
vec2 w2 = f * (0.5 + f * (2.0 - 1.5 * f));
|
||||
vec2 w3 = f * f * (-0.5 + 0.5 * f);
|
||||
|
||||
// Work out weighting factors and sampling offsets that will let us use bilinear filtering to
|
||||
// simultaneously evaluate the middle 2 samples from the 4x4 grid.
|
||||
vec2 w12 = w1 + w2;
|
||||
vec2 offset12 = w2 / (w1 + w2);
|
||||
|
||||
// Compute the final UV coordinates we'll use for sampling the texture
|
||||
vec2 texPos0 = texPos1 - 1.;
|
||||
vec2 texPos3 = texPos1 + 2.;
|
||||
vec2 texPos12 = texPos1 + offset12;
|
||||
|
||||
texPos0 *= SourceSize.zw;
|
||||
texPos3 *= SourceSize.zw;
|
||||
texPos12 *= SourceSize.zw;
|
||||
|
||||
float wtm = w12.x * w0.y;
|
||||
float wml = w0.x * w12.y;
|
||||
float wmm = w12.x * w12.y;
|
||||
float wmr = w3.x * w12.y;
|
||||
float wbm = w12.x * w3.y;
|
||||
|
||||
vec3 result = vec3(0.0f);
|
||||
|
||||
result += COMPAT_TEXTURE(Source, vec2(texPos12.x, texPos0.y)).rgb * wtm;
|
||||
result += COMPAT_TEXTURE(Source, vec2(texPos0.x, texPos12.y)).rgb * wml;
|
||||
result += COMPAT_TEXTURE(Source, vec2(texPos12.x, texPos12.y)).rgb * wmm;
|
||||
result += COMPAT_TEXTURE(Source, vec2(texPos3.x, texPos12.y)).rgb * wmr;
|
||||
result += COMPAT_TEXTURE(Source, vec2(texPos12.x, texPos3.y)).rgb * wbm;
|
||||
|
||||
FragColor = vec4(result * (1./(wtm+wml+wmm+wmr+wbm)), 1.0);
|
||||
}
|
||||
#endif
|
||||
@@ -1,324 +0,0 @@
|
||||
/*
|
||||
FSR - [EASU] EDGE ADAPTIVE SPATIAL UPSAMPLING
|
||||
Ported from https://www.shadertoy.com/view/stXSWB, MIT license
|
||||
*/
|
||||
|
||||
#if defined(VERTEX)
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
#define COMPAT_VARYING out
|
||||
#define COMPAT_ATTRIBUTE in
|
||||
#define COMPAT_TEXTURE texture
|
||||
#else
|
||||
#define COMPAT_VARYING varying
|
||||
#define COMPAT_ATTRIBUTE attribute
|
||||
#define COMPAT_TEXTURE texture2D
|
||||
#endif
|
||||
|
||||
#ifdef GL_ES
|
||||
#define COMPAT_PRECISION mediump
|
||||
#else
|
||||
#define COMPAT_PRECISION
|
||||
#endif
|
||||
|
||||
COMPAT_ATTRIBUTE vec4 VertexCoord;
|
||||
COMPAT_ATTRIBUTE vec4 COLOR;
|
||||
COMPAT_ATTRIBUTE vec4 TexCoord;
|
||||
COMPAT_VARYING vec4 COL0;
|
||||
COMPAT_VARYING vec4 TEX0;
|
||||
|
||||
uniform mat4 MVPMatrix;
|
||||
uniform COMPAT_PRECISION int FrameDirection;
|
||||
uniform COMPAT_PRECISION int FrameCount;
|
||||
uniform COMPAT_PRECISION vec2 OutputSize;
|
||||
uniform COMPAT_PRECISION vec2 TextureSize;
|
||||
uniform COMPAT_PRECISION vec2 InputSize;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = MVPMatrix * VertexCoord;
|
||||
COL0 = COLOR;
|
||||
TEX0.xy = TexCoord.xy;
|
||||
}
|
||||
|
||||
#elif defined(FRAGMENT)
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
#define COMPAT_VARYING in
|
||||
#define COMPAT_TEXTURE texture
|
||||
out vec4 FragColor;
|
||||
#else
|
||||
#define COMPAT_VARYING varying
|
||||
#define FragColor gl_FragColor
|
||||
#define COMPAT_TEXTURE texture2D
|
||||
#endif
|
||||
|
||||
#ifdef GL_ES
|
||||
#ifdef GL_FRAGMENT_PRECISION_HIGH
|
||||
precision highp float;
|
||||
#else
|
||||
precision mediump float;
|
||||
#endif
|
||||
#define COMPAT_PRECISION mediump
|
||||
#else
|
||||
#define COMPAT_PRECISION
|
||||
#endif
|
||||
|
||||
uniform COMPAT_PRECISION int FrameDirection;
|
||||
uniform COMPAT_PRECISION int FrameCount;
|
||||
uniform COMPAT_PRECISION vec2 OutputSize;
|
||||
uniform COMPAT_PRECISION vec2 TextureSize;
|
||||
uniform COMPAT_PRECISION vec2 InputSize;
|
||||
uniform sampler2D Texture;
|
||||
COMPAT_VARYING vec4 TEX0;
|
||||
|
||||
// compatibility #defines
|
||||
#define Source Texture
|
||||
#define vTexCoord TEX0.xy
|
||||
|
||||
#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize
|
||||
#define outsize vec4(OutputSize, 1.0 / OutputSize)
|
||||
|
||||
vec3 FsrEasuCF(vec2 p) {
|
||||
return COMPAT_TEXTURE(Source,p).rgb;
|
||||
}
|
||||
|
||||
/**** EASU ****/
|
||||
void FsrEasuCon(
|
||||
out vec4 con0,
|
||||
out vec4 con1,
|
||||
out vec4 con2,
|
||||
out vec4 con3,
|
||||
// This the rendered image resolution being upscaled
|
||||
vec2 inputViewportInPixels,
|
||||
// This is the resolution of the resource containing the input image (useful for dynamic resolution)
|
||||
vec2 inputSizeInPixels,
|
||||
// This is the display resolution which the input image gets upscaled to
|
||||
vec2 outputSizeInPixels
|
||||
)
|
||||
{
|
||||
// Output integer position to a pixel position in viewport.
|
||||
con0 = vec4(
|
||||
inputViewportInPixels.x/outputSizeInPixels.x,
|
||||
inputViewportInPixels.y/outputSizeInPixels.y,
|
||||
.5*inputViewportInPixels.x/outputSizeInPixels.x-.5,
|
||||
.5*inputViewportInPixels.y/outputSizeInPixels.y-.5
|
||||
);
|
||||
// Viewport pixel position to normalized image space.
|
||||
// This is used to get upper-left of 'F' tap.
|
||||
con1 = vec4(1,1,1,-1)/inputSizeInPixels.xyxy;
|
||||
// Centers of gather4, first offset from upper-left of 'F'.
|
||||
// +---+---+
|
||||
// | | |
|
||||
// +--(0)--+
|
||||
// | b | c |
|
||||
// +---F---+---+---+
|
||||
// | e | f | g | h |
|
||||
// +--(1)--+--(2)--+
|
||||
// | i | j | k | l |
|
||||
// +---+---+---+---+
|
||||
// | n | o |
|
||||
// +--(3)--+
|
||||
// | | |
|
||||
// +---+---+
|
||||
// These are from (0) instead of 'F'.
|
||||
con2 = vec4(-1,2,1,2)/inputSizeInPixels.xyxy;
|
||||
con3 = vec4(0,4,0,0)/inputSizeInPixels.xyxy;
|
||||
}
|
||||
|
||||
// Filtering for a given tap for the scalar.
|
||||
void FsrEasuTapF(
|
||||
inout vec3 aC, // Accumulated color, with negative lobe.
|
||||
inout float aW, // Accumulated weight.
|
||||
vec2 off, // Pixel offset from resolve position to tap.
|
||||
vec2 dir, // Gradient direction.
|
||||
vec2 len, // Length.
|
||||
float lob, // Negative lobe strength.
|
||||
float clp, // Clipping point.
|
||||
vec3 c
|
||||
)
|
||||
{
|
||||
// Tap color.
|
||||
// Rotate offset by direction.
|
||||
vec2 v = vec2(dot(off, dir), dot(off,vec2(-dir.y,dir.x)));
|
||||
// Anisotropy.
|
||||
v *= len;
|
||||
// Compute distance^2.
|
||||
float d2 = min(dot(v,v),clp);
|
||||
// Limit to the window as at corner, 2 taps can easily be outside.
|
||||
// Approximation of lancos2 without sin() or rcp(), or sqrt() to get x.
|
||||
// (25/16 * (2/5 * x^2 - 1)^2 - (25/16 - 1)) * (1/4 * x^2 - 1)^2
|
||||
// |_______________________________________| |_______________|
|
||||
// base window
|
||||
// The general form of the 'base' is,
|
||||
// (a*(b*x^2-1)^2-(a-1))
|
||||
// Where 'a=1/(2*b-b^2)' and 'b' moves around the negative lobe.
|
||||
float wB = .4 * d2 - 1.;
|
||||
float wA = lob * d2 -1.;
|
||||
wB *= wB;
|
||||
wA *= wA;
|
||||
wB = 1.5625*wB-.5625;
|
||||
float w= wB * wA;
|
||||
// Do weighted average.
|
||||
aC += c*w;
|
||||
aW += w;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
// Accumulate direction and length.
|
||||
void FsrEasuSetF(
|
||||
inout vec2 dir,
|
||||
inout float len,
|
||||
float w,
|
||||
float lA,float lB,float lC,float lD,float lE
|
||||
)
|
||||
{
|
||||
// Direction is the '+' diff.
|
||||
// a
|
||||
// b c d
|
||||
// e
|
||||
// Then takes magnitude from abs average of both sides of 'c'.
|
||||
// Length converts gradient reversal to 0, smoothly to non-reversal at 1, shaped, then adding horz and vert terms.
|
||||
float lenX = max(abs(lD - lC), abs(lC - lB));
|
||||
float dirX = lD - lB;
|
||||
dir.x += dirX * w;
|
||||
lenX = clamp(abs(dirX)/lenX,0.,1.);
|
||||
lenX *= lenX;
|
||||
len += lenX * w;
|
||||
// Repeat for the y axis.
|
||||
float lenY = max(abs(lE - lC), abs(lC - lA));
|
||||
float dirY = lE - lA;
|
||||
dir.y += dirY * w;
|
||||
lenY = clamp(abs(dirY) / lenY,0.,1.);
|
||||
lenY *= lenY;
|
||||
len += lenY * w;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
void FsrEasuF(
|
||||
out vec3 pix,
|
||||
vec2 ip, // Integer pixel position in output.
|
||||
// Constants generated by FsrEasuCon().
|
||||
vec4 con0, // xy = output to input scale, zw = first pixel offset correction
|
||||
vec4 con1,
|
||||
vec4 con2,
|
||||
vec4 con3
|
||||
)
|
||||
{
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
// Get position of 'f'.
|
||||
vec2 pp = ip * con0.xy + con0.zw; // Corresponding input pixel/subpixel
|
||||
vec2 fp = floor(pp);// fp = source nearest pixel
|
||||
pp -= fp; // pp = source subpixel
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
// 12-tap kernel.
|
||||
// b c
|
||||
// e f g h
|
||||
// i j k l
|
||||
// n o
|
||||
// Gather 4 ordering.
|
||||
// a b
|
||||
// r g
|
||||
vec2 p0 = fp * con1.xy + con1.zw;
|
||||
|
||||
// These are from p0 to avoid pulling two constants on pre-Navi hardware.
|
||||
vec2 p1 = p0 + con2.xy;
|
||||
vec2 p2 = p0 + con2.zw;
|
||||
vec2 p3 = p0 + con3.xy;
|
||||
|
||||
// TextureGather is not available on WebGL2
|
||||
vec4 off = vec4(-.5,.5,-.5,.5)*con1.xxyy;
|
||||
// textureGather to texture offsets
|
||||
// x=west y=east z=north w=south
|
||||
vec3 bC = FsrEasuCF(p0 + off.xw); float bL = bC.g + 0.5 *(bC.r + bC.b);
|
||||
vec3 cC = FsrEasuCF(p0 + off.yw); float cL = cC.g + 0.5 *(cC.r + cC.b);
|
||||
vec3 iC = FsrEasuCF(p1 + off.xw); float iL = iC.g + 0.5 *(iC.r + iC.b);
|
||||
vec3 jC = FsrEasuCF(p1 + off.yw); float jL = jC.g + 0.5 *(jC.r + jC.b);
|
||||
vec3 fC = FsrEasuCF(p1 + off.yz); float fL = fC.g + 0.5 *(fC.r + fC.b);
|
||||
vec3 eC = FsrEasuCF(p1 + off.xz); float eL = eC.g + 0.5 *(eC.r + eC.b);
|
||||
vec3 kC = FsrEasuCF(p2 + off.xw); float kL = kC.g + 0.5 *(kC.r + kC.b);
|
||||
vec3 lC = FsrEasuCF(p2 + off.yw); float lL = lC.g + 0.5 *(lC.r + lC.b);
|
||||
vec3 hC = FsrEasuCF(p2 + off.yz); float hL = hC.g + 0.5 *(hC.r + hC.b);
|
||||
vec3 gC = FsrEasuCF(p2 + off.xz); float gL = gC.g + 0.5 *(gC.r + gC.b);
|
||||
vec3 oC = FsrEasuCF(p3 + off.yz); float oL = oC.g + 0.5 *(oC.r + oC.b);
|
||||
vec3 nC = FsrEasuCF(p3 + off.xz); float nL = nC.g + 0.5 *(nC.r + nC.b);
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
// Simplest multi-channel approximate luma possible (luma times 2, in 2 FMA/MAD).
|
||||
// Accumulate for bilinear interpolation.
|
||||
vec2 dir = vec2(0);
|
||||
float len = 0.;
|
||||
|
||||
FsrEasuSetF(dir, len, (1.-pp.x)*(1.-pp.y), bL, eL, fL, gL, jL);
|
||||
FsrEasuSetF(dir, len, pp.x *(1.-pp.y), cL, fL, gL, hL, kL);
|
||||
FsrEasuSetF(dir, len, (1.-pp.x)* pp.y , fL, iL, jL, kL, nL);
|
||||
FsrEasuSetF(dir, len, pp.x * pp.y , gL, jL, kL, lL, oL);
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
// Normalize with approximation, and cleanup close to zero.
|
||||
vec2 dir2 = dir * dir;
|
||||
float dirR = dir2.x + dir2.y;
|
||||
bool zro = dirR < (1.0/32768.0);
|
||||
dirR = inversesqrt(dirR);
|
||||
dirR = zro ? 1.0 : dirR;
|
||||
dir.x = zro ? 1.0 : dir.x;
|
||||
dir *= vec2(dirR);
|
||||
// Transform from {0 to 2} to {0 to 1} range, and shape with square.
|
||||
len = len * 0.5;
|
||||
len *= len;
|
||||
// Stretch kernel {1.0 vert|horz, to sqrt(2.0) on diagonal}.
|
||||
float stretch = dot(dir,dir) / (max(abs(dir.x), abs(dir.y)));
|
||||
// Anisotropic length after rotation,
|
||||
// x := 1.0 lerp to 'stretch' on edges
|
||||
// y := 1.0 lerp to 2x on edges
|
||||
vec2 len2 = vec2(1. +(stretch-1.0)*len, 1. -.5 * len);
|
||||
// Based on the amount of 'edge',
|
||||
// the window shifts from +/-{sqrt(2.0) to slightly beyond 2.0}.
|
||||
float lob = .5 - .29 * len;
|
||||
// Set distance^2 clipping point to the end of the adjustable window.
|
||||
float clp = 1./lob;
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
// Accumulation mixed with min/max of 4 nearest.
|
||||
// b c
|
||||
// e f g h
|
||||
// i j k l
|
||||
// n o
|
||||
vec3 min4 = min(min(fC,gC),min(jC,kC));
|
||||
vec3 max4 = max(max(fC,gC),max(jC,kC));
|
||||
// Accumulation.
|
||||
vec3 aC = vec3(0);
|
||||
float aW = 0.;
|
||||
FsrEasuTapF(aC, aW, vec2( 0,-1)-pp, dir, len2, lob, clp, bC);
|
||||
FsrEasuTapF(aC, aW, vec2( 1,-1)-pp, dir, len2, lob, clp, cC);
|
||||
FsrEasuTapF(aC, aW, vec2(-1, 1)-pp, dir, len2, lob, clp, iC);
|
||||
FsrEasuTapF(aC, aW, vec2( 0, 1)-pp, dir, len2, lob, clp, jC);
|
||||
FsrEasuTapF(aC, aW, vec2( 0, 0)-pp, dir, len2, lob, clp, fC);
|
||||
FsrEasuTapF(aC, aW, vec2(-1, 0)-pp, dir, len2, lob, clp, eC);
|
||||
FsrEasuTapF(aC, aW, vec2( 1, 1)-pp, dir, len2, lob, clp, kC);
|
||||
FsrEasuTapF(aC, aW, vec2( 2, 1)-pp, dir, len2, lob, clp, lC);
|
||||
FsrEasuTapF(aC, aW, vec2( 2, 0)-pp, dir, len2, lob, clp, hC);
|
||||
FsrEasuTapF(aC, aW, vec2( 1, 0)-pp, dir, len2, lob, clp, gC);
|
||||
FsrEasuTapF(aC, aW, vec2( 1, 2)-pp, dir, len2, lob, clp, oC);
|
||||
FsrEasuTapF(aC, aW, vec2( 0, 2)-pp, dir, len2, lob, clp, nC);
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
// Normalize and dering.
|
||||
pix=min(max4,max(min4,aC/aW));
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 c;
|
||||
vec4 con0,con1,con2,con3;
|
||||
|
||||
vec2 fragCoord = vTexCoord.xy * OutputSize.xy;
|
||||
|
||||
FsrEasuCon(
|
||||
con0, con1, con2, con3, SourceSize.xy, SourceSize.xy, OutputSize.xy
|
||||
);
|
||||
FsrEasuF(c, fragCoord, con0, con1, con2, con3);
|
||||
FragColor = vec4(c.xyz, 1);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,178 +0,0 @@
|
||||
/*
|
||||
FSR - [RCAS] ROBUST CONTRAST ADAPTIVE SHARPENING
|
||||
Ported from https://www.shadertoy.com/view/stXSWB, MIT license
|
||||
*/
|
||||
|
||||
#pragma parameter FSR_SHARPENING "FSR RCAS Sharpening Amount (Lower = Sharper)" 0.6 0.0 2.0 0.1
|
||||
|
||||
#if defined(VERTEX)
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
#define COMPAT_VARYING out
|
||||
#define COMPAT_ATTRIBUTE in
|
||||
#define COMPAT_TEXTURE texture
|
||||
#else
|
||||
#define COMPAT_VARYING varying
|
||||
#define COMPAT_ATTRIBUTE attribute
|
||||
#define COMPAT_TEXTURE texture2D
|
||||
#endif
|
||||
|
||||
#ifdef GL_ES
|
||||
#define COMPAT_PRECISION mediump
|
||||
#else
|
||||
#define COMPAT_PRECISION
|
||||
#endif
|
||||
|
||||
COMPAT_ATTRIBUTE vec4 VertexCoord;
|
||||
COMPAT_ATTRIBUTE vec4 COLOR;
|
||||
COMPAT_ATTRIBUTE vec4 TexCoord;
|
||||
COMPAT_VARYING vec4 COL0;
|
||||
COMPAT_VARYING vec4 TEX0;
|
||||
|
||||
uniform mat4 MVPMatrix;
|
||||
uniform COMPAT_PRECISION int FrameDirection;
|
||||
uniform COMPAT_PRECISION int FrameCount;
|
||||
uniform COMPAT_PRECISION vec2 OutputSize;
|
||||
uniform COMPAT_PRECISION vec2 TextureSize;
|
||||
uniform COMPAT_PRECISION vec2 InputSize;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = MVPMatrix * VertexCoord;
|
||||
COL0 = COLOR;
|
||||
TEX0.xy = TexCoord.xy;
|
||||
}
|
||||
|
||||
#elif defined(FRAGMENT)
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
#define COMPAT_VARYING in
|
||||
#define COMPAT_TEXTURE texture
|
||||
out vec4 FragColor;
|
||||
#else
|
||||
#define COMPAT_VARYING varying
|
||||
#define FragColor gl_FragColor
|
||||
#define COMPAT_TEXTURE texture2D
|
||||
#endif
|
||||
|
||||
#ifdef GL_ES
|
||||
#ifdef GL_FRAGMENT_PRECISION_HIGH
|
||||
precision highp float;
|
||||
#else
|
||||
precision mediump float;
|
||||
#endif
|
||||
#define COMPAT_PRECISION mediump
|
||||
#else
|
||||
#define COMPAT_PRECISION
|
||||
#endif
|
||||
|
||||
uniform COMPAT_PRECISION int FrameDirection;
|
||||
uniform COMPAT_PRECISION int FrameCount;
|
||||
uniform COMPAT_PRECISION vec2 OutputSize;
|
||||
uniform COMPAT_PRECISION vec2 TextureSize;
|
||||
uniform COMPAT_PRECISION vec2 InputSize;
|
||||
uniform sampler2D Texture;
|
||||
COMPAT_VARYING vec4 TEX0;
|
||||
|
||||
// compatibility #defines
|
||||
#define Source Texture
|
||||
#define vTexCoord TEX0.xy
|
||||
|
||||
#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize
|
||||
#define outsize vec4(OutputSize, 1.0 / OutputSize)
|
||||
|
||||
#ifdef PARAMETER_UNIFORM
|
||||
uniform COMPAT_PRECISION float FSR_SHARPENING;
|
||||
#else
|
||||
#define FSR_SHARPENING 0.6
|
||||
#endif
|
||||
|
||||
#define FSR_RCAS_LIMIT (0.25-(1.0/16.0))
|
||||
//#define FSR_RCAS_DENOISE
|
||||
|
||||
// Input callback prototypes that need to be implemented by calling shader
|
||||
vec4 FsrRcasLoadF(vec2 p);
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
void FsrRcasCon(
|
||||
out float con,
|
||||
// The scale is {0.0 := maximum, to N>0, where N is the number of stops (halving) of the reduction of sharpness}.
|
||||
float sharpness
|
||||
){
|
||||
// Transform from stops to linear value.
|
||||
con = exp2(-sharpness);
|
||||
}
|
||||
|
||||
vec3 FsrRcasF(
|
||||
vec2 ip, // Integer pixel position in output.
|
||||
float con
|
||||
)
|
||||
{
|
||||
// Constant generated by RcasSetup().
|
||||
// Algorithm uses minimal 3x3 pixel neighborhood.
|
||||
// b
|
||||
// d e f
|
||||
// h
|
||||
vec2 sp = vec2(ip);
|
||||
vec3 b = FsrRcasLoadF(sp + vec2( 0,-1)).rgb;
|
||||
vec3 d = FsrRcasLoadF(sp + vec2(-1, 0)).rgb;
|
||||
vec3 e = FsrRcasLoadF(sp).rgb;
|
||||
vec3 f = FsrRcasLoadF(sp+vec2( 1, 0)).rgb;
|
||||
vec3 h = FsrRcasLoadF(sp+vec2( 0, 1)).rgb;
|
||||
// Luma times 2.
|
||||
float bL = b.g + .5 * (b.b + b.r);
|
||||
float dL = d.g + .5 * (d.b + d.r);
|
||||
float eL = e.g + .5 * (e.b + e.r);
|
||||
float fL = f.g + .5 * (f.b + f.r);
|
||||
float hL = h.g + .5 * (h.b + h.r);
|
||||
// Noise detection.
|
||||
float nz = .25 * (bL + dL + fL + hL) - eL;
|
||||
nz=clamp(
|
||||
abs(nz)
|
||||
/(
|
||||
max(max(bL,dL),max(eL,max(fL,hL)))
|
||||
-min(min(bL,dL),min(eL,min(fL,hL)))
|
||||
),
|
||||
0., 1.
|
||||
);
|
||||
nz=1.-.5*nz;
|
||||
// Min and max of ring.
|
||||
vec3 mn4 = min(b, min(f, h));
|
||||
vec3 mx4 = max(b, max(f, h));
|
||||
// Immediate constants for peak range.
|
||||
vec2 peakC = vec2(1., -4.);
|
||||
// Limiters, these need to be high precision RCPs.
|
||||
vec3 hitMin = mn4 / (4. * mx4);
|
||||
vec3 hitMax = (peakC.x - mx4) / (4.* mn4 + peakC.y);
|
||||
vec3 lobeRGB = max(-hitMin, hitMax);
|
||||
float lobe = max(
|
||||
-FSR_RCAS_LIMIT,
|
||||
min(max(lobeRGB.r, max(lobeRGB.g, lobeRGB.b)), 0.)
|
||||
)*con;
|
||||
// Apply noise removal.
|
||||
#ifdef FSR_RCAS_DENOISE
|
||||
lobe *= nz;
|
||||
#endif
|
||||
// Resolve, which needs the medium precision rcp approximation to avoid visible tonality changes.
|
||||
return (lobe * (b + d + h + f) + e) / (4. * lobe + 1.);
|
||||
}
|
||||
|
||||
|
||||
vec4 FsrRcasLoadF(vec2 p) {
|
||||
return COMPAT_TEXTURE(Source,p/OutputSize.xy);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 fragCoord = vTexCoord.xy * OutputSize.xy;
|
||||
|
||||
// Set up constants
|
||||
float con;
|
||||
FsrRcasCon(con, FSR_SHARPENING);
|
||||
|
||||
// Perform RCAS pass
|
||||
vec3 col = FsrRcasF(fragCoord, con);
|
||||
|
||||
FragColor = vec4(col,1);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,202 +0,0 @@
|
||||
/*
|
||||
Hyllian's jinc windowed-jinc 2-lobe sharper with anti-ringing Shader
|
||||
|
||||
Copyright (C) 2011-2016 Hyllian/Jararaca - sergiogdb@gmail.com
|
||||
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
#define JINC2_WINDOW_SINC 0.405
|
||||
#define JINC2_SINC 0.79
|
||||
#define JINC2_AR_STRENGTH 0.8
|
||||
|
||||
#define texCoord TEX0
|
||||
|
||||
#if defined(VERTEX)
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
#define OUT out
|
||||
#define IN in
|
||||
#define tex2D texture
|
||||
#else
|
||||
#define OUT varying
|
||||
#define IN attribute
|
||||
#define tex2D texture2D
|
||||
#endif
|
||||
|
||||
#ifdef GL_ES
|
||||
#define COMPAT_PRECISION mediump
|
||||
#else
|
||||
#define COMPAT_PRECISION
|
||||
#endif
|
||||
|
||||
|
||||
IN vec4 VertexCoord;
|
||||
IN vec4 Color;
|
||||
IN vec2 TexCoord;
|
||||
OUT vec4 color;
|
||||
OUT vec2 texCoord;
|
||||
|
||||
uniform mat4 MVPMatrix;
|
||||
uniform COMPAT_PRECISION int FrameDirection;
|
||||
uniform COMPAT_PRECISION int FrameCount;
|
||||
uniform COMPAT_PRECISION vec2 OutputSize;
|
||||
uniform COMPAT_PRECISION vec2 TextureSize;
|
||||
uniform COMPAT_PRECISION vec2 InputSize;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = MVPMatrix * VertexCoord;
|
||||
color = Color;
|
||||
texCoord = TexCoord * 1.0001;
|
||||
}
|
||||
|
||||
#elif defined(FRAGMENT)
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
#define IN in
|
||||
#define tex2D texture
|
||||
out vec4 FragColor;
|
||||
#else
|
||||
#define IN varying
|
||||
#define FragColor gl_FragColor
|
||||
#define tex2D texture2D
|
||||
#endif
|
||||
|
||||
#ifdef GL_ES
|
||||
#ifdef GL_FRAGMENT_PRECISION_HIGH
|
||||
precision highp float;
|
||||
#else
|
||||
precision mediump float;
|
||||
#endif
|
||||
#define COMPAT_PRECISION mediump
|
||||
#else
|
||||
#define COMPAT_PRECISION
|
||||
#endif
|
||||
|
||||
uniform COMPAT_PRECISION int FrameDirection;
|
||||
uniform COMPAT_PRECISION int FrameCount;
|
||||
uniform COMPAT_PRECISION vec2 OutputSize;
|
||||
uniform COMPAT_PRECISION vec2 TextureSize;
|
||||
uniform COMPAT_PRECISION vec2 InputSize;
|
||||
uniform sampler2D s_p;
|
||||
IN vec2 texCoord;
|
||||
|
||||
const float halfpi = 1.5707963267948966192313216916398;
|
||||
const float pi = 3.1415926535897932384626433832795;
|
||||
const float wa = JINC2_WINDOW_SINC*pi;
|
||||
const float wb = JINC2_SINC*pi;
|
||||
|
||||
// Calculates the distance between two points
|
||||
float d(vec2 pt1, vec2 pt2)
|
||||
{
|
||||
vec2 v = pt2 - pt1;
|
||||
return sqrt(dot(v,v));
|
||||
}
|
||||
|
||||
vec3 min4(vec3 a, vec3 b, vec3 c, vec3 d)
|
||||
{
|
||||
return min(a, min(b, min(c, d)));
|
||||
}
|
||||
|
||||
vec3 max4(vec3 a, vec3 b, vec3 c, vec3 d)
|
||||
{
|
||||
return max(a, max(b, max(c, d)));
|
||||
}
|
||||
|
||||
vec4 resampler(vec4 x)
|
||||
{
|
||||
vec4 res;
|
||||
|
||||
res = (x==vec4(0.0, 0.0, 0.0, 0.0)) ? vec4(wa*wb) : sin(x*wa)*sin(x*wb)/(x*x);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
vec3 color;
|
||||
vec4 weights[4];
|
||||
|
||||
vec2 dx = vec2(1.0, 0.0);
|
||||
vec2 dy = vec2(0.0, 1.0);
|
||||
|
||||
vec2 pc = texCoord*TextureSize;
|
||||
|
||||
vec2 tc = (floor(pc-vec2(0.5,0.5))+vec2(0.5,0.5));
|
||||
|
||||
weights[0] = resampler(vec4(d(pc, tc -dx -dy), d(pc, tc -dy), d(pc, tc +dx -dy), d(pc, tc+2.0*dx -dy)));
|
||||
weights[1] = resampler(vec4(d(pc, tc -dx ), d(pc, tc ), d(pc, tc +dx ), d(pc, tc+2.0*dx )));
|
||||
weights[2] = resampler(vec4(d(pc, tc -dx +dy), d(pc, tc +dy), d(pc, tc +dx +dy), d(pc, tc+2.0*dx +dy)));
|
||||
weights[3] = resampler(vec4(d(pc, tc -dx+2.0*dy), d(pc, tc +2.0*dy), d(pc, tc +dx+2.0*dy), d(pc, tc+2.0*dx+2.0*dy)));
|
||||
|
||||
dx = dx/TextureSize;
|
||||
dy = dy/TextureSize;
|
||||
tc = tc/TextureSize;
|
||||
|
||||
vec3 c00 = tex2D(s_p, tc -dx -dy).xyz;
|
||||
vec3 c10 = tex2D(s_p, tc -dy).xyz;
|
||||
vec3 c20 = tex2D(s_p, tc +dx -dy).xyz;
|
||||
vec3 c30 = tex2D(s_p, tc+2.0*dx -dy).xyz;
|
||||
vec3 c01 = tex2D(s_p, tc -dx ).xyz;
|
||||
vec3 c11 = tex2D(s_p, tc ).xyz;
|
||||
vec3 c21 = tex2D(s_p, tc +dx ).xyz;
|
||||
vec3 c31 = tex2D(s_p, tc+2.0*dx ).xyz;
|
||||
vec3 c02 = tex2D(s_p, tc -dx +dy).xyz;
|
||||
vec3 c12 = tex2D(s_p, tc +dy).xyz;
|
||||
vec3 c22 = tex2D(s_p, tc +dx +dy).xyz;
|
||||
vec3 c32 = tex2D(s_p, tc+2.0*dx +dy).xyz;
|
||||
vec3 c03 = tex2D(s_p, tc -dx+2.0*dy).xyz;
|
||||
vec3 c13 = tex2D(s_p, tc +2.0*dy).xyz;
|
||||
vec3 c23 = tex2D(s_p, tc +dx+2.0*dy).xyz;
|
||||
vec3 c33 = tex2D(s_p, tc+2.0*dx+2.0*dy).xyz;
|
||||
|
||||
color = tex2D(s_p, texCoord).xyz;
|
||||
|
||||
// Get min/max samples
|
||||
vec3 min_sample = min4(c11, c21, c12, c22);
|
||||
vec3 max_sample = max4(c11, c21, c12, c22);
|
||||
/*
|
||||
color = mat4x3(c00, c10, c20, c30) * weights[0];
|
||||
color+= mat4x3(c01, c11, c21, c31) * weights[1];
|
||||
color+= mat4x3(c02, c12, c22, c32) * weights[2];
|
||||
color+= mat4x3(c03, c13, c23, c33) * weights[3];
|
||||
mat4 wgts = mat4(weights[0], weights[1], weights[2], weights[3]);
|
||||
vec4 wsum = wgts * vec4(1.0,1.0,1.0,1.0);
|
||||
color = color/(dot(wsum, vec4(1.0,1.0,1.0,1.0)));
|
||||
*/
|
||||
|
||||
|
||||
color = vec3(dot(weights[0], vec4(c00.x, c10.x, c20.x, c30.x)), dot(weights[0], vec4(c00.y, c10.y, c20.y, c30.y)), dot(weights[0], vec4(c00.z, c10.z, c20.z, c30.z)));
|
||||
color+= vec3(dot(weights[1], vec4(c01.x, c11.x, c21.x, c31.x)), dot(weights[1], vec4(c01.y, c11.y, c21.y, c31.y)), dot(weights[1], vec4(c01.z, c11.z, c21.z, c31.z)));
|
||||
color+= vec3(dot(weights[2], vec4(c02.x, c12.x, c22.x, c32.x)), dot(weights[2], vec4(c02.y, c12.y, c22.y, c32.y)), dot(weights[2], vec4(c02.z, c12.z, c22.z, c32.z)));
|
||||
color+= vec3(dot(weights[3], vec4(c03.x, c13.x, c23.x, c33.x)), dot(weights[3], vec4(c03.y, c13.y, c23.y, c33.y)), dot(weights[3], vec4(c03.z, c13.z, c23.z, c33.z)));
|
||||
color = color/(dot(weights[0], vec4(1,1,1,1)) + dot(weights[1], vec4(1,1,1,1)) + dot(weights[2], vec4(1,1,1,1)) + dot(weights[3], vec4(1,1,1,1)));
|
||||
|
||||
// Anti-ringing
|
||||
vec3 aux = color;
|
||||
color = clamp(color, min_sample, max_sample);
|
||||
color = mix(aux, color, JINC2_AR_STRENGTH);
|
||||
|
||||
// final sum and weight normalization
|
||||
FragColor.xyz = color;
|
||||
}
|
||||
#endif
|
||||
@@ -1,205 +0,0 @@
|
||||
/*
|
||||
Hyllian's jinc windowed-jinc 2-lobe sharper with anti-ringing Shader
|
||||
|
||||
Copyright (C) 2011-2016 Hyllian/Jararaca - sergiogdb@gmail.com
|
||||
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
#define JINC2_WINDOW_SINC 0.5
|
||||
#define JINC2_SINC 1.0
|
||||
#define JINC2_AR_STRENGTH 0.8
|
||||
|
||||
#define texCoord TEX0
|
||||
|
||||
#if defined(VERTEX)
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
#define OUT out
|
||||
#define IN in
|
||||
#define tex2D texture
|
||||
#else
|
||||
#define OUT varying
|
||||
#define IN attribute
|
||||
#define tex2D texture2D
|
||||
#endif
|
||||
|
||||
#ifdef GL_ES
|
||||
#define COMPAT_PRECISION mediump
|
||||
#else
|
||||
#define COMPAT_PRECISION
|
||||
#endif
|
||||
|
||||
|
||||
IN vec4 VertexCoord;
|
||||
IN vec4 Color;
|
||||
IN vec2 TexCoord;
|
||||
OUT vec4 color;
|
||||
OUT vec2 texCoord;
|
||||
|
||||
uniform mat4 MVPMatrix;
|
||||
uniform COMPAT_PRECISION int FrameDirection;
|
||||
uniform COMPAT_PRECISION int FrameCount;
|
||||
uniform COMPAT_PRECISION vec2 OutputSize;
|
||||
uniform COMPAT_PRECISION vec2 TextureSize;
|
||||
uniform COMPAT_PRECISION vec2 InputSize;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = MVPMatrix * VertexCoord;
|
||||
color = Color;
|
||||
texCoord = TexCoord;
|
||||
}
|
||||
|
||||
#elif defined(FRAGMENT)
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
#define IN in
|
||||
#define tex2D texture
|
||||
out vec4 FragColor;
|
||||
#else
|
||||
#define IN varying
|
||||
#define FragColor gl_FragColor
|
||||
#define tex2D texture2D
|
||||
#endif
|
||||
|
||||
#ifdef GL_ES
|
||||
#ifdef GL_FRAGMENT_PRECISION_HIGH
|
||||
precision highp float;
|
||||
#else
|
||||
precision mediump float;
|
||||
#endif
|
||||
#define COMPAT_PRECISION mediump
|
||||
#else
|
||||
#define COMPAT_PRECISION
|
||||
#endif
|
||||
|
||||
uniform COMPAT_PRECISION int FrameDirection;
|
||||
uniform COMPAT_PRECISION int FrameCount;
|
||||
uniform COMPAT_PRECISION vec2 OutputSize;
|
||||
uniform COMPAT_PRECISION vec2 TextureSize;
|
||||
uniform COMPAT_PRECISION vec2 InputSize;
|
||||
uniform sampler2D s_p;
|
||||
IN vec2 texCoord;
|
||||
|
||||
const float halfpi = 1.5707963267948966192313216916398;
|
||||
const float pi = 3.1415926535897932384626433832795;
|
||||
const float wa = JINC2_WINDOW_SINC*pi;
|
||||
const float wb = JINC2_SINC*pi;
|
||||
|
||||
// Calculates the distance between two points
|
||||
float d(vec2 pt1, vec2 pt2)
|
||||
{
|
||||
vec2 v = pt2 - pt1;
|
||||
return sqrt(dot(v,v));
|
||||
}
|
||||
|
||||
vec3 min4(vec3 a, vec3 b, vec3 c, vec3 d)
|
||||
{
|
||||
return min(a, min(b, min(c, d)));
|
||||
}
|
||||
|
||||
vec3 max4(vec3 a, vec3 b, vec3 c, vec3 d)
|
||||
{
|
||||
return max(a, max(b, max(c, d)));
|
||||
}
|
||||
|
||||
vec4 resampler(vec4 x)
|
||||
{
|
||||
vec4 res;
|
||||
|
||||
res.x = (x.x==0.0) ? wa*wb : sin(x.x*wa)*sin(x.x*wb)/(x.x*x.x);
|
||||
res.y = (x.y==0.0) ? wa*wb : sin(x.y*wa)*sin(x.y*wb)/(x.y*x.y);
|
||||
res.z = (x.z==0.0) ? wa*wb : sin(x.z*wa)*sin(x.z*wb)/(x.z*x.z);
|
||||
res.w = (x.w==0.0) ? wa*wb : sin(x.w*wa)*sin(x.w*wb)/(x.w*x.w);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
vec3 color;
|
||||
vec4 weights[4];
|
||||
|
||||
vec2 dx = vec2(1.0, 0.0);
|
||||
vec2 dy = vec2(0.0, 1.0);
|
||||
|
||||
vec2 pc = texCoord*TextureSize;
|
||||
|
||||
vec2 tc = (floor(pc-vec2(0.5,0.5))+vec2(0.5,0.5));
|
||||
|
||||
weights[0] = resampler(vec4(d(pc, tc -dx -dy), d(pc, tc -dy), d(pc, tc +dx -dy), d(pc, tc+2.0*dx -dy)));
|
||||
weights[1] = resampler(vec4(d(pc, tc -dx ), d(pc, tc ), d(pc, tc +dx ), d(pc, tc+2.0*dx )));
|
||||
weights[2] = resampler(vec4(d(pc, tc -dx +dy), d(pc, tc +dy), d(pc, tc +dx +dy), d(pc, tc+2.0*dx +dy)));
|
||||
weights[3] = resampler(vec4(d(pc, tc -dx+2.0*dy), d(pc, tc +2.0*dy), d(pc, tc +dx+2.0*dy), d(pc, tc+2.0*dx+2.0*dy)));
|
||||
|
||||
dx = dx/TextureSize;
|
||||
dy = dy/TextureSize;
|
||||
tc = tc/TextureSize;
|
||||
|
||||
vec3 c00 = tex2D(s_p, tc -dx -dy).xyz;
|
||||
vec3 c10 = tex2D(s_p, tc -dy).xyz;
|
||||
vec3 c20 = tex2D(s_p, tc +dx -dy).xyz;
|
||||
vec3 c30 = tex2D(s_p, tc+2.0*dx -dy).xyz;
|
||||
vec3 c01 = tex2D(s_p, tc -dx ).xyz;
|
||||
vec3 c11 = tex2D(s_p, tc ).xyz;
|
||||
vec3 c21 = tex2D(s_p, tc +dx ).xyz;
|
||||
vec3 c31 = tex2D(s_p, tc+2.0*dx ).xyz;
|
||||
vec3 c02 = tex2D(s_p, tc -dx +dy).xyz;
|
||||
vec3 c12 = tex2D(s_p, tc +dy).xyz;
|
||||
vec3 c22 = tex2D(s_p, tc +dx +dy).xyz;
|
||||
vec3 c32 = tex2D(s_p, tc+2.0*dx +dy).xyz;
|
||||
vec3 c03 = tex2D(s_p, tc -dx+2.0*dy).xyz;
|
||||
vec3 c13 = tex2D(s_p, tc +2.0*dy).xyz;
|
||||
vec3 c23 = tex2D(s_p, tc +dx+2.0*dy).xyz;
|
||||
vec3 c33 = tex2D(s_p, tc+2.0*dx+2.0*dy).xyz;
|
||||
|
||||
color = tex2D(s_p, texCoord).xyz;
|
||||
|
||||
// Get min/max samples
|
||||
vec3 min_sample = min4(c11, c21, c12, c22);
|
||||
vec3 max_sample = max4(c11, c21, c12, c22);
|
||||
/*
|
||||
color = mat4x3(c00, c10, c20, c30) * weights[0];
|
||||
color+= mat4x3(c01, c11, c21, c31) * weights[1];
|
||||
color+= mat4x3(c02, c12, c22, c32) * weights[2];
|
||||
color+= mat4x3(c03, c13, c23, c33) * weights[3];
|
||||
mat4 wgts = mat4(weights[0], weights[1], weights[2], weights[3]);
|
||||
vec4 wsum = wgts * vec4(1.0,1.0,1.0,1.0);
|
||||
color = color/(dot(wsum, vec4(1.0,1.0,1.0,1.0)));
|
||||
*/
|
||||
|
||||
|
||||
color = vec3(dot(weights[0], vec4(c00.x, c10.x, c20.x, c30.x)), dot(weights[0], vec4(c00.y, c10.y, c20.y, c30.y)), dot(weights[0], vec4(c00.z, c10.z, c20.z, c30.z)));
|
||||
color+= vec3(dot(weights[1], vec4(c01.x, c11.x, c21.x, c31.x)), dot(weights[1], vec4(c01.y, c11.y, c21.y, c31.y)), dot(weights[1], vec4(c01.z, c11.z, c21.z, c31.z)));
|
||||
color+= vec3(dot(weights[2], vec4(c02.x, c12.x, c22.x, c32.x)), dot(weights[2], vec4(c02.y, c12.y, c22.y, c32.y)), dot(weights[2], vec4(c02.z, c12.z, c22.z, c32.z)));
|
||||
color+= vec3(dot(weights[3], vec4(c03.x, c13.x, c23.x, c33.x)), dot(weights[3], vec4(c03.y, c13.y, c23.y, c33.y)), dot(weights[3], vec4(c03.z, c13.z, c23.z, c33.z)));
|
||||
color = color/(dot(weights[0], vec4(1,1,1,1)) + dot(weights[1], vec4(1,1,1,1)) + dot(weights[2], vec4(1,1,1,1)) + dot(weights[3], vec4(1,1,1,1)));
|
||||
|
||||
// Anti-ringing
|
||||
vec3 aux = color;
|
||||
color = clamp(color, min_sample, max_sample);
|
||||
color = mix(aux, color, JINC2_AR_STRENGTH);
|
||||
|
||||
// final sum and weight normalization
|
||||
FragColor.xyz = color;
|
||||
}
|
||||
#endif
|
||||
@@ -1,73 +0,0 @@
|
||||
#if defined(VERTEX)
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
#define COMPAT_VARYING out
|
||||
#define COMPAT_ATTRIBUTE in
|
||||
#define COMPAT_TEXTURE texture
|
||||
#else
|
||||
#define COMPAT_VARYING varying
|
||||
#define COMPAT_ATTRIBUTE attribute
|
||||
#define COMPAT_TEXTURE texture2D
|
||||
#endif
|
||||
|
||||
#ifdef GL_ES
|
||||
#define COMPAT_PRECISION mediump
|
||||
#else
|
||||
#define COMPAT_PRECISION
|
||||
#endif
|
||||
|
||||
COMPAT_ATTRIBUTE vec4 VertexCoord;
|
||||
COMPAT_ATTRIBUTE vec4 COLOR;
|
||||
COMPAT_ATTRIBUTE vec4 TexCoord;
|
||||
COMPAT_VARYING vec4 COL0;
|
||||
COMPAT_VARYING vec4 TEX0;
|
||||
|
||||
uniform mat4 MVPMatrix;
|
||||
uniform COMPAT_PRECISION int FrameDirection;
|
||||
uniform COMPAT_PRECISION int FrameCount;
|
||||
uniform COMPAT_PRECISION vec2 OutputSize;
|
||||
uniform COMPAT_PRECISION vec2 TextureSize;
|
||||
uniform COMPAT_PRECISION vec2 InputSize;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = VertexCoord.x * MVPMatrix[0] + VertexCoord.y * MVPMatrix[1] + VertexCoord.z * MVPMatrix[2] + VertexCoord.w * MVPMatrix[3];
|
||||
TEX0.xy = TexCoord.xy;
|
||||
}
|
||||
|
||||
#elif defined(FRAGMENT)
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
#define COMPAT_VARYING in
|
||||
#define COMPAT_TEXTURE texture
|
||||
out vec4 FragColor;
|
||||
#else
|
||||
#define COMPAT_VARYING varying
|
||||
#define FragColor gl_FragColor
|
||||
#define COMPAT_TEXTURE texture2D
|
||||
#endif
|
||||
|
||||
#ifdef GL_ES
|
||||
#ifdef GL_FRAGMENT_PRECISION_HIGH
|
||||
precision highp float;
|
||||
#else
|
||||
precision mediump float;
|
||||
#endif
|
||||
#define COMPAT_PRECISION mediump
|
||||
#else
|
||||
#define COMPAT_PRECISION
|
||||
#endif
|
||||
|
||||
uniform COMPAT_PRECISION int FrameDirection;
|
||||
uniform COMPAT_PRECISION int FrameCount;
|
||||
uniform COMPAT_PRECISION vec2 OutputSize;
|
||||
uniform COMPAT_PRECISION vec2 TextureSize;
|
||||
uniform COMPAT_PRECISION vec2 InputSize;
|
||||
uniform sampler2D Texture;
|
||||
COMPAT_VARYING vec4 TEX0;
|
||||
|
||||
void main()
|
||||
{
|
||||
FragColor = COMPAT_TEXTURE(Texture, TEX0.xy);
|
||||
}
|
||||
#endif
|
||||
@@ -1 +0,0 @@
|
||||
[{"name":"NVIDIA RIVA 128","deviceID":24,"vendorID":4318},{"name":"NVIDIA RIVA TNT","deviceID":32,"vendorID":4318},{"name":"NVIDIA RIVA TNT2\/TNT2 Pro","deviceID":40,"vendorID":4318},{"name":"NVIDIA GeForce 256","deviceID":256,"vendorID":4318},{"name":"NVIDIA GeForce2 GTS\/GeForce2 Pro","deviceID":336,"vendorID":4318},{"name":"NVIDIA GeForce2 MX\/MX 400","deviceID":272,"vendorID":4318},{"name":"NVIDIA GeForce3","deviceID":512,"vendorID":4318},{"name":"NVIDIA GeForce4 MX 460","deviceID":368,"vendorID":4318},{"name":"NVIDIA GeForce4 Ti 4200","deviceID":595,"vendorID":4318},{"name":"NVIDIA GeForce FX 5200","deviceID":800,"vendorID":4318},{"name":"NVIDIA GeForce FX 5600","deviceID":786,"vendorID":4318},{"name":"NVIDIA GeForce FX 5800","deviceID":770,"vendorID":4318},{"name":"NVIDIA GeForce 6200","deviceID":335,"vendorID":4318},{"name":"NVIDIA GeForce 6600 GT","deviceID":320,"vendorID":4318},{"name":"NVIDIA GeForce 6800","deviceID":65,"vendorID":4318},{"name":"NVIDIA GeForce Go 7300","deviceID":2026952880896,"vendorID":4318},{"name":"NVIDIA GeForce Go 7400","deviceID":472,"vendorID":4318},{"name":"NVIDIA GeForce 7600 GT","deviceID":913,"vendorID":4318},{"name":"NVIDIA GeForce 7800 GT","deviceID":146,"vendorID":4318},{"name":"NVIDIA GeForce 8200","deviceID":9113598691403,"vendorID":4318},{"name":"NVIDIA GeForce 8300 GS","deviceID":1059,"vendorID":4318},{"name":"NVIDIA GeForce 8400 GS","deviceID":1028,"vendorID":4318},{"name":"NVIDIA GeForce 8500 GT","deviceID":1057,"vendorID":4318},{"name":"NVIDIA GeForce 8600 GT","deviceID":1026,"vendorID":4318},{"name":"NVIDIA GeForce 8600M GT","deviceID":1031,"vendorID":4318},{"name":"NVIDIA GeForce 8800 GTS","deviceID":403,"vendorID":4318},{"name":"NVIDIA GeForce 8800 GTX","deviceID":401,"vendorID":4318},{"name":"NVIDIA GeForce 9200","deviceID":2157,"vendorID":4318},{"name":"NVIDIA GeForce 9300","deviceID":2156,"vendorID":4318},{"name":"NVIDIA GeForce 9400M","deviceID":2147,"vendorID":4318},{"name":"NVIDIA GeForce 9400 GT","deviceID":1068,"vendorID":4318},{"name":"NVIDIA GeForce 9500 GT","deviceID":1600,"vendorID":4318},{"name":"NVIDIA GeForce 9600 GT","deviceID":1570,"vendorID":4318},{"name":"NVIDIA GeForce 9700M GT","deviceID":1610,"vendorID":4318},{"name":"NVIDIA GeForce 9800 GT","deviceID":1556,"vendorID":4318},{"name":"NVIDIA GeForce 210","deviceID":2595,"vendorID":4318},{"name":"NVIDIA GeForce GT 220","deviceID":2592,"vendorID":4318},{"name":"NVIDIA GeForce GT 240","deviceID":3235,"vendorID":4318},{"name":"NVIDIA GeForce GTS 250","deviceID":1557,"vendorID":4318},{"name":"NVIDIA GeForce GTX 260","deviceID":1506,"vendorID":4318},{"name":"NVIDIA GeForce GTX 275","deviceID":1510,"vendorID":4318},{"name":"NVIDIA GeForce GTX 280","deviceID":1505,"vendorID":4318},{"name":"NVIDIA GeForce 315M","deviceID":2682,"vendorID":4318},{"name":"NVIDIA GeForce 320M","deviceID":2211,"vendorID":4318},{"name":"NVIDIA GeForce GT 320M","deviceID":2605,"vendorID":4318},{"name":"NVIDIA GeForce GT 325M","deviceID":2613,"vendorID":4318},{"name":"NVIDIA GeForce GT 330","deviceID":3232,"vendorID":4318},{"name":"NVIDIA GeForce GTS 350M","deviceID":3248,"vendorID":4318},{"name":"NVIDIA GeForce 410M","deviceID":4181,"vendorID":4318},{"name":"NVIDIA GeForce GT 420","deviceID":3554,"vendorID":4318},{"name":"NVIDIA GeForce GT 425M","deviceID":3568,"vendorID":4318},{"name":"NVIDIA GeForce GT 430","deviceID":3553,"vendorID":4318},{"name":"NVIDIA GeForce GT 440","deviceID":3552,"vendorID":4318},{"name":"NVIDIA GeForce GTS 450","deviceID":3524,"vendorID":4318},{"name":"NVIDIA GeForce GTX 460","deviceID":3618,"vendorID":4318},{"name":"NVIDIA GeForce GTX 460M","deviceID":3537,"vendorID":4318},{"name":"NVIDIA GeForce GTX 465","deviceID":1732,"vendorID":4318},{"name":"NVIDIA GeForce GTX 470","deviceID":1741,"vendorID":4318},{"name":"NVIDIA GeForce GTX 480","deviceID":1728,"vendorID":4318},{"name":"NVIDIA GeForce GT 520","deviceID":4160,"vendorID":4318},{"name":"NVIDIA GeForce GT 525M","deviceID":3564,"vendorID":4318},{"name":"NVIDIA GeForce GT 540M","deviceID":3572,"vendorID":4318},{"name":"NVIDIA GeForce GTX 550 Ti","deviceID":4676,"vendorID":4318},{"name":"NVIDIA GeForce GT 555M","deviceID":1208,"vendorID":4318},{"name":"NVIDIA GeForce GTX 560 Ti","deviceID":4608,"vendorID":4318},{"name":"NVIDIA GeForce GTX 560M","deviceID":4689,"vendorID":4318},{"name":"NVIDIA GeForce GTX 560","deviceID":4609,"vendorID":4318},{"name":"NVIDIA GeForce GTX 570","deviceID":4225,"vendorID":4318},{"name":"NVIDIA GeForce GTX 580","deviceID":4224,"vendorID":4318},{"name":"NVIDIA GeForce GT 610","deviceID":4170,"vendorID":4318},{"name":"NVIDIA GeForce GT 630","deviceID":3840,"vendorID":4318},{"name":"NVIDIA GeForce GT 630M","deviceID":3561,"vendorID":4318},{"name":"NVIDIA GeForce GT 640","deviceID":4033,"vendorID":4318},{"name":"NVIDIA GeForce GT 640M","deviceID":4050,"vendorID":4318},{"name":"NVIDIA GeForce GT 650M","deviceID":4049,"vendorID":4318},{"name":"NVIDIA GeForce GTX 650","deviceID":4038,"vendorID":4318},{"name":"NVIDIA GeFoLine truncated
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:00a283c7d3e9ed2399b8d73175f92a3932b65e86925f7a5bd0fe0d4736e81e8a
|
||||
size 165829076
|
||||
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 367 B |
|
Before Width: | Height: | Size: 558 B |
|
Before Width: | Height: | Size: 755 B |
|
Before Width: | Height: | Size: 879 B |
|
Before Width: | Height: | Size: 874 B |
|
Before Width: | Height: | Size: 785 B |
|
Before Width: | Height: | Size: 295 B |
|
Before Width: | Height: | Size: 354 B |
|
Before Width: | Height: | Size: 465 B |
|
Before Width: | Height: | Size: 418 B |
|
Before Width: | Height: | Size: 396 B |
|
Before Width: | Height: | Size: 411 B |
|
Before Width: | Height: | Size: 1004 B |
|
Before Width: | Height: | Size: 961 B |
|
Before Width: | Height: | Size: 639 B |
|
Before Width: | Height: | Size: 761 B |
@@ -1 +0,0 @@
|
||||
{"id":1,"name":"RTS","cursorSpeed":1,"elements":[{"type":"BUTTON","shape":"SQUARE","bindings":["KEY_DEL","NONE","NONE","NONE"],"scale":1,"x":0.12745098769664764,"y":0.35555556416511536,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"SQUARE","bindings":["KEY_DOWN","NONE","NONE","NONE"],"scale":1,"x":0.12745098769664764,"y":0.7555555701255798,"toggleSwitch":false,"text":"","iconId":5},{"type":"BUTTON","shape":"SQUARE","bindings":["KEY_RIGHT","NONE","NONE","NONE"],"scale":1,"x":0.12745098769664764,"y":0.6222222447395325,"toggleSwitch":false,"text":"","iconId":4},{"type":"BUTTON","shape":"SQUARE","bindings":["KEY_LEFT","NONE","NONE","NONE"],"scale":1,"x":0.06862745434045792,"y":0.6222222447395325,"toggleSwitch":false,"text":"","iconId":2},{"type":"BUTTON","shape":"SQUARE","bindings":["KEY_UP","NONE","NONE","NONE"],"scale":1,"x":0.12745098769664764,"y":0.4888888895511627,"toggleSwitch":false,"text":"","iconId":3},{"type":"BUTTON","shape":"SQUARE","bindings":["KEY_ESC","NONE","NONE","NONE"],"scale":1,"x":0.06862745434045792,"y":0.35555556416511536,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"SQUARE","bindings":["MOUSE_RIGHT_BUTTON","NONE","NONE","NONE"],"scale":1,"x":0.8721405267715454,"y":0.7555555701255798,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"SQUARE","bindings":["KEY_TAB","NONE","NONE","NONE"],"scale":1,"x":0.06862745434045792,"y":0.4888888895511627,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"SQUARE","bindings":["KEY_SHIFT_L","NONE","NONE","NONE"],"scale":1,"x":0.06862745434045792,"y":0.7555555701255798,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"SQUARE","bindings":["KEY_CTRL_L","NONE","NONE","NONE"],"scale":1,"x":0.06862745434045792,"y":0.8888888955116272,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"SQUARE","bindings":["KEY_ALT_L","NONE","NONE","NONE"],"scale":1,"x":0.12745098769664764,"y":0.8888888955116272,"toggleSwitch":false,"text":"","iconId":0},{"type":"RANGE_BUTTON","shape":"CIRCLE","bindings":["NONE","NONE","NONE","NONE","NONE","NONE"],"scale":1,"x":0.1568627506494522,"y":0.08888889104127884,"toggleSwitch":false,"text":"","iconId":0,"range":"FROM_0_TO_9"},{"type":"BUTTON","shape":"SQUARE","bindings":["KEY_SPACE","NONE","NONE","NONE"],"scale":1,"x":0.8721405267715454,"y":0.8888888955116272,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"SQUARE","bindings":["KEY_BKSP","NONE","NONE","NONE"],"scale":1,"x":0.9309640526771545,"y":0.7555555701255798,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"SQUARE","bindings":["KEY_ENTER","NONE","NONE","NONE"],"scale":1,"x":0.9309640526771545,"y":0.8888888955116272,"toggleSwitch":false,"text":"","iconId":0},{"type":"RANGE_BUTTON","shape":"CIRCLE","bindings":["NONE","NONE","NONE","NONE","NONE","NONE"],"scale":1,"x":0.843137264251709,"y":0.08888889104127884,"toggleSwitch":false,"text":"","iconId":0}]}
|
||||
@@ -1 +0,0 @@
|
||||
{"id":2,"name":"Template (12 buttons)","cursorSpeed":1,"elements":[{"type":"D_PAD","shape":"CIRCLE","bindings":["KEY_W","KEY_D","KEY_S","KEY_A"],"scale":1,"x":0.10784313827753067,"y":0.7333333492279053,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["NONE","NONE","NONE","NONE"],"scale":1,"x":0.8133170008659363,"y":0.7333333492279053,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["NONE","NONE","NONE","NONE"],"scale":1,"x":0.8721405267715454,"y":0.6000000238418579,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["NONE","NONE","NONE","NONE"],"scale":1,"x":0.8721405267715454,"y":0.8666666746139526,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["NONE","NONE","NONE","NONE"],"scale":1,"x":0.9309640526771545,"y":0.7333333492279053,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"RECT","bindings":["NONE","NONE","NONE","NONE"],"scale":1,"x":0.8235294222831726,"y":0.08888889104127884,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"RECT","bindings":["NONE","NONE","NONE","NONE"],"scale":1,"x":0.9215686321258545,"y":0.08888889104127884,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["NONE","NONE","NONE","NONE"],"scale":0.85,"x":0.06862745434045792,"y":0.4444444477558136,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"RECT","bindings":["NONE","NONE","NONE","NONE"],"scale":1,"x":0.0784313753247261,"y":0.08888889104127884,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"RECT","bindings":["NONE","NONE","NONE","NONE"],"scale":1,"x":0.1764705926179886,"y":0.08888889104127884,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["NONE","NONE","NONE","NONE"],"scale":0.85,"x":0.9309640526771545,"y":0.4444444477558136,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"ROUND_RECT","bindings":["NONE","NONE","NONE","NONE"],"scale":0.85,"x":0.538807213306427,"y":0.9111111164093018,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"ROUND_RECT","bindings":["NONE","NONE","NONE","NONE"],"scale":0.85,"x":0.46078431606292725,"y":0.9111111164093018,"toggleSwitch":false,"text":"","iconId":0}]}
|
||||
@@ -1 +0,0 @@
|
||||
{"id":3,"name":"Virtual Gamepad","cursorSpeed":1,"elements":[{"type":"D_PAD","shape":"CIRCLE","bindings":["GAMEPAD_DPAD_UP","GAMEPAD_DPAD_RIGHT","GAMEPAD_DPAD_DOWN","GAMEPAD_DPAD_LEFT"],"scale":0.85,"x":0.21568627655506134,"y":0.35555556416511536,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["GAMEPAD_BUTTON_X","NONE","NONE","NONE"],"scale":1,"x":0.8133170008659363,"y":0.7333333492279053,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["GAMEPAD_BUTTON_Y","NONE","NONE","NONE"],"scale":1,"x":0.8721405267715454,"y":0.6000000238418579,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["GAMEPAD_BUTTON_A","NONE","NONE","NONE"],"scale":1,"x":0.8721405267715454,"y":0.8666666746139526,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["GAMEPAD_BUTTON_B","NONE","NONE","NONE"],"scale":1,"x":0.9309640526771545,"y":0.7333333492279053,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"RECT","bindings":["GAMEPAD_BUTTON_R2","NONE","NONE","NONE"],"scale":1,"x":0.9215686321258545,"y":0.2888889014720917,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"RECT","bindings":["GAMEPAD_BUTTON_R1","NONE","NONE","NONE"],"scale":1,"x":0.9215686321258545,"y":0.42222222685813904,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"RECT","bindings":["GAMEPAD_BUTTON_L1","NONE","NONE","NONE"],"scale":1,"x":0.0784313753247261,"y":0.42222222685813904,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"RECT","bindings":["GAMEPAD_BUTTON_L2","NONE","NONE","NONE"],"scale":1,"x":0.0784313753247261,"y":0.2888889014720917,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"ROUND_RECT","bindings":["GAMEPAD_BUTTON_START","NONE","NONE","NONE"],"scale":0.85,"x":0.538807213306427,"y":0.9111111164093018,"toggleSwitch":false,"text":"","iconId":15},{"type":"BUTTON","shape":"ROUND_RECT","bindings":["GAMEPAD_BUTTON_SELECT","NONE","NONE","NONE"],"scale":0.85,"x":0.46078431606292725,"y":0.9111111164093018,"toggleSwitch":false,"text":"","iconId":16},{"type":"STICK","shape":"CIRCLE","bindings":["GAMEPAD_LEFT_THUMB_UP","GAMEPAD_LEFT_THUMB_RIGHT","GAMEPAD_LEFT_THUMB_DOWN","GAMEPAD_LEFT_THUMB_LEFT"],"scale":1,"x":0.10784313827753067,"y":0.7333333492279053,"toggleSwitch":false,"text":"","iconId":0},{"type":"TRACKPAD","shape":"CIRCLE","bindings":["GAMEPAD_RIGHT_THUMB_UP","GAMEPAD_RIGHT_THUMB_RIGHT","GAMEPAD_RIGHT_THUMB_DOWN","GAMEPAD_RIGHT_THUMB_LEFT"],"scale":1,"x":0.7843137383460999,"y":0.35555556416511536,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["GAMEPAD_BUTTON_L3","NONE","NONE","NONE"],"scale":0.85,"x":0.21568627655506134,"y":0.9111111164093018,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["GAMEPAD_BUTTON_R3","NONE","NONE","NONE"],"scale":0.85,"x":0.7843137383460999,"y":0.9111111164093018,"toggleSwitch":false,"text":"","iconId":0}]}
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"direct3d" : ["d3dcompiler_33", "d3dcompiler_34", "d3dcompiler_35", "d3dcompiler_36", "d3dcompiler_37", "d3dcompiler_38", "d3dcompiler_39", "d3dcompiler_40", "d3dcompiler_41", "d3dcompiler_42", "d3dcompiler_43", "d3dcompiler_46", "d3dcompiler_47", "d3dcsx_42", "d3dcsx_43", "d3dx10", "d3dx10_33", "d3dx10_34", "d3dx10_35", "d3dx10_36", "d3dx10_37", "d3dx10_38", "d3dx10_39", "d3dx10_40", "d3dx10_41", "d3dx10_42", "d3dx10_43", "d3dx11_42", "d3dx11_43", "d3dx9_24", "d3dx9_25", "d3dx9_26", "d3dx9_27", "d3dx9_28", "d3dx9_29", "d3dx9_30", "d3dx9_31", "d3dx9_32", "d3dx9_33", "d3dx9_34", "d3dx9_35", "d3dx9_36", "d3dx9_37", "d3dx9_38", "d3dx9_39", "d3dx9_40", "d3dx9_41", "d3dx9_42", "d3dx9_43"],
|
||||
"directsound" : ["dsound"],
|
||||
"directmusic" : ["dmband", "dmcompos", "dmime", "dmloader", "dmscript", "dmstyle", "dmsynth", "dmusic", "dmusic32", "dswave"],
|
||||
"directshow" : ["amstream", "qasf", "qcap", "qdvd", "qedit", "quartz"],
|
||||
"directplay" : ["dplaysvr.exe", "dplayx", "dpmodemx", "dpnet", "dpnhpast", "dpnhupnp", "dpnsvr.exe", "dpwsockx"],
|
||||
"vcrun2010" : ["msvcp100", "msvcr100", "vcomp100", "atl100"],
|
||||
"wmdecoder" : ["wmvcore", "wmasf", "wmadmod", "wmvdecod"]
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
["acledit","aclui","actctx","activeds","actxprxy","adpcm","adsldp","advapi","advpack","alsa","amsi","animate","appbar","apphelp","appwizcpl","appx","asmshader","aspi","atl","atlthunk","atmlib","atom","authz","avicap","avifile","avrt","bcrypt","bidi","bitblt","bitmap","bluetooth","bluetoothapis","browseui","button","bytecodewriter","cabinet","capi","capture","cards","cdosys","class","clipboard","clipping","clusapi","combase","combo","comboex","comm","commctrl","commdlg","compstui","comsvcs","concrt","connect","console","context","coreaudio","cred","credentials","credui","crypt","cryptasn","cryptdlg","cryptext","cryptnet","crypto","cryptui","ctapi32","cursor","d2d","d3d","d3d10","d3d10core","d3d11","d3d12","d3d8","d3d9","d3d_decl","d3d_shader","d3dcompiler","d3drm","d3dx","d3dxof","d3dxof_parsing","data","datetime","davclnt","dbgeng","dbghelp","dbghelp_coff","dbghelp_dwarf","dbghelp_macho","dbghelp_msc","dbghelp_stabs","dc","dciman","dcomp","ddeml","ddraw","ddrawex","debug_buffer","debugstr","devenum","dhcpcsvc","dhtmled","dialog","diasymreader","difxapi","dinput","display","dll","dmband","dmcompos","dmfile","dmime","dmloader","dmobj","dmscript","dmstyle","dmsynth","dmusic","dmusic32","dnsapi","dosmem","dpa","dplay","dpnet","dpnhpast","dpnhupnp","dpvoice","dragdrop","driver","dsa","dsdmo","dsound","dsound3d","dsquery","dssenh","dsuiext","dswave","dwmapi","dwrite","dx8vb","dxcore","dxdiag","dxgi","dxtrans","dxva2","edit","enhmetafile","enumeration","environ","err","event","eventlog","evr","exception","exec","explorerframe","faultrep","file","fixme","fixup","fltlib","fltmgr","font","fontcache","fontsub","fusion","fwpuclnt","g711","gamebar","gameux","gamingtcui","gdi","gdiplus","geolocator","gl_compat","global","globalmem","glu","graphics","gsm","handle","header","heap","hid","hlink","hnetcfg","hook","hostname","hotkey","htmlhelp","http","hvsi","iccvid","icm","icon","ieframe","image","imagehlp","imagelist","imm","inetcomm","inetcpl","inetmib1","infosoft","inkobj","input","inseng","int","int21","int31","ipaddress","iphlpapi","ir50_32","itss","joycpl","jscript","jsproxy","kerberos","kernelbase","keyboard","ksecdd","lanman","listbox","listview","loaddll","loadperf","local","locale","localspl","localui","macdrv","manipulation","mapi","mci","mciavi","mcicda","mcimidi","mciqtz","mciwave","mdi","media","mediacontrol","menu","message","metafile","mfplat","mgmtapi","midi","mlang","mmaux","mmc","mmdevapi","mmio","mmsys","mmtime","model","module","monthcal","mountmgr","mp3dmod","mpeg3","mpr","mprapi","msacm","msado15","msasn1","msauddecmft","mscms","msctf","msctfmonitor","msdasql","msdmo","msdrm","msftedit","msg","mshtml","msi","msidb","msident","msimg32","msimtf","msisip","msisys","msmpeg2vdec","msnet","msopc","mspatcha","msrle32","msscript","mssign","mstask","msttsengine","msvcirt","msvcm","msvcp","msvcrt","msvidc32","msvideo","mswsock","msxml","nativefont","ncrypt","nddeapi","ndis","netapi32","netbios","netcfgx","netio","netprofm","ninput","nls","nonclient","nsi","nstc","ntdll","ntdsapi","ntlm","ntoskrnl","ntprint","objsel","odbc","ole","oleacc","oledb","oledlg","olemalloc","olepicture","opencl","opengl","oss","packager","pager","palette","path","pdh","perception","pidgen","pidl","plugplay","powermgnt","powrprof","print","printui","prntvpt","process","profile","progress","propsheet","propsys","psdrv","pstores","pulse","qmgr","quartz","query","qwave","ras","rasdlg","rawinput","rebar","recyclebin","reg","region","relay","resource","richedit","richedit_lists","rpc","rstrtmgr","rtutils","sapi","schannel","schedsvc","scrobj","scroll","scrrun","scsiport","secur32","security","seh","selector","sensapi","service","setupapi","sfc","shcore","shdocvw","shell","shlctrl","slc","smbios","snmpapi","snoop","sound","speech","spoolss","sspicli","static","statusbar","sti","storage","stress","string","sxs","sync","syslevel","syslink","system","systray","t2embed","tab","tape","tapi","task","taskdialog","taskschd","tbs","tdh","tdi","text","theme_scroll","thread","threadpool","thunk","toolbar","toolhelp","tooltips","trackbar","traffic","treeview","twain","twinapi","ui","uianimation","uiautomation","uiribbon","unloaddll","unwind","updown","updspapi","url","urlmon","usb","usbd","user","uxtheme","variant","vbscript","vcomp","vcruntime","vdmdbg","ver","virtdisk","volume","vulkan","vxd","warn","wavemap","waylanddrv","wbemdisp","wbemprox","webservices","wer","wevtapi","wgl","wia","wimgapi","win","wincodecs","winemapi","wineusb","wing","winhttp","wininet","winmm","winprint","winscard","winsock","winspool","winsta","winstation","winstring","wintab","wintab32","wintrust","wintypes","winusb","wlanapi","wldap32","wldp","wmadec","wmi","wmiutils","wmp","wmvcore","wnet","wofutil","wow","wpc","wpcap","wsdapi","wshom","wsnmp32","wtsapi","wuapi","x11drv","xaudio2","xdnd","xim","xinput","xmllite","xolehlp","xrandr","xrender","xvidmode"]
|
||||
@@ -1,76 +0,0 @@
|
||||
[
|
||||
{
|
||||
"name" : "Programs",
|
||||
"children" : [
|
||||
{
|
||||
"name" : "7-Zip",
|
||||
"path" : "Z:/opt/apps/7-Zip/7zFM.exe"
|
||||
},
|
||||
{
|
||||
"name" : "Internet Explorer",
|
||||
"path" : "C:/windows/system32/iexplore.exe"
|
||||
},
|
||||
{
|
||||
"name" : "Notepad",
|
||||
"path" : "C:/windows/notepad.exe"
|
||||
},
|
||||
{
|
||||
"name" : "Wordpad",
|
||||
"path" : "C:/windows/system32/write.exe",
|
||||
"iconLocation" : "Z:/opt/wine/lib/wine/i386-windows/wordpad.exe"
|
||||
},
|
||||
{
|
||||
"name" : "Games",
|
||||
"children" : [
|
||||
{
|
||||
"name" : "WineMine",
|
||||
"path" : "C:/windows/system32/winemine.exe"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "System Tools",
|
||||
"children" : [
|
||||
{
|
||||
"name" : "Test Direct3D",
|
||||
"path" : "Z:/opt/apps/TestD3D.exe"
|
||||
},
|
||||
{
|
||||
"name" : "Computer",
|
||||
"path" : "C:/windows/wfm.exe"
|
||||
},
|
||||
{
|
||||
"name" : "Task Manager",
|
||||
"path" : "C:/windows/system32/taskmgr.exe"
|
||||
},
|
||||
{
|
||||
"name" : "Registry Editor",
|
||||
"path" : "C:/windows/regedit.exe"
|
||||
},
|
||||
{
|
||||
"name" : "Command Prompt",
|
||||
"path" : "C:/windows/system32/cmd.exe"
|
||||
},
|
||||
{
|
||||
"name" : "Wine Mono Installer",
|
||||
"path" : "C:/windows/system32/control.exe",
|
||||
"cmdArgs" : "appwiz.cpl install_mono",
|
||||
"iconLocation" : "shell32.dll",
|
||||
"iconIndex" : -25
|
||||
},
|
||||
{
|
||||
"name" : "Wine Gecko Installer",
|
||||
"path" : "C:/windows/system32/control.exe",
|
||||
"cmdArgs" : "appwiz.cpl install_gecko",
|
||||
"iconLocation" : "shell32.dll",
|
||||
"iconIndex" : -25
|
||||
},
|
||||
{
|
||||
"name" : "Wine Configuration",
|
||||
"path" : "C:/windows/system32/winecfg.exe"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -1,33 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.22.1)
|
||||
|
||||
Project(Winlator)
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -Wno-unused-function -Wimplicit-function-declaration")
|
||||
|
||||
add_subdirectory(proot)
|
||||
add_subdirectory(virglrenderer)
|
||||
add_subdirectory(OpenXR-SDK)
|
||||
add_subdirectory(midihandler)
|
||||
|
||||
add_library(winlator SHARED
|
||||
xr/engine.c
|
||||
xr/framebuffer.c
|
||||
xr/input.c
|
||||
xr/main.c
|
||||
xr/math.c
|
||||
xr/renderer.c
|
||||
winlator/drawable.c
|
||||
winlator/gpu_image.c
|
||||
winlator/sysvshared_memory.c
|
||||
winlator/xconnector_epoll.c
|
||||
winlator/alsa_client.c)
|
||||
|
||||
target_link_libraries(winlator
|
||||
log
|
||||
android
|
||||
jnigraphics
|
||||
openxr_loader
|
||||
aaudio
|
||||
EGL
|
||||
GLESv2
|
||||
GLESv3)
|
||||
@@ -1,91 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.22.1)
|
||||
|
||||
project(MIDIHandler)
|
||||
|
||||
set(JNILIBS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../jniLibs/arm64-v8a)
|
||||
|
||||
add_library(libc++_shared SHARED IMPORTED)
|
||||
set_target_properties(libc++_shared PROPERTIES IMPORTED_LOCATION ${JNILIBS_DIR}/libc++_shared.so)
|
||||
|
||||
add_library(libFLAC SHARED IMPORTED)
|
||||
set_target_properties(libFLAC PROPERTIES IMPORTED_LOCATION ${JNILIBS_DIR}/libFLAC.so)
|
||||
|
||||
add_library(libfluidsynth SHARED IMPORTED)
|
||||
set_target_properties(libfluidsynth PROPERTIES IMPORTED_LOCATION ${JNILIBS_DIR}/libfluidsynth.so)
|
||||
|
||||
add_library(libfluidsynth-assetloader SHARED IMPORTED)
|
||||
set_target_properties(libfluidsynth-assetloader PROPERTIES IMPORTED_LOCATION ${JNILIBS_DIR}/libfluidsynth-assetloader.so)
|
||||
|
||||
add_library(libgio-2.0 SHARED IMPORTED)
|
||||
set_target_properties(libgio-2.0 PROPERTIES IMPORTED_LOCATION ${JNILIBS_DIR}/libgio-2.0.so)
|
||||
|
||||
add_library(libglib-2.0 SHARED IMPORTED)
|
||||
set_target_properties(libglib-2.0 PROPERTIES IMPORTED_LOCATION ${JNILIBS_DIR}/libglib-2.0.so)
|
||||
|
||||
add_library(libgmodule-2.0 SHARED IMPORTED)
|
||||
set_target_properties(libgmodule-2.0 PROPERTIES IMPORTED_LOCATION ${JNILIBS_DIR}/libgmodule-2.0.so)
|
||||
|
||||
add_library(libgobject-2.0 SHARED IMPORTED)
|
||||
set_target_properties(libgobject-2.0 PROPERTIES IMPORTED_LOCATION ${JNILIBS_DIR}/libgobject-2.0.so)
|
||||
|
||||
add_library(libgthread-2.0 SHARED IMPORTED)
|
||||
set_target_properties(libgthread-2.0 PROPERTIES IMPORTED_LOCATION ${JNILIBS_DIR}/libgthread-2.0.so)
|
||||
|
||||
add_library(libinstpatch-1.0 SHARED IMPORTED)
|
||||
set_target_properties(libinstpatch-1.0 PROPERTIES IMPORTED_LOCATION ${JNILIBS_DIR}/libinstpatch-1.0.so)
|
||||
|
||||
add_library(liboboe SHARED IMPORTED)
|
||||
set_target_properties(liboboe PROPERTIES IMPORTED_LOCATION ${JNILIBS_DIR}/liboboe.so)
|
||||
|
||||
add_library(libogg SHARED IMPORTED)
|
||||
set_target_properties(libogg PROPERTIES IMPORTED_LOCATION ${JNILIBS_DIR}/libogg.so)
|
||||
|
||||
add_library(libopus SHARED IMPORTED)
|
||||
set_target_properties(libopus PROPERTIES IMPORTED_LOCATION ${JNILIBS_DIR}/libopus.so)
|
||||
|
||||
add_library(libpcre SHARED IMPORTED)
|
||||
set_target_properties(libpcre PROPERTIES IMPORTED_LOCATION ${JNILIBS_DIR}/libpcre.so)
|
||||
|
||||
add_library(libpcreposix SHARED IMPORTED)
|
||||
set_target_properties(libpcreposix PROPERTIES IMPORTED_LOCATION ${JNILIBS_DIR}/libpcreposix.so)
|
||||
|
||||
add_library(libsndfile SHARED IMPORTED)
|
||||
set_target_properties(libsndfile PROPERTIES IMPORTED_LOCATION ${JNILIBS_DIR}/libsndfile.so)
|
||||
|
||||
add_library(libvorbis SHARED IMPORTED)
|
||||
set_target_properties(libvorbis PROPERTIES IMPORTED_LOCATION ${JNILIBS_DIR}/libvorbis.so)
|
||||
|
||||
add_library(libvorbisenc SHARED IMPORTED)
|
||||
set_target_properties(libvorbisenc PROPERTIES IMPORTED_LOCATION ${JNILIBS_DIR}/libvorbisenc.so)
|
||||
|
||||
add_library(libvorbisfile SHARED IMPORTED)
|
||||
set_target_properties(libvorbisfile PROPERTIES IMPORTED_LOCATION ${JNILIBS_DIR}/libvorbisfile.so)
|
||||
|
||||
find_package(OpenMP REQUIRED)
|
||||
|
||||
add_library(midihandler SHARED
|
||||
midihandler.c)
|
||||
|
||||
target_include_directories(midihandler PRIVATE fluidsynth/include)
|
||||
|
||||
target_link_libraries(midihandler
|
||||
libFLAC
|
||||
libfluidsynth-assetloader
|
||||
libgio-2.0
|
||||
libglib-2.0
|
||||
libgmodule-2.0
|
||||
libgobject-2.0
|
||||
libgthread-2.0
|
||||
libinstpatch-1.0
|
||||
liboboe
|
||||
libogg
|
||||
libopus
|
||||
libpcre
|
||||
libpcreposix
|
||||
libsndfile
|
||||
libvorbis
|
||||
libvorbisenc
|
||||
libvorbisfile
|
||||
libfluidsynth
|
||||
OpenMP::OpenMP_CXX
|
||||
log)
|
||||
@@ -1,504 +0,0 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
(This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.)
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
{description}
|
||||
Copyright (C) {year} {fullname}
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random
|
||||
Hacker.
|
||||
|
||||
{signature of Ty Coon}, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
@@ -1,121 +0,0 @@
|
||||
/* FluidSynth - A Software Synthesizer
|
||||
*
|
||||
* Copyright (C) 2003 Peter Hanappe and others.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef _FLUIDSYNTH_H
|
||||
#define _FLUIDSYNTH_H
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define BUILD_SHARED_LIBS 1
|
||||
|
||||
#if (BUILD_SHARED_LIBS == 0)
|
||||
#define FLUIDSYNTH_API // building static lib? no visibility control then
|
||||
#elif defined(WIN32)
|
||||
#if defined(FLUIDSYNTH_NOT_A_DLL)
|
||||
#define FLUIDSYNTH_API
|
||||
#elif defined(FLUIDSYNTH_DLL_EXPORTS)
|
||||
#define FLUIDSYNTH_API __declspec(dllexport)
|
||||
#else
|
||||
#define FLUIDSYNTH_API __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#elif defined(MACOS9)
|
||||
#define FLUIDSYNTH_API __declspec(export)
|
||||
|
||||
#elif defined(__OS2__)
|
||||
#define FLUIDSYNTH_API __declspec(dllexport)
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
#define FLUIDSYNTH_API __attribute__ ((visibility ("default")))
|
||||
|
||||
#else
|
||||
#define FLUIDSYNTH_API
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
# define FLUID_DEPRECATED __attribute__((deprecated))
|
||||
#elif defined(_MSC_VER) && _MSC_VER > 1200
|
||||
# define FLUID_DEPRECATED __declspec(deprecated)
|
||||
#else
|
||||
# define FLUID_DEPRECATED
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* @file fluidsynth.h
|
||||
* @brief FluidSynth is a real-time synthesizer designed for SoundFont(R) files.
|
||||
*
|
||||
* This is the header of the fluidsynth library and contains the
|
||||
* synthesizer's public API.
|
||||
*
|
||||
* Depending on how you want to use or extend the synthesizer you
|
||||
* will need different API functions. You probably do not need all
|
||||
* of them. Here is what you might want to do:
|
||||
*
|
||||
* - Embedded synthesizer: create a new synthesizer and send MIDI
|
||||
* events to it. The sound goes directly to the audio output of
|
||||
* your system.
|
||||
*
|
||||
* - Plugin synthesizer: create a synthesizer and send MIDI events
|
||||
* but pull the audio back into your application.
|
||||
*
|
||||
* - SoundFont plugin: create a new type of "SoundFont" and allow
|
||||
* the synthesizer to load your type of SoundFonts.
|
||||
*
|
||||
* - MIDI input: Create a MIDI handler to read the MIDI input on your
|
||||
* machine and send the MIDI events directly to the synthesizer.
|
||||
*
|
||||
* - MIDI files: Open MIDI files and send the MIDI events to the
|
||||
* synthesizer.
|
||||
*
|
||||
* - Command lines: You can send textual commands to the synthesizer.
|
||||
*
|
||||
* SoundFont(R) is a registered trademark of E-mu Systems, Inc.
|
||||
*/
|
||||
|
||||
#include "fluidsynth/types.h"
|
||||
#include "fluidsynth/settings.h"
|
||||
#include "fluidsynth/synth.h"
|
||||
#include "fluidsynth/shell.h"
|
||||
#include "fluidsynth/sfont.h"
|
||||
#include "fluidsynth/audio.h"
|
||||
#include "fluidsynth/event.h"
|
||||
#include "fluidsynth/midi.h"
|
||||
#include "fluidsynth/seq.h"
|
||||
#include "fluidsynth/seqbind.h"
|
||||
#include "fluidsynth/log.h"
|
||||
#include "fluidsynth/misc.h"
|
||||
#include "fluidsynth/mod.h"
|
||||
#include "fluidsynth/gen.h"
|
||||
#include "fluidsynth/voice.h"
|
||||
#include "fluidsynth/version.h"
|
||||
#include "fluidsynth/ladspa.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _FLUIDSYNTH_H */
|
||||
@@ -1,155 +0,0 @@
|
||||
/* FluidSynth - A Software Synthesizer
|
||||
*
|
||||
* Copyright (C) 2003 Peter Hanappe and others.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef _FLUIDSYNTH_AUDIO_H
|
||||
#define _FLUIDSYNTH_AUDIO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup audio_output Audio Output
|
||||
*
|
||||
* Functions for managing audio drivers and file renderers.
|
||||
*
|
||||
* The file renderer is used for fast rendering of MIDI files to
|
||||
* audio files. The audio drivers are a high-level interface to
|
||||
* connect the synthesizer with external audio sinks or to render
|
||||
* real-time audio to files.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup audio_driver Audio Driver
|
||||
* @ingroup audio_output
|
||||
*
|
||||
* Functions for managing audio drivers.
|
||||
*
|
||||
* Defines functions for creating audio driver output. Use
|
||||
* new_fluid_audio_driver() to create a new audio driver for a given synth
|
||||
* and configuration settings.
|
||||
*
|
||||
* The function new_fluid_audio_driver2() can be
|
||||
* used if custom audio processing is desired before the audio is sent to the
|
||||
* audio driver (although it is not as efficient).
|
||||
*
|
||||
* @sa @ref CreatingAudioDriver
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Callback function type used with new_fluid_audio_driver2() to allow for
|
||||
* custom user audio processing before the audio is sent to the driver.
|
||||
*
|
||||
* @param data The user data parameter as passed to new_fluid_audio_driver2().
|
||||
* @param len Count of audio frames to synthesize.
|
||||
* @param nfx Count of arrays in \c fx.
|
||||
* @param fx Array of buffers to store effects audio to. Buffers may alias with buffers of \c out.
|
||||
* @param nout Count of arrays in \c out.
|
||||
* @param out Array of buffers to store (dry) audio to. Buffers may alias with buffers of \c fx.
|
||||
* @return Should return #FLUID_OK on success, #FLUID_FAILED if an error occurred.
|
||||
*
|
||||
* This function is responsible for rendering audio to the buffers.
|
||||
* The buffers passed to this function are allocated and owned by the respective
|
||||
* audio driver and are only valid during that specific call (do not cache them).
|
||||
* The buffers have already been zeroed-out.
|
||||
* For further details please refer to fluid_synth_process().
|
||||
*
|
||||
* @parblock
|
||||
* @note Whereas fluid_synth_process() allows aliasing buffers, there is the guarantee that @p out
|
||||
* and @p fx buffers provided by fluidsynth's audio drivers never alias. This prevents downstream
|
||||
* applications from e.g. applying a custom effect accidentally to the same buffer multiple times.
|
||||
* @endparblock
|
||||
*
|
||||
* @parblock
|
||||
* @note Also note that the Jack driver is currently the only driver that has dedicated @p fx buffers
|
||||
* (but only if \setting{audio_jack_multi} is true). All other drivers do not provide @p fx buffers.
|
||||
* In this case, users are encouraged to mix the effects into the provided dry buffers when calling
|
||||
* fluid_synth_process().
|
||||
* @code{.cpp}
|
||||
int myCallback(void *, int len, int nfx, float *fx[], int nout, float *out[])
|
||||
{
|
||||
int ret;
|
||||
if(nfx == 0)
|
||||
{
|
||||
float *fxb[4] = {out[0], out[1], out[0], out[1]};
|
||||
ret = fluid_synth_process(synth, len, sizeof(fxb) / sizeof(fxb[0]), fxb, nout, out);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = fluid_synth_process(synth, len, nfx, fx, nout, out);
|
||||
}
|
||||
// ... client-code ...
|
||||
return ret;
|
||||
}
|
||||
* @endcode
|
||||
* For other possible use-cases refer to \ref fluidsynth_process.c .
|
||||
* @endparblock
|
||||
*/
|
||||
typedef int (*fluid_audio_func_t)(void *data, int len,
|
||||
int nfx, float *fx[],
|
||||
int nout, float *out[]);
|
||||
|
||||
/** @startlifecycle{Audio Driver} */
|
||||
FLUIDSYNTH_API fluid_audio_driver_t *new_fluid_audio_driver(fluid_settings_t *settings,
|
||||
fluid_synth_t *synth);
|
||||
|
||||
FLUIDSYNTH_API fluid_audio_driver_t *new_fluid_audio_driver2(fluid_settings_t *settings,
|
||||
fluid_audio_func_t func,
|
||||
void *data);
|
||||
|
||||
FLUIDSYNTH_API void delete_fluid_audio_driver(fluid_audio_driver_t *driver);
|
||||
/** @endlifecycle */
|
||||
|
||||
FLUIDSYNTH_API int fluid_audio_driver_register(const char **adrivers);
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @defgroup file_renderer File Renderer
|
||||
* @ingroup audio_output
|
||||
*
|
||||
* Functions for managing file renderers and triggering the rendering.
|
||||
*
|
||||
* The file renderer is only used to render a MIDI file to audio as fast
|
||||
* as possible. Please see \ref FileRenderer for a full example.
|
||||
*
|
||||
* If you are looking for a way to write audio generated
|
||||
* from real-time events (for example from an external sequencer or a MIDI controller) to a file,
|
||||
* please have a look at the \c file \ref audio_driver instead.
|
||||
*
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @startlifecycle{File Renderer} */
|
||||
FLUIDSYNTH_API fluid_file_renderer_t *new_fluid_file_renderer(fluid_synth_t *synth);
|
||||
FLUIDSYNTH_API void delete_fluid_file_renderer(fluid_file_renderer_t *dev);
|
||||
/** @endlifecycle */
|
||||
|
||||
FLUIDSYNTH_API int fluid_file_renderer_process_block(fluid_file_renderer_t *dev);
|
||||
FLUIDSYNTH_API int fluid_file_set_encoding_quality(fluid_file_renderer_t *dev, double q);
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _FLUIDSYNTH_AUDIO_H */
|
||||
@@ -1,143 +0,0 @@
|
||||
/* FluidSynth - A Software Synthesizer
|
||||
*
|
||||
* Copyright (C) 2003 Peter Hanappe and others.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef _FLUIDSYNTH_EVENT_H
|
||||
#define _FLUIDSYNTH_EVENT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup sequencer_events Sequencer Events
|
||||
* @ingroup sequencer
|
||||
*
|
||||
* Create, modify, query and destroy sequencer events.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Sequencer event type enumeration.
|
||||
*/
|
||||
enum fluid_seq_event_type
|
||||
{
|
||||
FLUID_SEQ_NOTE = 0, /**< Note event with duration */
|
||||
FLUID_SEQ_NOTEON, /**< Note on event */
|
||||
FLUID_SEQ_NOTEOFF, /**< Note off event */
|
||||
FLUID_SEQ_ALLSOUNDSOFF, /**< All sounds off event */
|
||||
FLUID_SEQ_ALLNOTESOFF, /**< All notes off event */
|
||||
FLUID_SEQ_BANKSELECT, /**< Bank select message */
|
||||
FLUID_SEQ_PROGRAMCHANGE, /**< Program change message */
|
||||
FLUID_SEQ_PROGRAMSELECT, /**< Program select message */
|
||||
FLUID_SEQ_PITCHBEND, /**< Pitch bend message */
|
||||
FLUID_SEQ_PITCHWHEELSENS, /**< Pitch wheel sensitivity set message @since 1.1.0 was misspelled previously */
|
||||
FLUID_SEQ_MODULATION, /**< Modulation controller event */
|
||||
FLUID_SEQ_SUSTAIN, /**< Sustain controller event */
|
||||
FLUID_SEQ_CONTROLCHANGE, /**< MIDI control change event */
|
||||
FLUID_SEQ_PAN, /**< Stereo pan set event */
|
||||
FLUID_SEQ_VOLUME, /**< Volume set event */
|
||||
FLUID_SEQ_REVERBSEND, /**< Reverb send set event */
|
||||
FLUID_SEQ_CHORUSSEND, /**< Chorus send set event */
|
||||
FLUID_SEQ_TIMER, /**< Timer event (useful for giving a callback at a certain time) */
|
||||
FLUID_SEQ_CHANNELPRESSURE, /**< Channel aftertouch event @since 1.1.0 */
|
||||
FLUID_SEQ_KEYPRESSURE, /**< Polyphonic aftertouch event @since 2.0.0 */
|
||||
FLUID_SEQ_SYSTEMRESET, /**< System reset event @since 1.1.0 */
|
||||
FLUID_SEQ_UNREGISTERING, /**< Called when a sequencer client is being unregistered. @since 1.1.0 */
|
||||
FLUID_SEQ_SCALE, /**< Sets a new time scale for the sequencer @since 2.2.0 */
|
||||
FLUID_SEQ_LASTEVENT /**< @internal Defines the count of events enums @warning This symbol
|
||||
is not part of the public API and ABI stability guarantee and
|
||||
may change at any time! */
|
||||
};
|
||||
|
||||
/* Event alloc/free */
|
||||
/** @startlifecycle{Sequencer Event} */
|
||||
FLUIDSYNTH_API fluid_event_t *new_fluid_event(void);
|
||||
FLUIDSYNTH_API void delete_fluid_event(fluid_event_t *evt);
|
||||
/** @endlifecycle */
|
||||
|
||||
/* Initializing events */
|
||||
FLUIDSYNTH_API void fluid_event_set_source(fluid_event_t *evt, fluid_seq_id_t src);
|
||||
FLUIDSYNTH_API void fluid_event_set_dest(fluid_event_t *evt, fluid_seq_id_t dest);
|
||||
|
||||
/* Timer events */
|
||||
FLUIDSYNTH_API void fluid_event_timer(fluid_event_t *evt, void *data);
|
||||
|
||||
/* Note events */
|
||||
FLUIDSYNTH_API void fluid_event_note(fluid_event_t *evt, int channel,
|
||||
short key, short vel,
|
||||
unsigned int duration);
|
||||
|
||||
FLUIDSYNTH_API void fluid_event_noteon(fluid_event_t *evt, int channel, short key, short vel);
|
||||
FLUIDSYNTH_API void fluid_event_noteoff(fluid_event_t *evt, int channel, short key);
|
||||
FLUIDSYNTH_API void fluid_event_all_sounds_off(fluid_event_t *evt, int channel);
|
||||
FLUIDSYNTH_API void fluid_event_all_notes_off(fluid_event_t *evt, int channel);
|
||||
|
||||
/* Instrument selection */
|
||||
FLUIDSYNTH_API void fluid_event_bank_select(fluid_event_t *evt, int channel, short bank_num);
|
||||
FLUIDSYNTH_API void fluid_event_program_change(fluid_event_t *evt, int channel, int preset_num);
|
||||
FLUIDSYNTH_API void fluid_event_program_select(fluid_event_t *evt, int channel, unsigned int sfont_id, short bank_num, short preset_num);
|
||||
|
||||
/* Real-time generic instrument controllers */
|
||||
FLUIDSYNTH_API
|
||||
void fluid_event_control_change(fluid_event_t *evt, int channel, short control, int val);
|
||||
|
||||
/* Real-time instrument controllers shortcuts */
|
||||
FLUIDSYNTH_API void fluid_event_pitch_bend(fluid_event_t *evt, int channel, int val);
|
||||
FLUIDSYNTH_API void fluid_event_pitch_wheelsens(fluid_event_t *evt, int channel, int val);
|
||||
FLUIDSYNTH_API void fluid_event_modulation(fluid_event_t *evt, int channel, int val);
|
||||
FLUIDSYNTH_API void fluid_event_sustain(fluid_event_t *evt, int channel, int val);
|
||||
FLUIDSYNTH_API void fluid_event_pan(fluid_event_t *evt, int channel, int val);
|
||||
FLUIDSYNTH_API void fluid_event_volume(fluid_event_t *evt, int channel, int val);
|
||||
FLUIDSYNTH_API void fluid_event_reverb_send(fluid_event_t *evt, int channel, int val);
|
||||
FLUIDSYNTH_API void fluid_event_chorus_send(fluid_event_t *evt, int channel, int val);
|
||||
|
||||
FLUIDSYNTH_API void fluid_event_key_pressure(fluid_event_t *evt, int channel, short key, int val);
|
||||
FLUIDSYNTH_API void fluid_event_channel_pressure(fluid_event_t *evt, int channel, int val);
|
||||
FLUIDSYNTH_API void fluid_event_system_reset(fluid_event_t *evt);
|
||||
|
||||
/* Only when unregistering clients */
|
||||
FLUIDSYNTH_API void fluid_event_unregistering(fluid_event_t *evt);
|
||||
|
||||
FLUIDSYNTH_API void fluid_event_scale(fluid_event_t *evt, double new_scale);
|
||||
FLUIDSYNTH_API int fluid_event_from_midi_event(fluid_event_t *, const fluid_midi_event_t *);
|
||||
|
||||
/* Accessing event data */
|
||||
FLUIDSYNTH_API int fluid_event_get_type(fluid_event_t *evt);
|
||||
FLUIDSYNTH_API fluid_seq_id_t fluid_event_get_source(fluid_event_t *evt);
|
||||
FLUIDSYNTH_API fluid_seq_id_t fluid_event_get_dest(fluid_event_t *evt);
|
||||
FLUIDSYNTH_API int fluid_event_get_channel(fluid_event_t *evt);
|
||||
FLUIDSYNTH_API short fluid_event_get_key(fluid_event_t *evt);
|
||||
FLUIDSYNTH_API short fluid_event_get_velocity(fluid_event_t *evt);
|
||||
FLUIDSYNTH_API short fluid_event_get_control(fluid_event_t *evt);
|
||||
FLUIDSYNTH_API int fluid_event_get_value(fluid_event_t *evt);
|
||||
FLUIDSYNTH_API int fluid_event_get_program(fluid_event_t *evt);
|
||||
FLUIDSYNTH_API void *fluid_event_get_data(fluid_event_t *evt);
|
||||
FLUIDSYNTH_API unsigned int fluid_event_get_duration(fluid_event_t *evt);
|
||||
FLUIDSYNTH_API short fluid_event_get_bank(fluid_event_t *evt);
|
||||
FLUIDSYNTH_API int fluid_event_get_pitch(fluid_event_t *evt);
|
||||
FLUIDSYNTH_API double fluid_event_get_scale(fluid_event_t *evt);
|
||||
FLUIDSYNTH_API unsigned int fluid_event_get_sfont_id(fluid_event_t *evt);
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* _FLUIDSYNTH_EVENT_H */
|
||||
@@ -1,134 +0,0 @@
|
||||
/* FluidSynth - A Software Synthesizer
|
||||
*
|
||||
* Copyright (C) 2003 Peter Hanappe and others.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef _FLUIDSYNTH_GEN_H
|
||||
#define _FLUIDSYNTH_GEN_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup generators SoundFont Generators
|
||||
* @ingroup soundfonts
|
||||
*
|
||||
* Functions and defines for SoundFont generator effects.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Generator (effect) numbers (Soundfont 2.01 specifications section 8.1.3)
|
||||
*/
|
||||
enum fluid_gen_type
|
||||
{
|
||||
GEN_STARTADDROFS, /**< Sample start address offset (0-32767) */
|
||||
GEN_ENDADDROFS, /**< Sample end address offset (-32767-0) */
|
||||
GEN_STARTLOOPADDROFS, /**< Sample loop start address offset (-32767-32767) */
|
||||
GEN_ENDLOOPADDROFS, /**< Sample loop end address offset (-32767-32767) */
|
||||
GEN_STARTADDRCOARSEOFS, /**< Sample start address coarse offset (X 32768) */
|
||||
GEN_MODLFOTOPITCH, /**< Modulation LFO to pitch */
|
||||
GEN_VIBLFOTOPITCH, /**< Vibrato LFO to pitch */
|
||||
GEN_MODENVTOPITCH, /**< Modulation envelope to pitch */
|
||||
GEN_FILTERFC, /**< Filter cutoff */
|
||||
GEN_FILTERQ, /**< Filter Q */
|
||||
GEN_MODLFOTOFILTERFC, /**< Modulation LFO to filter cutoff */
|
||||
GEN_MODENVTOFILTERFC, /**< Modulation envelope to filter cutoff */
|
||||
GEN_ENDADDRCOARSEOFS, /**< Sample end address coarse offset (X 32768) */
|
||||
GEN_MODLFOTOVOL, /**< Modulation LFO to volume */
|
||||
GEN_UNUSED1, /**< Unused */
|
||||
GEN_CHORUSSEND, /**< Chorus send amount */
|
||||
GEN_REVERBSEND, /**< Reverb send amount */
|
||||
GEN_PAN, /**< Stereo panning */
|
||||
GEN_UNUSED2, /**< Unused */
|
||||
GEN_UNUSED3, /**< Unused */
|
||||
GEN_UNUSED4, /**< Unused */
|
||||
GEN_MODLFODELAY, /**< Modulation LFO delay */
|
||||
GEN_MODLFOFREQ, /**< Modulation LFO frequency */
|
||||
GEN_VIBLFODELAY, /**< Vibrato LFO delay */
|
||||
GEN_VIBLFOFREQ, /**< Vibrato LFO frequency */
|
||||
GEN_MODENVDELAY, /**< Modulation envelope delay */
|
||||
GEN_MODENVATTACK, /**< Modulation envelope attack */
|
||||
GEN_MODENVHOLD, /**< Modulation envelope hold */
|
||||
GEN_MODENVDECAY, /**< Modulation envelope decay */
|
||||
GEN_MODENVSUSTAIN, /**< Modulation envelope sustain */
|
||||
GEN_MODENVRELEASE, /**< Modulation envelope release */
|
||||
GEN_KEYTOMODENVHOLD, /**< Key to modulation envelope hold */
|
||||
GEN_KEYTOMODENVDECAY, /**< Key to modulation envelope decay */
|
||||
GEN_VOLENVDELAY, /**< Volume envelope delay */
|
||||
GEN_VOLENVATTACK, /**< Volume envelope attack */
|
||||
GEN_VOLENVHOLD, /**< Volume envelope hold */
|
||||
GEN_VOLENVDECAY, /**< Volume envelope decay */
|
||||
GEN_VOLENVSUSTAIN, /**< Volume envelope sustain */
|
||||
GEN_VOLENVRELEASE, /**< Volume envelope release */
|
||||
GEN_KEYTOVOLENVHOLD, /**< Key to volume envelope hold */
|
||||
GEN_KEYTOVOLENVDECAY, /**< Key to volume envelope decay */
|
||||
GEN_INSTRUMENT, /**< Instrument ID (shouldn't be set by user) */
|
||||
GEN_RESERVED1, /**< Reserved */
|
||||
GEN_KEYRANGE, /**< MIDI note range */
|
||||
GEN_VELRANGE, /**< MIDI velocity range */
|
||||
GEN_STARTLOOPADDRCOARSEOFS, /**< Sample start loop address coarse offset (X 32768) */
|
||||
GEN_KEYNUM, /**< Fixed MIDI note number */
|
||||
GEN_VELOCITY, /**< Fixed MIDI velocity value */
|
||||
GEN_ATTENUATION, /**< Initial volume attenuation */
|
||||
GEN_RESERVED2, /**< Reserved */
|
||||
GEN_ENDLOOPADDRCOARSEOFS, /**< Sample end loop address coarse offset (X 32768) */
|
||||
GEN_COARSETUNE, /**< Coarse tuning */
|
||||
GEN_FINETUNE, /**< Fine tuning */
|
||||
GEN_SAMPLEID, /**< Sample ID (shouldn't be set by user) */
|
||||
GEN_SAMPLEMODE, /**< Sample mode flags */
|
||||
GEN_RESERVED3, /**< Reserved */
|
||||
GEN_SCALETUNE, /**< Scale tuning */
|
||||
GEN_EXCLUSIVECLASS, /**< Exclusive class number */
|
||||
GEN_OVERRIDEROOTKEY, /**< Sample root note override */
|
||||
|
||||
/**
|
||||
* Initial Pitch
|
||||
*
|
||||
* @note This is not "standard" SoundFont generator, because it is not
|
||||
* mentioned in the list of generators in the SF2 specifications.
|
||||
* It is used by FluidSynth internally to compute the nominal pitch of
|
||||
* a note on note-on event. By nature it shouldn't be allowed to be modulated,
|
||||
* however the specification defines a default modulator having "Initial Pitch"
|
||||
* as destination (cf. SF2.01 page 57 section 8.4.10 MIDI Pitch Wheel to Initial Pitch).
|
||||
* Thus it is impossible to cancel this default modulator, which would be required
|
||||
* to let the MIDI Pitch Wheel controller modulate a different generator.
|
||||
* In order to provide this flexibility, FluidSynth >= 2.1.0 uses a default modulator
|
||||
* "Pitch Wheel to Fine Tune", rather than Initial Pitch. The same "compromise" can
|
||||
* be found on the Audigy 2 ZS for instance.
|
||||
*/
|
||||
GEN_PITCH,
|
||||
|
||||
GEN_CUSTOM_BALANCE, /**< Balance @note Not a real SoundFont generator */
|
||||
/* non-standard generator for an additional custom high- or low-pass filter */
|
||||
GEN_CUSTOM_FILTERFC, /**< Custom filter cutoff frequency */
|
||||
GEN_CUSTOM_FILTERQ, /**< Custom filter Q */
|
||||
|
||||
GEN_LAST /**< @internal Value defines the count of generators (#fluid_gen_type)
|
||||
@warning This symbol is not part of the public API and ABI
|
||||
stability guarantee and may change at any time! */
|
||||
};
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* _FLUIDSYNTH_GEN_H */
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
/* FluidSynth - A Software Synthesizer
|
||||
*
|
||||
* Copyright (C) 2003 Peter Hanappe and others.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef _FLUIDSYNTH_LADSPA_H
|
||||
#define _FLUIDSYNTH_LADSPA_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup ladspa Effect - LADSPA
|
||||
* @ingroup synth
|
||||
*
|
||||
* Functions for configuring the LADSPA effects unit
|
||||
*
|
||||
* This header defines useful functions for programmatically manipulating the ladspa
|
||||
* effects unit of the synth that can be retrieved via fluid_synth_get_ladspa_fx().
|
||||
*
|
||||
* Using any of those functions requires fluidsynth to be compiled with LADSPA support.
|
||||
* Else all of those functions are useless dummies.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
FLUIDSYNTH_API int fluid_ladspa_is_active(fluid_ladspa_fx_t *fx);
|
||||
FLUIDSYNTH_API int fluid_ladspa_activate(fluid_ladspa_fx_t *fx);
|
||||
FLUIDSYNTH_API int fluid_ladspa_deactivate(fluid_ladspa_fx_t *fx);
|
||||
FLUIDSYNTH_API int fluid_ladspa_reset(fluid_ladspa_fx_t *fx);
|
||||
FLUIDSYNTH_API int fluid_ladspa_check(fluid_ladspa_fx_t *fx, char *err, int err_size);
|
||||
|
||||
FLUIDSYNTH_API int fluid_ladspa_host_port_exists(fluid_ladspa_fx_t *fx, const char *name);
|
||||
|
||||
FLUIDSYNTH_API int fluid_ladspa_add_buffer(fluid_ladspa_fx_t *fx, const char *name);
|
||||
FLUIDSYNTH_API int fluid_ladspa_buffer_exists(fluid_ladspa_fx_t *fx, const char *name);
|
||||
|
||||
FLUIDSYNTH_API int fluid_ladspa_add_effect(fluid_ladspa_fx_t *fx, const char *effect_name,
|
||||
const char *lib_name, const char *plugin_name);
|
||||
FLUIDSYNTH_API int fluid_ladspa_effect_can_mix(fluid_ladspa_fx_t *fx, const char *name);
|
||||
FLUIDSYNTH_API int fluid_ladspa_effect_set_mix(fluid_ladspa_fx_t *fx, const char *name, int mix, float gain);
|
||||
FLUIDSYNTH_API int fluid_ladspa_effect_port_exists(fluid_ladspa_fx_t *fx, const char *effect_name, const char *port_name);
|
||||
FLUIDSYNTH_API int fluid_ladspa_effect_set_control(fluid_ladspa_fx_t *fx, const char *effect_name,
|
||||
const char *port_name, float val);
|
||||
FLUIDSYNTH_API int fluid_ladspa_effect_link(fluid_ladspa_fx_t *fx, const char *effect_name,
|
||||
const char *port_name, const char *name);
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _FLUIDSYNTH_LADSPA_H */
|
||||
|
||||
@@ -1,97 +0,0 @@
|
||||
/* FluidSynth - A Software Synthesizer
|
||||
*
|
||||
* Copyright (C) 2003 Peter Hanappe and others.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef _FLUIDSYNTH_LOG_H
|
||||
#define _FLUIDSYNTH_LOG_H
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup logging Logging
|
||||
*
|
||||
* Logging interface
|
||||
*
|
||||
* The default logging function of the fluidsynth prints its messages to the
|
||||
* stderr. The synthesizer uses five level of messages: #FLUID_PANIC,
|
||||
* #FLUID_ERR, #FLUID_WARN, #FLUID_INFO, and #FLUID_DBG.
|
||||
*
|
||||
* A client application can install a new log function to handle the messages
|
||||
* differently. In the following example, the application sets a callback
|
||||
* function to display #FLUID_PANIC messages in a dialog, and ignores all other
|
||||
* messages by setting the log function to NULL:
|
||||
*
|
||||
* @code
|
||||
* fluid_set_log_function(FLUID_PANIC, show_dialog, (void*) root_window);
|
||||
* fluid_set_log_function(FLUID_ERR, NULL, NULL);
|
||||
* fluid_set_log_function(FLUID_WARN, NULL, NULL);
|
||||
* fluid_set_log_function(FLUID_DBG, NULL, NULL);
|
||||
* @endcode
|
||||
*
|
||||
* @note The logging configuration is global and not tied to a specific
|
||||
* synthesizer instance. That means that all synthesizer instances created in
|
||||
* the same process share the same logging configuration.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* FluidSynth log levels.
|
||||
*/
|
||||
enum fluid_log_level
|
||||
{
|
||||
FLUID_PANIC, /**< The synth can't function correctly any more */
|
||||
FLUID_ERR, /**< Serious error occurred */
|
||||
FLUID_WARN, /**< Warning */
|
||||
FLUID_INFO, /**< Verbose informational messages */
|
||||
FLUID_DBG, /**< Debugging messages */
|
||||
LAST_LOG_LEVEL /**< @internal This symbol is not part of the public API and ABI
|
||||
stability guarantee and may change at any time! */
|
||||
};
|
||||
|
||||
/**
|
||||
* Log function handler callback type used by fluid_set_log_function().
|
||||
*
|
||||
* @param level Log level (#fluid_log_level)
|
||||
* @param message Log message text
|
||||
* @param data User data pointer supplied to fluid_set_log_function().
|
||||
*/
|
||||
typedef void (*fluid_log_function_t)(int level, const char *message, void *data);
|
||||
|
||||
FLUIDSYNTH_API
|
||||
fluid_log_function_t fluid_set_log_function(int level, fluid_log_function_t fun, void *data);
|
||||
|
||||
FLUIDSYNTH_API void fluid_default_log_function(int level, const char *message, void *data);
|
||||
|
||||
FLUIDSYNTH_API int fluid_log(int level, const char *fmt, ...)
|
||||
#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)
|
||||
__attribute__ ((format (printf, 2, 3)))
|
||||
#endif
|
||||
;
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _FLUIDSYNTH_LOG_H */
|
||||
@@ -1,295 +0,0 @@
|
||||
/* FluidSynth - A Software Synthesizer
|
||||
*
|
||||
* Copyright (C) 2003 Peter Hanappe and others.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef _FLUIDSYNTH_MIDI_H
|
||||
#define _FLUIDSYNTH_MIDI_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup midi_input MIDI Input
|
||||
*
|
||||
* MIDI Input Subsystem
|
||||
*
|
||||
* There are multiple ways to send MIDI events to the synthesizer. They can come
|
||||
* from MIDI files, from external MIDI sequencers or raw MIDI event sources,
|
||||
* can be modified via MIDI routers and also generated manually.
|
||||
*
|
||||
* The interface connecting all sources and sinks of MIDI events in libfluidsynth
|
||||
* is \ref handle_midi_event_func_t.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Generic callback function for MIDI event handler.
|
||||
*
|
||||
* @param data User defined data pointer
|
||||
* @param event The MIDI event
|
||||
* @return Should return #FLUID_OK on success, #FLUID_FAILED otherwise
|
||||
*
|
||||
* This callback is used to pass MIDI events
|
||||
* - from \ref midi_player, \ref midi_router or \ref midi_driver
|
||||
* - to \ref midi_router via fluid_midi_router_handle_midi_event()
|
||||
* - or to \ref synth via fluid_synth_handle_midi_event().
|
||||
*
|
||||
* Additionally, there is a translation layer to pass MIDI events to
|
||||
* a \ref sequencer via fluid_sequencer_add_midi_event_to_buffer().
|
||||
*/
|
||||
typedef int (*handle_midi_event_func_t)(void *data, fluid_midi_event_t *event);
|
||||
|
||||
/**
|
||||
* Generic callback function fired once by MIDI tick change.
|
||||
*
|
||||
* @param data User defined data pointer
|
||||
* @param tick The current (zero-based) tick, which triggered the callback
|
||||
* @return Should return #FLUID_OK on success, #FLUID_FAILED otherwise
|
||||
*
|
||||
* This callback is fired at a constant rate depending on the current BPM and PPQ.
|
||||
* e.g. for PPQ = 192 and BPM = 140 the callback is fired 192 * 140 times per minute (448/sec).
|
||||
*
|
||||
* It can be used to sync external elements with the beat,
|
||||
* or stop / loop the song on a given tick.
|
||||
* Ticks being BPM-dependent, you can manipulate values such as bars or beats,
|
||||
* without having to care about BPM.
|
||||
*
|
||||
* For example, this callback loops the song whenever it reaches the 5th bar :
|
||||
*
|
||||
* @code{.cpp}
|
||||
int handle_tick(void *data, int tick)
|
||||
{
|
||||
fluid_player_t *player = (fluid_player_t *)data;
|
||||
int ppq = 192; // From MIDI header
|
||||
int beatsPerBar = 4; // From the song's time signature
|
||||
int loopBar = 5;
|
||||
int loopTick = (loopBar - 1) * ppq * beatsPerBar;
|
||||
|
||||
if (tick == loopTick)
|
||||
{
|
||||
return fluid_player_seek(player, 0);
|
||||
}
|
||||
|
||||
return FLUID_OK;
|
||||
}
|
||||
* @endcode
|
||||
*/
|
||||
typedef int (*handle_midi_tick_func_t)(void *data, int tick);
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @defgroup midi_events MIDI Events
|
||||
* @ingroup midi_input
|
||||
*
|
||||
* Functions to create, modify, query and delete MIDI events.
|
||||
*
|
||||
* These functions are intended to be used in MIDI routers and other filtering
|
||||
* and processing functions in the MIDI event path. If you want to simply
|
||||
* send MIDI messages to the synthesizer, you can use the more convenient
|
||||
* \ref midi_messages interface.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
/** @startlifecycle{MIDI Event} */
|
||||
FLUIDSYNTH_API fluid_midi_event_t *new_fluid_midi_event(void);
|
||||
FLUIDSYNTH_API void delete_fluid_midi_event(fluid_midi_event_t *event);
|
||||
/** @endlifecycle */
|
||||
|
||||
FLUIDSYNTH_API int fluid_midi_event_set_type(fluid_midi_event_t *evt, int type);
|
||||
FLUIDSYNTH_API int fluid_midi_event_get_type(const fluid_midi_event_t *evt);
|
||||
FLUIDSYNTH_API int fluid_midi_event_set_channel(fluid_midi_event_t *evt, int chan);
|
||||
FLUIDSYNTH_API int fluid_midi_event_get_channel(const fluid_midi_event_t *evt);
|
||||
FLUIDSYNTH_API int fluid_midi_event_get_key(const fluid_midi_event_t *evt);
|
||||
FLUIDSYNTH_API int fluid_midi_event_set_key(fluid_midi_event_t *evt, int key);
|
||||
FLUIDSYNTH_API int fluid_midi_event_get_velocity(const fluid_midi_event_t *evt);
|
||||
FLUIDSYNTH_API int fluid_midi_event_set_velocity(fluid_midi_event_t *evt, int vel);
|
||||
FLUIDSYNTH_API int fluid_midi_event_get_control(const fluid_midi_event_t *evt);
|
||||
FLUIDSYNTH_API int fluid_midi_event_set_control(fluid_midi_event_t *evt, int ctrl);
|
||||
FLUIDSYNTH_API int fluid_midi_event_get_value(const fluid_midi_event_t *evt);
|
||||
FLUIDSYNTH_API int fluid_midi_event_set_value(fluid_midi_event_t *evt, int val);
|
||||
FLUIDSYNTH_API int fluid_midi_event_get_program(const fluid_midi_event_t *evt);
|
||||
FLUIDSYNTH_API int fluid_midi_event_set_program(fluid_midi_event_t *evt, int val);
|
||||
FLUIDSYNTH_API int fluid_midi_event_get_pitch(const fluid_midi_event_t *evt);
|
||||
FLUIDSYNTH_API int fluid_midi_event_set_pitch(fluid_midi_event_t *evt, int val);
|
||||
FLUIDSYNTH_API int fluid_midi_event_set_sysex(fluid_midi_event_t *evt, void *data,
|
||||
int size, int dynamic);
|
||||
FLUIDSYNTH_API int fluid_midi_event_set_text(fluid_midi_event_t *evt,
|
||||
void *data, int size, int dynamic);
|
||||
FLUIDSYNTH_API int fluid_midi_event_get_text(fluid_midi_event_t *evt,
|
||||
void **data, int *size);
|
||||
FLUIDSYNTH_API int fluid_midi_event_set_lyrics(fluid_midi_event_t *evt,
|
||||
void *data, int size, int dynamic);
|
||||
FLUIDSYNTH_API int fluid_midi_event_get_lyrics(fluid_midi_event_t *evt,
|
||||
void **data, int *size);
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @defgroup midi_router MIDI Router
|
||||
* @ingroup midi_input
|
||||
*
|
||||
* Rule based transformation and filtering of MIDI events.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* MIDI router rule type.
|
||||
*
|
||||
* @since 1.1.0
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
FLUID_MIDI_ROUTER_RULE_NOTE, /**< MIDI note rule */
|
||||
FLUID_MIDI_ROUTER_RULE_CC, /**< MIDI controller rule */
|
||||
FLUID_MIDI_ROUTER_RULE_PROG_CHANGE, /**< MIDI program change rule */
|
||||
FLUID_MIDI_ROUTER_RULE_PITCH_BEND, /**< MIDI pitch bend rule */
|
||||
FLUID_MIDI_ROUTER_RULE_CHANNEL_PRESSURE, /**< MIDI channel pressure rule */
|
||||
FLUID_MIDI_ROUTER_RULE_KEY_PRESSURE, /**< MIDI key pressure rule */
|
||||
FLUID_MIDI_ROUTER_RULE_COUNT /**< @internal Total count of rule types. This symbol
|
||||
is not part of the public API and ABI stability
|
||||
guarantee and may change at any time!*/
|
||||
} fluid_midi_router_rule_type;
|
||||
|
||||
|
||||
/** @startlifecycle{MIDI Router} */
|
||||
FLUIDSYNTH_API fluid_midi_router_t *new_fluid_midi_router(fluid_settings_t *settings,
|
||||
handle_midi_event_func_t handler,
|
||||
void *event_handler_data);
|
||||
FLUIDSYNTH_API void delete_fluid_midi_router(fluid_midi_router_t *handler);
|
||||
/** @endlifecycle */
|
||||
|
||||
FLUIDSYNTH_API int fluid_midi_router_set_default_rules(fluid_midi_router_t *router);
|
||||
FLUIDSYNTH_API int fluid_midi_router_clear_rules(fluid_midi_router_t *router);
|
||||
FLUIDSYNTH_API int fluid_midi_router_add_rule(fluid_midi_router_t *router,
|
||||
fluid_midi_router_rule_t *rule, int type);
|
||||
|
||||
|
||||
/** @startlifecycle{MIDI Router Rule} */
|
||||
FLUIDSYNTH_API fluid_midi_router_rule_t *new_fluid_midi_router_rule(void);
|
||||
FLUIDSYNTH_API void delete_fluid_midi_router_rule(fluid_midi_router_rule_t *rule);
|
||||
/** @endlifecycle */
|
||||
|
||||
FLUIDSYNTH_API void fluid_midi_router_rule_set_chan(fluid_midi_router_rule_t *rule,
|
||||
int min, int max, float mul, int add);
|
||||
FLUIDSYNTH_API void fluid_midi_router_rule_set_param1(fluid_midi_router_rule_t *rule,
|
||||
int min, int max, float mul, int add);
|
||||
FLUIDSYNTH_API void fluid_midi_router_rule_set_param2(fluid_midi_router_rule_t *rule,
|
||||
int min, int max, float mul, int add);
|
||||
FLUIDSYNTH_API int fluid_midi_router_handle_midi_event(void *data, fluid_midi_event_t *event);
|
||||
FLUIDSYNTH_API int fluid_midi_dump_prerouter(void *data, fluid_midi_event_t *event);
|
||||
FLUIDSYNTH_API int fluid_midi_dump_postrouter(void *data, fluid_midi_event_t *event);
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @defgroup midi_driver MIDI Driver
|
||||
* @ingroup midi_input
|
||||
*
|
||||
* Functions for managing MIDI drivers.
|
||||
*
|
||||
* The available MIDI drivers depend on your platform. See \ref settings_midi for all
|
||||
* available configuration options.
|
||||
*
|
||||
* To create a MIDI driver, you need to specify a source for the MIDI events to be
|
||||
* forwarded to via the \ref fluid_midi_event_t callback. Normally this will be
|
||||
* either a \ref midi_router via fluid_midi_router_handle_midi_event() or the synthesizer
|
||||
* via fluid_synth_handle_midi_event().
|
||||
*
|
||||
* But you can also write your own handler function that preprocesses the events and
|
||||
* forwards them on to the router or synthesizer instead.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @startlifecycle{MIDI Driver} */
|
||||
FLUIDSYNTH_API
|
||||
fluid_midi_driver_t *new_fluid_midi_driver(fluid_settings_t *settings,
|
||||
handle_midi_event_func_t handler,
|
||||
void *event_handler_data);
|
||||
|
||||
FLUIDSYNTH_API void delete_fluid_midi_driver(fluid_midi_driver_t *driver);
|
||||
/** @endlifecycle */
|
||||
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @defgroup midi_player MIDI File Player
|
||||
* @ingroup midi_input
|
||||
*
|
||||
* Parse standard MIDI files and emit MIDI events.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* MIDI File Player status enum.
|
||||
* @since 1.1.0
|
||||
*/
|
||||
enum fluid_player_status
|
||||
{
|
||||
FLUID_PLAYER_READY, /**< Player is ready */
|
||||
FLUID_PLAYER_PLAYING, /**< Player is currently playing */
|
||||
FLUID_PLAYER_STOPPING, /**< Player is stopping, but hasn't finished yet (currently unused) */
|
||||
FLUID_PLAYER_DONE /**< Player is finished playing */
|
||||
};
|
||||
|
||||
/**
|
||||
* MIDI File Player tempo enum.
|
||||
* @since 2.2.0
|
||||
*/
|
||||
enum fluid_player_set_tempo_type
|
||||
{
|
||||
FLUID_PLAYER_TEMPO_INTERNAL, /**< Use midi file tempo set in midi file (120 bpm by default). Multiplied by a factor */
|
||||
FLUID_PLAYER_TEMPO_EXTERNAL_BPM, /**< Set player tempo in bpm, supersede midi file tempo */
|
||||
FLUID_PLAYER_TEMPO_EXTERNAL_MIDI, /**< Set player tempo in us per quarter note, supersede midi file tempo */
|
||||
FLUID_PLAYER_TEMPO_NBR /**< @internal Value defines the count of player tempo type (#fluid_player_set_tempo_type) @warning This symbol is not part of the public API and ABI stability guarantee and may change at any time! */
|
||||
};
|
||||
|
||||
/** @startlifecycle{MIDI File Player} */
|
||||
FLUIDSYNTH_API fluid_player_t *new_fluid_player(fluid_synth_t *synth);
|
||||
FLUIDSYNTH_API void delete_fluid_player(fluid_player_t *player);
|
||||
/** @endlifecycle */
|
||||
|
||||
FLUIDSYNTH_API int fluid_player_add(fluid_player_t *player, const char *midifile);
|
||||
FLUIDSYNTH_API int fluid_player_add_mem(fluid_player_t *player, const void *buffer, size_t len);
|
||||
FLUIDSYNTH_API int fluid_player_play(fluid_player_t *player);
|
||||
FLUIDSYNTH_API int fluid_player_stop(fluid_player_t *player);
|
||||
FLUIDSYNTH_API int fluid_player_join(fluid_player_t *player);
|
||||
FLUIDSYNTH_API int fluid_player_set_loop(fluid_player_t *player, int loop);
|
||||
FLUIDSYNTH_API int fluid_player_set_tempo(fluid_player_t *player, int tempo_type, double tempo);
|
||||
FLUID_DEPRECATED FLUIDSYNTH_API int fluid_player_set_midi_tempo(fluid_player_t *player, int tempo);
|
||||
FLUID_DEPRECATED FLUIDSYNTH_API int fluid_player_set_bpm(fluid_player_t *player, int bpm);
|
||||
FLUIDSYNTH_API int fluid_player_set_playback_callback(fluid_player_t *player, handle_midi_event_func_t handler, void *handler_data);
|
||||
FLUIDSYNTH_API int fluid_player_set_tick_callback(fluid_player_t *player, handle_midi_tick_func_t handler, void *handler_data);
|
||||
|
||||
FLUIDSYNTH_API int fluid_player_get_status(fluid_player_t *player);
|
||||
FLUIDSYNTH_API int fluid_player_get_current_tick(fluid_player_t *player);
|
||||
FLUIDSYNTH_API int fluid_player_get_total_ticks(fluid_player_t *player);
|
||||
FLUIDSYNTH_API int fluid_player_get_bpm(fluid_player_t *player);
|
||||
FLUIDSYNTH_API int fluid_player_get_division(fluid_player_t *player);
|
||||
FLUIDSYNTH_API int fluid_player_get_midi_tempo(fluid_player_t *player);
|
||||
FLUIDSYNTH_API int fluid_player_seek(fluid_player_t *player, int ticks);
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _FLUIDSYNTH_MIDI_H */
|
||||
@@ -1,77 +0,0 @@
|
||||
/* FluidSynth - A Software Synthesizer
|
||||
*
|
||||
* Copyright (C) 2003 Peter Hanappe and others.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef _FLUIDSYNTH_MISC_H
|
||||
#define _FLUIDSYNTH_MISC_H
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup misc Miscellaneous
|
||||
*
|
||||
* Miscellaneous utility functions and defines
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Value that indicates success, used by most libfluidsynth functions.
|
||||
*
|
||||
* @note This was not publicly defined prior to libfluidsynth 1.1.0. When
|
||||
* writing code which should also be compatible with older versions, something
|
||||
* like the following can be used:
|
||||
*
|
||||
* @code
|
||||
* #include <fluidsynth.h>
|
||||
*
|
||||
* #ifndef FLUID_OK
|
||||
* #define FLUID_OK (0)
|
||||
* #define FLUID_FAILED (-1)
|
||||
* #endif
|
||||
* @endcode
|
||||
*
|
||||
* @since 1.1.0
|
||||
*/
|
||||
#define FLUID_OK (0)
|
||||
|
||||
/**
|
||||
* Value that indicates failure, used by most libfluidsynth functions.
|
||||
*
|
||||
* @note See #FLUID_OK for more details.
|
||||
*
|
||||
* @since 1.1.0
|
||||
*/
|
||||
#define FLUID_FAILED (-1)
|
||||
|
||||
|
||||
FLUIDSYNTH_API int fluid_is_soundfont(const char *filename);
|
||||
FLUIDSYNTH_API int fluid_is_midifile(const char *filename);
|
||||
FLUIDSYNTH_API void fluid_free(void* ptr);
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _FLUIDSYNTH_MISC_H */
|
||||
@@ -1,116 +0,0 @@
|
||||
/* FluidSynth - A Software Synthesizer
|
||||
*
|
||||
* Copyright (C) 2003 Peter Hanappe and others.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef _FLUIDSYNTH_MOD_H
|
||||
#define _FLUIDSYNTH_MOD_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup modulators SoundFont Modulators
|
||||
* @ingroup soundfonts
|
||||
*
|
||||
* SoundFont modulator functions and constants.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Flags defining the polarity, mapping function and type of a modulator source.
|
||||
* Compare with SoundFont 2.04 PDF section 8.2.
|
||||
*
|
||||
* Note: Bit values do not correspond to the SoundFont spec! Also note that
|
||||
* #FLUID_MOD_GC and #FLUID_MOD_CC are in the flags field instead of the source field.
|
||||
*/
|
||||
enum fluid_mod_flags
|
||||
{
|
||||
FLUID_MOD_POSITIVE = 0, /**< Mapping function is positive */
|
||||
FLUID_MOD_NEGATIVE = 1, /**< Mapping function is negative */
|
||||
FLUID_MOD_UNIPOLAR = 0, /**< Mapping function is unipolar */
|
||||
FLUID_MOD_BIPOLAR = 2, /**< Mapping function is bipolar */
|
||||
FLUID_MOD_LINEAR = 0, /**< Linear mapping function */
|
||||
FLUID_MOD_CONCAVE = 4, /**< Concave mapping function */
|
||||
FLUID_MOD_CONVEX = 8, /**< Convex mapping function */
|
||||
FLUID_MOD_SWITCH = 12, /**< Switch (on/off) mapping function */
|
||||
FLUID_MOD_GC = 0, /**< General controller source type (#fluid_mod_src) */
|
||||
FLUID_MOD_CC = 16, /**< MIDI CC controller (source will be a MIDI CC number) */
|
||||
|
||||
FLUID_MOD_SIN = 0x80, /**< Custom non-standard sinus mapping function */
|
||||
};
|
||||
|
||||
/**
|
||||
* Transform types for the SoundFont2 modulators as defined by SoundFont 2.04 section 8.3.
|
||||
*/
|
||||
enum fluid_mod_transforms
|
||||
{
|
||||
FLUID_MOD_TRANSFORM_LINEAR = 0, /**< Linear: directly add the computed value to summing node */
|
||||
FLUID_MOD_TRANSFORM_ABS = 2 /**< Abs: add the absolute value of the computed to summing node */
|
||||
};
|
||||
|
||||
/**
|
||||
* General controller (if #FLUID_MOD_GC in flags). This
|
||||
* corresponds to SoundFont 2.04 PDF section 8.2.1
|
||||
*/
|
||||
enum fluid_mod_src
|
||||
{
|
||||
FLUID_MOD_NONE = 0, /**< No source controller */
|
||||
FLUID_MOD_VELOCITY = 2, /**< MIDI note-on velocity */
|
||||
FLUID_MOD_KEY = 3, /**< MIDI note-on note number */
|
||||
FLUID_MOD_KEYPRESSURE = 10, /**< MIDI key pressure */
|
||||
FLUID_MOD_CHANNELPRESSURE = 13, /**< MIDI channel pressure */
|
||||
FLUID_MOD_PITCHWHEEL = 14, /**< Pitch wheel */
|
||||
FLUID_MOD_PITCHWHEELSENS = 16 /**< Pitch wheel sensitivity */
|
||||
};
|
||||
|
||||
/** @startlifecycle{Modulator} */
|
||||
FLUIDSYNTH_API fluid_mod_t *new_fluid_mod(void);
|
||||
FLUIDSYNTH_API void delete_fluid_mod(fluid_mod_t *mod);
|
||||
/** @endlifecycle */
|
||||
|
||||
FLUIDSYNTH_API size_t fluid_mod_sizeof(void);
|
||||
|
||||
FLUIDSYNTH_API void fluid_mod_set_source1(fluid_mod_t *mod, int src, int flags);
|
||||
FLUIDSYNTH_API void fluid_mod_set_source2(fluid_mod_t *mod, int src, int flags);
|
||||
FLUIDSYNTH_API void fluid_mod_set_dest(fluid_mod_t *mod, int dst);
|
||||
FLUIDSYNTH_API void fluid_mod_set_amount(fluid_mod_t *mod, double amount);
|
||||
FLUIDSYNTH_API void fluid_mod_set_transform(fluid_mod_t *mod, int type);
|
||||
|
||||
FLUIDSYNTH_API int fluid_mod_get_source1(const fluid_mod_t *mod);
|
||||
FLUIDSYNTH_API int fluid_mod_get_flags1(const fluid_mod_t *mod);
|
||||
FLUIDSYNTH_API int fluid_mod_get_source2(const fluid_mod_t *mod);
|
||||
FLUIDSYNTH_API int fluid_mod_get_flags2(const fluid_mod_t *mod);
|
||||
FLUIDSYNTH_API int fluid_mod_get_dest(const fluid_mod_t *mod);
|
||||
FLUIDSYNTH_API double fluid_mod_get_amount(const fluid_mod_t *mod);
|
||||
FLUIDSYNTH_API int fluid_mod_get_transform(fluid_mod_t *mod);
|
||||
|
||||
FLUIDSYNTH_API int fluid_mod_test_identity(const fluid_mod_t *mod1, const fluid_mod_t *mod2);
|
||||
FLUIDSYNTH_API int fluid_mod_has_source(const fluid_mod_t *mod, int cc, int ctrl);
|
||||
FLUIDSYNTH_API int fluid_mod_has_dest(const fluid_mod_t *mod, int gen);
|
||||
|
||||
FLUIDSYNTH_API void fluid_mod_clone(fluid_mod_t *mod, const fluid_mod_t *src);
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* _FLUIDSYNTH_MOD_H */
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
/* FluidSynth - A Software Synthesizer
|
||||
*
|
||||
* Copyright (C) 2003 Peter Hanappe and others.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef _FLUIDSYNTH_SEQ_H
|
||||
#define _FLUIDSYNTH_SEQ_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup sequencer MIDI Sequencer
|
||||
*
|
||||
* MIDI event sequencer.
|
||||
*
|
||||
* The MIDI sequencer can be used to play MIDI events in a more flexible way than
|
||||
* using the MIDI file player, which expects the events to be stored as
|
||||
* Standard MIDI Files. Using the sequencer, you can provide the events one by
|
||||
* one, with an optional timestamp for scheduling.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Event callback prototype for destination clients.
|
||||
*
|
||||
* @param time Current sequencer tick value (see fluid_sequencer_get_tick()).
|
||||
* @param event The event being received
|
||||
* @param seq The sequencer instance
|
||||
* @param data User defined data registered with the client
|
||||
*
|
||||
* @note @p time may not be of the same tick value as the scheduled event! In fact, depending on
|
||||
* the sequencer's scale and the synth's sample-rate, @p time may be a few ticks too late. Although this
|
||||
* itself is inaudible, it is important to consider,
|
||||
* when you use this callback for enqueuing additional events over and over again with
|
||||
* fluid_sequencer_send_at(): If you enqueue new events with a relative tick value you might introduce
|
||||
* a timing error, which causes your sequence to sound e.g. slower than it's supposed to be. If this is
|
||||
* your use-case, make sure to enqueue events with an absolute tick value.
|
||||
*/
|
||||
typedef void (*fluid_event_callback_t)(unsigned int time, fluid_event_t *event,
|
||||
fluid_sequencer_t *seq, void *data);
|
||||
|
||||
|
||||
/** @startlifecycle{MIDI Sequencer} */
|
||||
FLUID_DEPRECATED FLUIDSYNTH_API fluid_sequencer_t *new_fluid_sequencer(void);
|
||||
FLUIDSYNTH_API fluid_sequencer_t *new_fluid_sequencer2(int use_system_timer);
|
||||
FLUIDSYNTH_API void delete_fluid_sequencer(fluid_sequencer_t *seq);
|
||||
/** @endlifecycle */
|
||||
|
||||
FLUIDSYNTH_API int fluid_sequencer_get_use_system_timer(fluid_sequencer_t *seq);
|
||||
FLUIDSYNTH_API
|
||||
fluid_seq_id_t fluid_sequencer_register_client(fluid_sequencer_t *seq, const char *name,
|
||||
fluid_event_callback_t callback, void *data);
|
||||
FLUIDSYNTH_API void fluid_sequencer_unregister_client(fluid_sequencer_t *seq, fluid_seq_id_t id);
|
||||
FLUIDSYNTH_API int fluid_sequencer_count_clients(fluid_sequencer_t *seq);
|
||||
FLUIDSYNTH_API fluid_seq_id_t fluid_sequencer_get_client_id(fluid_sequencer_t *seq, int index);
|
||||
FLUIDSYNTH_API char *fluid_sequencer_get_client_name(fluid_sequencer_t *seq, fluid_seq_id_t id);
|
||||
FLUIDSYNTH_API int fluid_sequencer_client_is_dest(fluid_sequencer_t *seq, fluid_seq_id_t id);
|
||||
FLUIDSYNTH_API void fluid_sequencer_process(fluid_sequencer_t *seq, unsigned int msec);
|
||||
FLUIDSYNTH_API void fluid_sequencer_send_now(fluid_sequencer_t *seq, fluid_event_t *evt);
|
||||
FLUIDSYNTH_API
|
||||
int fluid_sequencer_send_at(fluid_sequencer_t *seq, fluid_event_t *evt,
|
||||
unsigned int time, int absolute);
|
||||
FLUIDSYNTH_API
|
||||
void fluid_sequencer_remove_events(fluid_sequencer_t *seq, fluid_seq_id_t source, fluid_seq_id_t dest, int type);
|
||||
FLUIDSYNTH_API unsigned int fluid_sequencer_get_tick(fluid_sequencer_t *seq);
|
||||
FLUIDSYNTH_API void fluid_sequencer_set_time_scale(fluid_sequencer_t *seq, double scale);
|
||||
FLUIDSYNTH_API double fluid_sequencer_get_time_scale(fluid_sequencer_t *seq);
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _FLUIDSYNTH_SEQ_H */
|
||||
@@ -1,45 +0,0 @@
|
||||
/* FluidSynth - A Software Synthesizer
|
||||
*
|
||||
* Copyright (C) 2003 Peter Hanappe and others.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef _FLUIDSYNTH_SEQBIND_H
|
||||
#define _FLUIDSYNTH_SEQBIND_H
|
||||
|
||||
#include "seq.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @addtogroup sequencer
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
FLUIDSYNTH_API
|
||||
fluid_seq_id_t fluid_sequencer_register_fluidsynth(fluid_sequencer_t *seq, fluid_synth_t *synth);
|
||||
FLUIDSYNTH_API
|
||||
int fluid_sequencer_add_midi_event_to_buffer(void *data, fluid_midi_event_t *event);
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* _FLUIDSYNTH_SEQBIND_H */
|
||||
|
||||
@@ -1,197 +0,0 @@
|
||||
/* FluidSynth - A Software Synthesizer
|
||||
*
|
||||
* Copyright (C) 2003 Peter Hanappe and others.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef _FLUIDSYNTH_SETTINGS_H
|
||||
#define _FLUIDSYNTH_SETTINGS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup settings Settings
|
||||
*
|
||||
* Functions for settings management
|
||||
*
|
||||
* To create a synthesizer object you will have to specify its
|
||||
* settings. These settings are stored in a fluid_settings_t object.
|
||||
* @code
|
||||
* void
|
||||
* my_synthesizer ()
|
||||
* {
|
||||
* fluid_settings_t *settings;
|
||||
* fluid_synth_t *synth;
|
||||
* fluid_audio_driver_t *adriver;
|
||||
*
|
||||
* settings = new_fluid_settings ();
|
||||
* fluid_settings_setstr(settings, "audio.driver", "alsa");
|
||||
* // ... change settings ...
|
||||
* synth = new_fluid_synth (settings);
|
||||
* adriver = new_fluid_audio_driver (settings, synth);
|
||||
* // ...
|
||||
* }
|
||||
* @endcode
|
||||
* All string settings are encoded in UTF-8. This includes the names
|
||||
* of the audio and MIDI devices, exposed as setting options.
|
||||
*
|
||||
* @sa @ref CreatingSettings
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Hint FLUID_HINT_BOUNDED_BELOW indicates that the LowerBound field
|
||||
* of the FLUID_PortRangeHint should be considered meaningful. The
|
||||
* value in this field should be considered the (inclusive) lower
|
||||
* bound of the valid range. If FLUID_HINT_SAMPLE_RATE is also
|
||||
* specified then the value of LowerBound should be multiplied by the
|
||||
* sample rate.
|
||||
*/
|
||||
#define FLUID_HINT_BOUNDED_BELOW 0x1
|
||||
|
||||
/** Hint FLUID_HINT_BOUNDED_ABOVE indicates that the UpperBound field
|
||||
of the FLUID_PortRangeHint should be considered meaningful. The
|
||||
value in this field should be considered the (inclusive) upper
|
||||
bound of the valid range. If FLUID_HINT_SAMPLE_RATE is also
|
||||
specified then the value of UpperBound should be multiplied by the
|
||||
sample rate. */
|
||||
#define FLUID_HINT_BOUNDED_ABOVE 0x2
|
||||
|
||||
/**
|
||||
* Hint FLUID_HINT_TOGGLED indicates that the data item should be
|
||||
* considered a Boolean toggle. Data less than or equal to zero should
|
||||
* be considered `off' or `false,' and data above zero should be
|
||||
* considered `on' or `true.' FLUID_HINT_TOGGLED may not be used in
|
||||
* conjunction with any other hint.
|
||||
*/
|
||||
#define FLUID_HINT_TOGGLED 0x4
|
||||
|
||||
#define FLUID_HINT_OPTIONLIST 0x02 /**< Setting is a list of string options */
|
||||
|
||||
|
||||
/**
|
||||
* Settings type
|
||||
*
|
||||
* Each setting has a defined type: numeric (double), integer, string or a
|
||||
* set of values. The type of each setting can be retrieved using the
|
||||
* function fluid_settings_get_type()
|
||||
*/
|
||||
enum fluid_types_enum
|
||||
{
|
||||
FLUID_NO_TYPE = -1, /**< Undefined type */
|
||||
FLUID_NUM_TYPE, /**< Numeric (double) */
|
||||
FLUID_INT_TYPE, /**< Integer */
|
||||
FLUID_STR_TYPE, /**< String */
|
||||
FLUID_SET_TYPE /**< Set of values */
|
||||
};
|
||||
|
||||
/** @startlifecycle{Settings} */
|
||||
FLUIDSYNTH_API fluid_settings_t *new_fluid_settings(void);
|
||||
FLUIDSYNTH_API void delete_fluid_settings(fluid_settings_t *settings);
|
||||
/** @endlifecycle */
|
||||
|
||||
FLUIDSYNTH_API
|
||||
int fluid_settings_get_type(fluid_settings_t *settings, const char *name);
|
||||
|
||||
FLUIDSYNTH_API
|
||||
int fluid_settings_get_hints(fluid_settings_t *settings, const char *name, int *val);
|
||||
|
||||
FLUIDSYNTH_API
|
||||
int fluid_settings_is_realtime(fluid_settings_t *settings, const char *name);
|
||||
|
||||
FLUIDSYNTH_API
|
||||
int fluid_settings_setstr(fluid_settings_t *settings, const char *name, const char *str);
|
||||
|
||||
FLUIDSYNTH_API
|
||||
int fluid_settings_copystr(fluid_settings_t *settings, const char *name, char *str, int len);
|
||||
|
||||
FLUIDSYNTH_API
|
||||
int fluid_settings_dupstr(fluid_settings_t *settings, const char *name, char **str);
|
||||
|
||||
FLUIDSYNTH_API
|
||||
int fluid_settings_getstr_default(fluid_settings_t *settings, const char *name, char **def);
|
||||
|
||||
FLUIDSYNTH_API
|
||||
int fluid_settings_str_equal(fluid_settings_t *settings, const char *name, const char *value);
|
||||
|
||||
FLUIDSYNTH_API
|
||||
int fluid_settings_setnum(fluid_settings_t *settings, const char *name, double val);
|
||||
|
||||
FLUIDSYNTH_API
|
||||
int fluid_settings_getnum(fluid_settings_t *settings, const char *name, double *val);
|
||||
|
||||
FLUIDSYNTH_API
|
||||
int fluid_settings_getnum_default(fluid_settings_t *settings, const char *name, double *val);
|
||||
|
||||
FLUIDSYNTH_API
|
||||
int fluid_settings_getnum_range(fluid_settings_t *settings, const char *name,
|
||||
double *min, double *max);
|
||||
|
||||
FLUIDSYNTH_API
|
||||
int fluid_settings_setint(fluid_settings_t *settings, const char *name, int val);
|
||||
|
||||
FLUIDSYNTH_API
|
||||
int fluid_settings_getint(fluid_settings_t *settings, const char *name, int *val);
|
||||
|
||||
FLUIDSYNTH_API
|
||||
int fluid_settings_getint_default(fluid_settings_t *settings, const char *name, int *val);
|
||||
|
||||
FLUIDSYNTH_API
|
||||
int fluid_settings_getint_range(fluid_settings_t *settings, const char *name,
|
||||
int *min, int *max);
|
||||
|
||||
/**
|
||||
* Callback function type used with fluid_settings_foreach_option()
|
||||
*
|
||||
* @param data User defined data pointer
|
||||
* @param name Setting name
|
||||
* @param option A string option for this setting (iterates through the list)
|
||||
*/
|
||||
typedef void (*fluid_settings_foreach_option_t)(void *data, const char *name, const char *option);
|
||||
|
||||
FLUIDSYNTH_API
|
||||
void fluid_settings_foreach_option(fluid_settings_t *settings,
|
||||
const char *name, void *data,
|
||||
fluid_settings_foreach_option_t func);
|
||||
FLUIDSYNTH_API
|
||||
int fluid_settings_option_count(fluid_settings_t *settings, const char *name);
|
||||
FLUIDSYNTH_API char *fluid_settings_option_concat(fluid_settings_t *settings,
|
||||
const char *name,
|
||||
const char *separator);
|
||||
|
||||
/**
|
||||
* Callback function type used with fluid_settings_foreach()
|
||||
*
|
||||
* @param data User defined data pointer
|
||||
* @param name Setting name
|
||||
* @param type Setting type (#fluid_types_enum)
|
||||
*/
|
||||
typedef void (*fluid_settings_foreach_t)(void *data, const char *name, int type);
|
||||
|
||||
FLUIDSYNTH_API
|
||||
void fluid_settings_foreach(fluid_settings_t *settings, void *data,
|
||||
fluid_settings_foreach_t func);
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _FLUIDSYNTH_SETTINGS_H */
|
||||
@@ -1,362 +0,0 @@
|
||||
/* FluidSynth - A Software Synthesizer
|
||||
*
|
||||
* Copyright (C) 2003 Peter Hanappe and others.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef _FLUIDSYNTH_SFONT_H
|
||||
#define _FLUIDSYNTH_SFONT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup soundfonts SoundFonts
|
||||
*
|
||||
* SoundFont related functions
|
||||
*
|
||||
* This part of the API contains functions, defines and types that are mostly
|
||||
* only used by internal or custom SoundFont loaders or client code that
|
||||
* modifies loaded presets, SoundFonts or voices directly.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup soundfont_loader SoundFont Loader
|
||||
* @ingroup soundfonts
|
||||
*
|
||||
* Create custom SoundFont loaders
|
||||
*
|
||||
* It is possible to add new SoundFont loaders to the
|
||||
* synthesizer. This API allows for virtual SoundFont files to be loaded
|
||||
* and synthesized, which may not actually be SoundFont files, as long as they
|
||||
* can be represented by the SoundFont synthesis model.
|
||||
*
|
||||
* To add a new SoundFont loader to the synthesizer, call
|
||||
* fluid_synth_add_sfloader() and pass a pointer to an
|
||||
* #fluid_sfloader_t instance created by new_fluid_sfloader().
|
||||
* On creation, you must specify a callback function \p load
|
||||
* that will be called for every file attempting to load it and
|
||||
* if successful returns a #fluid_sfont_t instance, or NULL if it fails.
|
||||
*
|
||||
* The #fluid_sfont_t structure contains a callback to obtain the
|
||||
* name of the SoundFont. It contains two functions to iterate
|
||||
* though the contained presets, and one function to obtain a
|
||||
* preset corresponding to a bank and preset number. This
|
||||
* function should return a #fluid_preset_t instance.
|
||||
*
|
||||
* The #fluid_preset_t instance contains some functions to obtain
|
||||
* information from the preset (name, bank, number). The most
|
||||
* important callback is the noteon function. The noteon function
|
||||
* is called by fluidsynth internally and
|
||||
* should call fluid_synth_alloc_voice() for every sample that has
|
||||
* to be played. fluid_synth_alloc_voice() expects a pointer to a
|
||||
* #fluid_sample_t instance and returns a pointer to the opaque
|
||||
* #fluid_voice_t structure. To set or increment the values of a
|
||||
* generator, use fluid_voice_gen_set() or fluid_voice_gen_incr(). When you are
|
||||
* finished initializing the voice call fluid_voice_start() to
|
||||
* start playing the synthesis voice.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Some notification enums for presets and samples.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
FLUID_PRESET_SELECTED, /**< Preset selected notify */
|
||||
FLUID_PRESET_UNSELECTED, /**< Preset unselected notify */
|
||||
FLUID_SAMPLE_DONE, /**< Sample no longer needed notify */
|
||||
FLUID_PRESET_PIN, /**< Request to pin preset samples to cache */
|
||||
FLUID_PRESET_UNPIN /**< Request to unpin preset samples from cache */
|
||||
};
|
||||
|
||||
/**
|
||||
* Indicates the type of a sample used by the _fluid_sample_t::sampletype field.
|
||||
*
|
||||
* This enum corresponds to the \c SFSampleLink enum in the SoundFont spec.
|
||||
* One \c flag may be bit-wise OR-ed with one \c value.
|
||||
*/
|
||||
enum fluid_sample_type
|
||||
{
|
||||
FLUID_SAMPLETYPE_MONO = 0x1, /**< Value used for mono samples */
|
||||
FLUID_SAMPLETYPE_RIGHT = 0x2, /**< Value used for right samples of a stereo pair */
|
||||
FLUID_SAMPLETYPE_LEFT = 0x4, /**< Value used for left samples of a stereo pair */
|
||||
FLUID_SAMPLETYPE_LINKED = 0x8, /**< Value used for linked sample, which is currently not supported */
|
||||
FLUID_SAMPLETYPE_OGG_VORBIS = 0x10, /**< Flag used for Ogg Vorbis compressed samples (non-standard compliant extension) as found in the program "sftools" developed by Werner Schweer from MuseScore @since 1.1.7 */
|
||||
FLUID_SAMPLETYPE_ROM = 0x8000 /**< Flag that indicates ROM samples, causing the sample to be ignored */
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Method to load an instrument file (does not actually need to be a real file name,
|
||||
* could be another type of string identifier that the \a loader understands).
|
||||
*
|
||||
* @param loader SoundFont loader
|
||||
* @param filename File name or other string identifier
|
||||
* @return The loaded instrument file (SoundFont) or NULL if an error occurred.
|
||||
*/
|
||||
typedef fluid_sfont_t *(*fluid_sfloader_load_t)(fluid_sfloader_t *loader, const char *filename);
|
||||
|
||||
/**
|
||||
* The free method should free the memory allocated for a fluid_sfloader_t instance in
|
||||
* addition to any private data.
|
||||
*
|
||||
* @param loader SoundFont loader
|
||||
*
|
||||
* Any custom user provided cleanup function must ultimately call
|
||||
* delete_fluid_sfloader() to ensure proper cleanup of the #fluid_sfloader_t struct. If no private data
|
||||
* needs to be freed, setting this to delete_fluid_sfloader() is sufficient.
|
||||
*
|
||||
*/
|
||||
typedef void (*fluid_sfloader_free_t)(fluid_sfloader_t *loader);
|
||||
|
||||
|
||||
/** @startlifecycle{SoundFont Loader} */
|
||||
FLUIDSYNTH_API fluid_sfloader_t *new_fluid_sfloader(fluid_sfloader_load_t load, fluid_sfloader_free_t free);
|
||||
FLUIDSYNTH_API void delete_fluid_sfloader(fluid_sfloader_t *loader);
|
||||
|
||||
FLUIDSYNTH_API fluid_sfloader_t *new_fluid_defsfloader(fluid_settings_t *settings);
|
||||
/** @endlifecycle */
|
||||
|
||||
/**
|
||||
* Opens the file or memory indicated by \c filename in binary read mode.
|
||||
*
|
||||
* @return returns a file handle on success, NULL otherwise
|
||||
*
|
||||
* \c filename matches the string provided during the fluid_synth_sfload() call.
|
||||
*/
|
||||
typedef void *(* fluid_sfloader_callback_open_t)(const char *filename);
|
||||
|
||||
/**
|
||||
* Reads \c count bytes to the specified buffer \c buf.
|
||||
*
|
||||
* @return returns #FLUID_OK if exactly \c count bytes were successfully read, else returns #FLUID_FAILED and leaves \a buf unmodified.
|
||||
*/
|
||||
typedef int (* fluid_sfloader_callback_read_t)(void *buf, fluid_long_long_t count, void *handle);
|
||||
|
||||
/**
|
||||
* Same purpose and behaviour as fseek.
|
||||
*
|
||||
* @param origin either \c SEEK_SET, \c SEEK_CUR or \c SEEK_END
|
||||
* @return returns #FLUID_OK if the seek was successfully performed while not seeking beyond a buffer or file, #FLUID_FAILED otherwise
|
||||
*/
|
||||
typedef int (* fluid_sfloader_callback_seek_t)(void *handle, fluid_long_long_t offset, int origin);
|
||||
|
||||
/**
|
||||
* Closes the handle returned by #fluid_sfloader_callback_open_t and frees used resources.
|
||||
*
|
||||
* @return returns #FLUID_OK on success, #FLUID_FAILED on error
|
||||
*/
|
||||
typedef int (* fluid_sfloader_callback_close_t)(void *handle);
|
||||
|
||||
/** @return returns current file offset or #FLUID_FAILED on error */
|
||||
typedef fluid_long_long_t (* fluid_sfloader_callback_tell_t)(void *handle);
|
||||
|
||||
|
||||
FLUIDSYNTH_API int fluid_sfloader_set_callbacks(fluid_sfloader_t *loader,
|
||||
fluid_sfloader_callback_open_t open,
|
||||
fluid_sfloader_callback_read_t read,
|
||||
fluid_sfloader_callback_seek_t seek,
|
||||
fluid_sfloader_callback_tell_t tell,
|
||||
fluid_sfloader_callback_close_t close);
|
||||
|
||||
FLUIDSYNTH_API int fluid_sfloader_set_data(fluid_sfloader_t *loader, void *data);
|
||||
FLUIDSYNTH_API void *fluid_sfloader_get_data(fluid_sfloader_t *loader);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Method to return the name of a virtual SoundFont.
|
||||
*
|
||||
* @param sfont Virtual SoundFont
|
||||
* @return The name of the virtual SoundFont.
|
||||
*/
|
||||
typedef const char *(*fluid_sfont_get_name_t)(fluid_sfont_t *sfont);
|
||||
|
||||
/**
|
||||
* Get a virtual SoundFont preset by bank and program numbers.
|
||||
*
|
||||
* @param sfont Virtual SoundFont
|
||||
* @param bank MIDI bank number (0-16383)
|
||||
* @param prenum MIDI preset number (0-127)
|
||||
* @return Should return an allocated virtual preset or NULL if it could not
|
||||
* be found.
|
||||
*/
|
||||
typedef fluid_preset_t *(*fluid_sfont_get_preset_t)(fluid_sfont_t *sfont, int bank, int prenum);
|
||||
|
||||
/**
|
||||
* Start virtual SoundFont preset iteration method.
|
||||
*
|
||||
* @param sfont Virtual SoundFont
|
||||
*
|
||||
* Starts/re-starts virtual preset iteration in a SoundFont.
|
||||
*/
|
||||
typedef void (*fluid_sfont_iteration_start_t)(fluid_sfont_t *sfont);
|
||||
|
||||
/**
|
||||
* Virtual SoundFont preset iteration function.
|
||||
*
|
||||
* @param sfont Virtual SoundFont
|
||||
* @return NULL when no more presets are available, otherwise the a pointer to the current preset
|
||||
*
|
||||
* Returns preset information to the caller. The returned buffer is only valid until a subsequent
|
||||
* call to this function.
|
||||
*/
|
||||
typedef fluid_preset_t *(*fluid_sfont_iteration_next_t)(fluid_sfont_t *sfont);
|
||||
|
||||
/**
|
||||
* Method to free a virtual SoundFont bank.
|
||||
*
|
||||
* @param sfont Virtual SoundFont to free.
|
||||
* @return Should return 0 when it was able to free all resources or non-zero
|
||||
* if some of the samples could not be freed because they are still in use,
|
||||
* in which case the free will be tried again later, until success.
|
||||
*
|
||||
* Any custom user provided cleanup function must ultimately call
|
||||
* delete_fluid_sfont() to ensure proper cleanup of the #fluid_sfont_t struct. If no private data
|
||||
* needs to be freed, setting this to delete_fluid_sfont() is sufficient.
|
||||
*/
|
||||
typedef int (*fluid_sfont_free_t)(fluid_sfont_t *sfont);
|
||||
|
||||
|
||||
/** @startlifecycle{SoundFont} */
|
||||
FLUIDSYNTH_API fluid_sfont_t *new_fluid_sfont(fluid_sfont_get_name_t get_name,
|
||||
fluid_sfont_get_preset_t get_preset,
|
||||
fluid_sfont_iteration_start_t iter_start,
|
||||
fluid_sfont_iteration_next_t iter_next,
|
||||
fluid_sfont_free_t free);
|
||||
|
||||
FLUIDSYNTH_API int delete_fluid_sfont(fluid_sfont_t *sfont);
|
||||
/** @endlifecycle */
|
||||
|
||||
FLUIDSYNTH_API int fluid_sfont_set_data(fluid_sfont_t *sfont, void *data);
|
||||
FLUIDSYNTH_API void *fluid_sfont_get_data(fluid_sfont_t *sfont);
|
||||
|
||||
FLUIDSYNTH_API int fluid_sfont_get_id(fluid_sfont_t *sfont);
|
||||
FLUIDSYNTH_API const char *fluid_sfont_get_name(fluid_sfont_t *sfont);
|
||||
FLUIDSYNTH_API fluid_preset_t *fluid_sfont_get_preset(fluid_sfont_t *sfont, int bank, int prenum);
|
||||
FLUIDSYNTH_API void fluid_sfont_iteration_start(fluid_sfont_t *sfont);
|
||||
FLUIDSYNTH_API fluid_preset_t *fluid_sfont_iteration_next(fluid_sfont_t *sfont);
|
||||
|
||||
/**
|
||||
* Method to get a virtual SoundFont preset name.
|
||||
*
|
||||
* @param preset Virtual SoundFont preset
|
||||
* @return Should return the name of the preset. The returned string must be
|
||||
* valid for the duration of the virtual preset (or the duration of the
|
||||
* SoundFont, in the case of preset iteration).
|
||||
*/
|
||||
typedef const char *(*fluid_preset_get_name_t)(fluid_preset_t *preset);
|
||||
|
||||
/**
|
||||
* Method to get a virtual SoundFont preset MIDI bank number.
|
||||
*
|
||||
* @param preset Virtual SoundFont preset
|
||||
* @param return The bank number of the preset
|
||||
*/
|
||||
typedef int (*fluid_preset_get_banknum_t)(fluid_preset_t *preset);
|
||||
|
||||
/**
|
||||
* Method to get a virtual SoundFont preset MIDI program number.
|
||||
*
|
||||
* @param preset Virtual SoundFont preset
|
||||
* @param return The program number of the preset
|
||||
*/
|
||||
typedef int (*fluid_preset_get_num_t)(fluid_preset_t *preset);
|
||||
|
||||
/**
|
||||
* Method to handle a noteon event (synthesize the instrument).
|
||||
*
|
||||
* @param preset Virtual SoundFont preset
|
||||
* @param synth Synthesizer instance
|
||||
* @param chan MIDI channel number of the note on event
|
||||
* @param key MIDI note number (0-127)
|
||||
* @param vel MIDI velocity (0-127)
|
||||
* @return #FLUID_OK on success (0) or #FLUID_FAILED (-1) otherwise
|
||||
*
|
||||
* This method may be called from within synthesis context and therefore
|
||||
* should be as efficient as possible and not perform any operations considered
|
||||
* bad for realtime audio output (memory allocations and other OS calls).
|
||||
*
|
||||
* Call fluid_synth_alloc_voice() for every sample that has
|
||||
* to be played. fluid_synth_alloc_voice() expects a pointer to a
|
||||
* #fluid_sample_t structure and returns a pointer to the opaque
|
||||
* #fluid_voice_t structure. To set or increment the values of a
|
||||
* generator, use fluid_voice_gen_set() or fluid_voice_gen_incr(). When you are
|
||||
* finished initializing the voice call fluid_voice_start() to
|
||||
* start playing the synthesis voice. Starting with FluidSynth 1.1.0 all voices
|
||||
* created will be started at the same time.
|
||||
*/
|
||||
typedef int (*fluid_preset_noteon_t)(fluid_preset_t *preset, fluid_synth_t *synth, int chan, int key, int vel);
|
||||
|
||||
/**
|
||||
* Method to free a virtual SoundFont preset.
|
||||
*
|
||||
* @param preset Virtual SoundFont preset
|
||||
* @return Should return 0
|
||||
*
|
||||
* Any custom user provided cleanup function must ultimately call
|
||||
* delete_fluid_preset() to ensure proper cleanup of the #fluid_preset_t struct. If no private data
|
||||
* needs to be freed, setting this to delete_fluid_preset() is sufficient.
|
||||
*/
|
||||
typedef void (*fluid_preset_free_t)(fluid_preset_t *preset);
|
||||
|
||||
/** @startlifecycle{Preset} */
|
||||
FLUIDSYNTH_API fluid_preset_t *new_fluid_preset(fluid_sfont_t *parent_sfont,
|
||||
fluid_preset_get_name_t get_name,
|
||||
fluid_preset_get_banknum_t get_bank,
|
||||
fluid_preset_get_num_t get_num,
|
||||
fluid_preset_noteon_t noteon,
|
||||
fluid_preset_free_t free);
|
||||
FLUIDSYNTH_API void delete_fluid_preset(fluid_preset_t *preset);
|
||||
/** @endlifecycle */
|
||||
|
||||
FLUIDSYNTH_API int fluid_preset_set_data(fluid_preset_t *preset, void *data);
|
||||
FLUIDSYNTH_API void *fluid_preset_get_data(fluid_preset_t *preset);
|
||||
|
||||
FLUIDSYNTH_API const char *fluid_preset_get_name(fluid_preset_t *preset);
|
||||
FLUIDSYNTH_API int fluid_preset_get_banknum(fluid_preset_t *preset);
|
||||
FLUIDSYNTH_API int fluid_preset_get_num(fluid_preset_t *preset);
|
||||
FLUIDSYNTH_API fluid_sfont_t *fluid_preset_get_sfont(fluid_preset_t *preset);
|
||||
|
||||
/** @startlifecycle{Sample} */
|
||||
FLUIDSYNTH_API fluid_sample_t *new_fluid_sample(void);
|
||||
FLUIDSYNTH_API void delete_fluid_sample(fluid_sample_t *sample);
|
||||
/** @endlifecycle */
|
||||
|
||||
FLUIDSYNTH_API size_t fluid_sample_sizeof(void);
|
||||
|
||||
FLUIDSYNTH_API int fluid_sample_set_name(fluid_sample_t *sample, const char *name);
|
||||
FLUIDSYNTH_API int fluid_sample_set_sound_data(fluid_sample_t *sample,
|
||||
short *data,
|
||||
char *data24,
|
||||
unsigned int nbframes,
|
||||
unsigned int sample_rate,
|
||||
short copy_data);
|
||||
|
||||
FLUIDSYNTH_API int fluid_sample_set_loop(fluid_sample_t *sample, unsigned int loop_start, unsigned int loop_end);
|
||||
FLUIDSYNTH_API int fluid_sample_set_pitch(fluid_sample_t *sample, int root_key, int fine_tune);
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _FLUIDSYNTH_SFONT_H */
|
||||
@@ -1,150 +0,0 @@
|
||||
/* FluidSynth - A Software Synthesizer
|
||||
*
|
||||
* Copyright (C) 2003 Peter Hanappe and others.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef _FLUIDSYNTH_SHELL_H
|
||||
#define _FLUIDSYNTH_SHELL_H
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup command_interface Command Interface
|
||||
*
|
||||
* Control and configuration interface
|
||||
*
|
||||
* The command interface allows you to send textual commands to
|
||||
* the synthesizer, to parse a command file, or to read commands
|
||||
* from the stdin or other input streams (like a TCP socket).
|
||||
*
|
||||
* For a full list of available commands, type \c help in the
|
||||
* \ref command_shell or send the same command via a command handler.
|
||||
* Further documentation can be found at
|
||||
* https://github.com/FluidSynth/fluidsynth/wiki/UserManual#shell-commands
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
FLUIDSYNTH_API fluid_istream_t fluid_get_stdin(void);
|
||||
FLUIDSYNTH_API fluid_ostream_t fluid_get_stdout(void);
|
||||
FLUIDSYNTH_API char *fluid_get_userconf(char *buf, int len);
|
||||
FLUIDSYNTH_API char *fluid_get_sysconf(char *buf, int len);
|
||||
/** @} */
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup command_handler Command Handler
|
||||
* @ingroup command_interface
|
||||
* @brief Handles text commands and reading of configuration files
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @startlifecycle{Command Handler} */
|
||||
FLUIDSYNTH_API
|
||||
fluid_cmd_handler_t *new_fluid_cmd_handler(fluid_synth_t *synth, fluid_midi_router_t *router);
|
||||
|
||||
FLUIDSYNTH_API
|
||||
fluid_cmd_handler_t *new_fluid_cmd_handler2(fluid_settings_t *settings, fluid_synth_t *synth,
|
||||
fluid_midi_router_t *router, fluid_player_t *player);
|
||||
|
||||
FLUIDSYNTH_API
|
||||
void delete_fluid_cmd_handler(fluid_cmd_handler_t *handler);
|
||||
/** @endlifecycle */
|
||||
|
||||
FLUIDSYNTH_API
|
||||
void fluid_cmd_handler_set_synth(fluid_cmd_handler_t *handler, fluid_synth_t *synth);
|
||||
|
||||
FLUIDSYNTH_API
|
||||
int fluid_command(fluid_cmd_handler_t *handler, const char *cmd, fluid_ostream_t out);
|
||||
|
||||
FLUIDSYNTH_API
|
||||
int fluid_source(fluid_cmd_handler_t *handler, const char *filename);
|
||||
/** @} */
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup command_shell Command Shell
|
||||
* @ingroup command_interface
|
||||
*
|
||||
* Interactive shell to control and configure a synthesizer instance.
|
||||
*
|
||||
* If you need a platform independent way to get the standard input
|
||||
* and output streams, use fluid_get_stdin() and fluid_get_stdout().
|
||||
*
|
||||
* For a full list of available commands, type \c help in the shell.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @startlifecycle{Command Shell} */
|
||||
FLUIDSYNTH_API
|
||||
fluid_shell_t *new_fluid_shell(fluid_settings_t *settings, fluid_cmd_handler_t *handler,
|
||||
fluid_istream_t in, fluid_ostream_t out, int thread);
|
||||
|
||||
FLUIDSYNTH_API
|
||||
void fluid_usershell(fluid_settings_t *settings, fluid_cmd_handler_t *handler);
|
||||
|
||||
FLUIDSYNTH_API void delete_fluid_shell(fluid_shell_t *shell);
|
||||
/** @endlifecycle */
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup command_server Command Server
|
||||
* @ingroup command_interface
|
||||
*
|
||||
* TCP socket server for a command handler.
|
||||
*
|
||||
* The socket server will open the TCP port set by \ref settings_shell_port
|
||||
* (default 9800) and starts a new thread and \ref command_handler for each
|
||||
* incoming connection.
|
||||
*
|
||||
* @note The server is only available if libfluidsynth has been compiled
|
||||
* with network support (enable-network). Without network support, all related
|
||||
* functions will return FLUID_FAILED or NULL.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @startlifecycle{Command Server} */
|
||||
FLUIDSYNTH_API
|
||||
fluid_server_t *new_fluid_server(fluid_settings_t *settings,
|
||||
fluid_synth_t *synth, fluid_midi_router_t *router);
|
||||
|
||||
FLUIDSYNTH_API
|
||||
fluid_server_t *new_fluid_server2(fluid_settings_t *settings,
|
||||
fluid_synth_t *synth, fluid_midi_router_t *router,
|
||||
fluid_player_t *player);
|
||||
|
||||
FLUIDSYNTH_API void delete_fluid_server(fluid_server_t *server);
|
||||
|
||||
FLUIDSYNTH_API int fluid_server_join(fluid_server_t *server);
|
||||
/** @endlifecycle */
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _FLUIDSYNTH_SHELL_H */
|
||||
@@ -1,559 +0,0 @@
|
||||
/* FluidSynth - A Software Synthesizer
|
||||
*
|
||||
* Copyright (C) 2003 Peter Hanappe and others.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef _FLUIDSYNTH_SYNTH_H
|
||||
#define _FLUIDSYNTH_SYNTH_H
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup synth Synthesizer
|
||||
*
|
||||
* SoundFont synthesizer
|
||||
*
|
||||
* You create a new synthesizer with new_fluid_synth() and you destroy
|
||||
* it with delete_fluid_synth(). Use the fluid_settings_t structure to specify
|
||||
* the synthesizer characteristics.
|
||||
*
|
||||
* You have to load a SoundFont in order to hear any sound. For that
|
||||
* you use the fluid_synth_sfload() function.
|
||||
*
|
||||
* You can use the audio driver functions to open
|
||||
* the audio device and create a background audio thread.
|
||||
*
|
||||
* The API for sending MIDI events is probably what you expect:
|
||||
* fluid_synth_noteon(), fluid_synth_noteoff(), ...
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @startlifecycle{Synthesizer} */
|
||||
FLUIDSYNTH_API fluid_synth_t *new_fluid_synth(fluid_settings_t *settings);
|
||||
FLUIDSYNTH_API void delete_fluid_synth(fluid_synth_t *synth);
|
||||
/** @endlifecycle */
|
||||
|
||||
FLUIDSYNTH_API double fluid_synth_get_cpu_load(fluid_synth_t *synth);
|
||||
FLUID_DEPRECATED FLUIDSYNTH_API const char *fluid_synth_error(fluid_synth_t *synth);
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @defgroup midi_messages MIDI Channel Messages
|
||||
* @ingroup synth
|
||||
*
|
||||
* The MIDI channel message functions are mostly directly named after their
|
||||
* counterpart MIDI messages. They are a high-level interface to controlling
|
||||
* the synthesizer, playing notes and changing note and channel parameters.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
FLUIDSYNTH_API int fluid_synth_noteon(fluid_synth_t *synth, int chan, int key, int vel);
|
||||
FLUIDSYNTH_API int fluid_synth_noteoff(fluid_synth_t *synth, int chan, int key);
|
||||
FLUIDSYNTH_API int fluid_synth_cc(fluid_synth_t *synth, int chan, int ctrl, int val);
|
||||
FLUIDSYNTH_API int fluid_synth_get_cc(fluid_synth_t *synth, int chan, int ctrl, int *pval);
|
||||
FLUIDSYNTH_API int fluid_synth_sysex(fluid_synth_t *synth, const char *data, int len,
|
||||
char *response, int *response_len, int *handled, int dryrun);
|
||||
FLUIDSYNTH_API int fluid_synth_pitch_bend(fluid_synth_t *synth, int chan, int val);
|
||||
FLUIDSYNTH_API int fluid_synth_get_pitch_bend(fluid_synth_t *synth, int chan, int *ppitch_bend);
|
||||
FLUIDSYNTH_API int fluid_synth_pitch_wheel_sens(fluid_synth_t *synth, int chan, int val);
|
||||
FLUIDSYNTH_API int fluid_synth_get_pitch_wheel_sens(fluid_synth_t *synth, int chan, int *pval);
|
||||
FLUIDSYNTH_API int fluid_synth_program_change(fluid_synth_t *synth, int chan, int program);
|
||||
FLUIDSYNTH_API int fluid_synth_channel_pressure(fluid_synth_t *synth, int chan, int val);
|
||||
FLUIDSYNTH_API int fluid_synth_key_pressure(fluid_synth_t *synth, int chan, int key, int val);
|
||||
FLUIDSYNTH_API int fluid_synth_bank_select(fluid_synth_t *synth, int chan, int bank);
|
||||
FLUIDSYNTH_API int fluid_synth_sfont_select(fluid_synth_t *synth, int chan, int sfont_id);
|
||||
FLUIDSYNTH_API
|
||||
int fluid_synth_program_select(fluid_synth_t *synth, int chan, int sfont_id,
|
||||
int bank_num, int preset_num);
|
||||
FLUIDSYNTH_API int
|
||||
fluid_synth_program_select_by_sfont_name(fluid_synth_t *synth, int chan,
|
||||
const char *sfont_name, int bank_num,
|
||||
int preset_num);
|
||||
FLUIDSYNTH_API
|
||||
int fluid_synth_get_program(fluid_synth_t *synth, int chan, int *sfont_id,
|
||||
int *bank_num, int *preset_num);
|
||||
FLUIDSYNTH_API int fluid_synth_unset_program(fluid_synth_t *synth, int chan);
|
||||
FLUIDSYNTH_API int fluid_synth_program_reset(fluid_synth_t *synth);
|
||||
FLUIDSYNTH_API int fluid_synth_system_reset(fluid_synth_t *synth);
|
||||
|
||||
FLUIDSYNTH_API int fluid_synth_all_notes_off(fluid_synth_t *synth, int chan);
|
||||
FLUIDSYNTH_API int fluid_synth_all_sounds_off(fluid_synth_t *synth, int chan);
|
||||
|
||||
FLUIDSYNTH_API int fluid_synth_set_gen(fluid_synth_t *synth, int chan,
|
||||
int param, float value);
|
||||
FLUIDSYNTH_API float fluid_synth_get_gen(fluid_synth_t *synth, int chan, int param);
|
||||
/** @} MIDI Channel Messages */
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup voice_control Synthesis Voice Control
|
||||
* @ingroup synth
|
||||
*
|
||||
* Low-level access to synthesis voices.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
FLUIDSYNTH_API int fluid_synth_start(fluid_synth_t *synth, unsigned int id,
|
||||
fluid_preset_t *preset, int audio_chan,
|
||||
int midi_chan, int key, int vel);
|
||||
FLUIDSYNTH_API int fluid_synth_stop(fluid_synth_t *synth, unsigned int id);
|
||||
|
||||
FLUIDSYNTH_API fluid_voice_t *fluid_synth_alloc_voice(fluid_synth_t *synth,
|
||||
fluid_sample_t *sample,
|
||||
int channum, int key, int vel);
|
||||
FLUIDSYNTH_API void fluid_synth_start_voice(fluid_synth_t *synth, fluid_voice_t *voice);
|
||||
FLUIDSYNTH_API void fluid_synth_get_voicelist(fluid_synth_t *synth,
|
||||
fluid_voice_t *buf[], int bufsize, int ID);
|
||||
/** @} Voice Control */
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup soundfont_management SoundFont Management
|
||||
* @ingroup synth
|
||||
*
|
||||
* Functions to load and unload SoundFonts.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
FLUIDSYNTH_API
|
||||
int fluid_synth_sfload(fluid_synth_t *synth, const char *filename, int reset_presets);
|
||||
FLUIDSYNTH_API int fluid_synth_sfreload(fluid_synth_t *synth, int id);
|
||||
FLUIDSYNTH_API int fluid_synth_sfunload(fluid_synth_t *synth, int id, int reset_presets);
|
||||
FLUIDSYNTH_API int fluid_synth_add_sfont(fluid_synth_t *synth, fluid_sfont_t *sfont);
|
||||
FLUIDSYNTH_API int fluid_synth_remove_sfont(fluid_synth_t *synth, fluid_sfont_t *sfont);
|
||||
FLUIDSYNTH_API int fluid_synth_sfcount(fluid_synth_t *synth);
|
||||
FLUIDSYNTH_API fluid_sfont_t *fluid_synth_get_sfont(fluid_synth_t *synth, unsigned int num);
|
||||
FLUIDSYNTH_API fluid_sfont_t *fluid_synth_get_sfont_by_id(fluid_synth_t *synth, int id);
|
||||
FLUIDSYNTH_API fluid_sfont_t *fluid_synth_get_sfont_by_name(fluid_synth_t *synth,
|
||||
const char *name);
|
||||
FLUIDSYNTH_API int fluid_synth_set_bank_offset(fluid_synth_t *synth, int sfont_id, int offset);
|
||||
FLUIDSYNTH_API int fluid_synth_get_bank_offset(fluid_synth_t *synth, int sfont_id);
|
||||
/** @} Soundfont Management */
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup reverb_effect Effect - Reverb
|
||||
* @ingroup synth
|
||||
*
|
||||
* Functions for configuring the built-in reverb effect
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
FLUID_DEPRECATED FLUIDSYNTH_API void fluid_synth_set_reverb_on(fluid_synth_t *synth, int on);
|
||||
FLUIDSYNTH_API int fluid_synth_reverb_on(fluid_synth_t *synth, int fx_group, int on);
|
||||
|
||||
FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_set_reverb(fluid_synth_t *synth, double roomsize,
|
||||
double damping, double width, double level);
|
||||
FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_set_reverb_roomsize(fluid_synth_t *synth, double roomsize);
|
||||
FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_set_reverb_damp(fluid_synth_t *synth, double damping);
|
||||
FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_set_reverb_width(fluid_synth_t *synth, double width);
|
||||
FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_set_reverb_level(fluid_synth_t *synth, double level);
|
||||
|
||||
FLUID_DEPRECATED FLUIDSYNTH_API double fluid_synth_get_reverb_roomsize(fluid_synth_t *synth);
|
||||
FLUID_DEPRECATED FLUIDSYNTH_API double fluid_synth_get_reverb_damp(fluid_synth_t *synth);
|
||||
FLUID_DEPRECATED FLUIDSYNTH_API double fluid_synth_get_reverb_level(fluid_synth_t *synth);
|
||||
FLUID_DEPRECATED FLUIDSYNTH_API double fluid_synth_get_reverb_width(fluid_synth_t *synth);
|
||||
|
||||
FLUIDSYNTH_API int fluid_synth_set_reverb_group_roomsize(fluid_synth_t *synth, int fx_group, double roomsize);
|
||||
FLUIDSYNTH_API int fluid_synth_set_reverb_group_damp(fluid_synth_t *synth, int fx_group, double damping);
|
||||
FLUIDSYNTH_API int fluid_synth_set_reverb_group_width(fluid_synth_t *synth, int fx_group, double width);
|
||||
FLUIDSYNTH_API int fluid_synth_set_reverb_group_level(fluid_synth_t *synth, int fx_group, double level);
|
||||
|
||||
FLUIDSYNTH_API int fluid_synth_get_reverb_group_roomsize(fluid_synth_t *synth, int fx_group, double *roomsize);
|
||||
FLUIDSYNTH_API int fluid_synth_get_reverb_group_damp(fluid_synth_t *synth, int fx_group, double *damping);
|
||||
FLUIDSYNTH_API int fluid_synth_get_reverb_group_width(fluid_synth_t *synth, int fx_group, double *width);
|
||||
FLUIDSYNTH_API int fluid_synth_get_reverb_group_level(fluid_synth_t *synth, int fx_group, double *level);
|
||||
/** @} Reverb */
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup chorus_effect Effect - Chorus
|
||||
* @ingroup synth
|
||||
*
|
||||
* Functions for configuring the built-in chorus effect
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Chorus modulation waveform type.
|
||||
*/
|
||||
enum fluid_chorus_mod
|
||||
{
|
||||
FLUID_CHORUS_MOD_SINE = 0, /**< Sine wave chorus modulation */
|
||||
FLUID_CHORUS_MOD_TRIANGLE = 1 /**< Triangle wave chorus modulation */
|
||||
};
|
||||
|
||||
|
||||
FLUID_DEPRECATED FLUIDSYNTH_API void fluid_synth_set_chorus_on(fluid_synth_t *synth, int on);
|
||||
FLUIDSYNTH_API int fluid_synth_chorus_on(fluid_synth_t *synth, int fx_group, int on);
|
||||
|
||||
FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_set_chorus(fluid_synth_t *synth, int nr, double level,
|
||||
double speed, double depth_ms, int type);
|
||||
FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_set_chorus_nr(fluid_synth_t *synth, int nr);
|
||||
FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_set_chorus_level(fluid_synth_t *synth, double level);
|
||||
FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_set_chorus_speed(fluid_synth_t *synth, double speed);
|
||||
FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_set_chorus_depth(fluid_synth_t *synth, double depth_ms);
|
||||
FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_set_chorus_type(fluid_synth_t *synth, int type);
|
||||
|
||||
FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_get_chorus_nr(fluid_synth_t *synth);
|
||||
FLUID_DEPRECATED FLUIDSYNTH_API double fluid_synth_get_chorus_level(fluid_synth_t *synth);
|
||||
FLUID_DEPRECATED FLUIDSYNTH_API double fluid_synth_get_chorus_speed(fluid_synth_t *synth);
|
||||
FLUID_DEPRECATED FLUIDSYNTH_API double fluid_synth_get_chorus_depth(fluid_synth_t *synth);
|
||||
FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_get_chorus_type(fluid_synth_t *synth); /* see fluid_chorus_mod */
|
||||
|
||||
FLUIDSYNTH_API int fluid_synth_set_chorus_group_nr(fluid_synth_t *synth, int fx_group, int nr);
|
||||
FLUIDSYNTH_API int fluid_synth_set_chorus_group_level(fluid_synth_t *synth, int fx_group, double level);
|
||||
FLUIDSYNTH_API int fluid_synth_set_chorus_group_speed(fluid_synth_t *synth, int fx_group, double speed);
|
||||
FLUIDSYNTH_API int fluid_synth_set_chorus_group_depth(fluid_synth_t *synth, int fx_group, double depth_ms);
|
||||
FLUIDSYNTH_API int fluid_synth_set_chorus_group_type(fluid_synth_t *synth, int fx_group, int type);
|
||||
|
||||
FLUIDSYNTH_API int fluid_synth_get_chorus_group_nr(fluid_synth_t *synth, int fx_group, int *nr);
|
||||
FLUIDSYNTH_API int fluid_synth_get_chorus_group_level(fluid_synth_t *synth, int fx_group, double *level);
|
||||
FLUIDSYNTH_API int fluid_synth_get_chorus_group_speed(fluid_synth_t *synth, int fx_group, double *speed);
|
||||
FLUIDSYNTH_API int fluid_synth_get_chorus_group_depth(fluid_synth_t *synth, int fx_group, double *depth_ms);
|
||||
FLUIDSYNTH_API int fluid_synth_get_chorus_group_type(fluid_synth_t *synth, int fx_group, int *type);
|
||||
/** @} Chorus */
|
||||
|
||||
/**
|
||||
* @defgroup synthesis_params Synthesis Parameters
|
||||
* @ingroup synth
|
||||
*
|
||||
* Functions to control and query synthesis parameters like gain and
|
||||
* polyphony count.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
FLUIDSYNTH_API int fluid_synth_count_midi_channels(fluid_synth_t *synth);
|
||||
FLUIDSYNTH_API int fluid_synth_count_audio_channels(fluid_synth_t *synth);
|
||||
FLUIDSYNTH_API int fluid_synth_count_audio_groups(fluid_synth_t *synth);
|
||||
FLUIDSYNTH_API int fluid_synth_count_effects_channels(fluid_synth_t *synth);
|
||||
FLUIDSYNTH_API int fluid_synth_count_effects_groups(fluid_synth_t *synth);
|
||||
|
||||
FLUID_DEPRECATED FLUIDSYNTH_API void fluid_synth_set_sample_rate(fluid_synth_t *synth, float sample_rate);
|
||||
FLUIDSYNTH_API void fluid_synth_set_gain(fluid_synth_t *synth, float gain);
|
||||
FLUIDSYNTH_API float fluid_synth_get_gain(fluid_synth_t *synth);
|
||||
FLUIDSYNTH_API int fluid_synth_set_polyphony(fluid_synth_t *synth, int polyphony);
|
||||
FLUIDSYNTH_API int fluid_synth_get_polyphony(fluid_synth_t *synth);
|
||||
FLUIDSYNTH_API int fluid_synth_get_active_voice_count(fluid_synth_t *synth);
|
||||
FLUIDSYNTH_API int fluid_synth_get_internal_bufsize(fluid_synth_t *synth);
|
||||
|
||||
FLUIDSYNTH_API
|
||||
int fluid_synth_set_interp_method(fluid_synth_t *synth, int chan, int interp_method);
|
||||
|
||||
/**
|
||||
* Synthesis interpolation method.
|
||||
*/
|
||||
enum fluid_interp
|
||||
{
|
||||
FLUID_INTERP_NONE = 0, /**< No interpolation: Fastest, but questionable audio quality */
|
||||
FLUID_INTERP_LINEAR = 1, /**< Straight-line interpolation: A bit slower, reasonable audio quality */
|
||||
FLUID_INTERP_4THORDER = 4, /**< Fourth-order interpolation, best quality, the default */
|
||||
|
||||
/**
|
||||
* Seventh-point sinc interpolation
|
||||
* @note This interpolation method was believed to provide highest quality. However, in Feb. 2025 it was discovered
|
||||
* that for certain samples it does introduce ringing artifacts, which
|
||||
* are not present in the 4th order interpolation. This is not a bug, it's rather a limitation of only using 7 points for the sinc interpolation.
|
||||
*/
|
||||
FLUID_INTERP_7THORDER = 7,
|
||||
|
||||
FLUID_INTERP_DEFAULT = FLUID_INTERP_4THORDER, /**< Default interpolation method */
|
||||
FLUID_INTERP_HIGHEST = FLUID_INTERP_7THORDER, /**< Highest interpolation method */
|
||||
};
|
||||
|
||||
/**
|
||||
* Enum used with fluid_synth_add_default_mod() to specify how to handle duplicate modulators.
|
||||
*/
|
||||
enum fluid_synth_add_mod
|
||||
{
|
||||
FLUID_SYNTH_OVERWRITE, /**< Overwrite any existing matching modulator */
|
||||
FLUID_SYNTH_ADD, /**< Sum up modulator amounts */
|
||||
};
|
||||
|
||||
FLUIDSYNTH_API int fluid_synth_add_default_mod(fluid_synth_t *synth, const fluid_mod_t *mod, int mode);
|
||||
FLUIDSYNTH_API int fluid_synth_remove_default_mod(fluid_synth_t *synth, const fluid_mod_t *mod);
|
||||
/** @} Synthesis Parameters */
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup tuning MIDI Tuning
|
||||
* @ingroup synth
|
||||
*
|
||||
* The functions in this section implement the MIDI Tuning Standard interface.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
FLUIDSYNTH_API
|
||||
int fluid_synth_activate_key_tuning(fluid_synth_t *synth, int bank, int prog,
|
||||
const char *name, const double *pitch, int apply);
|
||||
FLUIDSYNTH_API
|
||||
int fluid_synth_activate_octave_tuning(fluid_synth_t *synth, int bank, int prog,
|
||||
const char *name, const double *pitch, int apply);
|
||||
FLUIDSYNTH_API
|
||||
int fluid_synth_tune_notes(fluid_synth_t *synth, int bank, int prog,
|
||||
int len, const int *keys, const double *pitch, int apply);
|
||||
FLUIDSYNTH_API
|
||||
int fluid_synth_activate_tuning(fluid_synth_t *synth, int chan, int bank, int prog,
|
||||
int apply);
|
||||
FLUIDSYNTH_API
|
||||
int fluid_synth_deactivate_tuning(fluid_synth_t *synth, int chan, int apply);
|
||||
FLUIDSYNTH_API void fluid_synth_tuning_iteration_start(fluid_synth_t *synth);
|
||||
FLUIDSYNTH_API
|
||||
int fluid_synth_tuning_iteration_next(fluid_synth_t *synth, int *bank, int *prog);
|
||||
FLUIDSYNTH_API int fluid_synth_tuning_dump(fluid_synth_t *synth, int bank, int prog,
|
||||
char *name, int len, double *pitch);
|
||||
/** @} MIDI Tuning */
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup audio_rendering Audio Rendering
|
||||
* @ingroup synth
|
||||
*
|
||||
* The functions in this section can be used to render audio directly to
|
||||
* memory buffers. They are used internally by the \ref audio_driver and \ref file_renderer,
|
||||
* but can also be used manually for custom processing of the rendered audio.
|
||||
*
|
||||
* @note Please note that all following functions block during rendering. If your goal is to
|
||||
* render real-time audio, ensure that you call these functions from a high-priority
|
||||
* thread with little to no other duties other than calling the rendering functions.
|
||||
*
|
||||
* @warning
|
||||
* If a concurrently running thread calls any other sound affecting synth function
|
||||
* (e.g. fluid_synth_noteon(), fluid_synth_cc(), etc.) it is unspecified whether the event triggered by such a call
|
||||
* will be effective in the recently synthesized audio. While this is inaudible when only requesting small chunks from the
|
||||
* synth with every call (cf. fluid_synth_get_internal_bufsize()), it will become evident when requesting larger sample chunks:
|
||||
* With larger sample chunks it will get harder for the synth to react on those spontaneously occurring events in time
|
||||
* (like events received from a MIDI driver, or directly made synth API calls).
|
||||
* In those real-time scenarios, prefer requesting smaller
|
||||
* sample chunks from the synth with each call, to avoid poor quantization of your events in the synthesized audio.
|
||||
* This issue is not applicable when using the MIDI player or sequencer for event dispatching. Also
|
||||
* refer to the documentation of \setting{audio_period-size}.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
FLUIDSYNTH_API int fluid_synth_write_s16(fluid_synth_t *synth, int len,
|
||||
void *lout, int loff, int lincr,
|
||||
void *rout, int roff, int rincr);
|
||||
FLUIDSYNTH_API int fluid_synth_write_float(fluid_synth_t *synth, int len,
|
||||
void *lout, int loff, int lincr,
|
||||
void *rout, int roff, int rincr);
|
||||
FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_nwrite_float(fluid_synth_t *synth, int len,
|
||||
float **left, float **right,
|
||||
float **fx_left, float **fx_right);
|
||||
FLUIDSYNTH_API int fluid_synth_process(fluid_synth_t *synth, int len,
|
||||
int nfx, float *fx[],
|
||||
int nout, float *out[]);
|
||||
/** @} Audio Rendering */
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup iir_filter Effect - IIR Filter
|
||||
* @ingroup synth
|
||||
*
|
||||
* Functions for configuring the built-in IIR filter effect
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Specifies the type of filter to use for the custom IIR filter
|
||||
*/
|
||||
enum fluid_iir_filter_type
|
||||
{
|
||||
FLUID_IIR_DISABLED = 0, /**< Custom IIR filter is not operating */
|
||||
FLUID_IIR_LOWPASS, /**< Custom IIR filter is operating as low-pass filter */
|
||||
FLUID_IIR_HIGHPASS, /**< Custom IIR filter is operating as high-pass filter */
|
||||
FLUID_IIR_LAST /**< @internal Value defines the count of filter types (#fluid_iir_filter_type) @warning This symbol is not part of the public API and ABI stability guarantee and may change at any time! */
|
||||
};
|
||||
|
||||
/**
|
||||
* Specifies optional settings to use for the custom IIR filter. Can be bitwise ORed.
|
||||
*/
|
||||
enum fluid_iir_filter_flags
|
||||
{
|
||||
FLUID_IIR_Q_LINEAR = 1 << 0, /**< The Soundfont spec requires the filter Q to be interpreted in dB. If this flag is set the filter Q is instead assumed to be in a linear range */
|
||||
FLUID_IIR_Q_ZERO_OFF = 1 << 1, /**< If this flag the filter is switched off if Q == 0 (prior to any transformation) */
|
||||
FLUID_IIR_NO_GAIN_AMP = 1 << 2 /**< The Soundfont spec requires to correct the gain of the filter depending on the filter's Q. If this flag is set the filter gain will not be corrected. */
|
||||
};
|
||||
|
||||
FLUIDSYNTH_API int fluid_synth_set_custom_filter(fluid_synth_t *, int type, int flags);
|
||||
/** @} IIR Filter */
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup channel_setup MIDI Channel Setup
|
||||
* @ingroup synth
|
||||
*
|
||||
* The functions in this section provide interfaces to change the channel type
|
||||
* and to configure basic channels, legato and portamento setups.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @name Channel Type
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* The midi channel type used by fluid_synth_set_channel_type()
|
||||
*/
|
||||
enum fluid_midi_channel_type
|
||||
{
|
||||
CHANNEL_TYPE_MELODIC = 0, /**< Melodic midi channel */
|
||||
CHANNEL_TYPE_DRUM = 1 /**< Drum midi channel */
|
||||
};
|
||||
|
||||
FLUIDSYNTH_API int fluid_synth_set_channel_type(fluid_synth_t *synth, int chan, int type);
|
||||
/** @} Channel Type */
|
||||
|
||||
|
||||
/** @name Basic Channel Mode
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Channel mode bits OR-ed together so that it matches with the midi spec: poly omnion (0), mono omnion (1), poly omnioff (2), mono omnioff (3)
|
||||
*/
|
||||
enum fluid_channel_mode_flags
|
||||
{
|
||||
FLUID_CHANNEL_POLY_OFF = 0x01, /**< if flag is set, the basic channel is in mono on state, if not set poly is on */
|
||||
FLUID_CHANNEL_OMNI_OFF = 0x02, /**< if flag is set, the basic channel is in omni off state, if not set omni is on */
|
||||
};
|
||||
|
||||
/**
|
||||
* Indicates the mode a basic channel is set to
|
||||
*/
|
||||
enum fluid_basic_channel_modes
|
||||
{
|
||||
FLUID_CHANNEL_MODE_MASK = (FLUID_CHANNEL_OMNI_OFF | FLUID_CHANNEL_POLY_OFF), /**< Mask Poly and Omni bits of #fluid_channel_mode_flags, usually only used internally */
|
||||
FLUID_CHANNEL_MODE_OMNION_POLY = FLUID_CHANNEL_MODE_MASK & (~FLUID_CHANNEL_OMNI_OFF & ~FLUID_CHANNEL_POLY_OFF), /**< corresponds to MIDI mode 0 */
|
||||
FLUID_CHANNEL_MODE_OMNION_MONO = FLUID_CHANNEL_MODE_MASK & (~FLUID_CHANNEL_OMNI_OFF & FLUID_CHANNEL_POLY_OFF), /**< corresponds to MIDI mode 1 */
|
||||
FLUID_CHANNEL_MODE_OMNIOFF_POLY = FLUID_CHANNEL_MODE_MASK & (FLUID_CHANNEL_OMNI_OFF & ~FLUID_CHANNEL_POLY_OFF), /**< corresponds to MIDI mode 2 */
|
||||
FLUID_CHANNEL_MODE_OMNIOFF_MONO = FLUID_CHANNEL_MODE_MASK & (FLUID_CHANNEL_OMNI_OFF | FLUID_CHANNEL_POLY_OFF), /**< corresponds to MIDI mode 3 */
|
||||
FLUID_CHANNEL_MODE_LAST /**< @internal Value defines the count of basic channel modes (#fluid_basic_channel_modes) @warning This symbol is not part of the public API and ABI stability guarantee and may change at any time! */
|
||||
};
|
||||
|
||||
FLUIDSYNTH_API int fluid_synth_reset_basic_channel(fluid_synth_t *synth, int chan);
|
||||
|
||||
FLUIDSYNTH_API int fluid_synth_get_basic_channel(fluid_synth_t *synth, int chan,
|
||||
int *basic_chan_out,
|
||||
int *mode_chan_out,
|
||||
int *basic_val_out);
|
||||
FLUIDSYNTH_API int fluid_synth_set_basic_channel(fluid_synth_t *synth, int chan, int mode, int val);
|
||||
|
||||
/** @} Basic Channel Mode */
|
||||
|
||||
/** @name Legato Mode
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Indicates the legato mode a channel is set to
|
||||
* n1,n2,n3,.. is a legato passage. n1 is the first note, and n2,n3,n4 are played legato with previous note. */
|
||||
enum fluid_channel_legato_mode
|
||||
{
|
||||
FLUID_CHANNEL_LEGATO_MODE_RETRIGGER, /**< Mode 0 - Release previous note, start a new note */
|
||||
FLUID_CHANNEL_LEGATO_MODE_MULTI_RETRIGGER, /**< Mode 1 - On contiguous notes retrigger in attack section using current value, shape attack using current dynamic and make use of previous voices if any */
|
||||
FLUID_CHANNEL_LEGATO_MODE_LAST /**< @internal Value defines the count of legato modes (#fluid_channel_legato_mode) @warning This symbol is not part of the public API and ABI stability guarantee and may change at any time! */
|
||||
};
|
||||
|
||||
FLUIDSYNTH_API int fluid_synth_set_legato_mode(fluid_synth_t *synth, int chan, int legatomode);
|
||||
FLUIDSYNTH_API int fluid_synth_get_legato_mode(fluid_synth_t *synth, int chan, int *legatomode);
|
||||
/** @} Legato Mode */
|
||||
|
||||
/** @name Portamento Mode
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Indicates the portamento mode a channel is set to
|
||||
*/
|
||||
enum fluid_channel_portamento_mode
|
||||
{
|
||||
FLUID_CHANNEL_PORTAMENTO_MODE_EACH_NOTE, /**< Mode 0 - Portamento on each note (staccato or legato) */
|
||||
FLUID_CHANNEL_PORTAMENTO_MODE_LEGATO_ONLY, /**< Mode 1 - Portamento only on legato note */
|
||||
FLUID_CHANNEL_PORTAMENTO_MODE_STACCATO_ONLY, /**< Mode 2 - Portamento only on staccato note */
|
||||
FLUID_CHANNEL_PORTAMENTO_MODE_LAST /**< @internal Value defines the count of portamento modes
|
||||
@warning This symbol is not part of the public API and ABI
|
||||
stability guarantee and may change at any time! */
|
||||
};
|
||||
|
||||
FLUIDSYNTH_API int fluid_synth_set_portamento_mode(fluid_synth_t *synth,
|
||||
int chan, int portamentomode);
|
||||
FLUIDSYNTH_API int fluid_synth_get_portamento_mode(fluid_synth_t *synth,
|
||||
int chan, int *portamentomode);
|
||||
/** @} Portamento Mode */
|
||||
|
||||
/**@name Breath Mode
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Indicates the breath mode a channel is set to
|
||||
*/
|
||||
enum fluid_channel_breath_flags
|
||||
{
|
||||
FLUID_CHANNEL_BREATH_POLY = 0x10, /**< when channel is poly, this flag indicates that the default velocity to initial attenuation modulator is replaced by a breath to initial attenuation modulator */
|
||||
FLUID_CHANNEL_BREATH_MONO = 0x20, /**< when channel is mono, this flag indicates that the default velocity to initial attenuation modulator is replaced by a breath modulator */
|
||||
FLUID_CHANNEL_BREATH_SYNC = 0x40, /**< when channel is mono, this flag indicates that the breath controller(MSB)triggers noteon/noteoff on the running note */
|
||||
};
|
||||
|
||||
FLUIDSYNTH_API int fluid_synth_set_breath_mode(fluid_synth_t *synth,
|
||||
int chan, int breathmode);
|
||||
FLUIDSYNTH_API int fluid_synth_get_breath_mode(fluid_synth_t *synth,
|
||||
int chan, int *breathmode);
|
||||
/** @} Breath Mode */
|
||||
/** @} MIDI Channel Setup */
|
||||
|
||||
|
||||
/** @ingroup settings */
|
||||
FLUIDSYNTH_API fluid_settings_t *fluid_synth_get_settings(fluid_synth_t *synth);
|
||||
|
||||
/** @ingroup soundfont_loader */
|
||||
FLUIDSYNTH_API void fluid_synth_add_sfloader(fluid_synth_t *synth, fluid_sfloader_t *loader);
|
||||
|
||||
/** @ingroup soundfont_loader */
|
||||
FLUIDSYNTH_API fluid_preset_t *fluid_synth_get_channel_preset(fluid_synth_t *synth, int chan);
|
||||
|
||||
/** @ingroup midi_input */
|
||||
FLUIDSYNTH_API int fluid_synth_handle_midi_event(void *data, fluid_midi_event_t *event);
|
||||
|
||||
/** @ingroup soundfonts */
|
||||
FLUIDSYNTH_API
|
||||
int fluid_synth_pin_preset(fluid_synth_t *synth, int sfont_id, int bank_num, int preset_num);
|
||||
|
||||
/** @ingroup soundfonts */
|
||||
FLUIDSYNTH_API
|
||||
int fluid_synth_unpin_preset(fluid_synth_t *synth, int sfont_id, int bank_num, int preset_num);
|
||||
|
||||
/** @ingroup ladspa */
|
||||
FLUIDSYNTH_API fluid_ladspa_fx_t *fluid_synth_get_ladspa_fx(fluid_synth_t *synth);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _FLUIDSYNTH_SYNTH_H */
|
||||
@@ -1,83 +0,0 @@
|
||||
/* FluidSynth - A Software Synthesizer
|
||||
*
|
||||
* Copyright (C) 2003 Peter Hanappe and others.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef _FLUIDSYNTH_TYPES_H
|
||||
#define _FLUIDSYNTH_TYPES_H
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup Types Types
|
||||
* @brief Type declarations
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
typedef struct _fluid_hashtable_t fluid_settings_t; /**< Configuration settings instance */
|
||||
typedef struct _fluid_synth_t fluid_synth_t; /**< Synthesizer instance */
|
||||
typedef struct _fluid_voice_t fluid_voice_t; /**< Synthesis voice instance */
|
||||
typedef struct _fluid_sfloader_t fluid_sfloader_t; /**< SoundFont loader plugin */
|
||||
typedef struct _fluid_sfont_t fluid_sfont_t; /**< SoundFont */
|
||||
typedef struct _fluid_preset_t fluid_preset_t; /**< SoundFont preset */
|
||||
typedef struct _fluid_sample_t fluid_sample_t; /**< SoundFont sample */
|
||||
typedef struct _fluid_mod_t fluid_mod_t; /**< SoundFont modulator */
|
||||
typedef struct _fluid_audio_driver_t fluid_audio_driver_t; /**< Audio driver instance */
|
||||
typedef struct _fluid_file_renderer_t fluid_file_renderer_t; /**< Audio file renderer instance */
|
||||
typedef struct _fluid_player_t fluid_player_t; /**< MIDI player instance */
|
||||
typedef struct _fluid_midi_event_t fluid_midi_event_t; /**< MIDI event */
|
||||
typedef struct _fluid_midi_driver_t fluid_midi_driver_t; /**< MIDI driver instance */
|
||||
typedef struct _fluid_midi_router_t fluid_midi_router_t; /**< MIDI router instance */
|
||||
typedef struct _fluid_midi_router_rule_t fluid_midi_router_rule_t; /**< MIDI router rule */
|
||||
typedef struct _fluid_hashtable_t fluid_cmd_hash_t; /**< Command handler hash table */
|
||||
typedef struct _fluid_shell_t fluid_shell_t; /**< Command shell */
|
||||
typedef struct _fluid_server_t fluid_server_t; /**< TCP/IP shell server instance */
|
||||
typedef struct _fluid_event_t fluid_event_t; /**< Sequencer event */
|
||||
typedef struct _fluid_sequencer_t fluid_sequencer_t; /**< Sequencer instance */
|
||||
typedef struct _fluid_cmd_handler_t fluid_cmd_handler_t; /**< Shell Command Handler */
|
||||
typedef struct _fluid_ladspa_fx_t fluid_ladspa_fx_t; /**< LADSPA effects instance */
|
||||
typedef struct _fluid_file_callbacks_t fluid_file_callbacks_t; /**< Callback struct to perform custom file loading of soundfonts */
|
||||
|
||||
typedef int fluid_istream_t; /**< Input stream descriptor */
|
||||
typedef int fluid_ostream_t; /**< Output stream descriptor */
|
||||
|
||||
typedef short fluid_seq_id_t; /**< Unique client IDs used by the sequencer and #fluid_event_t, obtained by fluid_sequencer_register_client() and fluid_sequencer_register_fluidsynth() */
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1800)
|
||||
typedef __int64 fluid_long_long_t; // even on 32bit windows
|
||||
#else
|
||||
/**
|
||||
* A typedef for C99's type long long, which is at least 64-bit wide, as guaranteed by the C99.
|
||||
* @p __int64 will be used as replacement for VisualStudio 2010 and older.
|
||||
*/
|
||||
typedef long long fluid_long_long_t;
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _FLUIDSYNTH_TYPES_H */
|
||||
@@ -1,47 +0,0 @@
|
||||
/* FluidSynth - A Software Synthesizer
|
||||
*
|
||||
* Copyright (C) 2003 Peter Hanappe and others.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef _FLUIDSYNTH_VERSION_H
|
||||
#define _FLUIDSYNTH_VERSION_H
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @addtogroup misc
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
#define FLUIDSYNTH_VERSION "2.4.5" /**< String constant of libfluidsynth version. */
|
||||
#define FLUIDSYNTH_VERSION_MAJOR 2 /**< libfluidsynth major version integer constant. */
|
||||
#define FLUIDSYNTH_VERSION_MINOR 4 /**< libfluidsynth minor version integer constant. */
|
||||
#define FLUIDSYNTH_VERSION_MICRO 5 /**< libfluidsynth micro version integer constant. */
|
||||
|
||||
FLUIDSYNTH_API void fluid_version(int *major, int *minor, int *micro);
|
||||
FLUIDSYNTH_API char* fluid_version_str(void);
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _FLUIDSYNTH_VERSION_H */
|
||||
@@ -1,77 +0,0 @@
|
||||
/* FluidSynth - A Software Synthesizer
|
||||
*
|
||||
* Copyright (C) 2003 Peter Hanappe and others.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef _FLUIDSYNTH_VOICE_H
|
||||
#define _FLUIDSYNTH_VOICE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup voices Voice Manipulation
|
||||
* @ingroup soundfonts
|
||||
*
|
||||
* Synthesis voice manipulation functions.
|
||||
*
|
||||
* The interface to the synthesizer's voices.
|
||||
* Examples on using them can be found in the source code of the default SoundFont
|
||||
* loader (fluid_defsfont.c).
|
||||
*
|
||||
* Most of these functions should only be called from within synthesis context,
|
||||
* such as the SoundFont loader's noteon method.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Enum used with fluid_voice_add_mod() to specify how to handle duplicate modulators.
|
||||
*/
|
||||
enum fluid_voice_add_mod
|
||||
{
|
||||
FLUID_VOICE_OVERWRITE, /**< Overwrite any existing matching modulator */
|
||||
FLUID_VOICE_ADD, /**< Add (sum) modulator amounts */
|
||||
FLUID_VOICE_DEFAULT /**< For default modulators only, no need to check for duplicates */
|
||||
};
|
||||
|
||||
FLUIDSYNTH_API void fluid_voice_add_mod(fluid_voice_t *voice, fluid_mod_t *mod, int mode);
|
||||
FLUIDSYNTH_API float fluid_voice_gen_get(fluid_voice_t *voice, int gen);
|
||||
FLUIDSYNTH_API void fluid_voice_gen_set(fluid_voice_t *voice, int gen, float val);
|
||||
FLUIDSYNTH_API void fluid_voice_gen_incr(fluid_voice_t *voice, int gen, float val);
|
||||
|
||||
FLUIDSYNTH_API unsigned int fluid_voice_get_id(const fluid_voice_t *voice);
|
||||
FLUIDSYNTH_API int fluid_voice_get_channel(const fluid_voice_t *voice);
|
||||
FLUIDSYNTH_API int fluid_voice_get_key(const fluid_voice_t *voice);
|
||||
FLUIDSYNTH_API int fluid_voice_get_actual_key(const fluid_voice_t *voice);
|
||||
FLUIDSYNTH_API int fluid_voice_get_velocity(const fluid_voice_t *voice);
|
||||
FLUIDSYNTH_API int fluid_voice_get_actual_velocity(const fluid_voice_t *voice);
|
||||
FLUIDSYNTH_API int fluid_voice_is_playing(const fluid_voice_t *voice);
|
||||
FLUIDSYNTH_API int fluid_voice_is_on(const fluid_voice_t *voice);
|
||||
FLUIDSYNTH_API int fluid_voice_is_sustained(const fluid_voice_t *voice);
|
||||
FLUIDSYNTH_API int fluid_voice_is_sostenuto(const fluid_voice_t *voice);
|
||||
FLUIDSYNTH_API int fluid_voice_optimize_sample(fluid_sample_t *s);
|
||||
FLUIDSYNTH_API void fluid_voice_update_param(fluid_voice_t *voice, int gen);
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* _FLUIDSYNTH_VOICE_H */
|
||||
|
||||
@@ -1,164 +0,0 @@
|
||||
#include <stdbool.h>
|
||||
#include <fluidsynth.h>
|
||||
#include <jni.h>
|
||||
#include <string.h>
|
||||
#include <android/log.h>
|
||||
#include <malloc.h>
|
||||
|
||||
#define FLUIDSYNTH_SAMPLE_RATE 44100
|
||||
#define FLUIDSYNTH_LATENCY 40
|
||||
#define LATENCY_MILLIS_TO_BUFFER_SIZE(ms) (FLUIDSYNTH_SAMPLE_RATE * ms / 1000.0)
|
||||
|
||||
#define println(...) __android_log_print(ANDROID_LOG_DEBUG, "System.out", __VA_ARGS__)
|
||||
|
||||
typedef struct MIDIHandler {
|
||||
fluid_settings_t* settings;
|
||||
fluid_synth_t* synth;
|
||||
fluid_audio_driver_t* driver;
|
||||
int soundfontId;
|
||||
} MIDIHandler;
|
||||
|
||||
static void setAudioLatency(fluid_settings_t* settings, int ms) {
|
||||
double periodSize = LATENCY_MILLIS_TO_BUFFER_SIZE(ms);
|
||||
fluid_settings_setnum(settings, "audio.period-size", periodSize);
|
||||
fluid_settings_setint(settings, "audio.periods", 2);
|
||||
}
|
||||
|
||||
static MIDIHandler* MIDIHandler_allocate() {
|
||||
fluid_settings_t* settings = new_fluid_settings();
|
||||
if (!settings) return NULL;
|
||||
fluid_settings_setint(settings, "synth.cpu-cores", 4);
|
||||
fluid_settings_setnum(settings, "synth.gain", 0.6f);
|
||||
fluid_settings_setstr(settings, "audio.oboe.performance-mode", "LowLatency");
|
||||
fluid_settings_setstr(settings, "audio.oboe.sharing-mode", "Exclusive");
|
||||
fluid_settings_setnum(settings, "synth.sample-rate", FLUIDSYNTH_SAMPLE_RATE);
|
||||
|
||||
setAudioLatency(settings, FLUIDSYNTH_LATENCY);
|
||||
|
||||
fluid_synth_t* synth = new_fluid_synth(settings);
|
||||
if (!synth) {
|
||||
delete_fluid_settings(settings);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fluid_audio_driver_t* driver = new_fluid_audio_driver(settings, synth);
|
||||
if (!driver) {
|
||||
delete_fluid_synth(synth);
|
||||
delete_fluid_settings(settings);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MIDIHandler* midiHandler = calloc(1, sizeof(MIDIHandler));
|
||||
midiHandler->settings = settings;
|
||||
midiHandler->synth = synth;
|
||||
midiHandler->driver = driver;
|
||||
midiHandler->soundfontId = -1;
|
||||
return midiHandler;
|
||||
}
|
||||
|
||||
static void MIDIHandler_destroy(MIDIHandler* midiHandler) {
|
||||
if (!midiHandler) return;
|
||||
if (midiHandler->soundfontId != -1) fluid_synth_sfunload(midiHandler->synth, midiHandler->soundfontId, 1);
|
||||
delete_fluid_audio_driver(midiHandler->driver);
|
||||
delete_fluid_synth(midiHandler->synth);
|
||||
delete_fluid_settings(midiHandler->settings);
|
||||
free(midiHandler);
|
||||
}
|
||||
|
||||
static void MIDIHandler_noteOn(MIDIHandler* midiHandler, int channel, int note, int velocity) {
|
||||
if (!midiHandler) return;
|
||||
fluid_synth_noteon(midiHandler->synth, channel, note, velocity);
|
||||
}
|
||||
|
||||
static void MIDIHandler_noteOff(MIDIHandler* midiHandler, int channel, int note) {
|
||||
if (!midiHandler) return;
|
||||
fluid_synth_noteoff(midiHandler->synth, channel, note);
|
||||
}
|
||||
|
||||
static void MIDIHandler_keyPressure(MIDIHandler* midiHandler, int channel, int key, int value) {
|
||||
if (!midiHandler) return;
|
||||
fluid_synth_key_pressure(midiHandler->synth, channel, key, value);
|
||||
}
|
||||
|
||||
static void MIDIHandler_programChange(MIDIHandler* midiHandler, int channel, int program) {
|
||||
if (!midiHandler) return;
|
||||
fluid_synth_program_change(midiHandler->synth, channel, program);
|
||||
}
|
||||
|
||||
static void MIDIHandler_controlChange(MIDIHandler* midiHandler, int channel, int control, int value) {
|
||||
if (!midiHandler) return;
|
||||
fluid_synth_cc(midiHandler->synth, channel, control, value);
|
||||
}
|
||||
|
||||
static void MIDIHandler_pitchBend(MIDIHandler* midiHandler, int channel, int value) {
|
||||
if (!midiHandler) return;
|
||||
fluid_synth_pitch_bend(midiHandler->synth, channel, value);
|
||||
}
|
||||
|
||||
static void MIDIHandler_loadSoundFont(MIDIHandler* midiHandler, const char* path) {
|
||||
if (!midiHandler) return;
|
||||
midiHandler->soundfontId = -1;
|
||||
int id = fluid_synth_sfload(midiHandler->synth, path, 0);
|
||||
if (id != FLUID_FAILED) {
|
||||
midiHandler->soundfontId = id;
|
||||
for (int i = 0; i < 16; i++) {
|
||||
fluid_synth_sfont_select(midiHandler->synth, i, id);
|
||||
fluid_synth_program_change(midiHandler->synth, i, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_com_winlator_winhandler_MIDIHandler_nativeAllocate(JNIEnv *env, jobject obj) {
|
||||
MIDIHandler* midiHandler = MIDIHandler_allocate();
|
||||
return (jlong)midiHandler;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_winlator_winhandler_MIDIHandler_destroy(JNIEnv *env, jobject obj,
|
||||
jlong nativePtr) {
|
||||
MIDIHandler_destroy((MIDIHandler*)nativePtr);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_winlator_winhandler_MIDIHandler_noteOn(JNIEnv *env, jobject obj, jlong nativePtr,
|
||||
jint channel, jint note, jint velocity) {
|
||||
MIDIHandler_noteOn((MIDIHandler*)nativePtr, channel, note, velocity);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_winlator_winhandler_MIDIHandler_noteOff(JNIEnv *env, jobject obj, jlong nativePtr,
|
||||
jint channel, jint note) {
|
||||
MIDIHandler_noteOff((MIDIHandler*)nativePtr, channel, note);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_winlator_winhandler_MIDIHandler_loadSoundFont(JNIEnv *env, jobject obj, jlong nativePtr,
|
||||
jstring soundfontPath) {
|
||||
const char* path = (*env)->GetStringUTFChars(env, soundfontPath, NULL);
|
||||
MIDIHandler_loadSoundFont((MIDIHandler*)nativePtr, path);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_winlator_winhandler_MIDIHandler_programChange(JNIEnv *env, jobject obj, jlong nativePtr,
|
||||
jint channel, jint program) {
|
||||
MIDIHandler_programChange((MIDIHandler*)nativePtr, channel, program);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_winlator_winhandler_MIDIHandler_controlChange(JNIEnv *env, jobject obj, jlong nativePtr,
|
||||
jint channel, jint control, jint value) {
|
||||
MIDIHandler_controlChange((MIDIHandler*)nativePtr, channel, control, value);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_winlator_winhandler_MIDIHandler_pitchBend(JNIEnv *env, jobject obj, jlong nativePtr,
|
||||
jint channel, jint value) {
|
||||
MIDIHandler_pitchBend((MIDIHandler*)nativePtr, channel, value);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_winlator_winhandler_MIDIHandler_keyPressure(JNIEnv *env, jobject obj, jlong nativePtr,
|
||||
jint channel, jint key, jint value) {
|
||||
MIDIHandler_keyPressure((MIDIHandler*)nativePtr, channel, key, value);
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.22.1)
|
||||
|
||||
project(PRoot)
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -Wno-unused-function -Wimplicit-function-declaration")
|
||||
|
||||
add_library(talloc STATIC
|
||||
talloc/talloc.c)
|
||||
|
||||
include_directories(src
|
||||
talloc)
|
||||
|
||||
add_executable(libproot.so
|
||||
src/cli/cli.c
|
||||
src/cli/proot.c
|
||||
src/cli/note.c
|
||||
src/execve/enter.c
|
||||
src/execve/exit.c
|
||||
src/execve/elf.c
|
||||
src/execve/auxv.c
|
||||
src/path/binding.c
|
||||
src/path/glue.c
|
||||
src/path/canon.c
|
||||
src/path/path.c
|
||||
src/path/proc.c
|
||||
src/path/temp.c
|
||||
src/syscall/seccomp.c
|
||||
src/syscall/syscall.c
|
||||
src/syscall/chain.c
|
||||
src/syscall/enter.c
|
||||
src/syscall/exit.c
|
||||
src/syscall/sysnum.c
|
||||
src/syscall/socket.c
|
||||
src/syscall/heap.c
|
||||
src/syscall/rlimit.c
|
||||
src/tracee/tracee.c
|
||||
src/tracee/mem.c
|
||||
src/tracee/reg.c
|
||||
src/tracee/event.c
|
||||
src/tracee/seccomp.c
|
||||
src/ptrace/ptrace.c
|
||||
src/ptrace/wait.c)
|
||||
|
||||
target_link_libraries(libproot.so
|
||||
talloc)
|
||||
|
||||
add_library(proot-loader SHARED
|
||||
src/loader/loader.c)
|
||||
@@ -1,372 +0,0 @@
|
||||
The copyright holder for PRoot and CARE is STMicroelectronics, these
|
||||
tools are developed in the Compilation Expertise Center by:
|
||||
|
||||
Cédric VINCENT <cedric.vincent@st.com>
|
||||
Original author, maintainer.
|
||||
|
||||
Rémi DURAFFORT <remi.duraffort@st.com>
|
||||
Improved the -0 feature, many experiments, bug reports, fixes, and articles.
|
||||
|
||||
Christophe GUILLON <christophe.guillon@st.com>
|
||||
Improved CARE, plugin experiments, bug reports, and fixes.
|
||||
|
||||
Yves JANIN <yves.janin@st.com>
|
||||
Support for the i386 architecture, many experiments and bug reports.
|
||||
|
||||
Antoine MOYNAULT <antoine.moynault@st.com>
|
||||
Many experiments and bug reports.
|
||||
|
||||
Claire ROBINE <claire.robine@st.com>
|
||||
Many bug fixes.
|
||||
|
||||
Clément BAZIN <clement@bazin-fr.org>
|
||||
Plugins interface, dependency tracker plugin, and bug reports.
|
||||
|
||||
Christian BERTIN <christian.bertin@st.com>
|
||||
Valuable support.
|
||||
|
||||
Denis FERRANTI <denis.ferranti@st.com>
|
||||
Valuable support.
|
||||
|
||||
Paul GHALEB <paul.ghaleb@st.com>
|
||||
User manual review.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
@@ -1,104 +0,0 @@
|
||||
/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
|
||||
*
|
||||
* This file is part of PRoot.
|
||||
*
|
||||
* Copyright (C) 2015 STMicroelectronics
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef ARCH_H
|
||||
#define ARCH_H
|
||||
|
||||
#ifndef NO_LIBC_HEADER
|
||||
#include <sys/ptrace.h> /* linux.git:c0a3a20b */
|
||||
#include <linux/audit.h> /* AUDIT_ARCH_*, */
|
||||
#endif
|
||||
|
||||
typedef unsigned long word_t;
|
||||
typedef unsigned char byte_t;
|
||||
|
||||
#define SYSCALL_AVOIDER ((word_t) -1)
|
||||
#define SYSTRAP_NUM SYSARG_NUM
|
||||
#define STACK_ALIGNMENT 16
|
||||
|
||||
#if defined(__ARM_EABI__)
|
||||
#define ARCH_ARM_EABI 1
|
||||
#elif defined(__aarch64__)
|
||||
#define ARCH_ARM64 1
|
||||
#elif defined(__arm__)
|
||||
#error "Only EABI is currently supported for ARM"
|
||||
#else
|
||||
#error "Unsupported architecture"
|
||||
#endif
|
||||
|
||||
/* Architecture specific definitions. */
|
||||
#if defined(ARCH_ARM_EABI)
|
||||
|
||||
#define SYSNUMS_HEADER1 "syscall/sysnums-arm.h"
|
||||
#define SYSNUMS_ABI1 sysnums_arm
|
||||
|
||||
#define SYSTRAP_SIZE 4
|
||||
|
||||
#define SECCOMP_ARCHS { { .value = AUDIT_ARCH_ARM, .nb_abis = 1, .abis = { ABI_DEFAULT } } }
|
||||
|
||||
#define user_regs_struct user_regs
|
||||
#define HOST_ELF_MACHINE {40, 0};
|
||||
#define RED_ZONE_SIZE 0
|
||||
#define OFFSETOF_STAT_UID_32 0
|
||||
#define OFFSETOF_STAT_GID_32 0
|
||||
#define EM_ARM 40
|
||||
|
||||
#define LOADER_ADDRESS 0x20000000
|
||||
|
||||
#define EXEC_PIC_ADDRESS 0x0f000000
|
||||
#define INTERP_PIC_ADDRESS 0x1f000000
|
||||
|
||||
#elif defined(ARCH_ARM64)
|
||||
|
||||
#define SYSNUMS_HEADER1 "syscall/sysnums-arm64.h"
|
||||
#define SYSNUMS_HEADER2 "syscall/sysnums-arm.h"
|
||||
|
||||
#define SYSNUMS_ABI1 sysnums_arm64
|
||||
#define SYSNUMS_ABI2 sysnums_arm
|
||||
|
||||
#define SYSTRAP_SIZE 4
|
||||
|
||||
#ifndef AUDIT_ARCH_AARCH64
|
||||
#define AUDIT_ARCH_AARCH64 (EM_AARCH64 | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE)
|
||||
#endif
|
||||
|
||||
#define SECCOMP_ARCHS { \
|
||||
{ .value = AUDIT_ARCH_AARCH64, .nb_abis = 1, .abis = { ABI_DEFAULT } }, \
|
||||
{ .value = AUDIT_ARCH_ARM, .nb_abis = 1, .abis = { ABI_2 } }, \
|
||||
}
|
||||
|
||||
#define HOST_ELF_MACHINE {183, 0};
|
||||
#define RED_ZONE_SIZE 0
|
||||
#define OFFSETOF_STAT_UID_32 24
|
||||
#define OFFSETOF_STAT_GID_32 28
|
||||
|
||||
#define LOADER_ADDRESS 0x2000000000
|
||||
#define EXEC_PIC_ADDRESS 0x3000000000
|
||||
#define INTERP_PIC_ADDRESS 0x3f00000000
|
||||
|
||||
#define HAS_LOADER_32BIT true
|
||||
#define EXEC_PIC_ADDRESS_32 0x0f000000
|
||||
#define INTERP_PIC_ADDRESS_32 0x1f000000
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* ARCH_H */
|
||||
@@ -1,32 +0,0 @@
|
||||
/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
|
||||
*
|
||||
* This file is part of PRoot.
|
||||
*
|
||||
* Copyright (C) 2015 STMicroelectronics
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef ATTRIBUTE_H
|
||||
#define ATTRIBUTE_H
|
||||
|
||||
#define UNUSED __attribute__((unused))
|
||||
#define FORMAT(a, b, c) __attribute__ ((format (a, b, c)))
|
||||
#define DONT_INSTRUMENT __attribute__((no_instrument_function))
|
||||
#define PACKED __attribute__((packed))
|
||||
#define WEAK __attribute__((weak))
|
||||
|
||||
#endif /* ATTRIBUTE_H */
|
||||
@@ -1,444 +0,0 @@
|
||||
/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
|
||||
*
|
||||
* This file is part of PRoot.
|
||||
*
|
||||
* Copyright (C) 2015 STMicroelectronics
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <stdio.h> /* printf(3), */
|
||||
#include <stdbool.h> /* bool, true, false, */
|
||||
#include <linux/limits.h> /* ARG_MAX, PATH_MAX, */
|
||||
#include <string.h> /* str*(3), basename(3), */
|
||||
#include <talloc.h> /* talloc*, */
|
||||
#include <stdlib.h> /* exit(3), EXIT_*, strtol(3), {g,s}etenv(3), */
|
||||
#include <assert.h> /* assert(3), */
|
||||
#include <sys/types.h> /* getpid(2), */
|
||||
#include <unistd.h> /* getpid(2), */
|
||||
#include <errno.h> /* errno(3), */
|
||||
#include <limits.h> /* INT_MAX, */
|
||||
|
||||
#include "cli/cli.h"
|
||||
#include "cli/note.h"
|
||||
#include "tracee/tracee.h"
|
||||
#include "tracee/event.h"
|
||||
#include "path/binding.h"
|
||||
#include "path/canon.h"
|
||||
#include "path/path.h"
|
||||
|
||||
/**
|
||||
* Print a (@detailed) usage of PRoot.
|
||||
*/
|
||||
void print_usage(Tracee *tracee, const Cli *cli, bool detailed)
|
||||
{
|
||||
const char *current_class = "none";
|
||||
const Option *options;
|
||||
size_t i, j;
|
||||
|
||||
#define DETAIL(a) if (detailed) a
|
||||
|
||||
DETAIL(printf("%s %s: %s.\n\n", cli->name, cli->version, cli->subtitle));
|
||||
printf("Usage:\n %s\n", cli->synopsis);
|
||||
DETAIL(printf("\n"));
|
||||
|
||||
options = cli->options;
|
||||
for (i = 0; options[i].class != NULL; i++) {
|
||||
for (j = 0; ; j++) {
|
||||
const Argument *argument = &(options[i].arguments[j]);
|
||||
|
||||
if (!argument->name || (!detailed && j != 0)) {
|
||||
DETAIL(printf("\n"));
|
||||
printf("\t%s\n", options[i].description);
|
||||
if (detailed) {
|
||||
if (options[i].detail[0] != '\0')
|
||||
printf("\n%s\n\n", options[i].detail);
|
||||
else
|
||||
printf("\n");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (strcmp(options[i].class, current_class) != 0) {
|
||||
current_class = options[i].class;
|
||||
printf("\n%s:\n", current_class);
|
||||
}
|
||||
|
||||
if (j == 0)
|
||||
printf(" %s", argument->name);
|
||||
else
|
||||
printf(", %s", argument->name);
|
||||
|
||||
if (argument->separator != '\0')
|
||||
printf("%c*%s*", argument->separator, argument->value);
|
||||
else if (!detailed)
|
||||
printf("\t");
|
||||
}
|
||||
}
|
||||
|
||||
if (detailed)
|
||||
printf("%s\n", cli->colophon);
|
||||
}
|
||||
|
||||
/**
|
||||
* Print the version of PRoot.
|
||||
*/
|
||||
void print_version(const Cli *cli)
|
||||
{
|
||||
printf("%s %s\n\n", cli->logo, cli->version);
|
||||
}
|
||||
|
||||
static void print_execve_help(const Tracee *tracee, const char *argv0, int status)
|
||||
{
|
||||
note(tracee, ERROR, SYSTEM, "execve(\"%s\")", argv0);
|
||||
|
||||
note(tracee, INFO, USER, "possible causes:\n"
|
||||
" * the program is a script but its interpreter (eg. /bin/sh) was not found;\n"
|
||||
" * the program is an ELF but its interpreter (eg. ld-linux.so) was not found;\n"
|
||||
" * the loader was not found or doesn't work.");
|
||||
}
|
||||
|
||||
static void print_error_separator(const Tracee *tracee, const Argument *argument)
|
||||
{
|
||||
if (argument->separator == '\0')
|
||||
note(tracee, ERROR, USER, "option '%s' expects no value.", argument->name);
|
||||
else
|
||||
note(tracee, ERROR, USER, "option '%s' and its value must be separated by '%c'.",
|
||||
argument->name, argument->separator);
|
||||
}
|
||||
|
||||
static void print_argv(const Tracee *tracee, const char *prompt, char *const argv[])
|
||||
{
|
||||
char string[ARG_MAX] = "";
|
||||
size_t i;
|
||||
|
||||
if (!argv)
|
||||
return;
|
||||
|
||||
#define APPEND(post) \
|
||||
do { \
|
||||
ssize_t length = sizeof(string) - (strlen(string) + strlen(post)); \
|
||||
if (length <= 0) \
|
||||
return; \
|
||||
strncat(string, post, length); \
|
||||
} while (0)
|
||||
|
||||
APPEND(prompt);
|
||||
APPEND(" =");
|
||||
for (i = 0; argv[i] != NULL; i++) {
|
||||
APPEND(" ");
|
||||
APPEND(argv[i]);
|
||||
}
|
||||
string[sizeof(string) - 1] = '\0';
|
||||
|
||||
#undef APPEND
|
||||
|
||||
note(tracee, INFO, USER, "%s", string);
|
||||
}
|
||||
|
||||
static void print_config(Tracee *tracee, char *const argv[])
|
||||
{
|
||||
assert(tracee != NULL);
|
||||
|
||||
if (tracee->verbose <= 0)
|
||||
return;
|
||||
|
||||
if (tracee->glue)
|
||||
note(tracee, INFO, USER, "glue rootfs = %s", tracee->glue);
|
||||
|
||||
note(tracee, INFO, USER, "exe = %s", tracee->exe);
|
||||
print_argv(tracee, "argv", argv);
|
||||
note(tracee, INFO, USER, "initial cwd = %s", tracee->fs->cwd);
|
||||
note(tracee, INFO, USER, "verbose level = %d", tracee->verbose);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize @tracee's current working directory. This function
|
||||
* returns -1 if an error occurred, otherwise 0.
|
||||
*/
|
||||
static int initialize_cwd(Tracee *tracee)
|
||||
{
|
||||
char path2[PATH_MAX];
|
||||
char path[PATH_MAX];
|
||||
int status;
|
||||
|
||||
/* Compute the base directory. */
|
||||
if (tracee->fs->cwd[0] != '/') {
|
||||
strcpy(path, "/");
|
||||
}
|
||||
else
|
||||
strcpy(path, tracee->fs->cwd);
|
||||
|
||||
/* The ending "." ensures canonicalize() will report an error
|
||||
* if tracee->fs->cwd does not exist or if it is not a
|
||||
* directory. */
|
||||
join_paths(path2, path, ".");
|
||||
|
||||
/* Initiate state for canonicalization. */
|
||||
strcpy(path, "/");
|
||||
|
||||
status = canonicalize(tracee, path2, true, path, 0);
|
||||
if (status < 0) {
|
||||
note(tracee, WARNING, USER, "can't chdir(\"%s\") in the guest rootfs: %s",
|
||||
path2, strerror(-status));
|
||||
note(tracee, INFO, USER, "default working directory is now \"/\"");
|
||||
strcpy(path, "/");
|
||||
}
|
||||
chop_finality(path);
|
||||
|
||||
/* Replace with the canonicalized working directory. */
|
||||
TALLOC_FREE(tracee->fs->cwd);
|
||||
tracee->fs->cwd = talloc_strdup(tracee->fs, path);
|
||||
if (tracee->fs->cwd == NULL)
|
||||
return -1;
|
||||
talloc_set_name_const(tracee->fs->cwd, "$cwd");
|
||||
|
||||
/* Keep this special environment variable consistent. */
|
||||
setenv("PWD", path, 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize @tracee->exe from @exe, i.e. canonicalize it from a
|
||||
* guest point-of-view.
|
||||
*/
|
||||
static int initialize_exe(Tracee *tracee, const char *exe)
|
||||
{
|
||||
char path[PATH_MAX];
|
||||
int status;
|
||||
|
||||
status = which(tracee, tracee->reconf.paths, path, exe ?: "/bin/sh");
|
||||
if (status < 0)
|
||||
return -1;
|
||||
|
||||
status = detranslate_path(tracee, path, NULL);
|
||||
if (status < 0)
|
||||
return -1;
|
||||
|
||||
tracee->exe = talloc_strdup(tracee, path);
|
||||
if (tracee->exe == NULL)
|
||||
return -1;
|
||||
talloc_set_name_const(tracee->exe, "$exe");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure @tracee according to the command-line arguments stored in
|
||||
* @argv[]. This function returns the index in @argv[] of the command
|
||||
* to launch, otherwise -1 if an error occured.
|
||||
*/
|
||||
static int parse_config(Tracee *tracee, size_t argc, char *const argv[])
|
||||
{
|
||||
option_handler_t handler = NULL;
|
||||
const Option *options;
|
||||
const Cli *cli = NULL;
|
||||
size_t argc_offset;
|
||||
size_t i, j, k;
|
||||
int status;
|
||||
|
||||
/* Unknown tool name? Default to PRoot. */
|
||||
if (cli == NULL)
|
||||
cli = get_proot_cli(tracee->ctx);
|
||||
|
||||
if (argc == 1) {
|
||||
print_usage(tracee, cli, false);
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
const char *arg = argv[i];
|
||||
|
||||
/* The current argument is the value of a short option. */
|
||||
if (handler != NULL) {
|
||||
status = handler(tracee, cli, arg);
|
||||
if (status < 0)
|
||||
return -1;
|
||||
handler = NULL;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (arg[0] != '-')
|
||||
break; /* End of PRoot options. */
|
||||
|
||||
options = cli->options;
|
||||
for (j = 0; options[j].class != NULL; j++) {
|
||||
const Option *option = &options[j];
|
||||
|
||||
/* A given option has several aliases. */
|
||||
for (k = 0; ; k++) {
|
||||
const Argument *argument;
|
||||
size_t length;
|
||||
|
||||
argument = &option->arguments[k];
|
||||
|
||||
/* End of aliases for this option. */
|
||||
if (!argument->name)
|
||||
break;
|
||||
|
||||
length = strlen(argument->name);
|
||||
if (strncmp(arg, argument->name, length) != 0)
|
||||
continue;
|
||||
|
||||
/* Avoid ambiguities. */
|
||||
if (strlen(arg) > length
|
||||
&& arg[length] != argument->separator) {
|
||||
print_error_separator(tracee, argument);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* No option value. */
|
||||
if (!argument->value) {
|
||||
status = option->handler(tracee, cli, NULL);
|
||||
if (status < 0)
|
||||
return -1;
|
||||
goto known_option;
|
||||
}
|
||||
|
||||
/* Value coalesced with to its option. */
|
||||
if (argument->separator == arg[length]) {
|
||||
assert(strlen(arg) >= length);
|
||||
status = option->handler(tracee, cli, &arg[length + 1]);
|
||||
if (status < 0)
|
||||
return -1;
|
||||
goto known_option;
|
||||
}
|
||||
|
||||
/* Avoid ambiguities. */
|
||||
if (argument->separator != ' ') {
|
||||
print_error_separator(tracee, argument);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Short option with a separated value. */
|
||||
handler = option->handler;
|
||||
goto known_option;
|
||||
}
|
||||
}
|
||||
|
||||
note(tracee, ERROR, USER, "unknown option '%s'.", arg);
|
||||
return -1;
|
||||
|
||||
known_option:
|
||||
if (handler != NULL && i == argc - 1) {
|
||||
note(tracee, ERROR, USER, "missing value for option '%s'.", arg);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
argc_offset = i;
|
||||
|
||||
status = pre_initialize_bindings(tracee, cli);
|
||||
if (status < 0)
|
||||
return -1;
|
||||
|
||||
/* The guest rootfs is now known: bindings specified by the
|
||||
* user (tracee->bindings.user) can be canonicalized. */
|
||||
status = initialize_bindings(tracee);
|
||||
if (status < 0)
|
||||
return -1;
|
||||
|
||||
/* Bindings are now installed (tracee->bindings.guest &
|
||||
* tracee->bindings.host): the current working directory can
|
||||
* be canonicalized. */
|
||||
status = initialize_cwd(tracee);
|
||||
if (status < 0)
|
||||
return -1;
|
||||
|
||||
/* Bindings are now installed and the current working
|
||||
* directory is canonicalized: resolve path to @tracee->exe
|
||||
* and configure @tracee->cmdline. */
|
||||
status = initialize_exe(tracee, argv[argc_offset]);
|
||||
if (status < 0)
|
||||
return -1;
|
||||
|
||||
print_config(tracee, &argv[argc_offset]);
|
||||
|
||||
return argc_offset;
|
||||
}
|
||||
|
||||
bool exit_failure = true;
|
||||
|
||||
int main(int argc, char *const argv[])
|
||||
{
|
||||
Tracee *tracee;
|
||||
int status;
|
||||
|
||||
/* Configure the memory allocator. */
|
||||
talloc_enable_leak_report();
|
||||
|
||||
#if defined(TALLOC_VERSION_MAJOR) && TALLOC_VERSION_MAJOR >= 2
|
||||
talloc_set_log_stderr();
|
||||
#endif
|
||||
|
||||
/* Pre-create the first tracee (pid == 0). */
|
||||
tracee = get_tracee(NULL, 0, true);
|
||||
if (tracee == NULL)
|
||||
goto error;
|
||||
tracee->pid = getpid();
|
||||
|
||||
/* Set verboseness from env variable, may be overriden by option */
|
||||
{
|
||||
const char *verbose_env = getenv("PROOT_VERBOSE");
|
||||
if (verbose_env != NULL) {
|
||||
tracee->verbose = strtol(verbose_env, NULL, 10);
|
||||
global_verbose_level = tracee->verbose;
|
||||
}
|
||||
}
|
||||
|
||||
/* Pre-configure the first tracee. */
|
||||
status = parse_config(tracee, argc, argv);
|
||||
if (status < 0)
|
||||
goto error;
|
||||
|
||||
/* Start the first tracee. */
|
||||
status = launch_process(tracee, &argv[status]);
|
||||
if (status < 0) {
|
||||
print_execve_help(tracee, tracee->exe, status);
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Start tracing the first tracee and all its children. */
|
||||
exit(event_loop());
|
||||
|
||||
error:
|
||||
TALLOC_FREE(tracee);
|
||||
|
||||
if (exit_failure) {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
else
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert @value into an integer, then put the result into
|
||||
* *@variable. This function prints a warning and returns -1 if a
|
||||
* conversion error occured, otherwise it returns 0.
|
||||
*/
|
||||
int parse_integer_option(const Tracee *tracee, int *variable, const char *value, const char *option)
|
||||
{
|
||||
char *end_ptr = NULL;
|
||||
|
||||
errno = 0;
|
||||
*variable = strtol(value, &end_ptr, 10);
|
||||
if (errno != 0 || end_ptr == value) {
|
||||
note(tracee, ERROR, USER, "option `%s` expects an integer value.", option);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
/* This file is automatically generated from the documentation. EDIT AT YOUR OWN RISK. */
|
||||
|
||||
#ifndef CLI_H
|
||||
#define CLI_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include "tracee/tracee.h"
|
||||
#include "attribute.h"
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
char separator;
|
||||
const char *value;
|
||||
} Argument;
|
||||
|
||||
struct Cli;
|
||||
typedef int (*option_handler_t)(Tracee *tracee, const struct Cli *cli, const char *value);
|
||||
|
||||
typedef struct {
|
||||
const char *class;
|
||||
option_handler_t handler;
|
||||
const char *description;
|
||||
const char *detail;
|
||||
Argument arguments[5];
|
||||
} Option;
|
||||
|
||||
#define END_OF_OPTIONS { .class = NULL, \
|
||||
.arguments = {{ .name = NULL, .separator = '\0', .value = NULL }}, \
|
||||
.handler = NULL, \
|
||||
.description = NULL, \
|
||||
.detail = NULL \
|
||||
}
|
||||
|
||||
typedef struct Cli {
|
||||
const char *name;
|
||||
const char *version;
|
||||
const char *subtitle;
|
||||
const char *synopsis;
|
||||
const char *colophon;
|
||||
const char *logo;
|
||||
|
||||
void *private;
|
||||
|
||||
const Option options[];
|
||||
} Cli;
|
||||
|
||||
extern int pre_initialize_bindings(Tracee *, const Cli *);
|
||||
extern const Cli *get_proot_cli(TALLOC_CTX *context);
|
||||
|
||||
extern void print_usage(Tracee *tracee, const Cli *cli, bool detailed);
|
||||
extern void print_version(const Cli *cli);
|
||||
extern int parse_integer_option(const Tracee *tracee, int *variable, const char *value, const char *option);
|
||||
|
||||
extern bool exit_failure;
|
||||
|
||||
#endif /* CLI_H */
|
||||
@@ -1,95 +0,0 @@
|
||||
/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
|
||||
*
|
||||
* This file is part of PRoot.
|
||||
*
|
||||
* Copyright (C) 2015 STMicroelectronics
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <errno.h> /* errno, */
|
||||
#include <string.h> /* strerror(3), */
|
||||
#include <stdarg.h> /* va_*, */
|
||||
#include <stdio.h> /* vfprintf(3), */
|
||||
#include <limits.h> /* INT_MAX, */
|
||||
|
||||
#include "cli/note.h"
|
||||
#include "tracee/tracee.h"
|
||||
|
||||
int global_verbose_level;
|
||||
const char *global_tool_name;
|
||||
|
||||
/**
|
||||
* Print @message to the standard error stream according to its
|
||||
* @severity and @origin.
|
||||
*/
|
||||
void note(const Tracee *tracee, Severity severity, Origin origin, const char *message, ...)
|
||||
{
|
||||
const char *tool_name;
|
||||
va_list extra_params;
|
||||
int verbose_level;
|
||||
|
||||
tool_name = global_tool_name ?: "";
|
||||
if (tracee == NULL) {
|
||||
verbose_level = global_verbose_level;
|
||||
}
|
||||
else
|
||||
verbose_level = tracee->verbose;
|
||||
|
||||
if (verbose_level < 0 && severity != ERROR)
|
||||
return;
|
||||
|
||||
switch (severity) {
|
||||
case WARNING:
|
||||
fprintf(stderr, "%s warning: ", tool_name);
|
||||
break;
|
||||
|
||||
case ERROR:
|
||||
fprintf(stderr, "%s error: ", tool_name);
|
||||
break;
|
||||
|
||||
case INFO:
|
||||
default:
|
||||
fprintf(stderr, "%s info: ", tool_name);
|
||||
break;
|
||||
}
|
||||
|
||||
if (origin == TALLOC)
|
||||
fprintf(stderr, "talloc: ");
|
||||
|
||||
va_start(extra_params, message);
|
||||
vfprintf(stderr, message, extra_params);
|
||||
va_end(extra_params);
|
||||
|
||||
switch (origin) {
|
||||
case SYSTEM:
|
||||
fprintf(stderr, ": ");
|
||||
perror(NULL);
|
||||
break;
|
||||
|
||||
case TALLOC:
|
||||
break;
|
||||
|
||||
case INTERNAL:
|
||||
case USER:
|
||||
default:
|
||||
fprintf(stderr, "\n");
|
||||
break;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
|
||||
*
|
||||
* This file is part of PRoot.
|
||||
*
|
||||
* Copyright (C) 2015 STMicroelectronics
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef NOTE_H
|
||||
#define NOTE_H
|
||||
|
||||
#include "tracee/tracee.h"
|
||||
#include "attribute.h"
|
||||
|
||||
/* Specify where a notice is coming from. */
|
||||
typedef enum {
|
||||
SYSTEM,
|
||||
INTERNAL,
|
||||
USER,
|
||||
TALLOC,
|
||||
} Origin;
|
||||
|
||||
/* Specify the severity of a notice. */
|
||||
typedef enum {
|
||||
ERROR,
|
||||
WARNING,
|
||||
INFO,
|
||||
} Severity;
|
||||
|
||||
#define VERBOSE(tracee, level, message, args...) do { \
|
||||
if (tracee == NULL || tracee->verbose >= (level)) \
|
||||
note(tracee, INFO, INTERNAL, (message), ## args); \
|
||||
} while (0)
|
||||
|
||||
extern void note(const Tracee *tracee, Severity severity, Origin origin, const char *message, ...) FORMAT(printf, 4, 5);
|
||||
|
||||
extern int global_verbose_level;
|
||||
extern const char *global_tool_name;
|
||||
|
||||
#endif /* NOTE_H */
|
||||
@@ -1,155 +0,0 @@
|
||||
/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
|
||||
*
|
||||
* This file is part of PRoot.
|
||||
*
|
||||
* Copyright (C) 2015 STMicroelectronics
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <string.h> /* str*(3), */
|
||||
#include <assert.h> /* assert(3), */
|
||||
#include <stdio.h> /* printf(3), fflush(3), */
|
||||
#include <unistd.h> /* write(2), */
|
||||
|
||||
#include "cli/cli.h"
|
||||
#include "cli/note.h"
|
||||
#include "path/binding.h"
|
||||
#include "attribute.h"
|
||||
|
||||
/* These should be included last. */
|
||||
#include "cli/proot.h"
|
||||
|
||||
char *root_path = NULL;
|
||||
|
||||
static int handle_option_r(Tracee *tracee, const Cli *cli UNUSED, const char *value)
|
||||
{
|
||||
Binding *binding;
|
||||
|
||||
/* ``chroot $PATH`` is semantically equivalent to ``mount
|
||||
* --bind $PATH /``. */
|
||||
binding = new_binding(tracee, value, "/", true);
|
||||
if (binding == NULL)
|
||||
return -1;
|
||||
|
||||
root_path = binding->host.path;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int handle_option_b(Tracee *tracee, const Cli *cli UNUSED, const char *value)
|
||||
{
|
||||
char *host;
|
||||
char *guest;
|
||||
|
||||
host = talloc_strdup(tracee->ctx, value);
|
||||
if (host == NULL) {
|
||||
note(tracee, ERROR, INTERNAL, "can't allocate memory");
|
||||
return -1;
|
||||
}
|
||||
|
||||
guest = strchr(host, ':');
|
||||
if (guest != NULL) {
|
||||
*guest = '\0';
|
||||
guest++;
|
||||
}
|
||||
|
||||
new_binding(tracee, host, guest, true);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int handle_option_w(Tracee *tracee, const Cli *cli UNUSED, const char *value)
|
||||
{
|
||||
tracee->fs->cwd = talloc_strdup(tracee->fs, value);
|
||||
if (tracee->fs->cwd == NULL)
|
||||
return -1;
|
||||
talloc_set_name_const(tracee->fs->cwd, "$cwd");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int handle_option_kill_on_exit(Tracee *tracee, const Cli *cli UNUSED, const char *value UNUSED)
|
||||
{
|
||||
tracee->killall_on_exit = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int handle_option_v(Tracee *tracee, const Cli *cli UNUSED, const char *value)
|
||||
{
|
||||
int status;
|
||||
|
||||
status = parse_integer_option(tracee, &tracee->verbose, value, "-v");
|
||||
if (status < 0)
|
||||
return status;
|
||||
|
||||
global_verbose_level = tracee->verbose;
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern unsigned char WEAK _binary_licenses_start;
|
||||
extern unsigned char WEAK _binary_licenses_end;
|
||||
|
||||
static int handle_option_V(Tracee *tracee UNUSED, const Cli *cli, const char *value UNUSED)
|
||||
{
|
||||
size_t size;
|
||||
|
||||
print_version(cli);
|
||||
printf("\n%s\n", cli->colophon);
|
||||
fflush(stdout);
|
||||
|
||||
size = &_binary_licenses_end - &_binary_licenses_start;
|
||||
if (size > 0)
|
||||
write(1, &_binary_licenses_start, size);
|
||||
|
||||
exit_failure = false;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int handle_option_h(Tracee *tracee, const Cli *cli, const char *value UNUSED)
|
||||
{
|
||||
print_usage(tracee, cli, true);
|
||||
exit_failure = false;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize @tracee's fields that are mandatory for PRoot but that
|
||||
* are not required on the command line, i.e. "-w" and "-r".
|
||||
*/
|
||||
int pre_initialize_bindings(Tracee *tracee, const Cli *cli)
|
||||
{
|
||||
int status;
|
||||
|
||||
/* Default to "." if no CWD were specified. */
|
||||
if (tracee->fs->cwd == NULL) {
|
||||
status = handle_option_w(tracee, cli, ".");
|
||||
if (status < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* The default guest rootfs is "/" if none was specified. */
|
||||
if (root_path == NULL) {
|
||||
status = handle_option_r(tracee, cli, "/");
|
||||
if (status < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
const Cli *get_proot_cli(TALLOC_CTX *context UNUSED)
|
||||
{
|
||||
global_tool_name = proot_cli.name;
|
||||
return &proot_cli;
|
||||
}
|
||||
@@ -1,127 +0,0 @@
|
||||
/* This file is automatically generated from the documentation. EDIT AT YOUR OWN RISK. */
|
||||
|
||||
#ifndef PROOT_CLI_H
|
||||
#define PROOT_CLI_H
|
||||
|
||||
#include "cli/cli.h"
|
||||
|
||||
#ifndef VERSION
|
||||
#define VERSION "5.1.0"
|
||||
#endif
|
||||
|
||||
static int handle_option_r(Tracee *tracee, const Cli *cli, const char *value);
|
||||
static int handle_option_b(Tracee *tracee, const Cli *cli, const char *value);
|
||||
static int handle_option_w(Tracee *tracee, const Cli *cli, const char *value);
|
||||
static int handle_option_v(Tracee *tracee, const Cli *cli, const char *value);
|
||||
static int handle_option_V(Tracee *tracee, const Cli *cli, const char *value);
|
||||
static int handle_option_h(Tracee *tracee, const Cli *cli, const char *value);
|
||||
static int handle_option_kill_on_exit(Tracee *tracee, const Cli *cli, const char *value);
|
||||
|
||||
static Cli proot_cli = {
|
||||
.version = VERSION,
|
||||
.name = "proot",
|
||||
.subtitle = "chroot, mount --bind, and binfmt_misc without privilege/setup",
|
||||
.synopsis = "proot [option] ... [command]",
|
||||
.colophon = "Visit http://proot.me for help, bug reports, suggestions, patchs, ...\n\
|
||||
Copyright (C) 2015 STMicroelectronics, licensed under GPL v2 or later.",
|
||||
.logo = "\
|
||||
_____ _____ ___\n\
|
||||
| __ \\ __ \\_____ _____| |_\n\
|
||||
| __/ / _ \\/ _ \\ _|\n\
|
||||
|__| |__|__\\_____/\\_____/\\____|",
|
||||
|
||||
.options = {
|
||||
{ .class = "Regular options",
|
||||
.arguments = {
|
||||
{ .name = "-r", .separator = ' ', .value = "path" },
|
||||
{ .name = "--rootfs", .separator = '=', .value = "path" },
|
||||
{ .name = NULL, .separator = '\0', .value = NULL } },
|
||||
.handler = handle_option_r,
|
||||
.description = "Use *path* as the new guest root file-system, default is /.",
|
||||
.detail = "\tThe specified path typically contains a Linux distribution where\n\
|
||||
\tall new programs will be confined. The default rootfs is /\n\
|
||||
\twhen none is specified, this makes sense when the bind mechanism\n\
|
||||
\tis used to relocate host files and directories, see the -b\n\
|
||||
\toption and the Examples section for details.\n\
|
||||
\t\n\
|
||||
\tIt is recommended to use the -R or -S options instead.",
|
||||
},
|
||||
{ .class = "Regular options",
|
||||
.arguments = {
|
||||
{ .name = "-b", .separator = ' ', .value = "path" },
|
||||
{ .name = "--bind", .separator = '=', .value = "path" },
|
||||
{ .name = "-m", .separator = ' ', .value = "path" },
|
||||
{ .name = "--mount", .separator = '=', .value = "path" },
|
||||
{ .name = NULL, .separator = '\0', .value = NULL } },
|
||||
.handler = handle_option_b,
|
||||
.description = "Make the content of *path* accessible in the guest rootfs.",
|
||||
.detail = "\tThis option makes any file or directory of the host rootfs\n\
|
||||
\taccessible in the confined environment just as if it were part of\n\
|
||||
\tthe guest rootfs. By default the host path is bound to the same\n\
|
||||
\tpath in the guest rootfs but users can specify any other location\n\
|
||||
\twith the syntax: -b *host_path*:*guest_location*. If the\n\
|
||||
\tguest location is a symbolic link, it is dereferenced to ensure\n\
|
||||
\tthe new content is accessible through all the symbolic links that\n\
|
||||
\tpoint to the overlaid content. In most cases this default\n\
|
||||
\tbehavior shouldn't be a problem, although it is possible to\n\
|
||||
\texplicitly not dereference the guest location by appending it the\n\
|
||||
\t! character: -b *host_path*:*guest_location!*.",
|
||||
},
|
||||
{ .class = "Regular options",
|
||||
.arguments = {
|
||||
{ .name = "-w", .separator = ' ', .value = "path" },
|
||||
{ .name = "--pwd", .separator = '=', .value = "path" },
|
||||
{ .name = "--cwd", .separator = '=', .value = "path" },
|
||||
{ .name = NULL, .separator = '\0', .value = NULL } },
|
||||
.handler = handle_option_w,
|
||||
.description = "Set the initial working directory to *path*.",
|
||||
.detail = "\tSome programs expect to be launched from a given directory but do\n\
|
||||
\tnot perform any chdir by themselves. This option avoids the\n\
|
||||
\tneed for running a shell and then entering the directory manually.",
|
||||
},
|
||||
{ .class = "Regular options",
|
||||
.arguments = {
|
||||
{ .name = "--kill-on-exit", .separator = '\0', .value = NULL },
|
||||
{ .name = NULL, .separator = '\0', .value = NULL } },
|
||||
.handler = handle_option_kill_on_exit,
|
||||
.description = "Kill all processes on command exit.",
|
||||
.detail = "\tWhen the executed command leaves orphan or detached processes\n\
|
||||
\taround, proot waits until all processes possibly terminate. This option forces\n\
|
||||
\tthe immediate termination of all tracee processes when the main command exits.",
|
||||
},
|
||||
{ .class = "Regular options",
|
||||
.arguments = {
|
||||
{ .name = "-v", .separator = ' ', .value = "value" },
|
||||
{ .name = "--verbose", .separator = '=', .value = "value" },
|
||||
{ .name = NULL, .separator = '\0', .value = NULL } },
|
||||
.handler = handle_option_v,
|
||||
.description = "Set the level of debug information to *value*.",
|
||||
.detail = "\tThe higher the integer value is, the more detailed debug\n\
|
||||
\tinformation is printed to the standard error stream. A negative\n\
|
||||
\tvalue makes PRoot quiet except on fatal errors.",
|
||||
},
|
||||
{ .class = "Regular options",
|
||||
.arguments = {
|
||||
{ .name = "-V", .separator = '\0', .value = NULL },
|
||||
{ .name = "--version", .separator = '\0', .value = NULL },
|
||||
{ .name = "--about", .separator = '\0', .value = NULL },
|
||||
{ .name = NULL, .separator = '\0', .value = NULL } },
|
||||
.handler = handle_option_V,
|
||||
.description = "Print version, copyright, license and contact, then exit.",
|
||||
.detail = "",
|
||||
},
|
||||
{ .class = "Regular options",
|
||||
.arguments = {
|
||||
{ .name = "-h", .separator = '\0', .value = NULL },
|
||||
{ .name = "--help", .separator = '\0', .value = NULL },
|
||||
{ .name = "--usage", .separator = '\0', .value = NULL },
|
||||
{ .name = NULL, .separator = '\0', .value = NULL } },
|
||||
.handler = handle_option_h,
|
||||
.description = "Print the version and the command-line usage, then exit.",
|
||||
.detail = "",
|
||||
},
|
||||
END_OF_OPTIONS,
|
||||
},
|
||||
};
|
||||
|
||||
#endif /* PROOT_CLI_H */
|
||||
@@ -1,265 +0,0 @@
|
||||
/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
|
||||
*
|
||||
* This file is part of PRoot.
|
||||
*
|
||||
* Copyright (C) 2015 STMicroelectronics
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef COMPAT_H
|
||||
#define COMPAT_H
|
||||
|
||||
/* Local definitions for compatibility with old and/or broken distros... */
|
||||
# ifndef AT_NULL
|
||||
# define AT_NULL 0
|
||||
# endif
|
||||
# ifndef AT_PHDR
|
||||
# define AT_PHDR 3
|
||||
# endif
|
||||
# ifndef AT_PHENT
|
||||
# define AT_PHENT 4
|
||||
# endif
|
||||
# ifndef AT_PHNUM
|
||||
# define AT_PHNUM 5
|
||||
# endif
|
||||
# ifndef AT_BASE
|
||||
# define AT_BASE 7
|
||||
# endif
|
||||
# ifndef AT_ENTRY
|
||||
# define AT_ENTRY 9
|
||||
# endif
|
||||
# ifndef AT_RANDOM
|
||||
# define AT_RANDOM 25
|
||||
# endif
|
||||
# ifndef AT_EXECFN
|
||||
# define AT_EXECFN 31
|
||||
# endif
|
||||
# ifndef AT_SYSINFO
|
||||
# define AT_SYSINFO 32
|
||||
# endif
|
||||
# ifndef AT_SYSINFO_EHDR
|
||||
# define AT_SYSINFO_EHDR 33
|
||||
# endif
|
||||
# ifndef AT_FDCWD
|
||||
# define AT_FDCWD -100
|
||||
# endif
|
||||
# ifndef AT_SYMLINK_FOLLOW
|
||||
# define AT_SYMLINK_FOLLOW 0x400
|
||||
# endif
|
||||
# ifndef AT_REMOVEDIR
|
||||
# define AT_REMOVEDIR 0x200
|
||||
# endif
|
||||
# ifndef AT_SYMLINK_NOFOLLOW
|
||||
# define AT_SYMLINK_NOFOLLOW 0x100
|
||||
# endif
|
||||
# ifndef IN_DONT_FOLLOW
|
||||
# define IN_DONT_FOLLOW 0x02000000
|
||||
# endif
|
||||
# ifndef WIFCONTINUED
|
||||
# define WIFCONTINUED(status) ((status) == 0xffff)
|
||||
# endif
|
||||
# ifndef PTRACE_GETREGS
|
||||
# define PTRACE_GETREGS 12
|
||||
# endif
|
||||
# ifndef PTRACE_SETREGS
|
||||
# define PTRACE_SETREGS 13
|
||||
# endif
|
||||
# ifndef PTRACE_GETFPREGS
|
||||
# define PTRACE_GETFPREGS 14
|
||||
# endif
|
||||
# ifndef PTRACE_SETFPREGS
|
||||
# define PTRACE_SETFPREGS 15
|
||||
# endif
|
||||
# ifndef PTRACE_GETFPXREGS
|
||||
# define PTRACE_GETFPXREGS 18
|
||||
# endif
|
||||
# ifndef PTRACE_SETFPXREGS
|
||||
# define PTRACE_SETFPXREGS 19
|
||||
# endif
|
||||
# ifndef PTRACE_SETOPTIONS
|
||||
# define PTRACE_SETOPTIONS 0x4200
|
||||
# endif
|
||||
# ifndef PTRACE_GETEVENTMSG
|
||||
# define PTRACE_GETEVENTMSG 0x4201
|
||||
# endif
|
||||
# ifndef PTRACE_GETREGSET
|
||||
# define PTRACE_GETREGSET 0x4204
|
||||
# endif
|
||||
# ifndef PTRACE_SETREGSET
|
||||
# define PTRACE_SETREGSET 0x4205
|
||||
# endif
|
||||
# ifndef PTRACE_SEIZE
|
||||
# define PTRACE_SEIZE 0x4206
|
||||
# endif
|
||||
# ifndef PTRACE_INTERRUPT
|
||||
# define PTRACE_INTERRUPT 0x4207
|
||||
# endif
|
||||
# ifndef PTRACE_LISTEN
|
||||
# define PTRACE_LISTEN 0x4208
|
||||
# endif
|
||||
# ifndef PTRACE_O_TRACESYSGOOD
|
||||
# define PTRACE_O_TRACESYSGOOD 0x00000001
|
||||
# endif
|
||||
# ifndef PTRACE_O_TRACEFORK
|
||||
# define PTRACE_O_TRACEFORK 0x00000002
|
||||
# endif
|
||||
# ifndef PTRACE_O_TRACEVFORK
|
||||
# define PTRACE_O_TRACEVFORK 0x00000004
|
||||
# endif
|
||||
# ifndef PTRACE_O_TRACECLONE
|
||||
# define PTRACE_O_TRACECLONE 0x00000008
|
||||
# endif
|
||||
# ifndef PTRACE_O_TRACEEXEC
|
||||
# define PTRACE_O_TRACEEXEC 0x00000010
|
||||
# endif
|
||||
# ifndef PTRACE_O_TRACEVFORKDONE
|
||||
# define PTRACE_O_TRACEVFORKDONE 0x00000020
|
||||
# endif
|
||||
# ifndef PTRACE_O_TRACEEXIT
|
||||
# define PTRACE_O_TRACEEXIT 0x00000040
|
||||
# endif
|
||||
# ifndef PTRACE_O_TRACESECCOMP
|
||||
# define PTRACE_O_TRACESECCOMP 0x00000080
|
||||
# endif
|
||||
# ifndef PTRACE_EVENT_FORK
|
||||
# define PTRACE_EVENT_FORK 1
|
||||
# endif
|
||||
# ifndef PTRACE_EVENT_VFORK
|
||||
# define PTRACE_EVENT_VFORK 2
|
||||
# endif
|
||||
# ifndef PTRACE_EVENT_CLONE
|
||||
# define PTRACE_EVENT_CLONE 3
|
||||
# endif
|
||||
# ifndef PTRACE_EVENT_EXEC
|
||||
# define PTRACE_EVENT_EXEC 4
|
||||
# endif
|
||||
# ifndef PTRACE_EVENT_VFORK_DONE
|
||||
# define PTRACE_EVENT_VFORK_DONE 5
|
||||
# endif
|
||||
# ifndef PTRACE_EVENT_EXIT
|
||||
# define PTRACE_EVENT_EXIT 6
|
||||
# endif
|
||||
# ifndef PTRACE_EVENT_SECCOMP
|
||||
# define PTRACE_EVENT_SECCOMP 7
|
||||
# endif
|
||||
# ifndef PTRACE_EVENT_SECCOMP2
|
||||
# if PTRACE_EVENT_SECCOMP == 7
|
||||
# define PTRACE_EVENT_SECCOMP2 8
|
||||
# elif PTRACE_EVENT_SECCOMP == 8
|
||||
# define PTRACE_EVENT_SECCOMP2 7
|
||||
# else
|
||||
# error "unknown PTRACE_EVENT_SECCOMP value"
|
||||
# endif
|
||||
# endif
|
||||
# ifndef PTRACE_SET_SYSCALL
|
||||
# define PTRACE_SET_SYSCALL 23
|
||||
# endif
|
||||
# ifndef PTRACE_GET_THREAD_AREA
|
||||
# define PTRACE_GET_THREAD_AREA 25
|
||||
# endif
|
||||
# ifndef PTRACE_SET_THREAD_AREA
|
||||
# define PTRACE_SET_THREAD_AREA 26
|
||||
# endif
|
||||
# ifndef PTRACE_GETVFPREGS
|
||||
# define PTRACE_GETVFPREGS 27
|
||||
# endif
|
||||
# ifndef PTRACE_ARCH_PRCTL
|
||||
# define PTRACE_ARCH_PRCTL 30
|
||||
# endif
|
||||
# ifndef ARCH_SET_GS
|
||||
# define ARCH_SET_GS 0x1001
|
||||
# endif
|
||||
# ifndef ARCH_SET_FS
|
||||
# define ARCH_SET_FS 0x1002
|
||||
# endif
|
||||
# ifndef ARCH_GET_GS
|
||||
# define ARCH_GET_FS 0x1003
|
||||
# endif
|
||||
# ifndef ARCH_GET_FS
|
||||
# define ARCH_GET_GS 0x1004
|
||||
# endif
|
||||
# ifndef PTRACE_SINGLEBLOCK
|
||||
# define PTRACE_SINGLEBLOCK 33
|
||||
# endif
|
||||
# ifndef ADDR_NO_RANDOMIZE
|
||||
# define ADDR_NO_RANDOMIZE 0x0040000
|
||||
# endif
|
||||
# ifndef SYS_ACCEPT4
|
||||
# define SYS_ACCEPT4 18
|
||||
# endif
|
||||
# ifndef TALLOC_FREE
|
||||
# define TALLOC_FREE(ctx) do { talloc_free(ctx); ctx = NULL; } while(0)
|
||||
# endif
|
||||
# ifndef PR_SET_NAME
|
||||
# define PR_SET_NAME 15
|
||||
# endif
|
||||
# ifndef PR_SET_NO_NEW_PRIVS
|
||||
# define PR_SET_NO_NEW_PRIVS 38
|
||||
# endif
|
||||
# ifndef PR_SET_SECCOMP
|
||||
# define PR_SET_SECCOMP 22
|
||||
# endif
|
||||
# ifndef SECCOMP_MODE_FILTER
|
||||
# define SECCOMP_MODE_FILTER 2
|
||||
# endif
|
||||
# ifndef talloc_get_type_abort
|
||||
# define talloc_get_type_abort talloc_get_type
|
||||
# endif
|
||||
# ifndef FUTEX_PRIVATE_FLAG
|
||||
# define FUTEX_PRIVATE_FLAG 128
|
||||
# endif
|
||||
# ifndef EFD_SEMAPHORE
|
||||
# define EFD_SEMAPHORE 1
|
||||
# endif
|
||||
# ifndef F_DUPFD_CLOEXEC
|
||||
# define F_DUPFD_CLOEXEC 1030
|
||||
# endif
|
||||
# ifndef O_RDONLY
|
||||
# define O_RDONLY 00000000
|
||||
# endif
|
||||
# ifndef O_CLOEXEC
|
||||
# define O_CLOEXEC 02000000
|
||||
# endif
|
||||
# ifndef MAP_PRIVATE
|
||||
# define MAP_PRIVATE 0x02
|
||||
# endif
|
||||
# ifndef MAP_FIXED
|
||||
# define MAP_FIXED 0x10
|
||||
# endif
|
||||
# ifndef MAP_ANONYMOUS
|
||||
# define MAP_ANONYMOUS 0x20
|
||||
# endif
|
||||
# ifndef PROT_READ
|
||||
# define PROT_READ 0x1
|
||||
# endif
|
||||
# ifndef PROT_WRITE
|
||||
# define PROT_WRITE 0x2
|
||||
# endif
|
||||
# ifndef PROT_EXEC
|
||||
# define PROT_EXEC 0x4
|
||||
# endif
|
||||
# ifndef PROT_GROWSDOWN
|
||||
# define PROT_GROWSDOWN 0x01000000
|
||||
# endif
|
||||
# ifndef NT_ARM_SYSTEM_CALL
|
||||
# define NT_ARM_SYSTEM_CALL 0x404
|
||||
# endif
|
||||
# ifndef SYS_SECCOMP
|
||||
# define SYS_SECCOMP 1
|
||||
# endif
|
||||
|
||||
#endif /* COMPAT_H */
|
||||
@@ -1,150 +0,0 @@
|
||||
/* -*- c-set-style: "K&R"; c-basic-offset: 8 -*-
|
||||
*
|
||||
* This file is part of PRoot.
|
||||
*
|
||||
* Copyright (C) 2015 STMicroelectronics
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <linux/auxvec.h> /* AT_*, */
|
||||
#include <assert.h> /* assert(3), */
|
||||
#include <errno.h> /* E*, */
|
||||
#include <unistd.h> /* write(3), close(3), */
|
||||
#include <sys/types.h> /* open(2), */
|
||||
#include <sys/stat.h> /* open(2), */
|
||||
#include <fcntl.h> /* open(2), */
|
||||
|
||||
#include "execve/auxv.h"
|
||||
#include "syscall/sysnum.h"
|
||||
#include "tracee/tracee.h"
|
||||
#include "tracee/mem.h"
|
||||
#include "tracee/reg.h"
|
||||
#include "tracee/abi.h"
|
||||
#include "arch.h"
|
||||
|
||||
|
||||
/**
|
||||
* Add the given vector [@type, @value] to @vectors. This function
|
||||
* returns -errno if an error occurred, otherwise 0.
|
||||
*/
|
||||
int add_elf_aux_vector(ElfAuxVector **vectors, word_t type, word_t value)
|
||||
{
|
||||
ElfAuxVector *tmp;
|
||||
size_t nb_vectors;
|
||||
|
||||
assert(*vectors != NULL);
|
||||
|
||||
nb_vectors = talloc_array_length(*vectors);
|
||||
|
||||
/* Sanity checks. */
|
||||
assert(nb_vectors > 0);
|
||||
assert((*vectors)[nb_vectors - 1].type == AT_NULL);
|
||||
|
||||
tmp = talloc_realloc(talloc_parent(*vectors), *vectors, ElfAuxVector, nb_vectors + 1);
|
||||
if (tmp == NULL)
|
||||
return -ENOMEM;
|
||||
*vectors = tmp;
|
||||
|
||||
/* Replace the sentinel with the new vector. */
|
||||
(*vectors)[nb_vectors - 1].type = type;
|
||||
(*vectors)[nb_vectors - 1].value = value;
|
||||
|
||||
/* Restore the sentinel. */
|
||||
(*vectors)[nb_vectors].type = AT_NULL;
|
||||
(*vectors)[nb_vectors].value = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the address of the the ELF auxiliary vectors table for the
|
||||
* given @tracee. This function returns 0 if an error occurred.
|
||||
*/
|
||||
word_t get_elf_aux_vectors_address(const Tracee *tracee)
|
||||
{
|
||||
word_t address;
|
||||
word_t data;
|
||||
|
||||
/* Sanity check: this works only in execve sysexit. */
|
||||
assert(IS_IN_SYSEXIT2(tracee, PR_execve));
|
||||
|
||||
/* Right after execve, the stack layout is:
|
||||
*
|
||||
* argc, argv[0], ..., 0, envp[0], ..., 0, auxv[0].type, auxv[0].value, ..., 0, 0
|
||||
*/
|
||||
address = peek_reg(tracee, CURRENT, STACK_POINTER);
|
||||
|
||||
/* Read: argc */
|
||||
data = peek_word(tracee, address);
|
||||
if (errno != 0)
|
||||
return 0;
|
||||
|
||||
/* Skip: argc, argv, 0 */
|
||||
address += (1 + data + 1) * sizeof_word(tracee);
|
||||
|
||||
/* Skip: envp, 0 */
|
||||
do {
|
||||
data = peek_word(tracee, address);
|
||||
if (errno != 0)
|
||||
return 0;
|
||||
address += sizeof_word(tracee);
|
||||
} while (data != 0);
|
||||
|
||||
return address;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch ELF auxiliary vectors stored at the given @address in
|
||||
* @tracee's memory. This function returns NULL if an error occurred,
|
||||
* otherwise it returns a pointer to the new vectors, in an ABI
|
||||
* independent form (the Talloc parent of this pointer is
|
||||
* @tracee->ctx).
|
||||
*/
|
||||
ElfAuxVector *fetch_elf_aux_vectors(const Tracee *tracee, word_t address)
|
||||
{
|
||||
ElfAuxVector *vectors = NULL;
|
||||
ElfAuxVector vector;
|
||||
int status;
|
||||
|
||||
/* It is assumed the sentinel always exists. */
|
||||
vectors = talloc_array(tracee->ctx, ElfAuxVector, 1);
|
||||
if (vectors == NULL)
|
||||
return NULL;
|
||||
vectors[0].type = AT_NULL;
|
||||
vectors[0].value = 0;
|
||||
|
||||
while (1) {
|
||||
vector.type = peek_word(tracee, address);
|
||||
if (errno != 0)
|
||||
return NULL;
|
||||
address += sizeof_word(tracee);
|
||||
|
||||
if (vector.type == AT_NULL)
|
||||
break; /* Already added. */
|
||||
|
||||
vector.value = peek_word(tracee, address);
|
||||
if (errno != 0)
|
||||
return NULL;
|
||||
address += sizeof_word(tracee);
|
||||
|
||||
status = add_elf_aux_vector(&vectors, vector.type, vector.value);
|
||||
if (status < 0)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return vectors;
|
||||
}
|
||||