-1, TRUE/true, FALSE/false and tabs replacements.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27838 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2004-06-16 15:22:59 +00:00
parent 695fe764bd
commit dea7e44a76
28 changed files with 1080 additions and 1080 deletions

View File

@@ -125,7 +125,7 @@ class WXDLLIMPEXP_MMEDIA wxSoundStream {
// Returns the best size for IO calls // Returns the best size for IO calls
virtual wxUint32 GetBestSize() const { return 1024; } virtual wxUint32 GetBestSize() const { return 1024; }
// SetSoundFormat returns TRUE when the format can be handled. // SetSoundFormat returns true when the format can be handled.
virtual bool SetSoundFormat(const wxSoundFormatBase& format); virtual bool SetSoundFormat(const wxSoundFormatBase& format);
// GetSoundFormat returns the current sound format. // GetSoundFormat returns the current sound format.
@@ -146,7 +146,7 @@ class WXDLLIMPEXP_MMEDIA wxSoundStream {
wxUint32 GetLastAccess() const { return m_lastcount; } wxUint32 GetLastAccess() const { return m_lastcount; }
// This is only useful for device (I think). // This is only useful for device (I think).
virtual bool QueueFilled() const { return TRUE; } virtual bool QueueFilled() const { return true; }
protected: protected:
// Current sound format // Current sound format

View File

@@ -98,7 +98,7 @@ public:
// You should use this function to test whether this file codec can read // You should use this function to test whether this file codec can read
// the stream you passed to it. // the stream you passed to it.
virtual bool CanRead() { return FALSE; } virtual bool CanRead() { return false; }
protected: protected:
wxSoundRouterStream m_codec; wxSoundRouterStream m_codec;

View File

@@ -23,7 +23,7 @@
class wxSoundFormatPcm : public wxSoundFormatBase { class wxSoundFormatPcm : public wxSoundFormatBase {
public: public:
wxSoundFormatPcm(wxUint32 srate = 22500, wxUint8 bps = 8, wxSoundFormatPcm(wxUint32 srate = 22500, wxUint8 bps = 8,
wxUint16 channels = 2, bool sign = TRUE, wxUint16 channels = 2, bool sign = true,
int order = wxLITTLE_ENDIAN); int order = wxLITTLE_ENDIAN);
~wxSoundFormatPcm(); ~wxSoundFormatPcm();

View File

@@ -68,7 +68,7 @@ public:
// Dtor // Dtor
virtual ~wxVideoBaseDriver(); virtual ~wxVideoBaseDriver();
// Usual functions ... They all return FALSE in case of errors. // Usual functions ... They all return false in case of errors.
virtual bool Play() = 0; virtual bool Play() = 0;
virtual bool Stop() = 0; virtual bool Stop() = 0;
virtual bool Pause() = 0; virtual bool Pause() = 0;
@@ -79,7 +79,7 @@ public:
virtual bool GetSize(wxSize& size) const = 0; virtual bool GetSize(wxSize& size) const = 0;
// Test the capability of the driver to handle the specified type // Test the capability of the driver to handle the specified type
virtual bool IsCapable(wxVideoType WXUNUSED(v_type)) const { return FALSE; } virtual bool IsCapable(wxVideoType WXUNUSED(v_type)) const { return false; }
// Return the video codec name // Return the video codec name
virtual wxString GetMovieCodec() const = 0; virtual wxString GetMovieCodec() const = 0;

View File

@@ -245,7 +245,7 @@ void MMBoardSoundFile::SetPosition(MMBoardTime btime)
bool MMBoardSoundFile::NeedWindow() bool MMBoardSoundFile::NeedWindow()
{ {
return FALSE; return false;
} }
void MMBoardSoundFile::SetWindow(wxWindow *WXUNUSED(window)) void MMBoardSoundFile::SetWindow(wxWindow *WXUNUSED(window))
@@ -375,7 +375,7 @@ MMBoardVideoFile::~MMBoardVideoFile()
bool MMBoardVideoFile::NeedWindow() bool MMBoardVideoFile::NeedWindow()
{ {
return TRUE; return true;
} }
void MMBoardVideoFile::SetWindow(wxWindow *window) void MMBoardVideoFile::SetWindow(wxWindow *window)

View File

@@ -284,7 +284,7 @@ MMBoardFrame::MMBoardFrame(const wxString& title, const wxPoint& pos, const wxSi
// Initialize main slider // Initialize main slider
m_positionSlider = new wxSlider( m_panel, MMBoard_PositionSlider, 0, 0, 60, m_positionSlider = new wxSlider( m_panel, MMBoard_PositionSlider, 0, 0, 60,
wxDefaultPosition, wxSize(300, -1), wxDefaultPosition, wxSize(300, wxDefaultSize.y),
wxSL_HORIZONTAL | wxSL_AUTOTICKS); wxSL_HORIZONTAL | wxSL_AUTOTICKS);
m_positionSlider->SetPageSize(60); // 60 secs m_positionSlider->SetPageSize(60); // 60 secs
m_positionSlider->Disable(); m_positionSlider->Disable();

View File

@@ -46,7 +46,7 @@
IMPLEMENT_DYNAMIC_CLASS(wxCDAudioWin, wxCDAudio) IMPLEMENT_DYNAMIC_CLASS(wxCDAudioWin, wxCDAudio)
wxCDAudioWin::wxCDAudioWin(void) wxCDAudioWin::wxCDAudioWin(void)
: wxCDAudio(), m_trksize(NULL), m_trkpos(NULL), m_toc(NULL), m_ok(TRUE) : wxCDAudio(), m_trksize(NULL), m_trkpos(NULL), m_toc(NULL), m_ok(true)
{ {
MCI_OPEN_PARMS open_struct; MCI_OPEN_PARMS open_struct;
MCI_SET_PARMS set_struct; MCI_SET_PARMS set_struct;
@@ -56,7 +56,7 @@ wxCDAudioWin::wxCDAudioWin(void)
DWORD ret = mciSendCommand((MCIDEVICEID)NULL, MCI_OPEN, MCI_OPEN_TYPE, DWORD ret = mciSendCommand((MCIDEVICEID)NULL, MCI_OPEN, MCI_OPEN_TYPE,
(DWORD)&open_struct); (DWORD)&open_struct);
if (ret) { if (ret) {
m_ok = FALSE; m_ok = false;
return; return;
} }
m_internal->dev_id = open_struct.wDeviceID; m_internal->dev_id = open_struct.wDeviceID;
@@ -150,7 +150,7 @@ bool wxCDAudioWin::Play(const wxCDtime& beg_time, const wxCDtime& end_time)
MCI_PLAY_PARMS play_struct; MCI_PLAY_PARMS play_struct;
if (!m_ok) if (!m_ok)
return FALSE; return false;
tmsf = MCI_MAKE_TMSF(beg_time.track, beg_time.min, tmsf = MCI_MAKE_TMSF(beg_time.track, beg_time.min,
beg_time.sec, 0); beg_time.sec, 0);
@@ -160,13 +160,13 @@ bool wxCDAudioWin::Play(const wxCDtime& beg_time, const wxCDtime& end_time)
play_struct.dwTo = tmsf; play_struct.dwTo = tmsf;
mciSendCommand(m_internal->dev_id, MCI_PLAY, 0, (DWORD)&play_struct); mciSendCommand(m_internal->dev_id, MCI_PLAY, 0, (DWORD)&play_struct);
return TRUE; return true;
} }
bool wxCDAudioWin::Pause(void) bool wxCDAudioWin::Pause(void)
{ {
if (!m_ok) if (!m_ok)
return FALSE; return false;
return (mciSendCommand(m_internal->dev_id, MCI_PAUSE, 0, 0) == 0); return (mciSendCommand(m_internal->dev_id, MCI_PAUSE, 0, 0) == 0);
} }
@@ -174,7 +174,7 @@ bool wxCDAudioWin::Pause(void)
bool wxCDAudioWin::Resume(void) bool wxCDAudioWin::Resume(void)
{ {
if (!m_ok) if (!m_ok)
return FALSE; return false;
return (mciSendCommand(m_internal->dev_id, MCI_RESUME, 0, 0) == 0); return (mciSendCommand(m_internal->dev_id, MCI_RESUME, 0, 0) == 0);
} }

View File

@@ -63,25 +63,25 @@ bool wxSoundAiff::CanRead()
wxUint32 signature1, signature2, len; wxUint32 signature1, signature2, len;
if (m_input->Read(&signature1, 4).LastRead() != 4) if (m_input->Read(&signature1, 4).LastRead() != 4)
return FALSE; return false;
if (wxUINT32_SWAP_ON_BE(signature1) != FORM_SIGNATURE) { if (wxUINT32_SWAP_ON_BE(signature1) != FORM_SIGNATURE) {
m_input->Ungetch(&signature1, 4); m_input->Ungetch(&signature1, 4);
return FALSE; return false;
} }
m_input->Read(&len, 4); m_input->Read(&len, 4);
if (m_input->LastRead() != 4) { if (m_input->LastRead() != 4) {
m_input->Ungetch(&len, m_input->LastRead()); m_input->Ungetch(&len, m_input->LastRead());
m_input->Ungetch(&signature1, 4); m_input->Ungetch(&signature1, 4);
return FALSE; return false;
} }
if (m_input->Read(&signature2, 4).LastRead() != 4) { if (m_input->Read(&signature2, 4).LastRead() != 4) {
m_input->Ungetch(&signature2, m_input->LastRead()); m_input->Ungetch(&signature2, m_input->LastRead());
m_input->Ungetch(&len, 4); m_input->Ungetch(&len, 4);
m_input->Ungetch(&signature1, 4); m_input->Ungetch(&signature1, 4);
return FALSE; return false;
} }
m_input->Ungetch(&signature2, 4); m_input->Ungetch(&signature2, 4);
@@ -91,12 +91,12 @@ bool wxSoundAiff::CanRead()
if ( if (
wxUINT32_SWAP_ON_BE(signature2) != AIFF_SIGNATURE && wxUINT32_SWAP_ON_BE(signature2) != AIFF_SIGNATURE &&
wxUINT32_SWAP_ON_BE(signature2) != AIFC_SIGNATURE) wxUINT32_SWAP_ON_BE(signature2) != AIFC_SIGNATURE)
return FALSE; return false;
return TRUE; return true;
} }
#define FAIL_WITH(condition, err) if (condition) { m_snderror = err; return FALSE; } #define FAIL_WITH(condition, err) if (condition) { m_snderror = err; return false; }
bool wxSoundAiff::PrepareToPlay() bool wxSoundAiff::PrepareToPlay()
{ {
@@ -106,11 +106,11 @@ bool wxSoundAiff::PrepareToPlay()
if (!m_input) { if (!m_input) {
m_snderror = wxSOUND_INVSTRM; m_snderror = wxSOUND_INVSTRM;
return FALSE; return false;
} }
m_snderror = wxSOUND_NOERROR; m_snderror = wxSOUND_NOERROR;
data.BigEndianOrdered(TRUE); data.BigEndianOrdered(true);
FAIL_WITH(m_input->Read(&signature, 4).LastRead() != 4, wxSOUND_INVSTRM); FAIL_WITH(m_input->Read(&signature, 4).LastRead() != 4, wxSOUND_INVSTRM);
FAIL_WITH(wxUINT32_SWAP_ON_BE(signature) != FORM_SIGNATURE, wxSOUND_INVSTRM); FAIL_WITH(wxUINT32_SWAP_ON_BE(signature) != FORM_SIGNATURE, wxSOUND_INVSTRM);
@@ -127,7 +127,7 @@ bool wxSoundAiff::PrepareToPlay()
wxUINT32_SWAP_ON_BE(signature) != AIFC_SIGNATURE, wxSOUND_INVSTRM); wxUINT32_SWAP_ON_BE(signature) != AIFC_SIGNATURE, wxSOUND_INVSTRM);
// "AIFF" / "AIFC" // "AIFF" / "AIFC"
end_headers = FALSE; end_headers = false;
while (!end_headers) { while (!end_headers) {
FAIL_WITH(m_input->Read(&signature, 4).LastRead() != 4, wxSOUND_INVSTRM); FAIL_WITH(m_input->Read(&signature, 4).LastRead() != 4, wxSOUND_INVSTRM);
@@ -148,11 +148,11 @@ bool wxSoundAiff::PrepareToPlay()
sndformat.SetSampleRate((wxUint32) srate); sndformat.SetSampleRate((wxUint32) srate);
sndformat.SetBPS(bps); sndformat.SetBPS(bps);
sndformat.SetChannels(channels); sndformat.SetChannels(channels);
sndformat.Signed(FALSE); sndformat.Signed(false);
sndformat.SetOrder(wxBIG_ENDIAN); sndformat.SetOrder(wxBIG_ENDIAN);
if (!SetSoundFormat(sndformat)) if (!SetSoundFormat(sndformat))
return FALSE; return false;
// We pass all data left // We pass all data left
m_input->SeekI(len-18, wxFromCurrent); m_input->SeekI(len-18, wxFromCurrent);
break; break;
@@ -165,7 +165,7 @@ bool wxSoundAiff::PrepareToPlay()
m_base_offset = m_input->TellI(); m_base_offset = m_input->TellI();
// len-8 bytes of samples // len-8 bytes of samples
FinishPreparation(len - 8); FinishPreparation(len - 8);
end_headers = TRUE; end_headers = true;
break; break;
} }
default: default:
@@ -173,28 +173,28 @@ bool wxSoundAiff::PrepareToPlay()
break; break;
} }
} }
return TRUE; return true;
} }
bool wxSoundAiff::PrepareToRecord(wxUint32 WXUNUSED(time)) bool wxSoundAiff::PrepareToRecord(wxUint32 WXUNUSED(time))
{ {
// TODO // TODO
return FALSE; return false;
} }
bool wxSoundAiff::FinishRecording() bool wxSoundAiff::FinishRecording()
{ {
// TODO // TODO
return FALSE; return false;
} }
bool wxSoundAiff::RepositionStream(wxUint32 WXUNUSED(position)) bool wxSoundAiff::RepositionStream(wxUint32 WXUNUSED(position))
{ {
// If the stream is not seekable "TellI() returns wxInvalidOffset" we cannot reposition stream // If the stream is not seekable "TellI() returns wxInvalidOffset" we cannot reposition stream
if (m_base_offset == wxInvalidOffset) if (m_base_offset == wxInvalidOffset)
return FALSE; return false;
m_input->SeekI(m_base_offset, wxFromStart); m_input->SeekI(m_base_offset, wxFromStart);
return TRUE; return true;
} }
wxUint32 wxSoundAiff::GetData(void *buffer, wxUint32 len) wxUint32 wxSoundAiff::GetData(void *buffer, wxUint32 len)

