+bool wxSound::LoadWAV(const wxUint8 *data, size_t length, bool copyData)
+{
+ NSData* theData;
+ if(copyData)
+ theData = [[NSData alloc] initWithBytes:const_cast<wxUint8*>(data) length:length];
+ else
+ theData = [[NSData alloc] initWithBytesNoCopy:const_cast<wxUint8*>(data) length:length];
+ SetNSSound([[NSSound alloc] initWithData:theData]);
+ [m_cocoaNSSound release];
+ [theData release];
+ return m_cocoaNSSound;
+}
+
+void wxSound::SetNSSound(WX_NSSound cocoaNSSound)
+{
+ bool need_debug = cocoaNSSound || m_cocoaNSSound;
+ if(need_debug) wxLogTrace(wxTRACE_COCOA_RetainRelease,wxT("wxSound=%p::SetNSSound [m_cocoaNSSound=%p retainCount]=%d (about to release)"),this,m_cocoaNSSound,[m_cocoaNSSound retainCount]);
+ [cocoaNSSound retain];
+ [m_cocoaNSSound release];
+ m_cocoaNSSound = cocoaNSSound;
+ [m_cocoaNSSound setDelegate:sm_cocoaDelegate];
+ if(need_debug) wxLogTrace(wxTRACE_COCOA_RetainRelease,wxT("wxSound=%p::SetNSSound [cocoaNSSound=%p retainCount]=%d (just retained)"),this,cocoaNSSound,[cocoaNSSound retainCount]);