audio fade-in at the server if new client connects
This commit is contained in:
parent
3eaec8363a
commit
4cfd54b21b
4 changed files with 32 additions and 10 deletions
|
@ -4,10 +4,11 @@
|
|||
|
||||
- changed the maximum number of clients from 20 to 40
|
||||
|
||||
- audio fade-in at the server if new client connects
|
||||
|
||||
|
||||
TODO add a QScrollArea to the mixer board to get a scroll bar if we have too many mixer faders
|
||||
|
||||
TODO slowly fade in the audio at the server for all inputs of client which new connects to the server and also if new other client enters the server
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
CChannel::CChannel ( const bool bNIsServer ) :
|
||||
vecdGains ( MAX_NUM_CHANNELS, 1.0 ),
|
||||
bDoAutoSockBufSize ( true ),
|
||||
iFadeInCnt ( 0 ),
|
||||
bIsEnabled ( false ),
|
||||
bIsServer ( bNIsServer )
|
||||
{
|
||||
|
@ -461,6 +462,12 @@ EPutDataStat CChannel::PutAudioData ( const CVector<uint8_t>& vecbyData,
|
|||
{
|
||||
eRet = PS_AUDIO_ERR;
|
||||
}
|
||||
|
||||
// manage audio fade-in counter
|
||||
if ( iFadeInCnt < FADE_IN_NUM_FRAMES )
|
||||
{
|
||||
iFadeInCnt++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -481,6 +488,9 @@ EPutDataStat CChannel::PutAudioData ( const CVector<uint8_t>& vecbyData,
|
|||
{
|
||||
// overwrite status
|
||||
eRet = PS_NEW_CONNECTION;
|
||||
|
||||
// init audio fade-in counter
|
||||
iFadeInCnt = 0;
|
||||
}
|
||||
|
||||
// reset time-out counter (note that this must be done after the
|
||||
|
|
|
@ -36,11 +36,21 @@
|
|||
|
||||
|
||||
/* Definitions ****************************************************************/
|
||||
// Set the time-out for the input buffer until the state changes from
|
||||
// set the time-out for the input buffer until the state changes from
|
||||
// connected to not connected (the actual time depends on the way the error
|
||||
// correction is implemented)
|
||||
#define CON_TIME_OUT_SEC_MAX 30 // seconds
|
||||
|
||||
// number of frames for audio fade-in
|
||||
#if ( SYSTEM_FRAME_SIZE_SAMPLES == 64 )
|
||||
// 48 kHz, 64 samples: 2 seconds / ( 64 samples / 48 kHz ) = 2250
|
||||
# define FADE_IN_NUM_FRAMES 1500
|
||||
#else
|
||||
// 48 kHz, 128 samples: 2 seconds / ( 128 samples / 48 kHz ) = 1125
|
||||
# define FADE_IN_NUM_FRAMES 750
|
||||
#endif
|
||||
|
||||
|
||||
enum EPutDataStat
|
||||
{
|
||||
PS_GEN_ERROR,
|
||||
|
@ -103,6 +113,7 @@ public:
|
|||
|
||||
void SetGain ( const int iChanID, const double dNewGain );
|
||||
double GetGain ( const int iChanID );
|
||||
double GetFadeInGain() { return static_cast<double> ( iFadeInCnt ) / FADE_IN_NUM_FRAMES; }
|
||||
|
||||
void SetRemoteChanGain ( const int iId, const double dGain )
|
||||
{ Protocol.CreateChanGainMes ( iId, dGain ); }
|
||||
|
@ -190,6 +201,7 @@ protected:
|
|||
|
||||
int iConTimeOut;
|
||||
int iConTimeOutStartVal;
|
||||
int iFadeInCnt;
|
||||
|
||||
bool bIsEnabled;
|
||||
bool bIsServer;
|
||||
|
|
|
@ -833,10 +833,8 @@ JitterMeas.Measure();
|
|||
const int iCurChanID = vecChanIDsCurConChan[i];
|
||||
|
||||
// get and store number of audio channels
|
||||
const int iCurNumAudChan =
|
||||
vecChannels[iCurChanID].GetNumAudioChannels();
|
||||
|
||||
vecNumAudioChannels[i] = iCurNumAudChan;
|
||||
const int iCurNumAudChan = vecChannels[iCurChanID].GetNumAudioChannels();
|
||||
vecNumAudioChannels[i] = iCurNumAudChan;
|
||||
|
||||
// get gains of all connected channels
|
||||
for ( j = 0; j < iNumClients; j++ )
|
||||
|
@ -845,13 +843,14 @@ JitterMeas.Measure();
|
|||
// the channel ID! Therefore we have to use
|
||||
// "vecChanIDsCurConChan" to query the IDs of the currently
|
||||
// connected channels
|
||||
vecvecdGains[i][j] =
|
||||
vecChannels[iCurChanID].GetGain( vecChanIDsCurConChan[j] );
|
||||
vecvecdGains[i][j] = vecChannels[iCurChanID].GetGain ( vecChanIDsCurConChan[j] );
|
||||
|
||||
// consider audio fade-in
|
||||
vecvecdGains[i][j] *= vecChannels[vecChanIDsCurConChan[j]].GetFadeInGain();
|
||||
}
|
||||
|
||||
// get current number of CELT coded bytes
|
||||
const int iCeltNumCodedBytes =
|
||||
vecChannels[iCurChanID].GetNetwFrameSize();
|
||||
const int iCeltNumCodedBytes = vecChannels[iCurChanID].GetNetwFrameSize();
|
||||
|
||||
// get data
|
||||
const EGetDataStat eGetStat =
|
||||
|
|
Loading…
Reference in a new issue