public override RecordingMachineBase HandleState()
    {
        if (this.abortRecording)
        {
            RecordingMachineBase invalid = new InvalidRecordingMachine(this.AbortMessage);
            invalid.SetStartCallback(this.StartRecording);
            invalid.SetStopCallback(this.StopRecording);

            return(invalid);
        }

        //Are we done recording.
        bool isDonePlaying = this.recordingTimer >= this.recordLength ? true : false;

        //Update microphone device each frame.
        Device.Update();

        if (isDonePlaying)
        {
            RecordingMachineBase endRecord = new EndRecordingMachine(this.recordLength);
            endRecord.SetStartCallback(this.StartRecording);
            endRecord.SetStopCallback(this.StopRecording);

            //Record audio for a while.
            //when we are done we return a new endrecording machine to handler.
            return(endRecord);
        }

        //Increment timer to check for done.
        this.recordingTimer += Time.deltaTime;

        return(null);
    }
Esempio n. 2
0
    public override RecordingMachineBase HandleState()
    {
        if (this.abortRecording)
        {
            RecordingMachineBase invalid = new InvalidRecordingMachine(this.AbortMessage);
            invalid.SetStartCallback(this.StartRecording);
            invalid.SetStopCallback(this.StopRecording);

            return(invalid);
        }

        return(null);
    }