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
|
- 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 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 ) :
|
CChannel::CChannel ( const bool bNIsServer ) :
|
||||||
vecdGains ( MAX_NUM_CHANNELS, 1.0 ),
|
vecdGains ( MAX_NUM_CHANNELS, 1.0 ),
|
||||||
bDoAutoSockBufSize ( true ),
|
bDoAutoSockBufSize ( true ),
|
||||||
|
iFadeInCnt ( 0 ),
|
||||||
bIsEnabled ( false ),
|
bIsEnabled ( false ),
|
||||||
bIsServer ( bNIsServer )
|
bIsServer ( bNIsServer )
|
||||||
{
|
{
|
||||||
|
@ -461,6 +462,12 @@ EPutDataStat CChannel::PutAudioData ( const CVector<uint8_t>& vecbyData,
|
||||||
{
|
{
|
||||||
eRet = PS_AUDIO_ERR;
|
eRet = PS_AUDIO_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// manage audio fade-in counter
|
||||||
|
if ( iFadeInCnt < FADE_IN_NUM_FRAMES )
|
||||||
|
{
|
||||||
|
iFadeInCnt++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -481,6 +488,9 @@ EPutDataStat CChannel::PutAudioData ( const CVector<uint8_t>& vecbyData,
|
||||||
{
|
{
|
||||||
// overwrite status
|
// overwrite status
|
||||||
eRet = PS_NEW_CONNECTION;
|
eRet = PS_NEW_CONNECTION;
|
||||||
|
|
||||||
|
// init audio fade-in counter
|
||||||
|
iFadeInCnt = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// reset time-out counter (note that this must be done after the
|
// reset time-out counter (note that this must be done after the
|
||||||
|
|
|
@ -36,11 +36,21 @@
|
||||||
|
|
||||||
|
|
||||||
/* Definitions ****************************************************************/
|
/* 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
|
// connected to not connected (the actual time depends on the way the error
|
||||||
// correction is implemented)
|
// correction is implemented)
|
||||||
#define CON_TIME_OUT_SEC_MAX 30 // seconds
|
#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
|
enum EPutDataStat
|
||||||
{
|
{
|
||||||
PS_GEN_ERROR,
|
PS_GEN_ERROR,
|
||||||
|
@ -103,6 +113,7 @@ public:
|
||||||
|
|
||||||
void SetGain ( const int iChanID, const double dNewGain );
|
void SetGain ( const int iChanID, const double dNewGain );
|
||||||
double GetGain ( const int iChanID );
|
double GetGain ( const int iChanID );
|
||||||
|
double GetFadeInGain() { return static_cast<double> ( iFadeInCnt ) / FADE_IN_NUM_FRAMES; }
|
||||||
|
|
||||||
void SetRemoteChanGain ( const int iId, const double dGain )
|
void SetRemoteChanGain ( const int iId, const double dGain )
|
||||||
{ Protocol.CreateChanGainMes ( iId, dGain ); }
|
{ Protocol.CreateChanGainMes ( iId, dGain ); }
|
||||||
|
@ -190,6 +201,7 @@ protected:
|
||||||
|
|
||||||
int iConTimeOut;
|
int iConTimeOut;
|
||||||
int iConTimeOutStartVal;
|
int iConTimeOutStartVal;
|
||||||
|
int iFadeInCnt;
|
||||||
|
|
||||||
bool bIsEnabled;
|
bool bIsEnabled;
|
||||||
bool bIsServer;
|
bool bIsServer;
|
||||||
|
|
|
@ -833,9 +833,7 @@ JitterMeas.Measure();
|
||||||
const int iCurChanID = vecChanIDsCurConChan[i];
|
const int iCurChanID = vecChanIDsCurConChan[i];
|
||||||
|
|
||||||
// get and store number of audio channels
|
// get and store number of audio channels
|
||||||
const int iCurNumAudChan =
|
const int iCurNumAudChan = vecChannels[iCurChanID].GetNumAudioChannels();
|
||||||
vecChannels[iCurChanID].GetNumAudioChannels();
|
|
||||||
|
|
||||||
vecNumAudioChannels[i] = iCurNumAudChan;
|
vecNumAudioChannels[i] = iCurNumAudChan;
|
||||||
|
|
||||||
// get gains of all connected channels
|
// get gains of all connected channels
|
||||||
|
@ -845,13 +843,14 @@ JitterMeas.Measure();
|
||||||
// the channel ID! Therefore we have to use
|
// the channel ID! Therefore we have to use
|
||||||
// "vecChanIDsCurConChan" to query the IDs of the currently
|
// "vecChanIDsCurConChan" to query the IDs of the currently
|
||||||
// connected channels
|
// connected channels
|
||||||
vecvecdGains[i][j] =
|
vecvecdGains[i][j] = vecChannels[iCurChanID].GetGain ( vecChanIDsCurConChan[j] );
|
||||||
vecChannels[iCurChanID].GetGain( vecChanIDsCurConChan[j] );
|
|
||||||
|
// consider audio fade-in
|
||||||
|
vecvecdGains[i][j] *= vecChannels[vecChanIDsCurConChan[j]].GetFadeInGain();
|
||||||
}
|
}
|
||||||
|
|
||||||
// get current number of CELT coded bytes
|
// get current number of CELT coded bytes
|
||||||
const int iCeltNumCodedBytes =
|
const int iCeltNumCodedBytes = vecChannels[iCurChanID].GetNetwFrameSize();
|
||||||
vecChannels[iCurChanID].GetNetwFrameSize();
|
|
||||||
|
|
||||||
// get data
|
// get data
|
||||||
const EGetDataStat eGetStat =
|
const EGetDataStat eGetStat =
|
||||||
|
|
Loading…
Reference in a new issue