// Author: Stefan Csomor
// Modified by: Stefan Csomor
// Created: 2009-01-01
-// RCS-ID: $Id: sound.cpp 61475 2009-07-20 16:47:54Z VZ $
+// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
wxOSXAudioToolboxSoundData(const wxString& fileName);
~wxOSXAudioToolboxSoundData();
-
+
virtual bool Play(unsigned flags);
virtual void DoStop();
protected:
static void CompletionCallback(SystemSoundID mySSID, void * soundRef);
void SoundCompleted();
-
- SystemSoundID m_soundID;
+
+ SystemSoundID m_soundID;
wxString m_sndname; //file path
};
wxOSXAudioToolboxSoundData::wxOSXAudioToolboxSoundData(const wxString& fileName) :
m_soundID(NULL)
-{
+{
m_sndname = fileName;
}
void * soundRef)
{
wxOSXAudioToolboxSoundData* data = (wxOSXAudioToolboxSoundData*) soundRef;
-
+
data->SoundCompleted();
-
+
if (data->IsMarkedForDeletion())
delete data;
}
{
if (m_flags & wxSOUND_LOOP)
AudioServicesPlaySystemSound(m_soundID);
- else
+ else
Stop();
}
- else
+ else
{
Stop();
CFRunLoopStop(CFRunLoopGetCurrent());
{
AudioServicesDisposeSystemSoundID (m_soundID);
m_soundID = NULL;
-
+
wxSound::SoundStopped(this);
}
}
Stop();
m_flags = flags;
-
+
wxCFRef<CFMutableStringRef> cfMutableString(CFStringCreateMutableCopy(NULL, 0, wxCFStringRef(m_sndname)));
CFStringNormalize(cfMutableString,kCFStringNormalizationFormD);
wxCFRef<CFURLRef> url(CFURLCreateWithFileSystemPath(kCFAllocatorDefault, cfMutableString , kCFURLPOSIXPathStyle, false));
if ( sync )
{
- while( m_soundID )
+ while( m_soundID )
{
CFRunLoopRun();
}
}
-
+
return true;
}
bool wxSound::Create(const wxString& fileName, bool isResource)
{
wxCHECK_MSG( !isResource, false, "not implemented" );
-
+
m_data = new wxOSXAudioToolboxSoundData(fileName);
return true;
}