Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ITADataSources
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Institute of Technical Acoustics (ITA)
ITADataSources
Commits
c5561a1d
Commit
c5561a1d
authored
8 years ago
by
Jonas Stienen
Browse files
Options
Downloads
Patches
Plain Diff
Cleaning up NetAudio server test
parent
6b4bb1b0
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/NetAudio/ITANetAudioStreamingServerTest.cpp
+40
-22
40 additions, 22 deletions
tests/NetAudio/ITANetAudioStreamingServerTest.cpp
with
40 additions
and
22 deletions
tests/NetAudio/ITANetAudioStreamingServerTest.cpp
+
40
−
22
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
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment