summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorAimee Linden <aimee@lindenlab.com>2010-05-22 17:58:45 +0100
committerAimee Linden <aimee@lindenlab.com>2010-05-22 17:58:45 +0100
commit5cf632aacbae683676c341a7f1470108cdf65b59 (patch)
tree5331c838ca51dc5f26dad0ff13e81e7c3252e5ec /indra
parent05157c9985d955bb62c9ef897cee6298500c762d (diff)
EXT-7138 WIP Voice Morphing - Go into stateCaptureBufferPaused as soon as the Voice Effects preview is opened.
Disconnecting from voice on hitting record was taking too long and causing the start of the voice recording to be cut off.
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llfloatervoiceeffect.cpp5
-rw-r--r--indra/newview/llvoiceclient.h6
-rw-r--r--indra/newview/llvoicevivox.cpp86
-rw-r--r--indra/newview/llvoicevivox.h13
4 files changed, 53 insertions, 57 deletions
diff --git a/indra/newview/llfloatervoiceeffect.cpp b/indra/newview/llfloatervoiceeffect.cpp
index 60831936ca..f38a56a06d 100644
--- a/indra/newview/llfloatervoiceeffect.cpp
+++ b/indra/newview/llfloatervoiceeffect.cpp
@@ -75,6 +75,9 @@ BOOL LLFloaterVoiceEffect::postBuild()
if (effect_interface)
{
effect_interface->addObserver(this);
+
+ // Disconnect from the current voice channel ready to record a voice sample for previewing
+ effect_interface->enablePreviewBuffer(true);
}
update();
@@ -88,7 +91,7 @@ void LLFloaterVoiceEffect::onClose(bool app_quitting)
LLVoiceEffectInterface* effect_interface = LLVoiceClient::instance().getVoiceEffectInterface();
if (effect_interface)
{
- effect_interface->clearPreviewBuffer();
+ effect_interface->enablePreviewBuffer(false);
}
}
diff --git a/indra/newview/llvoiceclient.h b/indra/newview/llvoiceclient.h
index 5caf26c492..2fa309d959 100644
--- a/indra/newview/llvoiceclient.h
+++ b/indra/newview/llvoiceclient.h
@@ -306,9 +306,9 @@ public:
//////////////////////////////
/// @name Preview buffer
//@{
- virtual void recordPreviewBuffer(bool enable) = 0;
- virtual void playPreviewBuffer(bool enable, const LLUUID& effect_id = LLUUID::null) = 0;
- virtual void clearPreviewBuffer() = 0;
+ virtual void enablePreviewBuffer(bool enable) = 0;
+ virtual void recordPreviewBuffer(bool record) = 0;
+ virtual void playPreviewBuffer(bool play, const LLUUID& effect_id = LLUUID::null) = 0;
virtual bool isPreviewRecording() = 0;
virtual bool isPreviewReady() = 0;
diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp
index 7daf865151..a64c05a3c6 100644
--- a/indra/newview/llvoicevivox.cpp
+++ b/indra/newview/llvoicevivox.cpp
@@ -342,7 +342,9 @@ LLVivoxVoiceClient::LLVivoxVoiceClient() :
mVoiceFontsReceived(false),
mVoiceFontsNew(false),
+ mCaptureBufferMode(false),
mCaptureBufferRecording(false),
+ mCaptureBufferRecorded(false),
mCaptureBufferPlaying(false)
{
mSpeakerVolume = scale_speaker_volume(0);
@@ -1130,7 +1132,12 @@ void LLVivoxVoiceClient::stateMachine()
//MARK: stateCaptureBufferPaused
case stateCaptureBufferPaused:
- if (mCaptureBufferRecording)
+ if (!mCaptureBufferMode)
+ {
+ mCaptureBufferRecorded = false;
+ setState(stateNoChannel);
+ }
+ else if (mCaptureBufferRecording)
{
setState(stateCaptureBufferRecStart);
// Update UI, should really be separated from the VoiceFont callback
@@ -1141,22 +1148,18 @@ void LLVivoxVoiceClient::stateMachine()
setState(stateCaptureBufferPlayStart);
notifyVoiceFontObservers();
}
- else if (mCaptureBufferClear)
- {
- mCaptureBufferClear = false;
- setState(stateNoChannel);
- }
break;
//MARK: stateCaptureBufferRecStart
case stateCaptureBufferRecStart:
captureBufferRecordStartSendMessage();
+ mCaptureBufferRecorded = true;
setState(stateCaptureBufferRecording);
break;
//MARK: stateCaptureBufferRecording
case stateCaptureBufferRecording:
- if (!mCaptureBufferRecording || mCaptureBufferPlaying || mCaptureBufferClear)
+ if (!mCaptureBufferMode || !mCaptureBufferRecording || mCaptureBufferPlaying)
{
mCaptureBufferRecording = false;
captureBufferRecordStopSendMessage();
@@ -1173,7 +1176,7 @@ void LLVivoxVoiceClient::stateMachine()
//MARK: stateCaptureBufferPlaying
case stateCaptureBufferPlaying:
- if (!mCaptureBufferPlaying || mCaptureBufferRecording || mCaptureBufferClear)
+ if (!mCaptureBufferMode || !mCaptureBufferPlaying || mCaptureBufferRecording)
{
mCaptureBufferPlaying = false;
captureBufferPlayStopSendMessage();
@@ -1382,10 +1385,9 @@ void LLVivoxVoiceClient::stateMachine()
mTuningExitState = stateNoChannel;
setState(stateMicTuningStart);
}
- else if(mCaptureBufferRecording)
+ else if(mCaptureBufferMode)
{
- mTuningExitState = stateNoChannel;
- setState(stateCaptureBufferRecStart);
+ setState(stateCaptureBufferPaused);
}
else if(sessionNeedsRelog(mNextAudioSession))
{
@@ -6693,42 +6695,43 @@ void LLVivoxVoiceClient::notifyVoiceFontObservers(bool new_fonts)
}
}
-void LLVivoxVoiceClient::recordPreviewBuffer(bool enable)
+void LLVivoxVoiceClient::enablePreviewBuffer(bool enable)
{
- if (enable)
- {
- mCaptureBufferRecording = true;
- LL_DEBUGS("Voice") << "Starting recording" << LL_ENDL;
- if(getState() >= stateNoChannel)
- {
- LL_DEBUGS("Voice") << "no channel" << LL_ENDL;
- sessionTerminate();
- }
- }
- else
+ mCaptureBufferMode = enable;
+ if(mCaptureBufferMode && getState() >= stateNoChannel)
{
- mCaptureBufferRecording = false;
+ LL_DEBUGS("Voice") << "no channel" << LL_ENDL;
+ sessionTerminate();
}
}
-void LLVivoxVoiceClient::playPreviewBuffer(bool enable, const LLUUID& effect_id)
+void LLVivoxVoiceClient::recordPreviewBuffer(bool record)
{
- if (enable && !isPreviewReady())
+ if (record && !mCaptureBufferMode)
{
- LL_DEBUGS("Voice") << "No preview buffer to play" << LL_ENDL;
+ LL_DEBUGS("Voice") << "Cannot start recording, not in preview mode." << LL_ENDL;
return;
}
- mCaptureBufferPlaying = enable;
- if (mCaptureBufferPlaying)
- {
- mPreviewVoiceFontID = effect_id;
- }
+ mCaptureBufferRecording = record;
}
-void LLVivoxVoiceClient::clearPreviewBuffer()
+void LLVivoxVoiceClient::playPreviewBuffer(bool play, const LLUUID& effect_id)
{
- mCaptureBufferClear = true;
+ if (play)
+ {
+ if (mCaptureBufferMode && mCaptureBufferRecorded)
+ {
+ mPreviewVoiceFontID = effect_id;
+ }
+ else
+ {
+ LL_DEBUGS("Voice") << "No preview buffer to play." << LL_ENDL;
+ return;
+ }
+ }
+
+ mCaptureBufferPlaying = play;
}
bool LLVivoxVoiceClient::isPreviewRecording()
@@ -6738,18 +6741,8 @@ bool LLVivoxVoiceClient::isPreviewRecording()
bool LLVivoxVoiceClient::isPreviewReady()
{
- state preview_state = getState();
- switch (preview_state)
- {
- case stateCaptureBufferPaused:
- case stateCaptureBufferRecording:
- case stateCaptureBufferPlaying:
- return true;
- break;
- default:
- return false;
- break;
- }
+ return mCaptureBufferRecorded;
+
}
bool LLVivoxVoiceClient::isPreviewPlaying()
@@ -6767,7 +6760,6 @@ void LLVivoxVoiceClient::captureBufferRecordStartSendMessage()
// Start capture
stream
<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.StartBufferCapture.1\">"
- << "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
<< "</Request>"
<< "\n\n\n";
diff --git a/indra/newview/llvoicevivox.h b/indra/newview/llvoicevivox.h
index 5ba8082d56..e4250d2ba3 100644
--- a/indra/newview/llvoicevivox.h
+++ b/indra/newview/llvoicevivox.h
@@ -257,9 +257,9 @@ public:
//////////////////////////////
/// @name Effect preview buffer
//@{
- virtual void recordPreviewBuffer(bool enable);
- virtual void playPreviewBuffer(bool enable, const LLUUID& effect_id = LLUUID::null);
- virtual void clearPreviewBuffer();
+ virtual void enablePreviewBuffer(bool enable);
+ virtual void recordPreviewBuffer(bool record);
+ virtual void playPreviewBuffer(bool play, const LLUUID& effect_id = LLUUID::null);
virtual bool isPreviewRecording();
virtual bool isPreviewReady();
@@ -919,9 +919,10 @@ private:
void captureBufferPlayStartSendMessage(const LLUUID& voice_font_id = LLUUID::null);
void captureBufferPlayStopSendMessage();
- bool mCaptureBufferRecording;
- bool mCaptureBufferPlaying;
- bool mCaptureBufferClear;
+ bool mCaptureBufferMode; // Disconnected from voice channels while using the capture buffer.
+ bool mCaptureBufferRecording; // A voice sample is being captured.
+ bool mCaptureBufferRecorded; // A voice sample is captured in the buffer ready to play.
+ bool mCaptureBufferPlaying; // A voice sample is being played.
LLUUID mPreviewVoiceFontID;
};