View File

@@ -72,7 +72,7 @@ wxSoundStream::~wxSoundStream()
// important function of the wxSoundStream class. It prepares the stream to // important function of the wxSoundStream class. It prepares the stream to
// receive or send the data in a strict format. Normally, the sound stream // receive or send the data in a strict format. Normally, the sound stream
// should be ready to accept any format it is asked to manage but in certain // should be ready to accept any format it is asked to manage but in certain
// cases, it really cannot: in that case it returns FALSE. To have more // cases, it really cannot: in that case it returns false. To have more
// details in the functionnalities of SetSoundFormat see // details in the functionnalities of SetSoundFormat see
// wxSoundRouterStream::SetSoundFormat() // wxSoundRouterStream::SetSoundFormat()
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -84,7 +84,7 @@ bool wxSoundStream::SetSoundFormat(const wxSoundFormatBase& format)
// create a new one by cloning the format passed in parameter // create a new one by cloning the format passed in parameter
m_sndformat = format.Clone(); m_sndformat = format.Clone();
return TRUE; return true;
} }

View File

@@ -279,11 +279,11 @@ bool wxSoundStreamPcm::SetSoundFormat(const wxSoundFormatBase& format)
if (m_sndio->SetSoundFormat(format)) { if (m_sndio->SetSoundFormat(format)) {
m_function_out = NULL; m_function_out = NULL;
m_function_in = NULL; m_function_in = NULL;
return TRUE; return true;
} }
if (format.GetType() != wxSOUND_PCM) { if (format.GetType() != wxSOUND_PCM) {
m_snderror = wxSOUND_INVFRMT; m_snderror = wxSOUND_INVFRMT;
return FALSE; return false;
} }
if (m_sndformat) if (m_sndformat)
delete m_sndformat; delete m_sndformat;
@@ -300,11 +300,11 @@ bool wxSoundStreamPcm::SetSoundFormat(const wxSoundFormatBase& format)
src_rate = pcm_format->GetSampleRate(); src_rate = pcm_format->GetSampleRate();
dst_rate = pcm_format2->GetSampleRate(); dst_rate = pcm_format2->GetSampleRate();
m_needResampling = TRUE; m_needResampling = true;
if (src_rate < dst_rate) if (src_rate < dst_rate)
m_expandSamples = TRUE; m_expandSamples = true;
else else
m_expandSamples = FALSE; m_expandSamples = false;
m_pitch = (src_rate << FLOATBITS) / dst_rate; m_pitch = (src_rate << FLOATBITS) / dst_rate;
} }
#endif #endif
@@ -327,7 +327,7 @@ bool wxSoundStreamPcm::SetSoundFormat(const wxSoundFormatBase& format)
break; break;
default: default:
// TODO: Add something here: error, log, ... // TODO: Add something here: error, log, ...
return FALSE; return false;
} }
switch (pcm_format2->GetBPS()) { switch (pcm_format2->GetBPS()) {
case 8: case 8:
@@ -338,7 +338,7 @@ bool wxSoundStreamPcm::SetSoundFormat(const wxSoundFormatBase& format)
break; break;
default: default:
// TODO: Add something here: error, log, ... // TODO: Add something here: error, log, ...
return FALSE; return false;
} }
if (pcm_format2->Signed() != pcm_format->Signed()) if (pcm_format2->Signed() != pcm_format->Signed())
@@ -399,7 +399,7 @@ bool wxSoundStreamPcm::SetSoundFormat(const wxSoundFormatBase& format)
wxUnusedVar( SetSoundFormatReturn ); wxUnusedVar( SetSoundFormatReturn );
m_sndformat = new_format; m_sndformat = new_format;
return TRUE; return true;
} }
wxUint32 wxSoundStreamPcm::GetWriteSize(wxUint32 len) const wxUint32 wxSoundStreamPcm::GetWriteSize(wxUint32 len) const

View File

