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
c5561a1d
Commit
c5561a1d
authored
Mar 27, 2017
by
Jonas Stienen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleaning up NetAudio server test
parent
6b4bb1b0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
22 deletions
+40
-22
tests/NetAudio/ITANetAudioStreamingServerTest.cpp
tests/NetAudio/ITANetAudioStreamingServerTest.cpp
+40
-22
No files found.
tests/NetAudio/ITANetAudioStreamingServerTest.cpp
View file @
c5561a1d
...
...
@@ -10,38 +10,56 @@
using
namespace
std
;
int
main
(
int
argc
,
char
**
argv
)
string
g_sServerName
=
"localhost"
;
int
g_iServerPort
=
12480
;
double
g_dSampleRate
=
44100.0
;
int
g_iBlockLength
=
32
;
int
g_iChannels
=
2
;
int
g_iTargetLatencySamples
=
64
;
// 1.4512ms
double
g_dClientStatusMessageTimeout
=
0.1
;
// seconds
string
g_sFileName
=
"gershwin-mono.wav"
;
int
main
(
int
argc
,
char
**
argv
)
{
if
(
argc
!=
6
)
if
(
argc
>=
6
)
{
fprintf
(
stderr
,
"Fehler: Syntax = ServerName ServerPort SampleRate BufferSize Channel!
\n
"
);
g_sServerName
=
argv
[
1
];
g_iServerPort
=
atoi
(
argv
[
2
]
);
g_dSampleRate
=
strtod
(
argv
[
3
],
NULL
);
g_iBlockLength
=
atoi
(
argv
[
4
]
);
g_iChannels
=
atoi
(
argv
[
5
]
);
}
string
sServerName
=
argv
[
1
];
unsigned
int
iServerPort
=
atoi
(
argv
[
2
]);
double
dSampleRate
=
strtod
(
argv
[
3
],
NULL
);
int
iBlockLength
=
atoi
(
argv
[
4
]);
int
iChannels
=
atoi
(
argv
[
5
]);
ITADatasource
*
pSource
=
NULL
;
try
{
pSource
=
new
ITAFileDatasource
(
g_sFileName
,
g_iBlockLength
);
static_cast
<
ITAFileDatasource
*
>
(
pSource
)
->
SetIsLooping
(
true
);
cout
<<
"Found file "
<<
g_sFileName
<<
", will use it for playback."
<<
endl
;
}
catch
(
ITAException
&
)
{
cout
<<
"Could not find file "
<<
g_sFileName
<<
", will use sine signal instead."
<<
endl
;
pSource
=
new
ITAStreamFunctionGenerator
(
1
,
g_dSampleRate
,
g_iBlockLength
,
ITAStreamFunctionGenerator
::
SINE
,
250.0
f
,
0.7171
f
,
true
);
}
ITAFileDatasource
oFile
(
"gershwin-mono.wav"
,
iBlockLength
);
oFile
.
SetIsLooping
(
true
);
ITAStreamMultiplier1N
oMuliplier
(
&
oFile
,
iChannels
);
ITAStreamMultiplier1N
oMuliplier
(
pSource
,
g_iChannels
);
CITANetAudioStreamingServer
oStreamingServer
;
oStreamingServer
.
SetInputStream
(
&
oMuliplier
);
cout
<<
"Starting net audio server and waiting for connections on '"
<<
sServerName
<<
"' on port "
<<
iServerPort
<<
endl
;
oStreamingServer
.
Start
(
sServerName
,
iServerPort
,
0.1
);
cout
<<
"Starting net audio server and waiting for connections on '"
<<
g_sServerName
<<
"' on port "
<<
g_
iServerPort
<<
endl
;
oStreamingServer
.
Start
(
g_sServerName
,
g_iServerPort
,
g_dClientStatusMessageTimeout
);
while
(
!
oStreamingServer
.
IsClientConnected
())
{
VistaTimeUtils
::
Sleep
(
100
);
}
while
(
oStreamingServer
.
IsClientConnected
())
{
VistaTimeUtils
::
Sleep
(
100
);
}
while
(
!
oStreamingServer
.
IsClientConnected
()
)
VistaTimeUtils
::
Sleep
(
100
);
while
(
oStreamingServer
.
IsClientConnected
()
)
VistaTimeUtils
::
Sleep
(
100
);
VistaTimeUtils
::
Sleep
(
2000
);
VistaTimeUtils
::
Sleep
(
2000
)
;
delete
pSource
;
return
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