Starting API adaption

parent db13fabd
......@@ -14,8 +14,8 @@
#include "VAMatlabConnection.h"
#include "VAMatlabTracking.h"
#include <VANetClient.h>
#include <VACore.h>
#include <VA.h>
#include <VANet.h>
CVAMatlabConnection::CVAMatlabConnection()
{
......
......@@ -18,7 +18,7 @@
#include <string>
#include <vector>
class IVACore;
class IVAInterface;
class CVAMatlabTracker;
class IVANetClient;
......@@ -27,7 +27,7 @@ class CVAMatlabConnection
{
public:
IVANetClient* pClient;
IVACore* pCoreInterface;
IVAInterface* pCoreInterface;
CVAMatlabTracker* pVAMatlabTracker;
CVAMatlabConnection();
......
......@@ -21,14 +21,8 @@
#include <matrix.h>
// VA includes
#include <VABaseDefinitions.h>
#include <VACore.h>
#include <VACoreVersion.h>
#include <VAException.h>
#include <VANetClient.h>
#include <VANetUtils.h>
#include <VANetVersion.h>
#include <VAStruct.h>
#include <VA.h>
#include <VANet.h>
// STL includes
#include <algorithm>
......@@ -36,11 +30,6 @@
#include <sstream>
#include <stdarg.h>
#ifdef WIN32
#include <windows.h>
#undef PlaySound
#endif
// Maximum number of parallel connections
const int VAMATLAB_MAX_CONNECTIONS = 16;
......@@ -54,7 +43,7 @@ bool g_bFirst = true; // First call of Matlab mexFunction
std::vector<CVAMatlabConnection*> g_vpConnections( VAMATLAB_MAX_CONNECTIONS + 1, NULL ); // Hashtable handles -> connections (1st element always NULL)
ConnectionHandle g_iLastConnectionHandle = 0; // Global connection ID counter
int g_iConnectionsEstablished = 0; // Number of established connections
IVACore* g_pOwnCore = NULL; // Own core instance (deploy mode 1)
IVAInterface* g_pOwnCore = NULL; // Own core instance (deploy mode 1)
CVAMatlabConnection g_oDummyConnection; // Dummy 'connection' to own core (deploy mode 1)
#define VERBOSE_LEVEL_QUIET 0
......@@ -418,7 +407,7 @@ void connect( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) {
pConnection->pCoreInterface = pConnection->pClient->GetCoreInstance();
pConnection->pVAMatlabTracker->pVACore = pConnection->pCoreInterface;
CVACoreVersionInfo oRemoteCoreVersion;
CVAVersionInfo oRemoteCoreVersion;
pConnection->pCoreInterface->GetVersionInfo( &oRemoteCoreVersion );
CVANetVersionInfo oNetVersion;
......@@ -825,15 +814,14 @@ void reset(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
#else // VAMATLAB_INTEGRATED
void reset( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) {
void reset( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
{
REQUIRE_INPUT_ARGS( 1 );
ConnectionHandle hHandle = GetConnectionHandle( prhs[ 0 ] );
CVAMatlabConnection* pConnection = g_vpConnections[ hHandle ];
INFO( "Resetting VA server \"%s\" (connection handle: %d)\n",
pConnection->pClient->GetServerAddress().c_str(), hHandle );
INFO( "Resetting VA server \"%s\" (connection handle: %d)\n", pConnection->pClient->GetServerAddress().c_str(), hHandle );
pConnection->pCoreInterface->Reset();
}
......@@ -857,7 +845,7 @@ void enumerateModules( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[
CVAMatlabConnection* pConnection = g_vpConnections[ hHandle ];
std::vector< CVAModuleInfo > v;
pConnection->pCoreInterface->EnumerateModules( v );
pConnection->pCoreInterface->GetModules( v );
const size_t nDims = int( v.size() );
const int nFields = 2;
......@@ -892,7 +880,7 @@ void callModule( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
CVAStruct oReturn;
pConnection->pCoreInterface->CallModule( sModuleName, oArgs, oReturn );
oReturn = pConnection->pCoreInterface->CallModule( sModuleName, oArgs );
if( nlhs == 0 )
return;
......@@ -933,12 +921,12 @@ void addSearchPath( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
* | | *
* +----------------------------------------------------------+ */
REGISTER_PUBLIC_FUNCTION( loadDirectivity, "Loads a directivity from a file", "" );
DECLARE_FUNCTION_REQUIRED_INARG( loadDirectivity, filename, "string", "Filename" );
DECLARE_FUNCTION_OPTIONAL_INARG( loadDirectivity, name, "string", "Displayed name", "''" );
DECLARE_FUNCTION_OUTARG( loadDirectivity, directivityID, "integer-1x1", "Directivity ID" );
REGISTER_PUBLIC_FUNCTION( create_directivity, "Loads a directivity from a file", "" );
DECLARE_FUNCTION_REQUIRED_INARG( create_directivity, filename, "string", "Filename" );
DECLARE_FUNCTION_OPTIONAL_INARG( create_directivity, name, "string", "Displayed name", "''" );
DECLARE_FUNCTION_OUTARG( create_directivity, directivityID, "integer-1x1", "Directivity ID" );
void loadDirectivity( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) {
void create_directivity( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) {
REQUIRE_INPUT_ARGS( 3 );
......@@ -948,7 +936,7 @@ void loadDirectivity( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]
std::string sFilename = matlabGetString( prhs[ 1 ], "filename" );
std::string sName = matlabGetString( prhs[ 2 ], "Name" );
int iDirectivityID = pConnection->pCoreInterface->LoadDirectivity( sFilename, sName );
int iDirectivityID = pConnection->pCoreInterface->CreateDirectivityFromFile( sFilename, sName );
plhs[ 0 ] = matlabCreateID( iDirectivityID );
INFO( "Loaded directivity \"%s\" successfully loaded (id: %d)\n", sFilename.c_str(), hHandle );
......@@ -956,11 +944,11 @@ void loadDirectivity( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]
// ------------------------------------------------------------
REGISTER_PUBLIC_FUNCTION( freeDirectivity, "Frees a directivity and releases its memory", "This is only possible if the directivity is not in use. Otherwise the method will do nothing." );
DECLARE_FUNCTION_REQUIRED_INARG( freeDirectivity, directivityID, "integer-1x1", "Directivity ID" );
DECLARE_FUNCTION_OUTARG( freeDirectivity, result, "logical-1x1", "Directivity freed?" );
REGISTER_PUBLIC_FUNCTION( delete_directivity, "Frees a directivity and releases its memory", "This is only possible if the directivity is not in use. Otherwise the method will do nothing." );
DECLARE_FUNCTION_REQUIRED_INARG( delete_directivity, directivityID, "integer-1x1", "Directivity ID" );
DECLARE_FUNCTION_OUTARG( delete_directivity, result, "logical-1x1", "Directivity freed?" );
void freeDirectivity( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) {
void delete_directivity( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) {
REQUIRE_INPUT_ARGS( 2 );
......@@ -969,7 +957,7 @@ void freeDirectivity( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]
int iDirectivityID = matlabGetIntegerScalar( prhs[ 1 ], "directivityID" );
bool bResult = pConnection->pCoreInterface->FreeDirectivity( iDirectivityID );
bool bResult = pConnection->pCoreInterface->DeleteDirectivity( iDirectivityID );
plhs[ 0 ] = mxCreateLogicalScalar( bResult );
}
......@@ -1016,105 +1004,17 @@ void getDirectivityInfos( int nlhs, mxArray *plhs[], int nrhs, const mxArray *pr
/* +----------------------------------------------------------+ *
* | | *
* | Head-related impulse responses (HRIRs) | *
* | | *
* +----------------------------------------------------------+ */
REGISTER_PUBLIC_FUNCTION( loadHRIRDataset, "Loads a HRIR dataset from a file", "" );
DECLARE_FUNCTION_REQUIRED_INARG( loadHRIRDataset, filename, "string", "Filename" );
DECLARE_FUNCTION_OPTIONAL_INARG( loadHRIRDataset, name, "string", "Displayed name", "''" );
DECLARE_FUNCTION_OUTARG( loadHRIRDataset, id, "integer-1x1", "HRIR dataset ID" );
void loadHRIRDataset( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) {
REQUIRE_INPUT_ARGS( 3 );
ConnectionHandle hHandle = GetConnectionHandle( prhs[ 0 ] );
CVAMatlabConnection* pConnection = g_vpConnections[ hHandle ];
std::string sFilename = matlabGetString( prhs[ 1 ], "filename" );
std::string sName = matlabGetString( prhs[ 2 ], "name" );
int iHRIRID = pConnection->pCoreInterface->LoadHRIRDataset( sFilename, sName );
plhs[ 0 ] = matlabCreateID( iHRIRID );
INFO( "HRIR dataset '%s' successfully loaded (id: %d)\n", sFilename.c_str(), iHRIRID );
}
// ------------------------------------------------------------
REGISTER_PUBLIC_FUNCTION( freeHRIRDataset, "Frees a loaded HRIR dataset", "This is only possible if the HRIR dataset is not in use. Otherwise the method will do nothing." );
DECLARE_FUNCTION_REQUIRED_INARG( freeHRIRDataset, hrirID, "integer-1x1", "HRIR dataset ID" );
DECLARE_FUNCTION_OUTARG( freeHRIRDataset, result, "logical-1x1", "HRIR dataset freed?" );
void freeHRIRDataset( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) {
REQUIRE_INPUT_ARGS( 2 );
ConnectionHandle hHandle = GetConnectionHandle( prhs[ 0 ] );
CVAMatlabConnection* pConnection = g_vpConnections[ hHandle ];
int iHRIRID = matlabGetIntegerScalar( prhs[ 1 ], "hrirID" );
bool bResult = pConnection->pCoreInterface->FreeHRIRDataset( iHRIRID );
plhs[ 0 ] = mxCreateLogicalScalar( bResult );
}
// ------------------------------------------------------------
REGISTER_PUBLIC_FUNCTION( getHRIRDatasetInfo, "Returns information on a loaded HRIR dataset", "" );
DECLARE_FUNCTION_REQUIRED_INARG( getHRIRDatasetInfo, hrirID, "integer-1x1", "HRIR dataset ID" );
DECLARE_FUNCTION_OUTARG( getHRIRDatasetInfo, info, "struct-1x1", "Information structs (name, filename, resolution, etc.)" );
void getHRIRDatasetInfo( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) {
REQUIRE_INPUT_ARGS( 2 );
ConnectionHandle hHandle = GetConnectionHandle( prhs[ 0 ] );
CVAMatlabConnection* pConnection = g_vpConnections[ hHandle ];
int iHRIRID = matlabGetIntegerScalar( prhs[ 1 ], "hrirID" );
CVAHRIRInfo hi = pConnection->pCoreInterface->GetHRIRInfo( iHRIRID );
plhs[ 0 ] = matlabCreateHRIRInfo( hi );
}
// ------------------------------------------------------------
REGISTER_PUBLIC_FUNCTION( getHRIRDatasetInfos, "Returns information on all loaded HRIR datasets", "" );
DECLARE_FUNCTION_OUTARG( getHRIRDatasetInfos, info, "cell-array of struct-1x1", "Information structs (name, filename, resolution, etc.)" );
void getHRIRDatasetInfos( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) {
REQUIRE_INPUT_ARGS( 1 );
ConnectionHandle hHandle = GetConnectionHandle( prhs[ 0 ] );
CVAMatlabConnection* pConnection = g_vpConnections[ hHandle ];
std::vector<CVAHRIRInfo> v;
pConnection->pCoreInterface->GetHRIRInfos( v );
const mwSize dims[ 2 ] = { 1, v.size() };
mxArray* pCell = mxCreateCellArray( 2, dims );
for( size_t i = 0; i < v.size(); i++ )
mxSetCell( pCell, i, matlabCreateHRIRInfo( v[ i ] ) );
plhs[ 0 ] = pCell;
}
/* +----------------------------------------------------------+ *
* | | *
* | Sounds | *
* | Signal sources | *
* | | *
* +----------------------------------------------------------+ */
REGISTER_PUBLIC_FUNCTION( loadSound, "Loads a sound from an audiofile", "Note: The audiofile must be mono" );
DECLARE_FUNCTION_REQUIRED_INARG( loadSound, filename, "string", "Filename" );
DECLARE_FUNCTION_OPTIONAL_INARG( loadSound, name, "string", "Displayed name", "''" );
DECLARE_FUNCTION_OUTARG( loadSound, id, "integer-1x1", "Sound ID" );
void loadSound( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) {
REGISTER_PUBLIC_FUNCTION( create_signal_source_buffer_from_file, "Creates a signal source which plays an audiofile", "Note: The audiofile must be mono and its sampling rate must match that of the server." );
DECLARE_FUNCTION_REQUIRED_INARG( create_signal_source_buffer_from_file, filename, "string", "Filename" );
DECLARE_FUNCTION_OPTIONAL_INARG( create_signal_source_buffer_from_file, name, "string", "Displayed name", "''" );
DECLARE_FUNCTION_OUTARG( create_signal_source_buffer_from_file, signalSourceID, "string", "Signal source ID" );
void create_signal_source_buffer_from_file( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
{
REQUIRE_INPUT_ARGS( 3 );
ConnectionHandle hHandle = GetConnectionHandle( prhs[ 0 ] );
......@@ -1123,154 +1023,65 @@ void loadSound( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) {
std::string sFilename = matlabGetString( prhs[ 1 ], "filename" );
std::string sName = matlabGetString( prhs[ 2 ], "name" );
int iSoundID = pConnection->pCoreInterface->LoadSound( sFilename, sName );
plhs[ 0 ] = matlabCreateID( iSoundID );
INFO( "Sound '%s' successfully loaded (id: %d)\n", sFilename.c_str(), iSoundID );
}
// ------------------------------------------------------------
REGISTER_PUBLIC_FUNCTION( freeSound, "Frees a loaded sound", "" );
DECLARE_FUNCTION_REQUIRED_INARG( freeSound, soundID, "integer-1x1", "Sound ID" );
DECLARE_FUNCTION_OUTARG( freeSound, result, "logical-1x1", "Sound freed?" );
void freeSound( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) {
REQUIRE_INPUT_ARGS( 2 );
ConnectionHandle hHandle = GetConnectionHandle( prhs[ 0 ] );
CVAMatlabConnection* pConnection = g_vpConnections[ hHandle ];
int iSoundID = matlabGetIntegerScalar( prhs[ 1 ], "soundID" );
bool bResult = pConnection->pCoreInterface->FreeSound( iSoundID );
plhs[ 0 ] = mxCreateLogicalScalar( bResult );
std::string sID = pConnection->pCoreInterface->CreateSignalSourceBufferFromFile( sFilename, sName );
plhs[ 0 ] = mxCreateString( sID.c_str() );
}
// ------------------------------------------------------------
REGISTER_PUBLIC_FUNCTION( create_signal_source_text_to_speech, "Creates a text to speech signal", "Note: depending on mode, either Speech WAV files are generated and then played back, or TTS sentence is directly played back." );
DECLARE_FUNCTION_OPTIONAL_INARG( create_signal_source_text_to_speech, name, "string", "Displayed name", "''" );
DECLARE_FUNCTION_OUTARG( create_signal_source_text_to_speech, signalSourceID, "string", "Signal source ID" );
REGISTER_PUBLIC_FUNCTION( getSoundInfo, "Returns information on a loaded sound", "" );
DECLARE_FUNCTION_REQUIRED_INARG( getSoundInfo, soundID, "integer-1x1", "Sound ID" );
DECLARE_FUNCTION_OUTARG( getSoundInfo, info, "struct-1x1", "Information struct (name, filename, length, etc.)" );
void getSoundInfo( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) {
void create_signal_source_text_to_speech( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
{
REQUIRE_INPUT_ARGS( 2 );
ConnectionHandle hHandle = GetConnectionHandle( prhs[ 0 ] );
CVAMatlabConnection* pConnection = g_vpConnections[ hHandle ];
int iSoundID = matlabGetIntegerScalar( prhs[ 1 ], "soundID" );
CVASoundInfo si = pConnection->pCoreInterface->GetSoundInfo( iSoundID );
plhs[ 0 ] = matlabCreateSoundInfo( si );
}
// ------------------------------------------------------------
REGISTER_PUBLIC_FUNCTION( getSoundInfos, "Returns information on all loaded sounds", "" );
DECLARE_FUNCTION_OUTARG( getSoundInfos, info, "cell-array of struct-1x1", "Information structs (name, filename, length, etc.)" );
void getSoundInfos( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) {
REQUIRE_INPUT_ARGS( 1 );
ConnectionHandle hHandle = GetConnectionHandle( prhs[ 0 ] );
CVAMatlabConnection* pConnection = g_vpConnections[ hHandle ];
std::vector<CVASoundInfo> v;
pConnection->pCoreInterface->GetSoundInfos( v );
const mwSize dims[ 2 ] = { 1, v.size() };
mxArray* pCell = mxCreateCellArray( 2, dims );
for( size_t i = 0; i < v.size(); i++ )
mxSetCell( pCell, i, matlabCreateSoundInfo( v[ i ] ) );
plhs[ 0 ] = pCell;
std::string sName = matlabGetString( prhs[ 1 ], "name" );
std::string sID = pConnection->pCoreInterface->CreateSignalSourceTextToSpeech( sName );
plhs[ 0 ] = mxCreateString( sID.c_str() );
}
// ------------------------------------------------------------
REGISTER_PUBLIC_FUNCTION( playSound, "Plays a sound", "" );
DECLARE_FUNCTION_REQUIRED_INARG( playSound, soundID, "integer-1x1", "Sound ID" );
DECLARE_FUNCTION_OPTIONAL_INARG( playSound, volume, "double-1x1", "Volume [factor]", "1" );
DECLARE_FUNCTION_OUTARG( playSound, id, "integer-1x1", "Playback ID" );
void playSound( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) {
REQUIRE_INPUT_ARGS( 1 );
ConnectionHandle hHandle = GetConnectionHandle( prhs[ 0 ] );
CVAMatlabConnection* pConnection = g_vpConnections[ hHandle ];
int iSoundID = matlabGetIntegerScalar( prhs[ 1 ], "soundID" );
// TODO: Check availability of 2nd parameter
double dVolume( 1 );
if( nlhs >= 2 ) matlabGetRealScalar( prhs[ 2 ], "volume" );
int iPlaybackID = pConnection->pCoreInterface->PlaySound( iSoundID, dVolume );
plhs[ 0 ] = matlabCreateID( iPlaybackID );
}
/* +----------------------------------------------------------+ *
* | | *
* | Signal sources | *
* | | *
* +----------------------------------------------------------+ */
REGISTER_PUBLIC_FUNCTION( create_signal_source_buffer_from_parameters, "Creates an buffer signal source", "" );
DECLARE_FUNCTION_REQUIRED_INARG( create_signal_source_buffer_from_parameters, params, "struct", "Parameters", "''" );
DECLARE_FUNCTION_OPTIONAL_INARG( create_signal_source_buffer_from_parameters, name, "string", "Displayed name", "''" );
DECLARE_FUNCTION_OUTARG( create_signal_source_buffer_from_parameters, signalSourceID, "string", "Signal source ID" );
REGISTER_PUBLIC_FUNCTION( createAudiofileSignalSource, "Creates a signal source which plays an audiofile", "Note: The audiofile must be mono and its sampling rate must match that of the server." );
DECLARE_FUNCTION_REQUIRED_INARG( createAudiofileSignalSource, filename, "string", "Filename" );
DECLARE_FUNCTION_OPTIONAL_INARG( createAudiofileSignalSource, name, "string", "Displayed name", "''" );
DECLARE_FUNCTION_OUTARG( createAudiofileSignalSource, signalSourceID, "string", "Signal source ID" );
void createAudiofileSignalSource( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
void create_signal_source_buffer_from_parameters( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
{
REQUIRE_INPUT_ARGS( 3 );
ConnectionHandle hHandle = GetConnectionHandle( prhs[ 0 ] );
CVAMatlabConnection* pConnection = g_vpConnections[ hHandle ];
std::string sFilename = matlabGetString( prhs[ 1 ], "filename" );
CVAStruct oParams = matlabGetStruct( prhs[ 1 ], "params" );
std::string sName = matlabGetString( prhs[ 2 ], "name" );
std::string sID = pConnection->pCoreInterface->CreateAudiofileSignalSource( sFilename, sName );
std::string sID = pConnection->pCoreInterface->CreateSignalSourceBufferFromParameters( oParams, sName );
plhs[ 0 ] = mxCreateString( sID.c_str() );
}
// ------------------------------------------------------------
REGISTER_PUBLIC_FUNCTION( createTextToSpeechSignalSource, "Creates a text to speech signal", "Note: depending on mode, either Speech WAV files are generated and then played back, or TTS sentence is directly played back." );
DECLARE_FUNCTION_OPTIONAL_INARG( createTextToSpeechSignalSource, name, "string", "Displayed name", "''" );
DECLARE_FUNCTION_OUTARG( createTextToSpeechSignalSource, signalSourceID, "string", "Signal source ID" );
void createTextToSpeechSignalSource( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
{
REQUIRE_INPUT_ARGS( 2 );
REGISTER_PUBLIC_FUNCTION( create_signal_source_engine, "Creates an engine signal source", "" );
DECLARE_FUNCTION_REQUIRED_INARG( create_signal_source_engine, params, "struct", "Parameters", "''" );
DECLARE_FUNCTION_OPTIONAL_INARG( create_signal_source_engine, name, "string", "Displayed name", "''" );
DECLARE_FUNCTION_OUTARG( create_signal_source_engine, signalSourceID, "string", "Signal source ID" );
ConnectionHandle hHandle = GetConnectionHandle( prhs[ 0 ] );
CVAMatlabConnection* pConnection = g_vpConnections[ hHandle ];
std::string sName = matlabGetString( prhs[ 1 ], "name" );
std::string sID = pConnection->pCoreInterface->CreateTextToSpeechSignalSource( sName );
plhs[ 0 ] = mxCreateString( sID.c_str() );
}
// ------------------------------------------------------------
REGISTER_PUBLIC_FUNCTION( createEngineSignalSource, "Creates an engine signal source", "" );
DECLARE_FUNCTION_OPTIONAL_INARG( createEngineSignalSource, name, "string", "Displayed name", "''" );
DECLARE_FUNCTION_OUTARG( createEngineSignalSource, signalSourceID, "string", "Signal source ID" );
void createEngineSignalSource( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
void create_signal_source_engine( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
{
REQUIRE_INPUT_ARGS( 2 );
REQUIRE_INPUT_ARGS( 3 );
ConnectionHandle hHandle = GetConnectionHandle( prhs[ 0 ] );
CVAMatlabConnection* pConnection = g_vpConnections[ hHandle ];
std::string sName = matlabGetString( prhs[ 1 ], "name" );
CVAStruct oParams = matlabGetStruct( prhs[ 1 ], "params" );
std::string sName = matlabGetString( prhs[ 2 ], "name" );
std::string sID = pConnection->pCoreInterface->CreateEngineSignalSource( sName );
std::string sID = pConnection->pCoreInterface->CreateSignalSourceEngine( oParams, sName );
plhs[ 0 ] = mxCreateString( sID.c_str() );
}
......@@ -1289,7 +1100,7 @@ void createSequencerSignalSource( int nlhs, mxArray *plhs[], int nrhs, const mxA
std::string sName = matlabGetString( prhs[ 1 ], "name" );
std::string sID = pConnection->pCoreInterface->CreateSequencerSignalSource( sName );
std::string sID = pConnection->pCoreInterface->CreateSignalSourceSequencer( sName );
plhs[ 0 ] = mxCreateString( sID.c_str() );
}
......@@ -1312,7 +1123,7 @@ void createNetworkStreamSignalSource( int nlhs, mxArray *plhs[], int nrhs, const
int iPort = matlabGetIntegerScalar( prhs[ 2 ], "port" );
std::string sName = matlabGetString( prhs[ 3 ], "name" );
std::string sID = pConnection->pCoreInterface->CreateNetworkStreamSignalSource( sAddress, iPort, sName );
std::string sID = pConnection->pCoreInterface->CreateSignalSourceNetworkStream( sAddress, iPort, sName );
plhs[ 0 ] = mxCreateString( sID.c_str() );
}
......@@ -1378,17 +1189,17 @@ void getSignalSourceInfos( int nlhs, mxArray *plhs[], int nrhs, const mxArray *p
// ------------------------------------------------------------
REGISTER_PUBLIC_FUNCTION( getAudiofileSignalSourcePlaybackState, "Returns the playback state of an audiofile signal source. Available modes: PLAYING, STOPPED, PAUSED", "" );
DECLARE_FUNCTION_REQUIRED_INARG( getAudiofileSignalSourcePlaybackState, signalSourceID, "string", "Signal source ID" );
DECLARE_FUNCTION_OUTARG( getAudiofileSignalSourcePlaybackState, playState, "string", "Playback state" );
REGISTER_PUBLIC_FUNCTION( get_signal_source_buffer_playback_state, "Returns the playback state of an audiofile signal source. Available modes: PLAYING, STOPPED, PAUSED", "" );
DECLARE_FUNCTION_REQUIRED_INARG( get_signal_source_buffer_playback_state, signalSourceID, "string", "Signal source ID" );
DECLARE_FUNCTION_OUTARG( get_signal_source_buffer_playback_state, playState, "string", "Playback state" );
void getAudiofileSignalSourcePlaybackState( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
void get_signal_source_buffer_playback_state( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
{
REQUIRE_INPUT_ARGS( 2 );
ConnectionHandle hHandle = GetConnectionHandle( prhs[ 0 ] );
CVAMatlabConnection* pConnection = g_vpConnections[ hHandle ];
std::string sSignalSourceID = matlabGetString( prhs[ 1 ], "signalSourceID" );
int iPlayState = pConnection->pCoreInterface->GetAudiofileSignalSourcePlaybackState( sSignalSourceID );
int iPlayState = pConnection->pCoreInterface->GetSignalSourceBufferPlaybackState( sSignalSourceID );
std::string sPlayState = pConnection->pCoreInterface->GetPlaybackStateStr( iPlayState );
plhs[ 0 ] = mxCreateString( sPlayState.c_str() );
......@@ -1396,10 +1207,10 @@ void getAudiofileSignalSourcePlaybackState( int nlhs, mxArray *plhs[], int nrhs,
// ------------------------------------------------------------
REGISTER_PUBLIC_FUNCTION( setAudiofileSignalSourcePlaybackAction, "Change the playback state of an audiofile signal source. Available actions: PLAY STOP PAUSE", "" );
DECLARE_FUNCTION_REQUIRED_INARG( setAudiofileSignalSourcePlaybackAction, signalSourceID, "string", "Signal source ID" );
DECLARE_FUNCTION_REQUIRED_INARG( setAudiofileSignalSourcePlaybackAction, playAction, "string", "Playback action" );
void setAudiofileSignalSourcePlaybackAction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
REGISTER_PUBLIC_FUNCTION( set_signal_source_buffer_playback_action, "Change the playback state of an audiofile signal source. Available actions: PLAY STOP PAUSE", "" );
DECLARE_FUNCTION_REQUIRED_INARG( set_signal_source_buffer_playback_action, signalSourceID, "string", "Signal source ID" );
DECLARE_FUNCTION_REQUIRED_INARG( set_signal_source_buffer_playback_action, playAction, "string", "Playback action" );
void set_signal_source_buffer_playback_action( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
{
REQUIRE_INPUT_ARGS( 3 );
ConnectionHandle hHandle = GetConnectionHandle( prhs[ 0 ] );
......@@ -1407,8 +1218,8 @@ void setAudiofileSignalSourcePlaybackAction( int nlhs, mxArray *plhs[], int nrhs
std::string sSignalSourceID = matlabGetString( prhs[ 1 ], "signalSourceID" );
std::string sPlayAction = matlabGetString( prhs[ 2 ], "playAction" );
int iPlayAction = IVACore::ParsePlaybackAction( sPlayAction );
pConnection->pCoreInterface->SetAudiofileSignalSourcePlaybackAction( sSignalSourceID, iPlayAction );
int iPlayAction = IVAInterface::ParsePlaybackAction( sPlayAction );
pConnection->pCoreInterface->SetSignalSourceBufferPlaybackAction( sSignalSourceID, iPlayAction );
}
// ------------------------------------------------------------
......@@ -1628,7 +1439,7 @@ void createSoundSource( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs
std::string sName = matlabGetString( prhs[ 1 ], "name" );
std::string sAuralizationMode = matlabGetString( prhs[ 2 ], "auralizationMode" );
int iAuralizationMode = IVACore::ParseAuralizationModeStr( sAuralizationMode );
int iAuralizationMode = IVAInterface::ParseAuralizationModeStr( sAuralizationMode );
double dVolume = matlabGetRealScalar( prhs[ 3 ], "volume" );
int iSourceID = pConnection->pCoreInterface->CreateSoundSource( sName, iAuralizationMode, dVolume );
......@@ -1776,7 +1587,7 @@ void getSoundSourceAuralizationMode( int nlhs, mxArray *plhs[], int nrhs, const
int iSoundSourceID = matlabGetIntegerScalar( prhs[ 1 ], "soundSourceID" );
int iAuralizationMode = pConnection->pCoreInterface->GetSoundSourceAuralizationMode( iSoundSourceID );
plhs[ 0 ] = mxCreateString( IVACore::GetAuralizationModeStr( iAuralizationMode, true ).c_str() );
plhs[ 0 ] = mxCreateString( IVAInterface::GetAuralizationModeStr( iAuralizationMode, true ).c_str() );
}
// ------------------------------------------------------------
......@@ -1797,7 +1608,7 @@ void setSoundSourceAuralizationMode( int nlhs, mxArray *plhs[], int nrhs, const
// Get the current auralization mode first for computing relative modes (+|-)
int iCurAuralizationMode = pConnection->pCoreInterface->GetSoundSourceAuralizationMode( iSoundSourceID );
int iNewAuralizationMode = IVACore::ParseAuralizationModeStr( sAuralizationMode, iCurAuralizationMode );
int iNewAuralizationMode = IVAInterface::ParseAuralizationModeStr( sAuralizationMode, iCurAuralizationMode );
pConnection->pCoreInterface->SetSoundSourceAuralizationMode( iSoundSourceID, iNewAuralizationMode );
}
......@@ -2309,7 +2120,7 @@ void createListener( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]
std::string sName = matlabGetString( prhs[ 1 ], "name" );
std::string sAuralizationMode = matlabGetString( prhs[ 2 ], "auralizationMode" );
int iAuralizationMode = IVACore::ParseAuralizationModeStr( sAuralizationMode );
int iAuralizationMode = IVAInterface::ParseAuralizationModeStr( sAuralizationMode );
int iHRIRID = matlabGetIntegerScalar( prhs[ 3 ], "hrirID" );
int iListenerID = pConnection->pCoreInterface->CreateListener( sName, iAuralizationMode, iHRIRID );
......@@ -2389,7 +2200,7 @@ void getListenerAuralizationMode( int nlhs, mxArray *plhs[], int nrhs, const mxA
int iListenerID = matlabGetIntegerScalar( prhs[ 1 ], "listenerID" );
int iAuralizationMode = pConnection->pCoreInterface->GetListenerAuralizationMode( iListenerID );
plhs[ 0 ] = mxCreateString( IVACore::GetAuralizationModeStr( iAuralizationMode, true ).c_str() );
plhs[ 0 ] = mxCreateString( IVAInterface::GetAuralizationModeStr( iAuralizationMode, true ).c_str() );
}
// ------------------------------------------------------------
......@@ -2410,7 +2221,7 @@ void setListenerAuralizationMode( int nlhs, mxArray *plhs[], int nrhs, const mxA
// Get the current auralization mode first for computing relative modes (+|-)
int iCurAuralizationMode = pConnection->pCoreInterface->GetListenerAuralizationMode( iListenerID );
int iNewAuralizationMode = IVACore::ParseAuralizationModeStr( sAuralizationMode, iCurAuralizationMode );
int iNewAuralizationMode = IVAInterface::ParseAuralizationModeStr( sAuralizationMode, iCurAuralizationMode );
pConnection->pCoreInterface->SetListenerAuralizationMode( iListenerID, iNewAuralizationMode );
}
......@@ -3151,7 +2962,7 @@ void getGlobalAuralizationMode( int nlhs, mxArray *plhs[], int nrhs, const mxArr
CVAMatlabConnection* pConnection = g_vpConnections[ hHandle ];
int iAuralizationMode = pConnection->pCoreInterface->GetGlobalAuralizationMode();
plhs[ 0 ] = mxCreateString( IVACore::GetAuralizationModeStr( iAuralizationMode, true ).c_str() );
plhs[ 0 ] = mxCreateString( IVAInterface::GetAuralizationModeStr( iAuralizationMode, true ).c_str() );
}
// ------------------------------------------------------------
......@@ -3170,7 +2981,7 @@ void setGlobalAuralizationMode( int nlhs, mxArray *plhs[], int nrhs, const mxArr
// Get the current auralization mode first for computing relative modes (+|-)
int iCurAuralizationMode = pConnection->pCoreInterface->GetGlobalAuralizationMode();
int iNewAuralizationMode = IVACore::ParseAuralizationModeStr( sAuralizationMode, iCurAuralizationMode );
int iNewAuralizationMode = IVAInterface::ParseAuralizationModeStr( sAuralizationMode, iCurAuralizationMode );
pConnection->pCoreInterface->SetGlobalAuralizationMode( iNewAuralizationMode );
}
......
......@@ -89,7 +89,7 @@ bool matlabGetBoolScalar( const mxArray* arg, const char* argname )
return ( *p == true );
}
if( mxIsNumeric( arg ) && !mxIsComplex( arg ) && matlabIsScalar( arg ) )
if( mxIsNumeric( arg ) && !mxIsComplex( arg ) && matlabIsScalar( arg ) )
{
void* p = mxGetData( arg );
......@@ -102,10 +102,9 @@ bool matlabGetBoolScalar( const mxArray* arg, const char* argname )
// Unsupported datatype
sprintf_s( buf, buflen, "Argument '%s' could not be interpreted as a logical scalar", argname );
VA_EXCEPT1( buf );
return false;
}
if( mxIsChar( arg ) && matlabIsRowVector( arg ) )
if( mxIsChar( arg ) && matlabIsRowVector( arg ) )
{
mxGetString( arg, buf, buflen );
std::string s( buf );
......@@ -122,8 +121,6 @@ bool matlabGetBoolScalar( const mxArray* arg, const char* argname )
sprintf_s( buf, buflen, "Argument '%s' must be a logical scalar", argname );
VA_EXCEPT1( buf );
return false;
}
int matlabGetIntegerScalar( const mxArray* arg, const char* argname )
......@@ -155,13 +152,10 @@ int matlabGetIntegerScalar( const mxArray* arg, const char* argname )
// Unsupported datatype
sprintf_s( buf, 1024, "Argument '%s' could not be interpreted as an integer scalar", argname );
VA_EXCEPT1( buf );
return -1;
}
sprintf_s( buf, 1024, "Argument '%s' must be an integer scalar", argname );