fixed audio fade-in counter for 64 samples frame size
This commit is contained in:
parent
5f85660cde
commit
d9562ea525
4 changed files with 23 additions and 16 deletions
|
@ -30,6 +30,7 @@ CChannel::CChannel ( const bool bNIsServer ) :
|
||||||
vecdGains ( MAX_NUM_CHANNELS, 1.0 ),
|
vecdGains ( MAX_NUM_CHANNELS, 1.0 ),
|
||||||
bDoAutoSockBufSize ( true ),
|
bDoAutoSockBufSize ( true ),
|
||||||
iFadeInCnt ( 0 ),
|
iFadeInCnt ( 0 ),
|
||||||
|
iFadeInCntMax ( FADE_IN_NUM_FRAMES_DBLE_FRAMESIZE ),
|
||||||
bIsEnabled ( false ),
|
bIsEnabled ( false ),
|
||||||
bIsServer ( bNIsServer )
|
bIsServer ( bNIsServer )
|
||||||
{
|
{
|
||||||
|
@ -365,6 +366,16 @@ void CChannel::OnNetTranspPropsReceived ( CNetworkTransportProps NetworkTranspor
|
||||||
iNetwFrameSizeFact = NetworkTransportProps.iBlockSizeFact;
|
iNetwFrameSizeFact = NetworkTransportProps.iBlockSizeFact;
|
||||||
iNetwFrameSize = static_cast<int> ( NetworkTransportProps.iBaseNetworkPacketSize );
|
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();
|
MutexSocketBuf.lock();
|
||||||
{
|
{
|
||||||
// update socket buffer (the network block size is a multiple of the
|
// 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
|
// manage audio fade-in counter
|
||||||
if ( iFadeInCnt < FADE_IN_NUM_FRAMES )
|
if ( iFadeInCnt < iFadeInCntMax )
|
||||||
{
|
{
|
||||||
iFadeInCnt++;
|
iFadeInCnt++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,16 +39,11 @@
|
||||||
// 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
|
// number of frames for audio fade-in, 48 kHz, x samples: 3 sec / (x samples / 48 kHz)
|
||||||
#if ( SYSTEM_FRAME_SIZE_SAMPLES == 64 )
|
#define FADE_IN_NUM_FRAMES 2250
|
||||||
// 48 kHz, 64 samples: 3 seconds / ( 64 samples / 48 kHz ) = 2250
|
#define FADE_IN_NUM_FRAMES_DBLE_FRAMESIZE 1125
|
||||||
# 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
|
|
||||||
|
|
||||||
|
|
||||||
enum EPutDataStat
|
enum EPutDataStat
|
||||||
|
@ -113,7 +108,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; }
|
double GetFadeInGain() { return static_cast<double> ( iFadeInCnt ) / iFadeInCntMax; }
|
||||||
|
|
||||||
void SetRemoteChanGain ( const int iId, const double dGain )
|
void SetRemoteChanGain ( const int iId, const double dGain )
|
||||||
{ Protocol.CreateChanGainMes ( iId, dGain ); }
|
{ Protocol.CreateChanGainMes ( iId, dGain ); }
|
||||||
|
@ -210,6 +205,7 @@ protected:
|
||||||
int iConTimeOut;
|
int iConTimeOut;
|
||||||
int iConTimeOutStartVal;
|
int iConTimeOutStartVal;
|
||||||
int iFadeInCnt;
|
int iFadeInCnt;
|
||||||
|
int iFadeInCntMax;
|
||||||
|
|
||||||
bool bIsEnabled;
|
bool bIsEnabled;
|
||||||
bool bIsServer;
|
bool bIsServer;
|
||||||
|
|
|
@ -107,13 +107,13 @@ LED bar: lbr
|
||||||
#define DEFAULT_SERVER_NAME "Central Server"
|
#define DEFAULT_SERVER_NAME "Central Server"
|
||||||
|
|
||||||
// download URL
|
// 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
|
// determining server internal address uses well-known host and port
|
||||||
// (Google DNS, or something else reliable)
|
// (Google DNS, or something else reliable)
|
||||||
#define WELL_KNOWN_HOST "8.8.8.8" // Google
|
#define WELL_KNOWN_HOST "8.8.8.8" // Google
|
||||||
#define WELL_KNOWN_PORT 53 // DNS
|
#define WELL_KNOWN_PORT 53 // DNS
|
||||||
#define IP_LOOKUP_TIMEOUT 500 // ms
|
#define IP_LOOKUP_TIMEOUT 500 // ms
|
||||||
|
|
||||||
// defined port numbers for client and server
|
// defined port numbers for client and server
|
||||||
#define LLCON_DEFAULT_PORT_NUMBER 22124
|
#define LLCON_DEFAULT_PORT_NUMBER 22124
|
||||||
|
|
|
@ -482,7 +482,7 @@ public slots:
|
||||||
void OnHelpWhatsThis() { QWhatsThis::enterWhatsThisMode(); }
|
void OnHelpWhatsThis() { QWhatsThis::enterWhatsThisMode(); }
|
||||||
void OnHelpAbout() { AboutDlg.exec(); }
|
void OnHelpAbout() { AboutDlg.exec(); }
|
||||||
void OnHelpDownloadLink()
|
void OnHelpDownloadLink()
|
||||||
{ QDesktopServices::openUrl ( QUrl ( JAMULUS_DOWNLOAD_URL ) ); }
|
{ QDesktopServices::openUrl ( QUrl ( SOFTWARE_DOWNLOAD_URL ) ); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue