#pragma interface "wave.h"
#endif
+#if wxUSE_WAVE
+
#include "wx/object.h"
class WXDLLEXPORT wxWave : public wxObject
private:
void* m_sndChan;
-
+
wxString m_sndname;
void* m_hSnd;
int m_waveLength;
bool m_isResource;
};
+#endif
#endif
// _WX_WAVE_H_
#include "wx/string.h"
#include "wx/wave.h"
+#if wxUSE_WAVE
+
#ifdef __WXMAC__
#include "wx/mac/private.h"
#ifndef __DARWIN__
ret = true;
else
{ /*
- if (sndChan)
+ if (sndChan)
{ // we're playing
FSClose(SndRefNum);
SndRefNum = 0;
sndChan = 0;
KillTimer(0,timerID);
}
-
+
if (!lpSnd)
return true;
sndChan->qLength = 128;
- if (noErr != SndNewChannel (&sndChan, sampledSynth, initMono | initNoInterp, 0))
+ if (noErr != SndNewChannel (&sndChan, sampledSynth, initMono | initNoInterp, 0))
{
free(sndChan);
sndChan = 0;
return false;
}
- if (!(SndRefNum = MacOpenSndFile ((char *)lpSnd)))
+ if (!(SndRefNum = MacOpenSndFile ((char *)lpSnd)))
{
SndDisposeChannel(sndChan, TRUE);
free(sndChan);
if (fdwSound & SND_ASYNC)
async = true;
- if (SndStartFilePlay(sndChan, SndRefNum, 0, 81920, 0, 0, 0, async) != noErr)
+ if (SndStartFilePlay(sndChan, SndRefNum, 0, 81920, 0, 0, 0, async) != noErr)
{
FSClose (SndRefNum);
SndRefNum = 0;
return false;
}
- if (async)
+ if (async)
{ // haven't finish yet
timerID = SetTimer(0, 0, 250, TimerCallBack);
- }
- else
+ }
+ else
{
FSClose (SndRefNum);
SndRefNum = 0;
sndChan = 0;
}*/
}
-
+
return ret;
}
{
char lpSnd[32];
bool ret = false;
-
- if (m_isResource)
+
+ if (m_isResource)
{
#if TARGET_CARBON
c2pstrcpy((unsigned char *)lpSnd, m_sndname);
c2pstr((char *) lpSnd);
#endif
SndListHandle hSnd;
-
+
hSnd = (SndListHandle) GetNamedResource('snd ',(const unsigned char *) lpSnd);
if ((hSnd != NULL) && (SndPlay((SndChannelPtr)m_sndChan, (SndListHandle) hSnd, async) == noErr))
ret = true;
- }
-
+ }
+
return ret;
}
bool wxWave::FreeData()
{
bool ret = false;
-
+
if (m_isResource)
{
m_sndname.Empty();
}
else
{
- //TODO,
+ //TODO,
}
-
+
return ret;
}
// first, get the volume reference number for the file. Start by
// making a Pstring with just the volume name
strcpy ((char *) name, path);
- if (c = strchr ((char *) name, ':'))
+ if (c = strchr ((char *) name, ':'))
{
c++;
*c = '\0';
void TimerCallBack(HWND hwnd,UINT uMsg,UINT idEvent,DWORD dwTime)
{
- if(!sndChan)
+ if(!sndChan)
{
KillTimer(0,timerID);
return;
}*/
+#endif
#include "wx/string.h"
#include "wx/wave.h"
+#if wxUSE_WAVE
+
#ifdef __WXMAC__
#include "wx/mac/private.h"
#ifndef __DARWIN__
ret = true;
else
{ /*
- if (sndChan)
+ if (sndChan)
{ // we're playing
FSClose(SndRefNum);
SndRefNum = 0;
sndChan = 0;
KillTimer(0,timerID);
}
-
+
if (!lpSnd)
return true;
sndChan->qLength = 128;
- if (noErr != SndNewChannel (&sndChan, sampledSynth, initMono | initNoInterp, 0))
+ if (noErr != SndNewChannel (&sndChan, sampledSynth, initMono | initNoInterp, 0))
{
free(sndChan);
sndChan = 0;
return false;
}
- if (!(SndRefNum = MacOpenSndFile ((char *)lpSnd)))
+ if (!(SndRefNum = MacOpenSndFile ((char *)lpSnd)))
{
SndDisposeChannel(sndChan, TRUE);
free(sndChan);
if (fdwSound & SND_ASYNC)
async = true;
- if (SndStartFilePlay(sndChan, SndRefNum, 0, 81920, 0, 0, 0, async) != noErr)
+ if (SndStartFilePlay(sndChan, SndRefNum, 0, 81920, 0, 0, 0, async) != noErr)
{
FSClose (SndRefNum);
SndRefNum = 0;
return false;
}
- if (async)
+ if (async)
{ // haven't finish yet
timerID = SetTimer(0, 0, 250, TimerCallBack);
- }
- else
+ }
+ else
{
FSClose (SndRefNum);
SndRefNum = 0;
sndChan = 0;
}*/
}
-
+
return ret;
}
{
char lpSnd[32];
bool ret = false;
-
- if (m_isResource)
+
+ if (m_isResource)
{
#if TARGET_CARBON
c2pstrcpy((unsigned char *)lpSnd, m_sndname);
c2pstr((char *) lpSnd);
#endif
SndListHandle hSnd;
-
+
hSnd = (SndListHandle) GetNamedResource('snd ',(const unsigned char *) lpSnd);
if ((hSnd != NULL) && (SndPlay((SndChannelPtr)m_sndChan, (SndListHandle) hSnd, async) == noErr))
ret = true;
- }
-
+ }
+
return ret;
}
bool wxWave::FreeData()
{
bool ret = false;
-
+
if (m_isResource)
{
m_sndname.Empty();
}
else
{
- //TODO,
+ //TODO,
}
-
+
return ret;
}
// first, get the volume reference number for the file. Start by
// making a Pstring with just the volume name
strcpy ((char *) name, path);
- if (c = strchr ((char *) name, ':'))
+ if (c = strchr ((char *) name, ':'))
{
c++;
*c = '\0';
void TimerCallBack(HWND hwnd,UINT uMsg,UINT idEvent,DWORD dwTime)
{
- if(!sndChan)
+ if(!sndChan)
{
KillTimer(0,timerID);
return;
}*/
+#endif