Commit 354e7e76 authored by Michael Kohnen's avatar Michael Kohnen
Browse files

Merge branch 'develop' into features/ambisonics

parents 6142d178 34d6549b
......@@ -39,6 +39,7 @@ endif( )
vista_use_package( VistaCoreLibs REQUIRED COMPONENTS VistaInterProcComm FIND_DEPENDENCIES )
vista_use_package( VABase REQUIRED FIND_DEPENDENCIES )
vista_use_package( ITABase REQUIRED FIND_DEPENDENCIES )
vista_use_package( ITADSP REQUIRED FIND_DEPENDENCIES )
vista_use_package( ITADataSources REQUIRED FIND_DEPENDENCIES )
vista_use_package( ITAConvolution REQUIRED FIND_DEPENDENCIES )
vista_use_package( ITACTC REQUIRED FIND_DEPENDENCIES )
......@@ -53,7 +54,7 @@ if( NOT DEFINED ITA_VACORE_VERSION_MAJOR )
set( ITA_VACORE_VERSION_MAJOR "v2017" CACHE STRING "VACore version major (usually 'v' and year)" )
endif( )
if( NOT DEFINED ITA_VACORE_VERSION_MINOR )
set( ITA_VACORE_VERSION_MINOR "a" CACHE STRING "VACore version minor (usually a,b,c ...)" )
set( ITA_VACORE_VERSION_MINOR "c" CACHE STRING "VACore version minor (usually a,b,c ...)" )
endif( )
# Settings
......@@ -82,6 +83,9 @@ endif( )
if( NOT DEFINED ITA_VACORE_MAX_NUM_LISTENERS )
set( ITA_VACORE_MAX_NUM_LISTENERS 0 CACHE INT "VACore maximum number of listeners ( 0 = unlimited )" )
endif( )
if( NOT DEFINED ITA_VACORE_WITH_TTS_SIGNAL_SOURCE )
set( ITA_VACORE_WITH_TTS_SIGNAL_SOURCE ${TTSReleay} CACHE BOOL "VACore with text-to-speech signal source support" )
endif( )
# Data dirs
......@@ -310,6 +314,14 @@ endif( )
string( TIMESTAMP VACORE_CMAKE_DATE "%Y-%m-%d" )
add_definitions( "-DVACORE_CMAKE_DATE=\"${VACORE_CMAKE_DATE}\"" )
if( ITA_VACORE_WITH_TTS_SIGNAL_SOURCE )
vista_use_package( CereVoice REQUIRED FIND_DEPENDENCIES)
vista_use_package( samplerate REQUIRED FIND_DEPENDENCIES)
if( VCEREVOICE_FOUND )
add_definitions( "-DVACORE_WITH_TTS_SIGNAL_SOURCE" )
endif( )
endif( )
# Dev switches
if( ITA_VACORE_REPRODUCTION_NCTC_WITH_SWEET_SPOT_WIDENING )
add_definitions( "-DVACORE_REPRODUCTION_NCTC_WITH_SWEET_SPOT_WIDENING" )
......@@ -334,7 +346,11 @@ vista_create_default_info_file( VACore )
set_property( TARGET VACore PROPERTY FOLDER "VA" )
# VA core configuration file
configure_file( "conf/VACore.ini.proto" "${CMAKE_CURRENT_SOURCE_DIR}/conf/${ITA_VACORE_DEFAULT_CONFIG_FILE_NAME}" @ONLY )
if( NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/conf/${ITA_VACORE_DEFAULT_CONFIG_FILE_NAME}" )
configure_file( "conf/VACore.ini.proto" "${CMAKE_CURRENT_SOURCE_DIR}/conf/${ITA_VACORE_DEFAULT_CONFIG_FILE_NAME}" @ONLY )
else()
message( "conf/VACore.ini exists, skipping overwrite. Manually remove generated conf/VACore.ini first, if you want to re-generate from default prototype config file." )
endif()
# deploy
if( ITA_VACORE_DEPLOY_WITH_COMMON_DATA )
......@@ -342,7 +358,7 @@ if( ITA_VACORE_DEPLOY_WITH_COMMON_DATA )
endif( )
if( ITA_VACORE_DEPLOY_WITH_COMMON_CONFIGS )
install( DIRECTORY "conf" DESTINATION "." FILES_MATCHING PATTERN "*.ini" )
install( DIRECTORY "conf" DESTINATION "." FILES_MATCHING PATTERN "*.ini" )
endif( )
if( ITA_VACORE_DEPLOY_WITH_COMMON_SCRIPTS )
......
Copyright 2015-2016 Institute of Technical Acoustics, RWTH Aachen University
Copyright 2015-2017 Institute of Technical Acoustics, RWTH Aachen University
Any usage and distribution is prohibited, unless explicitly granted by the authors.
\ No newline at end of file
......@@ -3,20 +3,23 @@
VACore implements the core functionality for real-time auralization of virtual environments and sophisticated reproduction of various types. It can be
created using a factory method and exposes the IVACore abstract class methods. Manage the core by the C++ interface (directly or over TCP/IP network in VANet) or via various binding interfaces, i.e. for Matlab (VAMatlab).
### License
Copyright 2015-2016 Institute of Technical Acoustics, RWTH Aachen University. Any usage and distribution is prohibited, unless explicitly granted by the authors.
Copyright 2015-2017 Institute of Technical Acoustics, RWTH Aachen University. Any usage and distribution is prohibited, unless explicitly granted by the authors.
See [License](LICENSE.md) file for more information
### Quick build guide
VACore uses CMake configuration files to create project files for your preferred development environment. It requires the VistaCMakeCommon extension package, which can be downloaded from [devhub.com](http://devhub.com).
Further packages are required, such as the VistaCoreLibs and the ITACoreLibs.
### Additional software
Some applications like the VAServer and the VAGUI are using the VACore to manage the auralization and reproduction. Also, bindings for C++ and Matlab exist, where you can connect to the VACore via network connection.
### Help
VACore is an in-house development of ITA and not for use to anyone else. Help is only provided within projects where ITA is involved.
### Quick build guide
It is recommended to clone and follow the build guide of the parent project [VA](https://git.rwth-aachen.de/ita/VA), which includes this project as a submodule.
......@@ -12,7 +12,7 @@
#
# WARNING: This configuration file for the VACore has been automatically created by CMake.
# You can move this file and change the argument path accordingly, otherwise
# your changes will will be overwritten. Alternatively, you can directly modify
# your changes will be overwritten. Alternatively, you can directly modify
# the prototype file 'VACore.ini.proto' and re-run CMake.
#
......@@ -39,6 +39,9 @@ big_data_dir = @ITA_VACORE_BIG_DATA_DIR@
# Inside scene data directory
InsideSceneData = @INSIDE_SCENE_DATA@
# Path for TTS Voices of CereVoice
voices_dir = data/Voices
[Files]
......@@ -111,7 +114,7 @@ Buffersize = AUTO
[Renderer:MyBinauralFreeField]
Class = BinauralFreeField
Enabled = false
Enabled = true
Outputs = MyTalkthroughHeadphones
HRIRFilterLength = 256
MotionModelNumHistoryKeys = 10000
......@@ -121,6 +124,7 @@ MotionModelLogInputSources = false
MotionModelLogEstimatedOutputSources = false
MotionModelLogInputListener = false
MotionModelLogEstimatedOutputListener = false
SwitchingAlgorithm = linear
[Renderer:MyAmbientMixer]
class = AmbientMixer
......@@ -147,7 +151,7 @@ SpeedOfSound = 344.0
[Renderer:MyBinauralRoomAcoustics]
Class = BinauralRoomAcoustics
Enabled = true
Enabled = false
Outputs = MyTalkthroughHeadphones
# Setup options: Local, Remote, Hybrid
Setup = Local
......@@ -175,7 +179,7 @@ MotionModelLogEstimatedOutputSources = false
DumpListeners = false
DumpListenersGain = 1.0
SpeedOfSound = 344.0
SwitchingAlgorithm = cubicspline
SwitchingAlgorithm = linear
[Renderer:MyHearingAidRenderer]
Class = PrototypeHearingAid
......
......@@ -35,7 +35,7 @@ Devices = LS_BF, LS_BR, LS_BB, LS_BL
[Output:VRLAB_LS_SUBWOOFER]
Description = ITA VRLab subwoofer loudspeaker setup
Enabled = false
Enabled = true
Devices = LS_SUB
[Output:VRLAB_HP_MAIN]
......
......@@ -11,6 +11,7 @@
#include "VASequencerSignalSource.h"
#include "VAEngineSignalSource.h"
#include "VAMachineSignalSource.h"
#include "VATextToSpeechSignalSource.h"
#include <ITAException.h>
#include <ITAStringUtils.h>
......@@ -22,27 +23,27 @@
#include <sstream>
CVAAudioSignalSourceManager::CVAAudioSignalSourceManager(CVACoreImpl* pParentCore,
const CVAAudioDriverConfig& oAudioDriverConfig,
ITADatasource* pDeviceInputSource)
: m_pParentCore(pParentCore),
m_dSamplerate(oAudioDriverConfig.dSampleRate),
m_iBlocklength(oAudioDriverConfig.iBuffersize),
m_iDeviceInputs(oAudioDriverConfig.iInputChannels),
m_pDeviceInputSource(pDeviceInputSource),
m_vsbDeviceInputBuffers(oAudioDriverConfig.iInputChannels),
m_evStreamCounterInc( VistaThreadEvent::NON_WAITABLE_EVENT ),
m_iStreamCounter(0)
CVAAudioSignalSourceManager::CVAAudioSignalSourceManager( CVACoreImpl* pParentCore,
const CVAAudioDriverConfig& oAudioDriverConfig,
ITADatasource* pDeviceInputSource )
: m_pParentCore( pParentCore ),
m_dSamplerate( oAudioDriverConfig.dSampleRate ),
m_iBlocklength( oAudioDriverConfig.iBuffersize ),
m_iDeviceInputs( oAudioDriverConfig.iInputChannels ),
m_pDeviceInputSource( pDeviceInputSource ),
m_vsbDeviceInputBuffers( oAudioDriverConfig.iInputChannels ),
m_evStreamCounterInc( VistaThreadEvent::NON_WAITABLE_EVENT ),
m_iStreamCounter( 0 )
{
m_sbSilence.Init( oAudioDriverConfig.iBuffersize, true );
// Puffer und Signalquellen fr Audio-Eingnge anlegen
for (int i=0; i<oAudioDriverConfig.iInputChannels; i++) {
m_vsbDeviceInputBuffers[i].Init( oAudioDriverConfig.iBuffersize, false);
for( int i = 0; i < oAudioDriverConfig.iInputChannels; i++ ) {
m_vsbDeviceInputBuffers[ i ].Init( oAudioDriverConfig.iBuffersize, false );
std::stringstream ss;
ss << "Audio device input " << (i+1);
IVAAudioSignalSource* pSource = new CVADeviceInputSignalSource(&m_vsbDeviceInputBuffers[i], ss.str());
m_vsDeviceInputSourceIDs.push_back( RegisterSignalSource(pSource, ss.str(), true, false) );
ss << "Audio device input " << ( i + 1 );
IVAAudioSignalSource* pSource = new CVADeviceInputSignalSource( &m_vsbDeviceInputBuffers[ i ], ss.str() );
m_vsDeviceInputSourceIDs.push_back( RegisterSignalSource( pSource, ss.str(), true, false ) );
}
}
......@@ -58,7 +59,7 @@ void CVAAudioSignalSourceManager::Reset() {
std::vector< IVAAudioSignalSource* > vpDelayedRemoveList;
// Alle gemanageten Quellen freigeben
for( RecordMapIt it=m_mRecords.begin(); it!=m_mRecords.end(); )
for( RecordMapIt it = m_mRecords.begin(); it != m_mRecords.end(); )
{
// Forced reference count reset - OK here
it->second.iRefCount = 0;
......@@ -89,7 +90,7 @@ void CVAAudioSignalSourceManager::Reset() {
SyncSignalSources();
// Falls kein Streaming luft. Direkt die Queue leeren.
if( !m_pParentCore->IsStreaming() )
if( !m_pParentCore->IsStreaming() )
m_qpDelReqSources.clear();
if( bFirstWaitTimeout == false )
......@@ -101,8 +102,8 @@ void CVAAudioSignalSourceManager::Reset() {
}
// Now delete signal source
for( size_t i=0; i< vpDelayedRemoveList.size(); i++ )
delete vpDelayedRemoveList[i];
for( size_t i = 0; i < vpDelayedRemoveList.size(); i++ )
delete vpDelayedRemoveList[ i ];
m_mMnemonicCount.clear();
......@@ -121,7 +122,7 @@ std::string CVAAudioSignalSourceManager::RegisterSignalSource( IVAAudioSignalSou
if( FindSignalSource( pSource ) != m_mRecords.end() )
{
m_csRecords.leave();
ITA_EXCEPT1(INVALID_PARAMETER, "Audio signal source already contained");
ITA_EXCEPT1( INVALID_PARAMETER, "Audio signal source already contained" );
}
// Neue ID (Mnemonic + Zahl) generieren
......@@ -129,7 +130,7 @@ std::string CVAAudioSignalSourceManager::RegisterSignalSource( IVAAudioSignalSou
std::string sMnemonic = toLowercase( pSource->GetTypeString() );
//std::string sMnemonic = "ss";
int iNumber;
std::map<std::string, int>::iterator it = m_mMnemonicCount.find(sMnemonic);
std::map<std::string, int>::iterator it = m_mMnemonicCount.find( sMnemonic );
if( it == m_mMnemonicCount.end() )
{
// Es wurde noch keine Quelle mit diesem Mnemonic hinzugefgt -> Zhler initialisieren
......@@ -139,9 +140,9 @@ std::string CVAAudioSignalSourceManager::RegisterSignalSource( IVAAudioSignalSou
else
{
// Es wurden schon Quellen mit diesem Mnemonic hinzugefgt -> Zhler inkrementieren
iNumber = ++(it->second);
iNumber = ++( it->second );
}
std::string sID = sMnemonic + IntToString(iNumber);
std::string sID = sMnemonic + IntToString( iNumber );
// Quelle hinzufgen
RecordMapIt jt = m_mRecords.insert( m_mRecords.begin(), RecordItem( sID, CAudioSignalSourceRecord( pSource, sName, m_iBlocklength, bManaged, bDynamic ) ) );
......@@ -149,10 +150,10 @@ std::string CVAAudioSignalSourceManager::RegisterSignalSource( IVAAudioSignalSou
m_csRecords.leave();
// Quelle dem Audio-Streaming bergeben
m_qpNewSources.push( &(jt->second) );
m_qpNewSources.push( &( jt->second ) );
// Quelle ber Registrierung informieren
pSource->HandleRegistration(m_pParentCore);
pSource->HandleRegistration( m_pParentCore );
return sID;
}
......@@ -217,14 +218,21 @@ std::string CVAAudioSignalSourceManager::GetAudioDeviceInputSignalSource( int iI
return m_vsDeviceInputSourceIDs[ iInput ];
}
std::string CVAAudioSignalSourceManager::CreateAudiofileSignalSource(const std::string& sFilename, const std::string& sName)
std::string CVAAudioSignalSourceManager::CreateAudiofileSignalSource( const std::string& sFilename, const std::string& sName )
{
// Datei-Quellen sind immer managed und dynamisch
// File signals are always dynamic and managed
CVAAudiofileSignalSource* pSource = new CVAAudiofileSignalSource( sFilename, m_dSamplerate, m_iBlocklength );
return RegisterSignalSource(pSource, sName, true, true);
return RegisterSignalSource( pSource, sName, true, true );
}
std::string CVAAudioSignalSourceManager::CreateTextToSpeechSignalSource( const std::string& sName )
{
// TTS signals are always dynamic and managed
CVATextToSpeechSignalSource* pSource = new CVATextToSpeechSignalSource( m_dSamplerate, m_iBlocklength );
return RegisterSignalSource( pSource, sName, true, true );
}
std::string CVAAudioSignalSourceManager::CreateSequencerSignalSource(const std::string& sName)
std::string CVAAudioSignalSourceManager::CreateSequencerSignalSource( const std::string& sName )
{
// Sampler-Quellen sind immer managed und dynamisch
CVASequencerSignalSource* pSource = new CVASequencerSignalSource( m_dSamplerate, m_iBlocklength, m_pParentCore->GetSamplePool() );
......@@ -233,7 +241,7 @@ std::string CVAAudioSignalSourceManager::CreateSequencerSignalSource(const std::
std::string CVAAudioSignalSourceManager::CreateNetstreamSignalSource( const std::string& sBindAddress, int iRecvPort, const std::string& sName )
{
// Datei-Quellen sind immer managed und dynamisch
// Netstream audio sources are managed
CVANetstreamSignalSource* pSource = new CVANetstreamSignalSource( m_dSamplerate, m_iBlocklength, sBindAddress, iRecvPort );
return RegisterSignalSource( pSource, sName, true, true );
}
......@@ -243,17 +251,17 @@ std::string CVAAudioSignalSourceManager::CreateEngineSignalSource( const std::st
// Engine-quellen sind immer managed und dynamisch
CVAEngineSignalSource::Config oESSConfig;
oESSConfig.pCore = m_pParentCore;
oESSConfig.lFreqModesSpectrum.insert( std::pair< double, double >( 153/13.4f, 0.1*std::pow( 10, -27/10 ) ) );
oESSConfig.lFreqModesSpectrum.insert( std::pair< double, double >( 277/13.4f, 0.1*std::pow( 10, -32/10 ) ) );
oESSConfig.lFreqModesSpectrum.insert( std::pair< double, double >( 301/13.4f, 0.1*std::pow( 10, -23/10 ) ) );
oESSConfig.lFreqModesSpectrum.insert( std::pair< double, double >( 458/13.4f, 0.1*std::pow( 10, -24/10 ) ) );
oESSConfig.lFreqModesSpectrum.insert( std::pair< double, double >( 584/13.4f, 0.1*std::pow( 10, -4/10 ) ) );
oESSConfig.lFreqModesSpectrum.insert( std::pair< double, double >( 922/13.4f, 0.1*std::pow( 10, -29/10 ) ) );
oESSConfig.lFreqModesSpectrum.insert( std::pair< double, double >( 1152/13.4f, 0.1*std::pow( 10, -30/10 ) ) );
oESSConfig.lFreqModesSpectrum.insert( std::pair< double, double >( 1552/13.4f, 0.1*std::pow( 10, -14/10 ) ) );
oESSConfig.lFreqModesSpectrum.insert( std::pair< double, double >( 2382/13.4f, 0.1*std::pow( 10, -27/10 ) ) );
oESSConfig.lFreqModesSpectrum.insert( std::pair< double, double >( 2883/13.4f, 0.1*std::pow( 10, -18/10 ) ) );
oESSConfig.lFreqModesSpectrum.insert( std::pair< double, double >( 3472/13.4f, 0.1*std::pow( 10, -16/10 ) ) );
oESSConfig.lFreqModesSpectrum.insert( std::pair< double, double >( 153 / 13.4f, 0.1*std::pow( 10, -27 / 10 ) ) );
oESSConfig.lFreqModesSpectrum.insert( std::pair< double, double >( 277 / 13.4f, 0.1*std::pow( 10, -32 / 10 ) ) );
oESSConfig.lFreqModesSpectrum.insert( std::pair< double, double >( 301 / 13.4f, 0.1*std::pow( 10, -23 / 10 ) ) );
oESSConfig.lFreqModesSpectrum.insert( std::pair< double, double >( 458 / 13.4f, 0.1*std::pow( 10, -24 / 10 ) ) );
oESSConfig.lFreqModesSpectrum.insert( std::pair< double, double >( 584 / 13.4f, 0.1*std::pow( 10, -4 / 10 ) ) );
oESSConfig.lFreqModesSpectrum.insert( std::pair< double, double >( 922 / 13.4f, 0.1*std::pow( 10, -29 / 10 ) ) );
oESSConfig.lFreqModesSpectrum.insert( std::pair< double, double >( 1152 / 13.4f, 0.1*std::pow( 10, -30 / 10 ) ) );
oESSConfig.lFreqModesSpectrum.insert( std::pair< double, double >( 1552 / 13.4f, 0.1*std::pow( 10, -14 / 10 ) ) );
oESSConfig.lFreqModesSpectrum.insert( std::pair< double, double >( 2382 / 13.4f, 0.1*std::pow( 10, -27 / 10 ) ) );
oESSConfig.lFreqModesSpectrum.insert( std::pair< double, double >( 2883 / 13.4f, 0.1*std::pow( 10, -18 / 10 ) ) );
oESSConfig.lFreqModesSpectrum.insert( std::pair< double, double >( 3472 / 13.4f, 0.1*std::pow( 10, -16 / 10 ) ) );
CVAEngineSignalSource* pSource = new CVAEngineSignalSource( oESSConfig );
return RegisterSignalSource( pSource, sName, true, true );
}
......@@ -271,7 +279,7 @@ void CVAAudioSignalSourceManager::DeleteSignalSource( const std::string& sID )
m_csRecords.enter();
RecordMapIt it = FindSignalSource( sID );
if( it == m_mRecords.end() )
{
m_csRecords.leave();
......@@ -300,14 +308,14 @@ void CVAAudioSignalSourceManager::DeleteSignalSource( const std::string& sID )
}
// Audio-Stream das Lschen der Quelle melden
m_qpDelReqSources.push( &(it->second) );
m_qpDelReqSources.push( &( it->second ) );
// Warten bis der Lschauftrag abgearbeitet wurden
while (!m_qpDelReqSources.empty()) SyncSignalSources();
while( !m_qpDelReqSources.empty() ) SyncSignalSources();
// Quelle ber deregistrierung informieren
it->second.pSource->HandleUnregistration( m_pParentCore );
// Quelle freigeben
delete it->second.pSource;
m_mRecords.erase( it );
......@@ -320,8 +328,8 @@ CVASignalSourceInfo CVAAudioSignalSourceManager::GetSignalSourceInfo( const std:
m_csRecords.enter();
RecordMapCit it = FindSignalSource( sID );
if( it == m_mRecords.end() );
if( it == m_mRecords.end() )
{
m_csRecords.leave();
ITA_EXCEPT1( INVALID_PARAMETER, "Could not get information on " + sID + ", audio signal source not found" );
......@@ -342,85 +350,85 @@ void CVAAudioSignalSourceManager::GetSignalSourceInfos( std::vector<CVASignalSou
// Alphabetisch sortierte Liste der IDs erzeugen
std::vector<std::string> vsIDs;
for( RecordMapCit cit=m_mRecords.begin(); cit!=m_mRecords.end(); ++cit )
for( RecordMapCit cit = m_mRecords.begin(); cit != m_mRecords.end(); ++cit )
vsIDs.push_back( cit->first );
std::sort(vsIDs.begin(), vsIDs.end() );
std::sort( vsIDs.begin(), vsIDs.end() );
// Informationen zusammenstellen
vssiDest.clear();
for( std::vector< std::string >::const_iterator cit=vsIDs.begin(); cit!=vsIDs.end(); ++cit )
for( std::vector< std::string >::const_iterator cit = vsIDs.begin(); cit != vsIDs.end(); ++cit )
{
RecordMapCit cit2 = m_mRecords.find( *cit );
IVAAudioSignalSource* pSource = cit2->second.pSource;
vssiDest.push_back( CVASignalSourceInfo( *cit,
pSource->GetTypeString(),
cit2->second.sName,
pSource->GetDesc(),
pSource->GetStateString(),
cit2->second.iRefCount ) );
pSource->GetTypeString(),
cit2->second.sName,
pSource->GetDesc(),
pSource->GetStateString(),
cit2->second.iRefCount ) );
}
m_csRecords.leave();
}
std::string CVAAudioSignalSourceManager::GetSignalSourceID(IVAAudioSignalSource* pSource) const {
std::string CVAAudioSignalSourceManager::GetSignalSourceID( IVAAudioSignalSource* pSource ) const {
m_csRecords.enter();
for (RecordMapCit cit=m_mRecords.begin(); cit!=m_mRecords.end(); ++cit)
if (cit->second.pSource == pSource) {
m_csRecords.leave();
return cit->first;
for( RecordMapCit cit = m_mRecords.begin(); cit != m_mRecords.end(); ++cit )
if( cit->second.pSource == pSource ) {
m_csRecords.leave();
return cit->first;
}
m_csRecords.leave();
// Methode wird extern benutzt. Exception falls nicht gefunden.
VA_EXCEPT2(INVALID_PARAMETER, "Invalid signal source ID");
VA_EXCEPT2( INVALID_PARAMETER, "Invalid signal source ID" );
}
CVAAudioSignalSourceManager::RecordMapIt CVAAudioSignalSourceManager::FindSignalSource(const std::string& sID)
CVAAudioSignalSourceManager::RecordMapIt CVAAudioSignalSourceManager::FindSignalSource( const std::string& sID )
{
return m_mRecords.find( toLowercase(sID) );
return m_mRecords.find( toLowercase( sID ) );
}
CVAAudioSignalSourceManager::RecordMapCit CVAAudioSignalSourceManager::FindSignalSource(const std::string& sID) const
CVAAudioSignalSourceManager::RecordMapCit CVAAudioSignalSourceManager::FindSignalSource( const std::string& sID ) const
{
return m_mRecords.find( toLowercase(sID) );
return m_mRecords.find( toLowercase( sID ) );
}
CVAAudioSignalSourceManager::RecordMapIt CVAAudioSignalSourceManager::FindSignalSource(IVAAudioSignalSource* pSource)
CVAAudioSignalSourceManager::RecordMapIt CVAAudioSignalSourceManager::FindSignalSource( IVAAudioSignalSource* pSource )
{
for (RecordMapIt it=m_mRecords.begin(); it!=m_mRecords.end(); ++it)
if (it->second.pSource == pSource)
for( RecordMapIt it = m_mRecords.begin(); it != m_mRecords.end(); ++it )
if( it->second.pSource == pSource )
return it;
return m_mRecords.end();
}
IVAAudioSignalSource* CVAAudioSignalSourceManager::RequestSignalSource(const std::string& sID, const ITASampleBuffer** ppsbInputBuf) {
IVAAudioSignalSource* CVAAudioSignalSourceManager::RequestSignalSource( const std::string& sID, const ITASampleBuffer** ppsbInputBuf ) {
m_csRecords.enter();
RecordMapIt it = m_mRecords.find(sID);
RecordMapIt it = m_mRecords.find( sID );
// Wird von externen Methoden benutzt. Deshalb Exception.
if (it == m_mRecords.end()) {
if( it == m_mRecords.end() ) {
m_csRecords.leave();
VA_EXCEPT2(INVALID_PARAMETER, "Invalid signal source ID");
VA_EXCEPT2( INVALID_PARAMETER, "Invalid signal source ID" );
}
it->second.iRefCount++;
IVAAudioSignalSource* pResult = it->second.pSource;
ITASampleBuffer* psbInputBuffer = &(it->second.sbSampleBuffer);
if (ppsbInputBuf) *ppsbInputBuf = psbInputBuffer;
ITASampleBuffer* psbInputBuffer = &( it->second.sbSampleBuffer );
if( ppsbInputBuf ) *ppsbInputBuf = psbInputBuffer;
m_csRecords.leave();
return pResult;
}
void CVAAudioSignalSourceManager::ReleaseSignalSource(IVAAudioSignalSource* pSource) {
RecordMapIt it = FindSignalSource(pSource);
void CVAAudioSignalSourceManager::ReleaseSignalSource( IVAAudioSignalSource* pSource ) {
RecordMapIt it = FindSignalSource( pSource );
// Ungltiger Zeiger (weil nicht registriert)
assert (it != m_mRecords.end());
assert( it != m_mRecords.end() );
it->second.iRefCount--;
}
......@@ -430,10 +438,10 @@ void CVAAudioSignalSourceManager::SyncSignalSources() {
// das alle nderung an den Signalquellen im Audio-Stream Kontext abgearbeitet wurden.
// Falls Streaming nicht im Gange => Nicht warten
if (!m_pParentCore->IsStreaming()) return;
if( !m_pParentCore->IsStreaming() ) return;
// Keine Ketten => Nicht warten (sonst Deadlock)
if (m_mRecords.empty()) return;
if( m_mRecords.empty() ) return;
// Aktuellen Stream-Counter ermitteln
int iEntryCount = m_iStreamCounter;
......@@ -445,6 +453,8 @@ void CVAAudioSignalSourceManager::SyncSignalSources() {
// Dies geschieht wenn die Audio-Hardware im Sack ist und nicht streamt.
// In diesem Falle wird hier unendlich gewartet.
// [jst]: @todo This code block needs an update. The while( true ) loop appears unnecessary.
if( ( m_iStreamCounter != iEntryCount ) || ( iEntryCount == 0 ) )
return;
......@@ -459,9 +469,9 @@ void CVAAudioSignalSourceManager::FetchInputData( const CVAAudiostreamState* pSt
CAudioSignalSourceRecord* pRecord;
// Interne Liste aktualisieren
while( m_qpNewSources.try_pop(pRecord ) )
while( m_qpNewSources.try_pop( pRecord ) )
{
m_spIntSources.insert(pRecord);
m_spIntSources.insert( pRecord );
}
while( m_qpDelReqSources.try_pop( pRecord ) )
......@@ -472,14 +482,14 @@ void CVAAudioSignalSourceManager::FetchInputData( const CVAAudiostreamState* pSt
// Zunchst die Samples aller Audio-Eingnge vom Backend beziehen
if( m_pDeviceInputSource )
{
for (int i=0; i<m_iDeviceInputs; i++) {
for( int i = 0; i < m_iDeviceInputs; i++ ) {
// [fwe] Dieser Cast ist in Ordnung. VACore-intern wird immer CVAAudioStreamStateImpl weitergeleitet
const float* pfInputData = m_pDeviceInputSource->GetBlockPointer(i, dynamic_cast<const CVAAudiostreamStateImpl*>(pStreamInfo));
const float* pfInputData = m_pDeviceInputSource->GetBlockPointer( i, dynamic_cast< const CVAAudiostreamStateImpl* >( pStreamInfo ) );
if (pfInputData)
m_vsbDeviceInputBuffers[i].write(pfInputData, m_iBlocklength);
if( pfInputData )
m_vsbDeviceInputBuffers[ i ].write( pfInputData, m_iBlocklength );
else
m_vsbDeviceInputBuffers[i].Zero();
m_vsbDeviceInputBuffers[ i ].Zero();
}
m_pDeviceInputSource->IncrementBlockPointer();
}
......@@ -488,13 +498,14 @@ void CVAAudioSignalSourceManager::FetchInputData( const CVAAudiostreamState* pSt
// Wichtig: Zwei Phasen! 1. GetBlockPointer auf allen Quellen, 2. danach erst IncrementBlockPointer
for( std::set<CAudioSignalSourceRecord*>::iterator it = m_spIntSources.begin(); it != m_spIntSources.end(); ++it )
{
const float* pfInputData = (*it)->pSource->GetStreamBlock(pStreamInfo);
const float* pfInputData = ( *it )->pSource->GetStreamBlock( pStreamInfo );
//DEBUG_PRINTF("Ptr = 0x%08Xh\n", pfInputData);
if (pfInputData) {
(*it)->sbSampleBuffer.write(pfInputData, m_iBlocklength);
} else {
(*it)->sbSampleBuffer.Zero();
if( pfInputData ) {
( *it )->sbSampleBuffer.write( pfInputData, m_iBlocklength );
}
else {
( *it )->sbSampleBuffer.Zero();
}
}
......
......@@ -30,19 +30,18 @@ class CVACoreImpl;
- Diesen Signalquellen weit er auch ihre IDs zu
- Manche Signalquellen werden nicht vom Manager besessen (z.B. die vom Audiogert)
- Es gibt dynamische und statische Signalquellen:
- Eingnge vom Audiogert sind immer statisch (werden beim Start automatisch erzeugt und knnen nie entfernt werden)
- Alle anderen sind dynamisch: Sie knnen beliebig zur Laufzeit erzeugt und entfernt werden
- Eingnge vom Audiogert sind immer statisch (werden beim Start automatisch erzeugt und knnen nie entfernt werden)
- Alle anderen sind dynamisch: Sie knnen beliebig zur Laufzeit erzeugt und entfernt werden
- Warum Mnemonics (af001) => Weil einfacher anzusprechen
- Fetch Synchronisieren mit Register/Unreg.
*/
class CVAAudioSignalSourceManager {
class CVAAudioSignalSourceManager
{
public:
CVAAudioSignalSourceManager(CVACoreImpl* pParentCore,