From e306359cc457dfbe5200e6485596e9c9901aae19 Mon Sep 17 00:00:00 2001 From: "SND\\weimingzhi_cp" Date: Tue, 22 Feb 2011 02:03:02 +0000 Subject: -dfsound (macosx): added volume adjustment/muting support. -peopsxgl (macosx): removed powerpc from deployment configuration as the plugin is not big-endian compatible. git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@63687 e17a0e51-4ae3-4d35-97c3-1a29b211df97 --- macosx/Plugin.c | 14 +--- .../DFSound/English.lproj/InfoPlist.strings | Bin 538 -> 526 bytes .../NetSfPeopsSpuPluginMain.nib/classes.nib | 1 + .../NetSfPeopsSpuPluginMain.nib/info.nib | 4 +- .../NetSfPeopsSpuPluginMain.nib/keyedobjects.nib | Bin 10993 -> 11559 bytes macosx/plugins/DFSound/macsrc/NamedSlider.m | 4 +- macosx/plugins/DFSound/macsrc/PluginController.h | 5 +- macosx/plugins/DFSound/macsrc/PluginController.m | 34 +++++--- .../PeopsXgl/PeopsXGL.xcodeproj/project.pbxproj | 5 +- plugins/dfsound/spu.c | 93 ++++++++++----------- 10 files changed, 78 insertions(+), 82 deletions(-) diff --git a/macosx/Plugin.c b/macosx/Plugin.c index 9b83da68..73769a7f 100644 --- a/macosx/Plugin.c +++ b/macosx/Plugin.c @@ -69,28 +69,16 @@ void SPUirq(void); } int _OpenPlugins() { - static char path[1024]; - CFURLRef pathUrl; int ret; - //signal(SIGINT, SignalExit); - //signal(SIGPIPE, SignalExit); - GPU_clearDynarec(clearDynarec); - pathUrl = CFBundleCopyResourceURL(CFBundleGetMainBundle(), CFSTR("gpuPeopsSoftX.cfg"), NULL, NULL); - if (pathUrl) - { - CFURLGetFileSystemRepresentation(pathUrl, true, path, 1024); - CFRelease(pathUrl); - } - ret = CDR_open(); if (ret < 0) { SysMessage(_("Error Opening CDR Plugin")); return -1; } ret = SPU_open(); if (ret < 0) { SysMessage(_("Error Opening SPU Plugin")); return -1; } SPU_registerCallback(SPUirq); - ret = GPU_open(&gpuDisp, "PCSX", /*pathUrl ? path :*/ NULL); + ret = GPU_open(&gpuDisp, "PCSX", NULL); if (ret < 0) { SysMessage(_("Error Opening GPU Plugin")); return -1; } GPU_registerCallback(GPUbusy); ret = PAD1_open(&gpuDisp); diff --git a/macosx/plugins/DFSound/English.lproj/InfoPlist.strings b/macosx/plugins/DFSound/English.lproj/InfoPlist.strings index 6c79d9c8..d4f51d87 100755 Binary files a/macosx/plugins/DFSound/English.lproj/InfoPlist.strings and b/macosx/plugins/DFSound/English.lproj/InfoPlist.strings differ diff --git a/macosx/plugins/DFSound/English.lproj/NetSfPeopsSpuPluginMain.nib/classes.nib b/macosx/plugins/DFSound/English.lproj/NetSfPeopsSpuPluginMain.nib/classes.nib index ab65672a..161b8f0c 100644 --- a/macosx/plugins/DFSound/English.lproj/NetSfPeopsSpuPluginMain.nib/classes.nib +++ b/macosx/plugins/DFSound/English.lproj/NetSfPeopsSpuPluginMain.nib/classes.nib @@ -11,6 +11,7 @@ irqWaitBox = NetSfPeopsSPUPluginNamedSlider; monoSoundBox = NSControl; reverbValue = NSControl; + volumeValue = NSControl; xaSpeedBox = NSControl; }; SUPERCLASS = NSWindowController; diff --git a/macosx/plugins/DFSound/English.lproj/NetSfPeopsSpuPluginMain.nib/info.nib b/macosx/plugins/DFSound/English.lproj/NetSfPeopsSpuPluginMain.nib/info.nib index a4d8dd8c..27b0ed6d 100644 --- a/macosx/plugins/DFSound/English.lproj/NetSfPeopsSpuPluginMain.nib/info.nib +++ b/macosx/plugins/DFSound/English.lproj/NetSfPeopsSpuPluginMain.nib/info.nib @@ -5,12 +5,12 @@ IBDocumentLocation 42 12 546 240 0 0 1024 746 IBFramework Version - 446.1 + 442.0 IBOpenObjects 6 IBSystem Version - 8P2137 + 8F1099 diff --git a/macosx/plugins/DFSound/English.lproj/NetSfPeopsSpuPluginMain.nib/keyedobjects.nib b/macosx/plugins/DFSound/English.lproj/NetSfPeopsSpuPluginMain.nib/keyedobjects.nib index d56d7754..a158c1ae 100755 Binary files a/macosx/plugins/DFSound/English.lproj/NetSfPeopsSpuPluginMain.nib/keyedobjects.nib and b/macosx/plugins/DFSound/English.lproj/NetSfPeopsSpuPluginMain.nib/keyedobjects.nib differ diff --git a/macosx/plugins/DFSound/macsrc/NamedSlider.m b/macosx/plugins/DFSound/macsrc/NamedSlider.m index fd07780a..0196a168 100644 --- a/macosx/plugins/DFSound/macsrc/NamedSlider.m +++ b/macosx/plugins/DFSound/macsrc/NamedSlider.m @@ -17,10 +17,10 @@ - (NSString *)stringValue { int index = [self intValue]; - + if (index >= 0 && index < [strings count]) return [strings objectAtIndex:index]; - + return @"(Unknown)"; } diff --git a/macosx/plugins/DFSound/macsrc/PluginController.h b/macosx/plugins/DFSound/macsrc/PluginController.h index 36373b1d..804108c5 100644 --- a/macosx/plugins/DFSound/macsrc/PluginController.h +++ b/macosx/plugins/DFSound/macsrc/PluginController.h @@ -18,8 +18,9 @@ void LoadConfiguration(); IBOutlet NetSfPeopsSPUPluginNamedSlider *reverbValue; IBOutlet NSControl *xaEnableBox; IBOutlet NSControl *xaSpeedBox; - - NSMutableDictionary *keyValues; + IBOutlet NetSfPeopsSPUPluginNamedSlider *volumeValue; + + NSMutableDictionary *keyValues; } - (IBAction)cancel:(id)sender; - (IBAction)ok:(id)sender; diff --git a/macosx/plugins/DFSound/macsrc/PluginController.m b/macosx/plugins/DFSound/macsrc/PluginController.m index ec671f70..19b30134 100644 --- a/macosx/plugins/DFSound/macsrc/PluginController.m +++ b/macosx/plugins/DFSound/macsrc/PluginController.m @@ -48,13 +48,13 @@ long DoConfiguration() pluginController = [[PluginController alloc] initWithWindowNibName:@"NetSfPeopsSpuPluginMain"]; } window = [pluginController window]; - + /* load values */ [pluginController loadValues]; - + [window center]; [window makeKeyAndOrderFront:nil]; - + return 0; } @@ -69,6 +69,7 @@ void ReadConfig(void) [NSNumber numberWithBool:NO], @"XA Pitch", [NSNumber numberWithInt:0], @"Interpolation Quality", [NSNumber numberWithInt:1], @"Reverb Quality", + [NSNumber numberWithInt:3], @"Volume", nil], PrefsKey, nil]]; @@ -82,7 +83,7 @@ void ReadConfig(void) iUseInterpolation = [[keyValues objectForKey:@"Interpolation Quality"] intValue]; iUseReverb = [[keyValues objectForKey:@"Reverb Quality"] intValue]; - iVolume=1; + iVolume = 5 - [[keyValues objectForKey:@"Volume"] intValue]; } @implementation PluginController @@ -95,7 +96,7 @@ void ReadConfig(void) - (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"]; @@ -104,14 +105,16 @@ void ReadConfig(void) [writeDic setObject:[NSNumber numberWithInt:[interpolValue intValue]] forKey:@"Interpolation Quality"]; [writeDic setObject:[NSNumber numberWithInt:[reverbValue intValue]] forKey:@"Reverb Quality"]; - + + [writeDic setObject:[NSNumber numberWithInt:[volumeValue intValue]] forKey:@"Volume"]; + // write to defaults [defaults setObject:writeDic forKey:PrefsKey]; [defaults synchronize]; - + // and set global values accordingly ReadConfig(); - + [self close]; } @@ -125,13 +128,13 @@ void ReadConfig(void) - (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]]; @@ -139,6 +142,7 @@ void ReadConfig(void) [interpolValue setIntValue:[[keyValues objectForKey:@"Interpolation Quality"] intValue]]; [reverbValue setIntValue:[[keyValues objectForKey:@"Reverb Quality"] intValue]]; + [volumeValue setIntValue:[[keyValues objectForKey:@"Volume"] intValue]]; } - (void)awakeFromNib @@ -155,6 +159,14 @@ void ReadConfig(void) @"(Simple Reverb)", @"(PSX Reverb)", nil]]; + + [volumeValue setStrings:[NSArray arrayWithObjects: + @"(Muted)", + @"(Low)", + @"(Medium)", + @"(Loud)", + @"(Loudest)", + nil]]; } @end diff --git a/macosx/plugins/PeopsXgl/PeopsXGL.xcodeproj/project.pbxproj b/macosx/plugins/PeopsXgl/PeopsXGL.xcodeproj/project.pbxproj index 6bd33cca..a51e57e7 100644 --- a/macosx/plugins/PeopsXgl/PeopsXGL.xcodeproj/project.pbxproj +++ b/macosx/plugins/PeopsXgl/PeopsXGL.xcodeproj/project.pbxproj @@ -396,10 +396,7 @@ 717084330FDFD328004F3EB4 /* Deployment */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = ( - i386, - ppc, - ); + ARCHS = i386; GCC_ENABLE_SSE3_EXTENSIONS = YES; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_MODEL_TUNING = ""; diff --git a/plugins/dfsound/spu.c b/plugins/dfsound/spu.c index 3a37f7c5..f263cb8f 100644 --- a/plugins/dfsound/spu.c +++ b/plugins/dfsound/spu.c @@ -527,11 +527,8 @@ static void *MAINThread(void *arg) #endif { int s_1,s_2,fa,ns; -#ifndef _MACOSX int voldiv = iVolume; -#else - int voldiv = 2; -#endif + unsigned char * start;unsigned int nSample; int ch,predict_nr,shift_factor,flags,d,s; int bIRQReturn=0; @@ -596,18 +593,18 @@ static void *MAINThread(void *arg) for(ch=0;ch=0x10000L) { if(s_chan[ch].iSBPos==28) // 28 reached? - { -#if 0 - // Xenogears - Anima Relic dungeon (exp gain) - if( s_chan[ch].bLoopJump == 1 ) - s_chan[ch].pCurr = s_chan[ch].pLoop; - - s_chan[ch].bLoopJump = 0; + { +#if 0 + // Xenogears - Anima Relic dungeon (exp gain) + if( s_chan[ch].bLoopJump == 1 ) + s_chan[ch].pCurr = s_chan[ch].pLoop; + + s_chan[ch].bLoopJump = 0; #endif - - + + start=s_chan[ch].pCurr; // set up the current pos if (s_chan[ch].iSilent==1 || start == (unsigned char*)-1) // special "stop" sign @@ -652,7 +649,7 @@ static void *MAINThread(void *arg) predict_nr=(int)*start;start++; shift_factor=predict_nr&0xf; predict_nr >>= 4; - flags=(int)*start;start++; + flags=(int)*start;start++; // -------------------------------------- // @@ -708,15 +705,15 @@ static void *MAINThread(void *arg) silence means no volume (ADSR keeps playing!!) */ - -#if 0 - if(flags&4) - s_chan[ch].pLoop=start-16; + +#if 0 + if(flags&4) + s_chan[ch].pLoop=start-16; #else // Jungle Book - Rhythm 'n Groove - use external loop address // - fixes music player (+IRQ generate) if((flags&4) && (s_chan[ch].bIgnoreLoop == 0)) - s_chan[ch].pLoop=start-16; + s_chan[ch].pLoop=start-16; #endif // Jungle Book - Rhythm 'n Groove - don't reset ignore status @@ -729,12 +726,12 @@ static void *MAINThread(void *arg) // ...? //s_chan[ch].bIgnoreLoop = 0; - // Xenogears - 7 = play missing sounds -#if 0 - // set jump flag - pChannel->bLoopJump = 1; + // Xenogears - 7 = play missing sounds +#if 0 + // set jump flag + pChannel->bLoopJump = 1; #else - start = s_chan[ch].pLoop; + start = s_chan[ch].pLoop; #endif // silence = keep playing..? @@ -801,17 +798,17 @@ GOON: ; if(s_chan[ch].bNoise) fa=iGetNoiseVal(ch); // get noise val else fa=iGetInterpolationVal(ch); // get sample val - - -#if 0 - // Voice 1/3 decoded buffer - if( ch == 0 ) { - spuMem[ (0x800 + voice_dbuf_ptr) / 2 ] = (short) fa; - } else if( ch == 2 ) { - spuMem[ (0xc00 + voice_dbuf_ptr) / 2 ] = (short) fa; - } -#endif - + + +#if 0 + // Voice 1/3 decoded buffer + if( ch == 0 ) { + spuMem[ (0x800 + voice_dbuf_ptr) / 2 ] = (short) fa; + } else if( ch == 2 ) { + spuMem[ (0xc00 + voice_dbuf_ptr) / 2 ] = (short) fa; + } +#endif + s_chan[ch].sval = (MixADSR(ch) * fa) / 1023; // mix adsr @@ -1044,7 +1041,7 @@ void CALLBACK SPUasync(unsigned long cycle) if(iUseTimer==2) // special mode, only used in Linux by this spu (or if you enable the experimental Windows mode) { if(!bSpuInit) return; // -> no init, no call - + // note: usable precision difference (not using interval_time) while( cpu_cycles >= CPU_CLOCK / 44100 * NSSIZE ) { -- cgit v1.2.3