コード例 #1
0
    /// <summary>
    /// <c>StopRecording</c>
    ///
    /// Description: Stops recording and closes the file.
    ///
    /// pre-conditions: this.fileName must not be "", ie: There must be a recording happening.
    ///
    /// post-conditions: this.fileName is now "" and the file is closed.
    /// </summary>
    ///
    /// <returns> NULL </returns>
    public void StopRecording()
    {
        if (this.fileName == "")
        {
            throw new InvalidOperationException("Cannot stop recording if filename has not been set.");
        }

        Debug.Assert(fileName != "");

        Debug.Log(string.Format("AudioFeed::StopRecording: fileName: {0}", fileName));

        try
        {
            STT.ReceiveAudioFile(fileName);
        } catch (NullReferenceException)
        {
            Debug.Log("Error: File could not be found");
        }

        fileName = "";
    }