support Mute button for own audio #75
This commit is contained in:
parent
ce647535d8
commit
ad3e4e0587
5 changed files with 54 additions and 54 deletions
|
@ -56,7 +56,7 @@ CClient::CClient ( const quint16 iPortNumber,
|
||||||
eAudioChannelConf ( CC_MONO ),
|
eAudioChannelConf ( CC_MONO ),
|
||||||
iNumAudioChannels ( 1 ),
|
iNumAudioChannels ( 1 ),
|
||||||
bIsInitializationPhase ( true ),
|
bIsInitializationPhase ( true ),
|
||||||
bMuteInputAndOutput ( false ),
|
bMuteOutStream ( false ),
|
||||||
Socket ( &Channel, iPortNumber ),
|
Socket ( &Channel, iPortNumber ),
|
||||||
Sound ( AudioCallback, this, iCtrlMIDIChannel, bNoAutoJackConnect ),
|
Sound ( AudioCallback, this, iCtrlMIDIChannel, bNoAutoJackConnect ),
|
||||||
iAudioInFader ( AUD_FADER_IN_MIDDLE ),
|
iAudioInFader ( AUD_FADER_IN_MIDDLE ),
|
||||||
|
@ -807,6 +807,8 @@ void CClient::Init()
|
||||||
iStereoBlockSizeSam = 2 * iMonoBlockSizeSam;
|
iStereoBlockSizeSam = 2 * iMonoBlockSizeSam;
|
||||||
|
|
||||||
vecCeltData.Init ( iCeltNumCodedBytes );
|
vecCeltData.Init ( iCeltNumCodedBytes );
|
||||||
|
vecZeros.Init ( iStereoBlockSizeSam, 0 );
|
||||||
|
vecsStereoSndCrdTMP.Init ( iStereoBlockSizeSam );
|
||||||
|
|
||||||
opus_custom_encoder_ctl ( CurOpusEncoder,
|
opus_custom_encoder_ctl ( CurOpusEncoder,
|
||||||
OPUS_SET_BITRATE (
|
OPUS_SET_BITRATE (
|
||||||
|
@ -841,13 +843,11 @@ void CClient::Init()
|
||||||
// the output conversion buffer must be filled with the inner
|
// the output conversion buffer must be filled with the inner
|
||||||
// block size for initialization (this is the latency which is
|
// block size for initialization (this is the latency which is
|
||||||
// introduced by the conversion buffer) to avoid buffer underruns
|
// introduced by the conversion buffer) to avoid buffer underruns
|
||||||
const CVector<int16_t> vZeros ( iStereoBlockSizeSam, 0 );
|
SndCrdConversionBufferOut.Put ( vecZeros, iStereoBlockSizeSam );
|
||||||
SndCrdConversionBufferOut.Put ( vZeros, vZeros.Size() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// reset initialization phase flag and mute flag
|
// reset initialization phase flag and mute flag
|
||||||
bIsInitializationPhase = true;
|
bIsInitializationPhase = true;
|
||||||
bMuteInputAndOutput = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CClient::AudioCallback ( CVector<int16_t>& psData, void* arg )
|
void CClient::AudioCallback ( CVector<int16_t>& psData, void* arg )
|
||||||
|
@ -868,12 +868,6 @@ static CTimingMeas JitterMeas ( 1000, "test2.dat" );
|
||||||
JitterMeas.Measure();
|
JitterMeas.Measure();
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// mute input if requested
|
|
||||||
if ( bMuteInputAndOutput )
|
|
||||||
{
|
|
||||||
vecsStereoSndCrd.Reset ( 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
// check if a conversion buffer is required or not
|
// check if a conversion buffer is required or not
|
||||||
if ( bSndCrdConversionBufferRequired )
|
if ( bSndCrdConversionBufferRequired )
|
||||||
{
|
{
|
||||||
|
@ -901,12 +895,6 @@ JitterMeas.Measure();
|
||||||
// process audio data
|
// process audio data
|
||||||
ProcessAudioDataIntern ( vecsStereoSndCrd );
|
ProcessAudioDataIntern ( vecsStereoSndCrd );
|
||||||
}
|
}
|
||||||
|
|
||||||
// mute output if requested
|
|
||||||
if ( bMuteInputAndOutput )
|
|
||||||
{
|
|
||||||
vecsStereoSndCrd.Reset ( 0 );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CClient::ProcessAudioDataIntern ( CVector<int16_t>& vecsStereoSndCrd )
|
void CClient::ProcessAudioDataIntern ( CVector<int16_t>& vecsStereoSndCrd )
|
||||||
|
@ -1058,11 +1046,22 @@ void CClient::ProcessAudioDataIntern ( CVector<int16_t>& vecsStereoSndCrd )
|
||||||
// OPUS encoding
|
// OPUS encoding
|
||||||
if ( CurOpusEncoder != nullptr )
|
if ( CurOpusEncoder != nullptr )
|
||||||
{
|
{
|
||||||
opus_custom_encode ( CurOpusEncoder,
|
if ( bMuteOutStream )
|
||||||
&vecsStereoSndCrd[i * iNumAudioChannels * iOPUSFrameSizeSamples],
|
{
|
||||||
iOPUSFrameSizeSamples,
|
opus_custom_encode ( CurOpusEncoder,
|
||||||
&vecCeltData[0],
|
&vecZeros[i * iNumAudioChannels * iOPUSFrameSizeSamples],
|
||||||
iCeltNumCodedBytes );
|
iOPUSFrameSizeSamples,
|
||||||
|
&vecCeltData[0],
|
||||||
|
iCeltNumCodedBytes );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
opus_custom_encode ( CurOpusEncoder,
|
||||||
|
&vecsStereoSndCrd[i * iNumAudioChannels * iOPUSFrameSizeSamples],
|
||||||
|
iOPUSFrameSizeSamples,
|
||||||
|
&vecCeltData[0],
|
||||||
|
iCeltNumCodedBytes );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// send coded audio through the network
|
// send coded audio through the network
|
||||||
|
@ -1073,6 +1072,12 @@ void CClient::ProcessAudioDataIntern ( CVector<int16_t>& vecsStereoSndCrd )
|
||||||
|
|
||||||
|
|
||||||
// Receive signal ----------------------------------------------------------
|
// Receive signal ----------------------------------------------------------
|
||||||
|
// in case of mute stream, store local data
|
||||||
|
if ( bMuteOutStream )
|
||||||
|
{
|
||||||
|
vecsStereoSndCrdTMP = vecsStereoSndCrd;
|
||||||
|
}
|
||||||
|
|
||||||
for ( i = 0; i < iSndCrdFrameSizeFactor; i++ )
|
for ( i = 0; i < iSndCrdFrameSizeFactor; i++ )
|
||||||
{
|
{
|
||||||
// receive a new block
|
// receive a new block
|
||||||
|
@ -1120,6 +1125,16 @@ for (i = 0; i < iMonoBlockSizeSam; i++)
|
||||||
fflush(pFileDelay);
|
fflush(pFileDelay);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// for muted stream we have to add our local data here
|
||||||
|
if ( bMuteOutStream )
|
||||||
|
{
|
||||||
|
for ( i = 0; i < iStereoBlockSizeSam; i++ )
|
||||||
|
{
|
||||||
|
vecsStereoSndCrd[i] += vecsStereoSndCrdTMP[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// check if channel is connected and if we do not have the initialization phase
|
// check if channel is connected and if we do not have the initialization phase
|
||||||
if ( Channel.IsConnected() && ( !bIsInitializationPhase ) )
|
if ( Channel.IsConnected() && ( !bIsInitializationPhase ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -236,7 +236,7 @@ public:
|
||||||
bool GetFraSiFactDefSupported() { return bFraSiFactDefSupported; }
|
bool GetFraSiFactDefSupported() { return bFraSiFactDefSupported; }
|
||||||
bool GetFraSiFactSafeSupported() { return bFraSiFactSafeSupported; }
|
bool GetFraSiFactSafeSupported() { return bFraSiFactSafeSupported; }
|
||||||
|
|
||||||
void SetMuteInputAndOutputState ( const bool bDoMute ) { bMuteInputAndOutput = bDoMute; }
|
void SetMuteOutStream ( const bool bDoMute ) { bMuteOutStream = bDoMute; }
|
||||||
|
|
||||||
void SetRemoteChanGain ( const int iId, const double dGain )
|
void SetRemoteChanGain ( const int iId, const double dGain )
|
||||||
{ Channel.SetRemoteChanGain ( iId, dGain ); }
|
{ Channel.SetRemoteChanGain ( iId, dGain ); }
|
||||||
|
@ -331,7 +331,7 @@ protected:
|
||||||
EAudChanConf eAudioChannelConf;
|
EAudChanConf eAudioChannelConf;
|
||||||
int iNumAudioChannels;
|
int iNumAudioChannels;
|
||||||
bool bIsInitializationPhase;
|
bool bIsInitializationPhase;
|
||||||
bool bMuteInputAndOutput;
|
bool bMuteOutStream;
|
||||||
CVector<unsigned char> vecCeltData;
|
CVector<unsigned char> vecCeltData;
|
||||||
|
|
||||||
CHighPrioSocket Socket;
|
CHighPrioSocket Socket;
|
||||||
|
@ -354,6 +354,8 @@ protected:
|
||||||
CBufferBase<int16_t> SndCrdConversionBufferIn;
|
CBufferBase<int16_t> SndCrdConversionBufferIn;
|
||||||
CBufferBase<int16_t> SndCrdConversionBufferOut;
|
CBufferBase<int16_t> SndCrdConversionBufferOut;
|
||||||
CVector<int16_t> vecDataConvBuf;
|
CVector<int16_t> vecDataConvBuf;
|
||||||
|
CVector<int16_t> vecsStereoSndCrdTMP;
|
||||||
|
CVector<int16_t> vecZeros;
|
||||||
|
|
||||||
bool bFraSiFactPrefSupported;
|
bool bFraSiFactPrefSupported;
|
||||||
bool bFraSiFactDefSupported;
|
bool bFraSiFactDefSupported;
|
||||||
|
|
|
@ -416,8 +416,8 @@ CClientDlg::CClientDlg ( CClient* pNCliP,
|
||||||
QObject::connect ( chbChat, SIGNAL ( stateChanged ( int ) ),
|
QObject::connect ( chbChat, SIGNAL ( stateChanged ( int ) ),
|
||||||
this, SLOT ( OnChatStateChanged ( int ) ) );
|
this, SLOT ( OnChatStateChanged ( int ) ) );
|
||||||
|
|
||||||
QObject::connect ( chbProfile, SIGNAL ( stateChanged ( int ) ),
|
QObject::connect ( chbLocalMute, SIGNAL ( stateChanged ( int ) ),
|
||||||
this, SLOT ( OnProfileStateChanged ( int ) ) );
|
this, SLOT ( OnLocalMuteStateChanged ( int ) ) );
|
||||||
|
|
||||||
// timers
|
// timers
|
||||||
QObject::connect ( &TimerSigMet, SIGNAL ( timeout() ),
|
QObject::connect ( &TimerSigMet, SIGNAL ( timeout() ),
|
||||||
|
@ -769,8 +769,8 @@ void CClientDlg::OnLicenceRequired ( ELicenceType eLicenceType )
|
||||||
{
|
{
|
||||||
CLicenceDlg LicenceDlg;
|
CLicenceDlg LicenceDlg;
|
||||||
|
|
||||||
// mute the client
|
// mute the client output stream
|
||||||
pClient->SetMuteInputAndOutputState ( true );
|
pClient->SetMuteOutStream ( true );
|
||||||
|
|
||||||
// Open the licence dialog and check if the licence was accepted. In
|
// Open the licence dialog and check if the licence was accepted. In
|
||||||
// case the dialog is just closed or the decline button was pressed,
|
// case the dialog is just closed or the decline button was pressed,
|
||||||
|
@ -780,8 +780,11 @@ void CClientDlg::OnLicenceRequired ( ELicenceType eLicenceType )
|
||||||
Disconnect();
|
Disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
// unmute the client
|
// unmute the client output stream if local mute button is not pressed
|
||||||
pClient->SetMuteInputAndOutputState ( false );
|
if ( chbLocalMute->checkState() == Qt::Unchecked )
|
||||||
|
{
|
||||||
|
pClient->SetMuteOutStream ( false );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -923,16 +926,9 @@ void CClientDlg::OnChatStateChanged ( int value )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CClientDlg::OnProfileStateChanged ( int value )
|
void CClientDlg::OnLocalMuteStateChanged ( int value )
|
||||||
{
|
{
|
||||||
if ( value == Qt::Checked )
|
pClient->SetMuteOutStream ( value == Qt::Checked );
|
||||||
{
|
|
||||||
ShowMusicianProfileDialog();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MusicianProfileDlg.hide();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CClientDlg::OnTimerSigMet()
|
void CClientDlg::OnTimerSigMet()
|
||||||
|
@ -1166,19 +1162,6 @@ void CClientDlg::UpdateDisplay()
|
||||||
chbChat->setChecked ( true );
|
chbChat->setChecked ( true );
|
||||||
chbChat->blockSignals ( false );
|
chbChat->blockSignals ( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( chbProfile->isChecked() && !MusicianProfileDlg.isVisible() )
|
|
||||||
{
|
|
||||||
chbProfile->blockSignals ( true );
|
|
||||||
chbProfile->setChecked ( false );
|
|
||||||
chbProfile->blockSignals ( false );
|
|
||||||
}
|
|
||||||
if ( !chbProfile->isChecked() && MusicianProfileDlg.isVisible() )
|
|
||||||
{
|
|
||||||
chbProfile->blockSignals ( true );
|
|
||||||
chbProfile->setChecked ( true );
|
|
||||||
chbProfile->blockSignals ( false );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CClientDlg::SetGUIDesign ( const EGUIDesign eNewDesign )
|
void CClientDlg::SetGUIDesign ( const EGUIDesign eNewDesign )
|
||||||
|
|
|
@ -150,7 +150,7 @@ public slots:
|
||||||
|
|
||||||
void OnSettingsStateChanged ( int value );
|
void OnSettingsStateChanged ( int value );
|
||||||
void OnChatStateChanged ( int value );
|
void OnChatStateChanged ( int value );
|
||||||
void OnProfileStateChanged ( int value );
|
void OnLocalMuteStateChanged ( int value );
|
||||||
|
|
||||||
void OnAudioPanValueChanged ( int value );
|
void OnAudioPanValueChanged ( int value );
|
||||||
|
|
||||||
|
|
|
@ -339,9 +339,9 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="chbProfile">
|
<widget class="QCheckBox" name="chbLocalMute">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>My Profile</string>
|
<string>Mute Stream</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
Loading…
Reference in a new issue