Cocoa Port (OpenEmu Plug-in): Update the microphone controls to use the latest CocoaDSController standards. Fixes both hardware and software mic modes.

This commit is contained in:
rogerman 2017-11-14 16:11:21 -08:00
parent 16948fe8bd
commit 4457b95468
2 changed files with 49 additions and 14 deletions

View File

@ -88,7 +88,6 @@ volatile bool execute = true;
// Set up the DS controller
cdsController = [[[[CocoaDSController alloc] init] retain] autorelease];
[cdsController startHardwareMicDevice];
// Set up the cheat system
cdsCheats = [[[[CocoaDSCheatManager alloc] init] retain] autorelease];
@ -424,16 +423,61 @@ volatile bool execute = true;
}
}
#pragma mark - Internal
- (void)startEmulation
{
[cdsController startHardwareMicDevice];
[cdsController setHardwareMicMute:NO];
[cdsController setHardwareMicPause:NO];
[super startEmulation];
}
- (void)setPauseEmulation:(BOOL)pauseEmulation
{
[cdsController setHardwareMicPause:pauseEmulation];
[super setPauseEmulation:pauseEmulation];
}
#pragma mark - Input
- (oneway void)didPushNDSButton:(OENDSButton)button forPlayer:(NSUInteger)player
{
[cdsController setControllerState:YES controlID:inputID[button]];
switch (inputID[button])
{
case NDSInputID_Microphone:
[cdsController setSoftwareMicState:YES mode:MicrophoneMode_InternalNoise];
break;
case NDSInputID_Paddle:
// Do nothing for now. OpenEmu doesn't currently support the Taito Paddle Controller.
//[cdsController setPaddleAdjust:0];
break;
default:
[cdsController setControllerState:YES controlID:inputID[button]];
break;
}
}
- (oneway void)didReleaseNDSButton:(OENDSButton)button forPlayer:(NSUInteger)player
{
[cdsController setControllerState:NO controlID:inputID[button]];
switch (inputID[button])
{
case NDSInputID_Microphone:
[cdsController setSoftwareMicState:NO mode:MicrophoneMode_InternalNoise];
break;
case NDSInputID_Paddle:
[cdsController setPaddleAdjust:0];
break;
default:
[cdsController setControllerState:NO controlID:inputID[button]];
break;
}
}
- (oneway void)didTouchScreenPoint:(OEIntPoint)aPoint

View File

@ -83,17 +83,8 @@ void SNDOpenEmuUpdateAudio(s16 *buffer, u32 num_samples)
u32 SNDOpenEmuGetAudioSpace()
{
// The latest version of the OpenEmu API (as of 11/11/2017) renames [OERingBuffer usedBytes]
// to [OERingBuffer freeBytes]. Due to poor planning on their part, using [OERingBuffer freeBytes]
// on the current release version of OpenEmu.app, v2.0.5, will cause the plug-in to fail due to
// [OERingBuffer freeBytes] not being available in that version.
//
// Therefore, let's make a note of the problem here and revert OpenEmuBase.framework back to a
// version before the method renaming broke things, then use the older-named method instead.
//
// TODO: Use the newer-named method, [OERingBuffer freeBytes], when a newer version of OpenEmu.app
// is finally released. Or maybe wait for the OpenEmu Team to bring back [OERingBuffer usedBytes]
// and let them deprecate it correctly.
// TODO: Use the newer-named method, [OERingBuffer freeBytes], when a newer version of OpenEmu.app released.
// But for now, use the older-named method, [OERingBuffer usedBytes].
//return (u32)[openEmuSoundInterfaceBuffer freeBytes] / SPU_SAMPLE_SIZE;
return (u32)[openEmuSoundInterfaceBuffer usedBytes] / SPU_SAMPLE_SIZE;