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
GitLab 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
2c93e2de
Commit
2c93e2de
authored
7 years ago
by
Dipl.-Ing. Jonas Stienen
Browse files
Options
Downloads
Patches
Plain Diff
Progress on ASIO test
parent
2c7869ea
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/AsioTests/AsioTest.cpp
+0
-71
0 additions, 71 deletions
tests/AsioTests/AsioTest.cpp
tests/AsioTests/NativeAsioSingleInstanceTest.cpp
+153
-0
153 additions, 0 deletions
tests/AsioTests/NativeAsioSingleInstanceTest.cpp
with
153 additions
and
71 deletions
tests/AsioTests/AsioTest.cpp
deleted
100644 → 0
+
0
−
71
View file @
2c7869ea
#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
;
// @todo:
//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
)
{
// @todo:
/*
for( int i = 0; i < oAsioDriverInfo.inputBuffers + asioDriverInfo.outputBuffers; i++ )
{
if( asioDriverInfo.bufferInfos[ i ].isInput == TRUE )
{
assert( asioDriverInfo.channelInfos[ i ].type == ASIOSTInt24LSB );
}
}
*/
return
nullptr
;
};
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
;
}
This diff is collapsed.
Click to expand it.
tests/AsioTests/NativeAsioSingleInstanceTest.cpp
0 → 100644
+
153
−
0
View file @
2c93e2de
#include
<cassert>
#include
<conio.h>
#include
<iostream>
#include
<string>
#include
<vector>
#include
<algorithm>
#include
<host/asiodrivers.h>
#include
<common/asio.h>
#include
<VistaBase/VistaTimeUtils.h>
using
namespace
std
;
ASIOCallbacks
oAsioCallback
;
ASIODriverInfo
oAsioDriverInfo
;
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 );
}
}
*/
return
timeInfo
;
};
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
;
AsioBufferSwitchTimeInfo
(
&
timeInfo
,
index
,
processNow
);
};
void
AsioSampleRateChanged
(
ASIOSampleRate
fs
)
{
cout
<<
"Sample rate changed to "
<<
fs
<<
endl
;
return
;
};
long
AsioMessages
(
long
selector
,
long
value
,
void
*
,
double
*
)
{
return
0
;
};
int
main
(
int
argc
,
char
*
argv
[]
)
{
ASIOError
ae
;
AsioDriverList
*
pDrivers
=
new
AsioDriverList
();
long
nNumDrivers
=
pDrivers
->
asioGetNumDev
();
cout
<<
"Number of ASIO drivers: "
<<
nNumDrivers
<<
endl
;
delete
pDrivers
;
for
(
int
i
=
0
;
i
<
nNumDrivers
;
i
++
)
{
AsioDrivers
*
pDriver
=
new
AsioDrivers
();
string
sDriverName
;
sDriverName
.
resize
(
256
);
pDriver
->
asioGetDriverName
(
i
,
&
sDriverName
[
0
],
sDriverName
.
size
()
);
sDriverName
=
std
::
string
(
sDriverName
.
c_str
()
);
// Strip
cout
<<
"Driver name: "
<<
sDriverName
<<
"."
<<
endl
;
bool
bLoadSuccess
=
pDriver
->
loadDriver
(
&
sDriverName
[
0
]
);
if
(
bLoadSuccess
)
{
string
sDriverPath
;
sDriverPath
.
resize
(
256
);
pDriver
->
asioGetDriverPath
(
i
,
&
sDriverPath
[
0
],
sDriverPath
.
size
()
);
sDriverPath
=
std
::
string
(
sDriverPath
.
c_str
()
);
// Strip
cout
<<
"Driver path: "
<<
sDriverPath
<<
endl
;
cout
<<
"Current driver index: "
<<
pDriver
->
getCurrentDriverIndex
()
<<
endl
;
string
sCurrentDriverName
;
sCurrentDriverName
.
resize
(
256
);
pDriver
->
getCurrentDriverName
(
&
sCurrentDriverName
[
0
]
);
sCurrentDriverName
=
std
::
string
(
sCurrentDriverName
.
c_str
()
);
// Strip
cout
<<
"Current driver name: "
<<
sCurrentDriverName
<<
endl
;
ASIODriverInfo
oDriverInfo
;
oDriverInfo
.
asioVersion
=
2
;
if
(
ASIOInit
(
&
oDriverInfo
)
!=
ASE_OK
)
{
cout
<<
"Could not initialize "
<<
sCurrentDriverName
<<
", skipping."
<<
endl
;
continue
;
}
ASIOCallbacks
oAsioCallback
;
oAsioCallback
.
asioMessage
=
&
AsioMessages
;
oAsioCallback
.
bufferSwitch
=
&
AsioBufferSwitch
;
oAsioCallback
.
bufferSwitchTimeInfo
=
&
AsioBufferSwitchTimeInfo
;
oAsioCallback
.
sampleRateDidChange
=
&
AsioSampleRateChanged
;
vector
<
ASIOBufferInfo
>
voBufferInfos
(
4
);
voBufferInfos
[
0
].
buffers
;
voBufferInfos
[
0
].
channelNum
=
0
;
voBufferInfos
[
0
].
isInput
=
ASIOTrue
;
voBufferInfos
[
1
].
buffers
;
voBufferInfos
[
1
].
channelNum
=
1
;
voBufferInfos
[
1
].
isInput
=
ASIOTrue
;
voBufferInfos
[
2
].
buffers
;
voBufferInfos
[
2
].
channelNum
=
0
;
voBufferInfos
[
2
].
isInput
=
ASIOFalse
;
voBufferInfos
[
3
].
buffers
;
voBufferInfos
[
3
].
channelNum
=
1
;
voBufferInfos
[
3
].
isInput
=
ASIOFalse
;
ASIOSampleRate
fs
;
if
(
ASIOGetSampleRate
(
&
fs
)
==
ASE_NotPresent
)
continue
;
long
minSize
,
maxSize
,
preferredSize
,
granularity
;
ASIOError
aeResult
=
ASIOGetBufferSize
(
&
minSize
,
&
maxSize
,
&
preferredSize
,
&
granularity
);
preferredSize
=
(
preferredSize
==
0
?
min
(
1024
,
maxSize
)
:
preferredSize
);
ae
=
ASIOCreateBuffers
(
&
voBufferInfos
.
front
(),
4
,
preferredSize
,
&
oAsioCallback
);
assert
(
ae
==
ASE_OK
);
ae
=
ASIOStart
();
assert
(
ae
==
ASE_OK
);
VistaTimeUtils
::
Sleep
(
2e3
);
ae
=
ASIOStop
();
assert
(
ae
==
ASE_OK
);
}
pDriver
->
removeCurrentDriver
();
delete
pDriver
;
}
oAsioCallback
.
bufferSwitch
=
&
AsioBufferSwitch
;
oAsioCallback
.
sampleRateDidChange
=
&
AsioSampleRateChanged
;
oAsioCallback
.
asioMessage
=
&
AsioMessages
;
oAsioCallback
.
bufferSwitchTimeInfo
=
&
AsioBufferSwitchTimeInfo
;
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