Commit c3987b7a authored by Dipl.-Ing. Jonas Stienen's avatar Dipl.-Ing. Jonas Stienen
Browse files

Refactoring and fixing problems

parent ee7d19f8
#include <VACore.h>
#include <VACoreEvent.h>
#include <VA.h>
#include <VACoreFactory.h>
#include <VACoreVersion.h>
#include <VAException.h>
#include <iostream>
#include <vector>
......@@ -14,7 +11,7 @@ using namespace std;
int main( int, char** )
{
IVACore* pCore = NULL;
IVAInterface* pCore = NULL;
try
{
CVAStruct oConfig;
......
/*
* --------------------------------------------------------------------------------------------
*
* VVV VVV A Virtual Acoustics (VA) | http://www.virtualacoustics.org
* VVV VVV AAA Licensed under the Apache License, Version 2.0
* VVV VVV AAA
* VVV VVV AAA Copyright 2015-2017
* VVVVVV AAA Institute of Technical Acoustics (ITA)
* VVVV AAA RWTH Aachen University
*
* --------------------------------------------------------------------------------------------
*/
/*!
@mainpage
@section intro_sec Introduction
The Virtual Acoustics project is free, open source real-time auralization framework. It is distributed under the terms of the Apache License Version 2.0.
The official website can be found at http://www.virtualacoustics.org
@section license_sec License
Copyright 2015-2017 Institute of Technical Acoustics (ITA), RWTH Aachen University
Licensed under the Apache License, Version 2.0 (the "License");
you may not use the OpenDAFF software package except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
You should also have received a [copy of the License](LICENSE.md) with the VA software package.
@section getting_started Getting started
If you are a C++ developer and want to integrate VA into your application, the first contact point should be the VABase interface representad by the #IVAInterface class.
If you are planning to create a binding for any other programming and/or scripting language, also have a look at VANet and the #IVANetClient class.
*/
#ifndef IW_VA_CORE
#define IW_VA_CORE
#include "VACoreDefinitions.h"
#include "VACoreFactory.h"
#include "VANetworkStreamAudioSignalSource.h"
#include "VAObjectPool.h"
#include "VAPoolObject.h"
#include "VAReferenceableObject.h"
#include "VAUncopyable.h"
#endif // IW_VA_CORE
# $Id:$
set( RelativeDir "include" )
set( RelativeSourceGroup "include" )
set( DirFiles
VACore.h
VACoreDefinitions.h
VACoreFactory.h
VANetworkStreamAudioSignalSource.h
......
......@@ -248,7 +248,7 @@ std::string CVAAudioSignalSourceManager::CreateTextToSpeechSignalSource( const s
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() );
CVASequencerSignalSource* pSource = new CVASequencerSignalSource( m_dSamplerate, m_iBlocklength );
return RegisterSignalSource( pSource, sName, true, true );
}
......@@ -350,11 +350,18 @@ CVASignalSourceInfo CVAAudioSignalSourceManager::GetSignalSourceInfo( const std:
// Informationen zusammenstellen#
IVAAudioSignalSource* pSource = it->second.pSource;
CVASignalSourceInfo ssi( it->first, pSource->GetTypeString(), it->second.sName, pSource->GetDesc(), pSource->GetStateString(), it->second.iRefCount );
CVASignalSourceInfo oInfo;
oInfo.sID = sID;
oInfo.iType = pSource->GetType();
oInfo.sName = it->second.sName;
oInfo.sDesc = pSource->GetDesc();
oInfo.sState = pSource->GetStateString();
oInfo.iReferences = it->second.iRefCount;
m_csRecords.leave();
return ssi;
return oInfo;
}
void CVAAudioSignalSourceManager::GetSignalSourceInfos( std::vector<CVASignalSourceInfo>& vssiDest ) const
......@@ -373,12 +380,16 @@ void CVAAudioSignalSourceManager::GetSignalSourceInfos( std::vector<CVASignalSou
{
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 ) );
CVASignalSourceInfo oInfo;
oInfo.sID = *cit;
oInfo.iType = pSource->GetType();
oInfo.sName = cit2->second.sName;
oInfo.sDesc = pSource->GetDesc();
oInfo.sState = pSource->GetStateString();
oInfo.iReferences = cit2->second.iRefCount;
vssiDest.push_back( oInfo );
}
m_csRecords.leave();
......
......@@ -66,7 +66,7 @@ IVAInterface* CVAEngineSignalSource::GetAssociatedCore() const
return m_pAssociatedCore;
}
const float* CVAEngineSignalSource::GetStreamBlock( const CVAAudiostreamState* pStreamInfo )
const float* CVAEngineSignalSource::GetStreamBlock( const CVAAudiostreamState* )
{
m_sbBuffer.Zero();
double dOmega;
......
......@@ -86,9 +86,8 @@ IVAInterface* CVAMachineSignalSource::GetAssociatedCore() const
return m_oConfig.pCore;
}
const float* CVAMachineSignalSource::GetStreamBlock( const CVAAudiostreamState* pStreamInfo )
const float* CVAMachineSignalSource::GetStreamBlock( const CVAAudiostreamState* )
{
const int iCurrentState = m_iCurrentState;
const int iNewTransition = m_iNewTransition;
m_sbOut.Zero();
......@@ -488,7 +487,7 @@ void CVAMachineSignalSource::AddSamplesIdling( ITASampleBuffer& sbOut, int iOutp
return;
}
assert( sbOut.length() == GetBlocklength() );
assert( sbOut.length() == int( GetBlocklength() ) );
assert( iOutputOffset >= 0 && iOutputOffset < sbOut.length() );
assert( iOutputOffset < sbOut.length() );
......@@ -510,7 +509,6 @@ void CVAMachineSignalSource::AddSamplesIdling( ITASampleBuffer& sbOut, int iOutp
m_sbIdleSound.cyclic_read( m_sbInterpolationSrc.data(), iLeft + iSize + iRight, iSrcOffset ); // copy
int iInputLength = iLeft+iSize;
int iInputStartOffset = iLeft;
m_pInterpRoutine->Interpolate( &m_sbInterpolationSrc, iInputLength, iLeft, &sbOut, sbOut.length() - iOutputOffset, iOutputOffset );
}
......
......@@ -68,7 +68,7 @@ int CVANetworkStreamAudioSignalSource::GetNumQueuedSamples()
return 0;
}
int CVANetworkStreamAudioSignalSource::Transmit( const std::vector<CVASampleBuffer>& oFrame )
int CVANetworkStreamAudioSignalSource::Transmit( const std::vector<CVASampleBuffer>& )
{
return 0;
}
\ No newline at end of file
......@@ -21,18 +21,20 @@
#include <sstream>
CVASequencerSignalSource::CVASequencerSignalSource(const double dSamplerate,
const int iBlocklength,
ITASoundSamplePool* pGlobalSamplePool)
: m_pAssociatedCore(nullptr),
m_pSampler(nullptr),
m_pSamplePool(pGlobalSamplePool)
CVASequencerSignalSource::CVASequencerSignalSource( const double dSamplerate, const int iBlocklength )
: m_pAssociatedCore( nullptr )
, m_pSampler( nullptr )
, m_pSamplePool( nullptr )
{
m_pSampler = ITASoundSampler::Create(1, dSamplerate, iBlocklength, pGlobalSamplePool);
m_pSamplePool = ITASoundSamplePool::Create( 1, dSamplerate );
m_pSampler = ITASoundSampler::Create( 1, dSamplerate, iBlocklength, m_pSamplePool );
m_iTrackID = m_pSampler->AddMonoTrack();
}
CVASequencerSignalSource::~CVASequencerSignalSource() {
CVASequencerSignalSource::~CVASequencerSignalSource()
{
delete m_pSamplePool;
delete m_pSampler;
}
......@@ -49,7 +51,7 @@ std::string CVASequencerSignalSource::GetTypeMnemonic() const {
}
std::string CVASequencerSignalSource::GetDesc() const {
return std::string("Plays an audio signal generated by sampling (sound synthesis)");
return std::string( "Plays an audio signal generated by sampling (sound synthesis)" );
}
std::string CVASequencerSignalSource::GetStateString() const {
......@@ -60,27 +62,29 @@ IVAInterface* CVASequencerSignalSource::GetAssociatedCore() const {
return m_pAssociatedCore;
}
int CVASequencerSignalSource::AddSoundPlayback(int iSoundID, int iFlags, double dTimecode) {
int CVASequencerSignalSource::AddSoundPlayback( int iSoundID, int, double dTimecode ) {
/*
const ITASoundSample* pSample = m_pSamplePool->GetSample(iSoundID, true);
if (pSample == nullptr)
VA_EXCEPT2(INVALID_PARAMETER, "Invalid sound ID");
VA_EXCEPT2(INVALID_PARAMETER, "Invalid sound ID");
*/
return m_pSampler->AddPlaybackByTimecode(iSoundID, m_iTrackID, dTimecode);
return m_pSampler->AddPlaybackByTimecode( iSoundID, m_iTrackID, dTimecode );
}
const float* CVASequencerSignalSource::GetStreamBlock(const CVAAudiostreamState* pStreamInfo) {
const float* CVASequencerSignalSource::GetStreamBlock( const CVAAudiostreamState* pStreamInfo ) {
// [fwe] Dieser Cast ist in Ordnung. VACore-intern wird immer CVAAudioStreamStateImpl weitergeleitet
const float* pfData = m_pSampler->GetBlockPointer(0, dynamic_cast<const CVAAudiostreamStateImpl*>(pStreamInfo));
const float* pfData = m_pSampler->GetBlockPointer( 0, dynamic_cast< const CVAAudiostreamStateImpl* >( pStreamInfo ) );
m_pSampler->IncrementBlockPointer();
return pfData;
}
void CVASequencerSignalSource::HandleRegistration(IVAInterface* pParentCore) {
void CVASequencerSignalSource::HandleRegistration( IVAInterface* pParentCore )
{
m_pAssociatedCore = pParentCore;
}
void CVASequencerSignalSource::HandleUnregistration(IVAInterface* pParentCore) {
void CVASequencerSignalSource::HandleUnregistration( IVAInterface* )
{
m_pAssociatedCore = nullptr;
}
\ No newline at end of file
......@@ -25,14 +25,13 @@ class ITASoundSamplePool;
* fr Klangobjekte mittels eines Sequencers generieren.
*/
class CVASequencerSignalSource : public IVAAudioSignalSource {
class CVASequencerSignalSource : public IVAAudioSignalSource
{
public:
CVASequencerSignalSource(const double dSamplerate,
const int iBlocklength,
ITASoundSamplePool* pGlobalSamplePool);
CVASequencerSignalSource( const double dSamplerate, const int iBlocklength );
virtual ~CVASequencerSignalSource();
int AddSoundPlayback(int iSoundID, int iFlags, double dTimecode=0);
int AddSoundPlayback( int iSoundID, int iFlags, double dTimecode = 0 );
// --= Schnittstelle IVAAudioSignalSource =-------------------------
......@@ -42,7 +41,7 @@ public:
std::string GetDesc() const;
std::string GetStateString() const;
IVAInterface* GetAssociatedCore() const;
const float* GetStreamBlock(const CVAAudiostreamState* pStreamInfo);
const float* GetStreamBlock( const CVAAudiostreamState* pStreamInfo );
void SetParameters( const CVAStruct& ) {};
CVAStruct GetParameters( const CVAStruct& ) const { return CVAStruct(); };
......@@ -52,8 +51,8 @@ private:
ITASoundSamplePool* m_pSamplePool;
int m_iTrackID;
void HandleRegistration(IVAInterface* pParentCore);
void HandleUnregistration(IVAInterface* pParentCore);
void HandleRegistration( IVAInterface* pParentCore );
void HandleUnregistration( IVAInterface* pParentCore );
};
#endif // IW_VACORE_SEQUENCERSIGNALSOURCE
......@@ -23,7 +23,7 @@
#include <ITABufferDataSource.h>
#include <ITASampleTypeConversion.h>
#include <VACore.h>
#include <VA.h>
#include <sstream>
#include <assert.h>
......
......@@ -81,7 +81,7 @@ public:
* gibt den Index des Gitterpunkt zurck (falls gewnscht, nutzbar fr schnelle Vergleiche).
* - Zustzlich kann ermittelt werden, ob die Richtung von den Daten abgedeckt wurde
*/
virtual void GetNearestNeighbour( float fAzimuthDeg, float fElevationDeg, int* piIndex, bool* pbOutOfBounds = nullptr ) = 0;
virtual void GetNearestNeighbour( float fAzimuthDeg, float fElevationDeg, int* piIndex, bool* pbOutOfBounds = nullptr ) const = 0;
//! HRIR-Datensatz abrufen (Winkel in Grad []) [copy-to-buffer]
/**
......@@ -95,7 +95,7 @@ public:
* gibt den Index des Gitterpunkt zurck (falls gewnscht, nutzbar fr schnelle Vergleiche).
* - Zustzlich kann ermittelt werden, ob die Richtung von den Daten abgedeckt wurde
*/
virtual void GetHRIR( ITASampleFrame* psfDest, const float fAzimuthDeg, const float fElevationDeg, const float fDistanceMeters, int* piIndex = nullptr, bool* pbOutOfBounds = nullptr ) = 0;
virtual void GetHRIR( ITASampleFrame* psfDest, const float fAzimuthDeg, const float fElevationDeg, const float fDistanceMeters, int* piIndex = nullptr, bool* pbOutOfBounds = nullptr ) const = 0;
//! HRIR-Datensatz abrufen (durch gegebenen Index) [copy-to-buffer]
/**
......@@ -109,7 +109,7 @@ public:
*
* - Diese Funktion kann man effizient zusammen mit GetNearestNeighbourIndex benutzen
*/
virtual void GetHRIRByIndex( ITASampleFrame* psfDest, const int iIndex, const float fDistanceMeters ) = 0;
virtual void GetHRIRByIndex( ITASampleFrame* psfDest, const int iIndex, const float fDistanceMeters ) const = 0;
};
#endif // IW_VACORE_HRIRDATASET
......@@ -172,7 +172,7 @@ const CVAHRIRDatasetProperties* CVAHRIRDatasetDAFF2D::GetProperties() const
return &m_oProps;
}
void CVAHRIRDatasetDAFF2D::GetNearestNeighbour( float fAzimuthDeg, float fElevationDeg, int* piIndex, bool* pbOutOfBounds )
void CVAHRIRDatasetDAFF2D::GetNearestNeighbour( float fAzimuthDeg, float fElevationDeg, int* piIndex, bool* pbOutOfBounds ) const
{
assert( m_pContent );
......@@ -185,7 +185,7 @@ void CVAHRIRDatasetDAFF2D::GetNearestNeighbour( float fAzimuthDeg, float fElevat
}
void CVAHRIRDatasetDAFF2D::GetHRIRByIndex( ITASampleFrame* psfDest, const int iIndex, const float fDistanceMeters )
void CVAHRIRDatasetDAFF2D::GetHRIRByIndex( ITASampleFrame* psfDest, const int iIndex, const float ) const
{
assert( m_pContent );
......@@ -201,7 +201,7 @@ void CVAHRIRDatasetDAFF2D::GetHRIRByIndex( ITASampleFrame* psfDest, const int iI
}
}
void CVAHRIRDatasetDAFF2D::GetHRIR( ITASampleFrame* psfDest, const float fAzimuthDeg, const float fElevationDeg, const float fDistanceMeters, int* piIndex, bool* pbOutOfBounds )
void CVAHRIRDatasetDAFF2D::GetHRIR( ITASampleFrame* psfDest, const float fAzimuthDeg, const float fElevationDeg, const float fDistanceMeters, int* piIndex, bool* pbOutOfBounds ) const
{
int i;
GetNearestNeighbour( fAzimuthDeg, fElevationDeg, &i, pbOutOfBounds );
......
......@@ -44,7 +44,8 @@ class DAFFMetadata;
* - Dann ist die Latenz 256-200 = 56 Samples.
* - Also: Beim 56ten Samples ist man quasi beim Mittelpunkt des Filters.
*/
class CVAHRIRDatasetDAFF2D : public IVADirectivity {
class CVAHRIRDatasetDAFF2D : public IVADirectivity
{
public:
//! Lade-Konstruktor. Wirft CVAException im Fehlerfall.
CVAHRIRDatasetDAFF2D(const std::string& sFilename, const std::string& sName, double dDesiredSamplerate);
......@@ -61,18 +62,18 @@ public:
void GetNearestNeighbour(float fAzimuthDeg, float fElevationDeg,
int* piIndex,
bool* pbOutOfBounds=nullptr);
bool* pbOutOfBounds=nullptr) const;
void GetHRIRByIndex(ITASampleFrame* psfDest,
const int iIndex,
const float fDistanceMeters);
const float fDistanceMeters) const;
void GetHRIR(ITASampleFrame* psfDest,
const float fAzimuthDeg,
const float fElevationDeg,
const float fDistanceMeters,
int* piIndex=nullptr,
bool* pbOutOfBounds=nullptr);
bool* pbOutOfBounds=nullptr) const;
/*
//! Auflsung zurckgeben (Alpha|Beta)
float GetAlphaResolution() const;
......@@ -106,7 +107,7 @@ public:
private:
CVAHRIRDatasetProperties m_oProps;
DAFFReader* m_pReader;
DAFFContentIR* m_pContent;
mutable DAFFContentIR* m_pContent;
const DAFFMetadata* m_pMetadata;
std::string m_sName;
float m_fLatency;
......
......@@ -132,17 +132,17 @@ const CVAHRIRDatasetProperties* CVAHRIRMultiDataset3D::GetProperties() const
return &m_oProps;
}
void CVAHRIRMultiDataset3D::GetNearestNeighbour( float fAzimuthDeg, float fElevationDeg, int* piIndex, bool* pbOutOfBounds )
void CVAHRIRMultiDataset3D::GetNearestNeighbour( float fAzimuthDeg, float fElevationDeg, int* piIndex, bool* pbOutOfBounds ) const
{
VA_EXCEPT2( NOT_IMPLEMENTED, "Not implemented" );
}
void CVAHRIRMultiDataset3D::GetHRIRByIndex( ITASampleFrame* psfDest, const int iIndex, const float fDistanceMeters )
void CVAHRIRMultiDataset3D::GetHRIRByIndex( ITASampleFrame* psfDest, const int iIndex, const float fDistanceMeters ) const
{
}
void CVAHRIRMultiDataset3D::GetHRIR( ITASampleFrame* psfDest, const float fAzimuthDeg, const float fElevationDeg, const float fDistanceMeters, int* piIndex, bool* pbOutOfBounds )
void CVAHRIRMultiDataset3D::GetHRIR( ITASampleFrame* psfDest, const float fAzimuthDeg, const float fElevationDeg, const float fDistanceMeters, int* piIndex, bool* pbOutOfBounds ) const
{
// TODO;
......
......@@ -40,9 +40,9 @@ public:
std::string GetDesc() const;
const CVAHRIRDatasetProperties* GetProperties() const;
void GetNearestNeighbour( float fAzimuthDeg, float fElevationDeg, int* piIndex, bool* pbOutOfBounds = nullptr );
void GetHRIRByIndex( ITASampleFrame* psfDest, const int iIndex, const float fDistanceMeters );
void GetHRIR( ITASampleFrame* psfDest, const float fAzimuthDeg, const float fElevationDeg, const float fDistanceMeters, int* piIndex = nullptr, bool* pbOutOfBounds = nullptr );
void GetNearestNeighbour( float fAzimuthDeg, float fElevationDeg, int* piIndex, bool* pbOutOfBounds = nullptr ) const;
void GetHRIRByIndex( ITASampleFrame* psfDest, const int iIndex, const float fDistanceMeters ) const;
void GetHRIR( ITASampleFrame* psfDest, const float fAzimuthDeg, const float fElevationDeg, const float fDistanceMeters, int* piIndex = nullptr, bool* pbOutOfBounds = nullptr ) const;
private:
class Record
......
......@@ -19,7 +19,7 @@
// VA includes
#include "../../VAAudioRenderer.h"
#include "../../VAAudioRendererRegistry.h"
#include <VACore.h>
#include <VA.h>
// ITA includes
#include <ITADataSourceRealization.h>
......
......@@ -24,7 +24,7 @@
#include "../../../Scene/VAScene.h"
#include "../../../Utils/VAUtils.h"
#include "../../../VAAudiostreamTracker.h"
#include <VACore.h>
#include <VA.h>
#include "../../../VACoreImpl.h"
#include "../../../VACoreConfig.h"
#include "../../../VALog.h"
......
......@@ -23,9 +23,7 @@
#include "../../VAAudioRenderer.h"
#include "../../VAAudioRendererRegistry.h"
#include "../../../Scene/VAScene.h"
#include <VAObject.h>
#include <VABase.h>
#include <VACore.h>
#include <VA.h>
#include <VAObjectPool.h>
#include "../../../VASourceListenerMetrics.h"
#include "../../../VACoreImpl.h"
......
......@@ -18,7 +18,7 @@
#include "../../../Filtering/VATemporalVariations.h"
// VA includes
#include <VACore.h>
#include <VA.h>
#include <VAObjectPool.h>
#include <VAReferenceableObject.h>
#include "../../../Data/VADirectivity.h"
......
......@@ -17,9 +17,7 @@
#if ( VACORE_WITH_RENDERER_BINAURAL_AIR_TRAFFIC_NOISE == 1 )
// VA includes
#include <VAObject.h>
#include <VABase.h>
#include <VACore.h>
#include <VA.h>
#include <VAObjectPool.h>
#include "../../../Motion/VAMotionModelBase.h"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment