#pragma implementation "sndaiff.cpp"
#endif
-#include <wx/defs.h>
+#include <wx/wxprec.h>
+
#include <wx/stream.h>
#include <wx/datstrm.h>
#include <wx/filefn.h>
{
}
+bool wxSoundAiff::CanRead()
+{
+ wxUint32 signature1, signature2, len;
+
+ if (m_input->Read(&signature1, 4).LastRead() != 4)
+ return FALSE;
+
+ if (wxUINT32_SWAP_ON_BE(signature1) != FORM_SIGNATURE) {
+ m_input->Ungetch(&signature1, 4);
+ return FALSE;
+ }
+
+ m_input->Read(&len, 4);
+ if (m_input->LastRead() != 4) {
+ m_input->Ungetch(&len, m_input->LastRead());
+ m_input->Ungetch(&signature1, 4);
+ return FALSE;
+ }
+
+ if (m_input->Read(&signature2, 4).LastRead() != 4) {
+ m_input->Ungetch(&signature2, m_input->LastRead());
+ m_input->Ungetch(&len, 4);
+ m_input->Ungetch(&signature1, 4);
+ return FALSE;
+ }
+
+ m_input->Ungetch(&signature2, 4);
+ m_input->Ungetch(&len, 4);
+ m_input->Ungetch(&signature1, 4);
+
+ if (
+ wxUINT32_SWAP_ON_BE(signature2) != AIFF_SIGNATURE &&
+ wxUINT32_SWAP_ON_BE(signature2) != AIFC_SIGNATURE)
+ return FALSE;
+
+ return TRUE;
+}
+
#define FAIL_WITH(condition, err) if (condition) { m_snderror = err; return FALSE; }
bool wxSoundAiff::PrepareToPlay()
sndformat.SetSampleRate((wxUint32) srate);
sndformat.SetBPS(bps);
sndformat.SetChannels(channels);
- sndformat.Signed(TRUE);
+ sndformat.Signed(FALSE);
sndformat.SetOrder(wxBIG_ENDIAN);
if (!SetSoundFormat(sndformat))
bool wxSoundAiff::PrepareToRecord(unsigned long time)
{
+ // TODO
return FALSE;
}
bool wxSoundAiff::FinishRecording()
{
+ // TODO
return FALSE;
}
-size_t wxSoundAiff::GetData(void *buffer, size_t len)
+wxUint32 wxSoundAiff::GetData(void *buffer, wxUint32 len)
{
return m_input->Read(buffer, len).LastRead();
}
-size_t wxSoundAiff::PutData(const void *buffer, size_t len)
+wxUint32 wxSoundAiff::PutData(const void *buffer, wxUint32 len)
{
return m_output->Write(buffer, len).LastWrite();
}