Exemple #1
0
    void Update()
    {
        //If audio is recording, preform the counter and display on GUI
        if (getIsRecording())
        {
            audioCounter.setRecordingCounter(audioCounter.getRecordingCounter() + Time.deltaTime);
            audioCounter.updateAudioRecordingCounterText();
            performBlinkingNotification();

            //If the user reaches the limit
            if (audioCounter.getRecordingCounter() >= audioCounter.getMaxRecordingTime())
            {
                endAudioRecord();
            }
        }

        //The recording has just finished, begin the saving counter
        if (getDisplaySelection())
        {
            audioCounter.setSaveRecordingCounter(audioCounter.getSaveRecordingCounter() - Time.deltaTime);
            audioCounter.updateSaveRecordingCounterStatusBar();

            //Once the counter reaches 0 seconds and if the user did not speak it will begin autoSave process
            if (audioCounter.getSaveRecordingCounter() <= 0 && !getUserSelect())
            {
                userDidnotSelectAnOption();
            }
            else if (getUserSelect()) //If the user did speak and the time did not run out yet
            {
                userSelectedAnOption();
            }
        }
    }
 public void recordStartAudio()
 {
     source.Stop();
     source.clip = Microphone.Start("", false, recordCounter.getMaxRecordingTime(), 44100);
 }