diff --git a/Application/AppController.m b/Application/AppController.m index 9d12e62f2..5e8277632 100644 --- a/Application/AppController.m +++ b/Application/AppController.m @@ -474,15 +474,18 @@ void *kAppControllerContext = &kAppControllerContext; [[NSUserDefaults standardUserDefaults] setValue:feedURLdefault forKey:@"SUFeedURL"]; } - if([[[NSUserDefaults standardUserDefaults] stringForKey:@"midiPlugin"] isEqualToString:@"BASSMIDI"]) { - [[NSUserDefaults standardUserDefaults] setValue:@"FluidSynth" forKey:@"midiPlugin"]; - } - NSString *oldMidiPlugin = [[NSUserDefaults standardUserDefaults] stringForKey:@"midi.plugin"]; if(oldMidiPlugin) { [[NSUserDefaults standardUserDefaults] setValue:oldMidiPlugin forKey:@"midiPlugin"]; [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"midi.plugin"]; } + + // if([[[NSUserDefaults standardUserDefaults] stringForKey:@"midiPlugin"] isEqualToString:@"BASSMIDI"]) { + // [[NSUserDefaults standardUserDefaults] setValue:@"FluidSynth" forKey:@"midiPlugin"]; + // } + if([[[NSUserDefaults standardUserDefaults] stringForKey:@"midiPlugin"] isEqualToString:@"FluidSynth"]) { + [[NSUserDefaults standardUserDefaults] setValue:@"BASSMIDI" forKey:@"midiPlugin"]; + } } /* 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 333863433..8205de127 100644 --- a/Plugins/MIDI/MIDI.xcodeproj/project.pbxproj +++ b/Plugins/MIDI/MIDI.xcodeproj/project.pbxproj @@ -7,16 +7,22 @@ objects = { /* Begin PBXBuildFile section */ - 8309220B2640D0B8005855C1 /* SFPlayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8309220A2640D0B8005855C1 /* SFPlayer.cpp */; }; - 8309220D2640D3CF005855C1 /* libfluidsynth.3.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 830921FB2640CC16005855C1 /* libfluidsynth.3.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; - 830922192640D45D005855C1 /* libfluidsynth.3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 830921FB2640CC16005855C1 /* libfluidsynth.3.dylib */; }; - 8337420C26467870004E43ED /* libFLAC.8.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8337420226467839004E43ED /* libFLAC.8.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; - 8337420E2646787C004E43ED /* libopus.0.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8337420326467839004E43ED /* libopus.0.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; - 8337420F26467888004E43ED /* libogg.0.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8337420426467839004E43ED /* libogg.0.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; - 833742102646788E004E43ED /* libvorbis.0.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8337420526467839004E43ED /* libvorbis.0.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; - 8337421126467893004E43ED /* libsndfile.1.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 830922002640CC16005855C1 /* libsndfile.1.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; - 83374213264678A4004E43ED /* libvorbisenc.2.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8337420626467839004E43ED /* libvorbisenc.2.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 834BE91B1DE407CB00A07DCD /* resampler.c in Sources */ = {isa = PBXBuildFile; fileRef = 834BE9191DE407CB00A07DCD /* resampler.c */; }; + 8356BCC627B352620074E50C /* BMPlayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8356BCC427B352620074E50C /* BMPlayer.cpp */; }; + 8356BCC927B353CB0074E50C /* libbass.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 8356BCC727B353CB0074E50C /* libbass.dylib */; }; + 8356BCCA27B353CB0074E50C /* libbassmidi.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 8356BCC827B353CB0074E50C /* libbassmidi.dylib */; }; + 8356BCCE27B353E30074E50C /* libbassflac.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 8356BCCB27B353E30074E50C /* libbassflac.dylib */; }; + 8356BCCF27B353E30074E50C /* libbassopus.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 8356BCCC27B353E30074E50C /* libbassopus.dylib */; }; + 8356BCD027B353E30074E50C /* libbasswv.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 8356BCCD27B353E30074E50C /* libbasswv.dylib */; }; + 8356BCD127B353F60074E50C /* libbass.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8356BCC727B353CB0074E50C /* libbass.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 8356BCD227B353F90074E50C /* libbassmidi.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8356BCC827B353CB0074E50C /* libbassmidi.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 8356BCD327B353FB0074E50C /* libbassflac.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8356BCCB27B353E30074E50C /* libbassflac.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 8356BCD427B354010074E50C /* libbassopus.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8356BCCC27B353E30074E50C /* libbassopus.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 8356BCD527B354050074E50C /* libbasswv.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8356BCCD27B353E30074E50C /* libbasswv.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 8356BCDA27B357990074E50C /* sflist_rewrite.c in Sources */ = {isa = PBXBuildFile; fileRef = 8356BCD727B357990074E50C /* sflist_rewrite.c */; }; + 8356BCDB27B357990074E50C /* sflist.c in Sources */ = {isa = PBXBuildFile; fileRef = 8356BCD927B357990074E50C /* sflist.c */; }; + 8356BCE127B357D00074E50C /* json.c in Sources */ = {isa = PBXBuildFile; fileRef = 8356BCDD27B357D00074E50C /* json.c */; }; + 8356BCE227B357D00074E50C /* json-builder.c in Sources */ = {isa = PBXBuildFile; fileRef = 8356BCDE27B357D00074E50C /* json-builder.c */; }; 83686AAC1C5C69D400671C7A /* AUPlayerView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 83686AAB1C5C69D400671C7A /* AUPlayerView.mm */; }; 83686AB11C5C783000671C7A /* CoreAudioKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83686AB01C5C783000671C7A /* CoreAudioKit.framework */; }; 8398F2E01C438C7D00EB9639 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8398F2DF1C438C7D00EB9639 /* AudioUnit.framework */; }; @@ -61,6 +67,11 @@ dstSubfolderSpec = 10; files = ( 839CA224180D902100553DBA /* midi_processing.framework in CopyFiles */, + 8356BCD127B353F60074E50C /* libbass.dylib in CopyFiles */, + 8356BCD227B353F90074E50C /* libbassmidi.dylib in CopyFiles */, + 8356BCD327B353FB0074E50C /* libbassflac.dylib in CopyFiles */, + 8356BCD427B354010074E50C /* libbassopus.dylib in CopyFiles */, + 8356BCD527B354050074E50C /* libbasswv.dylib in CopyFiles */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -70,31 +81,29 @@ dstPath = ""; dstSubfolderSpec = 6; files = ( - 8337420C26467870004E43ED /* libFLAC.8.dylib in CopyFiles */, - 8309220D2640D3CF005855C1 /* libfluidsynth.3.dylib in CopyFiles */, - 8337420F26467888004E43ED /* libogg.0.dylib in CopyFiles */, - 8337420E2646787C004E43ED /* libopus.0.dylib in CopyFiles */, - 8337421126467893004E43ED /* libsndfile.1.dylib in CopyFiles */, - 833742102646788E004E43ED /* libvorbis.0.dylib in CopyFiles */, - 83374213264678A4004E43ED /* libvorbisenc.2.dylib in CopyFiles */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 830921FA2640CBBD005855C1 /* SFPlayer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SFPlayer.h; sourceTree = ""; }; - 830921FB2640CC16005855C1 /* libfluidsynth.3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libfluidsynth.3.dylib; path = ../../ThirdParty/FluidSynth/libfluidsynth.3.dylib; sourceTree = ""; }; - 830922002640CC16005855C1 /* libsndfile.1.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsndfile.1.dylib; path = ../../ThirdParty/FluidSynth/libsndfile.1.dylib; sourceTree = ""; }; - 8309220A2640D0B8005855C1 /* SFPlayer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SFPlayer.cpp; sourceTree = ""; }; - 8337420226467839004E43ED /* libFLAC.8.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libFLAC.8.dylib; path = ../../ThirdParty/FluidSynth/libFLAC.8.dylib; sourceTree = ""; }; - 8337420326467839004E43ED /* libopus.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libopus.0.dylib; path = ../../ThirdParty/FluidSynth/libopus.0.dylib; sourceTree = ""; }; - 8337420426467839004E43ED /* libogg.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libogg.0.dylib; path = ../../ThirdParty/FluidSynth/libogg.0.dylib; sourceTree = ""; }; - 8337420526467839004E43ED /* libvorbis.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libvorbis.0.dylib; path = ../../ThirdParty/FluidSynth/libvorbis.0.dylib; sourceTree = ""; }; - 8337420626467839004E43ED /* libvorbisenc.2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libvorbisenc.2.dylib; path = ../../ThirdParty/FluidSynth/libvorbisenc.2.dylib; 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 = ""; }; + 8356BCC427B352620074E50C /* BMPlayer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BMPlayer.cpp; sourceTree = ""; }; + 8356BCC527B352620074E50C /* BMPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BMPlayer.h; sourceTree = ""; }; + 8356BCC727B353CB0074E50C /* libbass.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libbass.dylib; path = ../../ThirdParty/BASS/libbass.dylib; sourceTree = ""; }; + 8356BCC827B353CB0074E50C /* libbassmidi.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libbassmidi.dylib; path = ../../ThirdParty/BASS/libbassmidi.dylib; sourceTree = ""; }; + 8356BCCB27B353E30074E50C /* libbassflac.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libbassflac.dylib; path = ../../ThirdParty/BASS/libbassflac.dylib; sourceTree = ""; }; + 8356BCCC27B353E30074E50C /* libbassopus.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libbassopus.dylib; path = ../../ThirdParty/BASS/libbassopus.dylib; sourceTree = ""; }; + 8356BCCD27B353E30074E50C /* libbasswv.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libbasswv.dylib; path = ../../ThirdParty/BASS/libbasswv.dylib; sourceTree = ""; }; + 8356BCD727B357990074E50C /* sflist_rewrite.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sflist_rewrite.c; path = ../../../../ThirdParty/BASS/sflist_rewrite.c; sourceTree = ""; }; + 8356BCD827B357990074E50C /* sflist.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sflist.h; path = ../../../../ThirdParty/BASS/sflist.h; sourceTree = ""; }; + 8356BCD927B357990074E50C /* sflist.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sflist.c; path = ../../../../ThirdParty/BASS/sflist.c; sourceTree = ""; }; + 8356BCDD27B357D00074E50C /* json.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = json.c; sourceTree = ""; }; + 8356BCDE27B357D00074E50C /* json-builder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "json-builder.c"; sourceTree = ""; }; + 8356BCDF27B357D00074E50C /* json.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = json.h; sourceTree = ""; }; + 8356BCE027B357D00074E50C /* json-builder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "json-builder.h"; sourceTree = ""; }; 835F91BA1EE211820003E186 /* dmxopl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dmxopl.h; sourceTree = ""; }; 83686AAB1C5C69D400671C7A /* AUPlayerView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AUPlayerView.mm; sourceTree = ""; }; 83686AAD1C5C6A2700671C7A /* AUPlayerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AUPlayerView.h; sourceTree = ""; }; @@ -150,15 +159,42 @@ files = ( 8398F2E01C438C7D00EB9639 /* AudioUnit.framework in Frameworks */, 83686AB11C5C783000671C7A /* CoreAudioKit.framework in Frameworks */, + 8356BCCF27B353E30074E50C /* libbassopus.dylib in Frameworks */, 83B06701180D5747008E3612 /* midi_processing.framework in Frameworks */, + 8356BCCE27B353E30074E50C /* libbassflac.dylib in Frameworks */, + 8356BCC927B353CB0074E50C /* libbass.dylib in Frameworks */, + 8356BCCA27B353CB0074E50C /* libbassmidi.dylib in Frameworks */, 83B0668B180D5668008E3612 /* Cocoa.framework in Frameworks */, - 830922192640D45D005855C1 /* libfluidsynth.3.dylib in Frameworks */, + 8356BCD027B353E30074E50C /* libbasswv.dylib in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 8356BCD627B3577E0074E50C /* sflist */ = { + isa = PBXGroup; + children = ( + 8356BCDC27B357D00074E50C /* json */, + 8356BCD727B357990074E50C /* sflist_rewrite.c */, + 8356BCD927B357990074E50C /* sflist.c */, + 8356BCD827B357990074E50C /* sflist.h */, + ); + path = sflist; + sourceTree = ""; + }; + 8356BCDC27B357D00074E50C /* json */ = { + isa = PBXGroup; + children = ( + 8356BCDD27B357D00074E50C /* json.c */, + 8356BCDE27B357D00074E50C /* json-builder.c */, + 8356BCDF27B357D00074E50C /* json.h */, + 8356BCE027B357D00074E50C /* json-builder.h */, + ); + name = json; + path = ../../../../ThirdParty/json; + sourceTree = ""; + }; 83A09F551CFA83F2001E7D2D /* synthlib_doom */ = { isa = PBXGroup; children = ( @@ -237,16 +273,14 @@ 83B0668C180D5668008E3612 /* Other Frameworks */ = { isa = PBXGroup; children = ( + 8356BCC727B353CB0074E50C /* libbass.dylib */, + 8356BCC827B353CB0074E50C /* libbassmidi.dylib */, + 8356BCCB27B353E30074E50C /* libbassflac.dylib */, + 8356BCCC27B353E30074E50C /* libbassopus.dylib */, + 8356BCCD27B353E30074E50C /* libbasswv.dylib */, 83B0668F180D5668008E3612 /* AppKit.framework */, 83B0668E180D5668008E3612 /* CoreData.framework */, 83B0668D180D5668008E3612 /* Foundation.framework */, - 8337420226467839004E43ED /* libFLAC.8.dylib */, - 830921FB2640CC16005855C1 /* libfluidsynth.3.dylib */, - 8337420426467839004E43ED /* libogg.0.dylib */, - 8337420326467839004E43ED /* libopus.0.dylib */, - 830922002640CC16005855C1 /* libsndfile.1.dylib */, - 8337420526467839004E43ED /* libvorbis.0.dylib */, - 8337420626467839004E43ED /* libvorbisenc.2.dylib */, ); name = "Other Frameworks"; sourceTree = ""; @@ -254,8 +288,9 @@ 83B06690180D5668008E3612 /* MIDI */ = { isa = PBXGroup; children = ( - 8309220A2640D0B8005855C1 /* SFPlayer.cpp */, - 830921FA2640CBBD005855C1 /* SFPlayer.h */, + 8356BCD627B3577E0074E50C /* sflist */, + 8356BCC427B352620074E50C /* BMPlayer.cpp */, + 8356BCC527B352620074E50C /* BMPlayer.h */, 83A09F6E1CFA8D6B001E7D2D /* MSPlayer.cpp */, 83A09F6D1CFA8D6B001E7D2D /* MSPlayer.h */, 83A09F661CFA883D001E7D2D /* interface.h */, @@ -391,19 +426,23 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 8356BCC627B352620074E50C /* BMPlayer.cpp in Sources */, + 8356BCE127B357D00074E50C /* json.c in Sources */, 83E973471C4378880007F413 /* AUPlayer.mm in Sources */, 83686AAC1C5C69D400671C7A /* AUPlayerView.mm in Sources */, + 8356BCDA27B357990074E50C /* sflist_rewrite.c in Sources */, 83A09F621CFA83F2001E7D2D /* i_oplmusic.cpp in Sources */, 83B06709180D64DA008E3612 /* MIDIPlayer.cpp in Sources */, 83A09F631CFA83F2001E7D2D /* opl3midi.cpp in Sources */, 83B06722180D70FE008E3612 /* MIDIDecoder.mm in Sources */, 83A09F6F1CFA8D6B001E7D2D /* MSPlayer.cpp in Sources */, 83C35702180EDB74007E9DF0 /* MIDIContainer.mm in Sources */, + 8356BCE227B357D00074E50C /* json-builder.c in Sources */, 83A09F651CFA83F2001E7D2D /* opl3class.cpp in Sources */, 83C35705180EDD1C007E9DF0 /* MIDIMetadataReader.mm in Sources */, 834BE91B1DE407CB00A07DCD /* resampler.c in Sources */, + 8356BCDB27B357990074E50C /* sflist.c in Sources */, 83A09F641CFA83F2001E7D2D /* opl3.cpp in Sources */, - 8309220B2640D0B8005855C1 /* SFPlayer.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -541,14 +580,15 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "MIDI/MIDI-Prefix.pch"; HEADER_SEARCH_PATHS = ( - "$(SRCROOT)/../../ThirdParty/FluidSynth/include", + "$(SRCROOT)/../../ThirdParty/BASS", "$(SRCROOT)/../../ThirdParty/json", ); INFOPLIST_FILE = "MIDI/MIDI-Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles"; + LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", - "$(PROJECT_DIR)/../../ThirdParty/FluidSynth", + "$(PROJECT_DIR)/../../ThirdParty/BASS", ); PRODUCT_BUNDLE_IDENTIFIER = net.kode54.midi; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -569,14 +609,15 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "MIDI/MIDI-Prefix.pch"; HEADER_SEARCH_PATHS = ( - "$(SRCROOT)/../../ThirdParty/FluidSynth/include", + "$(SRCROOT)/../../ThirdParty/BASS", "$(SRCROOT)/../../ThirdParty/json", ); INFOPLIST_FILE = "MIDI/MIDI-Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles"; + LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", - "$(PROJECT_DIR)/../../ThirdParty/FluidSynth", + "$(PROJECT_DIR)/../../ThirdParty/BASS", ); 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 16bece13e..be54cd5bc 100644 --- a/Plugins/MIDI/MIDI/MIDIDecoder.h +++ b/Plugins/MIDI/MIDI/MIDIDecoder.h @@ -13,13 +13,13 @@ #import "Plugin.h" class AUPlayer; -class SFPlayer; +class BMPlayer; @interface MIDIDecoder : NSObject { id source; int track_num; - SFPlayer* sfplayer; + BMPlayer* bmplayer; AUPlayer* auplayer; MIDIPlayer* player; midi_container midi_file; diff --git a/Plugins/MIDI/MIDI/MIDIDecoder.mm b/Plugins/MIDI/MIDI/MIDIDecoder.mm index 41013ff97..9fb4fa21e 100644 --- a/Plugins/MIDI/MIDI/MIDIDecoder.mm +++ b/Plugins/MIDI/MIDI/MIDIDecoder.mm @@ -9,8 +9,8 @@ #import "MIDIDecoder.h" #import "AUPlayer.h" +#import "BMPlayer.h" #import "MSPlayer.h" -#import "SFPlayer.h" #import "Logging.h" @@ -172,32 +172,28 @@ static OSType getOSType(const char *in_) { NSString *plugin = [[NSUserDefaults standardUserDefaults] stringForKey:@"midiPlugin"]; // Then detect if we should force the DLSMusicSynth, which has its own bank - if(!plugin || [plugin isEqualToString:@"FluidSynth"]) { + if(!plugin || [plugin isEqualToString:@"BASSMIDI"]) { if(!globalSoundFontPath || [globalSoundFontPath isEqualToString:@""]) { plugin = @"dls appl"; // Apple DLSMusicSynth if soundfont doesn't exist [[NSUserDefaults standardUserDefaults] setValue:plugin forKey:@"midiPlugin"]; } } - if(!plugin || [plugin isEqualToString:@"FluidSynth"]) { - sfplayer = new SFPlayer; + if(!plugin || [plugin isEqualToString:@"BASSMIDI"]) { + bmplayer = new BMPlayer; - unsigned int resamplingQuality = 0; + bool resamplingSinc = false; NSString *resampling = [[NSUserDefaults standardUserDefaults] stringForKey:@"resampling"]; - if([resampling isEqualToString:@"linear"]) - resamplingQuality = 1; - else if([resampling isEqualToString:@"cubic"]) - resamplingQuality = 4; - else if([resampling isEqualToString:@"sinc"]) - resamplingQuality = 7; + if([resampling isEqualToString:@"sinc"]) + resamplingSinc = true; - sfplayer->setInterpolationMethod(resamplingQuality); - sfplayer->setSampleRate(44100); + bmplayer->setSincInterpolation(resamplingSinc); + bmplayer->setSampleRate(44100); if([soundFontPath length]) - sfplayer->setFileSoundFont([soundFontPath UTF8String]); + bmplayer->setFileSoundFont([soundFontPath UTF8String]); - player = sfplayer; + player = bmplayer; } else if([[plugin substringToIndex:4] isEqualToString:@"DOOM"]) { MSPlayer *msplayer = new MSPlayer; player = msplayer; @@ -269,10 +265,10 @@ static OSType getOSType(const char *in_) { if(!repeatone && framesRead >= localTotalFrames) return 0; - if((sfplayer || auplayer) && !soundFontsAssigned) { + if((bmplayer || auplayer) && !soundFontsAssigned) { if(globalSoundFontPath != nil) { - if(sfplayer) - sfplayer->setSoundFont([globalSoundFontPath UTF8String]); + if(bmplayer) + bmplayer->setSoundFont([globalSoundFontPath UTF8String]); else if(auplayer) auplayer->setSoundFont([globalSoundFontPath UTF8String]); } diff --git a/Preferences/Preferences/MIDIPane.m b/Preferences/Preferences/MIDIPane.m index 4efd36378..b79363900 100644 --- a/Preferences/Preferences/MIDIPane.m +++ b/Preferences/Preferences/MIDIPane.m @@ -21,7 +21,7 @@ } - (IBAction)setSoundFont:(id)sender { - NSArray *fileTypes = @[@"sf3", @"sf2", @"sflist"]; + NSArray *fileTypes = @[@"sf2", @"sf2pack", @"sflist"]; NSOpenPanel *panel = [NSOpenPanel openPanel]; [panel setAllowsMultipleSelection:NO]; [panel setCanChooseDirectories:NO]; diff --git a/Preferences/Preferences/MIDIPluginBehaviorArrayController.m b/Preferences/Preferences/MIDIPluginBehaviorArrayController.m index d084d86d1..391b98735 100644 --- a/Preferences/Preferences/MIDIPluginBehaviorArrayController.m +++ b/Preferences/Preferences/MIDIPluginBehaviorArrayController.m @@ -68,7 +68,7 @@ static void enumCallback(void *context, OSType uSubType, OSType uManufacturer, c [self addObject: [NSDictionary dictionaryWithObjectsAndKeys: - @"FluidSynth", @"name", @"FluidSynth", @"preference", nil]]; + @"BASSMIDI", @"name", @"BASSMIDI", @"preference", nil]]; [self addObject: [NSDictionary dictionaryWithObjectsAndKeys: diff --git a/ThirdParty/BASS/README.md b/ThirdParty/BASS/README.md new file mode 100644 index 000000000..f62f9bc5c --- /dev/null +++ b/ThirdParty/BASS/README.md @@ -0,0 +1,10 @@ +These libraries were modified from the originals. + +First, they were generated by the bundled makefile, using: + +``` +make 64bit +``` + +Then, install_name_tool was used to change the id and import paths of each +of them, so that the libraries are referenced from @rpath, not @loader_path. diff --git a/ThirdParty/BASS/bass.h b/ThirdParty/BASS/bass.h new file mode 100644 index 000000000..b62681082 --- /dev/null +++ b/ThirdParty/BASS/bass.h @@ -0,0 +1,1131 @@ +/* + BASS 2.4 C/C++ header file + Copyright (c) 1999-2021 Un4seen Developments Ltd. + + See the BASS.CHM file for more detailed documentation +*/ + +#ifndef BASS_H +#define BASS_H + +#ifdef _WIN32 +#ifdef WINAPI_FAMILY +#include +#endif +#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__ +typedef int BOOL32; +#define BOOL BOOL32 // override objc's BOOL +#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; // sample playback 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; // 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_REINIT 11 // device needs to be reinitialized +#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_PROTOCOL 48 // unsupported protocol +#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 +#define BASS_CONFIG_SAMPLE_ONEHANDLE 69 +#define BASS_CONFIG_DEV_TIMEOUT 70 +#define BASS_CONFIG_NET_META 71 +#define BASS_CONFIG_NET_RESTRATE 72 + +// 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 + +#define BASS_CONFIG_THREAD 0x40000000 // flag: thread-specific setting + +// 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 // unused +#define BASS_DEVICE_MONO 2 // mono +#define BASS_DEVICE_3D 4 // unused +#define BASS_DEVICE_16BITS 8 // limit output to 16-bit +#define BASS_DEVICE_REINIT 128 // reinitialize +#define BASS_DEVICE_LATENCY 0x100 // unused +#define BASS_DEVICE_CPSPEAKERS 0x400 // unused +#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 +#define BASS_DEVICE_SOFTWARE 0x80000 // disable hardware/fastpath 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) || (defined(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_DEFAULTCOM 128 + +#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; // unused + DWORD hwfree; // unused + DWORD freesam; // unused + DWORD free3d; // unused + DWORD minrate; // unused + DWORD maxrate; // unused + BOOL eax; // unused + DWORD minbuf; // recommended minimum buffer length in ms + DWORD dsver; // DirectSound version + DWORD latency; // average delay (in ms) before start of playback + 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_EMULDRIVER 0x00000020 // device does not have hardware DirectSound support +#define DSCAPS_CERTIFIED 0x00000040 // device driver has been certified by Microsoft + +#define DSCAPS_HARDWARE 0x80000000 // hardware mixed + +// 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; // unused + DWORD priority; // unused +} 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 // unused +#define BASS_SAMPLE_MUTEMAX 32 // mute at max distance (3D only) +#define BASS_SAMPLE_VAM 64 // unused +#define BASS_SAMPLE_FX 128 // unused +#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 // scan file for accurate seeking and length +#define BASS_STREAM_AUTOFREE 0x40000 // automatically free the stream when it stops/ends +#define BASS_STREAM_RESTRATE 0x80000 // restrict the download rate of internet file stream +#define BASS_STREAM_BLOCK 0x100000 // download internet file stream in small blocks +#define BASS_STREAM_DECODE 0x200000 // don't play the stream, only decode +#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 // read file asynchronously +#define BASS_UNICODE 0x80000000 // UTF-16 + +#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; + DWORD ctype; // type of channel + DWORD origres; // original resolution + HPLUGIN plugin; + HSAMPLE sample; + const char *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_SAMPLE 0x1000a +#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) || (defined(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 + +// BASS_SampleGetChannel flags +#define BASS_SAMCHAN_NEW 1 // get a new playback channel +#define BASS_SAMCHAN_STREAM 2 // create a stream + +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 +#define BASS_FILEPOS_AVAILABLE 10 + +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_USER 15 +#define BASS_ATTRIB_TAIL 16 +#define BASS_ATTRIB_PUSH_LIMIT 17 +#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_NOREMOVE 0x10000000 // flag: don't remove data from recording buffer +#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 // get mono level +#define BASS_LEVEL_STEREO 2 // get stereo level +#define BASS_LEVEL_RMS 4 // get RMS levels +#define BASS_LEVEL_VOLPAN 8 // apply VOL/PAN attributes to the levels +#define BASS_LEVEL_NOREMOVE 16 // don't remove data from recording buffer + +// 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 ASCII 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_NAME 16 // Android Media codec name : ASCII string +#define BASS_TAG_ID3V2_2 17 // ID3v2 tags (2nd block) : variable length block +#define BASS_TAG_AM_MIME 18 // Android Media MIME type : ASCII string +#define BASS_TAG_LOCATION 19 // redirected URL : 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_CHAN 0x10200 // + channel #, MOD channel 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_END 0x10 // trimmed end position +#define BASS_POS_LOOP 0x11 // loop start positiom +#define BASS_POS_FLUSH 0x1000000 // flag: flush decoder/FX buffers +#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); +const void *BASSDEF(BASS_GetConfigPtr)(DWORD option); +DWORD BASSDEF(BASS_GetVersion)(void); +int BASSDEF(BASS_ErrorGetCode)(void); + +BOOL BASSDEF(BASS_GetDeviceInfo)(DWORD device, BASS_DEVICEINFO *info); +#if defined(_WIN32) && !defined(_WIN32_WCE) && !(defined(WINAPI_FAMILY) && WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP) +BOOL BASSDEF(BASS_Init)(int device, DWORD freq, DWORD flags, HWND win, const void *dsguid); +#else +BOOL BASSDEF(BASS_Init)(int device, DWORD freq, DWORD flags, void *win, const void *dsguid); +#endif +BOOL BASSDEF(BASS_Free)(void); +BOOL BASSDEF(BASS_SetDevice)(DWORD device); +DWORD BASSDEF(BASS_GetDevice)(void); +BOOL BASSDEF(BASS_GetInfo)(BASS_INFO *info); +BOOL BASSDEF(BASS_Start)(void); +BOOL BASSDEF(BASS_Stop)(void); +BOOL BASSDEF(BASS_Pause)(void); +DWORD BASSDEF(BASS_IsStarted)(void); +BOOL BASSDEF(BASS_Update)(DWORD length); +float BASSDEF(BASS_GetCPU)(void); +BOOL BASSDEF(BASS_SetVolume)(float volume); +float BASSDEF(BASS_GetVolume)(void); +#if defined(_WIN32) && !defined(_WIN32_WCE) && !(defined(WINAPI_FAMILY) && WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP) +void *BASSDEF(BASS_GetDSoundObject)(DWORD object); +#endif + +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)(void); + +HPLUGIN BASSDEF(BASS_PluginLoad)(const char *file, DWORD flags); +BOOL BASSDEF(BASS_PluginFree)(HPLUGIN handle); +BOOL BASSDEF(BASS_PluginEnable)(HPLUGIN handle, BOOL enable); +const BASS_PLUGININFO *BASSDEF(BASS_PluginGetInfo)(HPLUGIN 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); +DWORD BASSDEF(BASS_SampleGetChannel)(HSAMPLE handle, DWORD flags); +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); + +HMUSIC BASSDEF(BASS_MusicLoad)(BOOL mem, const void *file, QWORD offset, DWORD length, DWORD flags, DWORD freq); +BOOL BASSDEF(BASS_MusicFree)(HMUSIC handle); + +BOOL BASSDEF(BASS_RecordGetDeviceInfo)(DWORD device, BASS_DEVICEINFO *info); +BOOL BASSDEF(BASS_RecordInit)(int device); +BOOL BASSDEF(BASS_RecordFree)(void); +BOOL BASSDEF(BASS_RecordSetDevice)(DWORD device); +DWORD BASSDEF(BASS_RecordGetDevice)(void); +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_ChannelLock)(DWORD handle, BOOL lock); +BOOL BASSDEF(BASS_ChannelFree)(DWORD handle); +BOOL BASSDEF(BASS_ChannelPlay)(DWORD handle, BOOL restart); +BOOL BASSDEF(BASS_ChannelStop)(DWORD handle); +BOOL BASSDEF(BASS_ChannelPause)(DWORD handle); +BOOL BASSDEF(BASS_ChannelUpdate)(DWORD handle, DWORD length); +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); +BOOL BASSDEF(BASS_ChannelSetLink)(DWORD handle, DWORD chan); +BOOL BASSDEF(BASS_ChannelRemoveLink)(DWORD handle, DWORD chan); +HDSP BASSDEF(BASS_ChannelSetDSP)(DWORD handle, DSPPROC *proc, void *user, int priority); +BOOL BASSDEF(BASS_ChannelRemoveDSP)(DWORD handle, HDSP dsp); +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_FXSetPriority)(HFX handle, int priority); +BOOL BASSDEF(BASS_FXReset)(DWORD handle); + +#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 + +#ifdef __OBJC__ +#undef BOOL +#endif + +#endif diff --git a/ThirdParty/BASS/bassmidi.h b/ThirdParty/BASS/bassmidi.h new file mode 100644 index 000000000..dcfecd460 --- /dev/null +++ b/ThirdParty/BASS/bassmidi.h @@ -0,0 +1,380 @@ +/* + 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 new file mode 100644 index 000000000..2ecaed427 Binary files /dev/null and b/ThirdParty/BASS/libbass.dylib differ diff --git a/ThirdParty/BASS/libbassflac.dylib b/ThirdParty/BASS/libbassflac.dylib new file mode 100644 index 000000000..3c93974f1 Binary files /dev/null and b/ThirdParty/BASS/libbassflac.dylib differ diff --git a/ThirdParty/BASS/libbassmidi.dylib b/ThirdParty/BASS/libbassmidi.dylib new file mode 100644 index 000000000..f00663447 Binary files /dev/null and b/ThirdParty/BASS/libbassmidi.dylib differ diff --git a/ThirdParty/BASS/libbassopus.dylib b/ThirdParty/BASS/libbassopus.dylib new file mode 100644 index 000000000..2fc85d547 Binary files /dev/null and b/ThirdParty/BASS/libbassopus.dylib differ diff --git a/ThirdParty/BASS/libbasswv.dylib b/ThirdParty/BASS/libbasswv.dylib new file mode 100644 index 000000000..bee77f154 Binary files /dev/null and b/ThirdParty/BASS/libbasswv.dylib differ diff --git a/ThirdParty/BASS/sflist.c b/ThirdParty/BASS/sflist.c new file mode 100644 index 000000000..2ebdfdd3c --- /dev/null +++ b/ThirdParty/BASS/sflist.c @@ -0,0 +1,873 @@ +/* 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 new file mode 100644 index 000000000..e758c1697 --- /dev/null +++ b/ThirdParty/BASS/sflist.h @@ -0,0 +1,60 @@ +/* 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 new file mode 100644 index 000000000..6bc9773a1 --- /dev/null +++ b/ThirdParty/BASS/sflist_rewrite.c @@ -0,0 +1,92 @@ +/* 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 deleted file mode 100644 index 2656cb6f4..000000000 --- a/ThirdParty/FluidSynth/README.txt +++ /dev/null @@ -1,9 +0,0 @@ -These binaries were built +universal using MacPorts. - -The following versions are included as of this commit: - -fluidsynth: 1525a6fc0b59acafd309a8de8bfc89e9c2f0cda8 -glib: 2.58.3_1 -pcre: 8.44_1 -readline: 8.1.000_0 -libsndfile: 1.0.28_1 diff --git a/ThirdParty/FluidSynth/include/fluidsynth.h b/ThirdParty/FluidSynth/include/fluidsynth.h deleted file mode 100644 index 3e7096f47..000000000 --- a/ThirdParty/FluidSynth/include/fluidsynth.h +++ /dev/null @@ -1,121 +0,0 @@ -/* FluidSynth - A Software Synthesizer - * - * Copyright (C) 2003 Peter Hanappe and others. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA - */ - -#ifndef _FLUIDSYNTH_H -#define _FLUIDSYNTH_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define BUILD_SHARED_LIBS 1 - -#if (BUILD_SHARED_LIBS == 0) - #define FLUIDSYNTH_API // building static lib? no visibility control then -#elif defined(WIN32) - #if defined(FLUIDSYNTH_NOT_A_DLL) - #define FLUIDSYNTH_API - #elif defined(FLUIDSYNTH_DLL_EXPORTS) - #define FLUIDSYNTH_API __declspec(dllexport) - #else - #define FLUIDSYNTH_API __declspec(dllimport) - #endif - -#elif defined(MACOS9) -#define FLUIDSYNTH_API __declspec(export) - -#elif defined(__OS2__) -#define FLUIDSYNTH_API __declspec(dllexport) - -#elif defined(__GNUC__) -#define FLUIDSYNTH_API __attribute__ ((visibility ("default"))) - -#else -#define FLUIDSYNTH_API - -#endif - -#if defined(__GNUC__) || defined(__clang__) -# define FLUID_DEPRECATED __attribute__((deprecated)) -#elif defined(_MSC_VER) && _MSC_VER > 1200 -# define FLUID_DEPRECATED __declspec(deprecated) -#else -# define FLUID_DEPRECATED -#endif - - -/** - * @file fluidsynth.h - * @brief FluidSynth is a real-time synthesizer designed for SoundFont(R) files. - * - * This is the header of the fluidsynth library and contains the - * synthesizer's public API. - * - * Depending on how you want to use or extend the synthesizer you - * will need different API functions. You probably do not need all - * of them. Here is what you might want to do: - * - * - Embedded synthesizer: create a new synthesizer and send MIDI - * events to it. The sound goes directly to the audio output of - * your system. - * - * - Plugin synthesizer: create a synthesizer and send MIDI events - * but pull the audio back into your application. - * - * - SoundFont plugin: create a new type of "SoundFont" and allow - * the synthesizer to load your type of SoundFonts. - * - * - MIDI input: Create a MIDI handler to read the MIDI input on your - * machine and send the MIDI events directly to the synthesizer. - * - * - MIDI files: Open MIDI files and send the MIDI events to the - * synthesizer. - * - * - Command lines: You can send textual commands to the synthesizer. - * - * SoundFont(R) is a registered trademark of E-mu Systems, Inc. - */ - -#include "fluidsynth/types.h" -#include "fluidsynth/settings.h" -#include "fluidsynth/synth.h" -#include "fluidsynth/shell.h" -#include "fluidsynth/sfont.h" -#include "fluidsynth/audio.h" -#include "fluidsynth/event.h" -#include "fluidsynth/midi.h" -#include "fluidsynth/seq.h" -#include "fluidsynth/seqbind.h" -#include "fluidsynth/log.h" -#include "fluidsynth/misc.h" -#include "fluidsynth/mod.h" -#include "fluidsynth/gen.h" -#include "fluidsynth/voice.h" -#include "fluidsynth/version.h" -#include "fluidsynth/ladspa.h" - - -#ifdef __cplusplus -} -#endif - -#endif /* _FLUIDSYNTH_H */ diff --git a/ThirdParty/FluidSynth/include/fluidsynth/audio.h b/ThirdParty/FluidSynth/include/fluidsynth/audio.h deleted file mode 100644 index 6c0e93575..000000000 --- a/ThirdParty/FluidSynth/include/fluidsynth/audio.h +++ /dev/null @@ -1,155 +0,0 @@ -/* FluidSynth - A Software Synthesizer - * - * Copyright (C) 2003 Peter Hanappe and others. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA - */ - -#ifndef _FLUIDSYNTH_AUDIO_H -#define _FLUIDSYNTH_AUDIO_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @defgroup audio_output Audio Output - * - * Functions for managing audio drivers and file renderers. - * - * The file renderer is used for fast rendering of MIDI files to - * audio files. The audio drivers are a high-level interface to - * connect the synthesizer with external audio sinks or to render - * real-time audio to files. - */ - -/** - * @defgroup audio_driver Audio Driver - * @ingroup audio_output - * - * Functions for managing audio drivers. - * - * Defines functions for creating audio driver output. Use - * new_fluid_audio_driver() to create a new audio driver for a given synth - * and configuration settings. - * - * The function new_fluid_audio_driver2() can be - * used if custom audio processing is desired before the audio is sent to the - * audio driver (although it is not as efficient). - * - * @sa @ref CreatingAudioDriver - * - * @{ - */ - -/** - * Callback function type used with new_fluid_audio_driver2() to allow for - * custom user audio processing before the audio is sent to the driver. - * - * @param data The user data parameter as passed to new_fluid_audio_driver2(). - * @param len Count of audio frames to synthesize. - * @param nfx Count of arrays in \c fx. - * @param fx Array of buffers to store effects audio to. Buffers may alias with buffers of \c out. - * @param nout Count of arrays in \c out. - * @param out Array of buffers to store (dry) audio to. Buffers may alias with buffers of \c fx. - * @return Should return #FLUID_OK on success, #FLUID_FAILED if an error occurred. - * - * This function is responsible for rendering audio to the buffers. - * The buffers passed to this function are allocated and owned by the respective - * audio driver and are only valid during that specific call (do not cache them). - * The buffers have already been zeroed-out. - * For further details please refer to fluid_synth_process(). - * - * @parblock - * @note Whereas fluid_synth_process() allows aliasing buffers, there is the 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. - * @endparblock - * - * @parblock - * @note Also note that the Jack driver is currently the only driver that has dedicated @p fx buffers - * (but only if \setting{audio_jack_multi} is true). All other drivers do not provide @p fx buffers. - * In this case, users are encouraged to mix the effects into the provided dry buffers when calling - * fluid_synth_process(). - * @code{.cpp} -int myCallback(void *, int len, int nfx, float *fx[], int nout, float *out[]) -{ - int ret; - if(nfx == 0) - { - float *fxb[4] = {out[0], out[1], out[0], out[1]}; - ret = fluid_synth_process(synth, len, sizeof(fxb) / sizeof(fxb[0]), fxb, nout, out); - } - else - { - ret = fluid_synth_process(synth, len, nfx, fx, nout, out); - } - // ... client-code ... - return ret; -} - * @endcode - * For other possible use-cases refer to \ref fluidsynth_process.c . - * @endparblock - */ -typedef int (*fluid_audio_func_t)(void *data, int len, - int nfx, float *fx[], - int nout, float *out[]); - -/** @startlifecycle{Audio Driver} */ -FLUIDSYNTH_API fluid_audio_driver_t *new_fluid_audio_driver(fluid_settings_t *settings, - fluid_synth_t *synth); - -FLUIDSYNTH_API fluid_audio_driver_t *new_fluid_audio_driver2(fluid_settings_t *settings, - fluid_audio_func_t func, - void *data); - -FLUIDSYNTH_API void delete_fluid_audio_driver(fluid_audio_driver_t *driver); -/** @endlifecycle */ - -FLUIDSYNTH_API int fluid_audio_driver_register(const char **adrivers); -/* @} */ - -/** - * @defgroup file_renderer File Renderer - * @ingroup audio_output - * - * Functions for managing file renderers and triggering the rendering. - * - * The file renderer is only used to render a MIDI file to audio as fast - * as possible. Please see \ref FileRenderer for a full example. - * - * If you are looking for a way to write audio generated - * from real-time events (for example from an external sequencer or a MIDI controller) to a file, - * please have a look at the \c file \ref audio_driver instead. - * - * - * @{ - */ - -/** @startlifecycle{File Renderer} */ -FLUIDSYNTH_API fluid_file_renderer_t *new_fluid_file_renderer(fluid_synth_t *synth); -FLUIDSYNTH_API void delete_fluid_file_renderer(fluid_file_renderer_t *dev); -/** @endlifecycle */ - -FLUIDSYNTH_API int fluid_file_renderer_process_block(fluid_file_renderer_t *dev); -FLUIDSYNTH_API int fluid_file_set_encoding_quality(fluid_file_renderer_t *dev, double q); -/* @} */ - -#ifdef __cplusplus -} -#endif - -#endif /* _FLUIDSYNTH_AUDIO_H */ diff --git a/ThirdParty/FluidSynth/include/fluidsynth/event.h b/ThirdParty/FluidSynth/include/fluidsynth/event.h deleted file mode 100644 index e50f974f5..000000000 --- a/ThirdParty/FluidSynth/include/fluidsynth/event.h +++ /dev/null @@ -1,142 +0,0 @@ -/* FluidSynth - A Software Synthesizer - * - * Copyright (C) 2003 Peter Hanappe and others. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA - */ - -#ifndef _FLUIDSYNTH_EVENT_H -#define _FLUIDSYNTH_EVENT_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @defgroup sequencer_events Sequencer Events - * @ingroup sequencer - * - * Create, modify, query and destroy sequencer events. - * - * @{ - */ - -/** - * Sequencer event type enumeration. - */ -enum fluid_seq_event_type -{ - FLUID_SEQ_NOTE = 0, /**< Note event with duration */ - FLUID_SEQ_NOTEON, /**< Note on event */ - FLUID_SEQ_NOTEOFF, /**< Note off event */ - FLUID_SEQ_ALLSOUNDSOFF, /**< All sounds off event */ - FLUID_SEQ_ALLNOTESOFF, /**< All notes off event */ - FLUID_SEQ_BANKSELECT, /**< Bank select message */ - FLUID_SEQ_PROGRAMCHANGE, /**< Program change message */ - FLUID_SEQ_PROGRAMSELECT, /**< Program select message */ - FLUID_SEQ_PITCHBEND, /**< Pitch bend message */ - FLUID_SEQ_PITCHWHEELSENS, /**< Pitch wheel sensitivity set message @since 1.1.0 was misspelled previously */ - FLUID_SEQ_MODULATION, /**< Modulation controller event */ - FLUID_SEQ_SUSTAIN, /**< Sustain controller event */ - FLUID_SEQ_CONTROLCHANGE, /**< MIDI control change event */ - FLUID_SEQ_PAN, /**< Stereo pan set event */ - FLUID_SEQ_VOLUME, /**< Volume set event */ - FLUID_SEQ_REVERBSEND, /**< Reverb send set event */ - FLUID_SEQ_CHORUSSEND, /**< Chorus send set event */ - FLUID_SEQ_TIMER, /**< Timer event (useful for giving a callback at a certain time) */ - FLUID_SEQ_CHANNELPRESSURE, /**< Channel aftertouch event @since 1.1.0 */ - FLUID_SEQ_KEYPRESSURE, /**< Polyphonic aftertouch event @since 2.0.0 */ - FLUID_SEQ_SYSTEMRESET, /**< System reset event @since 1.1.0 */ - FLUID_SEQ_UNREGISTERING, /**< Called when a sequencer client is being unregistered. @since 1.1.0 */ - FLUID_SEQ_SCALE, /**< Sets a new time scale for the sequencer @since 2.2.0 */ - FLUID_SEQ_LASTEVENT /**< @internal Defines the count of events enums @warning This symbol - is not part of the public API and ABI stability guarantee and - may change at any time! */ -}; - -/* Event alloc/free */ -/** @startlifecycle{Sequencer Event} */ -FLUIDSYNTH_API fluid_event_t *new_fluid_event(void); -FLUIDSYNTH_API void delete_fluid_event(fluid_event_t *evt); -/** @endlifecycle */ - -/* Initializing events */ -FLUIDSYNTH_API void fluid_event_set_source(fluid_event_t *evt, fluid_seq_id_t src); -FLUIDSYNTH_API void fluid_event_set_dest(fluid_event_t *evt, fluid_seq_id_t dest); - -/* Timer events */ -FLUIDSYNTH_API void fluid_event_timer(fluid_event_t *evt, void *data); - -/* Note events */ -FLUIDSYNTH_API void fluid_event_note(fluid_event_t *evt, int channel, - short key, short vel, - unsigned int duration); - -FLUIDSYNTH_API void fluid_event_noteon(fluid_event_t *evt, int channel, short key, short vel); -FLUIDSYNTH_API void fluid_event_noteoff(fluid_event_t *evt, int channel, short key); -FLUIDSYNTH_API void fluid_event_all_sounds_off(fluid_event_t *evt, int channel); -FLUIDSYNTH_API void fluid_event_all_notes_off(fluid_event_t *evt, int channel); - -/* Instrument selection */ -FLUIDSYNTH_API void fluid_event_bank_select(fluid_event_t *evt, int channel, short bank_num); -FLUIDSYNTH_API void fluid_event_program_change(fluid_event_t *evt, int channel, int preset_num); -FLUIDSYNTH_API void fluid_event_program_select(fluid_event_t *evt, int channel, unsigned int sfont_id, short bank_num, short preset_num); - -/* Real-time generic instrument controllers */ -FLUIDSYNTH_API -void fluid_event_control_change(fluid_event_t *evt, int channel, short control, int val); - -/* Real-time instrument controllers shortcuts */ -FLUIDSYNTH_API void fluid_event_pitch_bend(fluid_event_t *evt, int channel, int val); -FLUIDSYNTH_API void fluid_event_pitch_wheelsens(fluid_event_t *evt, int channel, int val); -FLUIDSYNTH_API void fluid_event_modulation(fluid_event_t *evt, int channel, int val); -FLUIDSYNTH_API void fluid_event_sustain(fluid_event_t *evt, int channel, int val); -FLUIDSYNTH_API void fluid_event_pan(fluid_event_t *evt, int channel, int val); -FLUIDSYNTH_API void fluid_event_volume(fluid_event_t *evt, int channel, int val); -FLUIDSYNTH_API void fluid_event_reverb_send(fluid_event_t *evt, int channel, int val); -FLUIDSYNTH_API void fluid_event_chorus_send(fluid_event_t *evt, int channel, int val); - -FLUIDSYNTH_API void fluid_event_key_pressure(fluid_event_t *evt, int channel, short key, int val); -FLUIDSYNTH_API void fluid_event_channel_pressure(fluid_event_t *evt, int channel, int val); -FLUIDSYNTH_API void fluid_event_system_reset(fluid_event_t *evt); - -/* Only when unregistering clients */ -FLUIDSYNTH_API void fluid_event_unregistering(fluid_event_t *evt); - -FLUIDSYNTH_API void fluid_event_scale(fluid_event_t *evt, double new_scale); - -/* Accessing event data */ -FLUIDSYNTH_API int fluid_event_get_type(fluid_event_t *evt); -FLUIDSYNTH_API fluid_seq_id_t fluid_event_get_source(fluid_event_t *evt); -FLUIDSYNTH_API fluid_seq_id_t fluid_event_get_dest(fluid_event_t *evt); -FLUIDSYNTH_API int fluid_event_get_channel(fluid_event_t *evt); -FLUIDSYNTH_API short fluid_event_get_key(fluid_event_t *evt); -FLUIDSYNTH_API short fluid_event_get_velocity(fluid_event_t *evt); -FLUIDSYNTH_API short fluid_event_get_control(fluid_event_t *evt); -FLUIDSYNTH_API int fluid_event_get_value(fluid_event_t *evt); -FLUIDSYNTH_API int fluid_event_get_program(fluid_event_t *evt); -FLUIDSYNTH_API void *fluid_event_get_data(fluid_event_t *evt); -FLUIDSYNTH_API unsigned int fluid_event_get_duration(fluid_event_t *evt); -FLUIDSYNTH_API short fluid_event_get_bank(fluid_event_t *evt); -FLUIDSYNTH_API int fluid_event_get_pitch(fluid_event_t *evt); -FLUIDSYNTH_API double fluid_event_get_scale(fluid_event_t *evt); -FLUIDSYNTH_API unsigned int fluid_event_get_sfont_id(fluid_event_t *evt); -/* @} */ - -#ifdef __cplusplus -} -#endif -#endif /* _FLUIDSYNTH_EVENT_H */ diff --git a/ThirdParty/FluidSynth/include/fluidsynth/gen.h b/ThirdParty/FluidSynth/include/fluidsynth/gen.h deleted file mode 100644 index 13b07c057..000000000 --- a/ThirdParty/FluidSynth/include/fluidsynth/gen.h +++ /dev/null @@ -1,134 +0,0 @@ -/* FluidSynth - A Software Synthesizer - * - * Copyright (C) 2003 Peter Hanappe and others. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA - */ - -#ifndef _FLUIDSYNTH_GEN_H -#define _FLUIDSYNTH_GEN_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @defgroup generators SoundFont Generators - * @ingroup soundfonts - * - * Functions and defines for SoundFont generator effects. - * - * @{ - */ - -/** - * Generator (effect) numbers (Soundfont 2.01 specifications section 8.1.3) - */ -enum fluid_gen_type -{ - GEN_STARTADDROFS, /**< Sample start address offset (0-32767) */ - GEN_ENDADDROFS, /**< Sample end address offset (-32767-0) */ - GEN_STARTLOOPADDROFS, /**< Sample loop start address offset (-32767-32767) */ - GEN_ENDLOOPADDROFS, /**< Sample loop end address offset (-32767-32767) */ - GEN_STARTADDRCOARSEOFS, /**< Sample start address coarse offset (X 32768) */ - GEN_MODLFOTOPITCH, /**< Modulation LFO to pitch */ - GEN_VIBLFOTOPITCH, /**< Vibrato LFO to pitch */ - GEN_MODENVTOPITCH, /**< Modulation envelope to pitch */ - GEN_FILTERFC, /**< Filter cutoff */ - GEN_FILTERQ, /**< Filter Q */ - GEN_MODLFOTOFILTERFC, /**< Modulation LFO to filter cutoff */ - GEN_MODENVTOFILTERFC, /**< Modulation envelope to filter cutoff */ - GEN_ENDADDRCOARSEOFS, /**< Sample end address coarse offset (X 32768) */ - GEN_MODLFOTOVOL, /**< Modulation LFO to volume */ - GEN_UNUSED1, /**< Unused */ - GEN_CHORUSSEND, /**< Chorus send amount */ - GEN_REVERBSEND, /**< Reverb send amount */ - GEN_PAN, /**< Stereo panning */ - GEN_UNUSED2, /**< Unused */ - GEN_UNUSED3, /**< Unused */ - GEN_UNUSED4, /**< Unused */ - GEN_MODLFODELAY, /**< Modulation LFO delay */ - GEN_MODLFOFREQ, /**< Modulation LFO frequency */ - GEN_VIBLFODELAY, /**< Vibrato LFO delay */ - GEN_VIBLFOFREQ, /**< Vibrato LFO frequency */ - GEN_MODENVDELAY, /**< Modulation envelope delay */ - GEN_MODENVATTACK, /**< Modulation envelope attack */ - GEN_MODENVHOLD, /**< Modulation envelope hold */ - GEN_MODENVDECAY, /**< Modulation envelope decay */ - GEN_MODENVSUSTAIN, /**< Modulation envelope sustain */ - GEN_MODENVRELEASE, /**< Modulation envelope release */ - GEN_KEYTOMODENVHOLD, /**< Key to modulation envelope hold */ - GEN_KEYTOMODENVDECAY, /**< Key to modulation envelope decay */ - GEN_VOLENVDELAY, /**< Volume envelope delay */ - GEN_VOLENVATTACK, /**< Volume envelope attack */ - GEN_VOLENVHOLD, /**< Volume envelope hold */ - GEN_VOLENVDECAY, /**< Volume envelope decay */ - GEN_VOLENVSUSTAIN, /**< Volume envelope sustain */ - GEN_VOLENVRELEASE, /**< Volume envelope release */ - GEN_KEYTOVOLENVHOLD, /**< Key to volume envelope hold */ - GEN_KEYTOVOLENVDECAY, /**< Key to volume envelope decay */ - GEN_INSTRUMENT, /**< Instrument ID (shouldn't be set by user) */ - GEN_RESERVED1, /**< Reserved */ - GEN_KEYRANGE, /**< MIDI note range */ - GEN_VELRANGE, /**< MIDI velocity range */ - GEN_STARTLOOPADDRCOARSEOFS, /**< Sample start loop address coarse offset (X 32768) */ - GEN_KEYNUM, /**< Fixed MIDI note number */ - GEN_VELOCITY, /**< Fixed MIDI velocity value */ - GEN_ATTENUATION, /**< Initial volume attenuation */ - GEN_RESERVED2, /**< Reserved */ - GEN_ENDLOOPADDRCOARSEOFS, /**< Sample end loop address coarse offset (X 32768) */ - GEN_COARSETUNE, /**< Coarse tuning */ - GEN_FINETUNE, /**< Fine tuning */ - GEN_SAMPLEID, /**< Sample ID (shouldn't be set by user) */ - GEN_SAMPLEMODE, /**< Sample mode flags */ - GEN_RESERVED3, /**< Reserved */ - GEN_SCALETUNE, /**< Scale tuning */ - GEN_EXCLUSIVECLASS, /**< Exclusive class number */ - GEN_OVERRIDEROOTKEY, /**< Sample root note override */ - - /** - * Initial Pitch - * - * @note This is not "standard" SoundFont generator, because it is not - * mentioned in the list of generators in the SF2 specifications. - * It is used by FluidSynth internally to compute the nominal pitch of - * a note on note-on event. By nature it shouldn't be allowed to be modulated, - * however the specification defines a default modulator having "Initial Pitch" - * as destination (cf. SF2.01 page 57 section 8.4.10 MIDI Pitch Wheel to Initial Pitch). - * Thus it is impossible to cancel this default modulator, which would be required - * to let the MIDI Pitch Wheel controller modulate a different generator. - * In order to provide this flexibility, FluidSynth >= 2.1.0 uses a default modulator - * "Pitch Wheel to Fine Tune", rather than Initial Pitch. The same "compromise" can - * be found on the Audigy 2 ZS for instance. - */ - GEN_PITCH, - - GEN_CUSTOM_BALANCE, /**< Balance @note Not a real SoundFont generator */ - /* non-standard generator for an additional custom high- or low-pass filter */ - GEN_CUSTOM_FILTERFC, /**< Custom filter cutoff frequency */ - GEN_CUSTOM_FILTERQ, /**< Custom filter Q */ - - GEN_LAST /**< @internal Value defines the count of generators (#fluid_gen_type) - @warning This symbol is not part of the public API and ABI - stability guarantee and may change at any time! */ -}; -/* @} */ - -#ifdef __cplusplus -} -#endif -#endif /* _FLUIDSYNTH_GEN_H */ - diff --git a/ThirdParty/FluidSynth/include/fluidsynth/ladspa.h b/ThirdParty/FluidSynth/include/fluidsynth/ladspa.h deleted file mode 100644 index 05b1942d6..000000000 --- a/ThirdParty/FluidSynth/include/fluidsynth/ladspa.h +++ /dev/null @@ -1,69 +0,0 @@ -/* FluidSynth - A Software Synthesizer - * - * Copyright (C) 2003 Peter Hanappe and others. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA - */ - -#ifndef _FLUIDSYNTH_LADSPA_H -#define _FLUIDSYNTH_LADSPA_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @defgroup ladspa Effect - LADSPA - * @ingroup synth - * - * Functions for configuring the LADSPA effects unit - * - * This header defines useful functions for programmatically manipulating the ladspa - * effects unit of the synth that can be retrieved via fluid_synth_get_ladspa_fx(). - * - * Using any of those functions requires fluidsynth to be compiled with LADSPA support. - * Else all of those functions are useless dummies. - * - * @{ - */ -FLUIDSYNTH_API int fluid_ladspa_is_active(fluid_ladspa_fx_t *fx); -FLUIDSYNTH_API int fluid_ladspa_activate(fluid_ladspa_fx_t *fx); -FLUIDSYNTH_API int fluid_ladspa_deactivate(fluid_ladspa_fx_t *fx); -FLUIDSYNTH_API int fluid_ladspa_reset(fluid_ladspa_fx_t *fx); -FLUIDSYNTH_API int fluid_ladspa_check(fluid_ladspa_fx_t *fx, char *err, int err_size); - -FLUIDSYNTH_API int fluid_ladspa_host_port_exists(fluid_ladspa_fx_t *fx, const char *name); - -FLUIDSYNTH_API int fluid_ladspa_add_buffer(fluid_ladspa_fx_t *fx, const char *name); -FLUIDSYNTH_API int fluid_ladspa_buffer_exists(fluid_ladspa_fx_t *fx, const char *name); - -FLUIDSYNTH_API int fluid_ladspa_add_effect(fluid_ladspa_fx_t *fx, const char *effect_name, - const char *lib_name, const char *plugin_name); -FLUIDSYNTH_API int fluid_ladspa_effect_can_mix(fluid_ladspa_fx_t *fx, const char *name); -FLUIDSYNTH_API int fluid_ladspa_effect_set_mix(fluid_ladspa_fx_t *fx, const char *name, int mix, float gain); -FLUIDSYNTH_API int fluid_ladspa_effect_port_exists(fluid_ladspa_fx_t *fx, const char *effect_name, const char *port_name); -FLUIDSYNTH_API int fluid_ladspa_effect_set_control(fluid_ladspa_fx_t *fx, const char *effect_name, - const char *port_name, float val); -FLUIDSYNTH_API int fluid_ladspa_effect_link(fluid_ladspa_fx_t *fx, const char *effect_name, - const char *port_name, const char *name); -/* @} */ - -#ifdef __cplusplus -} -#endif - -#endif /* _FLUIDSYNTH_LADSPA_H */ - diff --git a/ThirdParty/FluidSynth/include/fluidsynth/log.h b/ThirdParty/FluidSynth/include/fluidsynth/log.h deleted file mode 100644 index ec553ba4a..000000000 --- a/ThirdParty/FluidSynth/include/fluidsynth/log.h +++ /dev/null @@ -1,97 +0,0 @@ -/* FluidSynth - A Software Synthesizer - * - * Copyright (C) 2003 Peter Hanappe and others. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA - */ - -#ifndef _FLUIDSYNTH_LOG_H -#define _FLUIDSYNTH_LOG_H - - -#ifdef __cplusplus -extern "C" { -#endif - - -/** - * @defgroup logging Logging - * - * Logging interface - * - * The default logging function of the fluidsynth prints its messages to the - * stderr. The synthesizer uses five level of messages: #FLUID_PANIC, - * #FLUID_ERR, #FLUID_WARN, #FLUID_INFO, and #FLUID_DBG. - * - * A client application can install a new log function to handle the messages - * differently. In the following example, the application sets a callback - * function to display #FLUID_PANIC messages in a dialog, and ignores all other - * messages by setting the log function to NULL: - * - * @code - * fluid_set_log_function(FLUID_PANIC, show_dialog, (void*) root_window); - * fluid_set_log_function(FLUID_ERR, NULL, NULL); - * fluid_set_log_function(FLUID_WARN, NULL, NULL); - * fluid_set_log_function(FLUID_DBG, NULL, NULL); - * @endcode - * - * @note The logging configuration is global and not tied to a specific - * synthesizer instance. That means that all synthesizer instances created in - * the same process share the same logging configuration. - * - * @{ - */ - -/** - * FluidSynth log levels. - */ -enum fluid_log_level -{ - FLUID_PANIC, /**< The synth can't function correctly any more */ - FLUID_ERR, /**< Serious error occurred */ - FLUID_WARN, /**< Warning */ - FLUID_INFO, /**< Verbose informational messages */ - FLUID_DBG, /**< Debugging messages */ - LAST_LOG_LEVEL /**< @internal This symbol is not part of the public API and ABI - stability guarantee and may change at any time! */ -}; - -/** - * Log function handler callback type used by fluid_set_log_function(). - * - * @param level Log level (#fluid_log_level) - * @param message Log message text - * @param data User data pointer supplied to fluid_set_log_function(). - */ -typedef void (*fluid_log_function_t)(int level, const char *message, void *data); - -FLUIDSYNTH_API -fluid_log_function_t fluid_set_log_function(int level, fluid_log_function_t fun, void *data); - -FLUIDSYNTH_API void fluid_default_log_function(int level, const char *message, void *data); - -FLUIDSYNTH_API int fluid_log(int level, const char *fmt, ...) -#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) -__attribute__ ((format (printf, 2, 3))) -#endif -; -/* @} */ - -#ifdef __cplusplus -} -#endif - -#endif /* _FLUIDSYNTH_LOG_H */ diff --git a/ThirdParty/FluidSynth/include/fluidsynth/midi.h b/ThirdParty/FluidSynth/include/fluidsynth/midi.h deleted file mode 100644 index 047dcfc7d..000000000 --- a/ThirdParty/FluidSynth/include/fluidsynth/midi.h +++ /dev/null @@ -1,294 +0,0 @@ -/* FluidSynth - A Software Synthesizer - * - * Copyright (C) 2003 Peter Hanappe and others. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA - */ - -#ifndef _FLUIDSYNTH_MIDI_H -#define _FLUIDSYNTH_MIDI_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @defgroup midi_input MIDI Input - * - * MIDI Input Subsystem - * - * There are multiple ways to send MIDI events to the synthesizer. They can come - * from MIDI files, from external MIDI sequencers or raw MIDI event sources, - * can be modified via MIDI routers and also generated manually. - * - * The interface connecting all sources and sinks of MIDI events in libfluidsynth - * is \ref handle_midi_event_func_t. - * - * @{ - */ - -/** - * Generic callback function for MIDI event handler. - * - * @param data User defined data pointer - * @param event The MIDI event - * @return Should return #FLUID_OK on success, #FLUID_FAILED otherwise - * - * This callback is used to pass MIDI events - * - from \ref midi_player, \ref midi_router or \ref midi_driver - * - to \ref midi_router via fluid_midi_router_handle_midi_event() - * - or to \ref synth via fluid_synth_handle_midi_event(). - * - * Additionally, there is a translation layer to pass MIDI events to - * a \ref sequencer via fluid_sequencer_add_midi_event_to_buffer(). - */ -typedef int (*handle_midi_event_func_t)(void *data, fluid_midi_event_t *event); - -/** - * Generic callback function fired once by MIDI tick change. - * - * @param data User defined data pointer - * @param tick The current (zero-based) tick, which triggered the callback - * @return Should return #FLUID_OK on success, #FLUID_FAILED otherwise - * - * This callback is fired at a constant rate depending on the current BPM and PPQ. - * e.g. for PPQ = 192 and BPM = 140 the callback is fired 192 * 140 times per minute (448/sec). - * - * It can be used to sync external elements with the beat, - * or stop / loop the song on a given tick. - * Ticks being BPM-dependent, you can manipulate values such as bars or beats, - * without having to care about BPM. - * - * For example, this callback loops the song whenever it reaches the 5th bar : - * - * @code{.cpp} -int handle_tick(void *data, int tick) -{ - fluid_player_t *player = (fluid_player_t *)data; - int ppq = 192; // From MIDI header - int beatsPerBar = 4; // From the song's time signature - int loopBar = 5; - int loopTick = (loopBar - 1) * ppq * beatsPerBar; - - if (tick == loopTick) - { - return fluid_player_seek(player, 0); - } - - return FLUID_OK; -} - * @endcode - */ -typedef int (*handle_midi_tick_func_t)(void *data, int tick); -/* @} */ - -/** - * @defgroup midi_events MIDI Events - * @ingroup midi_input - * - * Functions to create, modify, query and delete MIDI events. - * - * These functions are intended to be used in MIDI routers and other filtering - * and processing functions in the MIDI event path. If you want to simply - * send MIDI messages to the synthesizer, you can use the more convenient - * \ref midi_messages interface. - * - * @{ - */ -/** @startlifecycle{MIDI Event} */ -FLUIDSYNTH_API fluid_midi_event_t *new_fluid_midi_event(void); -FLUIDSYNTH_API void delete_fluid_midi_event(fluid_midi_event_t *event); -/** @endlifecycle */ - -FLUIDSYNTH_API int fluid_midi_event_set_type(fluid_midi_event_t *evt, int type); -FLUIDSYNTH_API int fluid_midi_event_get_type(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); -/* @} */ - -/** - * @defgroup midi_router MIDI Router - * @ingroup midi_input - * - * Rule based tranformation and filtering of MIDI events. - * - * @{ - */ - -/** - * MIDI router rule type. - * - * @since 1.1.0 - */ -typedef enum -{ - FLUID_MIDI_ROUTER_RULE_NOTE, /**< MIDI note rule */ - FLUID_MIDI_ROUTER_RULE_CC, /**< MIDI controller rule */ - FLUID_MIDI_ROUTER_RULE_PROG_CHANGE, /**< MIDI program change rule */ - FLUID_MIDI_ROUTER_RULE_PITCH_BEND, /**< MIDI pitch bend rule */ - FLUID_MIDI_ROUTER_RULE_CHANNEL_PRESSURE, /**< MIDI channel pressure rule */ - FLUID_MIDI_ROUTER_RULE_KEY_PRESSURE, /**< MIDI key pressure rule */ - FLUID_MIDI_ROUTER_RULE_COUNT /**< @internal Total count of rule types. This symbol - is not part of the public API and ABI stability - guarantee and may change at any time!*/ -} fluid_midi_router_rule_type; - - -/** @startlifecycle{MIDI Router} */ -FLUIDSYNTH_API fluid_midi_router_t *new_fluid_midi_router(fluid_settings_t *settings, - handle_midi_event_func_t handler, - void *event_handler_data); -FLUIDSYNTH_API void delete_fluid_midi_router(fluid_midi_router_t *handler); -/** @endlifecycle */ - -FLUIDSYNTH_API int fluid_midi_router_set_default_rules(fluid_midi_router_t *router); -FLUIDSYNTH_API int fluid_midi_router_clear_rules(fluid_midi_router_t *router); -FLUIDSYNTH_API int fluid_midi_router_add_rule(fluid_midi_router_t *router, - fluid_midi_router_rule_t *rule, int type); - - -/** @startlifecycle{MIDI Router Rule} */ -FLUIDSYNTH_API fluid_midi_router_rule_t *new_fluid_midi_router_rule(void); -FLUIDSYNTH_API void delete_fluid_midi_router_rule(fluid_midi_router_rule_t *rule); -/** @endlifecycle */ - -FLUIDSYNTH_API void fluid_midi_router_rule_set_chan(fluid_midi_router_rule_t *rule, - int min, int max, float mul, int add); -FLUIDSYNTH_API void fluid_midi_router_rule_set_param1(fluid_midi_router_rule_t *rule, - int min, int max, float mul, int add); -FLUIDSYNTH_API void fluid_midi_router_rule_set_param2(fluid_midi_router_rule_t *rule, - int min, int max, float mul, int add); -FLUIDSYNTH_API int fluid_midi_router_handle_midi_event(void *data, fluid_midi_event_t *event); -FLUIDSYNTH_API int fluid_midi_dump_prerouter(void *data, fluid_midi_event_t *event); -FLUIDSYNTH_API int fluid_midi_dump_postrouter(void *data, fluid_midi_event_t *event); -/* @} */ - -/** - * @defgroup midi_driver MIDI Driver - * @ingroup midi_input - * - * Functions for managing MIDI drivers. - * - * The available MIDI drivers depend on your platform. See \ref settings_midi for all - * available configuration options. - * - * To create a MIDI driver, you need to specify a source for the MIDI events to be - * forwarded to via the \ref fluid_midi_event_t callback. Normally this will be - * either a \ref midi_router via fluid_midi_router_handle_midi_event() or the synthesizer - * via fluid_synth_handle_midi_event(). - * - * But you can also write your own handler function that preprocesses the events and - * forwards them on to the router or synthesizer instead. - * - * @{ - */ - -/** @startlifecycle{MIDI Driver} */ -FLUIDSYNTH_API -fluid_midi_driver_t *new_fluid_midi_driver(fluid_settings_t *settings, - handle_midi_event_func_t handler, - void *event_handler_data); - -FLUIDSYNTH_API void delete_fluid_midi_driver(fluid_midi_driver_t *driver); -/** @endlifecycle */ - -/* @} */ - -/** - * @defgroup midi_player MIDI File Player - * @ingroup midi_input - * - * Parse standard MIDI files and emit MIDI events. - * - * @{ - */ - -/** - * MIDI File Player status enum. - * @since 1.1.0 - */ -enum fluid_player_status -{ - FLUID_PLAYER_READY, /**< Player is ready */ - FLUID_PLAYER_PLAYING, /**< Player is currently playing */ - FLUID_PLAYER_STOPPING, /**< Player is stopping, but hasn't finished yet (currently unused) */ - FLUID_PLAYER_DONE /**< Player is finished playing */ -}; - -/** - * MIDI File Player tempo enum. - * @since 2.2.0 - */ -enum fluid_player_set_tempo_type -{ - FLUID_PLAYER_TEMPO_INTERNAL, /**< Use midi file tempo set in midi file (120 bpm by default). Multiplied by a factor */ - FLUID_PLAYER_TEMPO_EXTERNAL_BPM, /**< Set player tempo in bpm, supersede midi file tempo */ - FLUID_PLAYER_TEMPO_EXTERNAL_MIDI, /**< Set player tempo in us per quarter note, supersede midi file tempo */ - FLUID_PLAYER_TEMPO_NBR /**< @internal Value defines the count of player tempo type (#fluid_player_set_tempo_type) @warning This symbol is not part of the public API and ABI stability guarantee and may change at any time! */ -}; - -/** @startlifecycle{MIDI File Player} */ -FLUIDSYNTH_API fluid_player_t *new_fluid_player(fluid_synth_t *synth); -FLUIDSYNTH_API void delete_fluid_player(fluid_player_t *player); -/** @endlifecycle */ - -FLUIDSYNTH_API int fluid_player_add(fluid_player_t *player, const char *midifile); -FLUIDSYNTH_API int fluid_player_add_mem(fluid_player_t *player, const void *buffer, size_t len); -FLUIDSYNTH_API int fluid_player_play(fluid_player_t *player); -FLUIDSYNTH_API int fluid_player_stop(fluid_player_t *player); -FLUIDSYNTH_API int fluid_player_join(fluid_player_t *player); -FLUIDSYNTH_API int fluid_player_set_loop(fluid_player_t *player, int loop); -FLUIDSYNTH_API int fluid_player_set_tempo(fluid_player_t *player, int tempo_type, double tempo); -FLUID_DEPRECATED FLUIDSYNTH_API int fluid_player_set_midi_tempo(fluid_player_t *player, int tempo); -FLUID_DEPRECATED FLUIDSYNTH_API int fluid_player_set_bpm(fluid_player_t *player, int bpm); -FLUIDSYNTH_API int fluid_player_set_playback_callback(fluid_player_t *player, handle_midi_event_func_t handler, void *handler_data); -FLUIDSYNTH_API int fluid_player_set_tick_callback(fluid_player_t *player, handle_midi_tick_func_t handler, void *handler_data); - -FLUIDSYNTH_API int fluid_player_get_status(fluid_player_t *player); -FLUIDSYNTH_API int fluid_player_get_current_tick(fluid_player_t *player); -FLUIDSYNTH_API int fluid_player_get_total_ticks(fluid_player_t *player); -FLUIDSYNTH_API int fluid_player_get_bpm(fluid_player_t *player); -FLUIDSYNTH_API int fluid_player_get_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 deleted file mode 100644 index 8da368d9c..000000000 --- a/ThirdParty/FluidSynth/include/fluidsynth/misc.h +++ /dev/null @@ -1,77 +0,0 @@ -/* FluidSynth - A Software Synthesizer - * - * Copyright (C) 2003 Peter Hanappe and others. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA - */ - -#ifndef _FLUIDSYNTH_MISC_H -#define _FLUIDSYNTH_MISC_H - - -#ifdef __cplusplus -extern "C" { -#endif - - -/** - * @defgroup misc Miscellaneous - * - * Miscellaneous utility functions and defines - * - * @{ - */ - -/** - * Value that indicates success, used by most libfluidsynth functions. - * - * @note This was not publicly defined prior to libfluidsynth 1.1.0. When - * writing code which should also be compatible with older versions, something - * like the following can be used: - * - * @code - * #include - * - * #ifndef FLUID_OK - * #define FLUID_OK (0) - * #define FLUID_FAILED (-1) - * #endif - * @endcode - * - * @since 1.1.0 - */ -#define FLUID_OK (0) - -/** - * Value that indicates failure, used by most libfluidsynth functions. - * - * @note See #FLUID_OK for more details. - * - * @since 1.1.0 - */ -#define FLUID_FAILED (-1) - - -FLUIDSYNTH_API int fluid_is_soundfont(const char *filename); -FLUIDSYNTH_API int fluid_is_midifile(const char *filename); -FLUIDSYNTH_API void fluid_free(void* ptr); -/* @} */ - -#ifdef __cplusplus -} -#endif - -#endif /* _FLUIDSYNTH_MISC_H */ diff --git a/ThirdParty/FluidSynth/include/fluidsynth/mod.h b/ThirdParty/FluidSynth/include/fluidsynth/mod.h deleted file mode 100644 index 98a00b0c5..000000000 --- a/ThirdParty/FluidSynth/include/fluidsynth/mod.h +++ /dev/null @@ -1,105 +0,0 @@ -/* FluidSynth - A Software Synthesizer - * - * Copyright (C) 2003 Peter Hanappe and others. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA - */ - -#ifndef _FLUIDSYNTH_MOD_H -#define _FLUIDSYNTH_MOD_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @defgroup modulators SoundFont Modulators - * @ingroup soundfonts - * - * SoundFont modulator functions and constants. - * - * @{ - */ - -/** - * Flags defining the polarity, mapping function and type of a modulator source. - * Compare with SoundFont 2.04 PDF section 8.2. - * - * Note: Bit values do not correspond to the SoundFont spec! Also note that - * #FLUID_MOD_GC and #FLUID_MOD_CC are in the flags field instead of the source field. - */ -enum fluid_mod_flags -{ - FLUID_MOD_POSITIVE = 0, /**< Mapping function is positive */ - FLUID_MOD_NEGATIVE = 1, /**< Mapping function is negative */ - FLUID_MOD_UNIPOLAR = 0, /**< Mapping function is unipolar */ - FLUID_MOD_BIPOLAR = 2, /**< Mapping function is bipolar */ - FLUID_MOD_LINEAR = 0, /**< Linear mapping function */ - FLUID_MOD_CONCAVE = 4, /**< Concave mapping function */ - FLUID_MOD_CONVEX = 8, /**< Convex mapping function */ - FLUID_MOD_SWITCH = 12, /**< Switch (on/off) mapping function */ - FLUID_MOD_GC = 0, /**< General controller source type (#fluid_mod_src) */ - FLUID_MOD_CC = 16, /**< MIDI CC controller (source will be a MIDI CC number) */ - - FLUID_MOD_SIN = 0x80, /**< Custom non-standard sinus mapping function */ -}; - -/** - * General controller (if #FLUID_MOD_GC in flags). This - * corresponds to SoundFont 2.04 PDF section 8.2.1 - */ -enum fluid_mod_src -{ - FLUID_MOD_NONE = 0, /**< No source controller */ - FLUID_MOD_VELOCITY = 2, /**< MIDI note-on velocity */ - FLUID_MOD_KEY = 3, /**< MIDI note-on note number */ - FLUID_MOD_KEYPRESSURE = 10, /**< MIDI key pressure */ - FLUID_MOD_CHANNELPRESSURE = 13, /**< MIDI channel pressure */ - FLUID_MOD_PITCHWHEEL = 14, /**< Pitch wheel */ - FLUID_MOD_PITCHWHEELSENS = 16 /**< Pitch wheel sensitivity */ -}; - -/** @startlifecycle{Modulator} */ -FLUIDSYNTH_API fluid_mod_t *new_fluid_mod(void); -FLUIDSYNTH_API void delete_fluid_mod(fluid_mod_t *mod); -/** @endlifecycle */ - -FLUIDSYNTH_API size_t fluid_mod_sizeof(void); - -FLUIDSYNTH_API void fluid_mod_set_source1(fluid_mod_t *mod, int src, int flags); -FLUIDSYNTH_API void fluid_mod_set_source2(fluid_mod_t *mod, int src, int flags); -FLUIDSYNTH_API void fluid_mod_set_dest(fluid_mod_t *mod, int dst); -FLUIDSYNTH_API void fluid_mod_set_amount(fluid_mod_t *mod, double amount); - -FLUIDSYNTH_API 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 deleted file mode 100644 index 35c46eedd..000000000 --- a/ThirdParty/FluidSynth/include/fluidsynth/seq.h +++ /dev/null @@ -1,92 +0,0 @@ -/* FluidSynth - A Software Synthesizer - * - * Copyright (C) 2003 Peter Hanappe and others. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA - */ - -#ifndef _FLUIDSYNTH_SEQ_H -#define _FLUIDSYNTH_SEQ_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @defgroup sequencer MIDI Sequencer - * - * MIDI event sequencer. - * - * The MIDI sequencer can be used to play MIDI events in a more flexible way than - * using the MIDI file player, which expects the events to be stored as - * Standard MIDI Files. Using the sequencer, you can provide the events one by - * one, with an optional timestamp for scheduling. - * - * @{ - */ - -/** - * Event callback prototype for destination clients. - * - * @param time Current sequencer tick value (see fluid_sequencer_get_tick()). - * @param event The event being received - * @param seq The sequencer instance - * @param data User defined data registered with the client - * - * @note @p time may not be of the same tick value as the scheduled event! In fact, depending on - * the sequencer's scale and the synth's sample-rate, @p time may a few ticks too late. Although this - * itself is inaudible, it is important to consider, - * when you use this callback for enqueuing additional events over and over again with - * fluid_sequencer_send_at(): If you enqueue new events with a relative tick value you might introduce - * a timing error, which causes your sequence to sound e.g. slower than it's supposed to be. If this is - * your use-case, make sure to enqueue events with an absolute tick value. - */ -typedef void (*fluid_event_callback_t)(unsigned int time, fluid_event_t *event, - fluid_sequencer_t *seq, void *data); - - -/** @startlifecycle{MIDI Sequencer} */ -FLUID_DEPRECATED FLUIDSYNTH_API fluid_sequencer_t *new_fluid_sequencer(void); -FLUIDSYNTH_API fluid_sequencer_t *new_fluid_sequencer2(int use_system_timer); -FLUIDSYNTH_API void delete_fluid_sequencer(fluid_sequencer_t *seq); -/** @endlifecycle */ - -FLUIDSYNTH_API int fluid_sequencer_get_use_system_timer(fluid_sequencer_t *seq); -FLUIDSYNTH_API -fluid_seq_id_t fluid_sequencer_register_client(fluid_sequencer_t *seq, const char *name, - fluid_event_callback_t callback, void *data); -FLUIDSYNTH_API void fluid_sequencer_unregister_client(fluid_sequencer_t *seq, fluid_seq_id_t id); -FLUIDSYNTH_API int fluid_sequencer_count_clients(fluid_sequencer_t *seq); -FLUIDSYNTH_API fluid_seq_id_t fluid_sequencer_get_client_id(fluid_sequencer_t *seq, int index); -FLUIDSYNTH_API char *fluid_sequencer_get_client_name(fluid_sequencer_t *seq, fluid_seq_id_t id); -FLUIDSYNTH_API int fluid_sequencer_client_is_dest(fluid_sequencer_t *seq, fluid_seq_id_t id); -FLUIDSYNTH_API void fluid_sequencer_process(fluid_sequencer_t *seq, unsigned int msec); -FLUIDSYNTH_API void fluid_sequencer_send_now(fluid_sequencer_t *seq, fluid_event_t *evt); -FLUIDSYNTH_API -int fluid_sequencer_send_at(fluid_sequencer_t *seq, fluid_event_t *evt, - unsigned int time, int absolute); -FLUIDSYNTH_API -void fluid_sequencer_remove_events(fluid_sequencer_t *seq, fluid_seq_id_t source, fluid_seq_id_t dest, int type); -FLUIDSYNTH_API unsigned int fluid_sequencer_get_tick(fluid_sequencer_t *seq); -FLUIDSYNTH_API void fluid_sequencer_set_time_scale(fluid_sequencer_t *seq, double scale); -FLUIDSYNTH_API double fluid_sequencer_get_time_scale(fluid_sequencer_t *seq); -/* @} */ - -#ifdef __cplusplus -} -#endif - -#endif /* _FLUIDSYNTH_SEQ_H */ diff --git a/ThirdParty/FluidSynth/include/fluidsynth/seqbind.h b/ThirdParty/FluidSynth/include/fluidsynth/seqbind.h deleted file mode 100644 index ddf1cb9d8..000000000 --- a/ThirdParty/FluidSynth/include/fluidsynth/seqbind.h +++ /dev/null @@ -1,45 +0,0 @@ -/* FluidSynth - A Software Synthesizer - * - * Copyright (C) 2003 Peter Hanappe and others. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA - */ - -#ifndef _FLUIDSYNTH_SEQBIND_H -#define _FLUIDSYNTH_SEQBIND_H - -#include "seq.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @addtogroup sequencer - * - * @{ - */ -FLUIDSYNTH_API -fluid_seq_id_t fluid_sequencer_register_fluidsynth(fluid_sequencer_t *seq, fluid_synth_t *synth); -FLUIDSYNTH_API int -fluid_sequencer_add_midi_event_to_buffer(void *data, fluid_midi_event_t *event); -/* @} */ - -#ifdef __cplusplus -} -#endif -#endif /* _FLUIDSYNTH_SEQBIND_H */ - diff --git a/ThirdParty/FluidSynth/include/fluidsynth/settings.h b/ThirdParty/FluidSynth/include/fluidsynth/settings.h deleted file mode 100644 index a8b3cb85e..000000000 --- a/ThirdParty/FluidSynth/include/fluidsynth/settings.h +++ /dev/null @@ -1,194 +0,0 @@ -/* FluidSynth - A Software Synthesizer - * - * Copyright (C) 2003 Peter Hanappe and others. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA - */ - -#ifndef _FLUIDSYNTH_SETTINGS_H -#define _FLUIDSYNTH_SETTINGS_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @defgroup settings Settings - * - * Functions for settings management - * - * To create a synthesizer object you will have to specify its - * settings. These settings are stored in a fluid_settings_t object. - * @code - * void - * my_synthesizer () - * { - * fluid_settings_t *settings; - * fluid_synth_t *synth; - * fluid_audio_driver_t *adriver; - * - * settings = new_fluid_settings (); - * fluid_settings_setstr(settings, "audio.driver", "alsa"); - * // ... change settings ... - * synth = new_fluid_synth (settings); - * adriver = new_fluid_audio_driver (settings, synth); - * // ... - * } - * @endcode - * @sa @ref CreatingSettings - * - * @{ - */ - -/** - * Hint FLUID_HINT_BOUNDED_BELOW indicates that the LowerBound field - * of the FLUID_PortRangeHint should be considered meaningful. The - * value in this field should be considered the (inclusive) lower - * bound of the valid range. If FLUID_HINT_SAMPLE_RATE is also - * specified then the value of LowerBound should be multiplied by the - * sample rate. - */ -#define FLUID_HINT_BOUNDED_BELOW 0x1 - -/** Hint FLUID_HINT_BOUNDED_ABOVE indicates that the UpperBound field - of the FLUID_PortRangeHint should be considered meaningful. The - value in this field should be considered the (inclusive) upper - bound of the valid range. If FLUID_HINT_SAMPLE_RATE is also - specified then the value of UpperBound should be multiplied by the - sample rate. */ -#define FLUID_HINT_BOUNDED_ABOVE 0x2 - -/** - * Hint FLUID_HINT_TOGGLED indicates that the data item should be - * considered a Boolean toggle. Data less than or equal to zero should - * be considered `off' or `false,' and data above zero should be - * considered `on' or `true.' FLUID_HINT_TOGGLED may not be used in - * conjunction with any other hint. - */ -#define FLUID_HINT_TOGGLED 0x4 - -#define FLUID_HINT_OPTIONLIST 0x02 /**< Setting is a list of string options */ - - -/** - * Settings type - * - * Each setting has a defined type: numeric (double), integer, string or a - * set of values. The type of each setting can be retrieved using the - * function fluid_settings_get_type() - */ -enum fluid_types_enum -{ - FLUID_NO_TYPE = -1, /**< Undefined type */ - FLUID_NUM_TYPE, /**< Numeric (double) */ - FLUID_INT_TYPE, /**< Integer */ - FLUID_STR_TYPE, /**< String */ - FLUID_SET_TYPE /**< Set of values */ -}; - -/** @startlifecycle{Settings} */ -FLUIDSYNTH_API fluid_settings_t *new_fluid_settings(void); -FLUIDSYNTH_API void delete_fluid_settings(fluid_settings_t *settings); -/** @endlifecycle */ - -FLUIDSYNTH_API -int fluid_settings_get_type(fluid_settings_t *settings, const char *name); - -FLUIDSYNTH_API -int fluid_settings_get_hints(fluid_settings_t *settings, const char *name, int *val); - -FLUIDSYNTH_API -int fluid_settings_is_realtime(fluid_settings_t *settings, const char *name); - -FLUIDSYNTH_API -int fluid_settings_setstr(fluid_settings_t *settings, const char *name, const char *str); - -FLUIDSYNTH_API -int fluid_settings_copystr(fluid_settings_t *settings, const char *name, char *str, int len); - -FLUIDSYNTH_API -int fluid_settings_dupstr(fluid_settings_t *settings, const char *name, char **str); - -FLUIDSYNTH_API -int fluid_settings_getstr_default(fluid_settings_t *settings, const char *name, char **def); - -FLUIDSYNTH_API -int fluid_settings_str_equal(fluid_settings_t *settings, const char *name, const char *value); - -FLUIDSYNTH_API -int fluid_settings_setnum(fluid_settings_t *settings, const char *name, double val); - -FLUIDSYNTH_API -int fluid_settings_getnum(fluid_settings_t *settings, const char *name, double *val); - -FLUIDSYNTH_API -int fluid_settings_getnum_default(fluid_settings_t *settings, const char *name, double *val); - -FLUIDSYNTH_API -int fluid_settings_getnum_range(fluid_settings_t *settings, const char *name, - double *min, double *max); - -FLUIDSYNTH_API -int fluid_settings_setint(fluid_settings_t *settings, const char *name, int val); - -FLUIDSYNTH_API -int fluid_settings_getint(fluid_settings_t *settings, const char *name, int *val); - -FLUIDSYNTH_API -int fluid_settings_getint_default(fluid_settings_t *settings, const char *name, int *val); - -FLUIDSYNTH_API -int fluid_settings_getint_range(fluid_settings_t *settings, const char *name, - int *min, int *max); - -/** - * Callback function type used with fluid_settings_foreach_option() - * - * @param data User defined data pointer - * @param name Setting name - * @param option A string option for this setting (iterates through the list) - */ -typedef void (*fluid_settings_foreach_option_t)(void *data, const char *name, const char *option); - -FLUIDSYNTH_API -void fluid_settings_foreach_option(fluid_settings_t *settings, - const char *name, void *data, - fluid_settings_foreach_option_t func); -FLUIDSYNTH_API -int fluid_settings_option_count(fluid_settings_t *settings, const char *name); -FLUIDSYNTH_API char *fluid_settings_option_concat(fluid_settings_t *settings, - const char *name, - const char *separator); - -/** - * Callback function type used with fluid_settings_foreach() - * - * @param data User defined data pointer - * @param name Setting name - * @param type Setting type (#fluid_types_enum) - */ -typedef void (*fluid_settings_foreach_t)(void *data, const char *name, int type); - -FLUIDSYNTH_API -void fluid_settings_foreach(fluid_settings_t *settings, void *data, - fluid_settings_foreach_t func); -/* @} */ - -#ifdef __cplusplus -} -#endif - -#endif /* _FLUIDSYNTH_SETTINGS_H */ diff --git a/ThirdParty/FluidSynth/include/fluidsynth/sfont.h b/ThirdParty/FluidSynth/include/fluidsynth/sfont.h deleted file mode 100644 index b29d8b490..000000000 --- a/ThirdParty/FluidSynth/include/fluidsynth/sfont.h +++ /dev/null @@ -1,362 +0,0 @@ -/* FluidSynth - A Software Synthesizer - * - * Copyright (C) 2003 Peter Hanappe and others. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA - */ - -#ifndef _FLUIDSYNTH_SFONT_H -#define _FLUIDSYNTH_SFONT_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @defgroup soundfonts SountFonts - * - * SoundFont related functions - * - * This part of the API contains functions, defines and types that are mostly - * only used by internal or custom SoundFont loaders or client code that - * modifies loaded presets, SoundFonts or voices directly. - */ - -/** - * @defgroup soundfont_loader SoundFont Loader - * @ingroup soundfonts - * - * Create custom SoundFont loaders - * - * It is possible to add new SoundFont loaders to the - * synthesizer. This API allows for virtual SoundFont files to be loaded - * and synthesized, which may not actually be SoundFont files, as long as they - * can be represented by the SoundFont synthesis model. - * - * To add a new SoundFont loader to the synthesizer, call - * fluid_synth_add_sfloader() and pass a pointer to an - * #fluid_sfloader_t instance created by new_fluid_sfloader(). - * On creation, you must specify a callback function \p load - * that will be called for every file attempting to load it and - * if successful returns a #fluid_sfont_t instance, or NULL if it fails. - * - * The #fluid_sfont_t structure contains a callback to obtain the - * name of the SoundFont. It contains two functions to iterate - * though the contained presets, and one function to obtain a - * preset corresponding to a bank and preset number. This - * function should return a #fluid_preset_t instance. - * - * The #fluid_preset_t instance contains some functions to obtain - * information from the preset (name, bank, number). The most - * important callback is the noteon function. The noteon function - * is called by fluidsynth internally and - * should call fluid_synth_alloc_voice() for every sample that has - * to be played. fluid_synth_alloc_voice() expects a pointer to a - * #fluid_sample_t instance and returns a pointer to the opaque - * #fluid_voice_t structure. To set or increment the values of a - * generator, use fluid_voice_gen_set() or fluid_voice_gen_incr(). When you are - * finished initializing the voice call fluid_voice_start() to - * start playing the synthesis voice. - * - * @{ - */ - -/** - * Some notification enums for presets and samples. - */ -enum -{ - FLUID_PRESET_SELECTED, /**< Preset selected notify */ - FLUID_PRESET_UNSELECTED, /**< Preset unselected notify */ - FLUID_SAMPLE_DONE, /**< Sample no longer needed notify */ - FLUID_PRESET_PIN, /**< Request to pin preset samples to cache */ - FLUID_PRESET_UNPIN /**< Request to unpin preset samples from cache */ -}; - -/** - * Indicates the type of a sample used by the _fluid_sample_t::sampletype field. - * - * This enum corresponds to the \c SFSampleLink enum in the SoundFont spec. - * One \c flag may be bit-wise OR-ed with one \c value. - */ -enum fluid_sample_type -{ - FLUID_SAMPLETYPE_MONO = 0x1, /**< Value used for mono samples */ - FLUID_SAMPLETYPE_RIGHT = 0x2, /**< Value used for right samples of a stereo pair */ - FLUID_SAMPLETYPE_LEFT = 0x4, /**< Value used for left samples of a stereo pair */ - FLUID_SAMPLETYPE_LINKED = 0x8, /**< Value used for linked sample, which is currently not supported */ - FLUID_SAMPLETYPE_OGG_VORBIS = 0x10, /**< Flag used for Ogg Vorbis compressed samples (non-standard compliant extension) as found in the program "sftools" developed by Werner Schweer from MuseScore @since 1.1.7 */ - FLUID_SAMPLETYPE_ROM = 0x8000 /**< Flag that indicates ROM samples, causing the sample to be ignored */ -}; - - -/** - * Method to load an instrument file (does not actually need to be a real file name, - * could be another type of string identifier that the \a loader understands). - * - * @param loader SoundFont loader - * @param filename File name or other string identifier - * @return The loaded instrument file (SoundFont) or NULL if an error occurred. - */ -typedef fluid_sfont_t *(*fluid_sfloader_load_t)(fluid_sfloader_t *loader, const char *filename); - -/** - * The free method should free the memory allocated for a fluid_sfloader_t instance in - * addition to any private data. - * - * @param loader SoundFont loader - * - * Any custom user provided cleanup function must ultimately call - * delete_fluid_sfloader() to ensure proper cleanup of the #fluid_sfloader_t struct. If no private data - * needs to be freed, setting this to delete_fluid_sfloader() is sufficient. - * - */ -typedef void (*fluid_sfloader_free_t)(fluid_sfloader_t *loader); - - -/** @startlifecycle{SoundFont Loader} */ -FLUIDSYNTH_API fluid_sfloader_t *new_fluid_sfloader(fluid_sfloader_load_t load, fluid_sfloader_free_t free); -FLUIDSYNTH_API void delete_fluid_sfloader(fluid_sfloader_t *loader); - -FLUIDSYNTH_API fluid_sfloader_t *new_fluid_defsfloader(fluid_settings_t *settings); -/** @endlifecycle */ - -/** - * Opens the file or memory indicated by \c filename in binary read mode. - * - * @return returns a file handle on success, NULL otherwise - * - * \c filename matches the string provided during the fluid_synth_sfload() call. - */ -typedef void *(* fluid_sfloader_callback_open_t)(const char *filename); - -/** - * Reads \c count bytes to the specified buffer \c buf. - * - * @return returns #FLUID_OK if exactly \c count bytes were successfully read, else returns #FLUID_FAILED and leaves \a buf unmodified. - */ -typedef int (* fluid_sfloader_callback_read_t)(void *buf, fluid_long_long_t count, void *handle); - -/** - * Same purpose and behaviour as fseek. - * - * @param origin either \c SEEK_SET, \c SEEK_CUR or \c SEEK_END - * @return returns #FLUID_OK if the seek was successfully performed while not seeking beyond a buffer or file, #FLUID_FAILED otherwise - */ -typedef int (* fluid_sfloader_callback_seek_t)(void *handle, fluid_long_long_t offset, int origin); - -/** - * Closes the handle returned by #fluid_sfloader_callback_open_t and frees used resources. - * - * @return returns #FLUID_OK on success, #FLUID_FAILED on error - */ -typedef int (* fluid_sfloader_callback_close_t)(void *handle); - -/** @return returns current file offset or #FLUID_FAILED on error */ -typedef fluid_long_long_t (* fluid_sfloader_callback_tell_t)(void *handle); - - -FLUIDSYNTH_API int fluid_sfloader_set_callbacks(fluid_sfloader_t *loader, - fluid_sfloader_callback_open_t open, - fluid_sfloader_callback_read_t read, - fluid_sfloader_callback_seek_t seek, - fluid_sfloader_callback_tell_t tell, - fluid_sfloader_callback_close_t close); - -FLUIDSYNTH_API int fluid_sfloader_set_data(fluid_sfloader_t *loader, void *data); -FLUIDSYNTH_API void *fluid_sfloader_get_data(fluid_sfloader_t *loader); - - - -/** - * Method to return the name of a virtual SoundFont. - * - * @param sfont Virtual SoundFont - * @return The name of the virtual SoundFont. - */ -typedef const char *(*fluid_sfont_get_name_t)(fluid_sfont_t *sfont); - -/** - * Get a virtual SoundFont preset by bank and program numbers. - * - * @param sfont Virtual SoundFont - * @param bank MIDI bank number (0-16383) - * @param prenum MIDI preset number (0-127) - * @return Should return an allocated virtual preset or NULL if it could not - * be found. - */ -typedef fluid_preset_t *(*fluid_sfont_get_preset_t)(fluid_sfont_t *sfont, int bank, int prenum); - -/** - * Start virtual SoundFont preset iteration method. - * - * @param sfont Virtual SoundFont - * - * Starts/re-starts virtual preset iteration in a SoundFont. - */ -typedef void (*fluid_sfont_iteration_start_t)(fluid_sfont_t *sfont); - -/** - * Virtual SoundFont preset iteration function. - * - * @param sfont Virtual SoundFont - * @return NULL when no more presets are available, otherwise the a pointer to the current preset - * - * Returns preset information to the caller. The returned buffer is only valid until a subsequent - * call to this function. - */ -typedef fluid_preset_t *(*fluid_sfont_iteration_next_t)(fluid_sfont_t *sfont); - -/** - * Method to free a virtual SoundFont bank. - * - * @param sfont Virtual SoundFont to free. - * @return Should return 0 when it was able to free all resources or non-zero - * if some of the samples could not be freed because they are still in use, - * in which case the free will be tried again later, until success. - * - * Any custom user provided cleanup function must ultimately call - * delete_fluid_sfont() to ensure proper cleanup of the #fluid_sfont_t struct. If no private data - * needs to be freed, setting this to delete_fluid_sfont() is sufficient. - */ -typedef int (*fluid_sfont_free_t)(fluid_sfont_t *sfont); - - -/** @startlifecycle{SoundFont} */ -FLUIDSYNTH_API fluid_sfont_t *new_fluid_sfont(fluid_sfont_get_name_t get_name, - fluid_sfont_get_preset_t get_preset, - fluid_sfont_iteration_start_t iter_start, - fluid_sfont_iteration_next_t iter_next, - fluid_sfont_free_t free); - -FLUIDSYNTH_API int delete_fluid_sfont(fluid_sfont_t *sfont); -/** @endlifecycle */ - -FLUIDSYNTH_API int fluid_sfont_set_data(fluid_sfont_t *sfont, void *data); -FLUIDSYNTH_API void *fluid_sfont_get_data(fluid_sfont_t *sfont); - -FLUIDSYNTH_API int fluid_sfont_get_id(fluid_sfont_t *sfont); -FLUIDSYNTH_API const char *fluid_sfont_get_name(fluid_sfont_t *sfont); -FLUIDSYNTH_API fluid_preset_t *fluid_sfont_get_preset(fluid_sfont_t *sfont, int bank, int prenum); -FLUIDSYNTH_API void fluid_sfont_iteration_start(fluid_sfont_t *sfont); -FLUIDSYNTH_API fluid_preset_t *fluid_sfont_iteration_next(fluid_sfont_t *sfont); - -/** - * Method to get a virtual SoundFont preset name. - * - * @param preset Virtual SoundFont preset - * @return Should return the name of the preset. The returned string must be - * valid for the duration of the virtual preset (or the duration of the - * SoundFont, in the case of preset iteration). - */ -typedef const char *(*fluid_preset_get_name_t)(fluid_preset_t *preset); - -/** - * Method to get a virtual SoundFont preset MIDI bank number. - * - * @param preset Virtual SoundFont preset - * @param return The bank number of the preset - */ -typedef int (*fluid_preset_get_banknum_t)(fluid_preset_t *preset); - -/** - * Method to get a virtual SoundFont preset MIDI program number. - * - * @param preset Virtual SoundFont preset - * @param return The program number of the preset - */ -typedef int (*fluid_preset_get_num_t)(fluid_preset_t *preset); - -/** - * Method to handle a noteon event (synthesize the instrument). - * - * @param preset Virtual SoundFont preset - * @param synth Synthesizer instance - * @param chan MIDI channel number of the note on event - * @param key MIDI note number (0-127) - * @param vel MIDI velocity (0-127) - * @return #FLUID_OK on success (0) or #FLUID_FAILED (-1) otherwise - * - * This method may be called from within synthesis context and therefore - * should be as efficient as possible and not perform any operations considered - * bad for realtime audio output (memory allocations and other OS calls). - * - * Call fluid_synth_alloc_voice() for every sample that has - * to be played. fluid_synth_alloc_voice() expects a pointer to a - * #fluid_sample_t structure and returns a pointer to the opaque - * #fluid_voice_t structure. To set or increment the values of a - * generator, use fluid_voice_gen_set() or fluid_voice_gen_incr(). When you are - * finished initializing the voice call fluid_voice_start() to - * start playing the synthesis voice. Starting with FluidSynth 1.1.0 all voices - * created will be started at the same time. - */ -typedef int (*fluid_preset_noteon_t)(fluid_preset_t *preset, fluid_synth_t *synth, int chan, int key, int vel); - -/** - * Method to free a virtual SoundFont preset. - * - * @param preset Virtual SoundFont preset - * @return Should return 0 - * - * Any custom user provided cleanup function must ultimately call - * delete_fluid_preset() to ensure proper cleanup of the #fluid_preset_t struct. If no private data - * needs to be freed, setting this to delete_fluid_preset() is sufficient. - */ -typedef void (*fluid_preset_free_t)(fluid_preset_t *preset); - -/** @startlifecycle{Preset} */ -FLUIDSYNTH_API fluid_preset_t *new_fluid_preset(fluid_sfont_t *parent_sfont, - fluid_preset_get_name_t get_name, - fluid_preset_get_banknum_t get_bank, - fluid_preset_get_num_t get_num, - fluid_preset_noteon_t noteon, - fluid_preset_free_t free); -FLUIDSYNTH_API void delete_fluid_preset(fluid_preset_t *preset); -/** @endlifecycle */ - -FLUIDSYNTH_API int fluid_preset_set_data(fluid_preset_t *preset, void *data); -FLUIDSYNTH_API void *fluid_preset_get_data(fluid_preset_t *preset); - -FLUIDSYNTH_API const char *fluid_preset_get_name(fluid_preset_t *preset); -FLUIDSYNTH_API int fluid_preset_get_banknum(fluid_preset_t *preset); -FLUIDSYNTH_API int fluid_preset_get_num(fluid_preset_t *preset); -FLUIDSYNTH_API fluid_sfont_t *fluid_preset_get_sfont(fluid_preset_t *preset); - -/** @startlifecycle{Sample} */ -FLUIDSYNTH_API fluid_sample_t *new_fluid_sample(void); -FLUIDSYNTH_API void delete_fluid_sample(fluid_sample_t *sample); -/** @endlifecycle */ - -FLUIDSYNTH_API size_t fluid_sample_sizeof(void); - -FLUIDSYNTH_API int fluid_sample_set_name(fluid_sample_t *sample, const char *name); -FLUIDSYNTH_API int fluid_sample_set_sound_data(fluid_sample_t *sample, - short *data, - char *data24, - unsigned int nbframes, - unsigned int sample_rate, - short copy_data); - -FLUIDSYNTH_API int fluid_sample_set_loop(fluid_sample_t *sample, unsigned int loop_start, unsigned int loop_end); -FLUIDSYNTH_API int fluid_sample_set_pitch(fluid_sample_t *sample, int root_key, int fine_tune); - -/* @} */ - -#ifdef __cplusplus -} -#endif - -#endif /* _FLUIDSYNTH_SFONT_H */ diff --git a/ThirdParty/FluidSynth/include/fluidsynth/shell.h b/ThirdParty/FluidSynth/include/fluidsynth/shell.h deleted file mode 100644 index 80787a30a..000000000 --- a/ThirdParty/FluidSynth/include/fluidsynth/shell.h +++ /dev/null @@ -1,150 +0,0 @@ -/* FluidSynth - A Software Synthesizer - * - * Copyright (C) 2003 Peter Hanappe and others. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA - */ - -#ifndef _FLUIDSYNTH_SHELL_H -#define _FLUIDSYNTH_SHELL_H - - -#ifdef __cplusplus -extern "C" { -#endif - - -/** - * @defgroup command_interface Command Interface - * - * Control and configuration interface - * - * The command interface allows you to send textual commands to - * the synthesizer, to parse a command file, or to read commands - * from the stdin or other input streams (like a TCP socket). - * - * For a full list of available commands, type \c help in the - * \ref command_shell or send the same command via a command handler. - * Further documentation can be found at - * https://github.com/FluidSynth/fluidsynth/wiki/UserManual#shell-commands - * - * @{ - */ -FLUIDSYNTH_API fluid_istream_t fluid_get_stdin(void); -FLUIDSYNTH_API fluid_ostream_t fluid_get_stdout(void); -FLUIDSYNTH_API char *fluid_get_userconf(char *buf, int len); -FLUIDSYNTH_API char *fluid_get_sysconf(char *buf, int len); -/* @} */ - - -/** - * @defgroup command_handler Command Handler - * @ingroup command_interface - * @brief Handles text commands and reading of configuration files - * - * @{ - */ - -/** @startlifecycle{Command Handler} */ -FLUIDSYNTH_API -fluid_cmd_handler_t *new_fluid_cmd_handler(fluid_synth_t *synth, fluid_midi_router_t *router); - -FLUIDSYNTH_API -fluid_cmd_handler_t *new_fluid_cmd_handler2(fluid_settings_t *settings, fluid_synth_t *synth, - fluid_midi_router_t *router, fluid_player_t *player); - -FLUIDSYNTH_API -void delete_fluid_cmd_handler(fluid_cmd_handler_t *handler); -/** @endlifecycle */ - -FLUIDSYNTH_API -void fluid_cmd_handler_set_synth(fluid_cmd_handler_t *handler, fluid_synth_t *synth); - -FLUIDSYNTH_API -int fluid_command(fluid_cmd_handler_t *handler, const char *cmd, fluid_ostream_t out); - -FLUIDSYNTH_API -int fluid_source(fluid_cmd_handler_t *handler, const char *filename); -/* @} */ - - -/** - * @defgroup command_shell Command Shell - * @ingroup command_interface - * - * Interactive shell to control and configure a synthesizer instance. - * - * If you need a platform independent way to get the standard input - * and output streams, use fluid_get_stdin() and fluid_get_stdout(). - * - * For a full list of available commands, type \c help in the shell. - * - * @{ - */ - -/** @startlifecycle{Command Shell} */ -FLUIDSYNTH_API -fluid_shell_t *new_fluid_shell(fluid_settings_t *settings, fluid_cmd_handler_t *handler, - fluid_istream_t in, fluid_ostream_t out, int thread); - -FLUIDSYNTH_API -void fluid_usershell(fluid_settings_t *settings, fluid_cmd_handler_t *handler); - -FLUIDSYNTH_API void delete_fluid_shell(fluid_shell_t *shell); -/** @endlifecycle */ - -/* @} */ - - -/** - * @defgroup command_server Command Server - * @ingroup command_interface - * - * TCP socket server for a command handler. - * - * The socket server will open the TCP port set by \ref settings_shell_port - * (default 9800) and starts a new thread and \ref command_handler for each - * incoming connection. - * - * @note The server is only available if libfluidsynth has been compiled - * with network support (enable-network). Without network support, all related - * functions will return FLUID_FAILED or NULL. - * - * @{ - */ - -/** @startlifecycle{Command Server} */ -FLUIDSYNTH_API -fluid_server_t *new_fluid_server(fluid_settings_t *settings, - fluid_synth_t *synth, fluid_midi_router_t *router); - -FLUIDSYNTH_API -fluid_server_t *new_fluid_server2(fluid_settings_t *settings, - fluid_synth_t *synth, fluid_midi_router_t *router, - fluid_player_t *player); - -FLUIDSYNTH_API void delete_fluid_server(fluid_server_t *server); - -FLUIDSYNTH_API int fluid_server_join(fluid_server_t *server); -/** @endlifecycle */ - -/* @} */ - -#ifdef __cplusplus -} -#endif - -#endif /* _FLUIDSYNTH_SHELL_H */ diff --git a/ThirdParty/FluidSynth/include/fluidsynth/synth.h b/ThirdParty/FluidSynth/include/fluidsynth/synth.h deleted file mode 100644 index b8d0b0ab1..000000000 --- a/ThirdParty/FluidSynth/include/fluidsynth/synth.h +++ /dev/null @@ -1,540 +0,0 @@ -/* FluidSynth - A Software Synthesizer - * - * Copyright (C) 2003 Peter Hanappe and others. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA - */ - -#ifndef _FLUIDSYNTH_SYNTH_H -#define _FLUIDSYNTH_SYNTH_H - - -#ifdef __cplusplus -extern "C" { -#endif - - -/** - * @defgroup synth Synthesizer - * - * SoundFont synthesizer - * - * You create a new synthesizer with new_fluid_synth() and you destroy - * it with delete_fluid_synth(). Use the fluid_settings_t structure to specify - * the synthesizer characteristics. - * - * You have to load a SoundFont in order to hear any sound. For that - * you use the fluid_synth_sfload() function. - * - * You can use the audio driver functions to open - * the audio device and create a background audio thread. - * - * The API for sending MIDI events is probably what you expect: - * fluid_synth_noteon(), fluid_synth_noteoff(), ... - * - * @{ - */ - -/** @startlifecycle{Synthesizer} */ -FLUIDSYNTH_API fluid_synth_t *new_fluid_synth(fluid_settings_t *settings); -FLUIDSYNTH_API void delete_fluid_synth(fluid_synth_t *synth); -/** @endlifecycle */ - -FLUIDSYNTH_API double fluid_synth_get_cpu_load(fluid_synth_t *synth); -FLUID_DEPRECATED FLUIDSYNTH_API const char *fluid_synth_error(fluid_synth_t *synth); -/* @} */ - -/** - * @defgroup midi_messages MIDI Channel Messages - * @ingroup synth - * - * The MIDI channel message functions are mostly directly named after their - * counterpart MIDI messages. They are a high-level interface to controlling - * the synthesizer, playing notes and changing note and channel parameters. - * - * @{ - */ -FLUIDSYNTH_API int fluid_synth_noteon(fluid_synth_t *synth, int chan, int key, int vel); -FLUIDSYNTH_API int fluid_synth_noteoff(fluid_synth_t *synth, int chan, int key); -FLUIDSYNTH_API int fluid_synth_cc(fluid_synth_t *synth, int chan, int ctrl, int val); -FLUIDSYNTH_API int fluid_synth_get_cc(fluid_synth_t *synth, int chan, int ctrl, int *pval); -FLUIDSYNTH_API int fluid_synth_sysex(fluid_synth_t *synth, const char *data, int len, - char *response, int *response_len, int *handled, int dryrun); -FLUIDSYNTH_API int fluid_synth_pitch_bend(fluid_synth_t *synth, int chan, int val); -FLUIDSYNTH_API int fluid_synth_get_pitch_bend(fluid_synth_t *synth, int chan, int *ppitch_bend); -FLUIDSYNTH_API int fluid_synth_pitch_wheel_sens(fluid_synth_t *synth, int chan, int val); -FLUIDSYNTH_API int fluid_synth_get_pitch_wheel_sens(fluid_synth_t *synth, int chan, int *pval); -FLUIDSYNTH_API int fluid_synth_program_change(fluid_synth_t *synth, int chan, int program); -FLUIDSYNTH_API int fluid_synth_channel_pressure(fluid_synth_t *synth, int chan, int val); -FLUIDSYNTH_API int fluid_synth_key_pressure(fluid_synth_t *synth, int chan, int key, int val); -FLUIDSYNTH_API int fluid_synth_bank_select(fluid_synth_t *synth, int chan, int bank); -FLUIDSYNTH_API int fluid_synth_sfont_select(fluid_synth_t *synth, int chan, int sfont_id); -FLUIDSYNTH_API -int fluid_synth_program_select(fluid_synth_t *synth, int chan, int sfont_id, - int bank_num, int preset_num); -FLUIDSYNTH_API int -fluid_synth_program_select_by_sfont_name(fluid_synth_t *synth, int chan, - const char *sfont_name, int bank_num, - int preset_num); -FLUIDSYNTH_API -int fluid_synth_get_program(fluid_synth_t *synth, int chan, int *sfont_id, - int *bank_num, int *preset_num); -FLUIDSYNTH_API int fluid_synth_unset_program(fluid_synth_t *synth, int chan); -FLUIDSYNTH_API int fluid_synth_program_reset(fluid_synth_t *synth); -FLUIDSYNTH_API int fluid_synth_system_reset(fluid_synth_t *synth); - -FLUIDSYNTH_API int fluid_synth_all_notes_off(fluid_synth_t *synth, int chan); -FLUIDSYNTH_API int fluid_synth_all_sounds_off(fluid_synth_t *synth, int chan); - -FLUIDSYNTH_API int fluid_synth_set_gen(fluid_synth_t *synth, int chan, - int param, float value); -FLUIDSYNTH_API float fluid_synth_get_gen(fluid_synth_t *synth, int chan, int param); -/* @} MIDI Channel Messages */ - - -/** - * @defgroup voice_control Synthesis Voice Control - * @ingroup synth - * - * Low-level access to synthesis voices. - * - * @{ - */ -FLUIDSYNTH_API int fluid_synth_start(fluid_synth_t *synth, unsigned int id, - fluid_preset_t *preset, int audio_chan, - int midi_chan, int key, int vel); -FLUIDSYNTH_API int fluid_synth_stop(fluid_synth_t *synth, unsigned int id); - -FLUIDSYNTH_API fluid_voice_t *fluid_synth_alloc_voice(fluid_synth_t *synth, - fluid_sample_t *sample, - int channum, int key, int vel); -FLUIDSYNTH_API void fluid_synth_start_voice(fluid_synth_t *synth, fluid_voice_t *voice); -FLUIDSYNTH_API void fluid_synth_get_voicelist(fluid_synth_t *synth, - fluid_voice_t *buf[], int bufsize, int ID); -/* @} Voice Control */ - - -/** - * @defgroup soundfont_management SoundFont Management - * @ingroup synth - * - * Functions to load and unload SoundFonts. - * - * @{ - */ -FLUIDSYNTH_API -int fluid_synth_sfload(fluid_synth_t *synth, const char *filename, int reset_presets); -FLUIDSYNTH_API int fluid_synth_sfreload(fluid_synth_t *synth, int id); -FLUIDSYNTH_API int fluid_synth_sfunload(fluid_synth_t *synth, int id, int reset_presets); -FLUIDSYNTH_API int fluid_synth_add_sfont(fluid_synth_t *synth, fluid_sfont_t *sfont); -FLUIDSYNTH_API int fluid_synth_remove_sfont(fluid_synth_t *synth, fluid_sfont_t *sfont); -FLUIDSYNTH_API int fluid_synth_sfcount(fluid_synth_t *synth); -FLUIDSYNTH_API fluid_sfont_t *fluid_synth_get_sfont(fluid_synth_t *synth, unsigned int num); -FLUIDSYNTH_API fluid_sfont_t *fluid_synth_get_sfont_by_id(fluid_synth_t *synth, int id); -FLUIDSYNTH_API fluid_sfont_t *fluid_synth_get_sfont_by_name(fluid_synth_t *synth, - const char *name); -FLUIDSYNTH_API int fluid_synth_set_bank_offset(fluid_synth_t *synth, int sfont_id, int offset); -FLUIDSYNTH_API int fluid_synth_get_bank_offset(fluid_synth_t *synth, int sfont_id); -/* @} Soundfont Management */ - - -/** - * @defgroup reverb_effect Effect - Reverb - * @ingroup synth - * - * Functions for configuring the built-in reverb effect - * - * @{ - */ -FLUID_DEPRECATED FLUIDSYNTH_API void fluid_synth_set_reverb_on(fluid_synth_t *synth, int on); -FLUIDSYNTH_API int fluid_synth_reverb_on(fluid_synth_t *synth, int fx_group, int on); - -FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_set_reverb(fluid_synth_t *synth, double roomsize, - double damping, double width, double level); -FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_set_reverb_roomsize(fluid_synth_t *synth, double roomsize); -FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_set_reverb_damp(fluid_synth_t *synth, double damping); -FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_set_reverb_width(fluid_synth_t *synth, double width); -FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_set_reverb_level(fluid_synth_t *synth, double level); - -FLUID_DEPRECATED FLUIDSYNTH_API double fluid_synth_get_reverb_roomsize(fluid_synth_t *synth); -FLUID_DEPRECATED FLUIDSYNTH_API double fluid_synth_get_reverb_damp(fluid_synth_t *synth); -FLUID_DEPRECATED FLUIDSYNTH_API double fluid_synth_get_reverb_level(fluid_synth_t *synth); -FLUID_DEPRECATED FLUIDSYNTH_API double fluid_synth_get_reverb_width(fluid_synth_t *synth); - -FLUIDSYNTH_API int fluid_synth_set_reverb_group_roomsize(fluid_synth_t *synth, int fx_group, double roomsize); -FLUIDSYNTH_API int fluid_synth_set_reverb_group_damp(fluid_synth_t *synth, int fx_group, double damping); -FLUIDSYNTH_API int fluid_synth_set_reverb_group_width(fluid_synth_t *synth, int fx_group, double width); -FLUIDSYNTH_API int fluid_synth_set_reverb_group_level(fluid_synth_t *synth, int fx_group, double level); - -FLUIDSYNTH_API int fluid_synth_get_reverb_group_roomsize(fluid_synth_t *synth, int fx_group, double *roomsize); -FLUIDSYNTH_API int fluid_synth_get_reverb_group_damp(fluid_synth_t *synth, int fx_group, double *damping); -FLUIDSYNTH_API int fluid_synth_get_reverb_group_width(fluid_synth_t *synth, int fx_group, double *width); -FLUIDSYNTH_API int fluid_synth_get_reverb_group_level(fluid_synth_t *synth, int fx_group, double *level); - /* @} Reverb */ - - -/** - * @defgroup chorus_effect Effect - Chorus - * @ingroup synth - * - * Functions for configuring the built-in chorus effect - * - * @{ - */ - -/** - * Chorus modulation waveform type. - */ -enum fluid_chorus_mod -{ - FLUID_CHORUS_MOD_SINE = 0, /**< Sine wave chorus modulation */ - FLUID_CHORUS_MOD_TRIANGLE = 1 /**< Triangle wave chorus modulation */ -}; - - -FLUID_DEPRECATED FLUIDSYNTH_API void fluid_synth_set_chorus_on(fluid_synth_t *synth, int on); -FLUIDSYNTH_API int fluid_synth_chorus_on(fluid_synth_t *synth, int fx_group, int on); - -FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_set_chorus(fluid_synth_t *synth, int nr, double level, - double speed, double depth_ms, int type); -FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_set_chorus_nr(fluid_synth_t *synth, int nr); -FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_set_chorus_level(fluid_synth_t *synth, double level); -FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_set_chorus_speed(fluid_synth_t *synth, double speed); -FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_set_chorus_depth(fluid_synth_t *synth, double depth_ms); -FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_set_chorus_type(fluid_synth_t *synth, int type); - -FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_get_chorus_nr(fluid_synth_t *synth); -FLUID_DEPRECATED FLUIDSYNTH_API double fluid_synth_get_chorus_level(fluid_synth_t *synth); -FLUID_DEPRECATED FLUIDSYNTH_API double fluid_synth_get_chorus_speed(fluid_synth_t *synth); -FLUID_DEPRECATED FLUIDSYNTH_API double fluid_synth_get_chorus_depth(fluid_synth_t *synth); -FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_get_chorus_type(fluid_synth_t *synth); /* see fluid_chorus_mod */ - -FLUIDSYNTH_API int fluid_synth_set_chorus_group_nr(fluid_synth_t *synth, int fx_group, int nr); -FLUIDSYNTH_API int fluid_synth_set_chorus_group_level(fluid_synth_t *synth, int fx_group, double level); -FLUIDSYNTH_API int fluid_synth_set_chorus_group_speed(fluid_synth_t *synth, int fx_group, double speed); -FLUIDSYNTH_API int fluid_synth_set_chorus_group_depth(fluid_synth_t *synth, int fx_group, double depth_ms); -FLUIDSYNTH_API int fluid_synth_set_chorus_group_type(fluid_synth_t *synth, int fx_group, int type); - -FLUIDSYNTH_API int fluid_synth_get_chorus_group_nr(fluid_synth_t *synth, int fx_group, int *nr); -FLUIDSYNTH_API int fluid_synth_get_chorus_group_level(fluid_synth_t *synth, int fx_group, double *level); -FLUIDSYNTH_API int fluid_synth_get_chorus_group_speed(fluid_synth_t *synth, int fx_group, double *speed); -FLUIDSYNTH_API int fluid_synth_get_chorus_group_depth(fluid_synth_t *synth, int fx_group, double *depth_ms); -FLUIDSYNTH_API int fluid_synth_get_chorus_group_type(fluid_synth_t *synth, int fx_group, int *type); -/* @} Chorus */ - -/** - * @defgroup synthesis_params Synthesis Parameters - * @ingroup synth - * - * Functions to control and query synthesis parameters like gain and - * polyphony count. - * - * @{ - */ -FLUIDSYNTH_API int fluid_synth_count_midi_channels(fluid_synth_t *synth); -FLUIDSYNTH_API int fluid_synth_count_audio_channels(fluid_synth_t *synth); -FLUIDSYNTH_API int fluid_synth_count_audio_groups(fluid_synth_t *synth); -FLUIDSYNTH_API int fluid_synth_count_effects_channels(fluid_synth_t *synth); -FLUIDSYNTH_API int fluid_synth_count_effects_groups(fluid_synth_t *synth); - -FLUID_DEPRECATED FLUIDSYNTH_API void fluid_synth_set_sample_rate(fluid_synth_t *synth, float sample_rate); -FLUIDSYNTH_API void fluid_synth_set_gain(fluid_synth_t *synth, float gain); -FLUIDSYNTH_API float fluid_synth_get_gain(fluid_synth_t *synth); -FLUIDSYNTH_API int fluid_synth_set_polyphony(fluid_synth_t *synth, int polyphony); -FLUIDSYNTH_API int fluid_synth_get_polyphony(fluid_synth_t *synth); -FLUIDSYNTH_API int fluid_synth_get_active_voice_count(fluid_synth_t *synth); -FLUIDSYNTH_API int fluid_synth_get_internal_bufsize(fluid_synth_t *synth); - -FLUIDSYNTH_API -int fluid_synth_set_interp_method(fluid_synth_t *synth, int chan, int interp_method); - -/** - * Synthesis interpolation method. - */ -enum fluid_interp -{ - FLUID_INTERP_NONE = 0, /**< No interpolation: Fastest, but questionable audio quality */ - FLUID_INTERP_LINEAR = 1, /**< Straight-line interpolation: A bit slower, reasonable audio quality */ - FLUID_INTERP_4THORDER = 4, /**< Fourth-order interpolation, 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 */ -}; - -/** - * Enum used with fluid_synth_add_default_mod() to specify how to handle duplicate modulators. - */ -enum fluid_synth_add_mod -{ - FLUID_SYNTH_OVERWRITE, /**< Overwrite any existing matching modulator */ - FLUID_SYNTH_ADD, /**< Sum up modulator amounts */ -}; - -FLUIDSYNTH_API int fluid_synth_add_default_mod(fluid_synth_t *synth, const fluid_mod_t *mod, int mode); -FLUIDSYNTH_API int fluid_synth_remove_default_mod(fluid_synth_t *synth, const fluid_mod_t *mod); -/* @} Synthesis Parameters */ - - -/** - * @defgroup tuning MIDI Tuning - * @ingroup synth - * - * The functions in this section implement the MIDI Tuning Standard interface. - * - * @{ - */ -FLUIDSYNTH_API -int fluid_synth_activate_key_tuning(fluid_synth_t *synth, int bank, int prog, - const char *name, const double *pitch, int apply); -FLUIDSYNTH_API -int fluid_synth_activate_octave_tuning(fluid_synth_t *synth, int bank, int prog, - const char *name, const double *pitch, int apply); -FLUIDSYNTH_API -int fluid_synth_tune_notes(fluid_synth_t *synth, int bank, int prog, - int len, const int *keys, const double *pitch, int apply); -FLUIDSYNTH_API -int fluid_synth_activate_tuning(fluid_synth_t *synth, int chan, int bank, int prog, - int apply); -FLUIDSYNTH_API -int fluid_synth_deactivate_tuning(fluid_synth_t *synth, int chan, int apply); -FLUIDSYNTH_API void fluid_synth_tuning_iteration_start(fluid_synth_t *synth); -FLUIDSYNTH_API -int fluid_synth_tuning_iteration_next(fluid_synth_t *synth, int *bank, int *prog); -FLUIDSYNTH_API int fluid_synth_tuning_dump(fluid_synth_t *synth, int bank, int prog, - char *name, int len, double *pitch); -/* @} MIDI Tuning */ - - -/** - * @defgroup audio_rendering Audio Rendering - * @ingroup synth - * - * The functions in this section can be used to render audio directly to - * memory buffers. They are used internally by the \ref audio_driver and \ref file_renderer, - * but can also be used manually for custom processing of the rendered audio. - * - * @note Please note that all following functions block during rendering. If your goal is to - * render real-time audio, ensure that you call these functions from a high-priority - * thread with little to no other duties other than calling the rendering functions. - * - * @{ - */ -FLUIDSYNTH_API int fluid_synth_write_s16(fluid_synth_t *synth, int len, - void *lout, int loff, int lincr, - void *rout, int roff, int rincr); -FLUIDSYNTH_API int fluid_synth_write_float(fluid_synth_t *synth, int len, - void *lout, int loff, int lincr, - void *rout, int roff, int rincr); -FLUID_DEPRECATED FLUIDSYNTH_API int fluid_synth_nwrite_float(fluid_synth_t *synth, int len, - float **left, float **right, - float **fx_left, float **fx_right); -FLUIDSYNTH_API int fluid_synth_process(fluid_synth_t *synth, int len, - int nfx, float *fx[], - int nout, float *out[]); -/* @} Audio Rendering */ - - -/** - * @defgroup iir_filter Effect - IIR Filter - * @ingroup synth - * - * Functions for configuring the built-in IIR filter effect - * - * @{ - */ - -/** - * Specifies the type of filter to use for the custom IIR filter - */ -enum fluid_iir_filter_type -{ - FLUID_IIR_DISABLED = 0, /**< Custom IIR filter is not operating */ - FLUID_IIR_LOWPASS, /**< Custom IIR filter is operating as low-pass filter */ - FLUID_IIR_HIGHPASS, /**< Custom IIR filter is operating as high-pass filter */ - FLUID_IIR_LAST /**< @internal Value defines the count of filter types (#fluid_iir_filter_type) @warning This symbol is not part of the public API and ABI stability guarantee and may change at any time! */ -}; - -/** - * Specifies optional settings to use for the custom IIR filter. Can be bitwise ORed. - */ -enum fluid_iir_filter_flags -{ - FLUID_IIR_Q_LINEAR = 1 << 0, /**< The Soundfont spec requires the filter Q to be interpreted in dB. If this flag is set the filter Q is instead assumed to be in a linear range */ - FLUID_IIR_Q_ZERO_OFF = 1 << 1, /**< If this flag the filter is switched off if Q == 0 (prior to any transformation) */ - FLUID_IIR_NO_GAIN_AMP = 1 << 2 /**< The Soundfont spec requires to correct the gain of the filter depending on the filter's Q. If this flag is set the filter gain will not be corrected. */ -}; - -FLUIDSYNTH_API int fluid_synth_set_custom_filter(fluid_synth_t *, int type, int flags); -/* @} IIR Filter */ - - - - -/** - * @defgroup channel_setup MIDI Channel Setup - * @ingroup synth - * - * The functions in this section provide interfaces to change the channel type - * and to configure basic channels, legato and portamento setups. - * - * @{ - */ - -/** @name Channel Type - * @{ - */ - -/** - * The midi channel type used by fluid_synth_set_channel_type() - */ -enum fluid_midi_channel_type -{ - CHANNEL_TYPE_MELODIC = 0, /**< Melodic midi channel */ - CHANNEL_TYPE_DRUM = 1 /**< Drum midi channel */ -}; - -FLUIDSYNTH_API int fluid_synth_set_channel_type(fluid_synth_t *synth, int chan, int type); -/** @} Channel Type */ - - -/** @name Basic Channel Mode - * @{ - */ - -/** - * Channel mode bits OR-ed together so that it matches with the midi spec: poly omnion (0), mono omnion (1), poly omnioff (2), mono omnioff (3) - */ -enum fluid_channel_mode_flags -{ - FLUID_CHANNEL_POLY_OFF = 0x01, /**< if flag is set, the basic channel is in mono on state, if not set poly is on */ - FLUID_CHANNEL_OMNI_OFF = 0x02, /**< if flag is set, the basic channel is in omni off state, if not set omni is on */ -}; - -/** - * Indicates the mode a basic channel is set to - */ -enum fluid_basic_channel_modes -{ - FLUID_CHANNEL_MODE_MASK = (FLUID_CHANNEL_OMNI_OFF | FLUID_CHANNEL_POLY_OFF), /**< Mask Poly and Omni bits of #fluid_channel_mode_flags, usually only used internally */ - FLUID_CHANNEL_MODE_OMNION_POLY = FLUID_CHANNEL_MODE_MASK & (~FLUID_CHANNEL_OMNI_OFF & ~FLUID_CHANNEL_POLY_OFF), /**< corresponds to MIDI mode 0 */ - FLUID_CHANNEL_MODE_OMNION_MONO = FLUID_CHANNEL_MODE_MASK & (~FLUID_CHANNEL_OMNI_OFF & FLUID_CHANNEL_POLY_OFF), /**< corresponds to MIDI mode 1 */ - FLUID_CHANNEL_MODE_OMNIOFF_POLY = FLUID_CHANNEL_MODE_MASK & (FLUID_CHANNEL_OMNI_OFF & ~FLUID_CHANNEL_POLY_OFF), /**< corresponds to MIDI mode 2 */ - FLUID_CHANNEL_MODE_OMNIOFF_MONO = FLUID_CHANNEL_MODE_MASK & (FLUID_CHANNEL_OMNI_OFF | FLUID_CHANNEL_POLY_OFF), /**< corresponds to MIDI mode 3 */ - FLUID_CHANNEL_MODE_LAST /**< @internal Value defines the count of basic channel modes (#fluid_basic_channel_modes) @warning This symbol is not part of the public API and ABI stability guarantee and may change at any time! */ -}; - -FLUIDSYNTH_API int fluid_synth_reset_basic_channel(fluid_synth_t *synth, int chan); - -FLUIDSYNTH_API int fluid_synth_get_basic_channel(fluid_synth_t *synth, int chan, - int *basic_chan_out, - int *mode_chan_out, - int *basic_val_out); -FLUIDSYNTH_API int fluid_synth_set_basic_channel(fluid_synth_t *synth, int chan, int mode, int val); - -/** @} Basic Channel Mode */ - -/** @name Legato Mode - * @{ - */ - -/** - * Indicates the legato mode a channel is set to - * n1,n2,n3,.. is a legato passage. n1 is the first note, and n2,n3,n4 are played legato with previous note. */ -enum fluid_channel_legato_mode -{ - FLUID_CHANNEL_LEGATO_MODE_RETRIGGER, /**< Mode 0 - Release previous note, start a new note */ - FLUID_CHANNEL_LEGATO_MODE_MULTI_RETRIGGER, /**< Mode 1 - On contiguous notes retrigger in attack section using current value, shape attack using current dynamic and make use of previous voices if any */ - FLUID_CHANNEL_LEGATO_MODE_LAST /**< @internal Value defines the count of legato modes (#fluid_channel_legato_mode) @warning This symbol is not part of the public API and ABI stability guarantee and may change at any time! */ -}; - -FLUIDSYNTH_API int fluid_synth_set_legato_mode(fluid_synth_t *synth, int chan, int legatomode); -FLUIDSYNTH_API int fluid_synth_get_legato_mode(fluid_synth_t *synth, int chan, int *legatomode); -/** @} Legato Mode */ - -/** @name Portamento Mode - * @{ - */ - -/** - * Indicates the portamento mode a channel is set to - */ -enum fluid_channel_portamento_mode -{ - FLUID_CHANNEL_PORTAMENTO_MODE_EACH_NOTE, /**< Mode 0 - Portamento on each note (staccato or legato) */ - FLUID_CHANNEL_PORTAMENTO_MODE_LEGATO_ONLY, /**< Mode 1 - Portamento only on legato note */ - FLUID_CHANNEL_PORTAMENTO_MODE_STACCATO_ONLY, /**< Mode 2 - Portamento only on staccato note */ - FLUID_CHANNEL_PORTAMENTO_MODE_LAST /**< @internal Value defines the count of portamento modes - @warning This symbol is not part of the public API and ABI - stability guarantee and may change at any time! */ -}; - -FLUIDSYNTH_API int fluid_synth_set_portamento_mode(fluid_synth_t *synth, - int chan, int portamentomode); -FLUIDSYNTH_API int fluid_synth_get_portamento_mode(fluid_synth_t *synth, - int chan, int *portamentomode); -/** @} Portamento Mode */ - -/**@name Breath Mode - * @{ - */ - -/** - * Indicates the breath mode a channel is set to - */ -enum fluid_channel_breath_flags -{ - FLUID_CHANNEL_BREATH_POLY = 0x10, /**< when channel is poly, this flag indicates that the default velocity to initial attenuation modulator is replaced by a breath to initial attenuation modulator */ - FLUID_CHANNEL_BREATH_MONO = 0x20, /**< when channel is mono, this flag indicates that the default velocity to initial attenuation modulator is replaced by a breath modulator */ - FLUID_CHANNEL_BREATH_SYNC = 0x40, /**< when channel is mono, this flag indicates that the breath controller(MSB)triggers noteon/noteoff on the running note */ -}; - -FLUIDSYNTH_API int fluid_synth_set_breath_mode(fluid_synth_t *synth, - int chan, int breathmode); -FLUIDSYNTH_API int fluid_synth_get_breath_mode(fluid_synth_t *synth, - int chan, int *breathmode); -/** @} Breath Mode */ -/* @} MIDI Channel Setup */ - - -/** @ingroup settings */ -FLUIDSYNTH_API fluid_settings_t *fluid_synth_get_settings(fluid_synth_t *synth); - -/** @ingroup soundfont_loader */ -FLUIDSYNTH_API void fluid_synth_add_sfloader(fluid_synth_t *synth, fluid_sfloader_t *loader); - -/** @ingroup soundfont_loader */ -FLUIDSYNTH_API fluid_preset_t *fluid_synth_get_channel_preset(fluid_synth_t *synth, int chan); - -/** @ingroup midi_input */ -FLUIDSYNTH_API int fluid_synth_handle_midi_event(void *data, fluid_midi_event_t *event); - -/** @ingroup soundfonts */ -FLUIDSYNTH_API -int fluid_synth_pin_preset(fluid_synth_t *synth, int sfont_id, int bank_num, int preset_num); - -/** @ingroup soundfonts */ -FLUIDSYNTH_API -int fluid_synth_unpin_preset(fluid_synth_t *synth, int sfont_id, int bank_num, int preset_num); - -/** @ingroup ladspa */ -FLUIDSYNTH_API fluid_ladspa_fx_t *fluid_synth_get_ladspa_fx(fluid_synth_t *synth); - -#ifdef __cplusplus -} -#endif - -#endif /* _FLUIDSYNTH_SYNTH_H */ diff --git a/ThirdParty/FluidSynth/include/fluidsynth/types.h b/ThirdParty/FluidSynth/include/fluidsynth/types.h deleted file mode 100644 index 4352b4c57..000000000 --- a/ThirdParty/FluidSynth/include/fluidsynth/types.h +++ /dev/null @@ -1,85 +0,0 @@ -/* FluidSynth - A Software Synthesizer - * - * Copyright (C) 2003 Peter Hanappe and others. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA - */ - -#ifndef _FLUIDSYNTH_TYPES_H -#define _FLUIDSYNTH_TYPES_H - - - -#ifdef __cplusplus -extern "C" { -#endif - - -/** - * @defgroup Types Types - * @brief Type declarations - * - * @{ - */ - -typedef struct _fluid_hashtable_t fluid_settings_t; /**< Configuration settings instance */ -typedef struct _fluid_synth_t fluid_synth_t; /**< Synthesizer instance */ -typedef struct _fluid_voice_t fluid_voice_t; /**< Synthesis voice instance */ -typedef struct _fluid_sfloader_t fluid_sfloader_t; /**< SoundFont loader plugin */ -typedef struct _fluid_sfont_t fluid_sfont_t; /**< SoundFont */ -typedef struct _fluid_preset_t fluid_preset_t; /**< SoundFont preset */ -typedef struct _fluid_sample_t fluid_sample_t; /**< SoundFont sample */ -typedef struct _fluid_mod_t fluid_mod_t; /**< SoundFont modulator */ -typedef struct _fluid_audio_driver_t fluid_audio_driver_t; /**< Audio driver instance */ -typedef struct _fluid_file_renderer_t fluid_file_renderer_t; /**< Audio file renderer instance */ -typedef struct _fluid_player_t fluid_player_t; /**< MIDI player instance */ -typedef struct _fluid_midi_event_t fluid_midi_event_t; /**< MIDI event */ -typedef struct _fluid_midi_driver_t fluid_midi_driver_t; /**< MIDI driver instance */ -typedef struct _fluid_midi_router_t fluid_midi_router_t; /**< MIDI router instance */ -typedef struct _fluid_midi_router_rule_t fluid_midi_router_rule_t; /**< MIDI router rule */ -typedef struct _fluid_hashtable_t fluid_cmd_hash_t; /**< Command handler hash table */ -typedef struct _fluid_shell_t fluid_shell_t; /**< Command shell */ -typedef struct _fluid_server_t fluid_server_t; /**< TCP/IP shell server instance */ -typedef struct _fluid_event_t fluid_event_t; /**< Sequencer event */ -typedef struct _fluid_sequencer_t fluid_sequencer_t; /**< Sequencer instance */ -typedef struct _fluid_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() */ - -#if defined(_MSC_VER) && (_MSC_VER < 1800) -typedef __int64 fluid_long_long_t; // even on 32bit windows -#else -/** - * A typedef for C99's type long long, which is at least 64-bit wide, as guaranteed by the C99. - * @p __int64 will be used as replacement for VisualStudio 2010 and older. - */ -typedef long long fluid_long_long_t; -#endif - -/* @} */ - -#ifdef __cplusplus -} -#endif - -#endif /* _FLUIDSYNTH_TYPES_H */ diff --git a/ThirdParty/FluidSynth/include/fluidsynth/version.h b/ThirdParty/FluidSynth/include/fluidsynth/version.h deleted file mode 100644 index 8ad0cbb07..000000000 --- a/ThirdParty/FluidSynth/include/fluidsynth/version.h +++ /dev/null @@ -1,47 +0,0 @@ -/* FluidSynth - A Software Synthesizer - * - * Copyright (C) 2003 Peter Hanappe and others. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA - */ - -#ifndef _FLUIDSYNTH_VERSION_H -#define _FLUIDSYNTH_VERSION_H - - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @addtogroup misc - * - * @{ - */ -#define FLUIDSYNTH_VERSION "2.2.0" /**< String constant of libfluidsynth version. */ -#define FLUIDSYNTH_VERSION_MAJOR 2 /**< libfluidsynth major version integer constant. */ -#define FLUIDSYNTH_VERSION_MINOR 2 /**< libfluidsynth minor version integer constant. */ -#define FLUIDSYNTH_VERSION_MICRO 0 /**< 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 deleted file mode 100644 index ead4f710e..000000000 --- a/ThirdParty/FluidSynth/include/fluidsynth/voice.h +++ /dev/null @@ -1,77 +0,0 @@ -/* FluidSynth - A Software Synthesizer - * - * Copyright (C) 2003 Peter Hanappe and others. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA - */ - -#ifndef _FLUIDSYNTH_VOICE_H -#define _FLUIDSYNTH_VOICE_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @defgroup voices Voice Manipulation - * @ingroup soundfonts - * - * Synthesis voice manipulation functions. - * - * The interface to the synthesizer's voices. - * Examples on using them can be found in the source code of the default SoundFont - * loader (fluid_defsfont.c). - * - * Most of these functions should only be called from within synthesis context, - * such as the SoundFont loader's noteon method. - * - * @{ - */ - -/** - * Enum used with fluid_voice_add_mod() to specify how to handle duplicate modulators. - */ -enum fluid_voice_add_mod -{ - FLUID_VOICE_OVERWRITE, /**< Overwrite any existing matching modulator */ - FLUID_VOICE_ADD, /**< Add (sum) modulator amounts */ - FLUID_VOICE_DEFAULT /**< For default modulators only, no need to check for duplicates */ -}; - -FLUIDSYNTH_API void fluid_voice_add_mod(fluid_voice_t *voice, fluid_mod_t *mod, int mode); -FLUIDSYNTH_API float fluid_voice_gen_get(fluid_voice_t *voice, int gen); -FLUIDSYNTH_API void fluid_voice_gen_set(fluid_voice_t *voice, int gen, float val); -FLUIDSYNTH_API void fluid_voice_gen_incr(fluid_voice_t *voice, int gen, float val); - -FLUIDSYNTH_API unsigned int fluid_voice_get_id(const fluid_voice_t *voice); -FLUIDSYNTH_API int fluid_voice_get_channel(const fluid_voice_t *voice); -FLUIDSYNTH_API int fluid_voice_get_key(const fluid_voice_t *voice); -FLUIDSYNTH_API int fluid_voice_get_actual_key(const fluid_voice_t *voice); -FLUIDSYNTH_API int fluid_voice_get_velocity(const fluid_voice_t *voice); -FLUIDSYNTH_API int fluid_voice_get_actual_velocity(const fluid_voice_t *voice); -FLUIDSYNTH_API int fluid_voice_is_playing(const fluid_voice_t *voice); -FLUIDSYNTH_API int fluid_voice_is_on(const fluid_voice_t *voice); -FLUIDSYNTH_API int fluid_voice_is_sustained(const fluid_voice_t *voice); -FLUIDSYNTH_API int fluid_voice_is_sostenuto(const fluid_voice_t *voice); -FLUIDSYNTH_API int fluid_voice_optimize_sample(fluid_sample_t *s); -FLUIDSYNTH_API void fluid_voice_update_param(fluid_voice_t *voice, int gen); -/* @} */ - -#ifdef __cplusplus -} -#endif -#endif /* _FLUIDSYNTH_VOICE_H */ - diff --git a/ThirdParty/FluidSynth/libFLAC.8.dylib b/ThirdParty/FluidSynth/libFLAC.8.dylib deleted file mode 100755 index be8fc130c..000000000 Binary files a/ThirdParty/FluidSynth/libFLAC.8.dylib and /dev/null differ diff --git a/ThirdParty/FluidSynth/libfluidsynth.3.dylib b/ThirdParty/FluidSynth/libfluidsynth.3.dylib deleted file mode 100755 index 2b19d787b..000000000 Binary files a/ThirdParty/FluidSynth/libfluidsynth.3.dylib and /dev/null differ diff --git a/ThirdParty/FluidSynth/libogg.0.dylib b/ThirdParty/FluidSynth/libogg.0.dylib deleted file mode 100755 index 35fe81320..000000000 Binary files a/ThirdParty/FluidSynth/libogg.0.dylib and /dev/null differ diff --git a/ThirdParty/FluidSynth/libopus.0.dylib b/ThirdParty/FluidSynth/libopus.0.dylib deleted file mode 100755 index 7c00f5ace..000000000 Binary files a/ThirdParty/FluidSynth/libopus.0.dylib and /dev/null differ diff --git a/ThirdParty/FluidSynth/libsndfile.1.dylib b/ThirdParty/FluidSynth/libsndfile.1.dylib deleted file mode 100755 index 8389e1820..000000000 Binary files a/ThirdParty/FluidSynth/libsndfile.1.dylib and /dev/null differ diff --git a/ThirdParty/FluidSynth/libvorbis.0.dylib b/ThirdParty/FluidSynth/libvorbis.0.dylib deleted file mode 100755 index 0bdb87f2c..000000000 Binary files a/ThirdParty/FluidSynth/libvorbis.0.dylib and /dev/null differ diff --git a/ThirdParty/FluidSynth/libvorbisenc.2.dylib b/ThirdParty/FluidSynth/libvorbisenc.2.dylib deleted file mode 100755 index 19563cbf2..000000000 Binary files a/ThirdParty/FluidSynth/libvorbisenc.2.dylib and /dev/null differ