Skip to content
GitLab
Menu
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
30d6a427
Commit
30d6a427
authored
Aug 07, 2017
by
Dipl.-Ing. Jonas Stienen
Browse files
Adding ASIO tests (without data sources)
parent
e5d15d59
Changes
2
Hide whitespace changes
Inline
Side-by-side
tests/AsioTests/AsioTest.cpp
0 → 100644
View file @
30d6a427
#include
<cassert>
#include
<conio.h>
#include
<iostream>
#include
<string>
#include
<host/asiodrivers.h>
#include
"common/asio.h"
using
namespace
std
;
ASIOCallbacks
oAsioCallback
;
void
AsioBufferSwitch
(
long
index
,
ASIOBool
processNow
)
{
ASIOTime
timeInfo
;
memset
(
&
timeInfo
,
0
,
sizeof
(
timeInfo
)
);
if
(
ASIOGetSamplePosition
(
&
timeInfo
.
timeInfo
.
samplePosition
,
&
timeInfo
.
timeInfo
.
systemTime
)
==
ASE_OK
)
timeInfo
.
timeInfo
.
flags
=
kSystemTimeValid
|
kSamplePositionValid
;
bufferSwitchTimeInfo
(
&
timeInfo
,
index
,
processNow
);
};
void
AsioSampleRateChanged
(
ASIOSampleRate
)
{};
long
AsioMessages
(
long
selector
,
long
value
,
void
*
,
double
*
)
{
return
0
;
};
ASIOTime
*
AsioBufferSwitchTimeInfo
(
ASIOTime
*
timeInfo
,
long
index
,
ASIOBool
processNow
)
{
for
(
int
i
=
0
;
i
<
oAsioDriverInfo
.
inputBuffers
+
asioDriverInfo
.
outputBuffers
;
i
++
)
{
if
(
asioDriverInfo
.
bufferInfos
[
i
].
isInput
==
TRUE
)
{
assert
(
asioDriverInfo
.
channelInfos
[
i
].
type
==
ASIOSTInt24LSB
);
}
}
};
int
main
(
int
argc
,
char
*
argv
[]
)
{
AsioDriverList
*
pDrivers
=
new
AsioDrivers
();
oAsioCallback
.
bufferSwitch
=
&
AsioBufferSwitch
;
oAsioCallback
.
sampleRateDidChange
=
&
AsioSampleRateChanged
;
oAsioCallback
.
asioMessage
=
&
AsioMessages
;
oAsioCallback
.
bufferSwitchTimeInfo
=
&
AsioBufferSwitchTimeInfo
;
long
lNumDrivers
=
pDrivers
->
asioGetNumDev
();
if
(
lNumDrivers
>
0
)
{
cout
<<
"Found ASIO drivers:"
<<
endl
<<
endl
;
std
::
string
sDriverName
;
sDriverName
.
reserve
(
255
);
for
(
long
i
=
0
;
i
<
lNumDrivers
;
i
++
)
{
pDrivers
->
asioGetDriverName
(
i
,
&
sDriverName
[
0
],
255
);
cout
<<
"["
<<
i
+
1
<<
"]
\"
"
<<
sDriverName
<<
"
\"
"
<<
endl
;
}
}
else
cout
<<
"No ASIO driver found"
<<
endl
;
return
0
;
}
tests/CMakeLists.txt
View file @
30d6a427
...
...
@@ -117,6 +117,7 @@ set_property( TARGET StreamProbeTest PROPERTY FOLDER "ITACoreLibs/Tests/ITADataS
# tests
if
(
ITA_DATA_SOURCES_WITH_INTEGRATED_ASIO
)
add_subdirectory
(
ITAAsioTests
)
add_subdirectory
(
AsioTests
)
endif
(
ITA_DATA_SOURCES_WITH_INTEGRATED_ASIO
)
if
(
ITA_DATA_SOURCES_WITH_INTEGRATED_PORTAUDIO
)
...
...
Write
Preview
Supports
Markdown
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