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
df011b81
Commit
df011b81
authored
Apr 05, 2017
by
Dipl.-Ing. Jonas Stienen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implementing missing audio stream info on NetAudio server side
parent
37d22377
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
10 deletions
+38
-10
include/ITANetAudioSampleServer.h
include/ITANetAudioSampleServer.h
+27
-8
include/ITANetAudioStreamingServer.h
include/ITANetAudioStreamingServer.h
+3
-0
src/ITANetAudioStreamingServer.cpp
src/ITANetAudioStreamingServer.cpp
+8
-2
No files found.
include/ITANetAudioSampleServer.h
View file @
df011b81
...
...
@@ -31,16 +31,35 @@ public:
inline
CITASampleProcessor
(
const
double
dSampleRate
,
const
int
iNumChannels
,
const
int
iBlockLength
)
:
ITADatasourceRealization
(
(
unsigned
int
)
(
iNumChannels
),
dSampleRate
,
(
unsigned
int
)
(
iBlockLength
)
)
{
m_vvfSampleBuffer
.
resize
(
iNumChannels
);
for
(
size_t
c
=
0
;
c
<
iNumChannels
;
c
++
)
{
m_vvfSampleBuffer
.
push_back
(
std
::
vector
<
float
>
()
);
for
(
size_t
n
=
0
;
n
<
iBlockLength
;
n
++
)
m_vvfSampleBuffer
[
c
].
push_back
(
0.0
f
);
}
m_vvfSampleBuffer
[
c
].
resize
(
iBlockLength
);
Zero
();
};
inline
~
CITASampleProcessor
()
{};
//! Sets all channels and samples to zero
inline
void
Zero
()
{
/*
* Use this as an example how to work with the buffer structure.
*/
// Iterate over channels
for
(
size_t
c
=
0
;
c
<
m_vvfSampleBuffer
.
size
();
c
++
)
{
std
::
vector
<
float
>&
vfSingleChannelSampleBuffer
(
m_vvfSampleBuffer
[
c
]
);
// One channel
// Iterate over samples of channel
for
(
size_t
n
=
0
;
n
<
vfSingleChannelSampleBuffer
.
size
();
n
++
)
{
float
&
fSample
(
vfSingleChannelSampleBuffer
[
n
]
);
// One sample
fSample
=
0.0
f
;
// -> Manipulation
}
}
};
//! Process samples (overwrite this virtual method)
/**
* Method that is called in audio streaming context and requests
...
...
@@ -51,9 +70,9 @@ public:
virtual
void
Process
(
const
ITAStreamInfo
*
pStreamInfo
)
=
0
;
protected:
std
::
vector
<
std
::
vector
<
float
>
>
m_vvfSampleBuffer
;
//!< Multi-channel sample buffer
std
::
vector
<
std
::
vector
<
float
>
>
m_vvfSampleBuffer
;
//!< Multi-channel sample buffer
to be filled
p
ublic
:
p
rivate
:
//! Delegate internal buffer to audio stream
inline
void
ProcessStream
(
const
ITAStreamInfo
*
pInfo
)
{
...
...
include/ITANetAudioStreamingServer.h
View file @
df011b81
...
...
@@ -115,6 +115,9 @@ private:
int
m_iSendingBlockLength
;
int
m_iMaxSendBlocks
;
double
m_dStreamTimeStart
;
//!< Stream time start
long
unsigned
int
m_nStreamSampleCounts
;
//!< Samples that has been streamed
friend
class
CITANetAudioServer
;
};
...
...
src/ITANetAudioStreamingServer.cpp
View file @
df011b81
...
...
@@ -71,6 +71,8 @@ CITANetAudioStreamingServer::CITANetAudioStreamingServer()
,
m_iEstimatedClientRingBufferFreeSamples
(
0
)
,
m_iClientRingBufferSize
(
0
)
,
m_dEstimatedCorrFactor
(
1
)
,
m_dStreamTimeStart
(
0.0
f
)
,
m_nStreamSampleCounts
(
0
)
{
// Careful with this:
//SetPriority( VistaPriority::VISTA_MID_PRIORITY );
...
...
@@ -160,6 +162,9 @@ bool CITANetAudioStreamingServer::LoopBody()
{
const
double
dNow
=
ITAClock
::
getDefaultClock
()
->
getTime
();
if
(
m_dStreamTimeStart
==
0.0
f
)
m_dStreamTimeStart
=
dNow
;
CITAServerLog
oLog
;
oLog
.
dWorldTimeStamp
=
dNow
;
oLog
.
uiBlockId
=
++
m_iServerBlockId
;
...
...
@@ -182,10 +187,11 @@ bool CITANetAudioStreamingServer::LoopBody()
for
(
int
i
=
0
;
i
<
int
(
m_pInputStream
->
GetNumberOfChannels
()
);
i
++
)
{
ITAStreamInfo
oStreamInfo
;
oStreamInfo
.
nSamples
=
m_iSendingBlockLength
;
oStreamInfo
.
nSamples
=
(
m_nStreamSampleCounts
+=
m_iSendingBlockLength
);
oStreamInfo
.
dTimecode
=
dNow
-
m_dStreamTimeStart
;
const
float
*
pfData
=
m_pInputStream
->
GetBlockPointer
(
i
,
&
oStreamInfo
);
if
(
pfData
!=
0
)
if
(
pfData
!=
nullptr
)
m_sfTempTransmitBuffer
[
i
].
write
(
pfData
,
m_iSendingBlockLength
,
0
);
}
...
...
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