- Change MIDI overrides to support 'default (auto)' mode
- Change MIDI flavor default to 'default (auto)' - Fix MIDI preference page to correctly enable the flavor option only where applicable - Fix SCVA player to reset existing instances reliably
This commit is contained in:
parent
af69cd53c3
commit
ebfcd03c5d
13 changed files with 106 additions and 31 deletions
|
@ -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];
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11129.15" systemVersion="15F34" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11542" systemVersion="16B2657" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<development version="7000" identifier="xcode"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11129.15"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11542"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="GeneralPreferencesPlugin">
|
||||
|
@ -454,7 +454,7 @@
|
|||
</button>
|
||||
</subviews>
|
||||
</customView>
|
||||
<customView id="JXu-ar-J3Y" userLabel="MIDIView">
|
||||
<customView wantsLayer="YES" id="JXu-ar-J3Y" userLabel="MIDIView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="500" height="137"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<subviews>
|
||||
|
@ -528,7 +528,6 @@
|
|||
</menu>
|
||||
</popUpButtonCell>
|
||||
<connections>
|
||||
<action selector="setMidiPlugin:" target="i5B-ga-Atm" id="8Nt-Z0-LvI"/>
|
||||
<binding destination="czk-eG-6QG" name="content" keyPath="arrangedObjects" id="Mzg-yr-6mv"/>
|
||||
<binding destination="czk-eG-6QG" name="contentValues" keyPath="arrangedObjects.name" previousBinding="NFp-di-hMf" id="6JE-ba-47Z"/>
|
||||
<binding destination="czk-eG-6QG" name="contentObjects" keyPath="arrangedObjects.preference" previousBinding="Mzg-yr-6mv" id="NFp-di-hMf"/>
|
||||
|
@ -547,12 +546,12 @@
|
|||
<popUpButton verticalHuggingPriority="750" id="1Yw-25-Gbs">
|
||||
<rect key="frame" x="173" y="17" width="164" height="26"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<popUpButtonCell key="cell" type="push" title="Item 1" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" enabled="NO" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="XzK-h2-vIT" id="qzt-Ox-taI">
|
||||
<popUpButtonCell key="cell" type="push" title="Item 1" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" enabled="NO" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" autoenablesItems="NO" altersStateOfSelectedItem="NO" selectedItem="XzK-h2-vIT" id="qzt-Ox-taI">
|
||||
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="menu"/>
|
||||
<menu key="menu" id="q1g-E5-NwQ">
|
||||
<menu key="menu" autoenablesItems="NO" id="q1g-E5-NwQ">
|
||||
<items>
|
||||
<menuItem title="Item 1" state="on" id="XzK-h2-vIT"/>
|
||||
<menuItem title="Item 1" id="XzK-h2-vIT"/>
|
||||
<menuItem title="Item 2" id="nzS-3F-jPX"/>
|
||||
<menuItem title="Item 3" id="jLL-zc-kYf"/>
|
||||
</items>
|
||||
|
@ -562,6 +561,11 @@
|
|||
<binding destination="KAn-H1-QH6" name="content" keyPath="arrangedObjects" id="Zvj-Wf-Bum"/>
|
||||
<binding destination="KAn-H1-QH6" name="contentValues" keyPath="arrangedObjects.name" previousBinding="WGj-w1-erz" id="Rvq-46-YeR"/>
|
||||
<binding destination="KAn-H1-QH6" name="contentObjects" keyPath="arrangedObjects.preference" previousBinding="Zvj-Wf-Bum" id="WGj-w1-erz"/>
|
||||
<binding destination="52" name="enabled" keyPath="values.midi.plugin" id="GlZ-Ch-oua">
|
||||
<dictionary key="options">
|
||||
<string key="NSValueTransformerName">MIDIPluginFlavorTransformer</string>
|
||||
</dictionary>
|
||||
</binding>
|
||||
<binding destination="52" name="selectedObject" keyPath="values.midi.flavor" previousBinding="Rvq-46-YeR" id="zC1-3J-frL"/>
|
||||
</connections>
|
||||
</popUpButton>
|
||||
|
|
|
@ -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 = "<group>"; };
|
||||
83EF495D17FBC96A00642E3C /* VolumeBehaviorArrayController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VolumeBehaviorArrayController.h; sourceTree = "<group>"; };
|
||||
83EF495E17FBC96A00642E3C /* VolumeBehaviorArrayController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VolumeBehaviorArrayController.m; sourceTree = "<group>"; };
|
||||
83F127A81DEE47E90010CB8F /* MIDIPluginFlavorTransformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MIDIPluginFlavorTransformer.m; sourceTree = "<group>"; };
|
||||
83F127A91DEE47E90010CB8F /* MIDIPluginFlavorTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MIDIPluginFlavorTransformer.h; sourceTree = "<group>"; };
|
||||
83F27E651810DD3A00CEF538 /* appearance@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "appearance@2x.png"; path = "Icons/appearance@2x.png"; sourceTree = "<group>"; };
|
||||
83F27E661810DD3A00CEF538 /* growl@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "growl@2x.png"; path = "Icons/growl@2x.png"; sourceTree = "<group>"; };
|
||||
83F27E671810DD3A00CEF538 /* lastfm@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "lastfm@2x.png"; path = "Icons/lastfm@2x.png"; sourceTree = "<group>"; };
|
||||
|
@ -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 */,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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]];
|
||||
|
|
|
@ -14,6 +14,5 @@
|
|||
}
|
||||
|
||||
- (IBAction)setSoundFont:(id)sender;
|
||||
- (IBAction)setMidiPlugin:(id)sender;
|
||||
|
||||
@end
|
||||
|
|
|
@ -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]], @"");
|
||||
|
|
13
Preferences/General/MIDIPluginFlavorTransformer.h
Normal file
13
Preferences/General/MIDIPluginFlavorTransformer.h
Normal file
|
@ -0,0 +1,13 @@
|
|||
//
|
||||
// PathToFileTransformer.h
|
||||
// General
|
||||
//
|
||||
// Created by Christopher Snowhill on 11/29/16.
|
||||
//
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface MIDIPluginFlavorTransformer : NSValueTransformer
|
||||
|
||||
@end
|
22
Preferences/General/MIDIPluginFlavorTransformer.m
Normal file
22
Preferences/General/MIDIPluginFlavorTransformer.m
Normal file
|
@ -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
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11129.15" systemVersion="15F34" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11542" systemVersion="16B2657" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11129.15"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11542"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="GeneralPreferencesPlugin">
|
||||
|
@ -453,7 +454,7 @@
|
|||
</button>
|
||||
</subviews>
|
||||
</customView>
|
||||
<customView id="JXu-ar-J3Y" userLabel="MIDIView">
|
||||
<customView wantsLayer="YES" id="JXu-ar-J3Y" userLabel="MIDIView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="500" height="137"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<subviews>
|
||||
|
@ -527,7 +528,6 @@
|
|||
</menu>
|
||||
</popUpButtonCell>
|
||||
<connections>
|
||||
<action selector="setMidiPlugin:" target="i5B-ga-Atm" id="8Nt-Z0-LvI"/>
|
||||
<binding destination="czk-eG-6QG" name="content" keyPath="arrangedObjects" id="Mzg-yr-6mv"/>
|
||||
<binding destination="czk-eG-6QG" name="contentValues" keyPath="arrangedObjects.name" previousBinding="NFp-di-hMf" id="6JE-ba-47Z"/>
|
||||
<binding destination="czk-eG-6QG" name="contentObjects" keyPath="arrangedObjects.preference" previousBinding="Mzg-yr-6mv" id="NFp-di-hMf"/>
|
||||
|
@ -546,12 +546,12 @@
|
|||
<popUpButton verticalHuggingPriority="750" id="1Yw-25-Gbs">
|
||||
<rect key="frame" x="173" y="17" width="164" height="26"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<popUpButtonCell key="cell" type="push" title="Item 1" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" enabled="NO" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="XzK-h2-vIT" id="qzt-Ox-taI">
|
||||
<popUpButtonCell key="cell" type="push" title="Item 1" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" enabled="NO" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" autoenablesItems="NO" altersStateOfSelectedItem="NO" selectedItem="XzK-h2-vIT" id="qzt-Ox-taI">
|
||||
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="menu"/>
|
||||
<menu key="menu" id="q1g-E5-NwQ">
|
||||
<menu key="menu" autoenablesItems="NO" id="q1g-E5-NwQ">
|
||||
<items>
|
||||
<menuItem title="Item 1" state="on" id="XzK-h2-vIT"/>
|
||||
<menuItem title="Item 1" id="XzK-h2-vIT"/>
|
||||
<menuItem title="Item 2" id="nzS-3F-jPX"/>
|
||||
<menuItem title="Item 3" id="jLL-zc-kYf"/>
|
||||
</items>
|
||||
|
@ -561,6 +561,11 @@
|
|||
<binding destination="KAn-H1-QH6" name="content" keyPath="arrangedObjects" id="Zvj-Wf-Bum"/>
|
||||
<binding destination="KAn-H1-QH6" name="contentValues" keyPath="arrangedObjects.name" previousBinding="WGj-w1-erz" id="Rvq-46-YeR"/>
|
||||
<binding destination="KAn-H1-QH6" name="contentObjects" keyPath="arrangedObjects.preference" previousBinding="Zvj-Wf-Bum" id="WGj-w1-erz"/>
|
||||
<binding destination="52" name="enabled" keyPath="values.midi.plugin" id="GlZ-Ch-oua">
|
||||
<dictionary key="options">
|
||||
<string key="NSValueTransformerName">MIDIPluginFlavorTransformer</string>
|
||||
</dictionary>
|
||||
</binding>
|
||||
<binding destination="52" name="selectedObject" keyPath="values.midi.flavor" previousBinding="Rvq-46-YeR" id="zC1-3J-frL"/>
|
||||
</connections>
|
||||
</popUpButton>
|
||||
|
|
Loading…
Reference in a new issue