diff --git a/Application/AppController.m b/Application/AppController.m index 920e265de..f386f4e48 100644 --- a/Application/AppController.m +++ b/Application/AppController.m @@ -374,7 +374,7 @@ [userDefaultsValuesDict setObject:@"dls appl" forKey:@"midi.plugin"]; - [userDefaultsValuesDict setObject:@"sc55" forKey:@"midi.flavor"]; + [userDefaultsValuesDict setObject:@"default" forKey:@"midi.flavor"]; //Register and sync defaults [[NSUserDefaults standardUserDefaults] registerDefaults:userDefaultsValuesDict]; diff --git a/Plugins/MIDI/MIDI/MIDIDecoder.mm b/Plugins/MIDI/MIDI/MIDIDecoder.mm index b547dd624..9135f9e4e 100755 --- a/Plugins/MIDI/MIDI/MIDIDecoder.mm +++ b/Plugins/MIDI/MIDI/MIDIDecoder.mm @@ -208,7 +208,9 @@ static OSType getOSType(const char * in_) SCPlayer::sc_mode mode = SCPlayer::sc_sc55; NSString * flavor = [[NSUserDefaults standardUserDefaults] stringForKey:@"midi.flavor"]; - if ([flavor isEqualToString:@"gm"]) + if ([flavor isEqualToString:@"default"]) + mode = SCPlayer::sc_default; + else if ([flavor isEqualToString:@"gm"]) mode = SCPlayer::sc_gm; else if ([flavor isEqualToString:@"gm2"]) mode = SCPlayer::sc_gm2; diff --git a/Plugins/MIDI/MIDI/SCPlayer.cpp b/Plugins/MIDI/MIDI/SCPlayer.cpp index c486df60f..a2de8a863 100644 --- a/Plugins/MIDI/MIDI/SCPlayer.cpp +++ b/Plugins/MIDI/MIDI/SCPlayer.cpp @@ -74,7 +74,7 @@ static bool syx_is_reset(const uint8_t * data) void SCPlayer::send_sysex(uint32_t port, const uint8_t * data) { sampler[port].TG_LongMidiIn( data, 0 ); - if (syx_is_reset(data)) + if (syx_is_reset(data) && mode != sc_default) { reset(port); } @@ -117,6 +117,7 @@ void SCPlayer::reset_sc(uint32_t port) break; case sc_sc8850: + case sc_default: message[8] = 4; break; } @@ -153,6 +154,7 @@ void SCPlayer::reset(uint32_t port) case sc_sc88: case sc_sc88pro: case sc_sc8850: + case sc_default: sampler[port].TG_LongMidiIn( syx_reset_gs, 0 ); reset_sc(port); break; @@ -162,6 +164,26 @@ void SCPlayer::reset(uint32_t port) sampler[port].TG_ShortMidiIn( 0x7F00B9, 0 ); // fix drum channel break; } + + { + unsigned int i; + for (i = 0; i < 16; ++i) + { + sampler[port].TG_ShortMidiIn( 0x78B0 + i, 0 ); + sampler[port].TG_ShortMidiIn( 0x79B0 + i, 0 ); + } + } + + { + float temp[1024]; + unsigned long i, j; + for (i = 0, j = (uSampleRate / 1536 + 1); i < j; ++i) + { + memset(temp, 0, sizeof(temp)); + sampler[port].TG_setInterruptThreadIdAtThisTime(); + sampler[port].TG_Process(temp, temp, 1024); + } + } } } diff --git a/Plugins/MIDI/MIDI/SCPlayer.h b/Plugins/MIDI/MIDI/SCPlayer.h index d15635ac8..962f77a35 100644 --- a/Plugins/MIDI/MIDI/SCPlayer.h +++ b/Plugins/MIDI/MIDI/SCPlayer.h @@ -18,20 +18,20 @@ public: typedef enum { - sc_gm = 0, + sc_default = 0, + sc_gm, sc_gm2, sc_sc55, sc_sc88, sc_sc88pro, sc_sc8850, - sc_xg, - sc_default = sc_sc55 + sc_xg } sc_mode; void set_mode(sc_mode m); - void set_sccore_path(const char * path); +void set_sccore_path(const char * path); protected: virtual void send_event(uint32_t b); diff --git a/Preferences/General/English.lproj/Preferences.xib b/Preferences/General/English.lproj/Preferences.xib index befab1acc..af68300f7 100644 --- a/Preferences/General/English.lproj/Preferences.xib +++ b/Preferences/General/English.lproj/Preferences.xib @@ -1,9 +1,9 @@ - - + + - - + + @@ -454,7 +454,7 @@ - + @@ -528,7 +528,6 @@ - @@ -547,12 +546,12 @@ - + - + - + @@ -562,6 +561,11 @@ + + + MIDIPluginFlavorTransformer + + diff --git a/Preferences/General/General.xcodeproj/project.pbxproj b/Preferences/General/General.xcodeproj/project.pbxproj index aee15e9cd..2ec77c377 100644 --- a/Preferences/General/General.xcodeproj/project.pbxproj +++ b/Preferences/General/General.xcodeproj/project.pbxproj @@ -28,6 +28,7 @@ 83B0672B180D8B39008E3612 /* midi.png in Resources */ = {isa = PBXBuildFile; fileRef = 83B0672A180D8B39008E3612 /* midi.png */; }; 83DFEA0B1CBC94DE00BCC565 /* MIDIFlavorBehaviorArrayController.m in Sources */ = {isa = PBXBuildFile; fileRef = 83DFEA0A1CBC94DE00BCC565 /* MIDIFlavorBehaviorArrayController.m */; }; 83EF495F17FBC96A00642E3C /* VolumeBehaviorArrayController.m in Sources */ = {isa = PBXBuildFile; fileRef = 83EF495E17FBC96A00642E3C /* VolumeBehaviorArrayController.m */; }; + 83F127AA1DEE47E90010CB8F /* MIDIPluginFlavorTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 83F127A81DEE47E90010CB8F /* MIDIPluginFlavorTransformer.m */; }; 83F27E6B1810DD3A00CEF538 /* appearance@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 83F27E651810DD3A00CEF538 /* appearance@2x.png */; }; 83F27E6C1810DD3A00CEF538 /* growl@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 83F27E661810DD3A00CEF538 /* growl@2x.png */; }; 83F27E6D1810DD3A00CEF538 /* lastfm@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 83F27E671810DD3A00CEF538 /* lastfm@2x.png */; }; @@ -115,6 +116,8 @@ 83DFEA0A1CBC94DE00BCC565 /* MIDIFlavorBehaviorArrayController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MIDIFlavorBehaviorArrayController.m; sourceTree = ""; }; 83EF495D17FBC96A00642E3C /* VolumeBehaviorArrayController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VolumeBehaviorArrayController.h; sourceTree = ""; }; 83EF495E17FBC96A00642E3C /* VolumeBehaviorArrayController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VolumeBehaviorArrayController.m; sourceTree = ""; }; + 83F127A81DEE47E90010CB8F /* MIDIPluginFlavorTransformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MIDIPluginFlavorTransformer.m; sourceTree = ""; }; + 83F127A91DEE47E90010CB8F /* MIDIPluginFlavorTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MIDIPluginFlavorTransformer.h; sourceTree = ""; }; 83F27E651810DD3A00CEF538 /* appearance@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "appearance@2x.png"; path = "Icons/appearance@2x.png"; sourceTree = ""; }; 83F27E661810DD3A00CEF538 /* growl@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "growl@2x.png"; path = "Icons/growl@2x.png"; sourceTree = ""; }; 83F27E671810DD3A00CEF538 /* lastfm@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "lastfm@2x.png"; path = "Icons/lastfm@2x.png"; sourceTree = ""; }; @@ -286,6 +289,8 @@ 83F27E711810E41A00CEF538 /* Transformers */ = { isa = PBXGroup; children = ( + 83F127A81DEE47E90010CB8F /* MIDIPluginFlavorTransformer.m */, + 83F127A91DEE47E90010CB8F /* MIDIPluginFlavorTransformer.h */, 83F27E721810E45D00CEF538 /* PathToFileTransformer.h */, 83F27E731810E45D00CEF538 /* PathToFileTransformer.m */, ); @@ -437,6 +442,7 @@ 17C643380B8A77CC00C53518 /* OutputsArrayController.m in Sources */, 837C0D401C50954000CAE18F /* MIDIPluginBehaviorArrayController.m in Sources */, 17C6433F0B8A783F00C53518 /* OutputPane.m in Sources */, + 83F127AA1DEE47E90010CB8F /* MIDIPluginFlavorTransformer.m in Sources */, 170744AD0BFF3938002475C9 /* AppcastArrayController.m in Sources */, 99F1813F0DE01D7A00FD5FFB /* PlaylistBehaviorArrayController.m in Sources */, 8372053718E3DEAF007EFAD4 /* ResamplerBehaviorArrayController.m in Sources */, diff --git a/Preferences/General/GeneralPreferencesPlugin.m b/Preferences/General/GeneralPreferencesPlugin.m index bfe3956f9..90d022cfc 100644 --- a/Preferences/General/GeneralPreferencesPlugin.m +++ b/Preferences/General/GeneralPreferencesPlugin.m @@ -8,6 +8,7 @@ #import "GeneralPreferencesPlugin.h" #import "PathToFileTransformer.h" +#import "MIDIPluginFlavorTransformer.h" @implementation GeneralPreferencesPlugin @@ -16,6 +17,9 @@ NSValueTransformer *pathToFileTransformer = [[PathToFileTransformer alloc] init]; [NSValueTransformer setValueTransformer:pathToFileTransformer forName:@"PathToFileTransformer"]; + NSValueTransformer *midiPluginFlavorTransformer = [[MIDIPluginFlavorTransformer alloc] init]; + [NSValueTransformer setValueTransformer:midiPluginFlavorTransformer + forName:@"MIDIPluginFlavorTransformer"]; } + (NSArray *)preferencePanes diff --git a/Preferences/General/MIDIFlavorBehaviorArrayController.m b/Preferences/General/MIDIFlavorBehaviorArrayController.m index 2c6d99259..19fe157ae 100644 --- a/Preferences/General/MIDIFlavorBehaviorArrayController.m +++ b/Preferences/General/MIDIFlavorBehaviorArrayController.m @@ -13,6 +13,10 @@ { [self removeObjects:[self arrangedObjects]]; + [self addObject: + [NSDictionary dictionaryWithObjectsAndKeys: + @"Default (auto)", @"name", @"default", @"preference", nil]]; + [self addObject: [NSDictionary dictionaryWithObjectsAndKeys: @"General MIDI", @"name", @"gm", @"preference", nil]]; diff --git a/Preferences/General/MIDIPane.h b/Preferences/General/MIDIPane.h index 7ddadb338..ea2a541b4 100644 --- a/Preferences/General/MIDIPane.h +++ b/Preferences/General/MIDIPane.h @@ -14,6 +14,5 @@ } - (IBAction)setSoundFont:(id)sender; -- (IBAction)setMidiPlugin:(id)sender; @end diff --git a/Preferences/General/MIDIPane.m b/Preferences/General/MIDIPane.m index e5dc98a4c..36c857cd2 100644 --- a/Preferences/General/MIDIPane.m +++ b/Preferences/General/MIDIPane.m @@ -10,12 +10,6 @@ @implementation MIDIPane -- (void)awakeFromNib -{ - if ([[[NSUserDefaults standardUserDefaults] stringForKey:@"midi.plugin"] isEqualToString:@"Sc55rolD"]) - [midiFlavorControl setEnabled:YES]; -} - - (NSString *)title { return NSLocalizedStringFromTableInBundle(@"Synthesis", nil, [NSBundle bundleForClass:[self class]], @""); diff --git a/Preferences/General/MIDIPluginFlavorTransformer.h b/Preferences/General/MIDIPluginFlavorTransformer.h new file mode 100644 index 000000000..5262bd568 --- /dev/null +++ b/Preferences/General/MIDIPluginFlavorTransformer.h @@ -0,0 +1,13 @@ +// +// PathToFileTransformer.h +// General +// +// Created by Christopher Snowhill on 11/29/16. +// +// + +#import + +@interface MIDIPluginFlavorTransformer : NSValueTransformer + +@end diff --git a/Preferences/General/MIDIPluginFlavorTransformer.m b/Preferences/General/MIDIPluginFlavorTransformer.m new file mode 100644 index 000000000..d0a3f9cc1 --- /dev/null +++ b/Preferences/General/MIDIPluginFlavorTransformer.m @@ -0,0 +1,22 @@ +// +// PathToFileTransformer.m +// General +// +// Created by Christopher Snowhill on 11/29/16. +// +// + +#import "MIDIPluginFlavorTransformer.h" + +@implementation MIDIPluginFlavorTransformer + ++ (Class)transformedValueClass { return [NSNumber class]; } ++ (BOOL)allowsReverseTransformation { return NO; } + +// Convert from string to NSURL +- (id)transformedValue:(id)value { + if (value == nil) return nil; + + return [NSNumber numberWithBool:[value isEqualToString:@"Sc55rolD"]]; +} +@end diff --git a/Preferences/General/es.lproj/Preferences.xib b/Preferences/General/es.lproj/Preferences.xib index ee7dd7156..af68300f7 100644 --- a/Preferences/General/es.lproj/Preferences.xib +++ b/Preferences/General/es.lproj/Preferences.xib @@ -1,8 +1,9 @@ - - + + - + + @@ -453,7 +454,7 @@ - + @@ -527,7 +528,6 @@ - @@ -546,12 +546,12 @@ - + - + - + @@ -561,6 +561,11 @@ + + + MIDIPluginFlavorTransformer + +