char tmp_buf[5];
wxString chunk_name;
- m_istream->SeekI(0, wxFromStart);
-
wxSndFileCodec::m_mmerror = wxMMFILE_INVALID;
READ_STRING(chunk_name, 4);
m_spos = 0;
m_slen = 0;
m_sndformat.SetSampleRate(0);
- while (1) {
+ while (!m_spos || !m_sndformat.GetSampleRate()) {
READ_STRING(chunk_name, 4);
READ32(m_chunksize);
ParseCOMM();
else
m_istream->SeekI(m_chunksize, wxFromCurrent);
-
- if (m_spos && m_sndformat.GetSampleRate())
- break;
}
m_sndmode = wxSND_OUTPUT;
wxSndFileCodec::m_mmerror = wxMMFILE_NOERROR;
m_istream->SeekI(m_spos, wxFromStart);
+ wxSndFileCodec::m_fstate = wxSFILE_PREPARED_TO_PLAY;
+
return m_slen;
}
return ( !(m_ostream->Write(buf, size).LastError()) );
}
-bool wxSndAiffCodec::PrepareToRecord(wxUint32 m_fsize)
+void wxSndAiffCodec::WriteCOMM()
{
/*
- wxUint32 total_size;
+ wxDataOutputStream data_s(*m_ostream);
char tmp_buf[10];
+ wxUint16 channels;
+ wxUint32 srate, num_samples;
+ wxUint16 bps;
+
+ m_chunksize = 18;
+ WRITE32(m_chunksize);
+ channels = m_sndformat.GetChannels();
+ srate = m_sndformat.GetSampleRate();
+ bps = m_sndformat.GetBps();
- m_ostream->SeekO(0, wxBeginPosition);
+ WRITE16(channels);
+ WRITE32(num_samples);
+ WRITE16(bps);
+
+ data_s.WriteDouble((double)srate);
+
+ m_sndformat.SetByteOrder(wxSND_SAMPLE_BE);
+ m_sndformat.SetSign(wxSND_SAMPLE_UNSIGNED);
+ ChangeCodec(WXSOUND_PCM);
+*/
+}
+
+void wxSndAiffCodec::WriteSSND(wxUint32 fsize)
+{
+/*
+ char tmp_buf[10];
+
+ WRITE32(m_spos);
+// WRITE32(dummy ??);
+
+ m_slen = m_chunksize - m_spos;
+ m_spos += m_istream->TellI();
+*/
+}
+
+
+bool wxSndAiffCodec::PrepareToRecord(wxUint32 m_fsize)
+{
+ wxUint32 total_size = m_fsize + 0;
+ char tmp_buf[10];
m_ostream->Write("FORM", 4);
WRITE32(total_size);
WriteCOMM();
WriteSSND(m_fsize);
-*/
return TRUE;
}