diff --git a/Application/AppController.m b/Application/AppController.m index 6980249df..73fe6ee57 100644 --- a/Application/AppController.m +++ b/Application/AppController.m @@ -494,6 +494,10 @@ void* kAppControllerContext = &kAppControllerContext; if ([brokenFeedURLs containsObject:feedURL]) { [[NSUserDefaults standardUserDefaults] setValue:feedURLdefault forKey:@"SUFeedURL"]; } + + if ([[[NSUserDefaults standardUserDefaults] stringForKey:@"midi.plugin"] isEqualToString:@"BASSMIDI"]) { + [[NSUserDefaults standardUserDefaults] setValue:@"FluidSynth" forKey:@"midi.plugin"]; + } } /* Unassign previous handler first, so dealloc can unregister it from the global map before the new instances are assigned */ diff --git a/Plugins/MIDI/MIDI.xcodeproj/project.pbxproj b/Plugins/MIDI/MIDI.xcodeproj/project.pbxproj index 756b6c49e..3d84f5951 100644 --- a/Plugins/MIDI/MIDI.xcodeproj/project.pbxproj +++ b/Plugins/MIDI/MIDI.xcodeproj/project.pbxproj @@ -7,9 +7,21 @@ objects = { /* Begin PBXBuildFile section */ - 830C94D11D171B65000E404F /* sflist.c in Sources */ = {isa = PBXBuildFile; fileRef = 830C94CB1D171B65000E404F /* sflist.c */; }; - 830C94D21D171B65000E404F /* json-builder.c in Sources */ = {isa = PBXBuildFile; fileRef = 830C94CD1D171B65000E404F /* json-builder.c */; }; - 830C94D31D171B65000E404F /* json.c in Sources */ = {isa = PBXBuildFile; fileRef = 830C94CF1D171B65000E404F /* json.c */; }; + 8309220B2640D0B8005855C1 /* SFPlayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8309220A2640D0B8005855C1 /* SFPlayer.cpp */; }; + 8309220C2640D3CD005855C1 /* libFLAC.8.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 830921FD2640CC16005855C1 /* libFLAC.8.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 8309220D2640D3CF005855C1 /* libfluidsynth.2.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 830921FB2640CC16005855C1 /* libfluidsynth.2.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 8309220E2640D3D3005855C1 /* libglib-2.0.0.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 830922022640CC16005855C1 /* libglib-2.0.0.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 8309220F2640D3D8005855C1 /* libgthread-2.0.0.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 830921FF2640CC16005855C1 /* libgthread-2.0.0.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 830922102640D3E4005855C1 /* libintl.8.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 830922042640CC16005855C1 /* libintl.8.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 830922112640D3E8005855C1 /* libogg.0.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 830922062640CC16005855C1 /* libogg.0.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 830922122640D3EC005855C1 /* libopus.0.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 830922052640CC16005855C1 /* libopus.0.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 830922132640D3F1005855C1 /* libpcre.1.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 830922012640CC16005855C1 /* libpcre.1.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 830922142640D3F4005855C1 /* libportaudio.2.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 830922032640CC16005855C1 /* libportaudio.2.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 830922152640D3F7005855C1 /* libreadline.8.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 830921FE2640CC16005855C1 /* libreadline.8.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 830922162640D3FD005855C1 /* libsndfile.1.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 830922002640CC16005855C1 /* libsndfile.1.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 830922172640D400005855C1 /* libvorbis.0.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 830922072640CC16005855C1 /* libvorbis.0.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 830922182640D40D005855C1 /* libvorbisenc.2.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 830921FC2640CC16005855C1 /* libvorbisenc.2.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 830922192640D45D005855C1 /* libfluidsynth.2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 830921FB2640CC16005855C1 /* libfluidsynth.2.dylib */; }; 834BE91B1DE407CB00A07DCD /* resampler.c in Sources */ = {isa = PBXBuildFile; fileRef = 834BE9191DE407CB00A07DCD /* resampler.c */; }; 83686AAC1C5C69D400671C7A /* AUPlayerView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 83686AAB1C5C69D400671C7A /* AUPlayerView.mm */; }; 83686AB11C5C783000671C7A /* CoreAudioKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83686AB01C5C783000671C7A /* CoreAudioKit.framework */; }; @@ -24,15 +36,6 @@ 83B06695180D5668008E3612 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 83B06693180D5668008E3612 /* InfoPlist.strings */; }; 83B06701180D5747008E3612 /* midi_processing.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83B066E0180D56BA008E3612 /* midi_processing.framework */; }; 83B06709180D64DA008E3612 /* MIDIPlayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83B06708180D64DA008E3612 /* MIDIPlayer.cpp */; }; - 83B0670C180D6665008E3612 /* BMPlayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83B0670A180D6665008E3612 /* BMPlayer.cpp */; }; - 83B0670F180D6F7F008E3612 /* libbass.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 83B0670D180D6F7F008E3612 /* libbass.dylib */; }; - 83B06710180D6F7F008E3612 /* libbassmidi.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 83B0670E180D6F7F008E3612 /* libbassmidi.dylib */; }; - 83B06712180D6FAA008E3612 /* libbass.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 83B0670D180D6F7F008E3612 /* libbass.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; - 83B06713180D6FAA008E3612 /* libbassmidi.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 83B0670E180D6F7F008E3612 /* libbassmidi.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; - 83B0671C180D6FD8008E3612 /* libbass_mpc.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 83B06714180D6FC8008E3612 /* libbass_mpc.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; - 83B0671D180D6FD8008E3612 /* libbassflac.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 83B06715180D6FC8008E3612 /* libbassflac.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; - 83B0671E180D6FD8008E3612 /* libbassopus.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 83B06716180D6FC8008E3612 /* libbassopus.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; - 83B0671F180D6FD8008E3612 /* libbasswv.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 83B06717180D6FC8008E3612 /* libbasswv.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 83B06722180D70FE008E3612 /* MIDIDecoder.mm in Sources */ = {isa = PBXBuildFile; fileRef = 83B06721180D70FE008E3612 /* MIDIDecoder.mm */; }; 83C35702180EDB74007E9DF0 /* MIDIContainer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 83C35700180EDB74007E9DF0 /* MIDIContainer.mm */; }; 83C35705180EDD1C007E9DF0 /* MIDIMetadataReader.mm in Sources */ = {isa = PBXBuildFile; fileRef = 83C35703180EDD1C007E9DF0 /* MIDIMetadataReader.mm */; }; @@ -75,24 +78,40 @@ dstPath = ""; dstSubfolderSpec = 6; files = ( - 83B0671C180D6FD8008E3612 /* libbass_mpc.dylib in CopyFiles */, - 83B0671D180D6FD8008E3612 /* libbassflac.dylib in CopyFiles */, - 83B0671E180D6FD8008E3612 /* libbassopus.dylib in CopyFiles */, - 83B0671F180D6FD8008E3612 /* libbasswv.dylib in CopyFiles */, - 83B06712180D6FAA008E3612 /* libbass.dylib in CopyFiles */, - 83B06713180D6FAA008E3612 /* libbassmidi.dylib in CopyFiles */, + 8309220C2640D3CD005855C1 /* libFLAC.8.dylib in CopyFiles */, + 8309220D2640D3CF005855C1 /* libfluidsynth.2.dylib in CopyFiles */, + 8309220F2640D3D8005855C1 /* libgthread-2.0.0.dylib in CopyFiles */, + 8309220E2640D3D3005855C1 /* libglib-2.0.0.dylib in CopyFiles */, + 830922102640D3E4005855C1 /* libintl.8.dylib in CopyFiles */, + 830922112640D3E8005855C1 /* libogg.0.dylib in CopyFiles */, + 830922122640D3EC005855C1 /* libopus.0.dylib in CopyFiles */, + 830922132640D3F1005855C1 /* libpcre.1.dylib in CopyFiles */, + 830922142640D3F4005855C1 /* libportaudio.2.dylib in CopyFiles */, + 830922152640D3F7005855C1 /* libreadline.8.dylib in CopyFiles */, + 830922162640D3FD005855C1 /* libsndfile.1.dylib in CopyFiles */, + 830922172640D400005855C1 /* libvorbis.0.dylib in CopyFiles */, + 830922182640D40D005855C1 /* libvorbisenc.2.dylib in CopyFiles */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 830C94CB1D171B65000E404F /* sflist.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sflist.c; path = ../../../ThirdParty/BASS/sflist.c; sourceTree = ""; }; - 830C94CC1D171B65000E404F /* sflist.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sflist.h; path = ../../../ThirdParty/BASS/sflist.h; sourceTree = ""; }; - 830C94CD1D171B65000E404F /* json-builder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "json-builder.c"; path = "../../../ThirdParty/json/json-builder.c"; sourceTree = ""; }; - 830C94CE1D171B65000E404F /* json-builder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "json-builder.h"; path = "../../../ThirdParty/json/json-builder.h"; sourceTree = ""; }; - 830C94CF1D171B65000E404F /* json.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = json.c; path = ../../../ThirdParty/json/json.c; sourceTree = ""; }; - 830C94D01D171B65000E404F /* json.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = json.h; path = ../../../ThirdParty/json/json.h; sourceTree = ""; }; + 830921FA2640CBBD005855C1 /* SFPlayer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SFPlayer.h; sourceTree = ""; }; + 830921FB2640CC16005855C1 /* libfluidsynth.2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libfluidsynth.2.dylib; path = ../../ThirdParty/FluidSynth/libfluidsynth.2.dylib; sourceTree = ""; }; + 830921FC2640CC16005855C1 /* libvorbisenc.2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libvorbisenc.2.dylib; path = ../../ThirdParty/FluidSynth/libvorbisenc.2.dylib; sourceTree = ""; }; + 830921FD2640CC16005855C1 /* libFLAC.8.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libFLAC.8.dylib; path = ../../ThirdParty/FluidSynth/libFLAC.8.dylib; sourceTree = ""; }; + 830921FE2640CC16005855C1 /* libreadline.8.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libreadline.8.dylib; path = ../../ThirdParty/FluidSynth/libreadline.8.dylib; sourceTree = ""; }; + 830921FF2640CC16005855C1 /* libgthread-2.0.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libgthread-2.0.0.dylib"; path = "../../ThirdParty/FluidSynth/libgthread-2.0.0.dylib"; sourceTree = ""; }; + 830922002640CC16005855C1 /* libsndfile.1.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsndfile.1.dylib; path = ../../ThirdParty/FluidSynth/libsndfile.1.dylib; sourceTree = ""; }; + 830922012640CC16005855C1 /* libpcre.1.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libpcre.1.dylib; path = ../../ThirdParty/FluidSynth/libpcre.1.dylib; sourceTree = ""; }; + 830922022640CC16005855C1 /* libglib-2.0.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libglib-2.0.0.dylib"; path = "../../ThirdParty/FluidSynth/libglib-2.0.0.dylib"; sourceTree = ""; }; + 830922032640CC16005855C1 /* libportaudio.2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libportaudio.2.dylib; path = ../../ThirdParty/FluidSynth/libportaudio.2.dylib; sourceTree = ""; }; + 830922042640CC16005855C1 /* libintl.8.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libintl.8.dylib; path = ../../ThirdParty/FluidSynth/libintl.8.dylib; sourceTree = ""; }; + 830922052640CC16005855C1 /* libopus.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libopus.0.dylib; path = ../../ThirdParty/FluidSynth/libopus.0.dylib; sourceTree = ""; }; + 830922062640CC16005855C1 /* libogg.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libogg.0.dylib; path = ../../ThirdParty/FluidSynth/libogg.0.dylib; sourceTree = ""; }; + 830922072640CC16005855C1 /* libvorbis.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libvorbis.0.dylib; path = ../../ThirdParty/FluidSynth/libvorbis.0.dylib; sourceTree = ""; }; + 8309220A2640D0B8005855C1 /* SFPlayer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SFPlayer.cpp; sourceTree = ""; }; 833F68431CDBCABE00AFB9F0 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/InfoPlist.strings; sourceTree = ""; }; 834BE9191DE407CB00A07DCD /* resampler.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = resampler.c; sourceTree = ""; }; 834BE91A1DE407CB00A07DCD /* resampler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = resampler.h; sourceTree = ""; }; @@ -131,14 +150,6 @@ 83B066DA180D56B9008E3612 /* midi_processing.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = midi_processing.xcodeproj; path = ../../Frameworks/midi_processing/midi_processing.xcodeproj; sourceTree = ""; }; 83B06706180D6471008E3612 /* MIDIPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MIDIPlayer.h; sourceTree = ""; }; 83B06708180D64DA008E3612 /* MIDIPlayer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MIDIPlayer.cpp; sourceTree = ""; }; - 83B0670A180D6665008E3612 /* BMPlayer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BMPlayer.cpp; sourceTree = ""; }; - 83B0670B180D6665008E3612 /* BMPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BMPlayer.h; sourceTree = ""; }; - 83B0670D180D6F7F008E3612 /* libbass.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libbass.dylib; path = ../../ThirdParty/BASS/libbass.dylib; sourceTree = ""; }; - 83B0670E180D6F7F008E3612 /* libbassmidi.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libbassmidi.dylib; path = ../../ThirdParty/BASS/libbassmidi.dylib; sourceTree = ""; }; - 83B06714180D6FC8008E3612 /* libbass_mpc.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libbass_mpc.dylib; path = ../../ThirdParty/BASS/libbass_mpc.dylib; sourceTree = ""; }; - 83B06715180D6FC8008E3612 /* libbassflac.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libbassflac.dylib; path = ../../ThirdParty/BASS/libbassflac.dylib; sourceTree = ""; }; - 83B06716180D6FC8008E3612 /* libbassopus.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libbassopus.dylib; path = ../../ThirdParty/BASS/libbassopus.dylib; sourceTree = ""; }; - 83B06717180D6FC8008E3612 /* libbasswv.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libbasswv.dylib; path = ../../ThirdParty/BASS/libbasswv.dylib; sourceTree = ""; }; 83B06720180D70FE008E3612 /* MIDIDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MIDIDecoder.h; sourceTree = ""; }; 83B06721180D70FE008E3612 /* MIDIDecoder.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MIDIDecoder.mm; sourceTree = ""; }; 83B06723180D714F008E3612 /* Plugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Plugin.h; path = ../../../Audio/Plugin.h; sourceTree = ""; }; @@ -163,29 +174,15 @@ files = ( 83686AB11C5C783000671C7A /* CoreAudioKit.framework in Frameworks */, 8398F2E01C438C7D00EB9639 /* AudioUnit.framework in Frameworks */, - 83B0670F180D6F7F008E3612 /* libbass.dylib in Frameworks */, 83B06701180D5747008E3612 /* midi_processing.framework in Frameworks */, - 83B06710180D6F7F008E3612 /* libbassmidi.dylib in Frameworks */, 83B0668B180D5668008E3612 /* Cocoa.framework in Frameworks */, + 830922192640D45D005855C1 /* libfluidsynth.2.dylib in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 830C94CA1D171B30000E404F /* sflist */ = { - isa = PBXGroup; - children = ( - 830C94CB1D171B65000E404F /* sflist.c */, - 830C94CC1D171B65000E404F /* sflist.h */, - 830C94CD1D171B65000E404F /* json-builder.c */, - 830C94CE1D171B65000E404F /* json-builder.h */, - 830C94CF1D171B65000E404F /* json.c */, - 830C94D01D171B65000E404F /* json.h */, - ); - name = sflist; - sourceTree = ""; - }; 83A09F551CFA83F2001E7D2D /* synthlib_doom */ = { isa = PBXGroup; children = ( @@ -254,12 +251,6 @@ 83686AB01C5C783000671C7A /* CoreAudioKit.framework */, 83686AAE1C5C780500671C7A /* AudioToolbox.framework */, 8398F2DF1C438C7D00EB9639 /* AudioUnit.framework */, - 83B06714180D6FC8008E3612 /* libbass_mpc.dylib */, - 83B06715180D6FC8008E3612 /* libbassflac.dylib */, - 83B06716180D6FC8008E3612 /* libbassopus.dylib */, - 83B06717180D6FC8008E3612 /* libbasswv.dylib */, - 83B0670D180D6F7F008E3612 /* libbass.dylib */, - 83B0670E180D6F7F008E3612 /* libbassmidi.dylib */, 83B0668A180D5668008E3612 /* Cocoa.framework */, 83B0668C180D5668008E3612 /* Other Frameworks */, 83B066DA180D56B9008E3612 /* midi_processing.xcodeproj */, @@ -270,6 +261,19 @@ 83B0668C180D5668008E3612 /* Other Frameworks */ = { isa = PBXGroup; children = ( + 830921FD2640CC16005855C1 /* libFLAC.8.dylib */, + 830921FB2640CC16005855C1 /* libfluidsynth.2.dylib */, + 830922022640CC16005855C1 /* libglib-2.0.0.dylib */, + 830921FF2640CC16005855C1 /* libgthread-2.0.0.dylib */, + 830922042640CC16005855C1 /* libintl.8.dylib */, + 830922062640CC16005855C1 /* libogg.0.dylib */, + 830922052640CC16005855C1 /* libopus.0.dylib */, + 830922012640CC16005855C1 /* libpcre.1.dylib */, + 830922032640CC16005855C1 /* libportaudio.2.dylib */, + 830921FE2640CC16005855C1 /* libreadline.8.dylib */, + 830922002640CC16005855C1 /* libsndfile.1.dylib */, + 830922072640CC16005855C1 /* libvorbis.0.dylib */, + 830921FC2640CC16005855C1 /* libvorbisenc.2.dylib */, 83B0668D180D5668008E3612 /* Foundation.framework */, 83B0668E180D5668008E3612 /* CoreData.framework */, 83B0668F180D5668008E3612 /* AppKit.framework */, @@ -280,7 +284,8 @@ 83B06690180D5668008E3612 /* MIDI */ = { isa = PBXGroup; children = ( - 830C94CA1D171B30000E404F /* sflist */, + 8309220A2640D0B8005855C1 /* SFPlayer.cpp */, + 830921FA2640CBBD005855C1 /* SFPlayer.h */, 83A09F6E1CFA8D6B001E7D2D /* MSPlayer.cpp */, 83A09F6D1CFA8D6B001E7D2D /* MSPlayer.h */, 83A09F661CFA883D001E7D2D /* interface.h */, @@ -306,8 +311,6 @@ 83B06723180D714F008E3612 /* Plugin.h */, 83B06720180D70FE008E3612 /* MIDIDecoder.h */, 83B06721180D70FE008E3612 /* MIDIDecoder.mm */, - 83B0670A180D6665008E3612 /* BMPlayer.cpp */, - 83B0670B180D6665008E3612 /* BMPlayer.h */, 83B06708180D64DA008E3612 /* MIDIPlayer.cpp */, 83B06706180D6471008E3612 /* MIDIPlayer.h */, 83B06691180D5668008E3612 /* Supporting Files */, @@ -424,7 +427,6 @@ files = ( 83E973471C4378880007F413 /* AUPlayer.mm in Sources */, 83686AAC1C5C69D400671C7A /* AUPlayerView.mm in Sources */, - 830C94D31D171B65000E404F /* json.c in Sources */, 83DFEA071CBC87BB00BCC565 /* SCCore.cpp in Sources */, 83A09F621CFA83F2001E7D2D /* i_oplmusic.cpp in Sources */, 83B06709180D64DA008E3612 /* MIDIPlayer.cpp in Sources */, @@ -433,13 +435,11 @@ 83B06722180D70FE008E3612 /* MIDIDecoder.mm in Sources */, 83A09F6F1CFA8D6B001E7D2D /* MSPlayer.cpp in Sources */, 83C35702180EDB74007E9DF0 /* MIDIContainer.mm in Sources */, - 83B0670C180D6665008E3612 /* BMPlayer.cpp in Sources */, 83A09F651CFA83F2001E7D2D /* opl3class.cpp in Sources */, 83C35705180EDD1C007E9DF0 /* MIDIMetadataReader.mm in Sources */, - 830C94D21D171B65000E404F /* json-builder.c in Sources */, 834BE91B1DE407CB00A07DCD /* resampler.c in Sources */, - 830C94D11D171B65000E404F /* sflist.c in Sources */, 83A09F641CFA83F2001E7D2D /* opl3.cpp in Sources */, + 8309220B2640D0B8005855C1 /* SFPlayer.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -577,14 +577,14 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "MIDI/MIDI-Prefix.pch"; HEADER_SEARCH_PATHS = ( - "$(SRCROOT)/../../ThirdParty/BASS", + "$(SRCROOT)/../../ThirdParty/FluidSynth/include", "$(SRCROOT)/../../ThirdParty/json", ); INFOPLIST_FILE = "MIDI/MIDI-Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", - "$(PROJECT_DIR)/../../ThirdParty/BASS", + "$(PROJECT_DIR)/../../ThirdParty/FluidSynth", ); PRODUCT_BUNDLE_IDENTIFIER = net.kode54.midi; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -605,14 +605,14 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "MIDI/MIDI-Prefix.pch"; HEADER_SEARCH_PATHS = ( - "$(SRCROOT)/../../ThirdParty/BASS", + "$(SRCROOT)/../../ThirdParty/FluidSynth/include", "$(SRCROOT)/../../ThirdParty/json", ); INFOPLIST_FILE = "MIDI/MIDI-Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", - "$(PROJECT_DIR)/../../ThirdParty/BASS", + "$(PROJECT_DIR)/../../ThirdParty/FluidSynth", ); PRODUCT_BUNDLE_IDENTIFIER = net.kode54.midi; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/Plugins/MIDI/MIDI/MIDIDecoder.h b/Plugins/MIDI/MIDI/MIDIDecoder.h index f9901a54e..d45bf2585 100755 --- a/Plugins/MIDI/MIDI/MIDIDecoder.h +++ b/Plugins/MIDI/MIDI/MIDIDecoder.h @@ -13,13 +13,13 @@ #import "Plugin.h" class AUPlayer; -class BMPlayer; +class SFPlayer; @interface MIDIDecoder : NSObject { id source; int track_num; - BMPlayer* bmplayer; + SFPlayer* sfplayer; AUPlayer* auplayer; MIDIPlayer* player; midi_container midi_file; diff --git a/Plugins/MIDI/MIDI/MIDIDecoder.mm b/Plugins/MIDI/MIDI/MIDIDecoder.mm index 681a3423b..896b48ec8 100755 --- a/Plugins/MIDI/MIDI/MIDIDecoder.mm +++ b/Plugins/MIDI/MIDI/MIDIDecoder.mm @@ -9,7 +9,7 @@ #import "MIDIDecoder.h" #import "AUPlayer.h" -#import "BMPlayer.h" +#import "SFPlayer.h" #import "SCPlayer.h" #import "MSPlayer.h" @@ -153,22 +153,26 @@ static OSType getOSType(const char * in_) DLog(@"Track num: %i", track_num); NSString * plugin = [[NSUserDefaults standardUserDefaults] stringForKey:@"midi.plugin"]; - if (!plugin || [plugin isEqualToString:@"BASSMIDI"]) + if (!plugin || [plugin isEqualToString:@"FluidSynth"]) { - bmplayer = new BMPlayer; + sfplayer = new SFPlayer; - bool resampling_sinc = false; + unsigned int resamplingQuality = 0; NSString * resampling = [[NSUserDefaults standardUserDefaults] stringForKey:@"resampling"]; - if ([resampling isEqualToString:@"sinc"]) - resampling_sinc = true; + if ([resampling isEqualToString:@"linear"]) + resamplingQuality = 1; + else if ([resampling isEqualToString:@"cubic"]) + resamplingQuality = 4; + else if ([resampling isEqualToString:@"sinc"]) + resamplingQuality = 7; - bmplayer->setSincInterpolation( resampling_sinc ); - bmplayer->setSampleRate( 44100 ); + sfplayer->setInterpolationMethod(resamplingQuality); + sfplayer->setSampleRate( 44100 ); if ( [soundFontPath length] ) - bmplayer->setFileSoundFont( [soundFontPath UTF8String] ); + sfplayer->setFileSoundFont( [soundFontPath UTF8String] ); - player = bmplayer; + player = sfplayer; } else if ([[plugin substringToIndex:4] isEqualToString:@"DOOM"]) { @@ -277,13 +281,13 @@ static OSType getOSType(const char * in_) if ( !repeatone && framesRead >= localTotalFrames ) return 0; - if ( (bmplayer||auplayer) && !soundFontsAssigned ) { + if ( (sfplayer||auplayer) && !soundFontsAssigned ) { NSString * soundFontPath = [[NSUserDefaults standardUserDefaults] stringForKey:@"soundFontPath"]; if (soundFontPath == nil) return 0; - if (bmplayer) - bmplayer->setSoundFont( [soundFontPath UTF8String] ); + if (sfplayer) + sfplayer->setSoundFont( [soundFontPath UTF8String] ); else if (auplayer) auplayer->setSoundFont( [soundFontPath UTF8String] ); diff --git a/Plugins/MIDI/MIDI/SFPlayer.cpp b/Plugins/MIDI/MIDI/SFPlayer.cpp new file mode 100644 index 000000000..2fabb9f23 --- /dev/null +++ b/Plugins/MIDI/MIDI/SFPlayer.cpp @@ -0,0 +1,314 @@ +// +// SFPlayer.cpp +// MIDI +// +// Created by Christopher Snowhill on 5/3/21. +// Copyright © 2021 Christopher Snowhill. All rights reserved. +// + +#include "SFPlayer.h" + +#include + +#define _countof(x) (sizeof((x))/sizeof(((x)[0]))) + +static const uint8_t sysex_gm_reset[] = { 0xF0, 0x7E, 0x7F, 0x09, 0x01, 0xF7 }; +static const uint8_t sysex_gm2_reset[]= { 0xF0, 0x7E, 0x7F, 0x09, 0x03, 0xF7 }; +static const uint8_t sysex_gs_reset[] = { 0xF0, 0x41, 0x10, 0x42, 0x12, 0x40, 0x00, 0x7F, 0x00, 0x41, 0xF7 }; +static const uint8_t sysex_xg_reset[] = { 0xF0, 0x43, 0x10, 0x4C, 0x00, 0x00, 0x7E, 0x00, 0xF7 }; + +static bool is_gs_reset(const unsigned char * data, unsigned long size) +{ + if ( size != _countof( sysex_gs_reset ) ) return false; + + if ( memcmp( data, sysex_gs_reset, 5 ) != 0 ) return false; + if ( memcmp( data + 7, sysex_gs_reset + 7, 2 ) != 0 ) return false; + if ( ( ( data[ 5 ] + data[ 6 ] + 1 ) & 127 ) != data[ 9 ] ) return false; + if ( data[ 10 ] != sysex_gs_reset[ 10 ] ) return false; + + return true; +} + +SFPlayer::SFPlayer() : MIDIPlayer() +{ + _synth = 0; + uInterpolationMethod = FLUID_INTERP_DEFAULT; + + reset_drums(); + + synth_mode = mode_gm; + + _settings = new_fluid_settings(); + + fluid_settings_setnum(_settings, "synth.gain", 1.0); + fluid_settings_setnum(_settings, "synth.sample-rate", 44100); + fluid_settings_setint(_settings, "synth.midi-channels", 48); +} + +SFPlayer::~SFPlayer() +{ + if (_synth) delete_fluid_synth(_synth); + if (_settings) delete_fluid_settings(_settings); +} + +void SFPlayer::setInterpolationMethod(unsigned method) +{ + shutdown(); + uInterpolationMethod = method; + if ( _synth ) fluid_synth_set_interp_method( _synth, -1, method ); +} + +void SFPlayer::send_event(uint32_t b) +{ + if (!(b & 0x80000000)) + { + int param2 = (b >> 16) & 0xFF; + int param1 = (b >> 8) & 0xFF; + int cmd = b & 0xF0; + int chan = b & 0x0F; + int port = (b >> 24) & 0x7F; + + if ( port && port < 3 ) + chan += port * 16; + + switch (cmd) + { + case 0x80: + fluid_synth_noteoff(_synth, chan, param1); + break; + case 0x90: + fluid_synth_noteon(_synth, chan, param1, param2); + break; + case 0xA0: + break; + case 0xB0: + fluid_synth_cc(_synth, chan, param1, param2); + if ( param1 == 0 || param1 == 0x20 ) + { + unsigned bank = channel_banks[ chan ]; + if ( param1 == 0x20 ) bank = ( bank & 0x3F80 ) | ( param2 & 0x7F ); + else bank = ( bank & 0x007F ) | ( ( param2 & 0x7F ) << 7 ); + channel_banks[ chan ] = bank; + if ( synth_mode == mode_xg ) + { + if ( bank == 16256 ) drum_channels [chan] = 1; + else drum_channels [chan] = 0; + } + else if ( synth_mode == mode_gm2 ) + { + if ( bank == 15360 ) + drum_channels [chan] = 1; + else if ( bank == 15488 ) + drum_channels [chan] = 0; + } + } + break; + case 0xC0: + if ( drum_channels [chan] ) fluid_synth_bank_select(_synth, chan, 16256 /*DRUM_INST_BANK*/); + fluid_synth_program_change(_synth, chan, param1); + break; + case 0xD0: + fluid_synth_channel_pressure(_synth, chan, param1); + break; + case 0xE0: + fluid_synth_pitch_bend(_synth, chan, (param2 << 7) | param1); + break; + } + } + else + { + uint32_t n = b & 0xffffff; + const uint8_t * data; + size_t size, port; + mSysexMap.get_entry( n, data, size, port ); + if (port >= 3) + port = 0; + if ( ( size == _countof( sysex_gm_reset ) && !memcmp( data, sysex_gm_reset, _countof( sysex_gm_reset ) ) ) || + ( size == _countof( sysex_gm2_reset ) && !memcmp( data, sysex_gm2_reset, _countof( sysex_gm2_reset ) ) ) || + is_gs_reset( data, size ) || + ( size == _countof( sysex_xg_reset ) && !memcmp( data, sysex_xg_reset, _countof( sysex_xg_reset ) ) ) ) + { + fluid_synth_system_reset( _synth ); + reset_drums(); + synth_mode = ( size == _countof( sysex_xg_reset ) ) ? mode_xg : + ( size == _countof( sysex_gs_reset ) ) ? mode_gs : + ( data [4] == 0x01 ) ? mode_gm : + mode_gm2; + } + else if ( synth_mode == mode_gs && size == 11 && + data [0] == 0xF0 && data [1] == 0x41 && data [3] == 0x42 && + data [4] == 0x12 && data [5] == 0x40 && (data [6] & 0xF0) == 0x10 && + data [10] == 0xF7) + { + if (data [7] == 2) + { + // GS MIDI channel to part assign + gs_part_to_ch [ ( port * 16 ) + ( data [6] & 15 ) ] = data [8]; + } + else if ( data [7] == 0x15 ) + { + // GS part to rhythm allocation + unsigned int drum_channel = gs_part_to_ch [ ( port * 16 ) + ( data [6] & 15 ) ]; + if ( drum_channel < 16 ) + { + drum_channels [ ( port * 16 ) + drum_channel ] = data [8]; + if ( port == 0 ) + { + drum_channels [ 16 + drum_channel ] = data [8]; + drum_channels [ 32 + drum_channel ] = data [8]; + } + } + } + } + } +} + +void SFPlayer::render(float * out, unsigned long count) +{ + fluid_synth_write_float(_synth, count, out, 0, 2, out, 1, 2); +} + +void SFPlayer::setSoundFont( const char * in ) +{ + sSoundFontName = in; + shutdown(); +} + +void SFPlayer::setFileSoundFont( const char * in ) +{ + sFileSoundFontName = in; + shutdown(); +} + +void SFPlayer::shutdown() +{ + if (_synth) delete_fluid_synth(_synth); + _synth = 0; +} + +bool SFPlayer::startup() +{ + if ( _synth ) return true; + + fluid_settings_setnum(_settings, "synth.sample-rate", uSampleRate); + + _synth = new_fluid_synth(_settings); + if (!_synth) + { + _last_error = "Out of memory"; + return false; + } + fluid_synth_set_interp_method( _synth, -1, uInterpolationMethod ); + reset_drums(); + synth_mode = mode_gm; + if (sSoundFontName.length()) + { + std::string ext; + size_t dot = sSoundFontName.find_last_of( '.' ); + if ( dot != std::string::npos ) + ext.assign( sSoundFontName.begin() + dot + 1, sSoundFontName.end() ); + if ( !strcasecmp( ext.c_str(), "sf2" ) ) + { + if ( FLUID_FAILED == fluid_synth_sfload( _synth, sSoundFontName.c_str(), 1) ) + { + shutdown(); + _last_error = "Failed to load SoundFont bank: "; + _last_error += sSoundFontName; + return false; + } + } + else if ( !strcasecmp( ext.c_str(), "sflist" ) ) + { + FILE * fl = fopen( sSoundFontName.c_str(), "r" ); + if ( fl ) + { + std::string path, temp; + char name[32768]; + size_t slash = sSoundFontName.find_last_of( '\\' ); + if ( slash != std::string::npos ) + path.assign( sSoundFontName.begin(), sSoundFontName.begin() + slash + 1 ); + while ( !feof( fl ) ) + { + if ( !fgets( name, 32767, fl ) ) break; + name[32767] = 0; + char * cr = strchr( name, '\n' ); + if ( cr ) *cr = 0; + cr = strchr( name, '\r' ); + if ( cr ) *cr = 0; + if ( name[0] == '/' ) + { + temp = name; + } + else + { + temp = path; + temp += name; + } + if ( FLUID_FAILED == fluid_synth_sfload( _synth, temp.c_str(), 1 ) ) + { + fclose( fl ); + shutdown(); + _last_error = "Failed to load SoundFont bank: "; + _last_error += temp; + return false; + } + } + fclose( fl ); + } + else + { + _last_error = "Failed to open SoundFont list: "; + _last_error += sSoundFontName; + return false; + } + } + } + + if ( sFileSoundFontName.length() ) + { + if ( FLUID_FAILED == fluid_synth_sfload(_synth, sFileSoundFontName.c_str(), 1) ) + { + shutdown(); + _last_error = "Failed to load SoundFont bank: "; + _last_error += sFileSoundFontName; + return false; + } + } + + _last_error = ""; + + return true; +} + +void SFPlayer::reset_drums() +{ + static const uint8_t part_to_ch[16] = { 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15 }; + + memset( drum_channels, 0, sizeof( drum_channels ) ); + drum_channels [9] = 1; + drum_channels [9+16] = 1; + drum_channels [9+32] = 1; + + memcpy( gs_part_to_ch, part_to_ch, sizeof( gs_part_to_ch ) ); + memcpy( gs_part_to_ch+16, part_to_ch, sizeof( gs_part_to_ch ) ); + memcpy( gs_part_to_ch+32, part_to_ch, sizeof( gs_part_to_ch ) ); + + memset( channel_banks, 0, sizeof( channel_banks ) ); + + if ( _synth ) + { + for ( unsigned i = 0; i < 48; ++i ) + { + if ( drum_channels [i] ) + { + fluid_synth_bank_select( _synth, i, 16256 /*DRUM_INST_BANK*/); + } + } + } +} + +const char * SFPlayer::GetLastError() const +{ + if ( _last_error.length() ) return _last_error.c_str(); + return NULL; +} diff --git a/Plugins/MIDI/MIDI/SFPlayer.h b/Plugins/MIDI/MIDI/SFPlayer.h new file mode 100644 index 000000000..69ff96f60 --- /dev/null +++ b/Plugins/MIDI/MIDI/SFPlayer.h @@ -0,0 +1,63 @@ +// +// SFPlayer.h +// MIDI +// +// Created by Christopher Snowhill on 5/3/21. +// Copyright © 2021 Christopher Snowhill. All rights reserved. +// + +#ifndef SFPlayer_h +#define SFPlayer_h + +#include "MIDIPlayer.h" + +#include + +class SFPlayer : public MIDIPlayer +{ +public: + // zero variables + SFPlayer(); + + // close, unload + virtual ~SFPlayer(); + + // configuration + void setSoundFont( const char * in ); + void setFileSoundFont( const char * in ); + void setInterpolationMethod(unsigned method); + + const char * GetLastError() const; + +private: + virtual void send_event(uint32_t b); + virtual void render(float * out, unsigned long count); + + virtual void shutdown(); + virtual bool startup(); + + std::string _last_error; + + fluid_settings_t * _settings; + fluid_synth_t * _synth; + std::string sSoundFontName; + std::string sFileSoundFontName; + + unsigned uInterpolationMethod; + + enum + { + mode_gm = 0, + mode_gm2, + mode_gs, + mode_xg + } + synth_mode; + + void reset_drums(); + uint8_t drum_channels[48]; + uint8_t gs_part_to_ch[48]; + unsigned short channel_banks[48]; +}; + +#endif /* SFPlayer_h */ diff --git a/Preferences/Preferences/MIDIPane.m b/Preferences/Preferences/MIDIPane.m index 4bea99e15..d308fb1a0 100644 --- a/Preferences/Preferences/MIDIPane.m +++ b/Preferences/Preferences/MIDIPane.m @@ -24,7 +24,7 @@ - (IBAction)setSoundFont:(id)sender { - NSArray *fileTypes = @[@"sf2", @"sf2pack", @"sflist", @"json"]; + NSArray *fileTypes = @[@"sf3", @"sf2", @"sflist"]; NSOpenPanel * panel = [NSOpenPanel openPanel]; [panel setAllowsMultipleSelection:NO]; [panel setCanChooseDirectories:NO]; diff --git a/Preferences/Preferences/MIDIPluginBehaviorArrayController.m b/Preferences/Preferences/MIDIPluginBehaviorArrayController.m index f3e0e43c2..612fc13a7 100644 --- a/Preferences/Preferences/MIDIPluginBehaviorArrayController.m +++ b/Preferences/Preferences/MIDIPluginBehaviorArrayController.m @@ -74,7 +74,7 @@ static void enumCallback(void *context, OSType uSubType, OSType uManufacturer, c [self addObject: [NSDictionary dictionaryWithObjectsAndKeys: - @"BASSMIDI", @"name", @"BASSMIDI", @"preference", nil]]; + @"FluidSynth", @"name", @"FluidSynth", @"preference", nil]]; [self addObject: [NSDictionary dictionaryWithObjectsAndKeys: diff --git a/ThirdParty/BASS/bass.h b/ThirdParty/BASS/bass.h deleted file mode 100644 index 901f9a276..000000000 --- a/ThirdParty/BASS/bass.h +++ /dev/null @@ -1,1160 +0,0 @@ -/* - BASS 2.4 C/C++ header file - Copyright (c) 1999-2019 Un4seen Developments Ltd. - - See the BASS.CHM file for more detailed documentation -*/ - -#ifndef BASS_H -#define BASS_H - -#ifdef _WIN32 -#include -typedef unsigned __int64 QWORD; -#else -#include -#define WINAPI -#define CALLBACK -typedef uint8_t BYTE; -typedef uint16_t WORD; -typedef uint32_t DWORD; -typedef uint64_t QWORD; -#ifdef __OBJC__ -#include -#else -typedef int BOOL; -#endif -#ifndef TRUE -#define TRUE 1 -#define FALSE 0 -#endif -#define LOBYTE(a) (BYTE)(a) -#define HIBYTE(a) (BYTE)((a)>>8) -#define LOWORD(a) (WORD)(a) -#define HIWORD(a) (WORD)((a)>>16) -#define MAKEWORD(a,b) (WORD)(((a)&0xff)|((b)<<8)) -#define MAKELONG(a,b) (DWORD)(((a)&0xffff)|((b)<<16)) -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#define BASSVERSION 0x204 // API version -#define BASSVERSIONTEXT "2.4" - -#ifndef BASSDEF -#define BASSDEF(f) WINAPI f -#else -#define NOBASSOVERLOADS -#endif - -typedef DWORD HMUSIC; // MOD music handle -typedef DWORD HSAMPLE; // sample handle -typedef DWORD HCHANNEL; // playing sample's channel handle -typedef DWORD HSTREAM; // sample stream handle -typedef DWORD HRECORD; // recording handle -typedef DWORD HSYNC; // synchronizer handle -typedef DWORD HDSP; // DSP handle -typedef DWORD HFX; // DX8 effect handle -typedef DWORD HPLUGIN; // Plugin handle - -// Error codes returned by BASS_ErrorGetCode -#define BASS_OK 0 // all is OK -#define BASS_ERROR_MEM 1 // memory error -#define BASS_ERROR_FILEOPEN 2 // can't open the file -#define BASS_ERROR_DRIVER 3 // can't find a free/valid driver -#define BASS_ERROR_BUFLOST 4 // the sample buffer was lost -#define BASS_ERROR_HANDLE 5 // invalid handle -#define BASS_ERROR_FORMAT 6 // unsupported sample format -#define BASS_ERROR_POSITION 7 // invalid position -#define BASS_ERROR_INIT 8 // BASS_Init has not been successfully called -#define BASS_ERROR_START 9 // BASS_Start has not been successfully called -#define BASS_ERROR_SSL 10 // SSL/HTTPS support isn't available -#define BASS_ERROR_ALREADY 14 // already initialized/paused/whatever -#define BASS_ERROR_NOTAUDIO 17 // file does not contain audio -#define BASS_ERROR_NOCHAN 18 // can't get a free channel -#define BASS_ERROR_ILLTYPE 19 // an illegal type was specified -#define BASS_ERROR_ILLPARAM 20 // an illegal parameter was specified -#define BASS_ERROR_NO3D 21 // no 3D support -#define BASS_ERROR_NOEAX 22 // no EAX support -#define BASS_ERROR_DEVICE 23 // illegal device number -#define BASS_ERROR_NOPLAY 24 // not playing -#define BASS_ERROR_FREQ 25 // illegal sample rate -#define BASS_ERROR_NOTFILE 27 // the stream is not a file stream -#define BASS_ERROR_NOHW 29 // no hardware voices available -#define BASS_ERROR_EMPTY 31 // the MOD music has no sequence data -#define BASS_ERROR_NONET 32 // no internet connection could be opened -#define BASS_ERROR_CREATE 33 // couldn't create the file -#define BASS_ERROR_NOFX 34 // effects are not available -#define BASS_ERROR_NOTAVAIL 37 // requested data/action is not available -#define BASS_ERROR_DECODE 38 // the channel is/isn't a "decoding channel" -#define BASS_ERROR_DX 39 // a sufficient DirectX version is not installed -#define BASS_ERROR_TIMEOUT 40 // connection timedout -#define BASS_ERROR_FILEFORM 41 // unsupported file format -#define BASS_ERROR_SPEAKER 42 // unavailable speaker -#define BASS_ERROR_VERSION 43 // invalid BASS version (used by add-ons) -#define BASS_ERROR_CODEC 44 // codec is not available/supported -#define BASS_ERROR_ENDED 45 // the channel/file has ended -#define BASS_ERROR_BUSY 46 // the device is busy -#define BASS_ERROR_UNSTREAMABLE 47 // unstreamable file -#define BASS_ERROR_UNKNOWN -1 // some other mystery problem - -// BASS_SetConfig options -#define BASS_CONFIG_BUFFER 0 -#define BASS_CONFIG_UPDATEPERIOD 1 -#define BASS_CONFIG_GVOL_SAMPLE 4 -#define BASS_CONFIG_GVOL_STREAM 5 -#define BASS_CONFIG_GVOL_MUSIC 6 -#define BASS_CONFIG_CURVE_VOL 7 -#define BASS_CONFIG_CURVE_PAN 8 -#define BASS_CONFIG_FLOATDSP 9 -#define BASS_CONFIG_3DALGORITHM 10 -#define BASS_CONFIG_NET_TIMEOUT 11 -#define BASS_CONFIG_NET_BUFFER 12 -#define BASS_CONFIG_PAUSE_NOPLAY 13 -#define BASS_CONFIG_NET_PREBUF 15 -#define BASS_CONFIG_NET_PASSIVE 18 -#define BASS_CONFIG_REC_BUFFER 19 -#define BASS_CONFIG_NET_PLAYLIST 21 -#define BASS_CONFIG_MUSIC_VIRTUAL 22 -#define BASS_CONFIG_VERIFY 23 -#define BASS_CONFIG_UPDATETHREADS 24 -#define BASS_CONFIG_DEV_BUFFER 27 -#define BASS_CONFIG_REC_LOOPBACK 28 -#define BASS_CONFIG_VISTA_TRUEPOS 30 -#define BASS_CONFIG_IOS_SESSION 34 -#define BASS_CONFIG_IOS_MIXAUDIO 34 -#define BASS_CONFIG_DEV_DEFAULT 36 -#define BASS_CONFIG_NET_READTIMEOUT 37 -#define BASS_CONFIG_VISTA_SPEAKERS 38 -#define BASS_CONFIG_IOS_SPEAKER 39 -#define BASS_CONFIG_MF_DISABLE 40 -#define BASS_CONFIG_HANDLES 41 -#define BASS_CONFIG_UNICODE 42 -#define BASS_CONFIG_SRC 43 -#define BASS_CONFIG_SRC_SAMPLE 44 -#define BASS_CONFIG_ASYNCFILE_BUFFER 45 -#define BASS_CONFIG_OGG_PRESCAN 47 -#define BASS_CONFIG_MF_VIDEO 48 -#define BASS_CONFIG_AIRPLAY 49 -#define BASS_CONFIG_DEV_NONSTOP 50 -#define BASS_CONFIG_IOS_NOCATEGORY 51 -#define BASS_CONFIG_VERIFY_NET 52 -#define BASS_CONFIG_DEV_PERIOD 53 -#define BASS_CONFIG_FLOAT 54 -#define BASS_CONFIG_NET_SEEK 56 -#define BASS_CONFIG_AM_DISABLE 58 -#define BASS_CONFIG_NET_PLAYLIST_DEPTH 59 -#define BASS_CONFIG_NET_PREBUF_WAIT 60 -#define BASS_CONFIG_ANDROID_SESSIONID 62 -#define BASS_CONFIG_WASAPI_PERSIST 65 -#define BASS_CONFIG_REC_WASAPI 66 -#define BASS_CONFIG_ANDROID_AAUDIO 67 - -// BASS_SetConfigPtr options -#define BASS_CONFIG_NET_AGENT 16 -#define BASS_CONFIG_NET_PROXY 17 -#define BASS_CONFIG_IOS_NOTIFY 46 -#define BASS_CONFIG_LIBSSL 64 - -// BASS_CONFIG_IOS_SESSION flags -#define BASS_IOS_SESSION_MIX 1 -#define BASS_IOS_SESSION_DUCK 2 -#define BASS_IOS_SESSION_AMBIENT 4 -#define BASS_IOS_SESSION_SPEAKER 8 -#define BASS_IOS_SESSION_DISABLE 16 - -// BASS_Init flags -#define BASS_DEVICE_8BITS 1 // 8 bit -#define BASS_DEVICE_MONO 2 // mono -#define BASS_DEVICE_3D 4 // enable 3D functionality -#define BASS_DEVICE_16BITS 8 // limit output to 16 bit -#define BASS_DEVICE_LATENCY 0x100 // calculate device latency (BASS_INFO struct) -#define BASS_DEVICE_CPSPEAKERS 0x400 // detect speakers via Windows control panel -#define BASS_DEVICE_SPEAKERS 0x800 // force enabling of speaker assignment -#define BASS_DEVICE_NOSPEAKER 0x1000 // ignore speaker arrangement -#define BASS_DEVICE_DMIX 0x2000 // use ALSA "dmix" plugin -#define BASS_DEVICE_FREQ 0x4000 // set device sample rate -#define BASS_DEVICE_STEREO 0x8000 // limit output to stereo -#define BASS_DEVICE_HOG 0x10000 // hog/exclusive mode -#define BASS_DEVICE_AUDIOTRACK 0x20000 // use AudioTrack output -#define BASS_DEVICE_DSOUND 0x40000 // use DirectSound output - -// DirectSound interfaces (for use with BASS_GetDSoundObject) -#define BASS_OBJECT_DS 1 // IDirectSound -#define BASS_OBJECT_DS3DL 2 // IDirectSound3DListener - -// Device info structure -typedef struct { -#if defined(_WIN32_WCE) || (WINAPI_FAMILY && WINAPI_FAMILY!=WINAPI_FAMILY_DESKTOP_APP) - const wchar_t *name; // description - const wchar_t *driver; // driver -#else - const char *name; // description - const char *driver; // driver -#endif - DWORD flags; -} BASS_DEVICEINFO; - -// BASS_DEVICEINFO flags -#define BASS_DEVICE_ENABLED 1 -#define BASS_DEVICE_DEFAULT 2 -#define BASS_DEVICE_INIT 4 -#define BASS_DEVICE_LOOPBACK 8 - -#define BASS_DEVICE_TYPE_MASK 0xff000000 -#define BASS_DEVICE_TYPE_NETWORK 0x01000000 -#define BASS_DEVICE_TYPE_SPEAKERS 0x02000000 -#define BASS_DEVICE_TYPE_LINE 0x03000000 -#define BASS_DEVICE_TYPE_HEADPHONES 0x04000000 -#define BASS_DEVICE_TYPE_MICROPHONE 0x05000000 -#define BASS_DEVICE_TYPE_HEADSET 0x06000000 -#define BASS_DEVICE_TYPE_HANDSET 0x07000000 -#define BASS_DEVICE_TYPE_DIGITAL 0x08000000 -#define BASS_DEVICE_TYPE_SPDIF 0x09000000 -#define BASS_DEVICE_TYPE_HDMI 0x0a000000 -#define BASS_DEVICE_TYPE_DISPLAYPORT 0x40000000 - -// BASS_GetDeviceInfo flags -#define BASS_DEVICES_AIRPLAY 0x1000000 - -typedef struct { - DWORD flags; // device capabilities (DSCAPS_xxx flags) - DWORD hwsize; // size of total device hardware memory - DWORD hwfree; // size of free device hardware memory - DWORD freesam; // number of free sample slots in the hardware - DWORD free3d; // number of free 3D sample slots in the hardware - DWORD minrate; // min sample rate supported by the hardware - DWORD maxrate; // max sample rate supported by the hardware - BOOL eax; // device supports EAX? (always FALSE if BASS_DEVICE_3D was not used) - DWORD minbuf; // recommended minimum buffer length in ms (requires BASS_DEVICE_LATENCY) - DWORD dsver; // DirectSound version - DWORD latency; // delay (in ms) before start of playback (requires BASS_DEVICE_LATENCY) - DWORD initflags; // BASS_Init "flags" parameter - DWORD speakers; // number of speakers available - DWORD freq; // current output rate -} BASS_INFO; - -// BASS_INFO flags (from DSOUND.H) -#define DSCAPS_CONTINUOUSRATE 0x00000010 // supports all sample rates between min/maxrate -#define DSCAPS_EMULDRIVER 0x00000020 // device does NOT have hardware DirectSound support -#define DSCAPS_CERTIFIED 0x00000040 // device driver has been certified by Microsoft -#define DSCAPS_SECONDARYMONO 0x00000100 // mono -#define DSCAPS_SECONDARYSTEREO 0x00000200 // stereo -#define DSCAPS_SECONDARY8BIT 0x00000400 // 8 bit -#define DSCAPS_SECONDARY16BIT 0x00000800 // 16 bit - -// Recording device info structure -typedef struct { - DWORD flags; // device capabilities (DSCCAPS_xxx flags) - DWORD formats; // supported standard formats (WAVE_FORMAT_xxx flags) - DWORD inputs; // number of inputs - BOOL singlein; // TRUE = only 1 input can be set at a time - DWORD freq; // current input rate -} BASS_RECORDINFO; - -// BASS_RECORDINFO flags (from DSOUND.H) -#define DSCCAPS_EMULDRIVER DSCAPS_EMULDRIVER // device does NOT have hardware DirectSound recording support -#define DSCCAPS_CERTIFIED DSCAPS_CERTIFIED // device driver has been certified by Microsoft - -// defines for formats field of BASS_RECORDINFO (from MMSYSTEM.H) -#ifndef WAVE_FORMAT_1M08 -#define WAVE_FORMAT_1M08 0x00000001 /* 11.025 kHz, Mono, 8-bit */ -#define WAVE_FORMAT_1S08 0x00000002 /* 11.025 kHz, Stereo, 8-bit */ -#define WAVE_FORMAT_1M16 0x00000004 /* 11.025 kHz, Mono, 16-bit */ -#define WAVE_FORMAT_1S16 0x00000008 /* 11.025 kHz, Stereo, 16-bit */ -#define WAVE_FORMAT_2M08 0x00000010 /* 22.05 kHz, Mono, 8-bit */ -#define WAVE_FORMAT_2S08 0x00000020 /* 22.05 kHz, Stereo, 8-bit */ -#define WAVE_FORMAT_2M16 0x00000040 /* 22.05 kHz, Mono, 16-bit */ -#define WAVE_FORMAT_2S16 0x00000080 /* 22.05 kHz, Stereo, 16-bit */ -#define WAVE_FORMAT_4M08 0x00000100 /* 44.1 kHz, Mono, 8-bit */ -#define WAVE_FORMAT_4S08 0x00000200 /* 44.1 kHz, Stereo, 8-bit */ -#define WAVE_FORMAT_4M16 0x00000400 /* 44.1 kHz, Mono, 16-bit */ -#define WAVE_FORMAT_4S16 0x00000800 /* 44.1 kHz, Stereo, 16-bit */ -#endif - -// Sample info structure -typedef struct { - DWORD freq; // default playback rate - float volume; // default volume (0-1) - float pan; // default pan (-1=left, 0=middle, 1=right) - DWORD flags; // BASS_SAMPLE_xxx flags - DWORD length; // length (in bytes) - DWORD max; // maximum simultaneous playbacks - DWORD origres; // original resolution - DWORD chans; // number of channels - DWORD mingap; // minimum gap (ms) between creating channels - DWORD mode3d; // BASS_3DMODE_xxx mode - float mindist; // minimum distance - float maxdist; // maximum distance - DWORD iangle; // angle of inside projection cone - DWORD oangle; // angle of outside projection cone - float outvol; // delta-volume outside the projection cone - DWORD vam; // voice allocation/management flags (BASS_VAM_xxx) - DWORD priority; // priority (0=lowest, 0xffffffff=highest) -} BASS_SAMPLE; - -#define BASS_SAMPLE_8BITS 1 // 8 bit -#define BASS_SAMPLE_FLOAT 256 // 32 bit floating-point -#define BASS_SAMPLE_MONO 2 // mono -#define BASS_SAMPLE_LOOP 4 // looped -#define BASS_SAMPLE_3D 8 // 3D functionality -#define BASS_SAMPLE_SOFTWARE 16 // not using hardware mixing -#define BASS_SAMPLE_MUTEMAX 32 // mute at max distance (3D only) -#define BASS_SAMPLE_VAM 64 // DX7 voice allocation & management -#define BASS_SAMPLE_FX 128 // old implementation of DX8 effects -#define BASS_SAMPLE_OVER_VOL 0x10000 // override lowest volume -#define BASS_SAMPLE_OVER_POS 0x20000 // override longest playing -#define BASS_SAMPLE_OVER_DIST 0x30000 // override furthest from listener (3D only) - -#define BASS_STREAM_PRESCAN 0x20000 // enable pin-point seeking/length (MP3/MP2/MP1) -#define BASS_STREAM_AUTOFREE 0x40000 // automatically free the stream when it stop/ends -#define BASS_STREAM_RESTRATE 0x80000 // restrict the download rate of internet file streams -#define BASS_STREAM_BLOCK 0x100000 // download/play internet file stream in small blocks -#define BASS_STREAM_DECODE 0x200000 // don't play the stream, only decode (BASS_ChannelGetData) -#define BASS_STREAM_STATUS 0x800000 // give server status info (HTTP/ICY tags) in DOWNLOADPROC - -#define BASS_MP3_IGNOREDELAY 0x200 // ignore LAME/Xing/VBRI/iTunes delay & padding info -#define BASS_MP3_SETPOS BASS_STREAM_PRESCAN - -#define BASS_MUSIC_FLOAT BASS_SAMPLE_FLOAT -#define BASS_MUSIC_MONO BASS_SAMPLE_MONO -#define BASS_MUSIC_LOOP BASS_SAMPLE_LOOP -#define BASS_MUSIC_3D BASS_SAMPLE_3D -#define BASS_MUSIC_FX BASS_SAMPLE_FX -#define BASS_MUSIC_AUTOFREE BASS_STREAM_AUTOFREE -#define BASS_MUSIC_DECODE BASS_STREAM_DECODE -#define BASS_MUSIC_PRESCAN BASS_STREAM_PRESCAN // calculate playback length -#define BASS_MUSIC_CALCLEN BASS_MUSIC_PRESCAN -#define BASS_MUSIC_RAMP 0x200 // normal ramping -#define BASS_MUSIC_RAMPS 0x400 // sensitive ramping -#define BASS_MUSIC_SURROUND 0x800 // surround sound -#define BASS_MUSIC_SURROUND2 0x1000 // surround sound (mode 2) -#define BASS_MUSIC_FT2PAN 0x2000 // apply FastTracker 2 panning to XM files -#define BASS_MUSIC_FT2MOD 0x2000 // play .MOD as FastTracker 2 does -#define BASS_MUSIC_PT1MOD 0x4000 // play .MOD as ProTracker 1 does -#define BASS_MUSIC_NONINTER 0x10000 // non-interpolated sample mixing -#define BASS_MUSIC_SINCINTER 0x800000 // sinc interpolated sample mixing -#define BASS_MUSIC_POSRESET 0x8000 // stop all notes when moving position -#define BASS_MUSIC_POSRESETEX 0x400000 // stop all notes and reset bmp/etc when moving position -#define BASS_MUSIC_STOPBACK 0x80000 // stop the music on a backwards jump effect -#define BASS_MUSIC_NOSAMPLE 0x100000 // don't load the samples - -// Speaker assignment flags -#define BASS_SPEAKER_FRONT 0x1000000 // front speakers -#define BASS_SPEAKER_REAR 0x2000000 // rear/side speakers -#define BASS_SPEAKER_CENLFE 0x3000000 // center & LFE speakers (5.1) -#define BASS_SPEAKER_REAR2 0x4000000 // rear center speakers (7.1) -#define BASS_SPEAKER_N(n) ((n)<<24) // n'th pair of speakers (max 15) -#define BASS_SPEAKER_LEFT 0x10000000 // modifier: left -#define BASS_SPEAKER_RIGHT 0x20000000 // modifier: right -#define BASS_SPEAKER_FRONTLEFT BASS_SPEAKER_FRONT|BASS_SPEAKER_LEFT -#define BASS_SPEAKER_FRONTRIGHT BASS_SPEAKER_FRONT|BASS_SPEAKER_RIGHT -#define BASS_SPEAKER_REARLEFT BASS_SPEAKER_REAR|BASS_SPEAKER_LEFT -#define BASS_SPEAKER_REARRIGHT BASS_SPEAKER_REAR|BASS_SPEAKER_RIGHT -#define BASS_SPEAKER_CENTER BASS_SPEAKER_CENLFE|BASS_SPEAKER_LEFT -#define BASS_SPEAKER_LFE BASS_SPEAKER_CENLFE|BASS_SPEAKER_RIGHT -#define BASS_SPEAKER_REAR2LEFT BASS_SPEAKER_REAR2|BASS_SPEAKER_LEFT -#define BASS_SPEAKER_REAR2RIGHT BASS_SPEAKER_REAR2|BASS_SPEAKER_RIGHT - -#define BASS_ASYNCFILE 0x40000000 -#define BASS_UNICODE 0x80000000 - -#define BASS_RECORD_PAUSE 0x8000 // start recording paused -#define BASS_RECORD_ECHOCANCEL 0x2000 -#define BASS_RECORD_AGC 0x4000 - -// DX7 voice allocation & management flags -#define BASS_VAM_HARDWARE 1 -#define BASS_VAM_SOFTWARE 2 -#define BASS_VAM_TERM_TIME 4 -#define BASS_VAM_TERM_DIST 8 -#define BASS_VAM_TERM_PRIO 16 - -// Channel info structure -typedef struct { - DWORD freq; // default playback rate - DWORD chans; // channels - DWORD flags; // BASS_SAMPLE/STREAM/MUSIC/SPEAKER flags - DWORD ctype; // type of channel - DWORD origres; // original resolution - HPLUGIN plugin; // plugin - HSAMPLE sample; // sample - const char *filename; // filename -} BASS_CHANNELINFO; - -#define BASS_ORIGRES_FLOAT 0x10000 - -// BASS_CHANNELINFO types -#define BASS_CTYPE_SAMPLE 1 -#define BASS_CTYPE_RECORD 2 -#define BASS_CTYPE_STREAM 0x10000 -#define BASS_CTYPE_STREAM_VORBIS 0x10002 -#define BASS_CTYPE_STREAM_OGG 0x10002 -#define BASS_CTYPE_STREAM_MP1 0x10003 -#define BASS_CTYPE_STREAM_MP2 0x10004 -#define BASS_CTYPE_STREAM_MP3 0x10005 -#define BASS_CTYPE_STREAM_AIFF 0x10006 -#define BASS_CTYPE_STREAM_CA 0x10007 -#define BASS_CTYPE_STREAM_MF 0x10008 -#define BASS_CTYPE_STREAM_AM 0x10009 -#define BASS_CTYPE_STREAM_DUMMY 0x18000 -#define BASS_CTYPE_STREAM_DEVICE 0x18001 -#define BASS_CTYPE_STREAM_WAV 0x40000 // WAVE flag, LOWORD=codec -#define BASS_CTYPE_STREAM_WAV_PCM 0x50001 -#define BASS_CTYPE_STREAM_WAV_FLOAT 0x50003 -#define BASS_CTYPE_MUSIC_MOD 0x20000 -#define BASS_CTYPE_MUSIC_MTM 0x20001 -#define BASS_CTYPE_MUSIC_S3M 0x20002 -#define BASS_CTYPE_MUSIC_XM 0x20003 -#define BASS_CTYPE_MUSIC_IT 0x20004 -#define BASS_CTYPE_MUSIC_MO3 0x00100 // MO3 flag - -typedef struct { - DWORD ctype; // channel type -#if defined(_WIN32_WCE) || (WINAPI_FAMILY && WINAPI_FAMILY!=WINAPI_FAMILY_DESKTOP_APP) - const wchar_t *name; // format description - const wchar_t *exts; // file extension filter (*.ext1;*.ext2;etc...) -#else - const char *name; // format description - const char *exts; // file extension filter (*.ext1;*.ext2;etc...) -#endif -} BASS_PLUGINFORM; - -typedef struct { - DWORD version; // version (same form as BASS_GetVersion) - DWORD formatc; // number of formats - const BASS_PLUGINFORM *formats; // the array of formats -} BASS_PLUGININFO; - -// 3D vector (for 3D positions/velocities/orientations) -typedef struct BASS_3DVECTOR { -#ifdef __cplusplus - BASS_3DVECTOR() {}; - BASS_3DVECTOR(float _x, float _y, float _z) : x(_x), y(_y), z(_z) {}; -#endif - float x; // +=right, -=left - float y; // +=up, -=down - float z; // +=front, -=behind -} BASS_3DVECTOR; - -// 3D channel modes -#define BASS_3DMODE_NORMAL 0 // normal 3D processing -#define BASS_3DMODE_RELATIVE 1 // position is relative to the listener -#define BASS_3DMODE_OFF 2 // no 3D processing - -// software 3D mixing algorithms (used with BASS_CONFIG_3DALGORITHM) -#define BASS_3DALG_DEFAULT 0 -#define BASS_3DALG_OFF 1 -#define BASS_3DALG_FULL 2 -#define BASS_3DALG_LIGHT 3 - -// EAX environments, use with BASS_SetEAXParameters -enum -{ - EAX_ENVIRONMENT_GENERIC, - EAX_ENVIRONMENT_PADDEDCELL, - EAX_ENVIRONMENT_ROOM, - EAX_ENVIRONMENT_BATHROOM, - EAX_ENVIRONMENT_LIVINGROOM, - EAX_ENVIRONMENT_STONEROOM, - EAX_ENVIRONMENT_AUDITORIUM, - EAX_ENVIRONMENT_CONCERTHALL, - EAX_ENVIRONMENT_CAVE, - EAX_ENVIRONMENT_ARENA, - EAX_ENVIRONMENT_HANGAR, - EAX_ENVIRONMENT_CARPETEDHALLWAY, - EAX_ENVIRONMENT_HALLWAY, - EAX_ENVIRONMENT_STONECORRIDOR, - EAX_ENVIRONMENT_ALLEY, - EAX_ENVIRONMENT_FOREST, - EAX_ENVIRONMENT_CITY, - EAX_ENVIRONMENT_MOUNTAINS, - EAX_ENVIRONMENT_QUARRY, - EAX_ENVIRONMENT_PLAIN, - EAX_ENVIRONMENT_PARKINGLOT, - EAX_ENVIRONMENT_SEWERPIPE, - EAX_ENVIRONMENT_UNDERWATER, - EAX_ENVIRONMENT_DRUGGED, - EAX_ENVIRONMENT_DIZZY, - EAX_ENVIRONMENT_PSYCHOTIC, - - EAX_ENVIRONMENT_COUNT // total number of environments -}; - -// EAX presets, usage: BASS_SetEAXParameters(EAX_PRESET_xxx) -#define EAX_PRESET_GENERIC EAX_ENVIRONMENT_GENERIC,0.5F,1.493F,0.5F -#define EAX_PRESET_PADDEDCELL EAX_ENVIRONMENT_PADDEDCELL,0.25F,0.1F,0.0F -#define EAX_PRESET_ROOM EAX_ENVIRONMENT_ROOM,0.417F,0.4F,0.666F -#define EAX_PRESET_BATHROOM EAX_ENVIRONMENT_BATHROOM,0.653F,1.499F,0.166F -#define EAX_PRESET_LIVINGROOM EAX_ENVIRONMENT_LIVINGROOM,0.208F,0.478F,0.0F -#define EAX_PRESET_STONEROOM EAX_ENVIRONMENT_STONEROOM,0.5F,2.309F,0.888F -#define EAX_PRESET_AUDITORIUM EAX_ENVIRONMENT_AUDITORIUM,0.403F,4.279F,0.5F -#define EAX_PRESET_CONCERTHALL EAX_ENVIRONMENT_CONCERTHALL,0.5F,3.961F,0.5F -#define EAX_PRESET_CAVE EAX_ENVIRONMENT_CAVE,0.5F,2.886F,1.304F -#define EAX_PRESET_ARENA EAX_ENVIRONMENT_ARENA,0.361F,7.284F,0.332F -#define EAX_PRESET_HANGAR EAX_ENVIRONMENT_HANGAR,0.5F,10.0F,0.3F -#define EAX_PRESET_CARPETEDHALLWAY EAX_ENVIRONMENT_CARPETEDHALLWAY,0.153F,0.259F,2.0F -#define EAX_PRESET_HALLWAY EAX_ENVIRONMENT_HALLWAY,0.361F,1.493F,0.0F -#define EAX_PRESET_STONECORRIDOR EAX_ENVIRONMENT_STONECORRIDOR,0.444F,2.697F,0.638F -#define EAX_PRESET_ALLEY EAX_ENVIRONMENT_ALLEY,0.25F,1.752F,0.776F -#define EAX_PRESET_FOREST EAX_ENVIRONMENT_FOREST,0.111F,3.145F,0.472F -#define EAX_PRESET_CITY EAX_ENVIRONMENT_CITY,0.111F,2.767F,0.224F -#define EAX_PRESET_MOUNTAINS EAX_ENVIRONMENT_MOUNTAINS,0.194F,7.841F,0.472F -#define EAX_PRESET_QUARRY EAX_ENVIRONMENT_QUARRY,1.0F,1.499F,0.5F -#define EAX_PRESET_PLAIN EAX_ENVIRONMENT_PLAIN,0.097F,2.767F,0.224F -#define EAX_PRESET_PARKINGLOT EAX_ENVIRONMENT_PARKINGLOT,0.208F,1.652F,1.5F -#define EAX_PRESET_SEWERPIPE EAX_ENVIRONMENT_SEWERPIPE,0.652F,2.886F,0.25F -#define EAX_PRESET_UNDERWATER EAX_ENVIRONMENT_UNDERWATER,1.0F,1.499F,0.0F -#define EAX_PRESET_DRUGGED EAX_ENVIRONMENT_DRUGGED,0.875F,8.392F,1.388F -#define EAX_PRESET_DIZZY EAX_ENVIRONMENT_DIZZY,0.139F,17.234F,0.666F -#define EAX_PRESET_PSYCHOTIC EAX_ENVIRONMENT_PSYCHOTIC,0.486F,7.563F,0.806F - -typedef DWORD (CALLBACK STREAMPROC)(HSTREAM handle, void *buffer, DWORD length, void *user); -/* User stream callback function. -handle : The stream that needs writing -buffer : Buffer to write the samples in -length : Number of bytes to write -user : The 'user' parameter value given when calling BASS_StreamCreate -RETURN : Number of bytes written. Set the BASS_STREAMPROC_END flag to end the stream. */ - -#define BASS_STREAMPROC_END 0x80000000 // end of user stream flag - -// special STREAMPROCs -#define STREAMPROC_DUMMY (STREAMPROC*)0 // "dummy" stream -#define STREAMPROC_PUSH (STREAMPROC*)-1 // push stream -#define STREAMPROC_DEVICE (STREAMPROC*)-2 // device mix stream -#define STREAMPROC_DEVICE_3D (STREAMPROC*)-3 // device 3D mix stream - -// BASS_StreamCreateFileUser file systems -#define STREAMFILE_NOBUFFER 0 -#define STREAMFILE_BUFFER 1 -#define STREAMFILE_BUFFERPUSH 2 - -// User file stream callback functions -typedef void (CALLBACK FILECLOSEPROC)(void *user); -typedef QWORD (CALLBACK FILELENPROC)(void *user); -typedef DWORD (CALLBACK FILEREADPROC)(void *buffer, DWORD length, void *user); -typedef BOOL (CALLBACK FILESEEKPROC)(QWORD offset, void *user); - -typedef struct { - FILECLOSEPROC *close; - FILELENPROC *length; - FILEREADPROC *read; - FILESEEKPROC *seek; -} BASS_FILEPROCS; - -// BASS_StreamPutFileData options -#define BASS_FILEDATA_END 0 // end & close the file - -// BASS_StreamGetFilePosition modes -#define BASS_FILEPOS_CURRENT 0 -#define BASS_FILEPOS_DECODE BASS_FILEPOS_CURRENT -#define BASS_FILEPOS_DOWNLOAD 1 -#define BASS_FILEPOS_END 2 -#define BASS_FILEPOS_START 3 -#define BASS_FILEPOS_CONNECTED 4 -#define BASS_FILEPOS_BUFFER 5 -#define BASS_FILEPOS_SOCKET 6 -#define BASS_FILEPOS_ASYNCBUF 7 -#define BASS_FILEPOS_SIZE 8 -#define BASS_FILEPOS_BUFFERING 9 - -typedef void (CALLBACK DOWNLOADPROC)(const void *buffer, DWORD length, void *user); -/* Internet stream download callback function. -buffer : Buffer containing the downloaded data... NULL=end of download -length : Number of bytes in the buffer -user : The 'user' parameter value given when calling BASS_StreamCreateURL */ - -// BASS_ChannelSetSync types -#define BASS_SYNC_POS 0 -#define BASS_SYNC_END 2 -#define BASS_SYNC_META 4 -#define BASS_SYNC_SLIDE 5 -#define BASS_SYNC_STALL 6 -#define BASS_SYNC_DOWNLOAD 7 -#define BASS_SYNC_FREE 8 -#define BASS_SYNC_SETPOS 11 -#define BASS_SYNC_MUSICPOS 10 -#define BASS_SYNC_MUSICINST 1 -#define BASS_SYNC_MUSICFX 3 -#define BASS_SYNC_OGG_CHANGE 12 -#define BASS_SYNC_DEV_FAIL 14 -#define BASS_SYNC_DEV_FORMAT 15 -#define BASS_SYNC_THREAD 0x20000000 // flag: call sync in other thread -#define BASS_SYNC_MIXTIME 0x40000000 // flag: sync at mixtime, else at playtime -#define BASS_SYNC_ONETIME 0x80000000 // flag: sync only once, else continuously - -typedef void (CALLBACK SYNCPROC)(HSYNC handle, DWORD channel, DWORD data, void *user); -/* Sync callback function. -handle : The sync that has occured -channel: Channel that the sync occured in -data : Additional data associated with the sync's occurance -user : The 'user' parameter given when calling BASS_ChannelSetSync */ - -typedef void (CALLBACK DSPPROC)(HDSP handle, DWORD channel, void *buffer, DWORD length, void *user); -/* DSP callback function. -handle : The DSP handle -channel: Channel that the DSP is being applied to -buffer : Buffer to apply the DSP to -length : Number of bytes in the buffer -user : The 'user' parameter given when calling BASS_ChannelSetDSP */ - -typedef BOOL (CALLBACK RECORDPROC)(HRECORD handle, const void *buffer, DWORD length, void *user); -/* Recording callback function. -handle : The recording handle -buffer : Buffer containing the recorded sample data -length : Number of bytes -user : The 'user' parameter value given when calling BASS_RecordStart -RETURN : TRUE = continue recording, FALSE = stop */ - -// BASS_ChannelIsActive return values -#define BASS_ACTIVE_STOPPED 0 -#define BASS_ACTIVE_PLAYING 1 -#define BASS_ACTIVE_STALLED 2 -#define BASS_ACTIVE_PAUSED 3 -#define BASS_ACTIVE_PAUSED_DEVICE 4 - -// Channel attributes -#define BASS_ATTRIB_FREQ 1 -#define BASS_ATTRIB_VOL 2 -#define BASS_ATTRIB_PAN 3 -#define BASS_ATTRIB_EAXMIX 4 -#define BASS_ATTRIB_NOBUFFER 5 -#define BASS_ATTRIB_VBR 6 -#define BASS_ATTRIB_CPU 7 -#define BASS_ATTRIB_SRC 8 -#define BASS_ATTRIB_NET_RESUME 9 -#define BASS_ATTRIB_SCANINFO 10 -#define BASS_ATTRIB_NORAMP 11 -#define BASS_ATTRIB_BITRATE 12 -#define BASS_ATTRIB_BUFFER 13 -#define BASS_ATTRIB_GRANULE 14 -#define BASS_ATTRIB_MUSIC_AMPLIFY 0x100 -#define BASS_ATTRIB_MUSIC_PANSEP 0x101 -#define BASS_ATTRIB_MUSIC_PSCALER 0x102 -#define BASS_ATTRIB_MUSIC_BPM 0x103 -#define BASS_ATTRIB_MUSIC_SPEED 0x104 -#define BASS_ATTRIB_MUSIC_VOL_GLOBAL 0x105 -#define BASS_ATTRIB_MUSIC_ACTIVE 0x106 -#define BASS_ATTRIB_MUSIC_VOL_CHAN 0x200 // + channel # -#define BASS_ATTRIB_MUSIC_VOL_INST 0x300 // + instrument # - -// BASS_ChannelSlideAttribute flags -#define BASS_SLIDE_LOG 0x1000000 - -// BASS_ChannelGetData flags -#define BASS_DATA_AVAILABLE 0 // query how much data is buffered -#define BASS_DATA_FIXED 0x20000000 // flag: return 8.24 fixed-point data -#define BASS_DATA_FLOAT 0x40000000 // flag: return floating-point sample data -#define BASS_DATA_FFT256 0x80000000 // 256 sample FFT -#define BASS_DATA_FFT512 0x80000001 // 512 FFT -#define BASS_DATA_FFT1024 0x80000002 // 1024 FFT -#define BASS_DATA_FFT2048 0x80000003 // 2048 FFT -#define BASS_DATA_FFT4096 0x80000004 // 4096 FFT -#define BASS_DATA_FFT8192 0x80000005 // 8192 FFT -#define BASS_DATA_FFT16384 0x80000006 // 16384 FFT -#define BASS_DATA_FFT32768 0x80000007 // 32768 FFT -#define BASS_DATA_FFT_INDIVIDUAL 0x10 // FFT flag: FFT for each channel, else all combined -#define BASS_DATA_FFT_NOWINDOW 0x20 // FFT flag: no Hanning window -#define BASS_DATA_FFT_REMOVEDC 0x40 // FFT flag: pre-remove DC bias -#define BASS_DATA_FFT_COMPLEX 0x80 // FFT flag: return complex data -#define BASS_DATA_FFT_NYQUIST 0x100 // FFT flag: return extra Nyquist value - -// BASS_ChannelGetLevelEx flags -#define BASS_LEVEL_MONO 1 -#define BASS_LEVEL_STEREO 2 -#define BASS_LEVEL_RMS 4 -#define BASS_LEVEL_VOLPAN 8 - -// BASS_ChannelGetTags types : what's returned -#define BASS_TAG_ID3 0 // ID3v1 tags : TAG_ID3 structure -#define BASS_TAG_ID3V2 1 // ID3v2 tags : variable length block -#define BASS_TAG_OGG 2 // OGG comments : series of null-terminated UTF-8 strings -#define BASS_TAG_HTTP 3 // HTTP headers : series of null-terminated ANSI strings -#define BASS_TAG_ICY 4 // ICY headers : series of null-terminated ANSI strings -#define BASS_TAG_META 5 // ICY metadata : ANSI string -#define BASS_TAG_APE 6 // APE tags : series of null-terminated UTF-8 strings -#define BASS_TAG_MP4 7 // MP4/iTunes metadata : series of null-terminated UTF-8 strings -#define BASS_TAG_WMA 8 // WMA tags : series of null-terminated UTF-8 strings -#define BASS_TAG_VENDOR 9 // OGG encoder : UTF-8 string -#define BASS_TAG_LYRICS3 10 // Lyric3v2 tag : ASCII string -#define BASS_TAG_CA_CODEC 11 // CoreAudio codec info : TAG_CA_CODEC structure -#define BASS_TAG_MF 13 // Media Foundation tags : series of null-terminated UTF-8 strings -#define BASS_TAG_WAVEFORMAT 14 // WAVE format : WAVEFORMATEEX structure -#define BASS_TAG_AM_MIME 15 // Android Media MIME type : ASCII string -#define BASS_TAG_AM_NAME 16 // Android Media codec name : ASCII string -#define BASS_TAG_RIFF_INFO 0x100 // RIFF "INFO" tags : series of null-terminated ANSI strings -#define BASS_TAG_RIFF_BEXT 0x101 // RIFF/BWF "bext" tags : TAG_BEXT structure -#define BASS_TAG_RIFF_CART 0x102 // RIFF/BWF "cart" tags : TAG_CART structure -#define BASS_TAG_RIFF_DISP 0x103 // RIFF "DISP" text tag : ANSI string -#define BASS_TAG_RIFF_CUE 0x104 // RIFF "cue " chunk : TAG_CUE structure -#define BASS_TAG_RIFF_SMPL 0x105 // RIFF "smpl" chunk : TAG_SMPL structure -#define BASS_TAG_APE_BINARY 0x1000 // + index #, binary APE tag : TAG_APE_BINARY structure -#define BASS_TAG_MUSIC_NAME 0x10000 // MOD music name : ANSI string -#define BASS_TAG_MUSIC_MESSAGE 0x10001 // MOD message : ANSI string -#define BASS_TAG_MUSIC_ORDERS 0x10002 // MOD order list : BYTE array of pattern numbers -#define BASS_TAG_MUSIC_AUTH 0x10003 // MOD author : UTF-8 string -#define BASS_TAG_MUSIC_INST 0x10100 // + instrument #, MOD instrument name : ANSI string -#define BASS_TAG_MUSIC_SAMPLE 0x10300 // + sample #, MOD sample name : ANSI string - -// ID3v1 tag structure -typedef struct { - char id[3]; - char title[30]; - char artist[30]; - char album[30]; - char year[4]; - char comment[30]; - BYTE genre; -} TAG_ID3; - -// Binary APE tag structure -typedef struct { - const char *key; - const void *data; - DWORD length; -} TAG_APE_BINARY; - -// BWF "bext" tag structure -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable:4200) -#endif -#pragma pack(push,1) -typedef struct { - char Description[256]; // description - char Originator[32]; // name of the originator - char OriginatorReference[32]; // reference of the originator - char OriginationDate[10]; // date of creation (yyyy-mm-dd) - char OriginationTime[8]; // time of creation (hh-mm-ss) - QWORD TimeReference; // first sample count since midnight (little-endian) - WORD Version; // BWF version (little-endian) - BYTE UMID[64]; // SMPTE UMID - BYTE Reserved[190]; -#if defined(__GNUC__) && __GNUC__<3 - char CodingHistory[0]; // history -#elif 1 // change to 0 if compiler fails the following line - char CodingHistory[]; // history -#else - char CodingHistory[1]; // history -#endif -} TAG_BEXT; -#pragma pack(pop) - -// BWF "cart" tag structures -typedef struct -{ - DWORD dwUsage; // FOURCC timer usage ID - DWORD dwValue; // timer value in samples from head -} TAG_CART_TIMER; - -typedef struct -{ - char Version[4]; // version of the data structure - char Title[64]; // title of cart audio sequence - char Artist[64]; // artist or creator name - char CutID[64]; // cut number identification - char ClientID[64]; // client identification - char Category[64]; // category ID, PSA, NEWS, etc - char Classification[64]; // classification or auxiliary key - char OutCue[64]; // out cue text - char StartDate[10]; // yyyy-mm-dd - char StartTime[8]; // hh:mm:ss - char EndDate[10]; // yyyy-mm-dd - char EndTime[8]; // hh:mm:ss - char ProducerAppID[64]; // name of vendor or application - char ProducerAppVersion[64]; // version of producer application - char UserDef[64]; // user defined text - DWORD dwLevelReference; // sample value for 0 dB reference - TAG_CART_TIMER PostTimer[8]; // 8 time markers after head - char Reserved[276]; - char URL[1024]; // uniform resource locator -#if defined(__GNUC__) && __GNUC__<3 - char TagText[0]; // free form text for scripts or tags -#elif 1 // change to 0 if compiler fails the following line - char TagText[]; // free form text for scripts or tags -#else - char TagText[1]; // free form text for scripts or tags -#endif -} TAG_CART; - -// RIFF "cue " tag structures -typedef struct -{ - DWORD dwName; - DWORD dwPosition; - DWORD fccChunk; - DWORD dwChunkStart; - DWORD dwBlockStart; - DWORD dwSampleOffset; -} TAG_CUE_POINT; - -typedef struct -{ - DWORD dwCuePoints; -#if defined(__GNUC__) && __GNUC__<3 - TAG_CUE_POINT CuePoints[0]; -#elif 1 // change to 0 if compiler fails the following line - TAG_CUE_POINT CuePoints[]; -#else - TAG_CUE_POINT CuePoints[1]; -#endif -} TAG_CUE; - -// RIFF "smpl" tag structures -typedef struct -{ - DWORD dwIdentifier; - DWORD dwType; - DWORD dwStart; - DWORD dwEnd; - DWORD dwFraction; - DWORD dwPlayCount; -} TAG_SMPL_LOOP; - -typedef struct -{ - DWORD dwManufacturer; - DWORD dwProduct; - DWORD dwSamplePeriod; - DWORD dwMIDIUnityNote; - DWORD dwMIDIPitchFraction; - DWORD dwSMPTEFormat; - DWORD dwSMPTEOffset; - DWORD cSampleLoops; - DWORD cbSamplerData; -#if defined(__GNUC__) && __GNUC__<3 - TAG_SMPL_LOOP SampleLoops[0]; -#elif 1 // change to 0 if compiler fails the following line - TAG_SMPL_LOOP SampleLoops[]; -#else - TAG_SMPL_LOOP SampleLoops[1]; -#endif -} TAG_SMPL; -#ifdef _MSC_VER -#pragma warning(pop) -#endif - -// CoreAudio codec info structure -typedef struct { - DWORD ftype; // file format - DWORD atype; // audio format - const char *name; // description -} TAG_CA_CODEC; - -#ifndef _WAVEFORMATEX_ -#define _WAVEFORMATEX_ -#pragma pack(push,1) -typedef struct tWAVEFORMATEX -{ - WORD wFormatTag; - WORD nChannels; - DWORD nSamplesPerSec; - DWORD nAvgBytesPerSec; - WORD nBlockAlign; - WORD wBitsPerSample; - WORD cbSize; -} WAVEFORMATEX, *PWAVEFORMATEX, *LPWAVEFORMATEX; -typedef const WAVEFORMATEX *LPCWAVEFORMATEX; -#pragma pack(pop) -#endif - -// BASS_ChannelGetLength/GetPosition/SetPosition modes -#define BASS_POS_BYTE 0 // byte position -#define BASS_POS_MUSIC_ORDER 1 // order.row position, MAKELONG(order,row) -#define BASS_POS_OGG 3 // OGG bitstream number -#define BASS_POS_RESET 0x2000000 // flag: reset user file buffers -#define BASS_POS_RELATIVE 0x4000000 // flag: seek relative to the current position -#define BASS_POS_INEXACT 0x8000000 // flag: allow seeking to inexact position -#define BASS_POS_DECODE 0x10000000 // flag: get the decoding (not playing) position -#define BASS_POS_DECODETO 0x20000000 // flag: decode to the position instead of seeking -#define BASS_POS_SCAN 0x40000000 // flag: scan to the position - -// BASS_ChannelSetDevice/GetDevice option -#define BASS_NODEVICE 0x20000 - -// BASS_RecordSetInput flags -#define BASS_INPUT_OFF 0x10000 -#define BASS_INPUT_ON 0x20000 - -#define BASS_INPUT_TYPE_MASK 0xff000000 -#define BASS_INPUT_TYPE_UNDEF 0x00000000 -#define BASS_INPUT_TYPE_DIGITAL 0x01000000 -#define BASS_INPUT_TYPE_LINE 0x02000000 -#define BASS_INPUT_TYPE_MIC 0x03000000 -#define BASS_INPUT_TYPE_SYNTH 0x04000000 -#define BASS_INPUT_TYPE_CD 0x05000000 -#define BASS_INPUT_TYPE_PHONE 0x06000000 -#define BASS_INPUT_TYPE_SPEAKER 0x07000000 -#define BASS_INPUT_TYPE_WAVE 0x08000000 -#define BASS_INPUT_TYPE_AUX 0x09000000 -#define BASS_INPUT_TYPE_ANALOG 0x0a000000 - -// BASS_ChannelSetFX effect types -#define BASS_FX_DX8_CHORUS 0 -#define BASS_FX_DX8_COMPRESSOR 1 -#define BASS_FX_DX8_DISTORTION 2 -#define BASS_FX_DX8_ECHO 3 -#define BASS_FX_DX8_FLANGER 4 -#define BASS_FX_DX8_GARGLE 5 -#define BASS_FX_DX8_I3DL2REVERB 6 -#define BASS_FX_DX8_PARAMEQ 7 -#define BASS_FX_DX8_REVERB 8 -#define BASS_FX_VOLUME 9 - -typedef struct { - float fWetDryMix; - float fDepth; - float fFeedback; - float fFrequency; - DWORD lWaveform; // 0=triangle, 1=sine - float fDelay; - DWORD lPhase; // BASS_DX8_PHASE_xxx -} BASS_DX8_CHORUS; - -typedef struct { - float fGain; - float fAttack; - float fRelease; - float fThreshold; - float fRatio; - float fPredelay; -} BASS_DX8_COMPRESSOR; - -typedef struct { - float fGain; - float fEdge; - float fPostEQCenterFrequency; - float fPostEQBandwidth; - float fPreLowpassCutoff; -} BASS_DX8_DISTORTION; - -typedef struct { - float fWetDryMix; - float fFeedback; - float fLeftDelay; - float fRightDelay; - BOOL lPanDelay; -} BASS_DX8_ECHO; - -typedef struct { - float fWetDryMix; - float fDepth; - float fFeedback; - float fFrequency; - DWORD lWaveform; // 0=triangle, 1=sine - float fDelay; - DWORD lPhase; // BASS_DX8_PHASE_xxx -} BASS_DX8_FLANGER; - -typedef struct { - DWORD dwRateHz; // Rate of modulation in hz - DWORD dwWaveShape; // 0=triangle, 1=square -} BASS_DX8_GARGLE; - -typedef struct { - int lRoom; // [-10000, 0] default: -1000 mB - int lRoomHF; // [-10000, 0] default: 0 mB - float flRoomRolloffFactor; // [0.0, 10.0] default: 0.0 - float flDecayTime; // [0.1, 20.0] default: 1.49s - float flDecayHFRatio; // [0.1, 2.0] default: 0.83 - int lReflections; // [-10000, 1000] default: -2602 mB - float flReflectionsDelay; // [0.0, 0.3] default: 0.007 s - int lReverb; // [-10000, 2000] default: 200 mB - float flReverbDelay; // [0.0, 0.1] default: 0.011 s - float flDiffusion; // [0.0, 100.0] default: 100.0 % - float flDensity; // [0.0, 100.0] default: 100.0 % - float flHFReference; // [20.0, 20000.0] default: 5000.0 Hz -} BASS_DX8_I3DL2REVERB; - -typedef struct { - float fCenter; - float fBandwidth; - float fGain; -} BASS_DX8_PARAMEQ; - -typedef struct { - float fInGain; // [-96.0,0.0] default: 0.0 dB - float fReverbMix; // [-96.0,0.0] default: 0.0 db - float fReverbTime; // [0.001,3000.0] default: 1000.0 ms - float fHighFreqRTRatio; // [0.001,0.999] default: 0.001 -} BASS_DX8_REVERB; - -#define BASS_DX8_PHASE_NEG_180 0 -#define BASS_DX8_PHASE_NEG_90 1 -#define BASS_DX8_PHASE_ZERO 2 -#define BASS_DX8_PHASE_90 3 -#define BASS_DX8_PHASE_180 4 - -typedef struct { - float fTarget; - float fCurrent; - float fTime; - DWORD lCurve; -} BASS_FX_VOLUME_PARAM; - -typedef void (CALLBACK IOSNOTIFYPROC)(DWORD status); -/* iOS notification callback function. -status : The notification (BASS_IOSNOTIFY_xxx) */ - -#define BASS_IOSNOTIFY_INTERRUPT 1 // interruption started -#define BASS_IOSNOTIFY_INTERRUPT_END 2 // interruption ended - -BOOL BASSDEF(BASS_SetConfig)(DWORD option, DWORD value); -DWORD BASSDEF(BASS_GetConfig)(DWORD option); -BOOL BASSDEF(BASS_SetConfigPtr)(DWORD option, const void *value); -void *BASSDEF(BASS_GetConfigPtr)(DWORD option); -DWORD BASSDEF(BASS_GetVersion)(); -int BASSDEF(BASS_ErrorGetCode)(); -BOOL BASSDEF(BASS_GetDeviceInfo)(DWORD device, BASS_DEVICEINFO *info); -#if defined(_WIN32) && !defined(_WIN32_WCE) && !(WINAPI_FAMILY && WINAPI_FAMILY!=WINAPI_FAMILY_DESKTOP_APP) -BOOL BASSDEF(BASS_Init)(int device, DWORD freq, DWORD flags, HWND win, const GUID *dsguid); -#else -BOOL BASSDEF(BASS_Init)(int device, DWORD freq, DWORD flags, void *win, void *dsguid); -#endif -BOOL BASSDEF(BASS_SetDevice)(DWORD device); -DWORD BASSDEF(BASS_GetDevice)(); -BOOL BASSDEF(BASS_Free)(); -#if defined(_WIN32) && !defined(_WIN32_WCE) && !(WINAPI_FAMILY && WINAPI_FAMILY!=WINAPI_FAMILY_DESKTOP_APP) -void *BASSDEF(BASS_GetDSoundObject)(DWORD object); -#endif -BOOL BASSDEF(BASS_GetInfo)(BASS_INFO *info); -BOOL BASSDEF(BASS_Update)(DWORD length); -float BASSDEF(BASS_GetCPU)(); -BOOL BASSDEF(BASS_Start)(); -BOOL BASSDEF(BASS_Stop)(); -BOOL BASSDEF(BASS_Pause)(); -BOOL BASSDEF(BASS_IsStarted)(); -BOOL BASSDEF(BASS_SetVolume)(float volume); -float BASSDEF(BASS_GetVolume)(); - -HPLUGIN BASSDEF(BASS_PluginLoad)(const char *file, DWORD flags); -BOOL BASSDEF(BASS_PluginFree)(HPLUGIN handle); -const BASS_PLUGININFO *BASSDEF(BASS_PluginGetInfo)(HPLUGIN handle); - -BOOL BASSDEF(BASS_Set3DFactors)(float distf, float rollf, float doppf); -BOOL BASSDEF(BASS_Get3DFactors)(float *distf, float *rollf, float *doppf); -BOOL BASSDEF(BASS_Set3DPosition)(const BASS_3DVECTOR *pos, const BASS_3DVECTOR *vel, const BASS_3DVECTOR *front, const BASS_3DVECTOR *top); -BOOL BASSDEF(BASS_Get3DPosition)(BASS_3DVECTOR *pos, BASS_3DVECTOR *vel, BASS_3DVECTOR *front, BASS_3DVECTOR *top); -void BASSDEF(BASS_Apply3D)(); -#if defined(_WIN32) && !defined(_WIN32_WCE) && !(WINAPI_FAMILY && WINAPI_FAMILY!=WINAPI_FAMILY_DESKTOP_APP) -BOOL BASSDEF(BASS_SetEAXParameters)(int env, float vol, float decay, float damp); -BOOL BASSDEF(BASS_GetEAXParameters)(DWORD *env, float *vol, float *decay, float *damp); -#endif - -HMUSIC BASSDEF(BASS_MusicLoad)(BOOL mem, const void *file, QWORD offset, DWORD length, DWORD flags, DWORD freq); -BOOL BASSDEF(BASS_MusicFree)(HMUSIC handle); - -HSAMPLE BASSDEF(BASS_SampleLoad)(BOOL mem, const void *file, QWORD offset, DWORD length, DWORD max, DWORD flags); -HSAMPLE BASSDEF(BASS_SampleCreate)(DWORD length, DWORD freq, DWORD chans, DWORD max, DWORD flags); -BOOL BASSDEF(BASS_SampleFree)(HSAMPLE handle); -BOOL BASSDEF(BASS_SampleSetData)(HSAMPLE handle, const void *buffer); -BOOL BASSDEF(BASS_SampleGetData)(HSAMPLE handle, void *buffer); -BOOL BASSDEF(BASS_SampleGetInfo)(HSAMPLE handle, BASS_SAMPLE *info); -BOOL BASSDEF(BASS_SampleSetInfo)(HSAMPLE handle, const BASS_SAMPLE *info); -HCHANNEL BASSDEF(BASS_SampleGetChannel)(HSAMPLE handle, BOOL onlynew); -DWORD BASSDEF(BASS_SampleGetChannels)(HSAMPLE handle, HCHANNEL *channels); -BOOL BASSDEF(BASS_SampleStop)(HSAMPLE handle); - -HSTREAM BASSDEF(BASS_StreamCreate)(DWORD freq, DWORD chans, DWORD flags, STREAMPROC *proc, void *user); -HSTREAM BASSDEF(BASS_StreamCreateFile)(BOOL mem, const void *file, QWORD offset, QWORD length, DWORD flags); -HSTREAM BASSDEF(BASS_StreamCreateURL)(const char *url, DWORD offset, DWORD flags, DOWNLOADPROC *proc, void *user); -HSTREAM BASSDEF(BASS_StreamCreateFileUser)(DWORD system, DWORD flags, const BASS_FILEPROCS *proc, void *user); -BOOL BASSDEF(BASS_StreamFree)(HSTREAM handle); -QWORD BASSDEF(BASS_StreamGetFilePosition)(HSTREAM handle, DWORD mode); -DWORD BASSDEF(BASS_StreamPutData)(HSTREAM handle, const void *buffer, DWORD length); -DWORD BASSDEF(BASS_StreamPutFileData)(HSTREAM handle, const void *buffer, DWORD length); - -BOOL BASSDEF(BASS_RecordGetDeviceInfo)(DWORD device, BASS_DEVICEINFO *info); -BOOL BASSDEF(BASS_RecordInit)(int device); -BOOL BASSDEF(BASS_RecordSetDevice)(DWORD device); -DWORD BASSDEF(BASS_RecordGetDevice)(); -BOOL BASSDEF(BASS_RecordFree)(); -BOOL BASSDEF(BASS_RecordGetInfo)(BASS_RECORDINFO *info); -const char *BASSDEF(BASS_RecordGetInputName)(int input); -BOOL BASSDEF(BASS_RecordSetInput)(int input, DWORD flags, float volume); -DWORD BASSDEF(BASS_RecordGetInput)(int input, float *volume); -HRECORD BASSDEF(BASS_RecordStart)(DWORD freq, DWORD chans, DWORD flags, RECORDPROC *proc, void *user); - -double BASSDEF(BASS_ChannelBytes2Seconds)(DWORD handle, QWORD pos); -QWORD BASSDEF(BASS_ChannelSeconds2Bytes)(DWORD handle, double pos); -DWORD BASSDEF(BASS_ChannelGetDevice)(DWORD handle); -BOOL BASSDEF(BASS_ChannelSetDevice)(DWORD handle, DWORD device); -DWORD BASSDEF(BASS_ChannelIsActive)(DWORD handle); -BOOL BASSDEF(BASS_ChannelGetInfo)(DWORD handle, BASS_CHANNELINFO *info); -const char *BASSDEF(BASS_ChannelGetTags)(DWORD handle, DWORD tags); -DWORD BASSDEF(BASS_ChannelFlags)(DWORD handle, DWORD flags, DWORD mask); -BOOL BASSDEF(BASS_ChannelUpdate)(DWORD handle, DWORD length); -BOOL BASSDEF(BASS_ChannelLock)(DWORD handle, BOOL lock); -BOOL BASSDEF(BASS_ChannelPlay)(DWORD handle, BOOL restart); -BOOL BASSDEF(BASS_ChannelStop)(DWORD handle); -BOOL BASSDEF(BASS_ChannelPause)(DWORD handle); -BOOL BASSDEF(BASS_ChannelSetAttribute)(DWORD handle, DWORD attrib, float value); -BOOL BASSDEF(BASS_ChannelGetAttribute)(DWORD handle, DWORD attrib, float *value); -BOOL BASSDEF(BASS_ChannelSlideAttribute)(DWORD handle, DWORD attrib, float value, DWORD time); -BOOL BASSDEF(BASS_ChannelIsSliding)(DWORD handle, DWORD attrib); -BOOL BASSDEF(BASS_ChannelSetAttributeEx)(DWORD handle, DWORD attrib, void *value, DWORD size); -DWORD BASSDEF(BASS_ChannelGetAttributeEx)(DWORD handle, DWORD attrib, void *value, DWORD size); -BOOL BASSDEF(BASS_ChannelSet3DAttributes)(DWORD handle, int mode, float min, float max, int iangle, int oangle, float outvol); -BOOL BASSDEF(BASS_ChannelGet3DAttributes)(DWORD handle, DWORD *mode, float *min, float *max, DWORD *iangle, DWORD *oangle, float *outvol); -BOOL BASSDEF(BASS_ChannelSet3DPosition)(DWORD handle, const BASS_3DVECTOR *pos, const BASS_3DVECTOR *orient, const BASS_3DVECTOR *vel); -BOOL BASSDEF(BASS_ChannelGet3DPosition)(DWORD handle, BASS_3DVECTOR *pos, BASS_3DVECTOR *orient, BASS_3DVECTOR *vel); -QWORD BASSDEF(BASS_ChannelGetLength)(DWORD handle, DWORD mode); -BOOL BASSDEF(BASS_ChannelSetPosition)(DWORD handle, QWORD pos, DWORD mode); -QWORD BASSDEF(BASS_ChannelGetPosition)(DWORD handle, DWORD mode); -DWORD BASSDEF(BASS_ChannelGetLevel)(DWORD handle); -BOOL BASSDEF(BASS_ChannelGetLevelEx)(DWORD handle, float *levels, float length, DWORD flags); -DWORD BASSDEF(BASS_ChannelGetData)(DWORD handle, void *buffer, DWORD length); -HSYNC BASSDEF(BASS_ChannelSetSync)(DWORD handle, DWORD type, QWORD param, SYNCPROC *proc, void *user); -BOOL BASSDEF(BASS_ChannelRemoveSync)(DWORD handle, HSYNC sync); -HDSP BASSDEF(BASS_ChannelSetDSP)(DWORD handle, DSPPROC *proc, void *user, int priority); -BOOL BASSDEF(BASS_ChannelRemoveDSP)(DWORD handle, HDSP dsp); -BOOL BASSDEF(BASS_ChannelSetLink)(DWORD handle, DWORD chan); -BOOL BASSDEF(BASS_ChannelRemoveLink)(DWORD handle, DWORD chan); -HFX BASSDEF(BASS_ChannelSetFX)(DWORD handle, DWORD type, int priority); -BOOL BASSDEF(BASS_ChannelRemoveFX)(DWORD handle, HFX fx); - -BOOL BASSDEF(BASS_FXSetParameters)(HFX handle, const void *params); -BOOL BASSDEF(BASS_FXGetParameters)(HFX handle, void *params); -BOOL BASSDEF(BASS_FXReset)(HFX handle); -BOOL BASSDEF(BASS_FXSetPriority)(HFX handle, int priority); - -#ifdef __cplusplus -} - -#if defined(_WIN32) && !defined(NOBASSOVERLOADS) -static inline HPLUGIN BASS_PluginLoad(const WCHAR *file, DWORD flags) -{ - return BASS_PluginLoad((const char*)file, flags|BASS_UNICODE); -} - -static inline HMUSIC BASS_MusicLoad(BOOL mem, const WCHAR *file, QWORD offset, DWORD length, DWORD flags, DWORD freq) -{ - return BASS_MusicLoad(mem, (const void*)file, offset, length, flags|BASS_UNICODE, freq); -} - -static inline HSAMPLE BASS_SampleLoad(BOOL mem, const WCHAR *file, QWORD offset, DWORD length, DWORD max, DWORD flags) -{ - return BASS_SampleLoad(mem, (const void*)file, offset, length, max, flags|BASS_UNICODE); -} - -static inline HSTREAM BASS_StreamCreateFile(BOOL mem, const WCHAR *file, QWORD offset, QWORD length, DWORD flags) -{ - return BASS_StreamCreateFile(mem, (const void*)file, offset, length, flags|BASS_UNICODE); -} - -static inline HSTREAM BASS_StreamCreateURL(const WCHAR *url, DWORD offset, DWORD flags, DOWNLOADPROC *proc, void *user) -{ - return BASS_StreamCreateURL((const char*)url, offset, flags|BASS_UNICODE, proc, user); -} - -static inline BOOL BASS_SetConfigPtr(DWORD option, const WCHAR *value) -{ - return BASS_SetConfigPtr(option|BASS_UNICODE, (const void*)value); -} -#endif -#endif - -#endif diff --git a/ThirdParty/BASS/bassmidi.h b/ThirdParty/BASS/bassmidi.h deleted file mode 100644 index dcfecd460..000000000 --- a/ThirdParty/BASS/bassmidi.h +++ /dev/null @@ -1,380 +0,0 @@ -/* - BASSMIDI 2.4 C/C++ header file - Copyright (c) 2006-2020 Un4seen Developments Ltd. - - See the BASSMIDI.CHM file for more detailed documentation -*/ - -#ifndef BASSMIDI_H -#define BASSMIDI_H - -#include "bass.h" - -#if BASSVERSION!=0x204 -#error conflicting BASS and BASSMIDI versions -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef BASSMIDIDEF -#define BASSMIDIDEF(f) WINAPI f -#endif - -typedef DWORD HSOUNDFONT; // soundfont handle - -// Additional error codes returned by BASS_ErrorGetCode -#define BASS_ERROR_MIDI_INCLUDE 7000 // SFZ include file could not be opened - -// Additional BASS_SetConfig options -#define BASS_CONFIG_MIDI_COMPACT 0x10400 -#define BASS_CONFIG_MIDI_VOICES 0x10401 -#define BASS_CONFIG_MIDI_AUTOFONT 0x10402 -#define BASS_CONFIG_MIDI_IN_PORTS 0x10404 -#define BASS_CONFIG_MIDI_SAMPLETHREADS 0x10406 -#define BASS_CONFIG_MIDI_SAMPLEMEM 0x10407 -#define BASS_CONFIG_MIDI_SAMPLEREAD 0x10408 - -// Additional BASS_SetConfigPtr options -#define BASS_CONFIG_MIDI_DEFFONT 0x10403 -#define BASS_CONFIG_MIDI_SFZHEAD 0x10408 - -// Additional sync types -#define BASS_SYNC_MIDI_MARK 0x10000 -#define BASS_SYNC_MIDI_MARKER 0x10000 -#define BASS_SYNC_MIDI_CUE 0x10001 -#define BASS_SYNC_MIDI_LYRIC 0x10002 -#define BASS_SYNC_MIDI_TEXT 0x10003 -#define BASS_SYNC_MIDI_EVENT 0x10004 -#define BASS_SYNC_MIDI_TICK 0x10005 -#define BASS_SYNC_MIDI_TIMESIG 0x10006 -#define BASS_SYNC_MIDI_KEYSIG 0x10007 - -// Additional BASS_MIDI_StreamCreateFile/etc flags -#define BASS_MIDI_NOSYSRESET 0x800 -#define BASS_MIDI_DECAYEND 0x1000 -#define BASS_MIDI_NOFX 0x2000 -#define BASS_MIDI_DECAYSEEK 0x4000 -#define BASS_MIDI_NOCROP 0x8000 -#define BASS_MIDI_NOTEOFF1 0x10000 -#define BASS_MIDI_SINCINTER 0x800000 - -// BASS_MIDI_FontInit flags -#define BASS_MIDI_FONT_MEM 0x10000 -#define BASS_MIDI_FONT_MMAP 0x20000 -#define BASS_MIDI_FONT_XGDRUMS 0x40000 -#define BASS_MIDI_FONT_NOFX 0x80000 -#define BASS_MIDI_FONT_LINATTMOD 0x100000 -#define BASS_MIDI_FONT_LINDECVOL 0x200000 -#define BASS_MIDI_FONT_NORAMPIN 0x400000 -#define BASS_MIDI_FONT_NOLIMITS 0x800000 - -typedef struct { - HSOUNDFONT font; // soundfont - int preset; // preset number (-1=all) - int bank; -} BASS_MIDI_FONT; - -typedef struct { - HSOUNDFONT font; // soundfont - int spreset; // source preset number - int sbank; // source bank number - int dpreset; // destination preset/program number - int dbank; // destination bank number - int dbanklsb; // destination bank number LSB -} BASS_MIDI_FONTEX; - -// BASS_MIDI_StreamSet/GetFonts flag -#define BASS_MIDI_FONT_EX 0x1000000 // BASS_MIDI_FONTEX - -typedef struct { - const char *name; - const char *copyright; - const char *comment; - DWORD presets; // number of presets/instruments - DWORD samsize; // total size (in bytes) of the sample data - DWORD samload; // amount of sample data currently loaded - DWORD samtype; // sample format (CTYPE) if packed -} BASS_MIDI_FONTINFO; - -typedef struct { - DWORD track; // track containing marker - DWORD pos; // marker position - const char *text; // marker text -} BASS_MIDI_MARK; - -// Marker types -#define BASS_MIDI_MARK_MARKER 0 // marker -#define BASS_MIDI_MARK_CUE 1 // cue point -#define BASS_MIDI_MARK_LYRIC 2 // lyric -#define BASS_MIDI_MARK_TEXT 3 // text -#define BASS_MIDI_MARK_TIMESIG 4 // time signature -#define BASS_MIDI_MARK_KEYSIG 5 // key signature -#define BASS_MIDI_MARK_COPY 6 // copyright notice -#define BASS_MIDI_MARK_TRACK 7 // track name -#define BASS_MIDI_MARK_INST 8 // instrument name -#define BASS_MIDI_MARK_TRACKSTART 9 // track start (SMF2) -#define BASS_MIDI_MARK_TICK 0x10000 // flag: get position in ticks (otherwise bytes) - -// MIDI events -#define MIDI_EVENT_NOTE 1 -#define MIDI_EVENT_PROGRAM 2 -#define MIDI_EVENT_CHANPRES 3 -#define MIDI_EVENT_PITCH 4 -#define MIDI_EVENT_PITCHRANGE 5 -#define MIDI_EVENT_DRUMS 6 -#define MIDI_EVENT_FINETUNE 7 -#define MIDI_EVENT_COARSETUNE 8 -#define MIDI_EVENT_MASTERVOL 9 -#define MIDI_EVENT_BANK 10 -#define MIDI_EVENT_MODULATION 11 -#define MIDI_EVENT_VOLUME 12 -#define MIDI_EVENT_PAN 13 -#define MIDI_EVENT_EXPRESSION 14 -#define MIDI_EVENT_SUSTAIN 15 -#define MIDI_EVENT_SOUNDOFF 16 -#define MIDI_EVENT_RESET 17 -#define MIDI_EVENT_NOTESOFF 18 -#define MIDI_EVENT_PORTAMENTO 19 -#define MIDI_EVENT_PORTATIME 20 -#define MIDI_EVENT_PORTANOTE 21 -#define MIDI_EVENT_MODE 22 -#define MIDI_EVENT_REVERB 23 -#define MIDI_EVENT_CHORUS 24 -#define MIDI_EVENT_CUTOFF 25 -#define MIDI_EVENT_RESONANCE 26 -#define MIDI_EVENT_RELEASE 27 -#define MIDI_EVENT_ATTACK 28 -#define MIDI_EVENT_DECAY 29 -#define MIDI_EVENT_REVERB_MACRO 30 -#define MIDI_EVENT_CHORUS_MACRO 31 -#define MIDI_EVENT_REVERB_TIME 32 -#define MIDI_EVENT_REVERB_DELAY 33 -#define MIDI_EVENT_REVERB_LOCUTOFF 34 -#define MIDI_EVENT_REVERB_HICUTOFF 35 -#define MIDI_EVENT_REVERB_LEVEL 36 -#define MIDI_EVENT_CHORUS_DELAY 37 -#define MIDI_EVENT_CHORUS_DEPTH 38 -#define MIDI_EVENT_CHORUS_RATE 39 -#define MIDI_EVENT_CHORUS_FEEDBACK 40 -#define MIDI_EVENT_CHORUS_LEVEL 41 -#define MIDI_EVENT_CHORUS_REVERB 42 -#define MIDI_EVENT_USERFX 43 -#define MIDI_EVENT_USERFX_LEVEL 44 -#define MIDI_EVENT_USERFX_REVERB 45 -#define MIDI_EVENT_USERFX_CHORUS 46 -#define MIDI_EVENT_DRUM_FINETUNE 50 -#define MIDI_EVENT_DRUM_COARSETUNE 51 -#define MIDI_EVENT_DRUM_PAN 52 -#define MIDI_EVENT_DRUM_REVERB 53 -#define MIDI_EVENT_DRUM_CHORUS 54 -#define MIDI_EVENT_DRUM_CUTOFF 55 -#define MIDI_EVENT_DRUM_RESONANCE 56 -#define MIDI_EVENT_DRUM_LEVEL 57 -#define MIDI_EVENT_DRUM_USERFX 58 -#define MIDI_EVENT_SOFT 60 -#define MIDI_EVENT_SYSTEM 61 -#define MIDI_EVENT_TEMPO 62 -#define MIDI_EVENT_SCALETUNING 63 -#define MIDI_EVENT_CONTROL 64 -#define MIDI_EVENT_CHANPRES_VIBRATO 65 -#define MIDI_EVENT_CHANPRES_PITCH 66 -#define MIDI_EVENT_CHANPRES_FILTER 67 -#define MIDI_EVENT_CHANPRES_VOLUME 68 -#define MIDI_EVENT_MOD_VIBRATO 69 -#define MIDI_EVENT_MODRANGE 69 -#define MIDI_EVENT_BANK_LSB 70 -#define MIDI_EVENT_KEYPRES 71 -#define MIDI_EVENT_KEYPRES_VIBRATO 72 -#define MIDI_EVENT_KEYPRES_PITCH 73 -#define MIDI_EVENT_KEYPRES_FILTER 74 -#define MIDI_EVENT_KEYPRES_VOLUME 75 -#define MIDI_EVENT_SOSTENUTO 76 -#define MIDI_EVENT_MOD_PITCH 77 -#define MIDI_EVENT_MOD_FILTER 78 -#define MIDI_EVENT_MOD_VOLUME 79 -#define MIDI_EVENT_VIBRATO_RATE 80 -#define MIDI_EVENT_VIBRATO_DEPTH 81 -#define MIDI_EVENT_VIBRATO_DELAY 82 -#define MIDI_EVENT_MIXLEVEL 0x10000 -#define MIDI_EVENT_TRANSPOSE 0x10001 -#define MIDI_EVENT_SYSTEMEX 0x10002 -#define MIDI_EVENT_SPEED 0x10004 - -#define MIDI_EVENT_END 0 -#define MIDI_EVENT_END_TRACK 0x10003 - -#define MIDI_EVENT_NOTES 0x20000 -#define MIDI_EVENT_VOICES 0x20001 - -#define MIDI_SYSTEM_DEFAULT 0 -#define MIDI_SYSTEM_GM1 1 -#define MIDI_SYSTEM_GM2 2 -#define MIDI_SYSTEM_XG 3 -#define MIDI_SYSTEM_GS 4 - -typedef struct { - DWORD event; // MIDI_EVENT_xxx - DWORD param; - DWORD chan; - DWORD tick; // event position (ticks) - DWORD pos; // event position (bytes) -} BASS_MIDI_EVENT; - -// BASS_MIDI_StreamEvents modes -#define BASS_MIDI_EVENTS_STRUCT 0 // BASS_MIDI_EVENT structures -#define BASS_MIDI_EVENTS_RAW 0x10000 // raw MIDI event data -#define BASS_MIDI_EVENTS_SYNC 0x1000000 // flag: trigger event syncs -#define BASS_MIDI_EVENTS_NORSTATUS 0x2000000 // flag: no running status -#define BASS_MIDI_EVENTS_CANCEL 0x4000000 // flag: cancel pending events -#define BASS_MIDI_EVENTS_TIME 0x8000000 // flag: delta-time info is present -#define BASS_MIDI_EVENTS_ABSTIME 0x10000000 // flag: absolute time info is present - -// BASS_MIDI_StreamGetChannel special channels -#define BASS_MIDI_CHAN_CHORUS (DWORD)-1 -#define BASS_MIDI_CHAN_REVERB (DWORD)-2 -#define BASS_MIDI_CHAN_USERFX (DWORD)-3 - -// BASS_CHANNELINFO type -#define BASS_CTYPE_STREAM_MIDI 0x10d00 - -// Additional attributes -#define BASS_ATTRIB_MIDI_PPQN 0x12000 -#define BASS_ATTRIB_MIDI_CPU 0x12001 -#define BASS_ATTRIB_MIDI_CHANS 0x12002 -#define BASS_ATTRIB_MIDI_VOICES 0x12003 -#define BASS_ATTRIB_MIDI_VOICES_ACTIVE 0x12004 -#define BASS_ATTRIB_MIDI_STATE 0x12005 -#define BASS_ATTRIB_MIDI_SRC 0x12006 -#define BASS_ATTRIB_MIDI_KILL 0x12007 -#define BASS_ATTRIB_MIDI_SPEED 0x12008 -#define BASS_ATTRIB_MIDI_REVERB 0x12009 -#define BASS_ATTRIB_MIDI_VOL 0x1200a -#define BASS_ATTRIB_MIDI_TRACK_VOL 0x12100 // + track # - -// Additional tag type -#define BASS_TAG_MIDI_TRACK 0x11000 // + track #, track text : array of null-terminated ANSI strings - -// BASS_ChannelGetLength/GetPosition/SetPosition mode -#define BASS_POS_MIDI_TICK 2 // tick position - -typedef BOOL (CALLBACK MIDIFILTERPROC)(HSTREAM handle, DWORD track, BASS_MIDI_EVENT *event, BOOL seeking, void *user); -/* Event filtering callback function. -handle : MIDI stream handle -track : Track containing the event -event : The event -seeking: TRUE = the event is being processed while seeking, FALSE = it is being played -user : The 'user' parameter value given when calling BASS_MIDI_StreamSetFilter -RETURN : TRUE = process the event, FALSE = drop the event */ - -// BASS_MIDI_FontLoadEx flags -#define BASS_MIDI_FONTLOAD_NOWAIT 1 // don't want for the samples to load -#define BASS_MIDI_FONTLOAD_COMPACT 2 // compact samples -#define BASS_MIDI_FONTLOAD_NOLOAD 4 // don't load (only compact) -#define BASS_MIDI_FONTLOAD_TIME 8 // length is in milliseconds -#define BASS_MIDI_FONTLOAD_KEEPDEC 16 // keep decoders - -// BASS_MIDI_FontPack flags -#define BASS_MIDI_PACK_NOHEAD 1 // don't send a WAV header to the encoder -#define BASS_MIDI_PACK_16BIT 2 // discard low 8 bits of 24-bit sample data -#define BASS_MIDI_PACK_48KHZ 4 // set encoding rate to 48000 Hz (else 44100 Hz) - -typedef struct { - const char *name; // description - DWORD id; - DWORD flags; -} BASS_MIDI_DEVICEINFO; - -typedef void (CALLBACK MIDIINPROC)(DWORD device, double time, const BYTE *buffer, DWORD length, void *user); -/* MIDI input callback function. -device : MIDI input device -time : Timestamp -buffer : Buffer containing MIDI data -length : Number of bytes of data -user : The 'user' parameter value given when calling BASS_MIDI_InInit */ - -HSTREAM BASSMIDIDEF(BASS_MIDI_StreamCreate)(DWORD channels, DWORD flags, DWORD freq); -HSTREAM BASSMIDIDEF(BASS_MIDI_StreamCreateFile)(BOOL mem, const void *file, QWORD offset, QWORD length, DWORD flags, DWORD freq); -HSTREAM BASSMIDIDEF(BASS_MIDI_StreamCreateURL)(const char *url, DWORD offset, DWORD flags, DOWNLOADPROC *proc, void *user, DWORD freq); -HSTREAM BASSMIDIDEF(BASS_MIDI_StreamCreateFileUser)(DWORD system, DWORD flags, const BASS_FILEPROCS *procs, void *user, DWORD freq); -HSTREAM BASSMIDIDEF(BASS_MIDI_StreamCreateEvents)(const BASS_MIDI_EVENT *events, DWORD ppqn, DWORD flags, DWORD freq); -BOOL BASSMIDIDEF(BASS_MIDI_StreamGetMark)(HSTREAM handle, DWORD type, DWORD index, BASS_MIDI_MARK *mark); -DWORD BASSMIDIDEF(BASS_MIDI_StreamGetMarks)(HSTREAM handle, int track, DWORD type, BASS_MIDI_MARK *marks); -BOOL BASSMIDIDEF(BASS_MIDI_StreamSetFonts)(HSTREAM handle, const void *fonts, DWORD count); -DWORD BASSMIDIDEF(BASS_MIDI_StreamGetFonts)(HSTREAM handle, void *fonts, DWORD count); -BOOL BASSMIDIDEF(BASS_MIDI_StreamLoadSamples)(HSTREAM handle); -BOOL BASSMIDIDEF(BASS_MIDI_StreamEvent)(HSTREAM handle, DWORD chan, DWORD event, DWORD param); -DWORD BASSMIDIDEF(BASS_MIDI_StreamEvents)(HSTREAM handle, DWORD mode, const void *events, DWORD length); -DWORD BASSMIDIDEF(BASS_MIDI_StreamGetEvent)(HSTREAM handle, DWORD chan, DWORD event); -DWORD BASSMIDIDEF(BASS_MIDI_StreamGetEvents)(HSTREAM handle, int track, DWORD filter, BASS_MIDI_EVENT *events); -DWORD BASSMIDIDEF(BASS_MIDI_StreamGetEventsEx)(HSTREAM handle, int track, DWORD filter, BASS_MIDI_EVENT *events, DWORD start, DWORD count); -BOOL BASSMIDIDEF(BASS_MIDI_StreamGetPreset)(HSTREAM handle, DWORD chan, BASS_MIDI_FONT *font); -HSTREAM BASSMIDIDEF(BASS_MIDI_StreamGetChannel)(HSTREAM handle, DWORD chan); -BOOL BASSMIDIDEF(BASS_MIDI_StreamSetFilter)(HSTREAM handle, BOOL seeking, MIDIFILTERPROC *proc, void *user); - -HSOUNDFONT BASSMIDIDEF(BASS_MIDI_FontInit)(const void *file, DWORD flags); -HSOUNDFONT BASSMIDIDEF(BASS_MIDI_FontInitUser)(const BASS_FILEPROCS *procs, void *user, DWORD flags); -BOOL BASSMIDIDEF(BASS_MIDI_FontFree)(HSOUNDFONT handle); -BOOL BASSMIDIDEF(BASS_MIDI_FontGetInfo)(HSOUNDFONT handle, BASS_MIDI_FONTINFO *info); -BOOL BASSMIDIDEF(BASS_MIDI_FontGetPresets)(HSOUNDFONT handle, DWORD *presets); -const char *BASSMIDIDEF(BASS_MIDI_FontGetPreset)(HSOUNDFONT handle, int preset, int bank); -BOOL BASSMIDIDEF(BASS_MIDI_FontLoad)(HSOUNDFONT handle, int preset, int bank); -BOOL BASSMIDIDEF(BASS_MIDI_FontLoadEx)(HSOUNDFONT handle, int preset, int bank, DWORD length, DWORD flags); -BOOL BASSMIDIDEF(BASS_MIDI_FontUnload)(HSOUNDFONT handle, int preset, int bank); -BOOL BASSMIDIDEF(BASS_MIDI_FontCompact)(HSOUNDFONT handle); -BOOL BASSMIDIDEF(BASS_MIDI_FontPack)(HSOUNDFONT handle, const void *outfile, const void *encoder, DWORD flags); -BOOL BASSMIDIDEF(BASS_MIDI_FontUnpack)(HSOUNDFONT handle, const void *outfile, DWORD flags); -BOOL BASSMIDIDEF(BASS_MIDI_FontSetVolume)(HSOUNDFONT handle, float volume); -float BASSMIDIDEF(BASS_MIDI_FontGetVolume)(HSOUNDFONT handle); - -DWORD BASSMIDIDEF(BASS_MIDI_ConvertEvents)(const BYTE *data, DWORD length, BASS_MIDI_EVENT *events, DWORD count, DWORD flags); - -BOOL BASSMIDIDEF(BASS_MIDI_InGetDeviceInfo)(DWORD device, BASS_MIDI_DEVICEINFO *info); -BOOL BASSMIDIDEF(BASS_MIDI_InInit)(DWORD device, MIDIINPROC *proc, void *user); -BOOL BASSMIDIDEF(BASS_MIDI_InFree)(DWORD device); -BOOL BASSMIDIDEF(BASS_MIDI_InStart)(DWORD device); -BOOL BASSMIDIDEF(BASS_MIDI_InStop)(DWORD device); - -#ifdef __cplusplus -} - -static inline BOOL BASS_MIDI_StreamSetFonts(HSTREAM handle, const BASS_MIDI_FONTEX *fonts, DWORD count) -{ - return BASS_MIDI_StreamSetFonts(handle, (const void*)fonts, count|BASS_MIDI_FONT_EX); -} - -static inline DWORD BASS_MIDI_StreamGetFonts(HSTREAM handle, BASS_MIDI_FONTEX *fonts, DWORD count) -{ - return BASS_MIDI_StreamGetFonts(handle, (void*)fonts, count|BASS_MIDI_FONT_EX); -} - -#ifdef _WIN32 -static inline HSTREAM BASS_MIDI_StreamCreateFile(BOOL mem, const WCHAR *file, QWORD offset, QWORD length, DWORD flags, DWORD freq) -{ - return BASS_MIDI_StreamCreateFile(mem, (const void*)file, offset, length, flags|BASS_UNICODE, freq); -} - -static inline HSTREAM BASS_MIDI_StreamCreateURL(const WCHAR *url, DWORD offset, DWORD flags, DOWNLOADPROC *proc, void *user, DWORD freq) -{ - return BASS_MIDI_StreamCreateURL((const char*)url, offset, flags|BASS_UNICODE, proc, user, freq); -} - -static inline HSOUNDFONT BASS_MIDI_FontInit(const WCHAR *file, DWORD flags) -{ - return BASS_MIDI_FontInit((const void*)file, flags|BASS_UNICODE); -} - -static inline BOOL BASS_MIDI_FontPack(HSOUNDFONT handle, const WCHAR *outfile, const WCHAR *encoder, DWORD flags) -{ - return BASS_MIDI_FontPack(handle, (const void*)outfile, (const void*)encoder, flags|BASS_UNICODE); -} - -static inline BOOL BASS_MIDI_FontUnpack(HSOUNDFONT handle, const WCHAR *outfile, DWORD flags) -{ - return BASS_MIDI_FontUnpack(handle, (const void*)outfile, flags|BASS_UNICODE); -} -#endif -#endif - -#endif diff --git a/ThirdParty/BASS/libbass.dylib b/ThirdParty/BASS/libbass.dylib deleted file mode 100644 index 28252eaa8..000000000 Binary files a/ThirdParty/BASS/libbass.dylib and /dev/null differ diff --git a/ThirdParty/BASS/libbassflac.dylib b/ThirdParty/BASS/libbassflac.dylib deleted file mode 100644 index 6180c2a13..000000000 Binary files a/ThirdParty/BASS/libbassflac.dylib and /dev/null differ diff --git a/ThirdParty/BASS/libbassmidi.dylib b/ThirdParty/BASS/libbassmidi.dylib deleted file mode 100644 index e8526bb51..000000000 Binary files a/ThirdParty/BASS/libbassmidi.dylib and /dev/null differ diff --git a/ThirdParty/BASS/libbassopus.dylib b/ThirdParty/BASS/libbassopus.dylib deleted file mode 100644 index ce45ffa0a..000000000 Binary files a/ThirdParty/BASS/libbassopus.dylib and /dev/null differ diff --git a/ThirdParty/BASS/libbasswv.dylib b/ThirdParty/BASS/libbasswv.dylib deleted file mode 100644 index 6a09b0221..000000000 Binary files a/ThirdParty/BASS/libbasswv.dylib and /dev/null differ diff --git a/ThirdParty/BASS/sflist.c b/ThirdParty/BASS/sflist.c deleted file mode 100644 index 494334833..000000000 --- a/ThirdParty/BASS/sflist.c +++ /dev/null @@ -1,917 +0,0 @@ -/* vim: set et ts=3 sw=3 sts=3 ft=c: - * - * Copyright (C) 2021 Christopher Snowhill. All rights reserved. - * https://github.com/kode54/sflist - * https://gist.github.com/kode54/a7bb01a0db3f2e996145b77f0ca510d5 - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#include -#include -#include -#include - -#include - -#include "sflist.h" - -#ifndef PRId64 -#ifdef _MSC_VER -#define PRId64 "I64d" -#else -#define PRId64 "lld" -#endif -#endif - -/* Extras needed */ - -static int json_equal (const json_value * a, const json_value * b); - -static int json_equal_array(const json_value * a, const json_value * b) -{ - unsigned int i, j; - - if (a->u.array.length != b->u.array.length) return 0; - - for (i = 0, j = a->u.array.length; i < j; ++i) - { - if (!json_equal(a->u.array.values[i], b->u.array.values[i])) - return 0; - } - - return 1; -} - -static int json_equal_object(const json_value * a, const json_value * b) -{ - unsigned int i, j; - - if (a->u.object.length != b->u.object.length) return 0; - - for (i = 0, j = a->u.object.length; i < j; ++i) - { - if (strcmp(a->u.object.values[i].name, b->u.object.values[i].name)) - return 0; - if (!json_equal(a->u.object.values[i].value, b->u.object.values[i].value)) - return 0; - } - - return 1; -} - -static int json_equal (const json_value * a, const json_value * b) -{ - if (a->type != b->type) return 0; - - switch (a->type) - { - case json_none: - case json_null: - return 1; - - case json_integer: - return a->u.integer == b->u.integer; - - case json_double: - return a->u.dbl == b->u.dbl; - - case json_boolean: - return !a->u.boolean == !b->u.boolean; - - case json_string: - return !strcmp(a->u.string.ptr, b->u.string.ptr); - - case json_array: - return json_equal_array(a, b); - - case json_object: - return json_equal_object(a, b); - } - - return 0; -} - -static int json_signum (double val) -{ - return (val > 0.0) - (val < 0.0); -} - -#define json_compare_invalid -1000 - -static int json_compare (const json_value * a, const json_value * b) -{ - if (a->type != b->type) return json_compare_invalid; - - switch (a->type) - { - case json_none: - case json_null: - return 0; - - case json_integer: - return (int)(a->u.integer - b->u.integer); - - case json_double: - return json_signum(a->u.dbl - b->u.dbl); - - case json_boolean: - return !!a->u.boolean - !!b->u.boolean; - - case json_string: - return strcmp(a->u.string.ptr, b->u.string.ptr); - - case json_array: - case json_object: - return json_compare_invalid; - } - - return json_compare_invalid; -} - -static int json_array_contains_value (const json_value * array, const json_value * value) -{ - unsigned int i, j; - - for (i = 0, j = array->u.array.length; i < j; ++i) - { - if (json_equal(array->u.array.values[i], value)) - return 1; - } - - return 0; -} - -json_value * json_array_merge (json_value * arrayA, json_value * arrayB) -{ - unsigned int i, j; - - if (arrayA->type != json_array || arrayB->type != json_array) - return 0; - - for (i = 0, j = arrayB->u.array.length; i < j; ++i) - { - if (!json_array_contains_value(arrayA, arrayB->u.array.values[i])) - { - json_array_push(arrayA, arrayB->u.array.values[i]); - } - } - - json_builder_free(arrayB); - - return arrayA; -} - -static int json_compare_callback (const void * a, const void * b) -{ - const json_value * aa = (const json_value *) a; - const json_value * bb = (const json_value *) b; - return json_compare(aa, bb); -} - -json_value * json_array_sort (json_value * array) -{ - unsigned int i, j; - - json_type type; - - if (array->type != json_array) return 0; - - if (array->u.array.length < 2) return array; - - type = array->u.array.values[0]->type; - - for (i = 1, j = array->u.array.length; i < j; ++i) - { - if (array->u.array.values[i]->type != type) - return 0; - } - - qsort(array->u.array.values, j, sizeof(json_value *), json_compare_callback); - - return array; -} - - -/* Processing begins */ - -static size_t sflist_parse_int(const char * in, const char ** end) -{ - size_t rval = 0; - while (in < *end) { - if (isdigit(*in)) { - rval = (rval * 10) + (*in - '0'); - } - else break; - ++in; - } - *end = in; - return rval; -} - -static double sflist_parse_float(const char * in, const char ** end) -{ - size_t whole = 0; - size_t decimal = 0; - size_t decimal_places = 0; - double sign = 1.0; - const char * end_orig = *end; - const char * ptr = in; - if (*ptr == '-') { - ++ptr; - sign = -1.0; - } - whole = sflist_parse_int(ptr, end); - if (*end == ptr || (**end != '.' && *end < end_orig)) { - *end = in; - return 0.0; - } - if (*end < end_orig) { - ptr = *end + 1; - *end = end_orig; - decimal = sflist_parse_int(ptr, end); - if (*end == ptr || *end < end_orig) { - *end = in; - return 0.0; - } - decimal_places = *end - ptr; - } - return (((double)whole) + (((double)decimal) / pow(10.0, (double)decimal_places))) * sign; -} - -static json_value * sflist_load_v1(const char * sflist, size_t size, char * error_buf) -{ - json_value * rval = 0; - - json_value * arr = json_array_new(0); - - json_value * channels = 0; - json_value * patchMappings = 0; - double gain = 0.0; - - const char * ptr = sflist; - const char * end = sflist + size; - - unsigned int cur_line = 0; - - while (ptr < end) { - const char * line_start = ptr; - json_value * obj = 0; - const char * path = 0; - const char * pipe = 0; - const char * lend = ptr; - ++cur_line; - while (lend < end && *lend && *lend != '\r' && *lend != '\n') { - if (*lend == '|') - pipe = lend; - ++lend; - } - if (pipe) - path = pipe + 1; - else - path = ptr; - if (pipe) { - while (ptr < pipe) { - char c; - const char * fend = ptr; - const char * vend; - while (fend < pipe && *fend != '&') ++fend; - vend = fend; - switch (c = *ptr++) { - case '&': - continue; - - case 'c': { - json_value * this_channels; - size_t channel_low = sflist_parse_int(ptr, &vend); - size_t channel_high = 0; - size_t i; - if (vend == ptr || (*vend != '-' && *vend != '&' && *vend != '|')) { - sprintf(error_buf, "Invalid channel number (%u:%u)", cur_line, (int)(vend - line_start + 1)); - goto error; - } - if (*vend != '-') - channel_high = channel_low; - else { - ptr = vend + 1; - vend = fend; - channel_high = sflist_parse_int(ptr, &vend); - if (vend == ptr || (*vend != '&' && *vend != '|')) { - sprintf(error_buf, "Invalid channel range end value (%u:%u)", cur_line, (int)(vend - line_start + 1)); - goto error; - } - } - if (!channels) - channels = json_array_new(0); - this_channels = json_array_new(0); - for (i = channel_low; i <= channel_high; ++i) - json_array_push(this_channels, json_integer_new(i)); - channels = json_array_merge(channels, this_channels); - ptr = fend; - } - break; - - case 'p': { - json_value * mapping = 0; - json_value * mapping_destination = 0; - json_value * mapping_source = 0; - - long source_bank = -1; - long source_program = -1; - long dest_bank = -1; - long dest_program = -1; - - size_t val = sflist_parse_int(ptr, &vend); - if (vend == ptr || (*vend != '=' && *vend != ',' && *vend != '|')) { - sprintf(error_buf, "Invalid preset number (%u:%u)", cur_line, (int)(vend - line_start + 1)); - goto error; - } - dest_program = val; - if (*vend == ',') { - dest_bank = val; - ptr = vend + 1; - vend = fend; - val = sflist_parse_int(ptr, &vend); - if (vend == ptr || (*vend != '=' && *vend != '|')) { - sprintf(error_buf, "Invalid preset number (%u:%u)", cur_line, (int)(vend - line_start + 1)); - goto error; - } - dest_program = val; - } - if (*vend == '=') { - ptr = vend + 1; - vend = fend; - val = sflist_parse_int(ptr, &vend); - if (vend == ptr || (*vend != ',' && *vend != '|')) { - sprintf(error_buf, "Invalid preset number (%u:%u)", cur_line, (int)(vend - line_start + 1)); - goto error; - } - source_program = val; - if (*vend == ',') { - source_bank = val; - ptr = vend + 1; - vend = fend; - val = sflist_parse_int(ptr, &vend); - if (vend == ptr || (*vend != '&' && *vend != '|')) { - sprintf(error_buf, "Invalid preset number (%u:%u)", cur_line, (int)(vend - line_start + 1)); - goto error; - } - source_program = val; - } - } - - if (!patchMappings) - patchMappings = json_array_new(0); - mapping = json_object_new(0); - mapping_destination = json_object_new(0); - if (dest_bank != -1) { - json_object_push(mapping_destination, "bank", json_integer_new(dest_bank)); - } - json_object_push(mapping_destination, "program", json_integer_new(dest_program)); - json_object_push(mapping, "destination", mapping_destination); - if (source_program != -1) { - mapping_source = json_object_new(0); - if (source_bank != -1) { - json_object_push(mapping_source, "bank", json_integer_new(source_bank)); - } - json_object_push(mapping_source, "program", json_integer_new(source_program)); - json_object_push(mapping, "source", mapping_source); - } - json_array_push(patchMappings, mapping); - - ptr = fend; - } - break; - - case 'g': { - double val = sflist_parse_float(ptr, &vend); - if (vend == ptr || vend < fend) { - sprintf(error_buf, "Invalid gain value (%u:%u)", cur_line, (int)(vend - line_start + 1)); - goto error; - } - gain = val; - ptr = fend; - } - break; - - default: - sprintf(error_buf, "Invalid character in preset '%c' (%u:%u)", c, cur_line, (unsigned int)(ptr - line_start)); - goto error; - } - } - } - obj = json_object_new(0); - json_object_push(obj, "fileName", json_string_new_length((unsigned int)(lend - path), path)); - if (gain != 0.0) { - json_object_push(obj, "gain", json_double_new(gain)); - gain = 0.0; - } - if (channels) { - channels = json_array_sort(channels); - json_object_push(obj, "channels", channels); - channels = 0; - } - if (patchMappings) { - json_object_push(obj, "patchMappings", patchMappings); - patchMappings = 0; - } - - json_array_push(arr, obj); - - ptr = lend; - - while (ptr < end && (*ptr == '\n' || *ptr == '\r')) ++ptr; - } - - rval = json_object_new(1); - json_object_push(rval, "soundFonts", arr); - - return rval; - -error: - if (channels) json_builder_free(channels); - if (patchMappings) json_builder_free(patchMappings); - if (arr) json_builder_free(arr); - return 0; -} - -static json_value * sflist_load_v2(const char * sflist, size_t size, char * error) -{ - json_value * rval = 0; - - json_settings settings = { 0 }; - settings.value_extra = json_builder_extra; - - rval = json_parse_ex( &settings, sflist, size, error); - - return rval; -} - -static const json_value * json_object_item(const json_value * object, const char * name) -{ - unsigned int i, j; - - if (object->type != json_object) return &json_value_none; - - for (i = 0, j = object->u.object.length; i < j; ++i) { - if (!strcmp(object->u.object.values[i].name, name)) - return object->u.object.values[i].value; - } - - return &json_value_none; -} - -static void sflist_process_patchmappings(BASS_MIDI_FONTEX * out, BASS_MIDI_FONTEX * fontex, const json_value * patchMappings, unsigned int channel) -{ - unsigned int i, j; - for (i = 0, j = patchMappings->u.array.length; i < j; ++i) { - json_value * preset = patchMappings->u.array.values[i]; - const json_value * destination = json_object_item(preset, "destination"); - const json_value * source = json_object_item(preset, "source"); - const json_value * destination_bank = json_object_item(destination, "bank"); - const json_value * destination_program = json_object_item(destination, "program"); - const json_value * source_bank = json_object_item(source, "bank"); - const json_value * source_program = json_object_item(source, "program"); - fontex->spreset = (source_program->type == json_none) ? -1 : (int)source_program->u.integer; - fontex->sbank = (source_bank->type == json_none) ? -1 : (int)source_bank->u.integer; - fontex->dpreset = (destination_program->type == json_none) ? -1 : (int)destination_program->u.integer; - fontex->dbank = (destination_bank->type == json_none) ? 0 : (int)destination_bank->u.integer; - fontex->dbanklsb = channel; - *out++ = *fontex; - } -} - -static sflist_presets * sflist_process(const json_value * sflist, const char * base_path, char * error_buf) -{ -#ifdef _WIN32 - wchar_t path16[32768]; -#endif - char path_temp[32768]; - const char * base_path_end = base_path + strlen(base_path) - 1; - unsigned int presets_to_allocate = 0; - sflist_presets * rval = calloc(1, sizeof(sflist_presets)); - json_value * arr; - unsigned int i, j, k, l, preset_number; - HSOUNDFONT hfont = 0; - BASS_MIDI_FONTEX fontex; - - if (!rval) - { - strcpy(error_buf, "Out of memory"); - goto error; - } - - if (sflist->type != json_object || sflist->u.object.length != 1 || - strcmp(sflist->u.object.values[0].name, "soundFonts")) - { - if (sflist->type != json_object) - strcpy(error_buf, "Base JSON item is not an object"); - else if (sflist->u.object.length != 1) - sprintf(error_buf, "Base JSON object contains unexpected number of items (wanted 1, got %u)", sflist->u.object.length); - else - sprintf(error_buf, "Base JSON object contains '%s' object instead of 'soundFonts'", sflist->u.object.values[0].name); - goto error; - } - - arr = sflist->u.object.values[0].value; - - if (arr->type != json_array) - { - strcpy(error_buf, "JSON 'soundFonts' object is not an array"); - goto error; - } - - for (i = 0, j = arr->u.array.length; i < j; ++i) { - const json_value * obj = arr->u.array.values[i]; - const json_value * path = 0; - const json_value * gain = 0; - const json_value * channels = 0; - const json_value * patchMappings = 0; - unsigned int patches_needed = 1; - if (obj->type != json_object) { - sprintf(error_buf, "soundFont item #%u is not an object", i + 1); - goto error; - } - path = json_object_item(obj, "fileName"); - gain = json_object_item(obj, "gain"); - channels = json_object_item(obj, "channels"); - patchMappings = json_object_item(obj, "patchMappings"); - if (path->type == json_none) { - sprintf(error_buf, "soundFont item #%u has no 'fileName'", i + 1); - goto error; - } - if (path->type != json_string) { - sprintf(error_buf, "soundFont item #%u 'fileName' is not a string", i + 1); - goto error; - } - if (gain->type != json_none && gain->type != json_integer && gain->type != json_double) { - sprintf(error_buf, "soundFont item #%u has an invalid gain value", i + 1); - goto error; - } - if (channels->type != json_none) { - if (channels->type != json_array) { - sprintf(error_buf, "soundFont item #%u 'channels' is not an array", i + 1); - goto error; - } - for (k = 0, l = channels->u.array.length; k < l; ++k) { - json_value * channel = channels->u.array.values[k]; - if (channel->type != json_integer) { - sprintf(error_buf, "soundFont item #%u 'channels' #%u is not an integer", i + 1, k + 1); - goto error; - } - if (channel->u.integer < 1 || channel->u.integer > 48) { - sprintf(error_buf, "soundFont item #%u 'channels' #%u is out of range (wanted 1-48, got %" PRId64 ")", i + 1, k + 1, channel->u.integer); - goto error; - } - } - patches_needed = l; - } - if (patchMappings->type != json_none) { - if (patchMappings->type != json_array) { - sprintf(error_buf, "soundFont item #%u 'patchMappings' is not an array", i + 1); - goto error; - } - for (k = 0, l = patchMappings->u.array.length; k < l; ++k) { - unsigned int m, n; - unsigned int source_found = 0; - unsigned int destination_found = 0; - json_value * mapping = patchMappings->u.array.values[k]; - if (mapping->type != json_object) { - sprintf(error_buf, "soundFont item #%u 'patchMappings' #%u is not an object", i + 1, k + 1); - goto error; - } - for (m = 0, n = mapping->u.object.length; m < n; ++m) { - unsigned int o, p; - json_value * item = mapping->u.object.values[m].value; - const char * name = mapping->u.object.values[m].name; - unsigned int bank_found = 0; - unsigned int program_found = 0; - if (strcmp(name, "source") && strcmp(name, "destination")) { - sprintf(error_buf, "soundFont item #%u 'patchMappings' #%u contains an invalid '%s' field", i + 1, k + 1, name); - goto error; - } - if (item->type != json_object) { - sprintf(error_buf, "soundFont item #%u 'patchMappings' #%u '%s' is not an object", i + 1, k + 1, name); - goto error; - } - if (!strcmp(name, "source")) - ++source_found; - else - ++destination_found; - for (o = 0, p = item->u.object.length; o < p; ++o) { - int range_min = 0; - int range_max = 128; - json_value * item2 = item->u.object.values[o].value; - const char * name2 = item->u.object.values[o].name; - if (strcmp(name2, "bank") && strcmp(name2, "program")) { - sprintf(error_buf, "soundFont item #%u 'patchMappings' #%u '%s' contains an invalid '%s' field", i + 1, k + 1, name, name2); - goto error; - } - if (item2->type != json_integer) { - sprintf(error_buf, "soundFont item #%u 'patchMappings' #%u '%s' '%s' is not an integer", i + 1, k + 1, name, name2); - } - if (!strcmp(name2, "program")) { - if (!strcmp(name, "destination")) - range_max = 65535; - else - range_max = 127; - } - if (item2->u.integer < range_min || item2->u.integer > range_max) { - sprintf(error_buf, "soundFont item #%u 'patchMappings' #%u '%s' '%s' is out of range (expected %d-%d, got %" PRId64 ")", i + 1, k + 1, name, name2, range_min, range_max, item->u.integer); - goto error; - } - if (!strcmp(name2, "bank")) - ++bank_found; - else - ++program_found; - } - if (!bank_found && !program_found) { - sprintf(error_buf, "soundFont item #%u 'patchMappings' #%u '%s' contains no 'bank' or 'program'", i + 1, k + 1, name); - goto error; - } - if (bank_found > 1) { - sprintf(error_buf, "soundFont item #%u 'patchMappings' #%u '%s' contains more than one 'bank'", i + 1, k + 1, name); - goto error; - } - if (program_found > 1) { - sprintf(error_buf, "soundFont item #%u 'patchMappings' #%u '%s' contains more than one 'program'", i + 1, k + 1, name); - goto error; - } - } - if (!destination_found) { - sprintf(error_buf, "soundFont item #%u 'patchMappings' #%u is missing 'destination'", i + 1, k + 1); - goto error; - } - if (destination_found > 1) { - sprintf(error_buf, "soundFont item #%u 'patchMappings' #%u contains more than one 'destination'", i + 1, k + 1); - goto error; - } - if (source_found > 1) { - sprintf(error_buf, "soundFont item #%u 'patchMappings' #%u contains more than one 'source'", i + 1, k + 1); - } - } - patches_needed *= l; - } - presets_to_allocate += patches_needed; - } - - rval->count = presets_to_allocate; - rval->presets = calloc(sizeof(BASS_MIDI_FONTEX), rval->count); - - if (!rval->presets) { - strcpy(error_buf, "Out of memory"); - goto error; - } - - preset_number = 0; - - for (i = arr->u.array.length, j = 0; i--; ++j) { - const json_value * obj = arr->u.array.values[i]; - const json_value * path = json_object_item(obj, "fileName"); - const json_value * gain = json_object_item(obj, "gain"); - const json_value * channels = json_object_item(obj, "channels"); - const json_value * patchMappings = json_object_item(obj, "patchMappings"); - const void * bass_path; - const char * path_ptr = path->u.string.ptr; - unsigned int bass_flags = 0; -#ifdef _WIN32 - if (!(isalpha(*path_ptr) && path_ptr[1] == ':')) { - if (strlen(path_ptr) + (base_path_end - base_path + 2) > 32767) { - strcpy(error_buf, "Base path plus SoundFont relative path is longer than 32767 characters"); - goto error; - } - strcpy(path_temp, base_path); - if (*base_path_end != '\\' && *base_path_end != '/') - strcat(path_temp, "\\"); - strcat(path_temp, path_ptr); - path_ptr = path_temp; - } - MultiByteToWideChar(CP_UTF8, 0, path_ptr, -1, path16, 32767); - path16[32767] = '\0'; - bass_path = (void *) path16; - bass_flags = BASS_UNICODE; -#else - if (*path_ptr != '/') { - if (strlen(path_ptr) + (base_path_end - base_path + 2) > 32767) { - strcpy(error_buf, "Base path plus SoundFont relative path is longer than 32767 characters"); - goto error; - } - strcpy(path_temp, base_path); - if (*base_path_end != '/') - strcat(path_temp, "/"); - strcat(path_temp, path_ptr); - path_ptr = path_temp; - } - bass_path = (void *) path_ptr; -#endif - hfont = BASS_MIDI_FontInit(bass_path, bass_flags); - if (!hfont) { - int error_code = BASS_ErrorGetCode(); - if (error_code == BASS_ERROR_FILEOPEN) { - sprintf(error_buf, "Could not open SoundFont bank '%s'", path->u.string.ptr); - goto error; - } - else if (error_code == BASS_ERROR_FILEFORM) { - sprintf(error_buf, "SoundFont bank '%s' is not a supported format", path->u.string.ptr); - goto error; - } - else { - sprintf(error_buf, "SoundFont bank '%s' failed to load with error #%u", path->u.string.ptr, error_code); - goto error; - } - } - if (gain->type != json_none) { - double gain_value = 0.0; - if (gain->type == json_integer) { - gain_value = (double)gain->u.integer; - } - else if (gain->type == json_double) { - gain_value = gain->u.dbl; - } - gain_value = pow(10.0, gain_value / 20.0); - BASS_MIDI_FontSetVolume(hfont, gain_value); - } - fontex.font = hfont; - fontex.spreset = -1; - fontex.sbank = -1; - fontex.dpreset = -1; - fontex.dbank = 0; - fontex.dbanklsb = 0; - /* Simplest case, whole bank loading */ - if (channels->type == json_none && patchMappings->type == json_none) { - rval->presets[preset_number++] = fontex; - } - else if (patchMappings->type == json_none) { - for (k = 0, l = channels->u.array.length; k < l; ++k) { - fontex.dbanklsb = (int)channels->u.array.values[k]->u.integer; - rval->presets[preset_number++] = fontex; - } - } - else if (channels->type == json_none) { - sflist_process_patchmappings(rval->presets + preset_number, &fontex, patchMappings, 0); - preset_number += patchMappings->u.array.length; - } - else { - for (k = 0, l = channels->u.array.length; k < l; ++k) { - sflist_process_patchmappings(rval->presets + preset_number, &fontex, patchMappings, (int)channels->u.array.values[k]->u.integer); - preset_number += patchMappings->u.array.length; - } - } - } - - return rval; - -error: - if (hfont) { - BASS_MIDI_FontFree(hfont); - } - if (rval) { - sflist_free(rval); - } - return 0; -} - -static int strpbrkn_all(const char * str, size_t size, const char * chrs) -{ - const char * end = str + size; - - while (str < end && *chrs) { - while (str < end && *str != *chrs) ++str; - ++str, ++chrs; - } - - return str < end; -} - -sflist_presets * sflist_load(const char * sflist, size_t size, const char * base_path, char * error) -{ - sflist_presets * rval; - - json_value * list = 0; - - /* Handle Unicode byte order markers */ - if (size >= 2) { - if ((sflist[0] == 0xFF && sflist[1] == 0xFE) || - (sflist[0] == 0xFE && sflist[1] == 0xFF)) { - strcpy(error, "UTF-16 encoding is not supported at this time"); - return 0; - } - if (size >= 3 && sflist[0] == 0xEF && - sflist[1] == 0xBB && sflist[2] == 0xBF) { - sflist += 3; - size -= 3; - } - } - - list = sflist_load_v2(sflist, size, error); - - if (!list) { - if (!strpbrkn_all(sflist, size, "{[]}")) - list = sflist_load_v1(sflist, size, error); - } - - if (!list) { - return 0; - } - - rval = sflist_process(list, base_path, error); - - json_builder_free(list); - - return rval; -} - -void sflist_free(sflist_presets *presetlist) -{ - if (presetlist) { - if (presetlist->presets) { - unsigned int i, j; - for (i = 0, j = presetlist->count; i < j; ++i) { - HSOUNDFONT hfont = presetlist->presets[i].font; - if (hfont) { - BASS_MIDI_FontFree(hfont); - } - } - free(presetlist->presets); - } - free(presetlist); - } -} - -const char * sflist_upgrade(const char * sflist, size_t size, char * error_buf) -{ - char * rval = 0; - - json_value * list = 0; - - size_t length = 0; - - const json_serialize_opts opts = - { - json_serialize_mode_multiline, - 0, - 3 /* indent_size */ - }; - - list = sflist_load_v2(sflist, size, error_buf); - - if (!list) { - if (!strpbrkn_all(sflist, size, "{[]}")) - list = sflist_load_v1(sflist, size, error_buf); - } - - if (!list) { - return 0; - } - - length = json_measure_ex( list, opts ); - - rval = (char *) malloc( length + 1 ); - - if (!rval) { - strcpy(error_buf, "Out of memory"); - goto error; - } - - json_serialize_ex( rval, list, opts ); - - json_builder_free( list ); - - rval[ length ] = '\0'; - - return (const char *) rval; - -error: - if ( list ) { - json_builder_free( list ); - } - return 0; -} - -void sflist_upgrade_free(const char *ptr) -{ - free( (void *) ptr ); -} - diff --git a/ThirdParty/BASS/sflist.h b/ThirdParty/BASS/sflist.h deleted file mode 100644 index 6be7a87dd..000000000 --- a/ThirdParty/BASS/sflist.h +++ /dev/null @@ -1,62 +0,0 @@ -/* vim: set et ts=3 sw=3 sts=3 ft=c: - * - * Copyright (C) 2021 Christopher Snowhill. All rights reserved. - * https://github.com/kode54/sflist - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _SFLIST_H -#define _SFLIST_H - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct sflist_presets -{ - unsigned int count; - BASS_MIDI_FONTEX * presets; -} sflist_presets; - -#define sflist_max_error 1024 - -sflist_presets * sflist_load(const char * sflist, size_t size, const char * base_path, char * error); -void sflist_free(sflist_presets *); - -const char * sflist_upgrade(const char * sflist, size_t size, char * error); -void sflist_upgrade_free(const char *); - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/ThirdParty/BASS/sflist_rewrite.c b/ThirdParty/BASS/sflist_rewrite.c deleted file mode 100644 index 2623e73fd..000000000 --- a/ThirdParty/BASS/sflist_rewrite.c +++ /dev/null @@ -1,93 +0,0 @@ -/* vim: set et ts=3 sw=3 sts=3 ft=c: - * - * Copyright (C) 2021 Christopher Snowhill. All rights reserved. - * https://github.com/kode54/sflist - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#include -#include -#include - -#include "sflist.h" - -int main(int argc, const char ** argv) -{ - char error[sflist_max_error]; - char path_temp[32768]; - int i; - FILE *f; - size_t length; - char * in; - const char * out; - - for (i = 1; i < argc; ++i) { - const char * end = argv[i] + strlen(argv[i]); - if (((end - argv[i]) >= 5) && !strcmp(&end[-5], ".json")) continue; - strcpy(path_temp, argv[i]); - strcat(path_temp, ".json"); - f = fopen(argv[i], "r"); - fseek(f, 0, SEEK_END); - length = ftell(f); - fseek(f, 0, SEEK_SET); - in = malloc(length + 1); - if (!in) { - fclose(f); - fputs("Out of memory.\n", stderr); - return 1; - } - if (fread(in, length, 1, f) != 1) { - free(in); - fclose(f); - fprintf(stderr, "Cannot read all of file '%s'.\n", argv[i]); - return 1; - } - fclose(f); - in[length] = '\0'; - out = sflist_upgrade(in, length, error); - free(in); - if (!out) { - fprintf(stderr, "Error processing '%s': %s\n", argv[i], error); - return 1; - } - f = fopen(path_temp, "w"); - if (!f) { - sflist_upgrade_free(out); - fprintf(stderr, "Unable to open output file '%s'.\n", path_temp); - return 1; - } - if (fwrite(out, strlen(out), 1, f) != 1) { - fclose(f); - sflist_upgrade_free(out); - fprintf(stderr, "Unable to write to output file '%s'.\n", path_temp); - return 1; - } - fclose(f); - sflist_upgrade_free(out); - } - - return 0; -} diff --git a/ThirdParty/FluidSynth/README.txt b/ThirdParty/FluidSynth/README.txt new file mode 100644 index 000000000..da0c93412 --- /dev/null +++ b/ThirdParty/FluidSynth/README.txt @@ -0,0 +1,15 @@ +These binaries were carefully retrieved from Homebrew for both x86_64 +and arm64, their signatures were removed, then their id and import +paths were patched using install_name_tool. + +The following versions are included as of this commit: + +flac: 1.3.3 +glib: 2.68.1 +libogg: 1.3.4 +libvorbis: 1.3.7 +opus: 1.3.1 +pcre: 8.44 +readline: 8.1 +libsndfile: 1.0.31 +portaudio: HEAD-aa05346 \ No newline at end of file diff --git a/ThirdParty/FluidSynth/include/fluidsynth.h b/ThirdParty/FluidSynth/include/fluidsynth.h new file mode 100644 index 000000000..1ea422fe9 --- /dev/null +++ b/ThirdParty/FluidSynth/include/fluidsynth.h @@ -0,0 +1,118 @@ +/* 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 + +#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(__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 */ diff --git a/ThirdParty/FluidSynth/include/fluidsynth/audio.h b/ThirdParty/FluidSynth/include/fluidsynth/audio.h new file mode 100644 index 000000000..eba327ce4 --- /dev/null +++ b/ThirdParty/FluidSynth/include/fluidsynth/audio.h @@ -0,0 +1,84 @@ +/* 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 + +/** + * @file audio.h + * @brief Functions for audio driver output. + * @defgroup AudioFunctions Functions for audio output + * + * 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. 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). + * For further details please refer to fluid_synth_process(). + * @note Whereas fluid_synth_process() allows aliasing buffers, there is the guarentee 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 accidentially to the same buffer multiple times. + * @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. + */ +typedef int (*fluid_audio_func_t)(void *data, int len, + int nfx, float *fx[], + int nout, float *out[]); + +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); + +FLUIDSYNTH_API fluid_file_renderer_t *new_fluid_file_renderer(fluid_synth_t *synth); +FLUIDSYNTH_API int fluid_file_renderer_process_block(fluid_file_renderer_t *dev); +FLUIDSYNTH_API void delete_fluid_file_renderer(fluid_file_renderer_t *dev); +FLUIDSYNTH_API int fluid_file_set_encoding_quality(fluid_file_renderer_t *dev, double q); + +FLUIDSYNTH_API int fluid_audio_driver_register(const char **adrivers); + +#ifdef __cplusplus +} +#endif + +#endif /* _FLUIDSYNTH_AUDIO_H */ diff --git a/ThirdParty/FluidSynth/include/fluidsynth/event.h b/ThirdParty/FluidSynth/include/fluidsynth/event.h new file mode 100644 index 000000000..8f5269d2c --- /dev/null +++ b/ThirdParty/FluidSynth/include/fluidsynth/event.h @@ -0,0 +1,138 @@ +/* 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 + +/** + * @file event.h + * @brief Sequencer event functions and defines. + * + * Functions and constants for creating/processing 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_ANYCONTROLCHANGE, /**< Any control change message (only internally used for remove_events) */ + 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 */ +#ifndef __DOXYGEN__ + 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! */ +#endif +}; + +/* Event alloc/free */ +FLUIDSYNTH_API fluid_event_t *new_fluid_event(void); +FLUIDSYNTH_API void delete_fluid_event(fluid_event_t *evt); + +/* 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, short 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, short 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, short val); +FLUIDSYNTH_API void fluid_event_modulation(fluid_event_t *evt, int channel, short val); +FLUIDSYNTH_API void fluid_event_sustain(fluid_event_t *evt, int channel, short val); +FLUIDSYNTH_API void fluid_event_pan(fluid_event_t *evt, int channel, short val); +FLUIDSYNTH_API void fluid_event_volume(fluid_event_t *evt, int channel, short val); +FLUIDSYNTH_API void fluid_event_reverb_send(fluid_event_t *evt, int channel, short val); +FLUIDSYNTH_API void fluid_event_chorus_send(fluid_event_t *evt, int channel, short val); + +FLUIDSYNTH_API void fluid_event_key_pressure(fluid_event_t *evt, int channel, short key, short val); +FLUIDSYNTH_API void fluid_event_channel_pressure(fluid_event_t *evt, int channel, short val); +FLUIDSYNTH_API void fluid_event_system_reset(fluid_event_t *evt); + + +/* Only for removing events */ +FLUID_DEPRECATED FLUIDSYNTH_API void fluid_event_any_control_change(fluid_event_t *evt, int channel); + +/* Only when unregistering clients */ +FLUIDSYNTH_API void fluid_event_unregistering(fluid_event_t *evt); + +/* 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 short fluid_event_get_value(fluid_event_t *evt); +FLUIDSYNTH_API short 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 unsigned int fluid_event_get_sfont_id(fluid_event_t *evt); + +#ifdef __cplusplus +} +#endif +#endif /* _FLUIDSYNTH_EVENT_H */ diff --git a/ThirdParty/FluidSynth/include/fluidsynth/gen.h b/ThirdParty/FluidSynth/include/fluidsynth/gen.h new file mode 100644 index 000000000..1f46fe2a9 --- /dev/null +++ b/ThirdParty/FluidSynth/include/fluidsynth/gen.h @@ -0,0 +1,130 @@ +/* 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 + +/** + * @file gen.h + * @brief 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 */ + + /** + * @brief 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 */ + +#ifndef __DOXYGEN__ + 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! */ +#endif +}; + + +#ifdef __cplusplus +} +#endif +#endif /* _FLUIDSYNTH_GEN_H */ + diff --git a/ThirdParty/FluidSynth/include/fluidsynth/ladspa.h b/ThirdParty/FluidSynth/include/fluidsynth/ladspa.h new file mode 100644 index 000000000..4752a8930 --- /dev/null +++ b/ThirdParty/FluidSynth/include/fluidsynth/ladspa.h @@ -0,0 +1,65 @@ +/* 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 + +/** + * @file ladspa.h + * @brief Functions for manipulating 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 */ + diff --git a/ThirdParty/FluidSynth/include/fluidsynth/log.h b/ThirdParty/FluidSynth/include/fluidsynth/log.h new file mode 100644 index 000000000..3ea74b261 --- /dev/null +++ b/ThirdParty/FluidSynth/include/fluidsynth/log.h @@ -0,0 +1,91 @@ +/* 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 + + +/** + * @file log.h + * @brief 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 + */ + +/** + * 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 */ +#ifndef __DOXYGEN__ + LAST_LOG_LEVEL /**< @warning This symbol is not part of the public API and ABI stability guarantee and may change at any time! */ +#endif +}; + +/** + * 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 */ diff --git a/ThirdParty/FluidSynth/include/fluidsynth/midi.h b/ThirdParty/FluidSynth/include/fluidsynth/midi.h new file mode 100644 index 000000000..9ddeef054 --- /dev/null +++ b/ThirdParty/FluidSynth/include/fluidsynth/midi.h @@ -0,0 +1,159 @@ +/* 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 + +/** + * @file midi.h + * @brief Functions for MIDI events, drivers and MIDI file playback. + */ + +FLUIDSYNTH_API fluid_midi_event_t *new_fluid_midi_event(void); +FLUIDSYNTH_API void delete_fluid_midi_event(fluid_midi_event_t *event); + +FLUIDSYNTH_API int fluid_midi_event_set_type(fluid_midi_event_t *evt, int type); +FLUIDSYNTH_API int fluid_midi_event_get_type(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(fluid_midi_event_t *evt); +FLUIDSYNTH_API int fluid_midi_event_get_key(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(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(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(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(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(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); + +/** + * 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 */ +#ifndef __DOXYGEN__ + FLUID_MIDI_ROUTER_RULE_COUNT /**< @internal Total count of rule types @warning This symbol is not part of the public API and ABI stability guarantee and may change at any time!*/ +#endif +} fluid_midi_router_rule_type; + +/** + * Generic callback function for MIDI events. + * @param data User defined data pointer + * @param event The MIDI event + * @return Should return #FLUID_OK on success, #FLUID_FAILED otherwise + * + * Will be used between + * - MIDI driver and MIDI router + * - MIDI router and synth + * to communicate events. + * In the not-so-far future... + */ +typedef int (*handle_midi_event_func_t)(void *data, fluid_midi_event_t *event); + +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); +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); +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); +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); + + +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); + + +/** + * MIDI 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_DONE /**< Player is finished playing */ +}; + +FLUIDSYNTH_API fluid_player_t *new_fluid_player(fluid_synth_t *synth); +FLUIDSYNTH_API void delete_fluid_player(fluid_player_t *player); +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_midi_tempo(fluid_player_t *player, int tempo); +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_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_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 */ diff --git a/ThirdParty/FluidSynth/include/fluidsynth/misc.h b/ThirdParty/FluidSynth/include/fluidsynth/misc.h new file mode 100644 index 000000000..e2f5d3f8b --- /dev/null +++ b/ThirdParty/FluidSynth/include/fluidsynth/misc.h @@ -0,0 +1,72 @@ +/* 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 + + +/** + * @file misc.h + * @brief Miscellaneous utility functions and defines + */ + +/** + * Value that indicates success, used by most libfluidsynth functions. + * @since 1.1.0 + * + * @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 + * + * #ifndef FLUID_OK + * #define FLUID_OK (0) + * #define FLUID_FAILED (-1) + * #endif + * @endcode + */ +#define FLUID_OK (0) + +/** + * Value that indicates failure, used by most libfluidsynth functions. + * @since 1.1.0 + * + * @note See #FLUID_OK for more details. + */ +#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 */ diff --git a/ThirdParty/FluidSynth/include/fluidsynth/mod.h b/ThirdParty/FluidSynth/include/fluidsynth/mod.h new file mode 100644 index 000000000..5ea5f89d4 --- /dev/null +++ b/ThirdParty/FluidSynth/include/fluidsynth/mod.h @@ -0,0 +1,98 @@ +/* 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 + +/** + * @file mod.h + * @brief 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 */ +}; + +/** + * 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 */ +}; + +FLUIDSYNTH_API fluid_mod_t *new_fluid_mod(void); +FLUIDSYNTH_API void delete_fluid_mod(fluid_mod_t *mod); +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 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_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 */ + diff --git a/ThirdParty/FluidSynth/include/fluidsynth/seq.h b/ThirdParty/FluidSynth/include/fluidsynth/seq.h new file mode 100644 index 000000000..846c7f48e --- /dev/null +++ b/ThirdParty/FluidSynth/include/fluidsynth/seq.h @@ -0,0 +1,71 @@ +/* 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 + +/** + * @file seq.h + * @brief MIDI event sequencer. + */ + +/** + * 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 + */ +typedef void (*fluid_event_callback_t)(unsigned int time, fluid_event_t *event, + fluid_sequencer_t *seq, void *data); + + +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); +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 */ diff --git a/ThirdParty/FluidSynth/include/fluidsynth/seqbind.h b/ThirdParty/FluidSynth/include/fluidsynth/seqbind.h new file mode 100644 index 000000000..638595661 --- /dev/null +++ b/ThirdParty/FluidSynth/include/fluidsynth/seqbind.h @@ -0,0 +1,45 @@ +/* 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 + +/** + * @file seqbind.h + * @brief Functions for binding sequencer objects to other subsystems. + */ + +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 */ + diff --git a/ThirdParty/FluidSynth/include/fluidsynth/settings.h b/ThirdParty/FluidSynth/include/fluidsynth/settings.h new file mode 100644 index 000000000..aa7f08312 --- /dev/null +++ b/ThirdParty/FluidSynth/include/fluidsynth/settings.h @@ -0,0 +1,188 @@ +/* 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 + +/** + * @file settings.h + * @brief Synthesizer settings + * @defgroup SettingsFunctions 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 + * @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 */ +}; + + +FLUIDSYNTH_API fluid_settings_t *new_fluid_settings(void); +FLUIDSYNTH_API void delete_fluid_settings(fluid_settings_t *settings); + +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 */ diff --git a/ThirdParty/FluidSynth/include/fluidsynth/sfont.h b/ThirdParty/FluidSynth/include/fluidsynth/sfont.h new file mode 100644 index 000000000..3b9e7ae74 --- /dev/null +++ b/ThirdParty/FluidSynth/include/fluidsynth/sfont.h @@ -0,0 +1,316 @@ +/* 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 + + +/** + * @file sfont.h + * @brief SoundFont plugins + * + * 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 */ +}; + +/** + * 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. 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. + * @param loader SoundFont loader + */ +typedef void (*fluid_sfloader_free_t)(fluid_sfloader_t *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); + +/** + * Opens the file or memory indicated by \c filename in binary read mode. + * \c filename matches the string provided during the fluid_synth_sfload() call. + * + * @return returns a file handle on success, NULL otherwise + */ +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, int 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, long 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 long (* 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. 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. + * @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. + */ +typedef int (*fluid_sfont_free_t)(fluid_sfont_t *sfont); + + +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); + +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. 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. + * @param preset Virtual SoundFont preset + * @return Should return 0 + */ +typedef void (*fluid_preset_free_t)(fluid_preset_t *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); + +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); + +FLUIDSYNTH_API fluid_sample_t *new_fluid_sample(void); +FLUIDSYNTH_API void delete_fluid_sample(fluid_sample_t *sample); +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 */ diff --git a/ThirdParty/FluidSynth/include/fluidsynth/shell.h b/ThirdParty/FluidSynth/include/fluidsynth/shell.h new file mode 100644 index 000000000..f9c17e0fe --- /dev/null +++ b/ThirdParty/FluidSynth/include/fluidsynth/shell.h @@ -0,0 +1,97 @@ +/* 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 + + +/** + * @file shell.h + * @brief Command shell interface + * + * The shell interface allows you to send simple textual commands to + * the synthesizer, to parse a command file, or to read commands + * from the stdin or other input streams. + */ + +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); + + +/* The command handler */ + +FLUIDSYNTH_API +fluid_cmd_handler_t *new_fluid_cmd_handler(fluid_synth_t *synth, fluid_midi_router_t *router); + +FLUIDSYNTH_API +void delete_fluid_cmd_handler(fluid_cmd_handler_t *handler); + +FLUIDSYNTH_API +void fluid_cmd_handler_set_synth(fluid_cmd_handler_t *handler, fluid_synth_t *synth); + + + +/* Command function */ + +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); + +FLUIDSYNTH_API +void fluid_usershell(fluid_settings_t *settings, fluid_cmd_handler_t *handler); + + +/* 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 delete_fluid_shell(fluid_shell_t *shell); + + + +/* TCP/IP server */ + + +FLUIDSYNTH_API +fluid_server_t *new_fluid_server(fluid_settings_t *settings, + fluid_synth_t *synth, fluid_midi_router_t *router); + +FLUIDSYNTH_API void delete_fluid_server(fluid_server_t *server); + +FLUIDSYNTH_API int fluid_server_join(fluid_server_t *server); + + +#ifdef __cplusplus +} +#endif + +#endif /* _FLUIDSYNTH_SHELL_H */ diff --git a/ThirdParty/FluidSynth/include/fluidsynth/synth.h b/ThirdParty/FluidSynth/include/fluidsynth/synth.h new file mode 100644 index 000000000..ef7f4e2a1 --- /dev/null +++ b/ThirdParty/FluidSynth/include/fluidsynth/synth.h @@ -0,0 +1,397 @@ +/* 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 + + +/** + * @file synth.h + * @brief Embeddable 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(), ... + */ + + +FLUIDSYNTH_API fluid_synth_t *new_fluid_synth(fluid_settings_t *settings); +FLUIDSYNTH_API void delete_fluid_synth(fluid_synth_t *synth); +FLUIDSYNTH_API fluid_settings_t *fluid_synth_get_settings(fluid_synth_t *synth); + +/* MIDI channel messages */ + +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); + +/** + * 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); + + +/* Low level access */ +FLUIDSYNTH_API fluid_preset_t *fluid_synth_get_channel_preset(fluid_synth_t *synth, int chan); +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); + + +/* SoundFont management */ + +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); + + +/* Reverb */ + + +FLUIDSYNTH_API int fluid_synth_set_reverb(fluid_synth_t *synth, double roomsize, + double damping, double width, double level); +FLUIDSYNTH_API int fluid_synth_set_reverb_roomsize(fluid_synth_t *synth, double roomsize); +FLUIDSYNTH_API int fluid_synth_set_reverb_damp(fluid_synth_t *synth, double damping); +FLUIDSYNTH_API int fluid_synth_set_reverb_width(fluid_synth_t *synth, double width); +FLUIDSYNTH_API int fluid_synth_set_reverb_level(fluid_synth_t *synth, double level); + +FLUIDSYNTH_API void fluid_synth_set_reverb_on(fluid_synth_t *synth, int on); +FLUIDSYNTH_API double fluid_synth_get_reverb_roomsize(fluid_synth_t *synth); +FLUIDSYNTH_API double fluid_synth_get_reverb_damp(fluid_synth_t *synth); +FLUIDSYNTH_API double fluid_synth_get_reverb_level(fluid_synth_t *synth); +FLUIDSYNTH_API double fluid_synth_get_reverb_width(fluid_synth_t *synth); + + +/* Chorus */ + +/** + * 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 */ +}; + +FLUIDSYNTH_API int fluid_synth_set_chorus(fluid_synth_t *synth, int nr, double level, + double speed, double depth_ms, int type); +FLUIDSYNTH_API int fluid_synth_set_chorus_nr(fluid_synth_t *synth, int nr); +FLUIDSYNTH_API int fluid_synth_set_chorus_level(fluid_synth_t *synth, double level); +FLUIDSYNTH_API int fluid_synth_set_chorus_speed(fluid_synth_t *synth, double speed); +FLUIDSYNTH_API int fluid_synth_set_chorus_depth(fluid_synth_t *synth, double depth_ms); +FLUIDSYNTH_API int fluid_synth_set_chorus_type(fluid_synth_t *synth, int type); + +FLUIDSYNTH_API void fluid_synth_set_chorus_on(fluid_synth_t *synth, int on); +FLUIDSYNTH_API int fluid_synth_get_chorus_nr(fluid_synth_t *synth); +FLUIDSYNTH_API double fluid_synth_get_chorus_level(fluid_synth_t *synth); +FLUIDSYNTH_API double fluid_synth_get_chorus_speed(fluid_synth_t *synth); +FLUIDSYNTH_API double fluid_synth_get_chorus_depth(fluid_synth_t *synth); +FLUIDSYNTH_API int fluid_synth_get_chorus_type(fluid_synth_t *synth); /* see fluid_chorus_mod */ + + +/* Audio and MIDI channels */ + +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); + + +/* Synthesis parameters */ + +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, good quality, the default */ + FLUID_INTERP_7THORDER = 7, /**< Seventh-order interpolation */ + + FLUID_INTERP_DEFAULT = FLUID_INTERP_4THORDER, /**< Default interpolation method */ + FLUID_INTERP_HIGHEST = FLUID_INTERP_7THORDER, /**< Highest interpolation method */ +}; + +/* Generator interface */ + +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); + + +/* Tuning */ + +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); + +/* Misc */ + +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); + + +/* Default modulators */ + +/** + * 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); + + +/* + * Synthesizer plugin + * + * To create a synthesizer plugin, create the synthesizer as + * explained above. Once the synthesizer is created you can call + * any of the functions below to get the audio. + */ + +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[]); + + +/* Synthesizer's interface to handle SoundFont loaders */ + +FLUIDSYNTH_API void fluid_synth_add_sfloader(fluid_synth_t *synth, fluid_sfloader_t *loader); +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); +FLUIDSYNTH_API int fluid_synth_handle_midi_event(void *data, fluid_midi_event_t *event); + +/** + * 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); + + +/* LADSPA */ + +FLUIDSYNTH_API fluid_ladspa_fx_t *fluid_synth_get_ladspa_fx(fluid_synth_t *synth); + + +/* API: Poly mono mode */ + +/** Interface to poly/mono mode variables + * + * 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 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 */ +}; + +/** 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); + +/** Interface to mono 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); + +/** Interface to 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 (#fluid_channel_portamento_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_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); + +/* Interface to breath mode */ +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); + + +#ifdef __cplusplus +} +#endif + +#endif /* _FLUIDSYNTH_SYNTH_H */ diff --git a/ThirdParty/FluidSynth/include/fluidsynth/types.h b/ThirdParty/FluidSynth/include/fluidsynth/types.h new file mode 100644 index 000000000..47ef18336 --- /dev/null +++ b/ThirdParty/FluidSynth/include/fluidsynth/types.h @@ -0,0 +1,71 @@ +/* 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 + + +/** + * @file types.h + * @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_ramsfont_t fluid_ramsfont_t; /**< RAM SoundFont */ +typedef struct _fluid_rampreset_t fluid_rampreset_t; /**< RAM SoundFont preset */ +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() */ + +#ifdef __cplusplus +} +#endif + +#endif /* _FLUIDSYNTH_TYPES_H */ diff --git a/ThirdParty/FluidSynth/include/fluidsynth/version.h b/ThirdParty/FluidSynth/include/fluidsynth/version.h new file mode 100644 index 000000000..4f22e3784 --- /dev/null +++ b/ThirdParty/FluidSynth/include/fluidsynth/version.h @@ -0,0 +1,47 @@ +/* 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 + +/** + * @file version.h + * @brief Library version functions and defines + */ + +#define FLUIDSYNTH_VERSION "2.1.8" /**< String constant of libfluidsynth version. */ +#define FLUIDSYNTH_VERSION_MAJOR 2 /**< libfluidsynth major version integer constant. */ +#define FLUIDSYNTH_VERSION_MINOR 1 /**< libfluidsynth minor version integer constant. */ +#define FLUIDSYNTH_VERSION_MICRO 8 /**< 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 */ diff --git a/ThirdParty/FluidSynth/include/fluidsynth/voice.h b/ThirdParty/FluidSynth/include/fluidsynth/voice.h new file mode 100644 index 000000000..f0644718b --- /dev/null +++ b/ThirdParty/FluidSynth/include/fluidsynth/voice.h @@ -0,0 +1,72 @@ +/* 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 + +/** + * @file voice.h + * @brief Synthesis voice manipulation functions. + * + * The interface to the synthesizer's voices. + * Examples on using them can be found in 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 */ + diff --git a/ThirdParty/FluidSynth/libFLAC.8.dylib b/ThirdParty/FluidSynth/libFLAC.8.dylib new file mode 100644 index 000000000..42d1c294e Binary files /dev/null and b/ThirdParty/FluidSynth/libFLAC.8.dylib differ diff --git a/ThirdParty/FluidSynth/libfluidsynth.2.dylib b/ThirdParty/FluidSynth/libfluidsynth.2.dylib new file mode 100644 index 000000000..984133436 Binary files /dev/null and b/ThirdParty/FluidSynth/libfluidsynth.2.dylib differ diff --git a/ThirdParty/FluidSynth/libglib-2.0.0.dylib b/ThirdParty/FluidSynth/libglib-2.0.0.dylib new file mode 100644 index 000000000..0819c9cb5 Binary files /dev/null and b/ThirdParty/FluidSynth/libglib-2.0.0.dylib differ diff --git a/ThirdParty/FluidSynth/libgthread-2.0.0.dylib b/ThirdParty/FluidSynth/libgthread-2.0.0.dylib new file mode 100644 index 000000000..fd231afbf Binary files /dev/null and b/ThirdParty/FluidSynth/libgthread-2.0.0.dylib differ diff --git a/ThirdParty/FluidSynth/libintl.8.dylib b/ThirdParty/FluidSynth/libintl.8.dylib new file mode 100644 index 000000000..6087949be Binary files /dev/null and b/ThirdParty/FluidSynth/libintl.8.dylib differ diff --git a/ThirdParty/BASS/libbass_mpc.dylib b/ThirdParty/FluidSynth/libogg.0.dylib similarity index 50% rename from ThirdParty/BASS/libbass_mpc.dylib rename to ThirdParty/FluidSynth/libogg.0.dylib index 951e03144..971e78e66 100644 Binary files a/ThirdParty/BASS/libbass_mpc.dylib and b/ThirdParty/FluidSynth/libogg.0.dylib differ diff --git a/ThirdParty/FluidSynth/libopus.0.dylib b/ThirdParty/FluidSynth/libopus.0.dylib new file mode 100644 index 000000000..da3a16d1e Binary files /dev/null and b/ThirdParty/FluidSynth/libopus.0.dylib differ diff --git a/ThirdParty/FluidSynth/libpcre.1.dylib b/ThirdParty/FluidSynth/libpcre.1.dylib new file mode 100644 index 000000000..5adaf512b Binary files /dev/null and b/ThirdParty/FluidSynth/libpcre.1.dylib differ diff --git a/ThirdParty/FluidSynth/libportaudio.2.dylib b/ThirdParty/FluidSynth/libportaudio.2.dylib new file mode 100644 index 000000000..742903cd6 Binary files /dev/null and b/ThirdParty/FluidSynth/libportaudio.2.dylib differ diff --git a/ThirdParty/FluidSynth/libreadline.8.dylib b/ThirdParty/FluidSynth/libreadline.8.dylib new file mode 100644 index 000000000..7bce04a35 Binary files /dev/null and b/ThirdParty/FluidSynth/libreadline.8.dylib differ diff --git a/ThirdParty/FluidSynth/libsndfile.1.dylib b/ThirdParty/FluidSynth/libsndfile.1.dylib new file mode 100644 index 000000000..600dbd4cd Binary files /dev/null and b/ThirdParty/FluidSynth/libsndfile.1.dylib differ diff --git a/ThirdParty/FluidSynth/libvorbis.0.dylib b/ThirdParty/FluidSynth/libvorbis.0.dylib new file mode 100644 index 000000000..a2c3bc718 Binary files /dev/null and b/ThirdParty/FluidSynth/libvorbis.0.dylib differ diff --git a/ThirdParty/FluidSynth/libvorbisenc.2.dylib b/ThirdParty/FluidSynth/libvorbisenc.2.dylib new file mode 100644 index 000000000..8b128201a Binary files /dev/null and b/ThirdParty/FluidSynth/libvorbisenc.2.dylib differ