Skip to content

Commit

Permalink
disable clang-format for code that is unaligned on purpose
Browse files Browse the repository at this point in the history
  • Loading branch information
passing authored and pljones committed May 16, 2021
1 parent f79ba40 commit 6d9d941
Show file tree
Hide file tree
Showing 17 changed files with 120 additions and 0 deletions.
4 changes: 4 additions & 0 deletions linux/sound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,14 @@ void CSound::Stop()
int CSound::Init ( const int /* iNewPrefMonoBufferSize */ )
{

// clang-format off
// try setting buffer size
// TODO seems not to work! -> no audio after this operation!
// Doesn't this give an infinite loop? The set buffer size function will call our
// registered callback which calls "EmitReinitRequestSignal()". In that function
// this CSound::Init() function is called...
//jack_set_buffer_size ( pJackClient, iNewPrefMonoBufferSize );
// clang-format on

// without a Jack server, Jamulus makes no sense to run, throw an error message
if ( bJackWasShutDown )
Expand Down Expand Up @@ -336,7 +338,9 @@ int CSound::process ( jack_nframes_t nframes, void* arg )
jack_midi_event_get ( &in_event, in_midi, j );

// copy packet and send it to the MIDI parser
// clang-format off
// TODO do not call malloc in real-time callback
// clang-format on
CVector<uint8_t> vMIDIPaketBytes ( in_event.size );

for ( i = 0; i < static_cast<int> ( in_event.size ); i++ )
Expand Down
2 changes: 2 additions & 0 deletions src/buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,7 @@ void CNetBufWithStats::UpdateAutoSetting()
dWeightUp,
dWeightDown );

// clang-format off
/*
// TEST store important detection parameters in file for debugging
static FILE* pFile = fopen ( "test.dat", "w" );
Expand All @@ -683,6 +684,7 @@ else
icnt++;
}
*/
// clang-format on

// apply a hysteresis
iCurAutoBufferSizeSetting =
Expand Down
2 changes: 2 additions & 0 deletions src/channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,11 @@ CChannel::CChannel ( const bool bNIsServer ) :

// Connections -------------------------------------------------------------

// clang-format off
// TODO if we later do not fire vectors in the emits, we can remove this again
qRegisterMetaType<CVector<uint8_t> > ( "CVector<uint8_t>" );
qRegisterMetaType<CHostAddress> ( "CHostAddress" );
// clang-format on

QObject::connect ( &Protocol, &CProtocol::MessReadyForSending,
this, &CChannel::OnSendProtMessage );
Expand Down
2 changes: 2 additions & 0 deletions src/channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,10 @@ class CChannel : public QObject
void CreateChatTextMes ( const QString& strChatText ) { Protocol.CreateChatTextMes ( strChatText ); }
void CreateLicReqMes ( const ELicenceType eLicenceType ) { Protocol.CreateLicenceRequiredMes ( eLicenceType ); }

// clang-format off
// TODO needed for compatibility to old servers >= 3.4.6 and <= 3.5.12
void CreateReqChannelLevelListMes() { Protocol.CreateReqChannelLevelListMes(); }
// clang-format on

void CreateConClientListMes ( const CVector<CChannelInfo>& vecChanInfo )
{ Protocol.CreateConClientListMes ( vecChanInfo ); }
Expand Down
4 changes: 4 additions & 0 deletions src/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,10 @@ void CClient::OnNewConnection()
Channel.CreateReqConnClientsList();
CreateServerJitterBufferMessage();

// clang-format off
// TODO needed for compatibility to old servers >= 3.4.6 and <= 3.5.12
Channel.CreateReqChannelLevelListMes();
// clang-format on
}

void CClient::CreateServerJitterBufferMessage()
Expand Down Expand Up @@ -1010,11 +1012,13 @@ void CClient::AudioCallback ( CVector<int16_t>& psData, void* arg )
// process audio data
pMyClientObj->ProcessSndCrdAudioData ( psData );

// clang-format off
/*
// TEST do a soundcard jitter measurement
static CTimingMeas JitterMeas ( 1000, "test2.dat" );
JitterMeas.Measure();
*/
// clang-format on
}

void CClient::ProcessSndCrdAudioData ( CVector<int16_t>& vecsStereoSndCrd )
Expand Down
2 changes: 2 additions & 0 deletions src/clientdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1271,9 +1271,11 @@ void CClientDlg::Disconnect()
bDetectFeedback = false;


// clang-format off
// TODO is this still required???
// immediately update status bar
OnTimerStatus();
// clang-format on


// reset LEDs
Expand Down
2 changes: 2 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -741,8 +741,10 @@ int main ( int argc, char** argv )
Q_INIT_RESOURCE(resources);


// clang-format off
// TEST -> activate the following line to activate the test bench,
//CTestbench Testbench ( "127.0.0.1", DEFAULT_PORT_NUMBER );
// clang-format on


