fixed audio fade-in counter for 64 samples frame size

This commit is contained in:
Volker Fischer 2020-04-13 18:13:42 +02:00
parent 5f85660cde
commit d9562ea525
4 changed files with 23 additions and 16 deletions

View file

@ -30,6 +30,7 @@ CChannel::CChannel ( const bool bNIsServer ) :
vecdGains ( MAX_NUM_CHANNELS, 1.0 ),
bDoAutoSockBufSize ( true ),
iFadeInCnt ( 0 ),
iFadeInCntMax ( FADE_IN_NUM_FRAMES_DBLE_FRAMESIZE ),
bIsEnabled ( false ),
bIsServer ( bNIsServer )
{
@ -365,6 +366,16 @@ void CChannel::OnNetTranspPropsReceived ( CNetworkTransportProps NetworkTranspor
iNetwFrameSizeFact = NetworkTransportProps.iBlockSizeFact;
iNetwFrameSize = static_cast<int> ( NetworkTransportProps.iBaseNetworkPacketSize );
// update maximum number of frames for fade in counter
if ( eAudioCompressionType == CT_OPUS )
{
iFadeInCntMax = FADE_IN_NUM_FRAMES_DBLE_FRAMESIZE;
}
else
{
iFadeInCntMax = FADE_IN_NUM_FRAMES;
}
MutexSocketBuf.lock();
{
// update socket buffer (the network block size is a multiple of the
@ -463,7 +474,7 @@ EPutDataStat CChannel::PutAudioData ( const CVector<uint8_t>& vecbyData,
}
// manage audio fade-in counter
if ( iFadeInCnt < FADE_IN_NUM_FRAMES )
if ( iFadeInCnt < iFadeInCntMax )
{
iFadeInCnt++;
}

View file

@ -39,16 +39,11 @@
// 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
#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: 3 seconds / ( 64 samples / 48 kHz ) = 2250
# define FADE_IN_NUM_FRAMES 2250
#else
// 48 kHz, 128 samples: 3 seconds / ( 128 samples / 48 kHz ) = 1125
# define FADE_IN_NUM_FRAMES 1125
#endif
// number of frames for audio fade-in, 48 kHz, x samples: 3 sec / (x samples / 48 kHz)
#define FADE_IN_NUM_FRAMES 2250
#define FADE_IN_NUM_FRAMES_DBLE_FRAMESIZE 1125
enum EPutDataStat
@ -113,7 +108,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; }
double GetFadeInGain() { return static_cast<double> ( iFadeInCnt ) / iFadeInCntMax; }
void SetRemoteChanGain ( const int iId, const double dGain )
{ Protocol.CreateChanGainMes ( iId, dGain ); }
@ -210,6 +205,7 @@ protected:
int iConTimeOut;
int iConTimeOutStartVal;
int iFadeInCnt;
int iFadeInCntMax;
bool bIsEnabled;
bool bIsServer;

View file

@ -107,13 +107,13 @@ LED bar: lbr
#define DEFAULT_SERVER_NAME "Central Server"
// download URL
#define JAMULUS_DOWNLOAD_URL "http://sourceforge.net/projects/llcon/files"
#define SOFTWARE_DOWNLOAD_URL "http://sourceforge.net/projects/llcon/files"
// determining server internal address uses well-known host and port
// (Google DNS, or something else reliable)
#define WELL_KNOWN_HOST "8.8.8.8" // Google
#define WELL_KNOWN_PORT 53 // DNS
#define IP_LOOKUP_TIMEOUT 500 // ms
#define WELL_KNOWN_HOST "8.8.8.8" // Google
#define WELL_KNOWN_PORT 53 // DNS
#define IP_LOOKUP_TIMEOUT 500 // ms
// defined port numbers for client and server
#define LLCON_DEFAULT_PORT_NUMBER 22124

View file

@ -482,7 +482,7 @@ public slots:
void OnHelpWhatsThis() { QWhatsThis::enterWhatsThisMode(); }
void OnHelpAbout() { AboutDlg.exec(); }
void OnHelpDownloadLink()
{ QDesktopServices::openUrl ( QUrl ( JAMULUS_DOWNLOAD_URL ) ); }
{ QDesktopServices::openUrl ( QUrl ( SOFTWARE_DOWNLOAD_URL ) ); }
};