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

Merge branch 'develop' of https://git.rwth-aachen.de/ita/ITABase into develop

parents 49ed1166 f8158b0a
......@@ -92,6 +92,9 @@ public:
//! Copy from another Spectra
void CopyFrom(const ITAHDFTSpectra* otherSpectra);
//! Returns maximum energy from all spectra
float GetMaxEnergy( int* piChannelIndex = nullptr ) const;
//! Subscript operator gives direct access to spectrum channel
const ITAHDFTSpectrum* operator[]( const int ) const;
ITAHDFTSpectrum* operator[]( const int );
......
#include <ITAHDFTSpectra.h>
#include <ITAAudiofileWriter.h>
#include <ITAConstants.h>
#include <ITAFilesystemUtils.h>
#include <ITAHDFTSpectrum.h>
#include <ITASampleFrame.h>
......@@ -41,6 +42,23 @@ ITAHDFTSpectra::~ITAHDFTSpectra()
delete m_vpSpectra[i];
}
float ITAHDFTSpectra::GetMaxEnergy( int* piIdx ) const
{
float fEnergyTemp;
float fEnergyMax = -1.0f;
for (size_t n = 0; n < m_vpSpectra.size(); n++)
{
fEnergyTemp = m_vpSpectra[n]->getEnergy();
if (fEnergyTemp > fEnergyMax)
{
fEnergyMax = fEnergyTemp;
*piIdx = n;
}
}
return fEnergyMax;
}
void ITAHDFTSpectra::CopyFrom(const ITAHDFTSpectra *otherSpectra)
{
int iNumChannels=otherSpectra->GetNumChannels();
......
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