Aufgrund einer Wartung wird GitLab am 19.10. zwischen 8:00 und 9:00 Uhr kurzzeitig nicht zur Verfügung stehen. / Due to maintenance, GitLab will be temporarily unavailable on 19.10. between 8:00 and 9:00 am.

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

Renaming signal sources special methods and moving on to signal source buffers instead of audiofile

parent 80dfbd66
......@@ -16,8 +16,10 @@
#include <VABaseDefinitions.h>
#include <VABase.h>
#include <VASamples.h>
#include <string>
#include <vector>
/*!
......@@ -152,6 +154,7 @@ public:
*/
virtual ~IVACore();
//! Returns the core version
virtual void GetVersionInfo( CVACoreVersionInfo* pVersionInfo ) const = 0;
......@@ -203,6 +206,7 @@ public:
*/
virtual void Reset() = 0;
//! Attaches a handler for core events to the core instance
/**
* @note Attaching event handlers it always possible,
......@@ -224,12 +228,14 @@ public:
*/
virtual void DetachCoreEventHandler( IVACoreEventHandler* pCoreEventHandler ) = 0;
//! Get all registered modules of the core
virtual void GetModules( std::vector< CVAModuleInfo >& voModuleInfos ) const = 0;
//! Calls a module and returns the answer
virtual CVAStruct CallModule( const std::string& sModuleName, const CVAStruct& oArgs ) = 0;
//! Adds a search path to the core instance
/**
* \param sPath Local relative or absolute path
......@@ -240,6 +246,7 @@ public:
//! Returns a struct with entries for each search paths
virtual CVAStruct GetSearchPaths() const = 0;
virtual int CreateDirectivityFromParameters( const CVAStruct& oParams, const std::string& sName = "" ) = 0;
//! Create a directivity from a file path
inline int CreateDirectivityFromFile( const std::string& sFilePath, const std::string& sName = "" )
......@@ -304,7 +311,38 @@ public:
*
* \return Signal source ID
*/
virtual std::string CreateAudiofileSignalSource( const std::string& sFilePath, const std::string& sName = "" ) = 0;
inline std::string CreateSignalSourceBufferFromFile(const std::string& sFilePath, const std::string& sName = "")
{
CVAStruct oParams;
oParams["filepath"] = sFilePath;
return CreateSignalSourceBufferFromParameters(oParams, sName);
};
//! Creates an audiofile signal source
/**
* Creates a signal source which streams the samples of an audiofile.
* The audiofile must be mono and its sampling rate must match that
* of the core.
*
* \param sFilePath Filename/path
* \param sName Name (optional, e.g. "Trumpet")
*
* \return Signal source ID
*/
virtual std::string CreateSignalSourceBufferFromSamples(const CVASampleBuffer& oSamples, const std::string& sName = "")
{
CVAStruct oParams;
oParams["samples"]["ch1"] = oSamples;
return CreateSignalSourceBufferFromParameters(oParams, sName);
};
virtual std::string CreateSignalSourceBufferMultichannelFromSamples( const std::vector< CVASampleBuffer >& voSamples, const std::string& sName = "")
{
CVAStruct oParams;
for (size_t i = 0; i < voSamples.size(); i++)
oParams["samples"]["ch" + std::to_string(long(i+1))] = voSamples[i];
return CreateSignalSourceBufferFromParameters(oParams, sName);
};
virtual std::string CreateSignalSourceBufferFromParameters(const CVAStruct& oParams, const std::string& sName = "") = 0;
//! Creates a text-to-speech (TTS) signal source
/**
......@@ -314,7 +352,7 @@ public:
*
* @return Signal source ID
*/
virtual std::string CreateTextToSpeechSignalSource( const std::string& sName = "" ) = 0;
virtual std::string CreateSignalSourceTextToSpeech( const std::string& sName = "" ) = 0;
//! Creates a sequencer signal source
/**
......@@ -324,7 +362,7 @@ public:
*
* \return Signal source ID
*/
virtual std::string CreateSequencerSignalSource( const std::string& sName = "" ) = 0;
virtual std::string CreateSignalSourceSequencer( const std::string& sName = "" ) = 0;
//! Creates a network-based signal source
/**
......@@ -339,20 +377,20 @@ public:
*
* @return ID of signal source
*/
virtual std::string CreateNetworkStreamSignalSource( const std::string& sInterface, const int iPort, const std::string& sName = "" ) = 0;
virtual std::string CreateSignalSourceNetworkStream( const std::string& sInterface, const int iPort, const std::string& sName = "" ) = 0;
//! Creates a rotating engine source
/**
* \param sName Name of the engine
* \return ID of signal source
*/
virtual std::string CreateEngineSignalSource( const std::string& sName = "" ) = 0;
virtual std::string CreateSignalSourceEngine( const CVAStruct& oParams, const std::string& sName = "" ) = 0;
//! Creates a machine signal source
/**
* \param sName Name of the machine
*/
virtual std::string CreateMachineSignalSource( const std::string& sName = "" ) = 0;
virtual std::string CreateSignalSourceMachine(const CVAStruct& oParams, const std::string& sName = "" ) = 0;
//! Deletes a signal source
/**
......@@ -399,87 +437,145 @@ public:
virtual void GetSignalSourceInfos( std::vector< CVASignalSourceInfo >& voInfos ) const = 0;
//! Returns the playback state flag (bit-vector) of an audiofile signal source
virtual int GetAudiofileSignalSourcePlaybackState( const std::string& sSignalSourceID ) const = 0;
virtual int GetSignalSourceBufferPlaybackState( const std::string& sSignalSourceID ) const = 0;
//! Set the playback state of an audiofile signal source
/**
* Start, stop or pause the playback of an audiofile using the playback action flags (bit-vector).
*/
virtual void SetAudiofileSignalSourcePlaybackAction( const std::string& sSignalSourceID, int iPlaybackAction ) = 0;
virtual void SetSignalSourceBufferPlaybackAction( const std::string& sSignalSourceID, int iPlaybackAction ) = 0;
//! Set the playback position of an audiofile signal source
/**
* \param sSignalSourceID Signal source ID
* \param dPlaybackPosition Playback position [s]
*/
virtual void SetAudiofileSignalSourcePlaybackPosition( const std::string& sSignalSourceID, double dPlaybackPosition ) = 0;
virtual void SetSignalSourceBufferPlaybackPosition( const std::string& sSignalSourceID, double dPlaybackPosition ) = 0;
//! Set playback looping mode (true = looping)
/**
* \param sSignalSourceID Signal source ID
* \param bLooping Playback is looping
*/
virtual void SetAudiofileSignalSourceIsLooping( const std::string& sSignalSourceID, bool bLooping ) = 0;
virtual void SetSignalSourceBufferIsLooping( const std::string& sSignalSourceID, bool bLooping ) = 0;
//! Get playback looping mode (true = looping)
/**
* \param sSignalSourceID Signal source ID
*/
virtual bool GetAudiofileSignalSourceIsLooping( const std::string& sSignalSourceID ) const = 0;
virtual bool GetSignalSourceBufferIsLooping( const std::string& sSignalSourceID ) const = 0;
//! Starts the signal of a machine source
/**
* \param sSignalSourceID Signal source ID
*/
void StartMachineSignalSource( const std::string& sSignalSourceID );
inline void SetSignalSourceMachineStartMachine(const std::string& sSignalSourceID)
{
CVAStruct oParams;
oParams["set"] = "action";
oParams["value"] = "start";
SetSignalSourceParameters(sSignalSourceID, oParams);
};
//! Halts the signal of a machine source
/**
* \param sSignalSourceID Signal source ID
*/
void HaltMachineSignalSource( const std::string& sSignalSourceID );
inline void SetSignalSourceMachineHaltMachine(const std::string& sSignalSourceID)
{
CVAStruct oParams;
oParams["set"] = "action";
oParams["value"] = "stop";
SetSignalSourceParameters(sSignalSourceID, oParams);
};
//! Returns the state of a machine signal source
/**
* \param sSignalSourceID Signal source ID
* \return Machine state
*/
std::string GetMachineSignalSourceStateStr( const std::string& sSignalSourceID ) const;
inline std::string GetSignalSourceMachineStateStr(const std::string& sSignalSourceID) const
{
CVAStruct oParams, oRet;
oParams["get"] = "state";
oRet = GetSignalSourceParameters(sSignalSourceID, oParams);
if (oRet.HasKey("state"))
if (oRet["state"].IsString())
return oRet["state"].ToString();
else
return "error";
else
return "unkown";
};
//! Sets the speed of a machine signal source
/**
* \param sSignalSourceID Signal source ID
* \param dSpeed Machine speed (0 .. not-too-large)
*/
void SetMachineSignalSourceSpeed( const std::string& sSignalSourceID, double dSpeed );
inline void SetSignalSourceMachineSpeed(const std::string& sSignalSourceID, double dSpeed)
{
CVAStruct oParams;
oParams["set"] = "S";
oParams["value"] = dSpeed;
SetSignalSourceParameters(sSignalSourceID, oParams);
};
//! Sets the speed of a machine signal source
/**
* \param sSignalSourceID Signal source ID
* \return Machine speed
*/
double GetMachineSignalSourceSpeed( const std::string& sSignalSourceID ) const;
inline double GetSignalSourceMachineSpeed(const std::string& sSignalSourceID) const
{
CVAStruct oParams, oRet;
oParams["get"] = "speed";
oRet = GetSignalSourceParameters(sSignalSourceID, oParams);
if (oRet.HasKey("speed"))
if (oRet["speed"].IsNumeric())
return double(oRet["speed"]);
return 1.0f;
};
//! Set start file sample of machine signal source
/**
* \param sSignalSourceID Signal source ID
* \param sFilePath Path to audio file
*/
void SetMachineSignalSourceStartFile( const std::string& sSignalSourceID, const std::string& sFilePath );
inline void SetSignalSourceMachineStartFile(const std::string& sSignalSourceID, const std::string& sFilePath)
{
CVAStruct oParams;
oParams["set"] = "StartSoundFilePath";
oParams["value"] = sFilePath;
SetSignalSourceParameters(sSignalSourceID, oParams);
};
//! Set idle file sample of machine signal source
/**
* \param sSignalSourceID Signal source ID
* \param sFilePath Path to audio file
*/
void SetMachineSignalSourceIdleFile( const std::string& sSignalSourceID, const std::string& sFilePath );
inline void SetSignalSourceMachineIdleFile( const std::string& sSignalSourceID, const std::string& sFilePath )
{
CVAStruct oParams;
oParams["set"] = "IdleSoundFilePath";
oParams["value"] = sFilePath;
SetSignalSourceParameters(sSignalSourceID, oParams);
};
//! Set stop file sample of machine signal source
/**
* \param sSignalSourceID Signal source ID
* \param sFilePath Path to audio file
*/
void SetMachineSignalSourceStopFile( const std::string& sSignalSourceID, const std::string& sFilePath );
inline void SetSignalSourceMachineStopFile(const std::string& sSignalSourceID, const std::string& sFilePath)
{
CVAStruct oParams;
oParams["set"] = "StopSoundFilePath";
oParams["value"] = sFilePath;
SetSignalSourceParameters(sSignalSourceID, oParams);
};
//! Adds a sound playback for a sequencer signal source
/**
......@@ -492,14 +588,14 @@ public:
*
* \return Playback ID
*/
virtual int AddSoundPlayback( const std::string& sSignalSourceID, const int iSoundID, const int iFlags, const double dTimecode = 0 ) = 0;
virtual int AddSignalSourceSequencerSoundPlayback( const std::string& sSignalSourceID, const int iSoundID, const int iFlags, const double dTimecode = 0 ) = 0;
//! Removes an existing sound playback from a sequencer signal source
/**
* \return true, if the playback has been removed
* false, otherwise
*/
virtual bool RemoveSoundPlayback( const int iID ) = 0;
virtual bool RemoveSignalSourceSequencerSoundPlayback( const int iID ) = 0;
// TODO: AlterSoundPlayback?
......@@ -523,6 +619,7 @@ public:
*/
virtual CVAStruct GetSignalSourceParameters( const std::string& sSignalSourceID, const CVAStruct& oParams ) const = 0;
//! Returns wheather a synchronized scene modification is in progress
virtual bool IsUpdateLocked() const = 0;
......@@ -545,6 +642,7 @@ public:
*/
virtual int UnlockUpdate() = 0;
//! Create a sound source
/**
* This method creates a new sound source and returns its ID.
......@@ -638,7 +736,10 @@ public:
*
* \param Sound source identifier
*/
void RemoveSoundSourceSignalSource( const int iID );
inline void RemoveSoundSourceSignalSource(const int iID)
{
SetSoundSourceSignalSource(iID, "");
};
//! Auralisierungsmodus einer Schallquelle zurückgeben (Bitvektor)
virtual int GetSoundSourceAuralizationMode( const int iID ) const = 0;
......
......@@ -20,7 +20,6 @@
#include <algorithm>
#include <iomanip>
#include <sstream>
#include <string>
const double DECIBEL_MINUS_INFINITY = -1.5E-308;
......@@ -402,81 +401,3 @@ const std::vector<CVAIntLiteral>& IVACore::GetLiterals()
return g_oCoreLiterals;
}
void IVACore::StartMachineSignalSource( const std::string& sSignalSourceID )
{
CVAStruct oParams;
oParams[ "set" ] = "action";
oParams[ "value" ] = "start";
SetSignalSourceParameters( sSignalSourceID, oParams );
}
void IVACore::HaltMachineSignalSource( const std::string& sSignalSourceID )
{
CVAStruct oParams;
oParams[ "set" ] = "action";
oParams[ "value" ] = "stop";
SetSignalSourceParameters( sSignalSourceID, oParams );
}
std::string IVACore::GetMachineSignalSourceStateStr( const std::string& sSignalSourceID ) const
{
CVAStruct oParams, oRet;
oParams[ "get" ] = "state";
oRet = GetSignalSourceParameters( sSignalSourceID, oParams );
if( oRet.HasKey( "state" ) )
if( oRet[ "state" ].IsString() )
return oRet[ "state" ].ToString();
else
return "error";
else
return "unkown";
}
void IVACore::SetMachineSignalSourceSpeed( const std::string& sSignalSourceID, double dSpeed )
{
CVAStruct oParams;
oParams[ "set" ] = "S";
oParams[ "value" ] = dSpeed;
SetSignalSourceParameters( sSignalSourceID, oParams );
}
double IVACore::GetMachineSignalSourceSpeed( const std::string& sSignalSourceID ) const
{
CVAStruct oParams, oRet;
oParams[ "get" ] = "speed";
oRet = GetSignalSourceParameters( sSignalSourceID, oParams );
if( oRet.HasKey( "speed" ) )
if( oRet[ "speed" ].IsNumeric() )
return double( oRet[ "speed" ] );
return 1.0f;
}
void IVACore::SetMachineSignalSourceStartFile( const std::string& sSignalSourceID, const std::string& sFilePath )
{
CVAStruct oParams;
oParams[ "set" ] = "StartSoundFilePath";
oParams[ "value" ] = sFilePath;
SetSignalSourceParameters( sSignalSourceID, oParams );
}
void IVACore::SetMachineSignalSourceIdleFile( const std::string& sSignalSourceID, const std::string& sFilePath )
{
CVAStruct oParams;
oParams[ "set" ] = "IdleSoundFilePath";
oParams[ "value" ] = sFilePath;
SetSignalSourceParameters( sSignalSourceID, oParams );
}
void IVACore::SetMachineSignalSourceStopFile( const std::string& sSignalSourceID, const std::string& sFilePath )
{
CVAStruct oParams;
oParams[ "set" ] = "StopSoundFilePath";
oParams[ "value" ] = sFilePath;
SetSignalSourceParameters( sSignalSourceID, oParams );
}
void IVACore::RemoveSoundSourceSignalSource( const int iID )
{
SetSoundSourceSignalSource( iID, "" );
}
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