Example #1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Play nice and clean up.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public void Dispose()
        {
            if (m_stream != null)
            {
                m_stream.Close();
            }
            if (m_writer != null)
            {
                m_writer.Close();
            }

            m_stream = null;
            m_reader = null;
            m_writer = null;
        }
Example #2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Method for reading the audio file.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public bool Read()
        {
            m_writer = new SaAudioDocumentWriter();
            m_writer.Initialize(m_audioFile, false);

            // Check if this is a wave file. If not, save the transcription file and return.
            if (!IsValidWaveFile())
            {
                m_writer.Commit();
                m_writer.Close();
                return(true);
            }

            if (!ReadFmtChunk())
            {
                return(false);
            }

            if (!ReadDataChunk())
            {
                return(false);
            }

            // Check if the audio file contains SA chunks. If not,
            // save the transcription file and return.
            if (GetChunkOffset(m_stream, kidSAChunk) == -1)
            {
                m_writer.Commit();
                m_writer.Close();
                return(true);
            }

            if (!ReadSaChunk())
            {
                return(false);
            }

            if (!ReadUttChunk())
            {
                return(false);
            }

            // Process Phonetic, Phonemic, Tone and Ortho chunks.
            ProcessLangTranscriptionChunks();

            // Read the mark chunk data (gloss and ref).
            if (!ReadMarkChunk())
            {
                // TODO: Log a message
            }

            if (!ReadSpkrChunk())
            {
                // TODO: Log a message
            }

            if (!ReadLangChunk())
            {
                // TODO: Log a message
            }

            if (!ReadRefChunk())
            {
                // TODO: Log a message
            }

            if (!ReadMdatChunk())
            {
                // TODO: Log a message
            }

            // Process Music Phrase Level chunks into database
            ProcessMusicTranscriptionChunks();

            m_writer.Commit(m_backupAudioFile);
            m_writer.Close();

            return(true);
        }