Added toggle to enable/disable audio output on OSX.

This commit is contained in:
Jean-Philip Desjardins 2016-04-11 18:24:01 -04:00
parent 94dbd3f199
commit d4e7906634
7 changed files with 94 additions and 1 deletions

View File

@ -97,6 +97,7 @@
[[PreferencesWindowController defaultController] show];
auto gs = g_virtualMachine->GetGSHandler();
if(gs != nullptr) gs->NotifyPreferencesChanged();
[self setupSoundHandler];
}
-(IBAction)bootElfMenuSelected: (id)sender

View File

@ -0,0 +1,8 @@
#import <Cocoa/Cocoa.h>
@interface AudioSettingsViewController : NSViewController
{
IBOutlet NSButton* enableAudioOutputCheckBox;
}
@end

View File

@ -0,0 +1,26 @@
#import "AudioSettingsViewController.h"
#include "../AppConfig.h"
#include "PreferenceDefs.h"
@implementation AudioSettingsViewController
-(id)init
{
if(self = [super initWithNibName: @"AudioSettingsView" bundle: nil])
{
}
return self;
}
-(void)viewWillAppear
{
[enableAudioOutputCheckBox setState: CAppConfig::GetInstance().GetPreferenceBoolean(PREFERENCE_AUDIO_ENABLEOUTPUT) ? NSOnState : NSOffState];
}
-(void)viewWillDisappear
{
CAppConfig::GetInstance().SetPreferenceBoolean(PREFERENCE_AUDIO_ENABLEOUTPUT, enableAudioOutputCheckBox.state == NSOnState);
}
@end

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10116" systemVersion="15E65" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10116"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="AudioSettingsViewController">
<connections>
<outlet property="enableAudioOutputCheckBox" destination="lXD-El-zxE" id="LCs-D0-afA"/>
<outlet property="view" destination="c22-O7-iKe" id="nN6-kY-QAY"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView id="c22-O7-iKe">
<rect key="frame" x="0.0" y="0.0" width="540" height="272"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="lXD-El-zxE">
<rect key="frame" x="18" y="236" width="444" height="18"/>
<buttonCell key="cell" type="check" title="Enable audio output" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="f6z-Ah-CJu">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
</subviews>
</customView>
</objects>
</document>

View File

@ -29,14 +29,20 @@
<action selector="onToolBarButtonPressed:" target="-2" id="WRg-Fb-U7b"/>
</connections>
</toolbarItem>
<toolbarItem implicitItemIdentifier="DAF19A38-1F2D-4A76-88CD-1B63B654A381" label="Filesystem" paletteLabel="Filesystem" tag="1" image="NSFolder" selectable="YES" id="SRE-jX-uO8">
<toolbarItem implicitItemIdentifier="DAF19A38-1F2D-4A76-88CD-1B63B654A381" label="Filesystem" paletteLabel="Filesystem" tag="2" image="NSFolder" selectable="YES" id="SRE-jX-uO8">
<connections>
<action selector="onToolBarButtonPressed:" target="-2" id="Gdx-Pv-X7f"/>
</connections>
</toolbarItem>
<toolbarItem implicitItemIdentifier="CE1785D1-3637-4FFC-AD90-38DB893A9234" label="Audio" paletteLabel="Audio" tag="1" image="NSComputer" selectable="YES" id="czM-Ls-onj">
<connections>
<action selector="onToolBarButtonPressed:" target="-2" id="F4b-ar-aNK"/>
</connections>
</toolbarItem>
</allowedToolbarItems>
<defaultToolbarItems>
<toolbarItem reference="rwX-i3-mrU"/>
<toolbarItem reference="czM-Ls-onj"/>
<toolbarItem reference="SRE-jX-uO8"/>
</defaultToolbarItems>
</toolbar>

View File

@ -1,6 +1,7 @@
#import <Foundation/Foundation.h>
#import "PreferencesWindowController.h"
#import "VideoSettingsViewController.h"
#import "AudioSettingsViewController.h"
#import "VfsManagerViewController.h"
#include "../AppConfig.h"
@ -49,6 +50,9 @@ static PreferencesWindowController* g_sharedInstance = nil;
currentViewController = [[VideoSettingsViewController alloc] init];
break;
case 1:
currentViewController = [[AudioSettingsViewController alloc] init];
break;
case 2:
currentViewController = [[VfsManagerViewController alloc] init];
break;
default:

View File