@@ -62,7 +62,7 @@ wxSoundStreamESD::wxSoundStreamESD(const wxString& hostname)
wxSoundFormatPcm pcm_default; wxSoundFormatPcm pcm_default;
// First, we make some basic test: is there ESD on this computer ? // First, we make some basic test: is there ESD on this computer ?
m_esd_ok = FALSE; m_esd_ok = false;
if (hostname.IsNull()) if (hostname.IsNull())
m_fd_output = esd_play_stream(ESD_PLAY | ESD_STREAM, 22050, m_fd_output = esd_play_stream(ESD_PLAY | ESD_STREAM, 22050,
@@ -86,9 +86,9 @@ wxSoundStreamESD::wxSoundStreamESD(const wxString& hostname)
// Initialize some variable // Initialize some variable
m_snderror = wxSOUND_NOERROR; m_snderror = wxSOUND_NOERROR;
m_esd_stop = TRUE; m_esd_stop = true;
m_q_filled = TRUE; m_q_filled = true;
m_esd_ok = TRUE; m_esd_ok = true;
m_fd_output= -1; m_fd_output= -1;
m_fd_input = -1; m_fd_input = -1;
#endif // defined HAVE_ESD_H #endif // defined HAVE_ESD_H
@@ -154,7 +154,7 @@ wxSoundStream& wxSoundStreamESD::Write(const void *buffer, wxUint32 len)
else else
m_snderror = wxSOUND_NOERROR; m_snderror = wxSOUND_NOERROR;
m_q_filled = TRUE; m_q_filled = true;
return *this; return *this;
#endif // defined HAVE_ESD_H #endif // defined HAVE_ESD_H
@@ -168,18 +168,18 @@ bool wxSoundStreamESD::SetSoundFormat(const wxSoundFormatBase& format)
{ {
#ifndef HAVE_ESD_H #ifndef HAVE_ESD_H
m_snderror = wxSOUND_INVDEV; m_snderror = wxSOUND_INVDEV;
return FALSE; return false;
#else #else
wxSoundFormatPcm *pcm_format; wxSoundFormatPcm *pcm_format;
if (format.GetType() != wxSOUND_PCM) { if (format.GetType() != wxSOUND_PCM) {
m_snderror = wxSOUND_INVFRMT; m_snderror = wxSOUND_INVFRMT;
return FALSE; return false;
} }
if (!m_esd_ok) { if (!m_esd_ok) {
m_snderror = wxSOUND_INVDEV; m_snderror = wxSOUND_INVDEV;
return FALSE; return false;
} }
if (m_sndformat) if (m_sndformat)
@@ -188,7 +188,7 @@ bool wxSoundStreamESD::SetSoundFormat(const wxSoundFormatBase& format)
m_sndformat = format.Clone(); m_sndformat = format.Clone();
if (!m_sndformat) { if (!m_sndformat) {
m_snderror = wxSOUND_MEMERROR; m_snderror = wxSOUND_MEMERROR;
return FALSE; return false;
} }
pcm_format = (wxSoundFormatPcm *)m_sndformat; pcm_format = (wxSoundFormatPcm *)m_sndformat;
@@ -198,9 +198,9 @@ bool wxSoundStreamESD::SetSoundFormat(const wxSoundFormatBase& format)
m_snderror = wxSOUND_NOERROR; m_snderror = wxSOUND_NOERROR;
if (*pcm_format != format) { if (*pcm_format != format) {
m_snderror = wxSOUND_NOEXACT; m_snderror = wxSOUND_NOEXACT;
return FALSE; return false;
} }
return TRUE; return true;
#endif // defined HAVE_ESD_H #endif // defined HAVE_ESD_H
} }
@@ -234,7 +234,7 @@ static void _wxSound_OSS_CBack(gpointer data, int source,
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
void wxSoundStreamESD::WakeUpEvt(int evt) void wxSoundStreamESD::WakeUpEvt(int evt)
{ {
m_q_filled = FALSE; m_q_filled = false;
OnSoundEvent(evt); OnSoundEvent(evt);
} }
@@ -245,14 +245,14 @@ bool wxSoundStreamESD::StartProduction(int evt)
{ {
#ifndef HAVE_ESD_H #ifndef HAVE_ESD_H
m_snderror = wxSOUND_INVDEV; m_snderror = wxSOUND_INVDEV;
return FALSE; return false;
#else #else
wxSoundFormatPcm *pcm; wxSoundFormatPcm *pcm;
int flag = 0; int flag = 0;
if (!m_esd_ok) { if (!m_esd_ok) {
m_snderror = wxSOUND_INVDEV; m_snderror = wxSOUND_INVDEV;
return FALSE; return false;
} }
if (!m_esd_stop) if (!m_esd_stop)
@@ -286,10 +286,10 @@ bool wxSoundStreamESD::StartProduction(int evt)
} }
#endif #endif
m_esd_stop = FALSE; m_esd_stop = false;
m_q_filled = FALSE; m_q_filled = false;
return TRUE; return true;
#endif // defined HAVE_ESD_H #endif // defined HAVE_ESD_H
} }
@@ -300,10 +300,10 @@ bool wxSoundStreamESD::StopProduction()
{ {
#ifndef HAVE_ESD_H #ifndef HAVE_ESD_H
m_snderror = wxSOUND_INVDEV; m_snderror = wxSOUND_INVDEV;
return FALSE; return false;
#else #else
if (m_esd_stop) if (m_esd_stop)
return FALSE; return false;
if (m_fd_input != -1) { if (m_fd_input != -1) {
esd_close(m_fd_input); esd_close(m_fd_input);
@@ -320,9 +320,9 @@ bool wxSoundStreamESD::StopProduction()
m_fd_input = -1; m_fd_input = -1;
m_fd_output= -1; m_fd_output= -1;
m_esd_stop = TRUE; m_esd_stop = true;
m_q_filled = TRUE; m_q_filled = true;
return TRUE; return true;
#endif // defined HAVE_ESD_H #endif // defined HAVE_ESD_H
} }
@@ -350,7 +350,7 @@ void wxSoundStreamESD::DetectBest(wxSoundFormatPcm *pcm)
best_pcm.SetBPS(8); best_pcm.SetBPS(8);
best_pcm.SetOrder(wxLITTLE_ENDIAN); best_pcm.SetOrder(wxLITTLE_ENDIAN);
best_pcm.Signed(TRUE); best_pcm.Signed(true);
// Finally recopy the new format // Finally recopy the new format
*pcm = best_pcm; *pcm = best_pcm;

View File

@@ -78,7 +78,7 @@ wxSoundStream& wxSoundRouterStream::Write(const void *buffer, wxUint32 len)
// sound driver using the specified format. If this fails, it uses personnal // sound driver using the specified format. If this fails, it uses personnal
// codec converters: for the moment there is a PCM converter (PCM to PCM: // codec converters: for the moment there is a PCM converter (PCM to PCM:
// with optional resampling, ...), an ULAW converter (ULAW to PCM), a G72X // with optional resampling, ...), an ULAW converter (ULAW to PCM), a G72X
// converter (G72X to PCM). If nothing works, it returns FALSE. // converter (G72X to PCM). If nothing works, it returns false.
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
bool wxSoundRouterStream::SetSoundFormat(const wxSoundFormatBase& format) bool wxSoundRouterStream::SetSoundFormat(const wxSoundFormatBase& format)
{ {
@@ -89,12 +89,12 @@ bool wxSoundRouterStream::SetSoundFormat(const wxSoundFormatBase& format)
if (m_sndio->SetSoundFormat(format)) { if (m_sndio->SetSoundFormat(format)) {
// We are lucky, it is working. // We are lucky, it is working.
wxSoundStream::SetSoundFormat(m_sndio->GetSoundFormat()); wxSoundStream::SetSoundFormat(m_sndio->GetSoundFormat());
return TRUE; return true;
} }
switch(format.GetType()) { switch(format.GetType()) {
case wxSOUND_NOFORMAT: case wxSOUND_NOFORMAT:
return FALSE; return false;
case wxSOUND_PCM: case wxSOUND_PCM:
m_router = new wxSoundStreamPcm(*m_sndio); m_router = new wxSoundStreamPcm(*m_sndio);
m_router->SetSoundFormat(format); m_router->SetSoundFormat(format);
@@ -112,11 +112,11 @@ bool wxSoundRouterStream::SetSoundFormat(const wxSoundFormatBase& format)
m_router->SetSoundFormat(format); m_router->SetSoundFormat(format);
break; break;
default: default:
return FALSE; return false;
} }
wxSoundStream::SetSoundFormat(m_router->GetSoundFormat()); wxSoundStream::SetSoundFormat(m_router->GetSoundFormat());
return TRUE; return true;
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -139,19 +139,19 @@ bool wxSoundRouterStream::StartProduction(int evt)
{ {
if (!m_router) { if (!m_router) {
if (m_sndio->StartProduction(evt)) if (m_sndio->StartProduction(evt))
return TRUE; return true;
m_snderror = m_sndio->GetError(); m_snderror = m_sndio->GetError();
m_lastcount = m_sndio->GetLastAccess(); m_lastcount = m_sndio->GetLastAccess();
return FALSE; return false;
} }
if (m_router->StartProduction(evt)) if (m_router->StartProduction(evt))
return TRUE; return true;
m_snderror = m_router->GetError(); m_snderror = m_router->GetError();
m_lastcount = m_router->GetLastAccess(); m_lastcount = m_router->GetLastAccess();
return FALSE; return false;
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -161,19 +161,19 @@ bool wxSoundRouterStream::StopProduction()
{ {
if (!m_router) { if (!m_router) {
if (m_sndio->StopProduction()) if (m_sndio->StopProduction())
return TRUE; return true;
m_snderror = m_sndio->GetError(); m_snderror = m_sndio->GetError();
m_lastcount = m_sndio->GetLastAccess(); m_lastcount = m_sndio->GetLastAccess();
return FALSE; return false;
} }
if (m_router->StopProduction()) if (m_router->StopProduction())
return TRUE; return true;
m_snderror = m_router->GetError(); m_snderror = m_router->GetError();
m_lastcount = m_router->GetLastAccess(); m_lastcount = m_router->GetLastAccess();
return FALSE; return false;
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -187,7 +187,7 @@ wxSoundFileStream::wxSoundFileStream(wxInputStream& stream,
{ {
m_length = 0; m_length = 0;
m_bytes_left = 0; m_bytes_left = 0;
m_prepared = FALSE; m_prepared = false;
} }
wxSoundFileStream::wxSoundFileStream(wxOutputStream& stream, wxSoundFileStream::wxSoundFileStream(wxOutputStream& stream,
@@ -197,7 +197,7 @@ wxSoundFileStream::wxSoundFileStream(wxOutputStream& stream,
{ {
m_length = 0; m_length = 0;
m_bytes_left = 0; m_bytes_left = 0;
m_prepared = FALSE; m_prepared = false;
} }
wxSoundFileStream::~wxSoundFileStream() wxSoundFileStream::~wxSoundFileStream()
@@ -209,51 +209,51 @@ wxSoundFileStream::~wxSoundFileStream()
bool wxSoundFileStream::Play() bool wxSoundFileStream::Play()
{ {
if (m_state != wxSOUND_FILE_STOPPED) if (m_state != wxSOUND_FILE_STOPPED)
return FALSE; return false;
if (!m_prepared) if (!m_prepared)
if (!PrepareToPlay()) if (!PrepareToPlay())
return FALSE; return false;
m_state = wxSOUND_FILE_PLAYING; m_state = wxSOUND_FILE_PLAYING;
if (!StartProduction(wxSOUND_OUTPUT)) if (!StartProduction(wxSOUND_OUTPUT))
return FALSE; return false;
return TRUE; return true;
} }
bool wxSoundFileStream::Record(wxUint32 time) bool wxSoundFileStream::Record(wxUint32 time)
{ {
if (m_state != wxSOUND_FILE_STOPPED) if (m_state != wxSOUND_FILE_STOPPED)
return FALSE; return false;
if (!PrepareToRecord(time)) if (!PrepareToRecord(time))
return FALSE; return false;
FinishPreparation(m_sndformat->GetBytesFromTime(time)); FinishPreparation(m_sndformat->GetBytesFromTime(time));
m_state = wxSOUND_FILE_RECORDING; m_state = wxSOUND_FILE_RECORDING;
if (!StartProduction(wxSOUND_INPUT)) if (!StartProduction(wxSOUND_INPUT))
return FALSE; return false;
return TRUE; return true;
} }
bool wxSoundFileStream::Stop() bool wxSoundFileStream::Stop()
{ {
if (m_state == wxSOUND_FILE_STOPPED) if (m_state == wxSOUND_FILE_STOPPED)
return FALSE; return false;
if (!StopProduction()) if (!StopProduction())
return FALSE; return false;
m_prepared = FALSE; m_prepared = false;
if (m_state == wxSOUND_FILE_RECORDING) if (m_state == wxSOUND_FILE_RECORDING)
if (!FinishRecording()) { if (!FinishRecording()) {
m_state = wxSOUND_FILE_STOPPED; m_state = wxSOUND_FILE_STOPPED;
return FALSE; return false;
} }
if (m_input) if (m_input)
@@ -263,35 +263,35 @@ bool wxSoundFileStream::Stop()
m_output->SeekO(0, wxFromStart); m_output->SeekO(0, wxFromStart);
m_state = wxSOUND_FILE_STOPPED; m_state = wxSOUND_FILE_STOPPED;
return TRUE; return true;
} }
bool wxSoundFileStream::Pause() bool wxSoundFileStream::Pause()
{ {
if (m_state == wxSOUND_FILE_PAUSED || m_state == wxSOUND_FILE_STOPPED) if (m_state == wxSOUND_FILE_PAUSED || m_state == wxSOUND_FILE_STOPPED)
return FALSE; return false;
if (!StopProduction()) if (!StopProduction())
return FALSE; return false;
m_oldstate = m_state; m_oldstate = m_state;
m_state = wxSOUND_FILE_PAUSED; m_state = wxSOUND_FILE_PAUSED;
return TRUE; return true;
} }
bool wxSoundFileStream::Resume() bool wxSoundFileStream::Resume()
{ {
if (m_state == wxSOUND_FILE_PLAYING || m_state == wxSOUND_FILE_RECORDING || if (m_state == wxSOUND_FILE_PLAYING || m_state == wxSOUND_FILE_RECORDING ||
m_state == wxSOUND_FILE_STOPPED) m_state == wxSOUND_FILE_STOPPED)
return FALSE; return false;
if (!StartProduction( (m_oldstate == wxSOUND_FILE_PLAYING) ? if (!StartProduction( (m_oldstate == wxSOUND_FILE_PLAYING) ?
wxSOUND_OUTPUT : wxSOUND_INPUT)) wxSOUND_OUTPUT : wxSOUND_INPUT))
return FALSE; return false;
m_state = m_oldstate; m_state = m_oldstate;
return TRUE; return true;
} }
wxSoundStream& wxSoundFileStream::Read(void *buffer, wxUint32 len) wxSoundStream& wxSoundFileStream::Read(void *buffer, wxUint32 len)
@@ -321,9 +321,9 @@ bool wxSoundFileStream::StartProduction(int evt)
m_sndio->SetEventHandler(this); m_sndio->SetEventHandler(this);
if (!m_codec.StartProduction(evt)) if (!m_codec.StartProduction(evt))
return FALSE; return false;
return TRUE; return true;
} }
bool wxSoundFileStream::StopProduction() bool wxSoundFileStream::StopProduction()
@@ -334,7 +334,7 @@ bool wxSoundFileStream::StopProduction()
void wxSoundFileStream::FinishPreparation(wxUint32 len) void wxSoundFileStream::FinishPreparation(wxUint32 len)
{ {
m_bytes_left = m_length = len; m_bytes_left = m_length = len;
m_prepared = TRUE; m_prepared = true;
} }
wxString wxSoundFileStream::GetCodecName() const wxString wxSoundFileStream::GetCodecName() const

View File

@@ -104,7 +104,7 @@ bool wxSoundFormatG72X::operator !=(const wxSoundFormatBase& frmt2) const
wxSoundFormatG72X *g72x = (wxSoundFormatG72X *)&frmt2; wxSoundFormatG72X *g72x = (wxSoundFormatG72X *)&frmt2;
if (frmt2.GetType() != wxSOUND_G72X) if (frmt2.GetType() != wxSOUND_G72X)
return TRUE; return true;
return (g72x->m_srate != m_srate || g72x->m_g72x_type != m_g72x_type); return (g72x->m_srate != m_srate || g72x->m_g72x_type != m_g72x_type);
} }
@@ -196,7 +196,7 @@ bool wxSoundStreamG72X::SetSoundFormat(const wxSoundFormatBase& format)
{ {
if (format.GetType() != wxSOUND_G72X) { if (format.GetType() != wxSOUND_G72X) {
m_snderror = wxSOUND_INVFRMT; m_snderror = wxSOUND_INVFRMT;
return FALSE; return false;
} }
wxSoundFormatPcm pcm; wxSoundFormatPcm pcm;
@@ -210,7 +210,7 @@ bool wxSoundStreamG72X::SetSoundFormat(const wxSoundFormatBase& format)
pcm.SetSampleRate(g72x->GetSampleRate()); pcm.SetSampleRate(g72x->GetSampleRate());
pcm.SetBPS(16); pcm.SetBPS(16);
pcm.SetChannels(1); // Only mono supported pcm.SetChannels(1); // Only mono supported
pcm.Signed(TRUE); pcm.Signed(true);
pcm.SetOrder(wxBYTE_ORDER); pcm.SetOrder(wxBYTE_ORDER);
// Look for the correct codec to use and set its bit width // Look for the correct codec to use and set its bit width
@@ -235,7 +235,7 @@ bool wxSoundStreamG72X::SetSoundFormat(const wxSoundFormatBase& format)
// Let the router finish the work // Let the router finish the work
m_router->SetSoundFormat(pcm); m_router->SetSoundFormat(pcm);
return TRUE; return true;
} }
#define BYTE_SIZE 8 #define BYTE_SIZE 8

View File

@@ -130,7 +130,7 @@ bool wxSoundFormatMSAdpcm::operator !=(const wxSoundFormatBase& frmt2) const
const wxSoundFormatMSAdpcm *adpcm = (const wxSoundFormatMSAdpcm *)&frmt2; const wxSoundFormatMSAdpcm *adpcm = (const wxSoundFormatMSAdpcm *)&frmt2;
if (frmt2.GetType() != wxSOUND_MSADPCM) if (frmt2.GetType() != wxSOUND_MSADPCM)
return TRUE; return true;
return (adpcm->m_srate != m_srate) && (adpcm->m_nchannels != m_nchannels); return (adpcm->m_srate != m_srate) && (adpcm->m_nchannels != m_nchannels);
} }
@@ -143,8 +143,8 @@ wxSoundStreamMSAdpcm::wxSoundStreamMSAdpcm(wxSoundStream& sndio)
{ {
// PCM converter // PCM converter
m_router = new wxSoundRouterStream(sndio); m_router = new wxSoundRouterStream(sndio);
m_got_header = FALSE; m_got_header = false;
m_stereo = FALSE; m_stereo = false;
} }
wxSoundStreamMSAdpcm::~wxSoundStreamMSAdpcm() wxSoundStreamMSAdpcm::~wxSoundStreamMSAdpcm()
@@ -354,7 +354,7 @@ bool wxSoundStreamMSAdpcm::SetSoundFormat(const wxSoundFormatBase& format)
{ {
if (format.GetType() != wxSOUND_MSADPCM) { if (format.GetType() != wxSOUND_MSADPCM) {
m_snderror = wxSOUND_INVFRMT; m_snderror = wxSOUND_INVFRMT;
return FALSE; return false;
} }
wxSoundFormatPcm pcm; wxSoundFormatPcm pcm;
@@ -369,13 +369,13 @@ bool wxSoundStreamMSAdpcm::SetSoundFormat(const wxSoundFormatBase& format)
if (!ncoefs) { if (!ncoefs) {
wxLogError(wxT("Number of ADPCM coefficients must be non null")); wxLogError(wxT("Number of ADPCM coefficients must be non null"));
return FALSE; return false;
} }
pcm.SetSampleRate(adpcm->GetSampleRate()); pcm.SetSampleRate(adpcm->GetSampleRate());
pcm.SetBPS(16); pcm.SetBPS(16);
pcm.SetChannels(adpcm->GetChannels()); pcm.SetChannels(adpcm->GetChannels());
pcm.Signed(TRUE); pcm.Signed(true);
pcm.SetOrder(wxBYTE_ORDER); pcm.SetOrder(wxBYTE_ORDER);
m_stereo = (adpcm->GetChannels() == 2); m_stereo = (adpcm->GetChannels() == 2);
@@ -384,6 +384,6 @@ bool wxSoundStreamMSAdpcm::SetSoundFormat(const wxSoundFormatBase& format)
m_router->SetSoundFormat(pcm); m_router->SetSoundFormat(pcm);
return TRUE; return true;
} }

View File

@@ -40,7 +40,7 @@ wxSoundStreamOSS::wxSoundStreamOSS(const wxString& dev_name)
m_fd = open(dev_name.mb_str(), O_WRONLY); m_fd = open(dev_name.mb_str(), O_WRONLY);
if (m_fd == -1) { if (m_fd == -1) {
// OSS not found // OSS not found
m_oss_ok = FALSE; m_oss_ok = false;
m_snderror = wxSOUND_INVDEV; m_snderror = wxSOUND_INVDEV;
return; return;
} }
@@ -59,9 +59,9 @@ wxSoundStreamOSS::wxSoundStreamOSS(const wxString& dev_name)
// Close OSS // Close OSS
close(m_fd); close(m_fd);
m_oss_ok = TRUE; m_oss_ok = true;
m_oss_stop = TRUE; m_oss_stop = true;
m_q_filled = TRUE; m_q_filled = true;
} }
wxSoundStreamOSS::~wxSoundStreamOSS() wxSoundStreamOSS::~wxSoundStreamOSS()
@@ -86,7 +86,7 @@ wxSoundStream& wxSoundStreamOSS::Read(void *buffer, wxUint32 len)
} }
m_lastcount = (wxUint32)ret = read(m_fd, buffer, len); m_lastcount = (wxUint32)ret = read(m_fd, buffer, len);
m_q_filled = TRUE; m_q_filled = true;
if (ret < 0) if (ret < 0)
m_snderror = wxSOUND_IOERROR; m_snderror = wxSOUND_IOERROR;
@@ -107,7 +107,7 @@ wxSoundStream& wxSoundStreamOSS::Write(const void *buffer, wxUint32 len)
} }
ret = write(m_fd, buffer, len); ret = write(m_fd, buffer, len);
m_q_filled = TRUE; m_q_filled = true;
if (ret < 0) { if (ret < 0) {
m_lastcount = 0; m_lastcount = 0;
@@ -127,12 +127,12 @@ bool wxSoundStreamOSS::SetSoundFormat(const wxSoundFormatBase& format)
if (format.GetType() != wxSOUND_PCM) { if (format.GetType() != wxSOUND_PCM) {
m_snderror = wxSOUND_INVFRMT; m_snderror = wxSOUND_INVFRMT;
return FALSE; return false;
} }
if (!m_oss_ok) { if (!m_oss_ok) {
m_snderror = wxSOUND_INVDEV; m_snderror = wxSOUND_INVDEV;
return FALSE; return false;
} }
if (m_sndformat) if (m_sndformat)
@@ -141,7 +141,7 @@ bool wxSoundStreamOSS::SetSoundFormat(const wxSoundFormatBase& format)
m_sndformat = format.Clone(); m_sndformat = format.Clone();
if (!m_sndformat) { if (!m_sndformat) {
m_snderror = wxSOUND_MEMERROR; m_snderror = wxSOUND_MEMERROR;
return FALSE; return false;
} }
pcm_format = (wxSoundFormatPcm *)m_sndformat; pcm_format = (wxSoundFormatPcm *)m_sndformat;
@@ -150,7 +150,7 @@ bool wxSoundStreamOSS::SetSoundFormat(const wxSoundFormatBase& format)
m_fd = open(m_devname.mb_str(), O_WRONLY); m_fd = open(m_devname.mb_str(), O_WRONLY);
if (m_fd == -1) { if (m_fd == -1) {
m_snderror = wxSOUND_INVDEV; m_snderror = wxSOUND_INVDEV;
return FALSE; return false;
} }
} }
@@ -176,10 +176,10 @@ bool wxSoundStreamOSS::SetSoundFormat(const wxSoundFormatBase& format)
m_snderror = wxSOUND_NOERROR; m_snderror = wxSOUND_NOERROR;
if (*pcm_format != format) { if (*pcm_format != format) {
m_snderror = wxSOUND_NOEXACT; m_snderror = wxSOUND_NOEXACT;
return FALSE; return false;
} }
return TRUE; return true;
} }
bool wxSoundStreamOSS::SetupFormat(wxSoundFormatPcm *pcm_format) bool wxSoundStreamOSS::SetupFormat(wxSoundFormatPcm *pcm_format)
@@ -217,34 +217,34 @@ bool wxSoundStreamOSS::SetupFormat(wxSoundFormatPcm *pcm_format)
switch (tmp) { switch (tmp) {
case AFMT_U8: case AFMT_U8:
pcm_format->SetBPS(8); pcm_format->SetBPS(8);
pcm_format->Signed(FALSE); pcm_format->Signed(false);
break; break;
case AFMT_S8: case AFMT_S8:
pcm_format->SetBPS(8); pcm_format->SetBPS(8);
pcm_format->Signed(TRUE); pcm_format->Signed(true);
break; break;
case AFMT_U16_LE: case AFMT_U16_LE:
pcm_format->SetBPS(16); pcm_format->SetBPS(16);
pcm_format->Signed(FALSE); pcm_format->Signed(false);
pcm_format->SetOrder(wxLITTLE_ENDIAN); pcm_format->SetOrder(wxLITTLE_ENDIAN);
break; break;
case AFMT_U16_BE: case AFMT_U16_BE:
pcm_format->SetBPS(16); pcm_format->SetBPS(16);
pcm_format->Signed(FALSE); pcm_format->Signed(false);
pcm_format->SetOrder(wxBIG_ENDIAN); pcm_format->SetOrder(wxBIG_ENDIAN);
break; break;
case AFMT_S16_LE: case AFMT_S16_LE:
pcm_format->SetBPS(16); pcm_format->SetBPS(16);
pcm_format->Signed(TRUE); pcm_format->Signed(true);
pcm_format->SetOrder(wxLITTLE_ENDIAN); pcm_format->SetOrder(wxLITTLE_ENDIAN);
break; break;
case AFMT_S16_BE: case AFMT_S16_BE:
pcm_format->SetBPS(16); pcm_format->SetBPS(16);
pcm_format->Signed(TRUE); pcm_format->Signed(true);
pcm_format->SetOrder(wxBIG_ENDIAN); pcm_format->SetOrder(wxBIG_ENDIAN);
break; break;
} }
return TRUE; return true;
} }
#ifdef __WXGTK__ #ifdef __WXGTK__
@@ -268,7 +268,7 @@ static void _wxSound_OSS_CBack(gpointer data, int source,
void wxSoundStreamOSS::WakeUpEvt(int evt) void wxSoundStreamOSS::WakeUpEvt(int evt)
{ {
m_q_filled = FALSE; m_q_filled = false;
OnSoundEvent(evt); OnSoundEvent(evt);
} }
@@ -282,7 +282,7 @@ bool wxSoundStreamOSS::StartProduction(int evt)
old_frmt = m_sndformat->Clone(); old_frmt = m_sndformat->Clone();
if (!old_frmt) { if (!old_frmt) {
m_snderror = wxSOUND_MEMERROR; m_snderror = wxSOUND_MEMERROR;
return FALSE; return false;
} }
if (evt == wxSOUND_OUTPUT) if (evt == wxSOUND_OUTPUT)
@@ -292,7 +292,7 @@ bool wxSoundStreamOSS::StartProduction(int evt)
if (m_fd == -1) { if (m_fd == -1) {
m_snderror = wxSOUND_INVDEV; m_snderror = wxSOUND_INVDEV;
return FALSE; return false;
} }
SetSoundFormat(*old_frmt); SetSoundFormat(*old_frmt);
@@ -314,25 +314,25 @@ bool wxSoundStreamOSS::StartProduction(int evt)
ioctl(m_fd, SNDCTL_DSP_SETTRIGGER, &trig); ioctl(m_fd, SNDCTL_DSP_SETTRIGGER, &trig);
m_oss_stop = FALSE; m_oss_stop = false;
m_q_filled = FALSE; m_q_filled = false;
return TRUE; return true;
} }
bool wxSoundStreamOSS::StopProduction() bool wxSoundStreamOSS::StopProduction()
{ {
if (m_oss_stop) if (m_oss_stop)
return FALSE; return false;
#ifdef __WXGTK__ #ifdef __WXGTK__
gdk_input_remove(m_tag); gdk_input_remove(m_tag);
#endif #endif
close(m_fd); close(m_fd);
m_oss_stop = TRUE; m_oss_stop = true;
m_q_filled = TRUE; m_q_filled = true;
return TRUE; return true;
} }
bool wxSoundStreamOSS::QueueFilled() const bool wxSoundStreamOSS::QueueFilled() const
@@ -375,12 +375,12 @@ void wxSoundStreamOSS::DetectBest(wxSoundFormatPcm *pcm)
// It supports signed samples // It supports signed samples
if (pcm->Signed() && if (pcm->Signed() &&
((fmt_mask & (AFMT_S16_LE | AFMT_S16_BE | AFMT_S8)) != 0)) ((fmt_mask & (AFMT_S16_LE | AFMT_S16_BE | AFMT_S8)) != 0))
best_pcm.Signed(TRUE); best_pcm.Signed(true);
// It supports unsigned samples // It supports unsigned samples
if (!pcm->Signed() && if (!pcm->Signed() &&
((fmt_mask & (AFMT_U16_LE | AFMT_U16_BE | AFMT_U8)) != 0)) ((fmt_mask & (AFMT_U16_LE | AFMT_U16_BE | AFMT_U8)) != 0))
best_pcm.Signed(FALSE); best_pcm.Signed(false);
// Finally recopy the new format // Finally recopy the new format
*pcm = best_pcm; *pcm = best_pcm;

