Refacotirng GetSamplerate to GetSampleRate (big caps R).

parent dc82c549
......@@ -193,7 +193,7 @@ public:
unsigned int GetBlocklength() const;
unsigned int GetNumberOfChannels() const;
double GetSamplerate() const;
double GetSampleRate() const;
const float* GetBlockPointer(unsigned int uiChannel, const ITAStreamInfo* pStreamInfo);
void IncrementBlockPointer();
......
......@@ -54,7 +54,7 @@
2.02 18.1.2005 Warten auf neue Daten in GetBlockPointer() hinzugefügt,
Dokumentation vervollständigt
2.01 14.1.2005 Samplerate hinzugefügt, sowie GetSamplerate()
2.01 14.1.2005 Samplerate hinzugefügt, sowie GetSampleRate()
2.00 12.1.2005 Die neue Klasse ITADatasource als verbesserte,
bereinigte Version der alt-eingesessenen DataSource-Klasse.
......@@ -177,7 +177,7 @@ public:
* \note Falls die Samplerate der Datenquelle noch nicht feststeht,
* wird 0 zurückgegeben (siehe Klassenbeschreibung).
*/
virtual double GetSamplerate() const=0;
virtual double GetSampleRate() const=0;
//! Blockzeiger abrufen
/**
......
......@@ -49,8 +49,8 @@ public:
return m_pDatasourceDelegatorTarget->GetNumberOfChannels();
}
double GetSamplerate() const {
return m_pDatasourceDelegatorTarget->GetSamplerate();
double GetSampleRate() const {
return m_pDatasourceDelegatorTarget->GetSampleRate();
}
virtual const float* GetBlockPointer(unsigned int uiChannel, const ITAStreamInfo* pStreamInfo) {
......
......@@ -110,7 +110,7 @@ public:
const ITAStreamProperties* GetStreamProperties() const { return &m_oStreamProps; }
unsigned int GetBlocklength() const { return m_uiBlocklength; }
unsigned int GetNumberOfChannels() const { return m_uiChannels; }
double GetSamplerate() const { return m_dSamplerate; }
double GetSampleRate() const { return m_dSampleRate; }
virtual const float* GetBlockPointer(unsigned int uiChannel, const ITAStreamInfo* pStreamInfo);
virtual void IncrementBlockPointer();
......@@ -164,7 +164,7 @@ protected:
* Tipparbeit in Unterklassen. Bitte diese Werte aber
* nur lesend [read-only] benutzen!!
*/
double m_dSamplerate; // Abtastrate [Hz]
double m_dSampleRate; // Abtastrate [Hz]
unsigned int m_uiChannels; // Anzahl Kanle
unsigned int m_uiBlocklength; // Streaming Puffergre [Samples]
......
......@@ -48,9 +48,9 @@ public:
*
* \note Bei Fehlern werden ITAExceptions aufgelst.
*/
ITAFileDatasink(std::string sFilename,
ITADatasource* pdsSource,
ITAQuantization eQuantization=ITA_INT16);
ITAFileDatasink( std::string sFilename,
ITADatasource* pdsSource,
ITAQuantization eQuantization = ITAQuantization::ITA_FLOAT );
//! Destruktor
virtual ~ITAFileDatasink();
......
......@@ -142,7 +142,7 @@ public:
unsigned int GetBlocklength() const { return m_uiBlocklength; }
unsigned int GetNumberOfChannels() const { return m_uiChannels; }
double GetSamplerate() const { return m_dSamplerate; }
double GetSampleRate() const { return m_dSamplerate; }
virtual const float* GetBlockPointer(unsigned int uiChannel, const ITAStreamInfo* pStreamInfo);
virtual void IncrementBlockPointer();
......
......@@ -15,7 +15,6 @@
* ----------------------------------------------------------------
*
*/
// $Id: ITAStreamProbe.h 2900 2012-09-17 08:42:42Z stienen $
#ifndef INCLUDE_WATCHER_ITA_STREAM_PROBE
#define INCLUDE_WATCHER_ITA_STREAM_PROBE
......@@ -36,7 +35,8 @@ class ITAAudiofileWriter;
* Instanzen der Klasse ITAStreamProbe knnen als "Messspitze" in Audiostreams
* eingehngt werden. Sie schreiben dann alle vorbeigeflossenen Daten in eine Audiodatei.
*/
class ITA_DATA_SOURCES_API ITAStreamProbe : public ITADatasource {
class ITA_DATA_SOURCES_API ITAStreamProbe : public ITADatasource
{
public:
//! Konstruktor
/**
......@@ -44,7 +44,7 @@ public:
*
* \note Es darf kein Nullzeiger bergeben werden.
*/
ITAStreamProbe(ITADatasource* pDatasource, const std::string& sFilename, ITAQuantization iQuantization=ITA_INT16);
ITAStreamProbe( ITADatasource* pDatasource, const std::string& sFilename, ITAQuantization iQuantization = ITAQuantization::ITA_FLOAT );
//! Destruktor
virtual ~ITAStreamProbe();
......@@ -62,7 +62,7 @@ public:
unsigned int GetBlocklength() const;
unsigned int GetNumberOfChannels() const;
double GetSamplerate() const;
double GetSampleRate() const;
virtual const float* GetBlockPointer(unsigned int uiChannel, const ITAStreamInfo* pStreamInfo);
virtual void IncrementBlockPointer();
......
......@@ -1051,7 +1051,7 @@ ITASIO_API ASIOError ITAsioSetPlaybackDatasource(ITADatasource* pidsDatasource)
if ((long) pidsDatasource->GetNumberOfChannels() != asioDriverInfo.outputBuffers)
ITA_EXCEPT1(MODAL_EXCEPTION, "Datasource has invalid number of channels");
if (ASIOSampleRate(pidsDatasource->GetSamplerate()) != asioDriverInfo.sampleRate)
if (ASIOSampleRate(pidsDatasource->GetSampleRate()) != asioDriverInfo.sampleRate)
ITA_EXCEPT1(MODAL_EXCEPTION, "Datasource has invalid samplerate");
if ((long) pidsDatasource->GetBlocklength() != lBuffersize)
......
......@@ -96,7 +96,7 @@ void ITABufferDatasink::Transfer(unsigned int uiSamples) {
m_uiWriteCursor += m;
m_siState.nSamples += b;
m_siState.dTimecode = (double) (m_siState.nSamples) / m_pdsSource->GetSamplerate();
m_siState.dTimecode = (double) (m_siState.nSamples) / m_pdsSource->GetSampleRate();
}
}
}
......@@ -253,7 +253,7 @@ unsigned int ITABufferDatasource::GetNumberOfChannels() const {
return m_uiChannels;
}
double ITABufferDatasource::GetSamplerate() const {
double ITABufferDatasource::GetSampleRate() const {
return m_dSamplerate;
}
......
......@@ -19,7 +19,7 @@ ITADatasourceRealization::ITADatasourceRealization(unsigned int uiChannels,
unsigned int uiCapacity)
{
assert( dSamplerate > 0 );
m_dSamplerate = dSamplerate;
m_dSampleRate = dSamplerate;
m_oStreamProps.dSamplerate = dSamplerate;
Init(uiChannels, uiBlocklength, uiCapacity);
......@@ -45,7 +45,7 @@ void ITADatasourceRealization::Init(unsigned int uiChannels,
m_uiChannels = uiChannels;
m_uiBlocklength = uiBlocklength;
m_oStreamProps.dSamplerate = m_dSamplerate;
m_oStreamProps.dSamplerate = m_dSampleRate;
m_oStreamProps.uiChannels = m_uiChannels;
m_oStreamProps.uiBlocklength = m_uiBlocklength;
......
......@@ -26,7 +26,7 @@ void WriteFromDatasourceToBuffer(ITADatasource* pSource,
if (!pSource) return;
unsigned int uiChannels = pSource->GetNumberOfChannels();
double dSamplerate = pSource->GetSamplerate();
double dSamplerate = pSource->GetSampleRate();
unsigned int uiBlocklength = pSource->GetBlocklength();
ITAStreamInfo siState;
......@@ -110,18 +110,18 @@ void WriteFromDatasourceToFile(ITADatasource* pSource,
unsigned int uiChannels = pSource->GetNumberOfChannels();
unsigned int uiBlocklength = pSource->GetBlocklength();
double dSamplerate = pSource->GetSamplerate();
double dSamplerate = pSource->GetSampleRate();
std::vector<float*> vpfData;
for (unsigned int i=0; i<uiChannels; i++)
vpfData.push_back(new float[uiBlocklength]);
ITAAudiofileProperties props;
props.uiChannels = uiChannels;
props.dSamplerate = dSamplerate;
props.eQuantization = ITA_INT16;
props.eDomain = ITA_TIME_DOMAIN;
props.uiLength = uiNumberOfSamples;
props.iChannels = uiChannels;
props.dSampleRate = dSamplerate;
props.eQuantization = ITAQuantization::ITA_FLOAT;
props.eDomain = ITADomain::ITA_TIME_DOMAIN;
props.iLength = uiNumberOfSamples;
ITAAudiofileWriter* writer = ITAAudiofileWriter::create(sFilename, props);
ITAStreamInfo siState;
......
......@@ -4,50 +4,50 @@
#include <ITADataSource.h>
#include <ITAAudiofileWriter.h>
#include <ITANumericUtils.h>
ITAFileDatasink::ITAFileDatasink(std::string sFilename, ITADatasource* pdsSource, ITAQuantization eQuantization)
: m_pfSilence(NULL) {
ITAFileDatasink::ITAFileDatasink( std::string sFilename, ITADatasource* pdsSource, ITAQuantization eQuantization )
: m_pfSilence( NULL ) {
m_pdsSource = pdsSource;
m_pFileWriter = NULL;
if (pdsSource) {
m_vpfData.resize(pdsSource->GetNumberOfChannels());
if( pdsSource ) {
m_vpfData.resize( pdsSource->GetNumberOfChannels() );
ITAAudiofileProperties props;
props.uiChannels = pdsSource->GetNumberOfChannels();
props.dSamplerate = pdsSource->GetSamplerate();
props.eDomain = ITA_TIME_DOMAIN;
props.iChannels = pdsSource->GetNumberOfChannels();
props.dSampleRate = pdsSource->GetSampleRate();
props.eDomain = ITADomain::ITA_TIME_DOMAIN;
props.eQuantization = eQuantization;
m_pFileWriter = ITAAudiofileWriter::create(sFilename, props);
m_pfSilence = fm_falloc(pdsSource->GetBlocklength(), true);
m_pFileWriter = ITAAudiofileWriter::create( sFilename, props );
m_pfSilence = fm_falloc( pdsSource->GetBlocklength(), true );
}
}
ITAFileDatasink::~ITAFileDatasink() {
delete m_pFileWriter;
fm_free(m_pfSilence);
fm_free( m_pfSilence );
}
void ITAFileDatasink::Transfer(unsigned int uiSamples) {
if (m_pdsSource) {
void ITAFileDatasink::Transfer( unsigned int uiSamples ) {
if( m_pdsSource ) {
// Anzahl der zu transferrierenden Blcke bestimmen
unsigned int b = m_pdsSource->GetBlocklength();
unsigned int n = uprdivu(uiSamples, b);
unsigned int n = uprdivu( uiSamples, b );
for (unsigned int i=0; i<n; i++) {
for (unsigned int j=0; j<m_pdsSource->GetNumberOfChannels(); j++) {
const float* pfSrc = m_pdsSource->GetBlockPointer(j, &m_siState);
if (pfSrc)
m_vpfData[j] = (float*) pfSrc;
for( unsigned int i = 0; i < n; i++ ) {
for( unsigned int j = 0; j < m_pdsSource->GetNumberOfChannels(); j++ ) {
const float* pfSrc = m_pdsSource->GetBlockPointer( j, &m_siState );
if( pfSrc )
m_vpfData[ j ] = ( float* ) pfSrc;
else
m_vpfData[j] = m_pfSilence;
m_vpfData[ j ] = m_pfSilence;
}
m_pdsSource->IncrementBlockPointer();
m_siState.nSamples += b;
m_siState.dTimecode = (double) (m_siState.nSamples) / m_pdsSource->GetSamplerate();
m_siState.dTimecode = ( double ) ( m_siState.nSamples ) / m_pdsSource->GetSampleRate();
m_pFileWriter->write(b, m_vpfData);
m_pFileWriter->write( b, m_vpfData );
}
}
}
......@@ -19,7 +19,7 @@ ITAFileDatasource::ITAFileDatasource(std::string sFilename,
// TODO: Ausnahme auslsen, falls Spektraldaten!
ITAAudiofileReader* pReader = ITAAudiofileReader::create(sFilename);
ITAAudiofileProperties props = pReader->getAudiofileProperties();
m_uiFileCapacity = props.uiLength;
m_uiFileCapacity = props.iLength;
if (m_uiFileCapacity > 0) {
// Lnge auf Vielfaches der Blocklnge erweitern
......@@ -28,7 +28,7 @@ ITAFileDatasource::ITAFileDatasource(std::string sFilename,
unsigned int uiCapacity = k * uiBlocklength;
// Datenpuffer allozieren und Daten hinein kopieren
for (unsigned int i=0; i<props.uiChannels; i++) {
for ( int i=0; i<props.iChannels; i++) {
// TODO: Fehlerbehandlung!
float* pfData = new float[uiCapacity];
......@@ -38,10 +38,10 @@ ITAFileDatasource::ITAFileDatasource(std::string sFilename,
vpfData.push_back(pfData);
}
pReader->read(props.uiLength, vpfData);
pReader->read(props.iLength, vpfData);
// Unterliegende Puffer-Datenquelle initialisieren
Init(vpfData, uiCapacity, props.dSamplerate, uiBlocklength, bLoopMode);
Init(vpfData, uiCapacity, props.dSampleRate, uiBlocklength, bLoopMode);
}
delete pReader;
......
......@@ -7,7 +7,7 @@
ITAPeakDetector::ITAPeakDetector(ITADatasource* pDatasource)
{
m_pDatasource = pDatasource;
m_dSamplerate = pDatasource->GetSamplerate();
m_dSamplerate = pDatasource->GetSampleRate();
m_uiChannels = pDatasource->GetNumberOfChannels();
m_uiBlocklength = pDatasource->GetBlocklength();
m_pfPeaks = 0;
......
......@@ -407,7 +407,7 @@ ITAPortaudioInterface::ITA_PA_ERRORCODE ITAPortaudioInterface::SetPlaybackDataso
if (pidsDatasource->GetBlocklength() != m_iBufferSize)
return ITA_PA_UNMATCHED_BUFFER_SIZE;
if (pidsDatasource->GetSamplerate() != m_dSampleRate)
if (pidsDatasource->GetSampleRate() != m_dSampleRate)
return ITA_PA_UNMATCHED_SAMPLE_RATE;
m_oUserData.pdsPlaybackDatasource = pidsDatasource;
......
......@@ -9,7 +9,7 @@
ITAStreamAmplifier::ITAStreamAmplifier(ITADatasource* pdsInput, float fInitialGain)
: ITADatasourceRealization(pdsInput->GetNumberOfChannels(),
pdsInput->GetSamplerate(),
pdsInput->GetSampleRate(),
pdsInput->GetBlocklength()),
m_pInputDatasource(pdsInput),
m_bMuted(false),
......
......@@ -58,13 +58,13 @@ void ITAStreamFunctionGenerator::SetFunction(int iFunction)
double ITAStreamFunctionGenerator::GetFrequency() const
{
return m_dSamplerate / (double) m_iPeriodLengthSamples;
return m_dSampleRate / (double) m_iPeriodLengthSamples;
}
void ITAStreamFunctionGenerator::SetFrequency(double dFrequency)
{
assert( dFrequency >= 0 );
m_iPeriodLengthSamples = (int) round( m_dSamplerate / dFrequency );
m_iPeriodLengthSamples = (int) round( m_dSampleRate / dFrequency );
}
int ITAStreamFunctionGenerator::GetPeriodAsSamples() const
......@@ -80,12 +80,12 @@ void ITAStreamFunctionGenerator::SetPeriodAsSamples(int iNumSamples)
double ITAStreamFunctionGenerator::GetPeriodAsTime() const
{
return (double) m_iPeriodLengthSamples / m_dSamplerate;
return (double) m_iPeriodLengthSamples / m_dSampleRate;
}
void ITAStreamFunctionGenerator::SetPeriodAsTime(double dPeriodLength)
{
m_iPeriodLengthSamples = (int) round(dPeriodLength * m_dSamplerate);
m_iPeriodLengthSamples = (int) round(dPeriodLength * m_dSampleRate);
}
bool ITAStreamFunctionGenerator::IsPeriodic() const
......
......@@ -14,7 +14,7 @@
using namespace std;
ITAStreamMultiplier1N::ITAStreamMultiplier1N(ITADatasource* pdsInput,int iOutputChannels, unsigned int uiFadeLength)
: ITADatasourceRealization(iOutputChannels, pdsInput->GetSamplerate(), pdsInput->GetBlocklength()),
: ITADatasourceRealization(iOutputChannels, pdsInput->GetSampleRate(), pdsInput->GetBlocklength()),
m_pInputDatasource(pdsInput),
m_bMuted(false),
m_iOutputChannels(iOutputChannels),
......
......@@ -148,7 +148,7 @@ void ITAStreamPatchbay::SetInputDatasource( const int iInput, ITADatasource* pds
int channels = pdsDatasource->GetNumberOfChannels();
if (pdsDatasource->GetNumberOfChannels() != m_vpInputs[iInput]->iChannels)
ITA_EXCEPT1(INVALID_PARAMETER, "Datasource properties do not match the input properties (num channel missmatch");
if (pdsDatasource->GetSamplerate() != m_dSamplerate)
if (pdsDatasource->GetSampleRate() != m_dSamplerate)
ITA_EXCEPT1(INVALID_PARAMETER, "Datasource properties do not match the input properties (samplerate missmatch");
if (pdsDatasource->GetBlocklength() != m_iBlockLength)
ITA_EXCEPT1(INVALID_PARAMETER, "Datasource properties do not match the input properties (blocklength missmatch)");
......
......@@ -14,14 +14,14 @@ ITAStreamProbe::ITAStreamProbe(ITADatasource* pDatasource, const std::string& sF
m_pDatasource = pDatasource;
m_sFilename = sFilename;
m_dSamplerate = pDatasource->GetSamplerate();
m_dSamplerate = pDatasource->GetSampleRate();
m_uiChannels = pDatasource->GetNumberOfChannels();
m_uiBlocklength = pDatasource->GetBlocklength();
ITAAudiofileProperties props;
props.uiChannels = m_uiChannels;
props.dSamplerate = m_dSamplerate;
props.eDomain = ITA_TIME_DOMAIN;
props.iChannels = m_uiChannels;
props.dSampleRate = m_dSamplerate;
props.eDomain = ITADomain::ITA_TIME_DOMAIN;
props.eQuantization = iQuantization;
m_pWriter = ITABufferedAudiofileWriter::create(sFilename, props);
......@@ -51,7 +51,7 @@ unsigned int ITAStreamProbe::GetNumberOfChannels() const {
return m_uiChannels;
}
double ITAStreamProbe::GetSamplerate() const {
double ITAStreamProbe::GetSampleRate() const {
return m_dSamplerate;
}
......
......@@ -3,7 +3,7 @@
#include <ITADataSource.h>
ITAStreamPump::ITAStreamPump(ITADatasource* pDatasource) : m_pDatasource(pDatasource), m_pTimer(NULL) {
m_pTimer = new ITATimer( (double) pDatasource->GetBlocklength() / pDatasource->GetSamplerate(), true);
m_pTimer = new ITATimer( (double) pDatasource->GetBlocklength() / pDatasource->GetSampleRate(), true);
m_pTimer->attach(this);
m_uiChannels = pDatasource->GetNumberOfChannels();
}
......@@ -26,6 +26,6 @@ void ITAStreamPump::handleTimerEvent(const ITATimer& tSource) {
m_pDatasource->IncrementBlockPointer();
m_siState.nSamples += m_pDatasource->GetBlocklength();
m_siState.dTimecode = (double) (m_siState.nSamples) / m_pDatasource->GetSamplerate();
m_siState.dTimecode = (double) (m_siState.nSamples) / m_pDatasource->GetSampleRate();
}
}
......@@ -8,7 +8,7 @@ ITAStreamYJunction::ITAStreamYJunction(unsigned int uiOutputs, ITADatasource* pd
if (uiOutputs == 0)
ITA_EXCEPT1(INVALID_PARAMETER, "The number of outputs must at least be one");
m_pImpl = new ITAStreamPatchbay(pdsInput->GetSamplerate(), pdsInput->GetBlocklength());
m_pImpl = new ITAStreamPatchbay(pdsInput->GetSampleRate(), pdsInput->GetBlocklength());
m_pImpl->AddInput(pdsInput->GetNumberOfChannels());
m_pImpl->SetInputDatasource(0, pdsInput);
for (unsigned int i=0; i<uiOutputs; i++) {
......
......@@ -25,7 +25,7 @@ int main(int argc, char* argv[]) {
printf("Channels: %d\n", source.GetNumberOfChannels());
printf("Capacity: %d Samples\n", source.GetCapacity());
printf("File capacity: %d Samples\n", source.GetFileCapacity());
printf("Samplerate: %0.3f KHz\n", source.GetSamplerate()/1000);
printf("Samplerate: %0.3f KHz\n", source.GetSampleRate()/1000);
printf("\nOutput file: \"%s\"\n", argv[2]);
......
......@@ -23,7 +23,7 @@ int main(int argc, char* argv[]) {
printf("Channels: %d\n", pSource->GetNumberOfChannels());
printf("Capacity: %d Samples\n", ((ITAFileDatasource*) pSource)->GetCapacity());
printf("File capacity: %d Samples\n", ((ITAFileDatasource*) pSource)->GetFileCapacity());
printf("Samplerate: %0.3f KHz\n", pSource->GetSamplerate()/1000);
printf("Samplerate: %0.3f KHz\n", pSource->GetSampleRate()/1000);
/* unsigned int n=1;
while (pSource->GetCursor() < pSource->GetCapacity()) {
......
......@@ -43,7 +43,7 @@ int main(int argc, char* argv[]) {
std::string sFilePath = correctPath( argv[2] );
ITAFileDatasource source( sFilePath, (signed int) lBuffersize, false);
if (ITAsioSetSampleRate((ASIOSampleRate) source.GetSamplerate()) != ASE_OK) {
if (ITAsioSetSampleRate((ASIOSampleRate) source.GetSampleRate()) != ASE_OK) {
ITAsioFinalizeLibrary();
fprintf(stderr, "Fehler: ITAsioSetSamplerate schlug fehl!\n");
......@@ -66,7 +66,7 @@ int main(int argc, char* argv[]) {
return 255;
}
ITAStreamPatchbay patchbay( source.GetSamplerate(), lBuffersize );
ITAStreamPatchbay patchbay( source.GetSampleRate(), lBuffersize );
patchbay.AddInput( &source );
patchbay.AddOutput( int( lNumOutputChannels ) );
......
......@@ -28,7 +28,7 @@ int main(int , char** )
catch (ITAException& e)
{
cerr << "Could open audio file, error = " << e << endl;
pSource = new ITAStreamFunctionGenerator(1, dSampleRate, iBlockSize, ITAStreamFunctionGenerator::SINE, 300, 0.9, true);
pSource = new ITAStreamFunctionGenerator(1, dSampleRate, iBlockSize, ITAStreamFunctionGenerator::SINE, 300, 0.9f, true);
}
// Instantiate
......
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