@ -126,6 +126,8 @@
70D9F1611AFB019F00197BBE /* GSH_OpenGL_Texture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 70D9F15D1AFB019F00197BBE /* GSH_OpenGL_Texture.cpp */; };
70D9F1621AFB019F00197BBE /* GSH_OpenGL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 70D9F15E1AFB019F00197BBE /* GSH_OpenGL.cpp */; };
70F0372E15D83D0E006A96F1 /* Iop_Thmsgbx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 70F0372C15D83D0E006A96F1 /* Iop_Thmsgbx.cpp */; };
70F2AB0B1CBB558B00D0773D /* AudioSettingsView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 70F2AB091CBB558B00D0773D /* AudioSettingsView.xib */; };
70F2AB0E1CBB56B600D0773D /* AudioSettingsViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 70F2AB0D1CBB56B600D0773D /* AudioSettingsViewController.mm */; };
7E4C15751517CBD400357777 /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7E4C15721517CBD400357777 /* main.mm */; };
7E4C15811517E6F800357777 /* libFramework.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7E4C157E1517CDD200357777 /* libFramework.a */; };
7E7832AC1516710A00C04C62 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7E7832AB1516710A00C04C62 /* Cocoa.framework */; };
@ -423,6 +425,9 @@
70D9F15F1AFB019F00197BBE /* GSH_OpenGL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GSH_OpenGL.h; path = ../Source/gs/GSH_OpenGL/GSH_OpenGL.h; sourceTree = "<group>"; };
70F0372C15D83D0E006A96F1 /* Iop_Thmsgbx.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Iop_Thmsgbx.cpp; path = ../Source/iop/Iop_Thmsgbx.cpp; sourceTree = "<group>"; };
70F0372D15D83D0E006A96F1 /* Iop_Thmsgbx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Iop_Thmsgbx.h; path = ../Source/iop/Iop_Thmsgbx.h; sourceTree = "<group>"; };
70F2AB0A1CBB558B00D0773D /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = AudioSettingsView.xib; sourceTree = "<group>"; };
70F2AB0C1CBB56B600D0773D /* AudioSettingsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AudioSettingsViewController.h; path = ../Source/ui_macosx/AudioSettingsViewController.h; sourceTree = "<group>"; };
70F2AB0D1CBB56B600D0773D /* AudioSettingsViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AudioSettingsViewController.mm; path = ../Source/ui_macosx/AudioSettingsViewController.mm; sourceTree = "<group>"; };
70F2AB0F1CBC544C00D0773D /* PreferenceDefs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PreferenceDefs.h; path = ../Source/ui_macosx/PreferenceDefs.h; sourceTree = "<group>"; };
7E4C15711517CBD400357777 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = ../Source/ui_macosx/Info.plist; sourceTree = "<group>"; };
7E4C15721517CBD400357777 /* main.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = main.mm; path = ../Source/ui_macosx/main.mm; sourceTree = "<group>"; };
@ -696,6 +701,7 @@
705D396D1C43FFC900D267A6 /* PreferencesWindow.xib */,
70684A38151E8B2400C9574F /* VfsManagerView.xib */,
705D39701C44A3FF00D267A6 /* VideoSettingsView.xib */,
70F2AB091CBB558B00D0773D /* AudioSettingsView.xib */,
);
name = English.lproj;
path = ../Source/ui_macosx/English.lproj;
@ -717,6 +723,8 @@
70BB57701C4551600053A1F6 /* PreferencesWindow */ = {
isa = PBXGroup;
children = (
70F2AB0C1CBB56B600D0773D /* AudioSettingsViewController.h */,
70F2AB0D1CBB56B600D0773D /* AudioSettingsViewController.mm */,
705D396A1C43FFAF00D267A6 /* PreferencesWindowController.h */,
705D396B1C43FFAF00D267A6 /* PreferencesWindowController.mm */,
70684A19151E89E200C9574F /* VfsManagerBindings.h */,
@ -1072,6 +1080,7 @@
70C0C84E1ADC97A900492241 /* Images.xcassets in Resources */,
700DF99515DF699000818F3B /* patches.xml in Resources */,
705D396F1C43FFC900D267A6 /* PreferencesWindow.xib in Resources */,
70F2AB0B1CBB558B00D0773D /* AudioSettingsView.xib in Resources */,
700DF99C15DFC0CB00818F3B /* MainMenu.xib in Resources */,
700FB58015E11E1E00C322DE /* OutputWindow.xib in Resources */,
70320D1E1A99EAC4001E9C4B /* GeneralSettings.xcconfig in Resources */,
@ -1212,6 +1221,7 @@
7056F2851B2683C700389AFB /* EeExecutor.cpp in Sources */,
70684A01151E896900C9574F /* Iop_Timrman.cpp in Sources */,
70D9F15A1AFB018900197BBE /* GSHandler.cpp in Sources */,
70F2AB0E1CBB56B600D0773D /* AudioSettingsViewController.mm in Sources */,
70684A02151E896900C9574F /* Iop_Vblank.cpp in Sources */,
70D9F14E1AFB016900197BBE /* VUShared.cpp in Sources */,
70684A03151E896900C9574F /* IopBios.cpp in Sources */,
@ -1298,6 +1308,14 @@
name = VfsManagerView.xib;
sourceTree = "<group>";
};
70F2AB091CBB558B00D0773D /* AudioSettingsView.xib */ = {
isa = PBXVariantGroup;
children = (
70F2AB0A1CBB558B00D0773D /* English */,
);
name = AudioSettingsView.xib;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */