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
e44bc3f9
Commit
e44bc3f9
authored
Aug 19, 2016
by
Dipl.-Ing. Jonas Stienen
Browse files
Minor fixes in output format
parent
e94bfd93
Changes
1
Hide whitespace changes
Inline
Side-by-side
apps/ita_whad/main.cpp
View file @
e44bc3f9
...
...
@@ -26,12 +26,9 @@ int main( int argc, char* argv[] )
#endif // ITA_WHAD_WITH_PORTAUDIO
cout
<<
endl
;
stringstream
ss
;
#ifdef ITA_WHAD_WITH_ASIO
ss
.
clear
();
ss
<<
"[ASIO]"
<<
endl
<<
endl
;
stringstream
ssa
;
ITAsioInitializeLibrary
();
...
...
@@ -42,7 +39,7 @@ int main( int argc, char* argv[] )
for
(
long
i
=
0
;
i
<
lDrivers
;
i
++
)
{
ss
<<
"Driver identifier: "
<<
ITAsioGetDriverName
(
i
)
<<
endl
;
ss
a
<<
"Driver identifier: "
<<
ITAsioGetDriverName
(
i
)
<<
endl
;
try
{
ASIOError
e
=
ITAsioInitializeDriver
(
i
);
...
...
@@ -52,24 +49,24 @@ int main( int argc, char* argv[] )
long
lMinSize
,
lMaxSize
,
lPrefSize
,
g
;
ITAsioGetBufferSize
(
&
lMinSize
,
&
lMaxSize
,
&
lPrefSize
,
&
g
);
ss
<<
"Buffer sizes: "
<<
lMinSize
<<
" "
<<
lMaxSize
<<
" "
<<
lPrefSize
<<
" "
<<
g
<<
endl
;
ss
a
<<
"Buffer sizes: "
<<
lMinSize
<<
" "
<<
lMaxSize
<<
" "
<<
lPrefSize
<<
" "
<<
g
<<
endl
;
ASIOSampleRate
fs
;
ITAsioGetSampleRate
(
&
fs
);
ss
<<
"Samplerate: "
<<
fs
<<
endl
;
ss
a
<<
"Samplerate: "
<<
fs
<<
endl
;
long
in
,
out
;
ITAsioGetChannels
(
&
in
,
&
out
);
ss
<<
"Input channels: "
<<
in
<<
endl
;
ss
<<
"Output channels: "
<<
out
<<
endl
;
ss
a
<<
"Input channels: "
<<
in
<<
endl
;
ss
a
<<
"Output channels: "
<<
out
<<
endl
;
}
catch
(
const
ITAException
&
e
)
{
ss
<<
"### ERROR: "
<<
e
<<
endl
;
ss
a
<<
"### ERROR: "
<<
e
<<
endl
;
}
ss
<<
endl
;
ss
a
<<
endl
;
}
ITAsioFinalizeLibrary
();
...
...
@@ -77,7 +74,7 @@ int main( int argc, char* argv[] )
// Export
string
sFileNameASIO
=
"ita_whad_asio.txt"
;
FILE
*
file_asio
=
fopen
(
sFileNameASIO
.
c_str
(),
"w"
);
fwrite
(
ss
.
str
().
c_str
(),
sizeof
(
char
),
ss
.
str
().
length
(),
file_asio
);
fwrite
(
ss
a
.
str
().
c_str
(),
sizeof
(
char
),
ss
a
.
str
().
length
(),
file_asio
);
fwrite
(
"
\n
"
,
sizeof
(
char
),
1
,
file_asio
);
fclose
(
file_asio
);
cout
<<
"Exported information to file '"
<<
sFileNameASIO
<<
"'"
<<
endl
<<
endl
;
...
...
@@ -86,9 +83,8 @@ int main( int argc, char* argv[] )
#ifdef ITA_WHAD_WITH_PORTAUDIO
ss
.
clear
();
ss
<<
"[Portaudio]"
<<
endl
<<
endl
;
stringstream
ssp
;
ITAPortaudioInterface
oPortaudioFirst
(
44100.0
f
,
512
);
oPortaudioFirst
.
Initialize
();
int
iNumDevices
=
oPortaudioFirst
.
GetNumDevices
();
...
...
@@ -104,8 +100,10 @@ int main( int argc, char* argv[] )
oPortaudioFirst
.
GetDriverSampleRate
(
i
,
vdPreferredSampleRates
[
i
]
);
}
ss
<<
"Default input device: "
<<
oPortaudioFirst
.
GetDeviceName
(
oPortaudioFirst
.
GetDefaultInputDevice
()
)
<<
endl
;
ss
<<
"Default output device: "
<<
oPortaudioFirst
.
GetDeviceName
(
oPortaudioFirst
.
GetDefaultOutputDevice
()
)
<<
endl
;
ssp
<<
"Default input device: "
<<
oPortaudioFirst
.
GetDeviceName
(
oPortaudioFirst
.
GetDefaultInputDevice
()
)
<<
endl
;
ssp
<<
"Default output device: "
<<
oPortaudioFirst
.
GetDeviceName
(
oPortaudioFirst
.
GetDefaultOutputDevice
()
)
<<
endl
;
ssp
<<
endl
;
oPortaudioFirst
.
Finalize
();
...
...
@@ -121,26 +119,26 @@ int main( int argc, char* argv[] )
if
(
e
!=
ITAPortaudioInterface
::
ITA_PA_NO_ERROR
)
ITA_EXCEPT1
(
INVALID_PARAMETER
,
"Portaudio error: "
+
ITAPortaudioInterface
::
GetErrorCodeString
(
e
)
);
ss
<<
"Driver number: "
<<
i
+
1
<<
endl
;
ss
<<
"Driver identifier: "
<<
oPA
.
GetDeviceName
(
i
)
<<
endl
;
ss
p
<<
"Driver number: "
<<
i
+
1
<<
endl
;
ss
p
<<
"Driver identifier: "
<<
oPA
.
GetDeviceName
(
i
)
<<
endl
;
e
=
oPA
.
Open
();
if
(
e
!=
ITAPortaudioInterface
::
ITA_PA_NO_ERROR
)
ITA_EXCEPT1
(
INVALID_PARAMETER
,
"Portaudio error: "
+
ITAPortaudioInterface
::
GetErrorCodeString
(
e
)
);
ss
<<
"Latency: "
<<
oPA
.
GetDeviceLatency
(
i
)
<<
endl
;
ss
p
<<
"Latency: "
<<
oPA
.
GetDeviceLatency
(
i
)
<<
endl
;
double
dSampleRate
;
e
=
oPA
.
GetDriverSampleRate
(
i
,
dSampleRate
);
if
(
e
!=
ITAPortaudioInterface
::
ITA_PA_NO_ERROR
)
ITA_EXCEPT1
(
INVALID_PARAMETER
,
"Portaudio error: "
+
ITAPortaudioInterface
::
GetErrorCodeString
(
e
)
);
ss
<<
"Sample rate: "
<<
dSampleRate
<<
endl
;
ss
p
<<
"Sample rate: "
<<
dSampleRate
<<
endl
;
int
iIn
,
iOut
;
oPA
.
GetNumChannels
(
i
,
iIn
,
iOut
);
ss
<<
"Input channels: "
<<
iIn
<<
endl
;
ss
<<
"Output channels: "
<<
iOut
<<
endl
;
ss
p
<<
"Input channels: "
<<
iIn
<<
endl
;
ss
p
<<
"Output channels: "
<<
iOut
<<
endl
;
oPA
.
Close
();
oPA
.
Finalize
();
...
...
@@ -148,17 +146,17 @@ int main( int argc, char* argv[] )
}
catch
(
const
ITAException
&
e
)
{
ss
<<
"### ERROR: "
<<
e
<<
endl
;
ss
p
<<
"### ERROR: "
<<
e
<<
endl
;
}
ss
<<
endl
;
ss
p
<<
endl
;
}
// Export
string
sFileNamePortaudio
=
"ita_whad_portaudio.txt"
;
FILE
*
file_pa
=
fopen
(
sFileNamePortaudio
.
c_str
(),
"w"
);
fwrite
(
ss
.
str
().
c_str
(),
sizeof
(
char
),
ss
.
str
().
length
(),
file_pa
);
fwrite
(
ss
p
.
str
().
c_str
(),
sizeof
(
char
),
ss
p
.
str
().
length
(),
file_pa
);
fwrite
(
"
\n
"
,
sizeof
(
char
),
1
,
file_pa
);
fclose
(
file_pa
);
cout
<<
"Exported information to file '"
<<
sFileNamePortaudio
<<
"'"
<<
endl
<<
endl
;
...
...
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