View File

@@ -88,7 +88,7 @@ bool wxSoundFormatPcm::operator!=(const wxSoundFormatBase& format) const
wxSoundFormatPcm *format2 = (wxSoundFormatPcm *)&format; wxSoundFormatPcm *format2 = (wxSoundFormatPcm *)&format;
if (format.GetType() != wxSOUND_PCM) if (format.GetType() != wxSOUND_PCM)
return TRUE; return true;
return ( (m_srate != format2->m_srate) || return ( (m_srate != format2->m_srate) ||
(m_bps != format2->m_bps) || (m_bps != format2->m_bps) ||

View File

@@ -82,7 +82,7 @@ bool wxSoundFormatUlaw::operator !=(const wxSoundFormatBase& frmt2) const
wxSoundFormatUlaw *ulaw = (wxSoundFormatUlaw *)&frmt2; wxSoundFormatUlaw *ulaw = (wxSoundFormatUlaw *)&frmt2;
if (frmt2.GetType() != wxSOUND_ULAW) if (frmt2.GetType() != wxSOUND_ULAW)
return TRUE; return true;
return (ulaw->m_srate != m_srate); return (ulaw->m_srate != m_srate);
} }
@@ -160,7 +160,7 @@ bool wxSoundStreamUlaw::SetSoundFormat(const wxSoundFormatBase& format)
{ {
if (format.GetType() != wxSOUND_ULAW) { if (format.GetType() != wxSOUND_ULAW) {
m_snderror = wxSOUND_INVFRMT; m_snderror = wxSOUND_INVFRMT;
return FALSE; return false;
} }
// As the codec only support 16 bits, Mono we must use a wxSoundRouter // As the codec only support 16 bits, Mono we must use a wxSoundRouter
@@ -177,10 +177,10 @@ bool wxSoundStreamUlaw::SetSoundFormat(const wxSoundFormatBase& format)
pcm.SetSampleRate(ulaw->GetSampleRate()); pcm.SetSampleRate(ulaw->GetSampleRate());
pcm.SetBPS(16); pcm.SetBPS(16);
pcm.SetChannels(ulaw->GetChannels()); pcm.SetChannels(ulaw->GetChannels());
pcm.Signed(TRUE); pcm.Signed(true);
pcm.SetOrder(wxBYTE_ORDER); pcm.SetOrder(wxBYTE_ORDER);
m_router->SetSoundFormat(pcm); m_router->SetSoundFormat(pcm);
return TRUE; return true;
} }

View File

@@ -64,7 +64,7 @@ wxString wxSoundWave::GetCodecName() const
return wxString(wxT("wxSoundWave codec")); return wxString(wxT("wxSoundWave codec"));
} }
#define FAIL_WITH(condition, err) if (condition) { m_snderror = err; return FALSE; } #define FAIL_WITH(condition, err) if (condition) { m_snderror = err; return false; }
bool wxSoundWave::CanRead() bool wxSoundWave::CanRead()
{ {
@@ -77,7 +77,7 @@ bool wxSoundWave::CanRead()
if (wxUINT32_SWAP_ON_BE(signature1) != RIFF_SIGNATURE) { if (wxUINT32_SWAP_ON_BE(signature1) != RIFF_SIGNATURE) {
m_input->Ungetch(&signature1, 4); m_input->Ungetch(&signature1, 4);
return FALSE; return false;
} }
// Pass the global length // Pass the global length
@@ -93,9 +93,9 @@ bool wxSoundWave::CanRead()
// Test the second signature // Test the second signature
if (wxUINT32_SWAP_ON_BE(signature2) != WAVE_SIGNATURE) if (wxUINT32_SWAP_ON_BE(signature2) != WAVE_SIGNATURE)
return FALSE; return false;
return TRUE; return true;
} }
bool wxSoundWave::HandleOutputPCM(wxDataInputStream& WXUNUSED(data), wxUint32 len, bool wxSoundWave::HandleOutputPCM(wxDataInputStream& WXUNUSED(data), wxUint32 len,
@@ -108,15 +108,15 @@ bool wxSoundWave::HandleOutputPCM(wxDataInputStream& WXUNUSED(data), wxUint32 le
sndformat.SetSampleRate(sample_fq); sndformat.SetSampleRate(sample_fq);
sndformat.SetBPS(bits_p_spl); sndformat.SetBPS(bits_p_spl);
sndformat.SetChannels(channels); sndformat.SetChannels(channels);
sndformat.Signed(TRUE); sndformat.Signed(true);
sndformat.SetOrder(wxLITTLE_ENDIAN); sndformat.SetOrder(wxLITTLE_ENDIAN);
if (!SetSoundFormat(sndformat)) if (!SetSoundFormat(sndformat))
return FALSE; return false;
m_input->SeekI(len, wxFromCurrent); m_input->SeekI(len, wxFromCurrent);
return TRUE; return true;
} }
bool wxSoundWave::HandleOutputMSADPCM(wxDataInputStream& data, wxUint32 len, bool wxSoundWave::HandleOutputMSADPCM(wxDataInputStream& data, wxUint32 len,
@@ -150,13 +150,13 @@ bool wxSoundWave::HandleOutputMSADPCM(wxDataInputStream& data, wxUint32 len,
delete[] coefs[1]; delete[] coefs[1];
if (!SetSoundFormat(sndformat)) if (!SetSoundFormat(sndformat))
return FALSE; return false;
len -= coefs_len*4 + 4; len -= coefs_len*4 + 4;
m_input->SeekI(len, wxFromCurrent); m_input->SeekI(len, wxFromCurrent);
return TRUE; return true;
} }
bool wxSoundWave::HandleOutputG721(wxDataInputStream& WXUNUSED(data), wxUint32 len, bool wxSoundWave::HandleOutputG721(wxDataInputStream& WXUNUSED(data), wxUint32 len,
@@ -170,11 +170,11 @@ bool wxSoundWave::HandleOutputG721(wxDataInputStream& WXUNUSED(data), wxUint32 l
sndformat.SetG72XType(wxSOUND_G721); sndformat.SetG72XType(wxSOUND_G721);
if (!SetSoundFormat(sndformat)) if (!SetSoundFormat(sndformat))
return FALSE; return false;
m_input->SeekI(len, wxFromCurrent); m_input->SeekI(len, wxFromCurrent);
return TRUE; return true;
} }
bool wxSoundWave::PrepareToPlay() bool wxSoundWave::PrepareToPlay()
@@ -184,11 +184,11 @@ bool wxSoundWave::PrepareToPlay()
if (!m_input) { if (!m_input) {
m_snderror = wxSOUND_INVSTRM; m_snderror = wxSOUND_INVSTRM;
return FALSE; return false;
} }
wxDataInputStream data(*m_input); wxDataInputStream data(*m_input);
data.BigEndianOrdered(FALSE); data.BigEndianOrdered(false);
// Get the first signature // Get the first signature
FAIL_WITH(m_input->Read(&signature, 4).LastRead() != 4, wxSOUND_INVSTRM); FAIL_WITH(m_input->Read(&signature, 4).LastRead() != 4, wxSOUND_INVSTRM);
@@ -205,7 +205,7 @@ bool wxSoundWave::PrepareToPlay()
FAIL_WITH(wxUINT32_SWAP_ON_BE(signature) != WAVE_SIGNATURE, wxSOUND_INVSTRM); FAIL_WITH(wxUINT32_SWAP_ON_BE(signature) != WAVE_SIGNATURE, wxSOUND_INVSTRM);
// "WAVE" // "WAVE"
end_headers = FALSE; end_headers = false;
// Chunk loop // Chunk loop
while (!end_headers) { while (!end_headers) {
FAIL_WITH(m_input->Read(&signature, 4).LastRead() != 4, wxSOUND_INVSTRM); FAIL_WITH(m_input->Read(&signature, 4).LastRead() != 4, wxSOUND_INVSTRM);
@@ -228,31 +228,31 @@ bool wxSoundWave::PrepareToPlay()
if (!HandleOutputPCM(data, len, channels, sample_fq, if (!HandleOutputPCM(data, len, channels, sample_fq,
byte_p_sec, byte_p_spl, byte_p_sec, byte_p_spl,
bits_p_spl)) bits_p_spl))
return FALSE; return false;
break; break;
case 0x02: // MS ADPCM case 0x02: // MS ADPCM
if (!HandleOutputMSADPCM(data, len, if (!HandleOutputMSADPCM(data, len,
channels, sample_fq, channels, sample_fq,
byte_p_sec, byte_p_spl, byte_p_sec, byte_p_spl,
bits_p_spl)) bits_p_spl))
return FALSE; return false;
break; break;
case 0x40: // G721 case 0x40: // G721
if (!HandleOutputG721(data, len, if (!HandleOutputG721(data, len,
channels, sample_fq, channels, sample_fq,
byte_p_sec, byte_p_spl, byte_p_sec, byte_p_spl,
bits_p_spl)) bits_p_spl))
return FALSE; return false;
break; break;
default: default:
m_snderror = wxSOUND_NOCODEC; m_snderror = wxSOUND_NOCODEC;
return FALSE; return false;
} }
break; break;
} }
case DATA_SIGNATURE: // "data" case DATA_SIGNATURE: // "data"
m_base_offset = m_input->TellI(); m_base_offset = m_input->TellI();
end_headers = TRUE; end_headers = true;
FinishPreparation(len); FinishPreparation(len);
break; break;
default: default:
@@ -261,7 +261,7 @@ bool wxSoundWave::PrepareToPlay()
break; break;
} }
} }
return TRUE; return true;
} }
wxSoundFormatBase *wxSoundWave::HandleInputPCM(wxDataOutputStream& data) wxSoundFormatBase *wxSoundWave::HandleInputPCM(wxDataOutputStream& data)
@@ -282,7 +282,7 @@ wxSoundFormatBase *wxSoundWave::HandleInputPCM(wxDataOutputStream& data)
byte_p_sec = pcm->GetBytesFromTime(1); byte_p_sec = pcm->GetBytesFromTime(1);
format = 0x01; format = 0x01;
pcm->Signed(TRUE); pcm->Signed(true);
pcm->SetOrder(wxLITTLE_ENDIAN); pcm->SetOrder(wxLITTLE_ENDIAN);
data << format << channels << sample_fq data << format << channels << sample_fq
@@ -330,14 +330,14 @@ FAIL_WITH(s->Write(&signature, 4).LastWrite() != 4, wxSOUND_INVSTRM);
if (!m_output) { if (!m_output) {
m_snderror = wxSOUND_INVSTRM; m_snderror = wxSOUND_INVSTRM;
return FALSE; return false;
} }
wxDataOutputStream data(*m_output); wxDataOutputStream data(*m_output);
wxDataOutputStream fmt_d_data(fmt_data); wxDataOutputStream fmt_d_data(fmt_data);
data.BigEndianOrdered(FALSE); data.BigEndianOrdered(false);
fmt_d_data.BigEndianOrdered(FALSE); fmt_d_data.BigEndianOrdered(false);
WRITE_SIGNATURE(m_output, RIFF_SIGNATURE); WRITE_SIGNATURE(m_output, RIFF_SIGNATURE);
@@ -359,14 +359,14 @@ FAIL_WITH(s->Write(&signature, 4).LastWrite() != 4, wxSOUND_INVSTRM);
break; break;
default: default:
m_snderror = wxSOUND_NOCODEC; m_snderror = wxSOUND_NOCODEC;
return FALSE; return false;
} }
FAIL_WITH(!frmt, wxSOUND_NOCODEC); FAIL_WITH(!frmt, wxSOUND_NOCODEC);
if (!SetSoundFormat(*frmt)) { if (!SetSoundFormat(*frmt)) {
delete frmt; delete frmt;
return FALSE; return false;
} }
delete frmt; delete frmt;
@@ -387,28 +387,28 @@ FAIL_WITH(s->Write(&signature, 4).LastWrite() != 4, wxSOUND_INVSTRM);
WRITE_SIGNATURE(m_output, DATA_SIGNATURE); WRITE_SIGNATURE(m_output, DATA_SIGNATURE);
data.Write32(m_sndformat->GetBytesFromTime(time)); data.Write32(m_sndformat->GetBytesFromTime(time));
return TRUE; return true;
} }
bool wxSoundWave::FinishRecording() bool wxSoundWave::FinishRecording()
{ {
if (m_output->SeekO(0, wxFromStart) == wxInvalidOffset) if (m_output->SeekO(0, wxFromStart) == wxInvalidOffset)
// We can't but there is no error. // We can't but there is no error.
return TRUE; return true;
if (m_bytes_left == 0) if (m_bytes_left == 0)
return TRUE; return true;
// TODO: Update headers when we stop before the specified time (if possible) // TODO: Update headers when we stop before the specified time (if possible)
return TRUE; return true;
} }
bool wxSoundWave::RepositionStream(wxUint32 WXUNUSED(position)) bool wxSoundWave::RepositionStream(wxUint32 WXUNUSED(position))
{ {
if (m_base_offset == wxInvalidOffset) if (m_base_offset == wxInvalidOffset)
return FALSE; return false;
m_input->SeekI(m_base_offset, wxFromStart); m_input->SeekI(m_base_offset, wxFromStart);
return TRUE; return true;
} }
wxUint32 wxSoundWave::GetData(void *buffer, wxUint32 len) wxUint32 wxSoundWave::GetData(void *buffer, wxUint32 len)

