Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Institute of Technical Acoustics (ITA)
ITADataSources
Commits
45cc77b6
Commit
45cc77b6
authored
Mar 29, 2017
by
Dipl.-Ing. Jonas Stienen
Browse files
Refactoring #4
parent
03ea1737
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/ITANetAudioMessage.cpp
View file @
45cc77b6
...
...
@@ -59,6 +59,7 @@ CITANetAudioMessage::CITANetAudioMessage( VistaSerializingToolset::ByteOrderSwap
,
m_pConnection
(
NULL
)
,
m_iBytesReceivedTotal
(
0
)
,
m_sMessageLoggerBaseName
(
"ITANetAudioMessage"
)
,
m_bDebuggingEnabled
(
false
)
{
m_pMessageLogger
=
new
ITABufferedDataLoggerImplProtocol
();
m_pMessageLogger
->
setOutputFile
(
m_sMessageLoggerBaseName
+
".log"
);
...
...
@@ -201,8 +202,8 @@ bool CITANetAudioMessage::ReadMessage( int timeout )
VistaType
::
sint32
nMessagePayloadSize
;
int
nBytesRead
=
m_pConnection
->
ReadInt32
(
nMessagePayloadSize
);
oLog
.
nMessagePayloadSize
=
nMessagePayloadSize
;
assert
(
nBytesRead
==
sizeof
(
VistaType
::
sint32
)
);
oLog
.
nMessagePayloadSize
=
nMessagePayloadSize
;
#if NET_AUDIO_SHOW_TRAFFIC
vstr
::
out
()
<<
"CITANetAudioMessage [ Reading ] Expecting "
<<
nMessagePayloadSize
<<
" bytes message payload"
<<
std
::
endl
;
#endif
...
...
@@ -369,6 +370,8 @@ VistaConnectionIP* CITANetAudioMessage::GetConnection() const
void
CITANetAudioMessage
::
ClearConnection
()
{
m_pConnection
=
NULL
;
if
(
GetIsDebuggingEnabled
()
==
false
)
m_pMessageLogger
->
setOutputFile
(
""
);
// disable output
delete
m_pMessageLogger
;
}
...
...
@@ -462,4 +465,14 @@ void CITANetAudioMessage::SetMessageLoggerBaseName( const std::string& sBaseName
std
::
string
CITANetAudioMessage
::
GetMessageLoggerBaseName
()
const
{
return
m_sMessageLoggerBaseName
;
}
\ No newline at end of file
}
void
CITANetAudioMessage
::
SetDebuggingEnabled
(
bool
bEnabled
)
{
m_bDebuggingEnabled
=
bEnabled
;
}
bool
CITANetAudioMessage
::
GetIsDebuggingEnabled
()
const
{
return
m_bDebuggingEnabled
;
}
src/ITANetAudioMessage.h
View file @
45cc77b6
...
...
@@ -98,6 +98,8 @@ public:
void
SetMessageLoggerBaseName
(
const
std
::
string
&
);
std
::
string
GetMessageLoggerBaseName
()
const
;
void
SetDebuggingEnabled
(
bool
bEnabled
);
bool
GetIsDebuggingEnabled
()
const
;
private:
int
m_nMessageType
;
...
...
@@ -112,6 +114,7 @@ private:
ITABufferedDataLoggerImplProtocol
*
m_pMessageLogger
;
std
::
string
m_sMessageLoggerBaseName
;
bool
m_bDebuggingEnabled
;
};
#endif // INCLUDE_WATCHER_ITA_NET_AUDIO_MESSAGE
src/ITANetAudioStream.cpp
View file @
45cc77b6
...
...
@@ -115,7 +115,7 @@ CITANetAudioStream::CITANetAudioStream(int iChannels, double dSamplingRate, int
CITANetAudioStream
::~
CITANetAudioStream
()
{
if
(
m_b
DebuggingEnabled
==
false
)
if
(
GetIs
DebuggingEnabled
()
==
false
)
{
m_pAudioStreamLogger
->
setOutputFile
(
""
);
// Disables file storing
m_pNetworkStreamLogger
->
setOutputFile
(
""
);
// Disables file storing
...
...
@@ -391,6 +391,7 @@ void CITANetAudioStream::SetNetAudioStreamingLoggerBaseName( const std::string&
void
CITANetAudioStream
::
SetDebuggingEnabled
(
bool
bEnabled
)
{
m_bDebuggingEnabled
=
bEnabled
;
m_pNetAudioStreamingClient
->
SetDebuggingEnabled
(
bEnabled
);
}
bool
CITANetAudioStream
::
GetIsDebuggingEnabled
()
const
...
...
src/ITANetAudioStreamingClient.cpp
View file @
45cc77b6
...
...
@@ -57,6 +57,7 @@ CITANetAudioStreamingClient::CITANetAudioStreamingClient( CITANetAudioStream* pP
,
m_iStreamingBlockId
(
0
)
,
m_dServerClockSyncRequestTimeInterval
(
0.1
f
)
,
m_dServerClockSyncLastSyncTime
(
0.0
f
)
,
m_bDebuggingEnabled
(
false
)
{
m_pClient
=
new
CITANetAudioClient
();
...
...
@@ -78,12 +79,18 @@ CITANetAudioStreamingClient::~CITANetAudioStreamingClient()
StopGently
(
false
);
if
(
GetIsDebuggingEnabled
()
)
{
vstr
::
out
()
<<
"[ ITANetAudioStreamingClient ] Processing statistics: "
<<
m_swTryReadBlockStats
.
ToString
()
<<
std
::
endl
;
vstr
::
out
()
<<
"[ ITANetAudioStreamingClient ] Try-read access statistics: "
<<
m_swTryReadAccessStats
.
ToString
()
<<
std
::
endl
;
}
else
m_pClientLogger
->
setOutputFile
(
""
);
// disable output
delete
m_pClientLogger
;
delete
m_pClient
;
delete
m_pMessage
;
vstr
::
out
()
<<
"[ ITANetAudioStreamingClient ] Processing statistics: "
<<
m_swTryReadBlockStats
.
ToString
()
<<
std
::
endl
;
vstr
::
out
()
<<
"[ ITANetAudioStreamingClient ] Try-read access statistics: "
<<
m_swTryReadAccessStats
.
ToString
()
<<
std
::
endl
;
}
bool
CITANetAudioStreamingClient
::
Connect
(
const
std
::
string
&
sAddress
,
int
iPort
)
...
...
@@ -249,6 +256,17 @@ void CITANetAudioStreamingClient::SetClientLoggerBaseName( const std::string& sB
m_pMessage
->
SetMessageLoggerBaseName
(
GetClientLoggerBaseName
()
+
"_Messages"
);
}
void
CITANetAudioStreamingClient
::
SetDebuggingEnabled
(
bool
bEnabled
)
{
m_bDebuggingEnabled
=
bEnabled
;
m_pMessage
->
SetDebuggingEnabled
(
bEnabled
);
}
bool
CITANetAudioStreamingClient
::
GetIsDebuggingEnabled
()
const
{
return
m_bDebuggingEnabled
;
}
bool
CITANetAudioStreamingClient
::
GetIsConnected
()
const
{
return
m_pClient
->
GetIsConnected
();
...
...
src/ITANetAudioStreamingClient.h
View file @
45cc77b6
...
...
@@ -62,6 +62,9 @@ public:
std
::
string
GetClientLoggerBaseName
()
const
;
void
SetClientLoggerBaseName
(
const
std
::
string
&
);
void
SetDebuggingEnabled
(
bool
bEnabled
);
bool
GetIsDebuggingEnabled
()
const
;
protected:
void
TriggerBlockIncrement
();
...
...
@@ -86,6 +89,7 @@ private:
ITABufferedDataLoggerImplClient
*
m_pClientLogger
;
std
::
string
m_sClientLoggerBaseName
;
ITAStopWatch
m_swTryReadBlockStats
,
m_swTryReadAccessStats
;
bool
m_bDebuggingEnabled
;
friend
class
CITANetAudioStream
;
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment