From 32826f31ebfe19f57a1d8cc7c2f3e81df9b5de74 Mon Sep 17 00:00:00 2001 From: Aimee Linden Date: Sat, 22 May 2010 18:09:56 +0100 Subject: EXT-7337 WIP Voice Morphing - Limit maximum recording sample to 15 seconds. --- indra/newview/llvoicevivox.cpp | 8 +++++++- indra/newview/llvoicevivox.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index a64c05a3c6..f1c8ce21d2 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -96,6 +96,9 @@ const int MAX_LOGIN_RETRIES = 12; // blocked is VERY rare and it's better to sacrifice response time in this situation for the sake of stability. const int MAX_NORMAL_JOINING_SPATIAL_NUM = 50; +// Maximum length of capture buffer recordings +const F32 CAPTURE_BUFFER_MAX_TIME = 15.f; + static int scale_mic_volume(float volume) { @@ -1154,12 +1157,15 @@ void LLVivoxVoiceClient::stateMachine() case stateCaptureBufferRecStart: captureBufferRecordStartSendMessage(); mCaptureBufferRecorded = true; + mCaptureTimer.start(); + mCaptureTimer.setTimerExpirySec(CAPTURE_BUFFER_MAX_TIME); setState(stateCaptureBufferRecording); break; //MARK: stateCaptureBufferRecording case stateCaptureBufferRecording: - if (!mCaptureBufferMode || !mCaptureBufferRecording || mCaptureBufferPlaying) + if (!mCaptureBufferMode || !mCaptureBufferRecording || + mCaptureBufferPlaying || mCaptureTimer.hasExpired()) { mCaptureBufferRecording = false; captureBufferRecordStopSendMessage(); diff --git a/indra/newview/llvoicevivox.h b/indra/newview/llvoicevivox.h index e4250d2ba3..3c7567610d 100644 --- a/indra/newview/llvoicevivox.h +++ b/indra/newview/llvoicevivox.h @@ -924,6 +924,7 @@ private: bool mCaptureBufferRecorded; // A voice sample is captured in the buffer ready to play. bool mCaptureBufferPlaying; // A voice sample is being played. + LLTimer mCaptureTimer; LLUUID mPreviewVoiceFontID; }; -- cgit v1.2.3