Cocoa Port:
- Add the Microphone Settings panel for easier control and more verbose info. The new panel also allows the user to change and monitor mic settings without needing a display window's status bar. - Implement a more proper mic level UI that reports the level per frame instead of per sample. This should improve UI performance. - Make all methods in the CocoaDSControllerDelegate protocol optional and remove all related protocol methods from the OpenEmu plug-in. - Try attaching a new hardware input device on startup. - Remove debug printf stuff when attaching a new hardware input device. The new Microphone Settings panel makes the extra printf stuff unnecessary. - Remember the hardware mic mute setting between app launches.
This commit is contained in:
parent
d0ec648952
commit
fa4d2cb58f
|
@ -694,6 +694,8 @@
|
|||
<dict/>
|
||||
<key>Input_SavedProfiles</key>
|
||||
<array/>
|
||||
<key>Microphone_HardwareMicMute</key>
|
||||
<false/>
|
||||
<key>Render3D_DepthComparisonThreshold</key>
|
||||
<integer>0</integer>
|
||||
<key>Render3D_EdgeMarking</key>
|
||||
|
|
|
@ -901,6 +901,8 @@ volatile bool execute = true;
|
|||
[self setCoreState:CORESTATE_PAUSE];
|
||||
[self applyDynaRec];
|
||||
[self applySlot1Device];
|
||||
[[self cdsController] resetMicLevel];
|
||||
[[self cdsController] updateMicLevel];
|
||||
|
||||
pthread_mutex_lock(&threadParam.mutexThreadExecute);
|
||||
NDS_Reset();
|
||||
|
@ -1128,15 +1130,8 @@ static void* RunCoreThread(void *arg)
|
|||
|
||||
// Make sure that the mic level is updated at least once per frame, regardless
|
||||
// of whether the NDS actually reads the mic or not.
|
||||
if (![cdsController isHardwareMicReadThisFrame])
|
||||
{
|
||||
[cdsController updateHardwareMicLevelWithSample:MIC_NULL_SAMPLE_VALUE];
|
||||
[[cdsController delegate] doMicSamplesReadFromController:cdsController inSample:MIC_NULL_SAMPLE_VALUE];
|
||||
}
|
||||
else
|
||||
{
|
||||
[cdsController setIsHardwareMicReadThisFrame:NO];
|
||||
}
|
||||
[cdsController updateMicLevel];
|
||||
[cdsController resetMicLevel];
|
||||
|
||||
pthread_mutex_lock(¶m->mutexOutputList);
|
||||
|
||||
|
|
|
@ -249,10 +249,8 @@
|
|||
#define MIC_SAMPLE_SIZE ((MIC_SAMPLE_RESOLUTION / 8) * MIC_NUMBER_CHANNELS) // Bytes per sample, multiplied by the number of channels
|
||||
#define MIC_MAX_BUFFER_SAMPLES ((MIC_SAMPLE_RATE / DS_FRAMES_PER_SECOND) * MIC_SAMPLE_SIZE)
|
||||
#define MIC_CAPTURE_FRAMES 192 // The number of audio frames that the NDS microphone should pull. The lower this value, the lower the latency. Ensure that this value is not too low, or else audio frames may be lost.
|
||||
#define MIC_CLIP_FRAME_THRESHOLD 15 // When the number of clipped mic samples reaches this amount, the UI will reflect that the mic is clipping.
|
||||
#define MIC_CLIP_FRAME_MAX_COUNT 60 // When counting clipped mic samples, don't count past this number. This is to prevent the mic clip state from persisting too long after the mic has stopped clipping.
|
||||
#define MIC_NULL_FRAME_THRESHOLD 12 // When the number of null mic samples reaches this amount, the UI will reflect that the mic is null.
|
||||
#define MIC_NULL_FRAME_MAX_COUNT 24 // When counting null mic samples, don't count past this number. This is to prevent the mic null state from persisting too long after the mic has read some samples.
|
||||
#define MIC_NULL_LEVEL_THRESHOLD 3
|
||||
#define MIC_CLIP_LEVEL_THRESHOLD 59
|
||||
#define MIC_NULL_SAMPLE_VALUE 64
|
||||
|
||||
#define COCOA_DIALOG_CANCEL 0
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#include <libkern/OSAtomic.h>
|
||||
#include <vector>
|
||||
|
||||
@class CocoaDSController;
|
||||
class CoreAudioInput;
|
||||
|
@ -77,10 +78,8 @@ typedef struct
|
|||
|
||||
@protocol CocoaDSControllerDelegate <NSObject>
|
||||
|
||||
@required
|
||||
- (uint8_t) doMicSamplesReadFromController:(CocoaDSController *)cdsController inSample:(uint8_t)sampleValue;
|
||||
|
||||
@optional
|
||||
- (void) doMicLevelUpdateFromController:(CocoaDSController *)cdsController;
|
||||
- (void) doMicHardwareStateChangedFromController:(CocoaDSController *)cdsController
|
||||
isEnabled:(BOOL)isHardwareEnabled
|
||||
isLocked:(BOOL)isHardwareLocked
|
||||
|
@ -93,13 +92,12 @@ typedef struct
|
|||
@interface CocoaDSController : NSObject
|
||||
{
|
||||
id <CocoaDSControllerDelegate> delegate;
|
||||
BOOL isHardwareMicReadThisFrame;
|
||||
float micLevel;
|
||||
BOOL autohold;
|
||||
BOOL isAutoholdCleared;
|
||||
BOOL _useHardwareMic;
|
||||
size_t _availableMicSamples;
|
||||
uint32_t _hwMicNumberIdleFrames;
|
||||
uint32_t _hwMicNumberClippedFrames;
|
||||
std::vector<uint8_t> *_hwMicLevelList;
|
||||
NSInteger micMode;
|
||||
NSPoint touchLocation;
|
||||
|
||||
|
@ -108,7 +106,11 @@ typedef struct
|
|||
CoreAudioInput *CAInputDevice;
|
||||
AudioGenerator *softwareMicSampleGenerator;
|
||||
NSInteger paddleAdjust;
|
||||
|
||||
NSString *hardwareMicInfoString;
|
||||
NSString *hardwareMicNameString;
|
||||
NSString *hardwareMicManufacturerString;
|
||||
NSString *hardwareMicSampleRateString;
|
||||
|
||||
OSSpinLock spinlockControllerState;
|
||||
}
|
||||
|
@ -116,9 +118,9 @@ typedef struct
|
|||
@property (retain) id <CocoaDSControllerDelegate> delegate;
|
||||
@property (assign) BOOL autohold;
|
||||
@property (readonly) BOOL isHardwareMicAvailable;
|
||||
@property (assign) BOOL isHardwareMicIdle;
|
||||
@property (assign) BOOL isHardwareMicInClip;
|
||||
@property (assign) BOOL isHardwareMicReadThisFrame;
|
||||
@property (readonly) BOOL isHardwareMicIdle;
|
||||
@property (readonly) BOOL isHardwareMicInClip;
|
||||
@property (assign) float micLevel;
|
||||
@property (assign) BOOL hardwareMicEnabled;
|
||||
@property (readonly) BOOL hardwareMicLocked;
|
||||
@property (assign) float hardwareMicGain;
|
||||
|
@ -132,6 +134,9 @@ typedef struct
|
|||
@property (assign) AudioSampleBlockGenerator *selectedAudioFileGenerator;
|
||||
@property (assign) NSInteger paddleAdjust;
|
||||
@property (retain) NSString *hardwareMicInfoString;
|
||||
@property (retain) NSString *hardwareMicNameString;
|
||||
@property (retain) NSString *hardwareMicManufacturerString;
|
||||
@property (retain) NSString *hardwareMicSampleRateString;
|
||||
|
||||
- (void) setControllerState:(BOOL)theState controlID:(const NSUInteger)controlID;
|
||||
- (void) setControllerState:(BOOL)theState controlID:(const NSUInteger)controlID turbo:(const BOOL)isTurboEnabled;
|
||||
|
@ -140,7 +145,9 @@ typedef struct
|
|||
- (void) clearAutohold;
|
||||
- (void) flush;
|
||||
- (void) flushEmpty;
|
||||
- (void) updateHardwareMicLevelWithSample:(uint8_t)inSample;
|
||||
|
||||
- (void) resetMicLevel;
|
||||
- (void) updateMicLevel;
|
||||
- (uint8_t) handleMicSampleRead:(CoreAudioInput *)caInput softwareMic:(AudioGenerator *)sampleGenerator;
|
||||
- (void) handleMicHardwareStateChanged:(CoreAudioInputDeviceInfo *)deviceInfo
|
||||
isEnabled:(BOOL)isHardwareEnabled
|
||||
|
|
|
@ -38,7 +38,7 @@ SineWaveGenerator sineWaveGenerator(250.0, MIC_SAMPLE_RATE);
|
|||
@dynamic isHardwareMicAvailable;
|
||||
@dynamic isHardwareMicIdle;
|
||||
@dynamic isHardwareMicInClip;
|
||||
@synthesize isHardwareMicReadThisFrame;
|
||||
@synthesize micLevel;
|
||||
@dynamic hardwareMicEnabled;
|
||||
@dynamic hardwareMicLocked;
|
||||
@dynamic hardwareMicGain;
|
||||
|
@ -53,6 +53,9 @@ SineWaveGenerator sineWaveGenerator(250.0, MIC_SAMPLE_RATE);
|
|||
@synthesize selectedAudioFileGenerator;
|
||||
@synthesize paddleAdjust;
|
||||
@synthesize hardwareMicInfoString;
|
||||
@synthesize hardwareMicNameString;
|
||||
@synthesize hardwareMicManufacturerString;
|
||||
@synthesize hardwareMicSampleRateString;
|
||||
|
||||
- (id)init
|
||||
{
|
||||
|
@ -74,11 +77,13 @@ SineWaveGenerator sineWaveGenerator(250.0, MIC_SAMPLE_RATE);
|
|||
spinlockControllerState = OS_SPINLOCK_INIT;
|
||||
autohold = NO;
|
||||
isAutoholdCleared = YES;
|
||||
isHardwareMicReadThisFrame = NO;
|
||||
micLevel = 0.0f;
|
||||
_useHardwareMic = NO;
|
||||
_availableMicSamples = 0;
|
||||
_hwMicNumberIdleFrames = MIC_NULL_FRAME_THRESHOLD;
|
||||
_hwMicNumberClippedFrames = 0;
|
||||
|
||||
_hwMicLevelList = new std::vector<uint8_t>;
|
||||
_hwMicLevelList->reserve(1024);
|
||||
_hwMicLevelList->clear();
|
||||
|
||||
micMode = MICMODE_NONE;
|
||||
selectedAudioFileGenerator = NULL;
|
||||
|
@ -88,7 +93,11 @@ SineWaveGenerator sineWaveGenerator(250.0, MIC_SAMPLE_RATE);
|
|||
softwareMicSampleGenerator = &nullSampleGenerator;
|
||||
touchLocation = NSMakePoint(0.0f, 0.0f);
|
||||
paddleAdjust = 0;
|
||||
|
||||
hardwareMicInfoString = @"No hardware input detected.";
|
||||
hardwareMicNameString = @"No hardware input detected.";
|
||||
hardwareMicManufacturerString = @"No hardware input detected.";
|
||||
hardwareMicSampleRateString = @"No hardware input detected.";
|
||||
|
||||
Mic_SetResetCallback(&CAResetCallback, self, NULL);
|
||||
Mic_SetSampleReadCallback(&CASampleReadCallback, self, NULL);
|
||||
|
@ -99,6 +108,7 @@ SineWaveGenerator sineWaveGenerator(250.0, MIC_SAMPLE_RATE);
|
|||
- (void)dealloc
|
||||
{
|
||||
delete CAInputDevice;
|
||||
delete _hwMicLevelList;
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
@ -109,40 +119,14 @@ SineWaveGenerator sineWaveGenerator(250.0, MIC_SAMPLE_RATE);
|
|||
!CAInputDevice->GetPauseState() ) ? YES : NO;
|
||||
}
|
||||
|
||||
- (void) setIsHardwareMicIdle:(BOOL)theState
|
||||
{
|
||||
if (theState)
|
||||
{
|
||||
_hwMicNumberIdleFrames = MIC_NULL_FRAME_THRESHOLD;
|
||||
_hwMicNumberClippedFrames = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
_hwMicNumberIdleFrames = 0;
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL) isHardwareMicIdle
|
||||
{
|
||||
return (_hwMicNumberIdleFrames >= MIC_NULL_FRAME_THRESHOLD);
|
||||
}
|
||||
|
||||
- (void) setIsHardwareMicInClip:(BOOL)theState
|
||||
{
|
||||
if (theState)
|
||||
{
|
||||
_hwMicNumberIdleFrames = 0;
|
||||
_hwMicNumberClippedFrames = MIC_CLIP_FRAME_THRESHOLD;
|
||||
}
|
||||
else
|
||||
{
|
||||
_hwMicNumberClippedFrames = 0;
|
||||
}
|
||||
return (micLevel < MIC_NULL_LEVEL_THRESHOLD);
|
||||
}
|
||||
|
||||
- (BOOL) isHardwareMicInClip
|
||||
{
|
||||
return (_hwMicNumberClippedFrames >= MIC_CLIP_FRAME_THRESHOLD);
|
||||
return (micLevel >= MIC_CLIP_LEVEL_THRESHOLD);
|
||||
}
|
||||
|
||||
- (void) setHardwareMicEnabled:(BOOL)micEnabled
|
||||
|
@ -526,42 +510,35 @@ SineWaveGenerator sineWaveGenerator(250.0, MIC_SAMPLE_RATE);
|
|||
NDS_setMic(false);
|
||||
}
|
||||
|
||||
- (void) updateHardwareMicLevelWithSample:(uint8_t)inSample
|
||||
- (void) resetMicLevel
|
||||
{
|
||||
switch (inSample)
|
||||
_hwMicLevelList->clear();
|
||||
}
|
||||
|
||||
- (void) updateMicLevel
|
||||
{
|
||||
float avgMicLevel = 0.0f;
|
||||
size_t recordedLevelCount = _hwMicLevelList->size();
|
||||
|
||||
for(size_t i = 0; i < recordedLevelCount; i++)
|
||||
{
|
||||
case MIC_NULL_SAMPLE_VALUE:
|
||||
{
|
||||
if (_hwMicNumberIdleFrames < MIC_NULL_FRAME_MAX_COUNT)
|
||||
{
|
||||
_hwMicNumberIdleFrames++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 0:
|
||||
case 127:
|
||||
{
|
||||
if (_hwMicNumberClippedFrames < MIC_CLIP_FRAME_MAX_COUNT)
|
||||
{
|
||||
_hwMicNumberClippedFrames++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
if (_hwMicNumberIdleFrames > 0)
|
||||
{
|
||||
_hwMicNumberIdleFrames--;
|
||||
}
|
||||
|
||||
if (_hwMicNumberClippedFrames > 0)
|
||||
{
|
||||
_hwMicNumberClippedFrames--;
|
||||
}
|
||||
break;
|
||||
}
|
||||
avgMicLevel += (*_hwMicLevelList)[i];
|
||||
}
|
||||
|
||||
if (recordedLevelCount > 0)
|
||||
{
|
||||
avgMicLevel /= _hwMicLevelList->size();
|
||||
}
|
||||
else
|
||||
{
|
||||
avgMicLevel = 0.0f;
|
||||
}
|
||||
|
||||
[self setMicLevel:avgMicLevel];
|
||||
|
||||
if (delegate != nil && [delegate respondsToSelector:@selector(doMicLevelUpdateFromController:)])
|
||||
{
|
||||
[[self delegate] doMicLevelUpdateFromController:self];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -585,9 +562,6 @@ SineWaveGenerator sineWaveGenerator(250.0, MIC_SAMPLE_RATE);
|
|||
caInput->_samplesConverted->read(&theSample, 1);
|
||||
theSample >>= 1; // Samples from CoreAudio are 8-bit, so we need to convert the sample to 7-bit
|
||||
_availableMicSamples--;
|
||||
|
||||
[self updateHardwareMicLevelWithSample:theSample];
|
||||
[self setIsHardwareMicReadThisFrame:YES];
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -595,7 +569,8 @@ SineWaveGenerator sineWaveGenerator(250.0, MIC_SAMPLE_RATE);
|
|||
theSample = sampleGenerator->generateSample();
|
||||
}
|
||||
|
||||
return [[self delegate] doMicSamplesReadFromController:self inSample:theSample];
|
||||
_hwMicLevelList->push_back(abs((float)theSample - MIC_NULL_SAMPLE_VALUE));
|
||||
return theSample;
|
||||
}
|
||||
|
||||
- (void) handleMicHardwareStateChanged:(CoreAudioInputDeviceInfo *)deviceInfo
|
||||
|
@ -603,21 +578,25 @@ SineWaveGenerator sineWaveGenerator(250.0, MIC_SAMPLE_RATE);
|
|||
isLocked:(BOOL)isHardwareLocked
|
||||
isMuted:(BOOL)isHardwareMuted
|
||||
{
|
||||
NSString *newHWMicInfoString;
|
||||
if (deviceInfo->objectID == kAudioObjectUnknown)
|
||||
{
|
||||
newHWMicInfoString = @"No hardware input detected.";
|
||||
[self setHardwareMicInfoString:@"No hardware input detected."];
|
||||
[self setHardwareMicNameString:@"No hardware input detected."];
|
||||
[self setHardwareMicManufacturerString:@"No hardware input detected."];
|
||||
[self setHardwareMicSampleRateString:@"No hardware input detected."];
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
newHWMicInfoString = [NSString stringWithFormat:@"%@\nSample Rate: %1.1f Hz",
|
||||
(NSString *)deviceInfo->name,
|
||||
(double)deviceInfo->sampleRate];
|
||||
[self setHardwareMicInfoString:[NSString stringWithFormat:@"%@\nSample Rate: %1.1f Hz",
|
||||
(NSString *)deviceInfo->name,
|
||||
(double)deviceInfo->sampleRate]];
|
||||
[self setHardwareMicNameString:(NSString *)deviceInfo->name];
|
||||
[self setHardwareMicManufacturerString:(NSString *)deviceInfo->manufacturer];
|
||||
[self setHardwareMicSampleRateString:[NSString stringWithFormat:@"%1.1f Hz", (double)deviceInfo->sampleRate]];
|
||||
}
|
||||
|
||||
[self setHardwareMicInfoString:newHWMicInfoString];
|
||||
[self setIsHardwareMicIdle:YES];
|
||||
[self setIsHardwareMicInClip:NO];
|
||||
[self resetMicLevel];
|
||||
|
||||
if (delegate != nil && [delegate respondsToSelector:@selector(doMicHardwareStateChangedFromController:isEnabled:isLocked:isMuted:)])
|
||||
{
|
||||
|
|
|
@ -300,22 +300,17 @@ OSStatus CoreAudioInput::InitInputAUHAL(UInt32 deviceID)
|
|||
}
|
||||
|
||||
// Get some information about the device before attempting to attach it to the AUHAL.
|
||||
// Currently, this information is only available in debug mode. However, if there is
|
||||
// a need to actually do something with this information, then we've already got it.
|
||||
AudioObjectPropertyAddress deviceProperty;
|
||||
UInt32 dataSize = 0;
|
||||
deviceProperty.mScope = kAudioObjectPropertyScopeGlobal;
|
||||
deviceProperty.mElement = kAudioObjectPropertyElementMaster;
|
||||
printf("\nInput Device Information:\n");
|
||||
printf(" Object ID: %d\n", deviceID);
|
||||
|
||||
deviceProperty.mSelector = kAudioObjectPropertyName;
|
||||
error = AudioObjectGetPropertyDataSize(deviceID, &deviceProperty, 0, NULL, &dataSize);
|
||||
if (error == noErr)
|
||||
{
|
||||
CFRelease(this->_hwDeviceInfo.name);
|
||||
error = AudioObjectGetPropertyData(deviceID, &deviceProperty, 0, NULL, &dataSize, &this->_hwDeviceInfo.name);
|
||||
printf(" Name: %s\n", CFStringGetCStringPtr(this->_hwDeviceInfo.name, kCFStringEncodingUTF8));
|
||||
AudioObjectGetPropertyData(deviceID, &deviceProperty, 0, NULL, &dataSize, &this->_hwDeviceInfo.name);
|
||||
}
|
||||
|
||||
deviceProperty.mSelector = kAudioObjectPropertyManufacturer;
|
||||
|
@ -323,8 +318,7 @@ OSStatus CoreAudioInput::InitInputAUHAL(UInt32 deviceID)
|
|||
if (error == noErr)
|
||||
{
|
||||
CFRelease(this->_hwDeviceInfo.manufacturer);
|
||||
error = AudioObjectGetPropertyData(deviceID, &deviceProperty, 0, NULL, &dataSize, &this->_hwDeviceInfo.manufacturer);
|
||||
printf(" Manufacturer: %s\n", CFStringGetCStringPtr(this->_hwDeviceInfo.manufacturer, kCFStringEncodingUTF8));
|
||||
AudioObjectGetPropertyData(deviceID, &deviceProperty, 0, NULL, &dataSize, &this->_hwDeviceInfo.manufacturer);
|
||||
}
|
||||
|
||||
deviceProperty.mSelector = kAudioDevicePropertyDeviceUID;
|
||||
|
@ -332,8 +326,7 @@ OSStatus CoreAudioInput::InitInputAUHAL(UInt32 deviceID)
|
|||
if (error == noErr)
|
||||
{
|
||||
CFRelease(this->_hwDeviceInfo.deviceUID);
|
||||
error = AudioObjectGetPropertyData(deviceID, &deviceProperty, 0, NULL, &dataSize, &this->_hwDeviceInfo.deviceUID);
|
||||
printf(" Device UID: %s\n", CFStringGetCStringPtr(this->_hwDeviceInfo.deviceUID, kCFStringEncodingUTF8));
|
||||
AudioObjectGetPropertyData(deviceID, &deviceProperty, 0, NULL, &dataSize, &this->_hwDeviceInfo.deviceUID);
|
||||
}
|
||||
|
||||
deviceProperty.mSelector = kAudioDevicePropertyModelUID;
|
||||
|
@ -341,8 +334,7 @@ OSStatus CoreAudioInput::InitInputAUHAL(UInt32 deviceID)
|
|||
if (error == noErr)
|
||||
{
|
||||
CFRelease(this->_hwDeviceInfo.modelUID);
|
||||
error = AudioObjectGetPropertyData(deviceID, &deviceProperty, 0, NULL, &dataSize, &this->_hwDeviceInfo.modelUID);
|
||||
printf(" Model UID: %s\n", CFStringGetCStringPtr(this->_hwDeviceInfo.modelUID, kCFStringEncodingUTF8));
|
||||
AudioObjectGetPropertyData(deviceID, &deviceProperty, 0, NULL, &dataSize, &this->_hwDeviceInfo.modelUID);
|
||||
}
|
||||
|
||||
deviceProperty.mSelector = kAudioDevicePropertyNominalSampleRate;
|
||||
|
@ -350,8 +342,7 @@ OSStatus CoreAudioInput::InitInputAUHAL(UInt32 deviceID)
|
|||
error = AudioObjectGetPropertyDataSize(deviceID, &deviceProperty, 0, NULL, &dataSize);
|
||||
if (error == noErr)
|
||||
{
|
||||
error = AudioObjectGetPropertyData(deviceID, &deviceProperty, 0, NULL, &dataSize, &this->_hwDeviceInfo.sampleRate);
|
||||
printf(" Sample Rate: %1.1f\n\n", this->_hwDeviceInfo.sampleRate);
|
||||
AudioObjectGetPropertyData(deviceID, &deviceProperty, 0, NULL, &dataSize, &this->_hwDeviceInfo.sampleRate);
|
||||
}
|
||||
|
||||
// Before attaching the HAL input device, stop everything first.
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
@class CocoaDSFirmware;
|
||||
|
||||
|
||||
@interface NDSGameCore : OEGameCore <CocoaDSControllerDelegate>
|
||||
@interface NDSGameCore : OEGameCore
|
||||
{
|
||||
NSPoint touchLocation;
|
||||
NSMutableDictionary *addedCheatsDict;
|
||||
|
|
|
@ -488,13 +488,4 @@ volatile bool execute = true;
|
|||
}
|
||||
}
|
||||
|
||||
#pragma mark CocoaDSControllerDelegate Protocol
|
||||
|
||||
- (uint8_t) doMicSamplesReadFromController:(CocoaDSController *)cdsController inSample:(uint8_t)sampleValue
|
||||
{
|
||||
// Do nothing.
|
||||
// OpenEmu has no UI to reflect changes with the NDS microphone input.
|
||||
return sampleValue;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -471,6 +471,7 @@
|
|||
</array>
|
||||
<reference key="NSMenuFont" ref="844216569"/>
|
||||
</object>
|
||||
<int key="NSSelectedIndex">-1</int>
|
||||
<bool key="NSPullDown">YES</bool>
|
||||
<int key="NSPreferredEdge">1</int>
|
||||
<bool key="NSUsesItemFromMenu">YES</bool>
|
||||
|
@ -1756,7 +1757,7 @@
|
|||
<string key="154.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="16.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<reference key="161.IBNSViewMetadataGestureRecognizers" ref="0"/>
|
||||
<string key="161.IBPersistedLastKnownCanvasPosition">{229, 364.5}</string>
|
||||
<string key="161.IBPersistedLastKnownCanvasPosition">{84.5, 324.5}</string>
|
||||
<string key="161.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="162.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="165.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -1868,6 +1868,8 @@
|
|||
|
||||
CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content];
|
||||
[cdsCore setSlot1StatusText:NSSTRING_STATUS_EMULATION_NOT_RUNNING];
|
||||
[[cdsCore cdsController] resetMicLevel];
|
||||
[[cdsCore cdsController] updateMicLevel];
|
||||
|
||||
result = YES;
|
||||
|
||||
|
@ -2111,6 +2113,11 @@
|
|||
|
||||
- (void) setupUserDefaults
|
||||
{
|
||||
CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content];
|
||||
|
||||
// Set the microphone settings per user preferences.
|
||||
[[cdsCore cdsController] setHardwareMicMute:[[NSUserDefaults standardUserDefaults] boolForKey:@"Microphone_HardwareMicMute"]];
|
||||
|
||||
// Set the SPU settings per user preferences.
|
||||
[self setCurrentVolumeValue:[[NSUserDefaults standardUserDefaults] floatForKey:@"Sound_Volume"]];
|
||||
[[self cdsSpeaker] setVolume:[[NSUserDefaults standardUserDefaults] floatForKey:@"Sound_Volume"]];
|
||||
|
@ -2121,7 +2128,6 @@
|
|||
[[self cdsSpeaker] setSpuSyncMethod:[[NSUserDefaults standardUserDefaults] integerForKey:@"SPU_SyncMethod"]];
|
||||
|
||||
// Set the 3D rendering options per user preferences.
|
||||
CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content];
|
||||
[[cdsCore cdsGPU] setRender3DThreads:(NSUInteger)[[NSUserDefaults standardUserDefaults] integerForKey:@"Render3D_Threads"]];
|
||||
[[cdsCore cdsGPU] setRender3DRenderingEngine:[[NSUserDefaults standardUserDefaults] integerForKey:@"Render3D_RenderingEngine"]];
|
||||
[[cdsCore cdsGPU] setRender3DHighPrecisionColorInterpolation:[[NSUserDefaults standardUserDefaults] boolForKey:@"Render3D_HighPrecisionColorInterpolation"]];
|
||||
|
@ -2422,7 +2428,7 @@
|
|||
|
||||
#pragma mark CocoaDSControllerDelegate Protocol
|
||||
|
||||
- (uint8_t) doMicSamplesReadFromController:(CocoaDSController *)cdsController inSample:(uint8_t)sampleValue
|
||||
- (void) doMicLevelUpdateFromController:(CocoaDSController *)cdsController
|
||||
{
|
||||
BOOL needsUpdate = NO;
|
||||
const BOOL controllerSoftwareMicState = [cdsController softwareMicState];
|
||||
|
@ -2463,8 +2469,6 @@
|
|||
{
|
||||
[self updateMicStatusIcon];
|
||||
}
|
||||
|
||||
return sampleValue;
|
||||
}
|
||||
|
||||
- (void) doMicHardwareStateChangedFromController:(CocoaDSController *)cdsController
|
||||
|
|
|
@ -181,8 +181,9 @@
|
|||
|
||||
// Init the DS controller.
|
||||
CocoaDSController *newController = [[[CocoaDSController alloc] init] autorelease];
|
||||
[newController setDelegate:emuControl];
|
||||
[newCore setCdsController:newController];
|
||||
[newController setDelegate:emuControl];
|
||||
[newController setHardwareMicEnabled:YES];
|
||||
|
||||
// Init the DS speakers.
|
||||
CocoaDSSpeaker *newSpeaker = [[[CocoaDSSpeaker alloc] init] autorelease];
|
||||
|
@ -212,6 +213,7 @@
|
|||
|
||||
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
|
||||
{
|
||||
CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content];
|
||||
EmuControllerDelegate *emuControl = (EmuControllerDelegate *)[emuControlController content];
|
||||
|
||||
// Determine if the app was run for the first time.
|
||||
|
@ -241,6 +243,10 @@
|
|||
[[inputPrefsView inputPrefOutlineView] expandItem:nil expandChildren:YES];
|
||||
[[inputPrefsView inputProfileMenu] selectItemAtIndex:0];
|
||||
|
||||
// Make sure that the mic is paused to start with.
|
||||
[[cdsCore cdsController] setHardwareMicPause:YES];
|
||||
[emuControl updateMicStatusIcon];
|
||||
|
||||
//Bring the application to the front
|
||||
[NSApp activateIgnoringOtherApps:TRUE];
|
||||
[self restoreDisplayWindowStates];
|
||||
|
@ -341,6 +347,7 @@
|
|||
// Save some settings to user defaults before app termination
|
||||
[self saveDisplayWindowStates];
|
||||
[romInfoPanel writeDefaults];
|
||||
[[NSUserDefaults standardUserDefaults] setBool:[[cdsCore cdsController] hardwareMicMute] forKey:@"Microphone_HardwareMicMute"];
|
||||
[[NSUserDefaults standardUserDefaults] setDouble:[emuControl lastSetSpeedScalar] forKey:@"CoreControl_SpeedScalar"];
|
||||
[[NSUserDefaults standardUserDefaults] setBool:[cdsCore isSpeedLimitEnabled] forKey:@"CoreControl_EnableSpeedLimit"];
|
||||
[[NSUserDefaults standardUserDefaults] setBool:[cdsCore isFrameSkipEnabled] forKey:@"CoreControl_EnableAutoFrameSkip"];
|
||||
|
|
Loading…
Reference in New Issue