Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
ITADataSources
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Institute of Technical Acoustics (ITA)
ITADataSources
Commits
1f77ee75
Commit
1f77ee75
authored
Jan 06, 2017
by
Anne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
running, but with dropouts
parent
6d51e425
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
20 deletions
+35
-20
src/ITANetAudioStream.cpp
src/ITANetAudioStream.cpp
+15
-8
src/ITANetAudioStreamingClient.cpp
src/ITANetAudioStreamingClient.cpp
+5
-3
src/ITANetAudioStreamingServer.cpp
src/ITANetAudioStreamingServer.cpp
+15
-9
No files found.
src/ITANetAudioStream.cpp
View file @
1f77ee75
...
...
@@ -40,15 +40,22 @@ bool CITANetAudioStream::GetIsConnected() const
const
float
*
CITANetAudioStream
::
GetBlockPointer
(
unsigned
int
uiChannel
,
const
ITAStreamInfo
*
)
{
// @todo: is connected?
m_sfOutputStreamBuffer
[
uiChannel
].
Zero
();
if
(
this
->
GetIsConnected
())
{
// todo restlichen kopieren und dann rein und raus faden
int
iCurrentWritePointer
=
m_iWriteCursor
;
if
(
iCurrentWritePointer
>
m_iReadCursor
)
{
m_sfOutputStreamBuffer
[
uiChannel
].
cyclic_write
(
&
m_sfRingBuffer
[
uiChannel
],
m_sfOutputStreamBuffer
.
GetLength
(),
m_iReadCursor
,
iCurrentWritePointer
);
}
else
{
// diesen Block auf 0 setzen
m_sfOutputStreamBuffer
[
uiChannel
].
Zero
();
m_sfRingBuffer
[
uiChannel
].
cyclic_read
(
m_sfOutputStreamBuffer
[
uiChannel
].
GetData
(),
m_sfOutputStreamBuffer
.
GetLength
(),
m_iReadCursor
);
}
else
{
// Hallo
int
a
=
0
;
}
}
return
m_sfOutputStreamBuffer
[
uiChannel
].
GetData
();
}
...
...
src/ITANetAudioStreamingClient.cpp
View file @
1f77ee75
...
...
@@ -99,9 +99,11 @@ bool CITANetAudioStreamingClient::LoopBody()
case
CITANetAudioProtocol
::
NP_SERVER_SEND_SAMPLES
:
// Receive samples from net message and forward them to the stream ring buffer
//int iNumSamples = m_pMessage->ReadSampleFrame( &m_sfReceivingBuffer );
//if( m_pStream->GetRingbufferFreeSamples() >= iNumSamples )
// m_pStream->Transmit( m_sfReceivingBuffer, iNumSamples );
m_pMessage
->
ReadSampleFrame
(
&
m_sfReceivingBuffer
);
if
(
m_pStream
->
GetRingbufferFreeSamples
()
>=
m_sfReceivingBuffer
.
GetLength
())
m_pStream
->
Transmit
(
m_sfReceivingBuffer
,
m_sfReceivingBuffer
.
GetLength
());
//else
// Fehler
break
;
case
CITANetAudioProtocol
::
NP_SERVER_GET_RINGBUFFER_FREE
:
...
...
src/ITANetAudioStreamingServer.cpp
View file @
1f77ee75
...
...
@@ -47,10 +47,15 @@ bool CITANetAudioStreamingServer::Start( const std::string& sAddress, int iPort
CITANetAudioProtocol
::
StreamingParameters
oClientParams
=
m_pMessage
->
ReadStreamingParameters
();
bool
bOK
=
false
;
if
(
m_pInputStream
->
GetNumberOfChannels
()
==
oClientParams
.
iChannels
&&
if
(
m_pInputStream
->
GetNumberOfChannels
()
==
oClientParams
.
iChannels
&&
m_pInputStream
->
GetSampleRate
()
==
oClientParams
.
dSampleRate
&&
m_pInputStream
->
GetBlocklength
()
==
oClientParams
.
iBlockSize
)
m_pInputStream
->
GetBlocklength
()
==
oClientParams
.
iBlockSize
)
{
bOK
=
true
;
std
::
cout
<<
" Alle Daten Stimmen:
\n
Anzahl Channel: "
<<
oClientParams
.
iChannels
<<
std
::
endl
;
std
::
cout
<<
"SampleRate: "
<<
oClientParams
.
dSampleRate
<<
std
::
endl
;
std
::
cout
<<
"Blockgroesse: "
<<
oClientParams
.
iBlockSize
<<
std
::
endl
;
}
m_pMessage
->
SetAnswerType
(
CITANetAudioProtocol
::
NP_SERVER_OPEN
);
m_pMessage
->
WriteBool
(
bOK
);
...
...
@@ -117,13 +122,11 @@ bool CITANetAudioStreamingServer::LoopBody()
case
CITANetAudioProtocol
::
NP_CLIENT_WAITING_FOR_SAMPLES
:
{
int
iFreeSamples
=
m_pMessage
->
ReadInt
();
// std::cout << "Freie Samples: " << iFreeSamples << std::endl;
// std::cout << "Laenge InputStram: " << m_pInputStream->GetBlocklength() << std::endl;
if
(
iFreeSamples
>=
m_pInputStream
->
GetBlocklength
()
)
{
if
(
iFreeSamples
<
m_pInputStream
->
GetBlocklength
())
{
// zurueckmelden und warten auf exeption
break
;
}
// Send Samples
for
(
int
i
=
0
;
i
<
m_pInputStream
->
GetNumberOfChannels
();
i
++
)
{
ITAStreamInfo
oStreamInfo
;
...
...
@@ -131,18 +134,21 @@ bool CITANetAudioStreamingServer::LoopBody()
m_sfTempTransmitBuffer
[
i
].
write
(
pfData
,
m_pInputStream
->
GetBlocklength
()
);
}
m_pMessage
->
SetAnswerType
(
CITANetAudioProtocol
::
NP_SERVER_SEND_SAMPLES
);
//
m_pMessage->WriteSampleFrame( &m_sfTempTransmitBuffer );
m_pMessage
->
WriteSampleFrame
(
&
m_sfTempTransmitBuffer
);
}
else
{
// Waiting for Trigger
m_pMessage
->
SetAnswerType
(
CITANetAudioProtocol
::
NP_SERVER_WAITING_FOR_TRIGGER
);
m_pMessage
->
WriteAnswer
();
break
;
}
m_pMessage
->
WriteAnswer
();
m_pInputStream
->
IncrementBlockPointer
();
float
fTimeOut
=
m_pInputStream
->
GetBlocklength
()
/
m_pInputStream
->
GetSampleRate
();
//VistaTimeUtils::Sleep( (int) (
fTimeOut * 10
00 ) );
//VistaTimeUtils::Sleep( (int) (
1 * 1
00 ) );
break
;
}
case
CITANetAudioProtocol
::
NP_CLIENT_CLOSE
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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