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++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,14 +41,9 @@
|
||||||
// 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 )
|
|
||||||
// 48 kHz, 64 samples: 3 seconds / ( 64 samples / 48 kHz ) = 2250
|
|
||||||
#define FADE_IN_NUM_FRAMES 2250
|
#define FADE_IN_NUM_FRAMES 2250
|
||||||
#else
|
#define FADE_IN_NUM_FRAMES_DBLE_FRAMESIZE 1125
|
||||||
// 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,7 +107,7 @@ 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)
|
||||||
|
|
|
@ -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