summaryrefslogtreecommitdiff
path: root/macosx/plugins/DFSound/macsrc
diff options
context:
space:
mode:
authorSND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2009-11-01 05:53:44 +0000
committerSND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2009-11-01 05:53:44 +0000
commit161fa8af66c57aa6c29f6efa415322b36798ef8f (patch)
tree4ff350370c8fcaac99c808822c57a1a1d30eef0b /macosx/plugins/DFSound/macsrc
parent8549d0c54350ee4b08e979c4712f313aba58ff3f (diff)
downloadpcsxr-161fa8af66c57aa6c29f6efa415322b36798ef8f.tar.gz
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@34480 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'macosx/plugins/DFSound/macsrc')
-rw-r--r--macosx/plugins/DFSound/macsrc/NamedSlider.h13
-rw-r--r--macosx/plugins/DFSound/macsrc/NamedSlider.m33
-rw-r--r--macosx/plugins/DFSound/macsrc/PluginController.h29
-rw-r--r--macosx/plugins/DFSound/macsrc/PluginController.m162
4 files changed, 237 insertions, 0 deletions
diff --git a/macosx/plugins/DFSound/macsrc/NamedSlider.h b/macosx/plugins/DFSound/macsrc/NamedSlider.h
new file mode 100644
index 00000000..c5a40aa0
--- /dev/null
+++ b/macosx/plugins/DFSound/macsrc/NamedSlider.h
@@ -0,0 +1,13 @@
+/* NetSfPeopsSPUPluginNamedSlider */
+
+#import <Cocoa/Cocoa.h>
+
+#define NamedSlider NetSfPeopsSPUPluginNamedSlider
+
+@interface NamedSlider : NSSlider
+{
+ NSArray *strings;
+}
+
+- (void)setStrings:(NSArray *)theStrings;
+@end
diff --git a/macosx/plugins/DFSound/macsrc/NamedSlider.m b/macosx/plugins/DFSound/macsrc/NamedSlider.m
new file mode 100644
index 00000000..fd07780a
--- /dev/null
+++ b/macosx/plugins/DFSound/macsrc/NamedSlider.m
@@ -0,0 +1,33 @@
+#import "NamedSlider.h"
+
+@implementation NamedSlider
+
+- (void)dealloc
+{
+ [strings release];
+ [super dealloc];
+}
+
+- (void)setStrings:(NSArray *)theStrings
+{
+ [strings release];
+ strings = [theStrings retain];
+}
+
+- (NSString *)stringValue
+{
+ int index = [self intValue];
+
+ if (index >= 0 && index < [strings count])
+ return [strings objectAtIndex:index];
+
+ return @"(Unknown)";
+}
+
+- (void)setIntValue:(int)value
+{
+ [super setIntValue:value];
+ [self sendAction:[self action] to:[self target]];
+}
+
+@end
diff --git a/macosx/plugins/DFSound/macsrc/PluginController.h b/macosx/plugins/DFSound/macsrc/PluginController.h
new file mode 100644
index 00000000..36373b1d
--- /dev/null
+++ b/macosx/plugins/DFSound/macsrc/PluginController.h
@@ -0,0 +1,29 @@
+/* NetSfPeopsSPUPluginController */
+
+#import <Cocoa/Cocoa.h>
+#import "NamedSlider.h"
+
+void DoAbout();
+long DoConfiguration();
+void LoadConfiguration();
+
+#define PluginController NetSfPeopsSPUPluginController
+
+@interface PluginController : NSWindowController
+{
+ IBOutlet NSControl *hiCompBox;
+ IBOutlet NetSfPeopsSPUPluginNamedSlider *interpolValue;
+ IBOutlet NSControl *irqWaitBox;
+ IBOutlet NSControl *monoSoundBox;
+ IBOutlet NetSfPeopsSPUPluginNamedSlider *reverbValue;
+ IBOutlet NSControl *xaEnableBox;
+ IBOutlet NSControl *xaSpeedBox;
+
+ NSMutableDictionary *keyValues;
+}
+- (IBAction)cancel:(id)sender;
+- (IBAction)ok:(id)sender;
+- (IBAction)reset:(id)sender;
+
+- (void)loadValues;
+@end
diff --git a/macosx/plugins/DFSound/macsrc/PluginController.m b/macosx/plugins/DFSound/macsrc/PluginController.m
new file mode 100644
index 00000000..f7a8221a
--- /dev/null
+++ b/macosx/plugins/DFSound/macsrc/PluginController.m
@@ -0,0 +1,162 @@
+#import "PluginController.h"
+#include "stdafx.h"
+#include "externals.h"
+
+#define APP_ID @"net.sf.peops.SPUPlugin"
+#define PrefsKey APP_ID @" Settings"
+
+static PluginController *pluginController;
+char * pConfigFile=NULL;
+
+void DoAbout()
+{
+ // Get parent application instance
+ NSApplication *app = [NSApplication sharedApplication];
+ NSBundle *bundle = [NSBundle bundleWithIdentifier:APP_ID];
+
+ // Get Credits.rtf
+ NSString *path = [bundle pathForResource:@"Credits" ofType:@"rtf"];
+ NSAttributedString *credits;
+ if (path) {
+ credits = [[[NSAttributedString alloc] initWithPath: path
+ documentAttributes:NULL] autorelease];
+ } else {
+ credits = [[[NSAttributedString alloc] initWithString:@""] autorelease];
+ }
+
+ // Get Application Icon
+ NSImage *icon = [[NSWorkspace sharedWorkspace] iconForFile:[bundle bundlePath]];
+ NSSize size = NSMakeSize(64, 64);
+ [icon setSize:size];
+
+ [app orderFrontStandardAboutPanelWithOptions:[NSDictionary dictionaryWithObjectsAndKeys:
+ [bundle objectForInfoDictionaryKey:@"CFBundleName"], @"ApplicationName",
+ icon, @"ApplicationIcon",
+ [bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"], @"ApplicationVersion",
+ [bundle objectForInfoDictionaryKey:@"CFBundleVersion"], @"Version",
+ [bundle objectForInfoDictionaryKey:@"NSHumanReadableCopyright"], @"Copyright",
+ credits, @"Credits",
+ nil]];
+}
+
+
+long DoConfiguration()
+{
+ NSWindow *window;
+
+ if (pluginController == nil) {
+ pluginController = [[PluginController alloc] initWithWindowNibName:@"NetSfPeopsSpuPluginMain"];
+ }
+ window = [pluginController window];
+
+ /* load values */
+ [pluginController loadValues];
+
+ [window center];
+ [window makeKeyAndOrderFront:nil];
+
+ return 0;
+}
+
+void ReadConfig(void)
+{
+ NSDictionary *keyValues;
+ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+ [defaults registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys:
+ [[NSMutableDictionary alloc] initWithObjectsAndKeys:
+ [NSNumber numberWithBool:YES], @"High Compatibility Mode",
+ [NSNumber numberWithBool:YES], @"SPU IRQ Wait",
+ [NSNumber numberWithBool:YES], @"Enable XA",
+ [NSNumber numberWithBool:NO], @"XA Pitch",
+ //[NSNumber numberWithBool:YES], @"Decoded Buffer IRQ",
+ [NSNumber numberWithInt:0], @"Interpolation Quality",
+ [NSNumber numberWithInt:1], @"Reverb Quality",
+ nil], PrefsKey,
+ nil]];
+
+ keyValues = [defaults dictionaryForKey:PrefsKey];
+
+ iUseTimer = [[keyValues objectForKey:@"High Compatibility Mode"] boolValue] ? 2 : 0;
+ iSPUIRQWait = [[keyValues objectForKey:@"SPU IRQ Wait"] boolValue];
+ iDisStereo = [[keyValues objectForKey:@"Mono Sound Output"] boolValue];
+ iXAPitch = [[keyValues objectForKey:@"XA Pitch"] boolValue];
+
+ iUseInterpolation = [[keyValues objectForKey:@"Interpolation Quality"] intValue];
+ iUseReverb = [[keyValues objectForKey:@"Reverb Quality"] intValue];
+
+ iVolume=1;
+}
+
+@implementation PluginController
+
+- (IBAction)cancel:(id)sender
+{
+ [self close];
+}
+
+- (IBAction)ok:(id)sender
+{
+ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+
+ NSMutableDictionary *writeDic = [NSMutableDictionary dictionaryWithDictionary:keyValues];
+ [writeDic setObject:[NSNumber numberWithInt:[hiCompBox intValue]] forKey:@"High Compatibility Mode"];
+ [writeDic setObject:[NSNumber numberWithInt:[irqWaitBox intValue]] forKey:@"SPU IRQ Wait"];
+ [writeDic setObject:[NSNumber numberWithInt:[monoSoundBox intValue]] forKey:@"Mono Sound Output"];
+ [writeDic setObject:[NSNumber numberWithInt:[xaSpeedBox intValue]] forKey:@"XA Pitch"];
+
+ [writeDic setObject:[NSNumber numberWithInt:[interpolValue intValue]] forKey:@"Interpolation Quality"];
+ [writeDic setObject:[NSNumber numberWithInt:[reverbValue intValue]] forKey:@"Reverb Quality"];
+
+ // write to defaults
+ [defaults setObject:writeDic forKey:PrefsKey];
+ [defaults synchronize];
+
+ // and set global values accordingly
+ ReadConfig();
+
+ [self close];
+}
+
+- (IBAction)reset:(id)sender
+{
+ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+ [defaults removeObjectForKey:PrefsKey];
+ [self loadValues];
+}
+
+- (void)loadValues
+{
+ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+
+ ReadConfig();
+
+ /* load from preferences */
+ [keyValues release];
+ keyValues = [[defaults dictionaryForKey:PrefsKey] retain];
+
+ [hiCompBox setIntValue:[[keyValues objectForKey:@"High Compatibility Mode"] intValue]];
+ [irqWaitBox setIntValue:[[keyValues objectForKey:@"SPU IRQ Wait"] intValue]];
+ [monoSoundBox setIntValue:[[keyValues objectForKey:@"Mono Sound Output"] intValue]];
+ [xaSpeedBox setIntValue:[[keyValues objectForKey:@"XA Pitch"] intValue]];
+
+ [interpolValue setIntValue:[[keyValues objectForKey:@"Interpolation Quality"] intValue]];
+ [reverbValue setIntValue:[[keyValues objectForKey:@"Reverb Quality"] intValue]];
+}
+
+- (void)awakeFromNib
+{
+ [interpolValue setStrings:[NSArray arrayWithObjects:
+ @"(No Interpolation)",
+ @"(Simple Interpolation)",
+ @"(Gaussian Interpolation)",
+ @"(Cubic Interpolation)",
+ nil]];
+
+ [reverbValue setStrings:[NSArray arrayWithObjects:
+ @"(No Reverb)",
+ @"(Simple Reverb)",
+ @"(PSX Reverb)",
+ nil]];
+}
+
+@end