try
Expand Down
6 changes: 6 additions & 0 deletions src/protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -640,10 +640,12 @@ void CProtocol::ParseMessageBody ( const CVector<uint8_t>& vecbyMesBodyData,
const int iRecCounter,
const int iRecID )
{
// clang-format off
/*
// TEST channel implementation: randomly delete protocol messages (50 % loss)
if ( rand() < ( RAND_MAX / 2 ) ) return false;
*/
// clang-format on

// In case we received a message and returned an answer but our answer
// did not make it to the receiver, he will resend his message. We check
Expand Down Expand Up @@ -865,10 +867,12 @@ void CProtocol::ParseConnectionLessMessageBody ( const CVector<uint8_t>& vecbyMe
const int iRecID,
const CHostAddress& InetAddr )
{
// clang-format off
/*
// TEST channel implementation: randomly delete protocol messages (50 % loss)
if ( rand() < ( RAND_MAX / 2 ) ) return false;
*/
// clang-format on

// check which type of message we received and do action
switch ( iRecID )
Expand Down Expand Up @@ -2884,8 +2888,10 @@ bool CProtocol::ParseMessageFrame ( const CVector<uint8_t>& vecbyData,

// Extract actual data -----------------------------------------------------

// clang-format off
// TODO this memory allocation is done in the real time thread but should be
// done in the low priority protocol management thread
// clang-format on

vecbyMesBodyData.Init ( iLenBy );

Expand Down
2 changes: 2 additions & 0 deletions src/protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,10 @@ class CProtocol : public QObject
void CreateLicenceRequiredMes ( const ELicenceType eLicenceType );
void CreateOpusSupportedMes();

// clang-format off
// TODO needed for compatibility to old servers >= 3.4.6 and <= 3.5.12
void CreateReqChannelLevelListMes();
// clang-format on

void CreateVersionAndOSMes();
void CreateRecorderStateMes ( const ERecorderState eRecorderState );
Expand Down
2 changes: 2 additions & 0 deletions src/recorder/jamrecorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ void CJamClient::Disconnect()
QString CJamClient::TranslateChars (const QString& input) const
{
// Allow letters and numbers
// clang-format off
static const char charmap[256] = {
'_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_',
'_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_',
Expand All @@ -126,6 +127,7 @@ QString CJamClient::TranslateChars (const QString& input) const
'a', 'a', 'a', 'a', 'a', 'a', 'a', 'c', 'e', 'e', 'e', 'e', 'i', 'i', 'i', 'i',
'd', 'n', 'o', 'o', 'o', 'o', 'o', '_', 'o', 'u', 'u', 'u', 'u', 'y', 'p', 'y'
};
// clang-format on

QByteArray r = input.toLatin1();

Expand Down
6 changes: 6 additions & 0 deletions src/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,11 @@ void CHighPrecisionTimer::run()
{
// call processing routine by fireing signal

// clang-format off
// TODO by emit a signal we leave the high priority thread -> maybe use some
// other connection type to have something like a true callback, e.g.
// "Qt::DirectConnection" -> Can this work?
// clang-format on

emit timeout();

Expand Down Expand Up @@ -810,9 +812,11 @@ void CServer::Stop()

void CServer::OnTimer()
{
// clang-format off
/*
static CTimingMeas JitterMeas ( 1000, "test2.dat" ); JitterMeas.Measure(); // TEST do a timer jitter measurement
*/
// clang-format on
// Get data from all connected clients -------------------------------------
// some inits
int iNumClients = 0; // init connected client counter
Expand Down Expand Up @@ -1411,9 +1415,11 @@ void CServer::MixEncodeTransmitData ( const int iChanCnt,
// OPUS encoding
if ( pCurOpusEncoder != nullptr )
{
// clang-format off
// TODO find a better place than this: the setting does not change all the time so for speed
// optimization it would be better to set it only if the network frame size is changed
opus_custom_encoder_ctl ( pCurOpusEncoder, OPUS_SET_BITRATE ( CalcBitRateBitsPerSecFromCodedBytes ( iCeltNumCodedBytes, iClientFrameSizeSamples ) ) );
// clang-format on

for ( size_t iB = 0; iB < (size_t)vecNumFrameSizeConvBlocks[iChanCnt]; iB++ )
{
Expand Down
2 changes: 2 additions & 0 deletions src/serverdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,11 @@ CServerDlg::CServerDlg ( CServer* pNServP,
lvwClients->setColumnWidth ( 3, 50 ); // Channels
lvwClients->clear();

// clang-format off
// TEST workaround for resize problem of window after iconize in task bar
lvwClients->setMinimumWidth ( 170 + 130 + 60 + 205 );
lvwClients->setMinimumHeight ( 140 );
// clang-format on


// insert items in reverse order because in Windows all of them are
Expand Down
6 changes: 6 additions & 0 deletions src/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -466,9 +466,11 @@ void CClientSettings::ReadSettingsFromXML ( const QDomDocument& IniXMLDocument
pClient->SetAudioQuality ( static_cast<EAudioQuality> ( iValue ) );
}

// clang-format off
// TODO compatibility to old version (< 3.6.1)
// NOTE that the strCurAddr and "check for empty" can be removed if compatibility mode is removed
vstrCentralServerAddress[0] = GetIniSetting ( IniXMLDocument, "client", "centralservaddr" );
// clang-format on

// directory server addresses
for ( iIdx = 0; iIdx < MAX_NUM_SERVER_ADDR_ITEMS; iIdx++ )
Expand All @@ -494,6 +496,7 @@ vstrCentralServerAddress[0] = GetIniSetting ( IniXMLDocument, "client", "central
eCentralServerAddressType = AT_DEFAULT;
}

// clang-format off
// TODO compatibility to old version (<3.4.7)
if ( GetFlagIniSet ( IniXMLDocument, "client", "defcentservaddr", bValue ) )
{
Expand All @@ -503,6 +506,7 @@ if ( GetFlagIniSet ( IniXMLDocument, "client", "defcentservaddr", bValue ) )
eCentralServerAddressType = AT_CUSTOM;
}
}
// clang-format on

// window position of the main window
vecWindowPosMain = FromBase64ToByteArray (
Expand Down Expand Up @@ -835,6 +839,7 @@ void CServerSettings::ReadSettingsFromXML ( const QDomDocument& IniXMLDocument
pServer->SetCentralServerAddressType ( AT_DEFAULT );
}

// clang-format off
// TODO compatibility to old version
if ( GetFlagIniSet ( IniXMLDocument, "server", "defcentservaddr", bValue ) )
{
Expand All @@ -844,6 +849,7 @@ if ( GetFlagIniSet ( IniXMLDocument, "server", "defcentservaddr", bValue ) )
pServer->SetCentralServerAddressType ( AT_CUSTOM );
}
}
// clang-format on

if ( !CommandLineOptions.contains ( "--centralserver" ) &&
!CommandLineOptions.contains ( "--directoryserver" ) )
Expand Down
6 changes: 6 additions & 0 deletions src/socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ void CSocket::Init ( const quint16 iPortNumber, const quint16 iQosNumber, const
#ifdef _WIN32
// for the Windows socket usage we have to start it up first

// clang-format off
// TODO check for error and exit application on error
// clang-format on

WSADATA wsa;
WSAStartup ( MAKEWORD(1, 0), &wsa );
Expand Down Expand Up @@ -271,14 +273,18 @@ void CSocket::OnDataReceived()
if ( CProtocol::IsConnectionLessMessageID ( iRecID ) )
{

// clang-format off
// TODO a copy of the vector is used -> avoid malloc in real-time routine
// clang-format on

emit ProtcolCLMessageReceived ( iRecID, vecbyMesBodyData, RecHostAddr );
}
else
{

// clang-format off
// TODO a copy of the vector is used -> avoid malloc in real-time routine
// clang-format on

emit ProtcolMessageReceived ( iRecCounter, iRecID, vecbyMesBodyData, RecHostAddr );
}
Expand Down
4 changes: 4 additions & 0 deletions src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -697,9 +697,11 @@ enum ESkillLevel
class CStereoSignalLevelMeter
{
public:
// clang-format off
// TODO Calculate smoothing factor from sample rate and frame size (64 or 128 samples frame size).
// But tests with 128 and 64 samples frame size have shown that the meter fly back
// is ok for both numbers of samples frame size with a factor of 0.99.
// clang-format on
CStereoSignalLevelMeter ( const bool bNIsStereoOut = true,
const double dNSmoothingFactor = 0.99 ) :
dSmoothingFactor ( dNSmoothingFactor ), bIsStereoOut ( bNIsStereoOut ) { Reset(); }
Expand Down Expand Up @@ -822,7 +824,9 @@ class CInstPictures
static EInstCategory GetCategory ( const int iInstrument );
static void UpdateTableOnLanguageChange() { GetTable ( true ); }

// clang-format off
// TODO make use of instrument category (not yet implemented)
// clang-format on

protected:
class CInstPictProps
Expand Down
2 changes: 2 additions & 0 deletions src/vstmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ CLlconVST::CLlconVST ( audioMasterCallback AudioMaster ) :
connect ( &TimerOnOff, SIGNAL ( timeout() ),
this, SLOT ( OnTimerOnOff() ) );

// clang-format off
// TODO settings
Client.SetServerAddr ( DEFAULT_SERVER_ADDRESS );
// clang-format on
}

bool CLlconVST::GetName ( char* cName )
Expand Down
Loading

0 comments on commit 6d9d941

Please sign in to comment.