Some minor tidying of the OS X audio and wiimote code.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6736 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Soren Jorvang 2011-01-04 02:09:29 +00:00
parent 58f5140233
commit efe555fc16
5 changed files with 12 additions and 17 deletions

View File

@ -47,9 +47,10 @@ CoreAudioSound::~CoreAudioSound()
bool CoreAudioSound::Start() bool CoreAudioSound::Start()
{ {
OSStatus err; OSStatus err;
UInt32 enableIO;
AURenderCallbackStruct callback_struct; AURenderCallbackStruct callback_struct;
AudioStreamBasicDescription format; AudioStreamBasicDescription format;
ComponentDescription desc;
UInt32 enableIO = 1;
desc.componentType = kAudioUnitType_Output; desc.componentType = kAudioUnitType_Output;
desc.componentSubType = kAudioUnitSubType_DefaultOutput; desc.componentSubType = kAudioUnitSubType_DefaultOutput;
@ -69,7 +70,6 @@ bool CoreAudioSound::Start()
return false; return false;
} }
enableIO = 1;
AudioUnitSetProperty(audioUnit, AudioUnitSetProperty(audioUnit,
kAudioOutputUnitProperty_EnableIO, kAudioOutputUnitProperty_EnableIO,
kAudioUnitScope_Output, 0, &enableIO, kAudioUnitScope_Output, 0, &enableIO,

View File

@ -27,9 +27,6 @@
class CoreAudioSound : public SoundStream class CoreAudioSound : public SoundStream
{ {
#ifdef __APPLE__ #ifdef __APPLE__
ComponentDescription desc;
AudioUnit audioUnit;
public: public:
CoreAudioSound(CMixer *mixer); CoreAudioSound(CMixer *mixer);
virtual ~CoreAudioSound(); virtual ~CoreAudioSound();
@ -49,6 +46,9 @@ public:
virtual void Update(); virtual void Update();
void RenderSamples(void *target, UInt32 size); void RenderSamples(void *target, UInt32 size);
private:
AudioUnit audioUnit;
#else #else
public: public:
CoreAudioSound(CMixer *mixer) : SoundStream(mixer) {} CoreAudioSound(CMixer *mixer) : SoundStream(mixer) {}

View File

@ -92,14 +92,9 @@ extern "C" OSErr UpdateSystemActivity(UInt8 activity);
return; return;
} }
WARN_LOG(WIIMOTE, "Connection to wiimote %i closed", wm->index + 1); WARN_LOG(WIIMOTE, "Lost channel to wiimote %i", wm->index + 1);
[wm->btd closeConnection]; wm->RealDisconnect();
wm->btd = NULL;
wm->cchan = NULL;
wm->ichan = NULL;
wm->m_connected = false;
} }
@end @end
@ -181,7 +176,8 @@ bool Wiimote::Connect()
{ {
ConnectBT *cbt = [[ConnectBT alloc] init]; ConnectBT *cbt = [[ConnectBT alloc] init];
if (IsConnected()) return false; if (IsConnected())
return false;
[btd openL2CAPChannelSync: &cchan [btd openL2CAPChannelSync: &cchan
withPSM: kBluetoothL2CAPPSMHIDControl delegate: cbt]; withPSM: kBluetoothL2CAPPSMHIDControl delegate: cbt];
@ -200,7 +196,6 @@ bool Wiimote::Connect()
m_connected = true; m_connected = true;
Handshake(); Handshake();
SetLEDs(WIIMOTE_LED_1 << index); SetLEDs(WIIMOTE_LED_1 << index);
[cbt release]; [cbt release];

View File

@ -58,7 +58,7 @@ Wiimote::Wiimote(const unsigned int _index)
, dev_handle(0), stack(MSBT_STACK_UNKNOWN) , dev_handle(0), stack(MSBT_STACK_UNKNOWN)
#endif #endif
, leds(0) , leds(0)
, m_connected(false), m_last_data_report(Report(NULL, 0)), m_channel(0) , m_last_data_report(Report(NULL, 0)), m_channel(0), m_connected(false)
{ {
#if defined(__linux__) && HAVE_BLUEZ #if defined(__linux__) && HAVE_BLUEZ
bdaddr = (bdaddr_t){{0, 0, 0, 0, 0, 0}}; bdaddr = (bdaddr_t){{0, 0, 0, 0, 0, 0}};

View File

@ -64,6 +64,7 @@ public:
void DisableDataReporting(); void DisableDataReporting();
void Rumble(); void Rumble();
void SendPacket(const u8 rpt_id, const void* const data, const unsigned int size); void SendPacket(const u8 rpt_id, const void* const data, const unsigned int size);
void RealDisconnect();
const unsigned int index; const unsigned int index;
@ -86,20 +87,19 @@ public:
#endif #endif
unsigned char leds; // Currently lit leds unsigned char leds; // Currently lit leds
bool m_connected;
protected: protected:
Report m_last_data_report; Report m_last_data_report;
u16 m_channel; u16 m_channel;
private: private:
void ClearReadQueue(); void ClearReadQueue();
void RealDisconnect();
bool SendRequest(unsigned char report_type, unsigned char* data, int length); bool SendRequest(unsigned char report_type, unsigned char* data, int length);
bool Handshake(); bool Handshake();
void SetLEDs(int leds); void SetLEDs(int leds);
int IORead(unsigned char* buf); int IORead(unsigned char* buf);
int IOWrite(unsigned char* buf, int len); int IOWrite(unsigned char* buf, int len);
bool m_connected;
Common::FifoQueue<Report> m_read_reports; Common::FifoQueue<Report> m_read_reports;
Common::FifoQueue<Report> m_write_reports; Common::FifoQueue<Report> m_write_reports;
}; };