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)
VACore
Commits
49568aca
Commit
49568aca
authored
Apr 12, 2017
by
Jonas Stienen
Browse files
Style
parent
a6f140eb
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
src/Drivers/Audio/VAASIOBackend.cpp
View file @
49568aca
...
...
@@ -46,8 +46,7 @@ const ITAStreamProperties* CVAASIOBackend::getOutputStreamProperties() const
return
&
m_oOutputStreamProps
;
}
ITADatasource
*
CVAASIOBackend
::
getInputStreamDatasource
()
const
{
ITADatasource
*
CVAASIOBackend
::
getInputStreamDatasource
()
const
{
return
ITAsioGetRecordDatasource
();
}
...
...
@@ -104,8 +103,7 @@ void CVAASIOBackend::threadInitialize()
std
::
string
(
"
\"
does not support the desired sampling rate"
)
);
// Buffergre automatisch bestimmen, falls nicht vorgegeben
if
(
m_pConfig
->
iBuffersize
==
CVAAudioDriverConfig
::
AUTO
)
{
if
(
m_pConfig
->
iBuffersize
==
CVAAudioDriverConfig
::
AUTO
)
{
long
lMin
,
lMax
,
lPref
,
lGran
;
if
(
(
ae
=
ITAsioGetBufferSize
(
&
lMin
,
&
lMax
,
&
lPref
,
&
lGran
)
)
!=
ASE_OK
)
ITA_EXCEPT1
(
INVALID_PARAMETER
,
...
...
@@ -121,8 +119,12 @@ void CVAASIOBackend::threadInitialize()
m_pConfig
->
iBuffersize
=
lPref
;
}
if
(
(
ae
=
ITAsioCreateBuffers
(
m_pConfig
->
iInputChannels
,
m_pConfig
->
iOutputChannels
,
m_pConfig
->
iBuffersize
)
)
!=
ASE_OK
)
ITA_EXCEPT1
(
INVALID_PARAMETER
,
std
::
string
(
"Failed to setup the ASIO driver
\"
"
)
+
m_pConfig
->
sDevice
+
std
::
string
(
"
\"
. "
)
+
ITAsioGetErrorStr
(
ae
)
+
std
::
string
(
" (ASIO Errorcode "
)
+
IntToString
(
ae
)
+
std
::
string
(
")"
)
);
if
(
(
ae
=
ITAsioCreateBuffers
(
m_pConfig
->
iInputChannels
,
m_pConfig
->
iOutputChannels
,
m_pConfig
->
iBuffersize
)
)
!=
ASE_OK
)
ITA_EXCEPT1
(
INVALID_PARAMETER
,
std
::
string
(
"Failed to setup the ASIO driver
\"
"
)
+
m_pConfig
->
sDevice
+
std
::
string
(
"
\"
. "
)
+
ITAsioGetErrorStr
(
ae
)
+
std
::
string
(
" (ASIO Errorcode "
)
+
IntToString
(
ae
)
+
std
::
string
(
")"
)
);
m_oOutputStreamProps
.
dSamplerate
=
m_pConfig
->
dSampleRate
;
m_oOutputStreamProps
.
uiChannels
=
(
unsigned
int
)
m_pConfig
->
iOutputChannels
;
...
...
@@ -138,14 +140,12 @@ void CVAASIOBackend::finalize()
#endif // USE_MEDIATOR_THREAD
}
void
CVAASIOBackend
::
threadFinalize
()
{
void
CVAASIOBackend
::
threadFinalize
()
{
// Rumt alles automatisch ab
ITAsioFinalizeLibrary
();
}
bool
CVAASIOBackend
::
isStreaming
()
{
bool
CVAASIOBackend
::
isStreaming
()
{
return
m_bStreaming
;
}
...
...
@@ -161,12 +161,10 @@ void CVAASIOBackend::startStreaming()
#endif // USE_MEDIATOR_THREAD
}
void
CVAASIOBackend
::
threadStartStreaming
()
{
void
CVAASIOBackend
::
threadStartStreaming
()
{
ASIOError
ae
;
if
(
(
ae
=
ITAsioStart
()
)
!=
ASE_OK
)
{
if
(
(
ae
=
ITAsioStart
()
)
!=
ASE_OK
)
{
// [fwe] Streaming-Flag lschen
m_bStreaming
=
false
;
...
...
@@ -188,8 +186,7 @@ void CVAASIOBackend::stopStreaming()
m_bStreaming
=
true
;
}
void
CVAASIOBackend
::
threadStopStreaming
()
{
void
CVAASIOBackend
::
threadStopStreaming
()
{
/*
* Wenn das Stoppen nicht klappt...
* Dann geht die Welt unter...
...
...
@@ -211,15 +208,13 @@ CVAASIOBackend::MediatorThread::MediatorThread( CVAASIOBackend* pParent )
Run
();
}
CVAASIOBackend
::
MediatorThread
::~
MediatorThread
()
{
CVAASIOBackend
::
MediatorThread
::~
MediatorThread
()
{
m_iOperation
=
OPERATION_STOP_THREAD
;
m_evStart
.
SignalEvent
();
StopGently
(
true
);
}
int
CVAASIOBackend
::
MediatorThread
::
doOperation
(
int
iOperation
)
{
int
CVAASIOBackend
::
MediatorThread
::
doOperation
(
int
iOperation
)
{
m_iOperation
=
iOperation
;
m_evStart
.
SignalEvent
();
m_evFinish
.
WaitForEvent
(
true
);
...
...
@@ -233,33 +228,27 @@ int CVAASIOBackend::MediatorThread::doOperation( int iOperation )
return
0
;
}
int
CVAASIOBackend
::
MediatorThread
::
doInitialize
()
{
int
CVAASIOBackend
::
MediatorThread
::
doInitialize
()
{
return
doOperation
(
OPERATION_INITIALIZE
);
}
int
CVAASIOBackend
::
MediatorThread
::
doFinalize
()
{
int
CVAASIOBackend
::
MediatorThread
::
doFinalize
()
{
return
doOperation
(
OPERATION_FINALIZE
);
}
int
CVAASIOBackend
::
MediatorThread
::
doStartStreaming
()
{
int
CVAASIOBackend
::
MediatorThread
::
doStartStreaming
()
{
return
doOperation
(
OPERATION_START_STREAMING
);
}
int
CVAASIOBackend
::
MediatorThread
::
doStopStreaming
()
{
int
CVAASIOBackend
::
MediatorThread
::
doStopStreaming
()
{
return
doOperation
(
OPERATION_STOP_STREAMING
);
}
ITAException
CVAASIOBackend
::
MediatorThread
::
getException
()
const
{
ITAException
CVAASIOBackend
::
MediatorThread
::
getException
()
const
{
return
m_oException
;
}
bool
CVAASIOBackend
::
MediatorThread
::
LoopBody
()
{
bool
CVAASIOBackend
::
MediatorThread
::
LoopBody
()
{
m_evStart
.
WaitForEvent
(
true
);
if
(
m_iOperation
==
OPERATION_STOP_THREAD
)
{
IndicateLoopEnd
();
...
...
@@ -271,8 +260,7 @@ bool CVAASIOBackend::MediatorThread::LoopBody()
m_iResult
=
0
;
try
{
switch
(
m_iOperation
)
{
switch
(
m_iOperation
)
{
case
OPERATION_INITIALIZE
:
m_pParent
->
threadInitialize
();
break
;
...
...
@@ -291,13 +279,11 @@ bool CVAASIOBackend::MediatorThread::LoopBody()
}
}
catch
(
ITAException
&
e
)
{
catch
(
ITAException
&
e
)
{
m_iResult
=
-
1
;
m_oException
=
e
;
}
catch
(
...
)
{
catch
(
...
)
{
// Hier sollte nie etwas ankommen...
assert
(
false
);
}
...
...
src/Drivers/Audio/VAASIOBackend.h
View file @
49568aca
...
...
@@ -22,7 +22,7 @@ public:
* Ldt die Konfigurationsdatei "ASIO.ini" und liest diese ein.
* Initialisiert den Treiber aber noch nicht. Dazu gibt es "initialize".
*/
CVAASIOBackend
(
CVAAudioDriverConfig
*
pConfig
);
CVAASIOBackend
(
CVAAudioDriverConfig
*
pConfig
);
~
CVAASIOBackend
();
std
::
string
getDriverName
()
const
;
...
...
@@ -30,14 +30,14 @@ public:
int
getNumberOfInputs
()
const
;
const
ITAStreamProperties
*
getOutputStreamProperties
()
const
;
ITADatasource
*
getInputStreamDatasource
()
const
;
void
setOutputStreamDatasource
(
ITADatasource
*
pDatasource
);
void
setOutputStreamDatasource
(
ITADatasource
*
pDatasource
);
void
initialize
();
void
finalize
();
bool
isStreaming
();
void
startStreaming
();
void
stopStreaming
();
// Threaded-entkoppelte Methoden
void
threadInitialize
();
void
threadFinalize
();
...
...
@@ -46,24 +46,24 @@ public:
private:
/*
* Thread-unabhngiges Initialisieren von ASIO ist nur mit einem
* Thread-unabhngiges Initialisieren von ASIO ist nur mit einem
* Vermittler-Thread ntig, da ASIO COM benutzt und der erste
* Thread der ASIO-Initialisiert, der jenige ist der es Bedient.
*
*
* Dieser Vermittler arbeitet Thread-entkoppelt
* Die Methoden sind aber blocking
*/
class
MediatorThread
:
public
VistaThreadLoop
{
public:
MediatorThread
(
CVAASIOBackend
*
pParent
);
MediatorThread
(
CVAASIOBackend
*
pParent
);
~
MediatorThread
();
int
doInitialize
();
int
doFinalize
();
int
doStartStreaming
();
int
doStopStreaming
();
ITAException
getException
()
const
;
private:
...
...
@@ -83,7 +83,7 @@ private:
VistaThreadEvent
m_evStart
;
VistaThreadEvent
m_evFinish
;
int
doOperation
(
int
iOperation
);
int
doOperation
(
int
iOperation
);
// --= Redefinition der Methoden in VistaThreadLoop =--
...
...
src/Drivers/Audio/VAAudioDriverBackend.h
View file @
49568aca
#ifndef
IW
_VA_AUDIO
_
DRIVER
_
BACKEND
#define
IW
_VA_AUDIO
_
DRIVER
_
BACKEND
#ifndef
_
_VA_AUDIODRIVERBACKEND
_H__
#define
_
_VA_AUDIODRIVERBACKEND
_H__
// Includes
#include <string>
// Vorwärtsdeklarationen
class
ITAStreamProperties
;
class
ITADatasource
;
//! VA audio driver backend
/**
* This purely abstract class defines the interfaces for using different audio architectures as backends, e.g. ASIO, Portaudio, etc.
*
* Every backend
*
* - receives and provides a static number of channels
* - output is connected with a audio data source
* - input feeds are created for each channel as a mono input signal and are directly available in the core
* - errors are raising CVAExceptions
*/
class
IVAAudioDriverBackend
{
* Diese rein abstrakte Klasse definiert für Virtual Acoustics die Schnittstelle
* zur Benutzung verschiedener Audiotreiber-Architekturen (ASIO, DirectSound, ALSA, JACK, ...).
*
* Jedes Backend:
*
* - Stellt gibt Daten auf einer festen Anzahl Ausgabekanäle wieder
* - Kann eine feste Anzahl Eingabekanäle bereitstellen
*
* - Die Ausgabekanäle werden aus einer Datenquelle gespeist
* - Die Eingabekanäle werden als Mono-Datenquellen vom Back bereitgestellt
*
* 'Fest' bedeutet in diesem Kontext, das sich die Parameter nicht mehr zur Laufzeit ändern.
* Diese Parameter werden üblicherweise aus einer Konfigurationsdatei eingelesen.
*
* - Alle Fehler werden mittels VAExceptions behandelt.
* - Nebenläufigkeit: Keine! Alle Funktionen seriell. Keine Parallel.
*/
class
IVAAudioDriverBackend
{
public:
inline
virtual
~
IVAAudioDriverBackend
()
{};
virtual
~
IVAAudioDriverBackend
()
{};
//! Namen des Treiber-Architektur zurückgeben (z.B. "ASIO")
virtual
std
::
string
getDriverName
()
const
=
0
;
virtual
std
::
string
getDriverName
()
const
=
0
;
//! Namen der gewählten Audio-Gerätes zurückgeben (z.B. "RME Hammerfall DSP")
virtual
std
::
string
getDeviceName
()
const
=
0
;
virtual
std
::
string
getDeviceName
()
const
=
0
;
//! Anzahl der Eingänge (Mono) zurückgeben
virtual
int
getNumberOfInputs
()
const
=
0
;
virtual
int
getNumberOfInputs
()
const
=
0
;
//! Eigenschaften (Anzahl Ausgabekanäle, Abtastrate, Blocklänge) des Ausgabe-Streams zurückgeben
virtual
const
ITAStreamProperties
*
getOutputStreamProperties
()
const
=
0
;
virtual
const
ITAStreamProperties
*
getOutputStreamProperties
()
const
=
0
;
//! Datenquelle für die Eingabe zurückgeben
virtual
ITADatasource
*
getInputStreamDatasource
()
const
=
0
;
virtual
ITADatasource
*
getInputStreamDatasource
()
const
=
0
;
//! Datenquelle für die Ausgabe setzen
virtual
void
setOutputStreamDatasource
(
ITADatasource
*
pDatasource
)
=
0
;
virtual
void
setOutputStreamDatasource
(
ITADatasource
*
pDatasource
)
=
0
;
//! Backend initialisieren (bereitmachen für das Streaming)
virtual
void
initialize
()
=
0
;
virtual
void
initialize
()
=
0
;
//! Backend freigeben
virtual
void
finalize
()
=
0
;
virtual
void
finalize
()
=
0
;
//! Gibt zurück, ob das Streaming gestartet ist
virtual
bool
isStreaming
()
=
0
;
virtual
bool
isStreaming
()
=
0
;
//! Audio-Streaming starten
virtual
void
startStreaming
()
=
0
;
virtual
void
startStreaming
()
=
0
;
//! Audio-Streaming starten
/**
* Wichtig: Diese Methode kommt erst zurück wenn keine Calls mehr auf die Datenquelle gehen.
*/
virtual
void
stopStreaming
()
=
0
;
/* Only via config
//! Sets the panic watch dog for processing time problems (causing dropouts on live audioi output stream)
virtual void SetPanicWarningEnabled( const bool bEnabled ) = 0;
//! Enable/disable software limiter based on RMS value per block (consumes CPU power in audio processing thread)
virtual void SetSoftwareLimiterEnabled( const bool bEnabled ) = 0;
//! Set software limiter threshold as factor of block-wise RMS value (default: 1.0f)
virtual void SetSoftwareLimiterThreshold( const double dRMSFactorNotToBeExceeded ) = 0;
*/
virtual
void
stopStreaming
()
=
0
;
};
#endif // IW_VA_AUDIO_DRIVER_BACKEND
\ No newline at end of file
#endif // __VA_AUDIODRIVERBACKEND_H__
\ No newline at end of file
src/Drivers/Audio/VAAudioDriverConfig.cpp
View file @
49568aca
...
...
@@ -14,7 +14,7 @@ CVAAudioDriverConfig::~CVAAudioDriverConfig()
{
}
void
CVAAudioDriverConfig
::
I
nit
(
const
CVAStruct
&
oArgs
)
void
CVAAudioDriverConfig
::
i
nit
(
const
CVAStruct
&
oArgs
)
{
CVALiterals
<
int
>
lits
;
lits
.
Add
(
"AUTO"
,
AUTO
);
...
...
@@ -27,11 +27,6 @@ void CVAAudioDriverConfig::Init( const CVAStruct& oArgs )
conf
.
OptInteger
(
"InputChannels"
,
iInputChannels
,
AUTO
,
&
lits
);
conf
.
OptInteger
(
"OutputChannels"
,
iOutputChannels
,
AUTO
,
&
lits
);
conf
.
OptBool
(
"SoftwareOutputLimiterEnabled"
,
bSoftwareOutputLimiterEnabled
,
false
);
conf
.
OptNumber
(
"SoftwareOutputLimiterRMSFactor"
,
dSoftwareOutputLimiterRMSFactor
,
1.0
f
);
conf
.
OptBool
(
"ProcessingPanicWarningEnabled"
,
bProcessingPanicWarningEnabled
,
true
);
// Parameter prfen
if
(
dSampleRate
<=
0
)
VA_EXCEPT1
(
"Invalid samplerate specified"
);
...
...
@@ -42,8 +37,7 @@ void CVAAudioDriverConfig::Init( const CVAStruct& oArgs )
if
(
(
iInputChannels
<
0
)
&&
(
iInputChannels
!=
AUTO
)
)
VA_EXCEPT1
(
"Invalid number of input channels specified"
);
// @todo
jst
: really?! I don't see a point why single channel output shouldn't be supported
, though number of actual applications might be low
// @todo: really?! I don't see a point why single channel output shouldn't be supported
.
if
(
(
iOutputChannels
<
2
)
&&
(
iOutputChannels
!=
AUTO
)
)
VA_EXCEPT1
(
"Invalid number of output channels specified (at least two)"
);
}
src/Drivers/Audio/VAAudioDriverConfig.h
View file @
49568aca
...
...
@@ -8,9 +8,9 @@
//! Audio driver configuration for backends
/**
* Diese Datenklasse speichert die Parameter fr das Audio-Streaming in VA.
* Dies schliet ein: Die Treiber-Architektur, das Audio-Gert, usw.
*/
* Diese Datenklasse speichert die Parameter fr das Audio-Streaming in VA.
* Dies schliet ein: Die Treiber-Architektur, das Audio-Gert, usw.
*/
class
CVAAudioDriverConfig
{
public:
...
...
@@ -22,16 +22,13 @@ public:
double
dSampleRate
;
// Abtastrate [Hz]
int
iBuffersize
;
// Streaming-Puffergre [Anzahl Samples] (0 => automatisch bestimmen)
int
iInputChannels
;
// Anzahl Eingangskanle
int
iOutputChannels
;
// Anzahl Ausgangskanle
bool
bSoftwareOutputLimiterEnabled
;
//!< Enabled/disable software limiter for output stream
double
dSoftwareOutputLimiterRMSFactor
;
//!< Maximum allowed RMS value as factor
bool
bProcessingPanicWarningEnabled
;
//!< Prints a warning if processing time is exceeded (causes dropouts)
int
iOutputChannels
;
// Anzahl Ausgangskanle
CVAAudioDriverConfig
();
virtual
~
CVAAudioDriverConfig
();
void
Init
(
const
CVAStruct
&
oArgs
);
// Einstellungen aus einem Struct lesen
void
init
(
const
CVAStruct
&
oArgs
);
};
#endif // __VA_AUDIODRIVERCONFIG_H__
src/Filtering/VAVariableDelayLine.cpp
View file @
49568aca
This diff is collapsed.
Click to expand it.
src/Filtering/VAVariableDelayLine.h
View file @
49568aca
This diff is collapsed.
Click to expand it.
src/Rendering/Binaural/FreeField/VABinauralFreeFieldAudioRenderer.cpp
View file @
49568aca
This diff is collapsed.
Click to expand it.
src/Rendering/Binaural/RoomAcoustics/VARoomAcousticsAudioRenderer.cpp
View file @
49568aca
This diff is collapsed.
Click to expand it.
src/VACoreConfig.cpp
View file @
49568aca
...
...
@@ -80,7 +80,7 @@ void CVACoreConfig::Init( const CVAStruct& oData )
// --= Audio interface =--
oAudioDriverConfig
.
I
nit
(
conf
.
OptStruct
(
"Audio driver"
)
);
oAudioDriverConfig
.
i
nit
(
conf
.
OptStruct
(
"Audio driver"
)
);
// --= Hardware setup =--
...
...
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