View File

@@ -80,7 +80,7 @@ wxSoundStreamWin::wxSoundStreamWin()
{ {
wxSoundFormatPcm pcm; wxSoundFormatPcm pcm;
m_production_started = FALSE; m_production_started = false;
m_internal = new wxSoundInternal; m_internal = new wxSoundInternal;
if (!m_internal) { if (!m_internal) {
m_snderror = wxSOUND_MEMERROR; m_snderror = wxSOUND_MEMERROR;
@@ -93,10 +93,10 @@ wxSoundStreamWin::wxSoundStreamWin()
CreateSndWindow(); CreateSndWindow();
SetSoundFormat(pcm); SetSoundFormat(pcm);
m_internal->m_input_enabled = FALSE; m_internal->m_input_enabled = false;
m_internal->m_output_enabled = FALSE; m_internal->m_output_enabled = false;
m_waiting_for = FALSE; m_waiting_for = false;
if (!OpenDevice(wxSOUND_OUTPUT)) { if (!OpenDevice(wxSOUND_OUTPUT)) {
m_snderror = wxSOUND_NOERROR; //next call to OpenDevice won't do this m_snderror = wxSOUND_NOERROR; //next call to OpenDevice won't do this
@@ -199,7 +199,7 @@ bool wxSoundStreamWin::OpenDevice(int mode)
if (!m_sndformat) { if (!m_sndformat) {
m_snderror = wxSOUND_INVFRMT; m_snderror = wxSOUND_INVFRMT;
return FALSE; return false;
} }
pcm = (wxSoundFormatPcm *)m_sndformat; pcm = (wxSoundFormatPcm *)m_sndformat;
@@ -225,13 +225,13 @@ bool wxSoundStreamWin::OpenDevice(int mode)
if (result != MMSYSERR_NOERROR) { if (result != MMSYSERR_NOERROR) {
m_snderror = wxSOUND_INVDEV; m_snderror = wxSOUND_INVDEV;
return FALSE; return false;
} }
m_output_frag_out = WXSOUND_MAX_QUEUE-1; m_output_frag_out = WXSOUND_MAX_QUEUE-1;
m_current_frag_out = 0; m_current_frag_out = 0;
m_internal->m_output_enabled = TRUE; m_internal->m_output_enabled = true;
} }
// ----------------------------------- // -----------------------------------
// Open the driver for Input operation // Open the driver for Input operation
@@ -246,29 +246,29 @@ bool wxSoundStreamWin::OpenDevice(int mode)
if (result != MMSYSERR_NOERROR) { if (result != MMSYSERR_NOERROR) {
m_snderror = wxSOUND_INVDEV; m_snderror = wxSOUND_INVDEV;
return FALSE; return false;
} }
m_current_frag_in = WXSOUND_MAX_QUEUE-1; m_current_frag_in = WXSOUND_MAX_QUEUE-1;
m_input_frag_in = 0; m_input_frag_in = 0;
m_internal->m_input_enabled = TRUE; m_internal->m_input_enabled = true;
} }
if (mode & wxSOUND_OUTPUT) { if (mode & wxSOUND_OUTPUT) {
if (!AllocHeaders(wxSOUND_OUTPUT)) { if (!AllocHeaders(wxSOUND_OUTPUT)) {
CloseDevice(); CloseDevice();
return FALSE; return false;
} }
} }
if (mode & wxSOUND_INPUT) { if (mode & wxSOUND_INPUT) {
if (!AllocHeaders(wxSOUND_INPUT)) { if (!AllocHeaders(wxSOUND_INPUT)) {
CloseDevice(); CloseDevice();
return FALSE; return false;
} }
} }
return TRUE; return true;
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
@@ -279,13 +279,13 @@ void wxSoundStreamWin::CloseDevice()
{ {
if (m_internal->m_output_enabled) { if (m_internal->m_output_enabled) {
FreeHeaders(wxSOUND_OUTPUT); FreeHeaders(wxSOUND_OUTPUT);
m_internal->m_output_enabled = FALSE; m_internal->m_output_enabled = false;
waveOutClose(m_internal->m_devout); waveOutClose(m_internal->m_devout);
} }
if (m_internal->m_input_enabled) { if (m_internal->m_input_enabled) {
FreeHeaders(wxSOUND_INPUT); FreeHeaders(wxSOUND_INPUT);
m_internal->m_input_enabled = FALSE; m_internal->m_input_enabled = false;
waveInClose(m_internal->m_devin); waveInClose(m_internal->m_devin);
} }
} }
@@ -381,8 +381,8 @@ wxSoundInfoHeader *wxSoundStreamWin::AllocHeader(int mode)
// AllocHeaders() allocates WXSOUND_MAX_QUEUE (= 128) blocks for an operation // AllocHeaders() allocates WXSOUND_MAX_QUEUE (= 128) blocks for an operation
// queue. It uses AllocHeader() for each element. // queue. It uses AllocHeader() for each element.
// //
// Once it has allocated all blocks, it returns TRUE and if an error occured // Once it has allocated all blocks, it returns true and if an error occured
// it returns FALSE. // it returns false.
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
bool wxSoundStreamWin::AllocHeaders(int mode) bool wxSoundStreamWin::AllocHeaders(int mode)
{ {
@@ -400,10 +400,10 @@ bool wxSoundStreamWin::AllocHeaders(int mode)
headers[i] = AllocHeader(mode); headers[i] = AllocHeader(mode);
if (!headers[i]) { if (!headers[i]) {
FreeHeaders(mode); FreeHeaders(mode);
return FALSE; return false;
} }
} }
return TRUE; return true;
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
@@ -482,11 +482,11 @@ void wxSoundStreamWin::WaitFor(wxSoundInfoHeader *info)
// PROBLEM // // PROBLEM //
return; return;
} }
m_waiting_for = TRUE; m_waiting_for = true;
// Else, we wait for its termination // Else, we wait for its termination
while (info->m_playing || info->m_recording) while (info->m_playing || info->m_recording)
wxYield(); wxYield();
m_waiting_for = FALSE; m_waiting_for = false;
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
@@ -508,18 +508,18 @@ bool wxSoundStreamWin::AddToQueue(wxSoundInfoHeader *info)
result = waveInAddBuffer(m_internal->m_devin, result = waveInAddBuffer(m_internal->m_devin,
info->m_header, sizeof(WAVEHDR)); info->m_header, sizeof(WAVEHDR));
if (result == MMSYSERR_NOERROR) if (result == MMSYSERR_NOERROR)
info->m_recording = TRUE; info->m_recording = true;
else else
return FALSE; return false;
} else if (info->m_mode == wxSOUND_OUTPUT) { } else if (info->m_mode == wxSOUND_OUTPUT) {
result = waveOutWrite(m_internal->m_devout, result = waveOutWrite(m_internal->m_devout,
info->m_header, sizeof(WAVEHDR)); info->m_header, sizeof(WAVEHDR));
if (result == MMSYSERR_NOERROR) if (result == MMSYSERR_NOERROR)
info->m_playing = TRUE; info->m_playing = true;
else else
return FALSE; return false;
} }
return TRUE; return true;
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
@@ -530,8 +530,8 @@ bool wxSoundStreamWin::AddToQueue(wxSoundInfoHeader *info)
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
void wxSoundStreamWin::ClearHeader(wxSoundInfoHeader *info) void wxSoundStreamWin::ClearHeader(wxSoundInfoHeader *info)
{ {
info->m_playing = FALSE; info->m_playing = false;
info->m_recording = FALSE; info->m_recording = false;
info->m_position = 0; info->m_position = 0;
info->m_size = GetBestSize(); info->m_size = GetBestSize();
} }
@@ -552,7 +552,7 @@ wxSoundInfoHeader *wxSoundStreamWin::NextFragmentOutput()
WaitFor(m_headers_play[m_current_frag_out]); WaitFor(m_headers_play[m_current_frag_out]);
} }
if (m_current_frag_out == m_output_frag_out) if (m_current_frag_out == m_output_frag_out)
m_queue_filled = TRUE; m_queue_filled = true;
return m_headers_play[m_current_frag_out]; return m_headers_play[m_current_frag_out];
} }
@@ -612,7 +612,7 @@ wxSoundInfoHeader *wxSoundStreamWin::NextFragmentInput()
// We reached the writer position: the queue is full. // We reached the writer position: the queue is full.
if (m_current_frag_in == m_input_frag_in) if (m_current_frag_in == m_input_frag_in)
m_queue_filled = TRUE; m_queue_filled = true;
return header; return header;
} }
@@ -672,7 +672,7 @@ void wxSoundStreamWin::NotifyDoneBuffer(wxUint32 WXUNUSED(dev_handle), int flag)
info = m_headers_play[m_output_frag_out]; info = m_headers_play[m_output_frag_out];
// Clear header to tell the system the buffer is free now // Clear header to tell the system the buffer is free now
ClearHeader(info); ClearHeader(info);
m_queue_filled = FALSE; m_queue_filled = false;
if (!m_waiting_for) if (!m_waiting_for)
// Try to requeue a new buffer. // Try to requeue a new buffer.
OnSoundEvent(wxSOUND_OUTPUT); OnSoundEvent(wxSOUND_OUTPUT);
@@ -681,12 +681,12 @@ void wxSoundStreamWin::NotifyDoneBuffer(wxUint32 WXUNUSED(dev_handle), int flag)
return; return;
// Recording completed // Recording completed
m_headers_rec[m_input_frag_in]->m_recording = FALSE; m_headers_rec[m_input_frag_in]->m_recording = false;
// Queue pointer: writer // Queue pointer: writer
m_input_frag_in = (m_input_frag_in + 1) % WXSOUND_MAX_QUEUE; m_input_frag_in = (m_input_frag_in + 1) % WXSOUND_MAX_QUEUE;
if (!m_waiting_for) if (!m_waiting_for)
OnSoundEvent(wxSOUND_INPUT); OnSoundEvent(wxSOUND_INPUT);
m_queue_filled = FALSE; m_queue_filled = false;
} }
} }
@@ -705,17 +705,17 @@ bool wxSoundStreamWin::SetSoundFormat(const wxSoundFormatBase& base)
bool wxSoundStreamWin::StartProduction(int evt) bool wxSoundStreamWin::StartProduction(int evt)
{ {
if (!m_internal) if (!m_internal)
return FALSE; return false;
if ((m_internal->m_output_enabled && (evt & wxSOUND_OUTPUT)) || if ((m_internal->m_output_enabled && (evt & wxSOUND_OUTPUT)) ||
(m_internal->m_input_enabled && (evt & wxSOUND_INPUT))) (m_internal->m_input_enabled && (evt & wxSOUND_INPUT)))
CloseDevice(); CloseDevice();
if (!OpenDevice(evt)) if (!OpenDevice(evt))
return FALSE; return false;
m_production_started = TRUE; m_production_started = true;
m_queue_filled = FALSE; m_queue_filled = false;
// Send a dummy event to start. // Send a dummy event to start.
if (evt & wxSOUND_OUTPUT) if (evt & wxSOUND_OUTPUT)
OnSoundEvent(wxSOUND_OUTPUT); OnSoundEvent(wxSOUND_OUTPUT);
@@ -728,7 +728,7 @@ bool wxSoundStreamWin::StartProduction(int evt)
waveInStart(m_internal->m_devin); waveInStart(m_internal->m_devin);
} }
return TRUE; return true;
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
@@ -738,13 +738,13 @@ bool wxSoundStreamWin::StopProduction()
{ {
if (!m_production_started) { if (!m_production_started) {
m_snderror = wxSOUND_NOTSTARTED; m_snderror = wxSOUND_NOTSTARTED;
return FALSE; return false;
} }
m_snderror = wxSOUND_NOERROR; m_snderror = wxSOUND_NOERROR;
m_production_started = FALSE; m_production_started = false;
CloseDevice(); CloseDevice();
return TRUE; return true;
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
@@ -771,7 +771,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxSoundWinModule, wxModule)
bool wxSoundWinModule::OnInit() { bool wxSoundWinModule::OnInit() {
wxSoundHandleList = new wxList(wxKEY_INTEGER); wxSoundHandleList = new wxList(wxKEY_INTEGER);
return TRUE; return true;
} }
void wxSoundWinModule::OnExit() { void wxSoundWinModule::OnExit() {

View File

@@ -50,7 +50,7 @@ wxVideoBaseDriver::~wxVideoBaseDriver()
bool wxVideoBaseDriver::AttachOutput(wxWindow& output) bool wxVideoBaseDriver::AttachOutput(wxWindow& output)
{ {
m_video_output = &output; m_video_output = &output;
return TRUE; return true;
} }
void wxVideoBaseDriver::DetachOutput() void wxVideoBaseDriver::DetachOutput()
@@ -62,11 +62,11 @@ void wxVideoBaseDriver::DetachOutput()
wxFrame *wxVideoCreateFrame(wxVideoBaseDriver *vid_drv) wxFrame *wxVideoCreateFrame(wxVideoBaseDriver *vid_drv)
{ {
wxFrame *frame = new wxFrame(NULL, -1, _("Video Output"), wxDefaultPosition, wxSize(100, 100)); wxFrame *frame = new wxFrame(NULL, wxID_ANY, _("Video Output"), wxDefaultPosition, wxSize(100, 100));
wxWindow *vid_out = new wxWindow(frame, -1, wxPoint(0, 0), wxSize(300, 300)); wxWindow *vid_out = new wxWindow(frame, wxID_ANY, wxPoint(0, 0), wxSize(300, 300));
frame->Layout(); frame->Layout();
frame->Show(TRUE); frame->Show(true);
vid_drv->AttachOutput(*vid_out); vid_drv->AttachOutput(*vid_out);
vid_drv->Play(); vid_drv->Play();

View File

@@ -49,10 +49,10 @@ wxVideoWindows::wxVideoWindows(wxInputStream& str)
: wxVideoBaseDriver(str) : wxVideoBaseDriver(str)
{ {
m_internal = new wxVIDWinternal; m_internal = new wxVIDWinternal;
m_remove_file = TRUE; m_remove_file = true;
m_filename = wxGetTempFileName(_T("wxvid")); m_filename = wxGetTempFileName(_T("wxvid"));
m_paused = FALSE; m_paused = false;
m_stopped = TRUE; m_stopped = true;
m_frameRate = 1.0; m_frameRate = 1.0;
wxFileOutputStream temp_file(m_filename); wxFileOutputStream temp_file(m_filename);
@@ -65,10 +65,10 @@ wxVideoWindows::wxVideoWindows(const wxString& filename)
: wxVideoBaseDriver(filename) : wxVideoBaseDriver(filename)
{ {
m_internal = new wxVIDWinternal; m_internal = new wxVIDWinternal;
m_remove_file = FALSE; m_remove_file = false;
m_filename = filename; m_filename = filename;
m_paused = FALSE; m_paused = false;
m_stopped = TRUE; m_stopped = true;
m_frameRate = 1.0; m_frameRate = 1.0;
OpenFile(); OpenFile();
} }
@@ -122,16 +122,16 @@ void wxVideoWindows::OpenFile()
bool wxVideoWindows::Pause() bool wxVideoWindows::Pause()
{ {
if (m_paused || m_stopped) if (m_paused || m_stopped)
return TRUE; return true;
m_paused = TRUE; m_paused = true;
return (mciSendCommand(m_internal->m_dev_id, MCI_PAUSE, MCI_WAIT, 0) == 0); return (mciSendCommand(m_internal->m_dev_id, MCI_PAUSE, MCI_WAIT, 0) == 0);
} }
bool wxVideoWindows::Resume() bool wxVideoWindows::Resume()
{ {
if (!m_paused || m_stopped) if (!m_paused || m_stopped)
return TRUE; return true;
m_paused = FALSE; m_paused = false;
return (mciSendCommand(m_internal->m_dev_id, MCI_RESUME, 0, 0) == 0); return (mciSendCommand(m_internal->m_dev_id, MCI_RESUME, 0, 0) == 0);
} }
@@ -149,12 +149,12 @@ bool wxVideoWindows::GetSize(wxSize& size) const
{ {
size.SetWidth(200); size.SetWidth(200);
size.SetHeight(200); size.SetHeight(200);
return TRUE; return true;
} }
bool wxVideoWindows::SetSize(wxSize WXUNUSED(size)) bool wxVideoWindows::SetSize(wxSize WXUNUSED(size))
{ {
return TRUE; return true;
} }
bool wxVideoWindows::IsCapable(wxVideoType v_type) const bool wxVideoWindows::IsCapable(wxVideoType v_type) const
@@ -167,12 +167,12 @@ bool wxVideoWindows::AttachOutput(wxWindow& output)
MCI_DGV_WINDOW_PARMS win_struct; MCI_DGV_WINDOW_PARMS win_struct;
if (!wxVideoBaseDriver::AttachOutput(output)) if (!wxVideoBaseDriver::AttachOutput(output))
return FALSE; return false;
win_struct.hWnd = (HWND)output.GetHWND(); win_struct.hWnd = (HWND)output.GetHWND();
mciSendCommand(m_internal->m_dev_id, MCI_WINDOW, mciSendCommand(m_internal->m_dev_id, MCI_WINDOW,
MCI_DGV_WINDOW_HWND, (DWORD)(LPVOID)&win_struct); MCI_DGV_WINDOW_HWND, (DWORD)(LPVOID)&win_struct);
return TRUE; return true;
} }
void wxVideoWindows::DetachOutput() void wxVideoWindows::DetachOutput()
@@ -189,8 +189,8 @@ void wxVideoWindows::DetachOutput()
bool wxVideoWindows::Play() bool wxVideoWindows::Play()
{ {
if (!m_stopped) if (!m_stopped)
return FALSE; return false;
m_stopped = FALSE; m_stopped = false;
return (mciSendCommand(m_internal->m_dev_id, MCI_PLAY, 0, NULL) == 0); return (mciSendCommand(m_internal->m_dev_id, MCI_PLAY, 0, NULL) == 0);
} }
@@ -199,10 +199,10 @@ bool wxVideoWindows::Stop()
MCI_SEEK_PARMS seekStruct; MCI_SEEK_PARMS seekStruct;
if (m_stopped) if (m_stopped)
return FALSE; return false;
m_stopped = TRUE; m_stopped = true;
if (::mciSendCommand(m_internal->m_dev_id, MCI_STOP, MCI_WAIT, NULL) != 0) if (::mciSendCommand(m_internal->m_dev_id, MCI_STOP, MCI_WAIT, NULL) != 0)
return FALSE; return false;
seekStruct.dwCallback = 0; seekStruct.dwCallback = 0;
seekStruct.dwTo = 0; seekStruct.dwTo = 0;

View File

@@ -77,14 +77,14 @@ wxVideoXANIMProcess::wxVideoXANIMProcess(wxVideoXANIM *xanim)
void wxVideoXANIMProcess::OnTerminate(int WXUNUSED(pid), int WXUNUSED(status)) void wxVideoXANIMProcess::OnTerminate(int WXUNUSED(pid), int WXUNUSED(status))
{ {
m_vid_xanim->m_xanim_started = FALSE; m_vid_xanim->m_xanim_started = false;
m_vid_xanim->OnFinished(); m_vid_xanim->OnFinished();
} }
wxVideoXANIMOutput::wxVideoXANIMOutput() wxVideoXANIMOutput::wxVideoXANIMOutput()
: wxProcess(NULL, -1) : wxProcess(NULL, wxID_ANY)
{ {
m_terminated = FALSE; m_terminated = false;
Redirect(); Redirect();
} }
@@ -95,7 +95,7 @@ bool wxVideoXANIMOutput::IsTerminated() const
void wxVideoXANIMOutput::OnTerminate(int pid, int status) void wxVideoXANIMOutput::OnTerminate(int pid, int status)
{ {
m_terminated = TRUE; m_terminated = true;
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
@@ -106,10 +106,10 @@ wxVideoXANIM::wxVideoXANIM()
{ {
m_internal = new wxXANIMinternal; m_internal = new wxXANIMinternal;
m_xanim_detector = new wxVideoXANIMProcess(this); m_xanim_detector = new wxVideoXANIMProcess(this);
m_xanim_started = FALSE; m_xanim_started = false;
m_paused = FALSE; m_paused = false;
m_filename = wxEmptyString; m_filename = wxEmptyString;
m_remove_file = FALSE; m_remove_file = false;
} }
wxVideoXANIM::wxVideoXANIM(wxInputStream& str) wxVideoXANIM::wxVideoXANIM(wxInputStream& str)
@@ -117,13 +117,13 @@ wxVideoXANIM::wxVideoXANIM(wxInputStream& str)
{ {
m_internal = new wxXANIMinternal; m_internal = new wxXANIMinternal;
m_xanim_detector = new wxVideoXANIMProcess(this); m_xanim_detector = new wxVideoXANIMProcess(this);
m_xanim_started = FALSE; m_xanim_started = false;
m_paused = FALSE; m_paused = false;
m_size[0] = 0; m_size[0] = 0;
m_size[1] = 0; m_size[1] = 0;
m_filename = wxGetTempFileName(_T("vidxa")); m_filename = wxGetTempFileName(_T("vidxa"));
m_remove_file = TRUE; m_remove_file = true;
wxFileOutputStream fout(m_filename); wxFileOutputStream fout(m_filename);
fout << str; fout << str;
@@ -135,11 +135,11 @@ wxVideoXANIM::wxVideoXANIM(const wxString& filename)
{ {
m_internal = new wxXANIMinternal; m_internal = new wxXANIMinternal;
m_xanim_detector = new wxVideoXANIMProcess(this); m_xanim_detector = new wxVideoXANIMProcess(this);
m_xanim_started = FALSE; m_xanim_started = false;
m_paused = FALSE; m_paused = false;
m_filename = filename; m_filename = filename;
m_remove_file = FALSE; m_remove_file = false;
m_size[0] = 0; m_size[0] = 0;
m_size[1] = 0; m_size[1] = 0;
@@ -163,42 +163,42 @@ wxVideoXANIM::~wxVideoXANIM()
bool wxVideoXANIM::Play() bool wxVideoXANIM::Play()
{ {
if (!m_paused && m_xanim_started) if (!m_paused && m_xanim_started)
return TRUE; return true;
if (!m_video_output) { if (!m_video_output) {
wxVideoCreateFrame(this); wxVideoCreateFrame(this);
return TRUE; return true;
} }
// The movie starts with xanim // The movie starts with xanim
if (RestartXANIM()) { if (RestartXANIM()) {
m_paused = FALSE; m_paused = false;
return TRUE; return true;
} }
return FALSE; return false;
} }
bool wxVideoXANIM::Pause() bool wxVideoXANIM::Pause()
{ {
if (!m_paused && SendCommand(" ")) { if (!m_paused && SendCommand(" ")) {
m_paused = TRUE; m_paused = true;
return TRUE; return true;
} }
return FALSE; return false;
} }
bool wxVideoXANIM::Resume() bool wxVideoXANIM::Resume()
{ {
if (m_paused && SendCommand(" ")) { if (m_paused && SendCommand(" ")) {
m_paused = FALSE; m_paused = false;
return TRUE; return true;
} }
return FALSE; return false;
} }
bool wxVideoXANIM::Stop() bool wxVideoXANIM::Stop()
{ {
if (!m_xanim_started) if (!m_xanim_started)
return FALSE; return false;
SendCommand("q"); SendCommand("q");
@@ -207,9 +207,9 @@ bool wxVideoXANIM::Stop()
wxYield(); wxYield();
} }
m_paused = FALSE; m_paused = false;
return TRUE; return true;
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
@@ -218,18 +218,18 @@ bool wxVideoXANIM::Stop()
bool wxVideoXANIM::SetSize(wxSize size) bool wxVideoXANIM::SetSize(wxSize size)
{ {
if (!m_video_output) if (!m_video_output)
return FALSE; return false;
m_video_output->SetSize(size.GetWidth(), size.GetHeight()); m_video_output->SetSize(size.GetWidth(), size.GetHeight());
return FALSE; return false;
} }
bool wxVideoXANIM::GetSize(wxSize& size) const bool wxVideoXANIM::GetSize(wxSize& size) const
{ {
if (m_size[0] == 0) if (m_size[0] == 0)
return FALSE; return false;
size.Set(m_size[0], m_size[1]); size.Set(m_size[0], m_size[1]);
return TRUE; return true;
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
@@ -240,9 +240,9 @@ bool wxVideoXANIM::IsCapable(wxVideoType v_type) const
if (v_type == wxVIDEO_MSAVI || v_type == wxVIDEO_MPEG || if (v_type == wxVIDEO_MSAVI || v_type == wxVIDEO_MPEG ||
v_type == wxVIDEO_QT || v_type == wxVIDEO_GIF || v_type == wxVIDEO_JMOV || v_type == wxVIDEO_QT || v_type == wxVIDEO_GIF || v_type == wxVIDEO_JMOV ||
v_type == wxVIDEO_FLI || v_type == wxVIDEO_IFF || v_type == wxVIDEO_SGI) v_type == wxVIDEO_FLI || v_type == wxVIDEO_IFF || v_type == wxVIDEO_SGI)
return TRUE; return true;
else else
return FALSE; return false;
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
@@ -314,16 +314,16 @@ bool wxVideoXANIM::IsStopped() const
bool wxVideoXANIM::AttachOutput(wxWindow& out) bool wxVideoXANIM::AttachOutput(wxWindow& out)
{ {
if (!wxVideoBaseDriver::AttachOutput(out)) if (!wxVideoBaseDriver::AttachOutput(out))
return FALSE; return false;
return TRUE; return true;
} }
void wxVideoXANIM::DetachOutput() void wxVideoXANIM::DetachOutput()
{ {
SendCommand("q"); SendCommand("q");
m_xanim_started = FALSE; m_xanim_started = false;
m_paused = FALSE; m_paused = false;
wxVideoBaseDriver::DetachOutput(); wxVideoBaseDriver::DetachOutput();
} }
@@ -336,7 +336,7 @@ bool wxVideoXANIM::SendCommand(const char *command, char **ret,
{ {
if (!m_xanim_started) if (!m_xanim_started)
if (!RestartXANIM()) if (!RestartXANIM())
return FALSE; return false;
// Send a command to XAnim through X11 Property // Send a command to XAnim through X11 Property
XChangeProperty(m_internal->xanim_dpy, m_internal->xanim_window, XChangeProperty(m_internal->xanim_dpy, m_internal->xanim_window,
@@ -354,7 +354,7 @@ bool wxVideoXANIM::SendCommand(const char *command, char **ret,
&prop_type, &prop_format, (unsigned long *)size, &prop_type, &prop_format, (unsigned long *)size,
&extra, (unsigned char **)ret); &extra, (unsigned char **)ret);
} }
return TRUE; return true;
} }
bool wxVideoXANIM::CollectInfo() bool wxVideoXANIM::CollectInfo()
@@ -366,8 +366,8 @@ bool wxVideoXANIM::CollectInfo()
xanimProcess = new wxVideoXANIMOutput; xanimProcess = new wxVideoXANIMOutput;
xanim_command = wxT("xanim +v +Zv -Ae "); xanim_command = wxT("xanim +v +Zv -Ae ");
xanim_command += m_filename; xanim_command += m_filename;
if (!wxExecute(xanim_command, FALSE, xanimProcess)) if (!wxExecute(xanim_command, false, xanimProcess))
return FALSE; return false;
wxInputStream *infoStream = xanimProcess->GetInputStream(); wxInputStream *infoStream = xanimProcess->GetInputStream();
wxString totalOutput; wxString totalOutput;
@@ -443,7 +443,7 @@ i = my_long;
delete xanimProcess; delete xanimProcess;
return TRUE; return true;
} }
bool wxVideoXANIM::RestartXANIM() bool wxVideoXANIM::RestartXANIM()
@@ -458,10 +458,10 @@ bool wxVideoXANIM::RestartXANIM()
bool xanim_chg_size; bool xanim_chg_size;
if (!m_video_output || m_xanim_started) if (!m_video_output || m_xanim_started)
return FALSE; return false;
// Check if we can change the size of the window dynamicly // Check if we can change the size of the window dynamicly
xanim_chg_size = TRUE; xanim_chg_size = true;
// Get current display // Get current display
#ifdef __WXGTK__ #ifdef __WXGTK__
m_internal->xanim_dpy = gdk_display; m_internal->xanim_dpy = gdk_display;
@@ -481,12 +481,12 @@ bool wxVideoXANIM::RestartXANIM()
WXSTRINGCAST m_filename); WXSTRINGCAST m_filename);
// Execute it // Execute it
if (!wxExecute(xanim_command, FALSE, m_xanim_detector)) if (!wxExecute(xanim_command, false, m_xanim_detector))
return FALSE; return false;
// Wait for XAnim to be ready // Wait for XAnim to be ready
nitems = 0; nitems = 0;
m_xanim_started = TRUE; m_xanim_started = true;
while (nitems == 0 && m_xanim_started) { while (nitems == 0 && m_xanim_started) {
ret = XGetWindowProperty(m_internal->xanim_dpy, m_internal->xanim_window, ret = XGetWindowProperty(m_internal->xanim_dpy, m_internal->xanim_window,
m_internal->xanim_atom, m_internal->xanim_atom,
@@ -507,7 +507,7 @@ bool wxVideoXANIM::RestartXANIM()
// Very useful ! Actually it "should" sends a SETSIZE event to XAnim // Very useful ! Actually it "should" sends a SETSIZE event to XAnim
// FIXME: This event is not sent !! // FIXME: This event is not sent !!
m_paused = FALSE; m_paused = false;
return TRUE; return true;
} }