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

Refactoring sample rate naming in audio driver

parent d256af2e
......@@ -26,7 +26,7 @@ CVAAudioSignalSourceManager::CVAAudioSignalSourceManager(CVACoreImpl* pParentCor
const CVAAudioDriverConfig& oAudioDriverConfig,
ITADatasource* pDeviceInputSource)
: m_pParentCore(pParentCore),
m_dSamplerate(oAudioDriverConfig.dSamplerate),
m_dSamplerate(oAudioDriverConfig.dSampleRate),
m_iBlocklength(oAudioDriverConfig.iBuffersize),
m_iDeviceInputs(oAudioDriverConfig.iInputChannels),
m_pDeviceInputSource(pDeviceInputSource),
......
......@@ -106,14 +106,14 @@ void CVAAudiofileSignalSource::SetPlaybackAction( int iPlayStateAction )
void CVAAudiofileSignalSource::SetCursorSeconds( double dPos )
{
double dDuration = m_pBufferDataSource->GetCapacity()/m_pBufferDataSource->GetSamplerate();
double dDuration = m_pBufferDataSource->GetCapacity()/m_pBufferDataSource->GetSampleRate();
int iPos;
if (dPos < 0)
iPos = 0;
else if (dPos > dDuration)
iPos = m_pBufferDataSource->GetCapacity();
else
iPos = (int) floor( dPos * m_pBufferDataSource->GetSamplerate() );
iPos = (int) floor( dPos * m_pBufferDataSource->GetSampleRate() );
m_pBufferDataSource->SetCursor(iPos);
}
......
......@@ -12,7 +12,7 @@
#include <math.h>
CVAEngineSignalSource::CVAEngineSignalSource( const CVAEngineSignalSource::Config& oConfig )
: ITADatasourceRealization( 1, oConfig.pCore->GetCoreConfig()->oAudioDriverConfig.dSamplerate, oConfig.pCore->GetCoreConfig()->oAudioDriverConfig.iBuffersize )
: ITADatasourceRealization( 1, oConfig.pCore->GetCoreConfig()->oAudioDriverConfig.dSampleRate, oConfig.pCore->GetCoreConfig()->oAudioDriverConfig.iBuffersize )
, m_oConfig( oConfig )
, m_pAssociatedCore( oConfig.pCore )
{
......@@ -64,7 +64,7 @@ const float* CVAEngineSignalSource::GetStreamBlock( const CVAAudiostreamState* p
{
const double& dBaseFrequency( cit->first );
const double& dAmplitude( cit->second );
const double dPeriodSamples = dK * GetSamplerate() / dBaseFrequency;
const double dPeriodSamples = dK * GetSampleRate() / dBaseFrequency;
double& dPhase( m_lFreqModesPhase[dBaseFrequency] );
dOmega = ITAConstants::TWO_PI_F / dPeriodSamples; // 2*pi/T
......
......@@ -17,7 +17,7 @@
#include <math.h>
CVAMachineSignalSource::CVAMachineSignalSource( const CVAMachineSignalSource::Config& oConfig )
: ITADatasourceRealization( 1, oConfig.pCore->GetCoreConfig()->oAudioDriverConfig.dSamplerate, oConfig.pCore->GetCoreConfig()->oAudioDriverConfig.iBuffersize )
: ITADatasourceRealization( 1, oConfig.pCore->GetCoreConfig()->oAudioDriverConfig.dSampleRate, oConfig.pCore->GetCoreConfig()->oAudioDriverConfig.iBuffersize )
, m_oConfig( oConfig )
, m_iCurrentState( MACHINE_STATE_INVALID )
, m_iNewTransition( MACHINE_TRANSITION_NONE )
......@@ -285,7 +285,7 @@ void CVAMachineSignalSource::SetStartSound( const std::string& sFilePath )
VA_EXCEPT2( INVALID_PARAMETER, "Looked everywhere, but could not find file '" + sFilePath + "'" );
ITAAudiofileReader* pReader = ITAAudiofileReader::create( sDestFilePath );
int N = pReader->getAudiofileProperties().uiLength;
int N = pReader->getAudiofileProperties().iLength;
m_sbStartSoundNew.Init( N, false );
m_sbStartSoundNew.write( pReader->read( N )[0], N );
m_bHasStartSound = true;
......@@ -299,7 +299,7 @@ void CVAMachineSignalSource::SetIdleSound( const std::string& sFilePath )
VA_EXCEPT2( INVALID_PARAMETER, "Looked everywhere, but could not find file '" + sFilePath + "'" );
ITAAudiofileReader* pReader = ITAAudiofileReader::create( sDestFilePath );
int N = pReader->getAudiofileProperties().uiLength;
int N = pReader->getAudiofileProperties().iLength;
m_sbIdleSoundNew.Init( N, false );
m_sbIdleSoundNew.write( pReader->read( N )[0], N );
m_bHasIdleSound = true;
......@@ -313,7 +313,7 @@ void CVAMachineSignalSource::SetStopSound( const std::string& sFilePath )
VA_EXCEPT2( INVALID_PARAMETER, "Looked everywhere, but could not find file '" + sFilePath + "'" );
ITAAudiofileReader* pReader = ITAAudiofileReader::create( sDestFilePath );
int N = pReader->getAudiofileProperties().uiLength;
int N = pReader->getAudiofileProperties().iLength;
m_sbStopSoundNew.Init( N, false );
m_sbStopSoundNew.write( pReader->read( N )[0], N );
m_bHasStopSound = true;
......
......@@ -92,7 +92,7 @@ void CVAASIOBackend::threadInitialize() {
std::string("\" does not support for the desired number of inputs or outputs"));
// Abtastrate berprfen
if (ITAsioCanSampleRate(m_pConfig->dSamplerate) != ASE_OK)
if (ITAsioCanSampleRate(m_pConfig->dSampleRate) != ASE_OK)
ITA_EXCEPT1(INVALID_PARAMETER,
std::string("The ASIO driver \"") + m_pConfig->sDevice +
std::string("\" does not support the desired sampling rate"));
......@@ -121,7 +121,7 @@ void CVAASIOBackend::threadInitialize() {
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.dSamplerate = m_pConfig->dSampleRate;
m_oOutputStreamProps.uiChannels = (unsigned int) m_pConfig->iOutputChannels;
m_oOutputStreamProps.uiBlocklength = (unsigned int) m_pConfig->iBuffersize;
}
......
......@@ -18,14 +18,14 @@ void CVAAudioDriverConfig::init(const CVAStruct& oArgs) {
CVAConfigInterpreter conf(oArgs);
conf.OptNonEmptyString("Driver", sDriver, "AUTO");
conf.OptString("Device", sDevice, "AUTO");
conf.OptNumber("Samplerate", dSamplerate, DEFAULT_SAMPLERATE);
conf.OptNumber("Samplerate", dSampleRate, DEFAULT_SAMPLERATE);
conf.OptInteger("Buffersize", iBuffersize, AUTO, &lits);
// TODO: Dieses Feature evtl. zuknftig entfernen und immer automatisch alle Kanle buchen
conf.OptInteger("InputChannels", iInputChannels, AUTO, &lits);
conf.OptInteger("OutputChannels", iOutputChannels, AUTO, &lits);
// Parameter prfen
if (dSamplerate <= 0) VA_EXCEPT1("Invalid samplerate specified");
if (dSampleRate <= 0) VA_EXCEPT1("Invalid samplerate specified");
if ((iBuffersize < 0) && (iBuffersize != AUTO)) VA_EXCEPT1("Invalid buffersize specified");
if ((iInputChannels < 0) && (iInputChannels != AUTO)) VA_EXCEPT1("Invalid number of input channels specified");
if ((iOutputChannels < 2) && (iOutputChannels != AUTO)) VA_EXCEPT1("Invalid number of output channels specified (at least two)");
......
......@@ -19,7 +19,7 @@ public:
std::string sDriver; // Name der Treiber-Architektur (z.B. "ASIO")
std::string sDevice; // Name des Audiogertes (z.B. "RME Hammerfall DSP")
double dSamplerate; // Abtastrate [Hz]
double dSampleRate; // Abtastrate [Hz]
int iBuffersize; // Streaming-Puffergre [Anzahl Samples] (0 => automatisch bestimmen)
int iInputChannels; // Anzahl Eingangskanle
int iOutputChannels; // Anzahl Ausgangskanle
......
......@@ -20,10 +20,10 @@ CVAPortaudioBackend::CVAPortaudioBackend(CVAAudioDriverConfig* pConfig)
if ( m_pConfig->iBuffersize <= 0 )
m_pConfig->iBuffersize = ITAPortaudioInterface::GetPreferredBufferSize();
m_pITAPA = new ITAPortaudioInterface( m_pConfig->dSamplerate, m_pConfig->iBuffersize );
m_pITAPA = new ITAPortaudioInterface( m_pConfig->dSampleRate, m_pConfig->iBuffersize );
// An diesen Einstellungen ist nicht mehr zu drehen ...
m_oOutputStreamProps.dSamplerate = m_pConfig->dSamplerate;
m_oOutputStreamProps.dSamplerate = m_pConfig->dSampleRate;
m_oOutputStreamProps.uiBlocklength = (unsigned int) m_pConfig->iBuffersize;
m_oOutputStreamProps.uiChannels = (unsigned int) m_pConfig->iOutputChannels;
}
......@@ -111,8 +111,8 @@ void CVAPortaudioBackend::threadInitialize()
double dSampleRate;
m_pITAPA->GetDriverSampleRate( iDriverID, dSampleRate );
if( m_pConfig->dSamplerate != dSampleRate )
ITA_EXCEPT1( INVALID_PARAMETER, "Samplerate " + DoubleToString( m_pConfig->dSamplerate ) + " is invalid for this audio device." );
if( m_pConfig->dSampleRate != dSampleRate )
ITA_EXCEPT1( INVALID_PARAMETER, "Samplerate " + DoubleToString( m_pConfig->dSampleRate ) + " is invalid for this audio device." );
m_oOutputStreamProps.uiBlocklength = ( unsigned int ) m_pConfig->iBuffersize;
m_oOutputStreamProps.uiChannels = ( unsigned int )m_pITAPA->GetNumOutputChannels( iDriverID );
......
......@@ -37,7 +37,7 @@ CVAAmbientMixerAudioRenderer::CVAAmbientMixerAudioRenderer( const CVAAudioRender
VA_EXCEPT2( INVALID_PARAMETER, "AmbientMixerAudioRenderer: '" + sOutput + "' is not a valid hardware output group. Disabled?" );
int iNumChannels = int( pOutput->GetPhysicalOutputChannels().size() );
double dSampleRate = m_oParams.pCore->GetCoreConfig()->oAudioDriverConfig.dSamplerate;
double dSampleRate = m_oParams.pCore->GetCoreConfig()->oAudioDriverConfig.dSampleRate;
int iBlockLength = m_oParams.pCore->GetCoreConfig()->oAudioDriverConfig.iBuffersize;
m_pDataSource = new ITADatasourceRealization( iNumChannels, dSampleRate, iBlockLength );
m_pDataSource->SetStreamEventHandler( this );
......
......@@ -33,7 +33,7 @@ CVAAmbisonicsFreefieldAudioRenderer::CVAAmbisonicsFreefieldAudioRenderer( const
VA_WARN( "CVAAmbisonicsBinauralMixdownReproduction", "No Ambisonics order given, using order 2" );
int iNumChannels = ( m_iAmbisonicsTruncationOrder + 1 ) * ( m_iAmbisonicsTruncationOrder + 1 );
double dSampleRate = oParams.pCore->GetCoreConfig()->oAudioDriverConfig.dSamplerate;
double dSampleRate = oParams.pCore->GetCoreConfig()->oAudioDriverConfig.dSampleRate;
int iBlockLength = oParams.pCore->GetCoreConfig()->oAudioDriverConfig.iBuffersize;
m_pdsOutput = new ITADatasourceRealization( iNumChannels, dSampleRate, iBlockLength );
......
......@@ -279,7 +279,7 @@ private:
// Renderer
CVABinauralAirTrafficNoiseAudioRenderer::CVABinauralAirTrafficNoiseAudioRenderer( const CVAAudioRendererInitParams& oParams )
: ITADatasourceRealization( 2, oParams.pCore->GetCoreConfig()->oAudioDriverConfig.dSamplerate, oParams.pCore->GetCoreConfig()->oAudioDriverConfig.iBuffersize )
: ITADatasourceRealization( 2, oParams.pCore->GetCoreConfig()->oAudioDriverConfig.dSampleRate, oParams.pCore->GetCoreConfig()->oAudioDriverConfig.iBuffersize )
, m_pCore( oParams.pCore )
, m_pCurSceneState( nullptr )
, m_iHRIRFilterLength( -1 )
......@@ -293,7 +293,7 @@ CVABinauralAirTrafficNoiseAudioRenderer::CVABinauralAirTrafficNoiseAudioRenderer
IVAPoolObjectFactory* pSourceFactory = new CVABATNSourcePoolFactory( m_oDefaultSourceConf );
m_pSourcePool = IVAObjectPool::Create( 16, 2, pSourceFactory, true );
m_pSoundPathFactory = new CVABATNSoundPathFactory( GetSamplerate(), GetBlocklength(), m_iHRIRFilterLength, 128 );
m_pSoundPathFactory = new CVABATNSoundPathFactory( GetSampleRate(), GetBlocklength(), m_iHRIRFilterLength, 128 );
m_pSoundPathPool = IVAObjectPool::Create( 64, 8, m_pSoundPathFactory, true );
......
......@@ -197,7 +197,7 @@ private:
// --= Renderer =--
CVABinauralArtificialReverbAudioRenderer::CVABinauralArtificialReverbAudioRenderer( const CVAAudioRendererInitParams& oParams )
: ITADatasourceRealization( 2, oParams.pCore->GetCoreConfig()->oAudioDriverConfig.dSamplerate, oParams.pCore->GetCoreConfig()->oAudioDriverConfig.iBuffersize )
: ITADatasourceRealization( 2, oParams.pCore->GetCoreConfig()->oAudioDriverConfig.dSampleRate, oParams.pCore->GetCoreConfig()->oAudioDriverConfig.iBuffersize )
, CVAObject( oParams.sClass + ":" + oParams.sID )
, m_pCore( oParams.pCore )
, m_pCurSceneState( NULL )
......@@ -212,7 +212,7 @@ CVABinauralArtificialReverbAudioRenderer::CVABinauralArtificialReverbAudioRender
m_pARSimulator = new CBARSimulator( this );
m_pARPathFactory = new CBARPathFactory( GetSamplerate(), GetBlocklength() );
m_pARPathFactory = new CBARPathFactory( GetSampleRate(), GetBlocklength() );
m_pARPathPool = IVAObjectPool::Create( 64, 8, m_pARPathFactory, true );
......@@ -238,7 +238,7 @@ void CVABinauralArtificialReverbAudioRenderer::Init( const CVAStruct& oArgs )
conf.OptNumber( "RoomSurfaceArea", m_dRoomSurfaceArea, 4 * ( 10.0f * 2.0f ) + 2 * ( 2.0f * 2.0f ) );
conf.OptNumber( "SoundPowerCorrectionFactor", m_dSoundPowerCorrectionFactor, 0.05 );
conf.OptInteger( "MaxReverbFilterLengthSamples", m_iMaxReverbFilterLengthSamples, int( 2 * GetSamplerate() ) );
conf.OptInteger( "MaxReverbFilterLengthSamples", m_iMaxReverbFilterLengthSamples, int( 2 * GetSampleRate() ) );
conf.OptNumber( "PositionThreshold", m_dPosThreshold, 1.0f );
conf.OptNumber( "AngleThresholdDegree", m_dAngleThreshold, 30.0f );
......@@ -317,7 +317,7 @@ int CVABinauralArtificialReverbAudioRenderer::CallObject( const CVAStruct& oArgs
if( sValue == "STATUS" )
{
VA_PRINT( "RoomReverberationTime: " << m_dReverberationTime << " seconds" );
VA_PRINT( "MaxReverbFilterLengthSamples: " << m_iMaxReverbFilterLengthSamples << " samples (" << m_iMaxReverbFilterLengthSamples / GetSamplerate() << " seconds)" );
VA_PRINT( "MaxReverbFilterLengthSamples: " << m_iMaxReverbFilterLengthSamples << " samples (" << m_iMaxReverbFilterLengthSamples / GetSampleRate() << " seconds)" );
VA_PRINT( "RoomVolume: " << m_dRoomVolume << " m^3" );
VA_PRINT( "RoomSurfaceArea: " << m_dRoomSurfaceArea << " m^2" );
VA_PRINT( "SoundPowerCorrectionFactor: " << m_dSoundPowerCorrectionFactor << " (linear factor)" );
......@@ -352,10 +352,10 @@ int CVABinauralArtificialReverbAudioRenderer::CallObject( const CVAStruct& oArgs
VA_INFO( "CVABinauralArtificialReverbAudioRenderer", "Set reverberation time to " << m_dReverberationTime );
}
if( m_dReverberationTime * GetSamplerate() > m_iMaxReverbFilterLengthSamples )
if( m_dReverberationTime * GetSampleRate() > m_iMaxReverbFilterLengthSamples )
VA_WARN( "CVABinauralArtificialReverbAudioRenderer",
"Reverberation time greater than target filter length, reverb will be truncated at "
<< m_iMaxReverbFilterLengthSamples / GetSamplerate() << " seconds"
<< m_iMaxReverbFilterLengthSamples / GetSampleRate() << " seconds"
);
m_bForceARUpdateOnce = true;
......@@ -452,7 +452,7 @@ int CVABinauralArtificialReverbAudioRenderer::CallObject( const CVAStruct& oArgs
else if( sValue == "ROOMSURFACEAREA" )
oReturn["Return"] = m_dRoomSurfaceArea;
else if( sValue == "MAXROOMREVERBERATIONTIME" )
oReturn["Return"] = double( m_iMaxReverbFilterLengthSamples / GetSamplerate() );
oReturn["Return"] = double( m_iMaxReverbFilterLengthSamples / GetSampleRate() );
else if( sValue == "MAXREVERBFILTERLENGTHSAMPLES" )
oReturn["Return"] = m_iMaxReverbFilterLengthSamples;
else if( sValue == "SOUNDPOWERCORRECTIONFACTOR" )
......@@ -1212,7 +1212,7 @@ void CVABinauralArtificialReverbAudioRenderer::UpdateArtificialReverbFilter( Lis
assert( dReverberationTime > 0.0f );
const double dSoundPowerCorrectionFactor = m_dSoundPowerCorrectionFactor;
if( ceil( dReverberationTime * GetSamplerate() ) > m_iMaxReverbFilterLengthSamples )
if( ceil( dReverberationTime * GetSampleRate() ) > m_iMaxReverbFilterLengthSamples )
VA_WARN( "CVABinauralArtificialReverbAudioRenderer", "Target filter length smaller than requested reverberation time, truncating." )
ITASampleFrame sfBRIR( 2, m_iMaxReverbFilterLengthSamples, true ); // 0=L, 1=R, TODO member var?
......@@ -1245,7 +1245,7 @@ void CVABinauralArtificialReverbAudioRenderer::UpdateArtificialReverbFilter( Lis
const double dScatterReflectionFactor = 0.75f + ( m_dScatteringCoefficient / 4.0f );
const double dSamplesPerTimeSlot = GetSamplerate() * m_dTimeSlotResolution;
const double dSamplesPerTimeSlot = GetSampleRate() * m_dTimeSlotResolution;
// get time of last image source
const double dTimeLastImageSource = dMeanfreePath / m_dSpeedOfSound;
......@@ -1281,7 +1281,7 @@ void CVABinauralArtificialReverbAudioRenderer::UpdateArtificialReverbFilter( Lis
// calculate reflection density for current block
// calculates reflection density according to kuttruffs equation
double dTime = ( iTimeSlot * iBlockLength + 1) / GetSamplerate();
double dTime = ( iTimeSlot * iBlockLength + 1) / GetSampleRate();
double dCurrentReflectionDensity = 4.0f * ITAConstants::PI_D * m_dSpeedOfSound * m_dSpeedOfSound * m_dSpeedOfSound * dTime * dTime / dRoomVolume;
// if the density exceeds maximumReflectionDensity it will be kept constant at this value
......@@ -1289,7 +1289,7 @@ void CVABinauralArtificialReverbAudioRenderer::UpdateArtificialReverbFilter( Lis
dCurrentReflectionDensity = m_dMaxReflectionDensity;
// calculate reflection density per sample (average scattering also taken into account)
double dCurrentReflectionDensityPerSample = dCurrentReflectionDensity * dScatterReflectionFactor / GetSamplerate();
double dCurrentReflectionDensityPerSample = dCurrentReflectionDensity * dScatterReflectionFactor / GetSampleRate();
// calculate number of diracs in current timeslot
int iNumberDiracsTimeSlot = int( dCurrentReflectionDensityPerSample * iBlockLength );
......@@ -1304,7 +1304,7 @@ void CVABinauralArtificialReverbAudioRenderer::UpdateArtificialReverbFilter( Lis
int iCurrentDiracPosition = iTimeSlot * iBlockLength + int( iBlockLength * rand() / double( RAND_MAX ) );
// calculate absolute position (needed to choose if audible or not)
double dAbsoluteTimePosition = iCurrentDiracPosition / GetSamplerate(); // + fDelayTimeDirectSound;
double dAbsoluteTimePosition = iCurrentDiracPosition / GetSampleRate(); // + fDelayTimeDirectSound;
// get random angles
double dAziAngle = rand() / RAND_MAX * 360.0f;
......@@ -1349,7 +1349,7 @@ void CVABinauralArtificialReverbAudioRenderer::UpdateArtificialReverbFilter( Lis
// insert scattered energy
for( int k=0; k<iNumberOfScatteredPulses; k++ )
{
int iScatterDelayInSamples = int(((k+1)/double(iNumberOfScatteredPulses)) * (2.0f * dAverageLengthRoom / m_dSpeedOfSound * GetSamplerate() ) + rand() % 30 );
int iScatterDelayInSamples = int(((k+1)/double(iNumberOfScatteredPulses)) * (2.0f * dAverageLengthRoom / m_dSpeedOfSound * GetSampleRate() ) + rand() % 30 );
assert( dSpectralEnergyThisSample > 0.0f );
double dCurrentScatterFactor = iRandomSign *
......@@ -1405,7 +1405,7 @@ void CVABinauralArtificialReverbAudioRenderer::UpdateArtificialReverbFilter( Lis
if( fMaxAbs > 1.0f )
{
VA_WARN( "CVABinauralArtificialReverbAudioRenderer", "Reverberation filter clipping detected, normalizing." );
writeAudiofile( "ArtificialReverb_clipping.wav", &sfBRIR, ITA_FLOAT );
writeAudiofile( "ArtificialReverb_clipping.wav", &sfBRIR, GetSampleRate() );
sfBRIR.mul_scalar( 1.0f / fMaxAbs );
}
......
......@@ -237,7 +237,7 @@ private:
// Renderer
CVABinauralFreeFieldAudioRenderer::CVABinauralFreeFieldAudioRenderer( const CVAAudioRendererInitParams& oParams )
: ITADatasourceRealization( 2, oParams.pCore->GetCoreConfig()->oAudioDriverConfig.dSamplerate, oParams.pCore->GetCoreConfig()->oAudioDriverConfig.iBuffersize )
: ITADatasourceRealization( 2, oParams.pCore->GetCoreConfig()->oAudioDriverConfig.dSampleRate, oParams.pCore->GetCoreConfig()->oAudioDriverConfig.iBuffersize )
, CVAObject(oParams.sClass + ":" + oParams.sID)
, m_pCore( oParams.pCore )
, m_pCurSceneState( nullptr )
......@@ -256,7 +256,7 @@ CVABinauralFreeFieldAudioRenderer::CVABinauralFreeFieldAudioRenderer( const CVAA
IVAPoolObjectFactory* pSourceFactory = new CVABFFSourcePoolFactory( m_oDefaultSourceConf );
m_pSourcePool = IVAObjectPool::Create( 16, 2, pSourceFactory, true );
m_pSoundPathFactory = new CVABFFSoundPathFactory( GetSamplerate(), GetBlocklength(), m_iHRIRFilterLength, 128 );
m_pSoundPathFactory = new CVABFFSoundPathFactory( GetSampleRate(), GetBlocklength(), m_iHRIRFilterLength, 128 );
m_pSoundPathPool = IVAObjectPool::Create( 64, 8, m_pSoundPathFactory, true );
......
......@@ -263,11 +263,11 @@ protected:
sOutput = SubstituteMacro(sOutput, "ListenerID", IntToString( pData->iID ) );
ITAAudiofileProperties props;
props.dSamplerate = pCore->GetCoreConfig()->oAudioDriverConfig.dSamplerate;
props.eDomain = ITA_TIME_DOMAIN;
props.eQuantization = ITA_INT24;
props.uiChannels = 2;
props.uiLength = 0;
props.dSampleRate = pCore->GetCoreConfig()->oAudioDriverConfig.dSampleRate;
props.eDomain = ITADomain::ITA_TIME_DOMAIN;
props.eQuantization = ITAQuantization::ITA_FLOAT;
props.iChannels = 2;
props.iLength = 0;
pListenerOutputAudioFileWriter = ITABufferedAudiofileWriter::create(sOutput, props);
}
......
......@@ -633,7 +633,7 @@ bool ComplexSoundPath::IsDirectSoundAudible() const
void ComplexSoundPath::UpdateDirectSound( const bool bDirectSoundAudible )
{
const double dSpeedOfSound = m_pRenderer->GetSpeedOfSound();
const double dSampleRate = m_pRenderer->GetSamplerate();
const double dSampleRate = m_pRenderer->GetSampleRate();
if( bDirectSoundAudible && pSource->pData )
{
......@@ -731,7 +731,7 @@ void ComplexSoundPath::UpdateDirectSound( const bool bDirectSoundAudible )
void ComplexSoundPath::UpdateEarlyReflections( const int iLeadingZeroOffset, const ITASampleFrame* psfFilterPart )
{
const double dSpeedOfSound = m_pRenderer->GetSpeedOfSound();
const double dSampleRate = m_pRenderer->GetSamplerate();
const double dSampleRate = m_pRenderer->GetSampleRate();
assert( dSpeedOfSound > 0 );
float fDirectSoundDelaySamples = (float) ( dSampleRate * oRelations.dDistance / dSpeedOfSound );
......@@ -759,7 +759,7 @@ void ComplexSoundPath::UpdateEarlyReflections( const int iLeadingZeroOffset, con
void ComplexSoundPath::UpdateDiffuseDecay( const int iLeadingZeroOffset, const ITASampleFrame* psfFilterPart )
{
const double dSpeedOfSound = m_pRenderer->GetSpeedOfSound();
const double dSampleRate = m_pRenderer->GetSamplerate();
const double dSampleRate = m_pRenderer->GetSampleRate();
assert( dSpeedOfSound > 0 );
float fDirectSoundDelaySamples = (float) ( dSampleRate * oRelations.dDistance / dSpeedOfSound );
......@@ -1081,8 +1081,9 @@ void ComplexSoundPath::ExportRIR( const std::string& sFileName, const bool bDS/*
sfExport.add_frame( sfRIRDiffuseDecayPart );
m_csRIRDiffuseDecayAssembly.leave();
}
writeAudiofile( sFileName, &sfExport, ITA_FLOAT );
writeAudiofile( sFileName, &sfExport, m_pRenderer->GetSampleRate(), ITAQuantization::ITA_FLOAT );
return;
}
......@@ -1113,7 +1114,7 @@ public:
};
CVARoomAcousticsAudioRenderer::CVARoomAcousticsAudioRenderer(const CVAAudioRendererInitParams& oParams)
: ITADatasourceRealization( 2, oParams.pCore->GetCoreConfig()->oAudioDriverConfig.dSamplerate, oParams.pCore->GetCoreConfig()->oAudioDriverConfig.iBuffersize )
: ITADatasourceRealization( 2, oParams.pCore->GetCoreConfig()->oAudioDriverConfig.dSampleRate, oParams.pCore->GetCoreConfig()->oAudioDriverConfig.iBuffersize )
, CVAObject( "roomrend" )
, m_pCore( oParams.pCore )
, m_oParams( oParams )
......@@ -1142,8 +1143,8 @@ CVARoomAcousticsAudioRenderer::CVARoomAcousticsAudioRenderer(const CVAAudioRende
int iConvolverLength = 22100;
m_pRIRFilterPool = new DSMBCFilterPool( GetBlocklength(), iConvolverLength, 32 );
int iRIRLength = (int)( 9 * GetSamplerate() );
m_pComplexSoundPathFactory = new ComplexSoundPathFactory( GetSamplerate(), GetBlocklength(), iRIRLength, m_pRIRFilterPool );
int iRIRLength = (int)( 9 * GetSampleRate() );
m_pComplexSoundPathFactory = new ComplexSoundPathFactory( GetSampleRate(), GetBlocklength(), iRIRLength, m_pRIRFilterPool );
m_pComplexSoundPathPool = IVAObjectPool::Create( 8, 2, m_pComplexSoundPathFactory, true );
m_pComplexSoundPathPool->SetName( "ComplexSoundPathesPool" );
......@@ -1270,7 +1271,7 @@ CVARoomAcousticsAudioRenderer::CVARoomAcousticsAudioRenderer(const CVAAudioRende
m_pTaskPool->SetName( "Tasks" );
int iThirdOctaveFIRFilterLength = 256;
m_pThirdOctaveFIRFilterGenerator = new CVAThirdOctaveFIRFilterGenerator( m_pCore->GetCoreConfig()->oAudioDriverConfig.dSamplerate, iThirdOctaveFIRFilterLength );
m_pThirdOctaveFIRFilterGenerator = new CVAThirdOctaveFIRFilterGenerator( m_pCore->GetCoreConfig()->oAudioDriverConfig.dSampleRate, iThirdOctaveFIRFilterLength );
m_oRavenConfig.SetDefaults();
......@@ -1599,7 +1600,7 @@ void CVARoomAcousticsAudioRenderer::ProcessStream( const ITAStreamInfo* pStreamI
// Profiling
double fConv = 0, fTaskRequest = 0, fTaskAssign = 0;
double fBudget = m_pCore->GetCoreConfig()->oAudioDriverConfig.iBuffersize / m_pCore->GetCoreConfig()->oAudioDriverConfig.dSamplerate;
double fBudget = m_pCore->GetCoreConfig()->oAudioDriverConfig.iBuffersize / m_pCore->GetCoreConfig()->oAudioDriverConfig.dSampleRate;
// States erstellen
CRavenReceiverState oGenericReceiverState;
......
......@@ -198,7 +198,7 @@ private:
// Renderer
CVAMonauralFreeFieldAudioRenderer::CVAMonauralFreeFieldAudioRenderer( const CVAAudioRendererInitParams& oParams )
: ITADatasourceRealization( 1, oParams.pCore->GetCoreConfig()->oAudioDriverConfig.dSamplerate, oParams.pCore->GetCoreConfig()->oAudioDriverConfig.iBuffersize )
: ITADatasourceRealization( 1, oParams.pCore->GetCoreConfig()->oAudioDriverConfig.dSampleRate, oParams.pCore->GetCoreConfig()->oAudioDriverConfig.iBuffersize )
, CVAObject(oParams.sClass + ":" + oParams.sID)
, m_pCore( oParams.pCore )
, m_pCurSceneState( nullptr )
......@@ -216,7 +216,7 @@ CVAMonauralFreeFieldAudioRenderer::CVAMonauralFreeFieldAudioRenderer( const CVAA
IVAPoolObjectFactory* pSourceFactory = new CVAMFFSourcePoolFactory( m_oDefaultSourceConf );
m_pSourcePool = IVAObjectPool::Create( 16, 2, pSourceFactory, true );
m_pSoundPathFactory = new CVAMFFSoundPathFactory( GetSamplerate(), GetBlocklength(), 128 );
m_pSoundPathFactory = new CVAMFFSoundPathFactory( GetSampleRate(), GetBlocklength(), 128 );
m_pSoundPathPool = IVAObjectPool::Create( 64, 8, m_pSoundPathFactory, true );
......@@ -818,11 +818,11 @@ CVAMonauralFreeFieldAudioRenderer::CVAMFFListener* CVAMonauralFreeFieldAudioRend
if (m_bDumpListenerOutputSignals) {
std::string sFilename = "Listener" + IntToString(pListener->pData->iID) + ".wav";
ITAAudiofileProperties props;
props.dSamplerate = m_pCore->GetCoreConfig()->oAudioDriverConfig.dSamplerate;
props.eDomain = ITA_TIME_DOMAIN;
props.eQuantization = ITA_INT24;
props.uiChannels = 1;
props.uiLength = 0;
props.dSampleRate = m_pCore->GetCoreConfig()->oAudioDriverConfig.dSampleRate;
props.eDomain = ITADomain::ITA_TIME_DOMAIN;
props.eQuantization = ITAQuantization::ITA_FLOAT;
props.iChannels = 1;
props.iLength = 0;
pListener->pListenerOutputAudioFileWriter = ITABufferedAudiofileWriter::create(sFilename, props);
}
......
......@@ -19,7 +19,7 @@ CVAPTDummyAudioRenderer::CVAPTDummyAudioRenderer( const CVAAudioRendererInitPara
VA_EXCEPT2( INVALID_PARAMETER, "DummyAudioRenderer: '" + sOutput + "' is not a valid hardware output group. Disabled?" );
int iNumChannels = int( pOutput->GetPhysicalOutputChannels().size() );
double dSampleRate = oParams.pCore->GetCoreConfig()->oAudioDriverConfig.dSamplerate;
double dSampleRate = oParams.pCore->GetCoreConfig()->oAudioDriverConfig.dSampleRate;
int iBlockLength = oParams.pCore->GetCoreConfig()->oAudioDriverConfig.iBuffersize;
m_pDataSource = new ITADatasourceRealization( iNumChannels, dSampleRate, iBlockLength );
m_pDataSource->SetStreamEventHandler( this );
......
......@@ -153,7 +153,7 @@ CVAPTGenericPathAudioRenderer::CVAPTGenericPathAudioRenderer( const CVAAudioRend
// read config
Init( *oParams.pConfig );
m_pOutput = new ITADatasourceRealization( m_iNumChannels, oParams.pCore->GetCoreConfig()->oAudioDriverConfig.dSamplerate, oParams.pCore->GetCoreConfig()->oAudioDriverConfig.iBuffersize );
m_pOutput = new ITADatasourceRealization( m_iNumChannels, oParams.pCore->GetCoreConfig()->oAudioDriverConfig.dSampleRate, oParams.pCore->GetCoreConfig()->oAudioDriverConfig.iBuffersize );
m_pOutput->SetStreamEventHandler( this );
IVAPoolObjectFactory* pListenerFactory = new CVAPTGPListenerPoolFactory( m_pCore );
......@@ -162,7 +162,7 @@ CVAPTGenericPathAudioRenderer::CVAPTGenericPathAudioRenderer( const CVAAudioRend
IVAPoolObjectFactory* pSourceFactory = new CVAPTGPSourcePoolFactory();
m_pSourcePool = IVAObjectPool::Create( 16, 2, pSourceFactory, true );
m_pSoundPathFactory = new CVAPTGenericSoundPathFactory( m_pOutput->GetSamplerate(), m_pOutput->GetBlocklength(), m_iNumChannels, m_iIRFilterLengthSamples );
m_pSoundPathFactory = new CVAPTGenericSoundPathFactory( m_pOutput->GetSampleRate(), m_pOutput->GetBlocklength(), m_iNumChannels, m_iIRFilterLengthSamples );
m_pSoundPathPool = IVAObjectPool::Create( 64, 8, m_pSoundPathFactory, true );
......@@ -820,7 +820,7 @@ void CVAPTGenericPathAudioRenderer::HandleProcessStream( ITADatasourceRealizatio
bDataPresent = true;
}
if( m_bOutputMonitoring && int( pStreamInfo->nSamples / m_pOutput->GetBlocklength() ) % int( m_pOutput->GetSamplerate() / m_pOutput->GetBlocklength() * 2.0f ) == 0 )
if( m_bOutputMonitoring && int( pStreamInfo->nSamples / m_pOutput->GetBlocklength() ) % int( m_pOutput->GetSampleRate() / m_pOutput->GetBlocklength() * 2.0f ) == 0 )
{
if( bDataPresent )
{
......
......@@ -250,7 +250,7 @@ private:
// Renderer
// oParams.pCore->GetCoreConfig()->oAudioDriverConfig.iOutputChannels
CVAPTHearingAidRenderer::CVAPTHearingAidRenderer( const CVAAudioRendererInitParams& oParams )
: ITADatasourceRealization(4, oParams.pCore->GetCoreConfig()->oAudioDriverConfig.dSamplerate, oParams.pCore->GetCoreConfig()->oAudioDriverConfig.iBuffersize )
: ITADatasourceRealization(4, oParams.pCore->GetCoreConfig()->oAudioDriverConfig.dSampleRate, oParams.pCore->GetCoreConfig()->oAudioDriverConfig.iBuffersize )
, CVAObject(oParams.sClass + ":" + oParams.sID)
, m_pCore( oParams.pCore )
, m_pCurSceneState( nullptr )
......@@ -273,7 +273,7 @@ CVAPTHearingAidRenderer::CVAPTHearingAidRenderer( const CVAAudioRendererInitPara
VA_EXCEPT2( INVALID_PARAMETER, "CVAPTHearingAidRenderer: Number of HARIR channels is greater than maximum output channels of sound card" );
m_pSoundPathFactory = new CVAPTHASoundPathFactory(
GetSamplerate(),
GetSampleRate(),
GetBlocklength(),
m_iHRIRFilterLength,
128,
......
......@@ -262,11 +262,11 @@ protected:
sOutput = SubstituteMacro(sOutput, "ListenerID", IntToString(pData->iID));
ITAAudiofileProperties props;
props.dSamplerate = m_pCore->GetCoreConfig()->oAudioDriverConfig.dSamplerate;
props.eDomain = ITA_TIME_DOMAIN;
props.eQuantization = ITA_INT24;
props.uiChannels = 2;
props.uiLength = 0;
props.dSampleRate = m_pCore->GetCoreConfig()->oAudioDriverConfig.dSampleRate;
props.eDomain = ITADomain::ITA_TIME_DOMAIN;
props.eQuantization = ITAQuantization::ITA_FLOAT;
props.iChannels = 2;
props.iLength = 0;
pListenerOutputAudioFileWriter = ITABufferedAudiofileWriter::create(sOutput, props);
}
......
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