/* * -------------------------------------------------------------------------------------------- * * VVV VVV A Virtual Acoustics (VA) | http://www.virtualacoustics.org * VVV VVV AAA Licensed under the Apache License, Version 2.0 * VVV VVV AAA * VVV VVV AAA Copyright 2015-2017 * VVVVVV AAA Institute of Technical Acoustics (ITA) * VVVV AAA RWTH Aachen University * * -------------------------------------------------------------------------------------------- */ #include "VANetNetworkProtocol.h" #include "VANetServerImpl.h" #include "VANetClientImpl.h" #include "VANetMessage.h" #include "VANetVistaCompatibility.h" #include #include #include #include #include #include #include ////////////////////////////////////////////////// ////////// Main Implementation ///////// ////////////////////////////////////////////////// CVANetNetworkProtocol::CVANetNetworkProtocol() : m_pRealCore( NULL ) , m_pServer( NULL ) , m_pClient( NULL ) , m_pLastAnswerConnection( NULL ) , m_pCommandChannel( NULL ) , m_pHeadChannel( NULL ) , m_oIncomingEvent() , m_vecEventBuffer( 128 ) , m_iReceiveTimeout( 0 ) , m_iExceptionHandlingMode( IVANetClient::EXC_CLIENT_THROW ) , m_bBufferingActive( false ) , m_bBufferSynchronisedModification( false ) , m_pMessage( NULL ) , m_pBufferedMessage( NULL ) , m_nCurrentMessageMode( MESSAGE_WITH_ANSWER ) , m_pEventMessage( NULL ) { } CVANetNetworkProtocol::~CVANetNetworkProtocol() { if( m_pLastAnswerConnection ) m_pLastAnswerConnection->WaitForSendFinish(); delete m_pMessage; delete m_pBufferedMessage; } bool CVANetNetworkProtocol::InitializeAsClient( CVANetClientImpl* pClient, VistaConnectionIP* pCommandChannel, VistaConnectionIP* pHeadChannel, const int iExceptionhandlingmode, const bool bBufferSynchronisedModification ) { m_iExceptionHandlingMode = iExceptionhandlingmode; m_bBufferSynchronisedModification = bBufferSynchronisedModification; m_pClient = pClient; m_pCommandChannel = pCommandChannel; m_pHeadChannel = pHeadChannel; m_pMessage = new CVANetMessage( m_pCommandChannel->GetByteorderSwapFlag() ); m_pBufferedMessage = new CVANetMessage( m_pCommandChannel->GetByteorderSwapFlag() ); m_pEventMessage = new CVANetMessage( m_pCommandChannel->GetByteorderSwapFlag() ); SetExceptionHandlingMode( m_iExceptionHandlingMode ); return true; } bool CVANetNetworkProtocol::InitializeAsServer( CVANetServerImpl* pServer ) { m_pServer = pServer; m_pMessage = new CVANetMessage( VistaSerializingToolset::DOES_NOT_SWAP_MULTIBYTE_VALUES ); m_pEventMessage = new CVANetMessage( VistaSerializingToolset::DOES_NOT_SWAP_MULTIBYTE_VALUES ); return true; } void CVANetNetworkProtocol::SetExceptionHandlingMode( const int nMode ) { m_iExceptionHandlingMode = nMode; } int CVANetNetworkProtocol::GetExceptionHandlingMode() const { return m_iExceptionHandlingMode; } void CVANetNetworkProtocol::SetRealVACore( IVAInterface* pCore ) { m_pRealCore = pCore; } #define SERVER_FUNCTION_MAPPING(ID,FUNCTION) case (ID): { FUNCTION; break; } //#define SERVER_FUNCTION_MAPPING(ID,FUNCTION) case (ID): { std::cout << "Processing " << #ID << std::endl; FUNCTION; break; } void CVANetNetworkProtocol::ServerCallFunctionByMessageType( const int nMessageType, VistaConnectionIP* pConnection ) { switch( nMessageType ) { SERVER_FUNCTION_MAPPING( VA_NP_GET_VERSION_INFO, ServerGetVersionInfo() ); // Base functions SERVER_FUNCTION_MAPPING( VA_NP_GET_STATE, ServerGetState() ); SERVER_FUNCTION_MAPPING( VA_NP_INITIALIZE, ServerInitialize() ); SERVER_FUNCTION_MAPPING( VA_NP_FINALIZE, ServerFinalize() ); SERVER_FUNCTION_MAPPING( VA_NP_RESET, ServerReset() ); // Module interface SERVER_FUNCTION_MAPPING( VA_NP_GET_MODULES, ServerGetModules() ); SERVER_FUNCTION_MAPPING( VA_NP_CALL_MODULE, ServerCallModule() ); // Event handling SERVER_FUNCTION_MAPPING( VA_NP_ATTACH_EVENT_HANDLER, ServerAttachEventHandler( pConnection ) ); SERVER_FUNCTION_MAPPING( VA_NP_DETACH_EVENT_HANDLER, ServerDetachEventHandler( pConnection ) ); // Directivities SERVER_FUNCTION_MAPPING( VA_NP_CREATE_DIRECTIVITY, ServerCreateDirectivityFromParameters() ); SERVER_FUNCTION_MAPPING( VA_NP_DELETE_DIRECTIVITY, ServerDeleteDirectivity() ); SERVER_FUNCTION_MAPPING( VA_NP_GET_DIRECTIVITY_INFO, ServerGetDirectivityInfo() ); SERVER_FUNCTION_MAPPING( VA_NP_GET_DIRECTIVITY_INFOS, ServerGetDirectivityInfos() ); // Signal sources SERVER_FUNCTION_MAPPING( VA_NP_CREATE_SIGNAL_SOURCE_BUFFER_FROM_PARAMETERS, ServerCreateSignalSourceBufferFromParameters() ); SERVER_FUNCTION_MAPPING( VA_NP_CREATE_TTS_SIGNAL_SOURCE, ServerCreateTextToSpeechSignalSource() ); SERVER_FUNCTION_MAPPING( VA_NP_CREATE_SEQUENCER_SIGNALSOURCE, ServerCreateSequencerSignalSource() ); SERVER_FUNCTION_MAPPING( VA_NP_CREATE_NETWORK_STREAM_SIGNALSOURCE, ServerCreateNetworkStreamSignalSource() ); SERVER_FUNCTION_MAPPING( VA_NP_CREATE_ENGINE_SIGNALSOURCE, ServerCreateEngineSignalSource() ); SERVER_FUNCTION_MAPPING( VA_NP_CREATE_MACHINE_SIGNALSOURCE, ServerCreateSignalSourceMachine() ); SERVER_FUNCTION_MAPPING( VA_NP_DELETE_SIGNALSOURCE, ServerDeleteSignalSource() ); SERVER_FUNCTION_MAPPING( VA_NP_GET_SIGNALSOURCE_INFO, ServerGetSignalSourceInfo() ); SERVER_FUNCTION_MAPPING( VA_NP_GET_SIGNALSOURCE_INFOS, ServerGetSignalSourceInfos() ); SERVER_FUNCTION_MAPPING( VA_NP_GET_AUDIOFILE_SIGNALSOURCE_PLAYSTATE, ServerGetAudiofileSignalSourcePlaybackState() ); SERVER_FUNCTION_MAPPING( VA_NP_SET_AUDIOFILE_SIGNALSOURCE_PLAYACTION, ServerSetAudiofileSignalSourcePlaybackAction() ); SERVER_FUNCTION_MAPPING( VA_NP_SET_AUDIOFILE_SIGNALSOURCE_PLAYPOS, ServerSetAudiofileSignalSourcePlaybackPosition() ); SERVER_FUNCTION_MAPPING( VA_NP_SET_AUDIOFILE_SIGNALSOURCE_LOOPING, ServerSetSignalSourceBufferLooping() ); SERVER_FUNCTION_MAPPING( VA_NP_GET_AUDIOFILE_SIGNALSOURCE_LOOPING, ServerGetSignalSourceBufferLooping() ); SERVER_FUNCTION_MAPPING( VA_NP_GET_SIGNALSOURCE_PARAMETERS, ServerGetSignalSourceParameters() ); SERVER_FUNCTION_MAPPING( VA_NP_SET_SIGNALSOURCE_PARAMETERS, ServerSetSignalSourceParameters() ); // Synchronization functions SERVER_FUNCTION_MAPPING( VA_NP_LOCK_SCENE, ServerLockUpdate() ); SERVER_FUNCTION_MAPPING( VA_NP_UNLOCK_SCENE, ServerUnlockUpdate() ); SERVER_FUNCTION_MAPPING( VA_NP_IS_SCENE_LOCKED, ServerGetUpdateLocked() ); // Sound sources SERVER_FUNCTION_MAPPING( VA_NP_GET_SOUND_SOURCE_IDS, ServerGetSoundSourceIDs() ); SERVER_FUNCTION_MAPPING( VA_NP_CREATE_SOUNDSOURCE, ServerCreateSoundSource() ); SERVER_FUNCTION_MAPPING( VA_NP_CREATE_SOUNDSOURCE_EXPLICIT_RENDERER, ServerCreateSoundSourceExplicitRenderer() ); SERVER_FUNCTION_MAPPING( VA_NP_DELETE_SOUNDSOURCE, ServerDeleteSoundSource() ); SERVER_FUNCTION_MAPPING( VA_NP_SET_SOUNDSOURCE_ENABLED, ServerSetSoundSourceEnabled() ); SERVER_FUNCTION_MAPPING( VA_NP_GET_SOUNDSOURCE_ENABLED, ServerGetSoundSourceEnabled() ); SERVER_FUNCTION_MAPPING( VA_NP_SET_SOUNDSOURCE_NAME, ServerSetSoundSourceName() ); SERVER_FUNCTION_MAPPING( VA_NP_GET_SOUNDSOURCE_NAME, ServerGetSoundSourceName() ); SERVER_FUNCTION_MAPPING( VA_NP_SET_SOUNDSOURCE_SIGNALSOURCE, ServerSetSoundSourceSignalSource() ); SERVER_FUNCTION_MAPPING( VA_NP_GET_SOUNDSOURCE_SIGNALSOURCE, ServerGetSoundSourceSignalSource() ); SERVER_FUNCTION_MAPPING( VA_NP_SET_SOUNDSOURCE_AURAMODE, ServerSetSoundSourceAuralizationMode() ); SERVER_FUNCTION_MAPPING( VA_NP_GET_SOUNDSOURCE_AURAMODE, ServerGetSoundSourceAuralizationMode() ); SERVER_FUNCTION_MAPPING( VA_NP_SET_SOUNDSOURCE_PARAMETERS, ServerSetSoundSourceParameters() ); SERVER_FUNCTION_MAPPING( VA_NP_GET_SOUNDSOURCE_PARAMETERS, ServerGetSoundSourceParameters() ); SERVER_FUNCTION_MAPPING( VA_NP_SET_SOUNDSOURCE_DIRECTIVITY, ServerSetSoundSourceDirectivity() ); SERVER_FUNCTION_MAPPING( VA_NP_GET_SOUNDSOURCE_DIRECTIVITY, ServerGetSoundSourceDirectivity() ); SERVER_FUNCTION_MAPPING( VA_NP_SET_SOUNDSOURCE_SOUND_POWER, ServerSetSoundSourceSoundPower() ); SERVER_FUNCTION_MAPPING( VA_NP_GET_SOUNDSOURCE_SOUND_POWER, ServerGetSoundSourceSoundPower() ); SERVER_FUNCTION_MAPPING( VA_NP_SET_SOUNDSOURCE_MUTED, ServerSetSoundSourceMuted() ); SERVER_FUNCTION_MAPPING( VA_NP_IS_SOUNDSOURCE_MUTED, ServerGetSoundSourceMuted() ); SERVER_FUNCTION_MAPPING( VA_NP_SET_SOUNDSOURCE_POSITION, ServerSetSoundSourcePosition() ); SERVER_FUNCTION_MAPPING( VA_NP_GET_SOUNDSOURCE_POSITION, ServerGetSoundSourcePosition() ); SERVER_FUNCTION_MAPPING( VA_NP_SET_SOUNDSOURCE_ORIENTATION, ServerSetSoundSourceOrientation() ); SERVER_FUNCTION_MAPPING( VA_NP_GET_SOUNDSOURCE_ORIENTATION, ServerGetSoundSourceOrientation() ); SERVER_FUNCTION_MAPPING( VA_NP_SET_SOUNDSOURCE_ORIENTATION_VU, ServerSetSoundSourceOrientationVU() ); SERVER_FUNCTION_MAPPING( VA_NP_GET_SOUNDSOURCE_ORIENTATION_VU, ServerGetSoundSourceOrientationVU() ); // SoundReceivers SERVER_FUNCTION_MAPPING( VA_NP_GET_SOUND_RECEIVER_IDS, ServerGetSoundReceiverIDs() ); SERVER_FUNCTION_MAPPING( VA_NP_CREATE_SOUND_RECEIVER, ServerCreateSoundReceiver() ); SERVER_FUNCTION_MAPPING( VA_NP_CREATE_SOUND_RECEIVER_EXPLICIT_RENDERER, ServerCreateSoundReceiverExplicitRenderer() ); SERVER_FUNCTION_MAPPING( VA_NP_DELETE_SOUND_RECEIVER, ServerDeleteSoundReceiver() ); SERVER_FUNCTION_MAPPING( VA_NP_SET_SOUND_RECEIVER_ENABLED, ServerSetSoundReceiverEnabled() ); SERVER_FUNCTION_MAPPING( VA_NP_GET_SOUND_RECEIVER_ENABLED, ServerGetSoundReceiverEnabled() ); SERVER_FUNCTION_MAPPING( VA_NP_GET_SOUND_RECEIVER_NAME, ServerGetSoundReceiverName() ); SERVER_FUNCTION_MAPPING( VA_NP_SET_SOUND_RECEIVER_NAME, ServerSetSoundReceiverName() ); SERVER_FUNCTION_MAPPING( VA_NP_GET_SOUND_RECEIVER_AURALIZATION_MODE, ServerGetSoundReceiverAuralizationMode() ); SERVER_FUNCTION_MAPPING( VA_NP_SET_SOUND_RECEIVER_AURALIZATION_MODE, ServerSetSoundReceiverAuralizationMode() ); SERVER_FUNCTION_MAPPING( VA_NP_SET_SOUND_RECEIVER_PARAMETERS, ServerSetSoundReceiverParameters() ); SERVER_FUNCTION_MAPPING( VA_NP_GET_SOUND_RECEIVER_PARAMETERS, ServerGetSoundReceiverParameters() ); SERVER_FUNCTION_MAPPING( VA_NP_GET_SOUND_RECEIVER_DIRECTIVITY, ServerGetSoundReceiverDirectivity() ); SERVER_FUNCTION_MAPPING( VA_NP_SET_SOUND_RECEIVER_DIRECTIVITY, ServerSetSoundReceiverDirectivity() ); SERVER_FUNCTION_MAPPING( VA_NP_SET_SOUND_RECEIVER_POSITION, ServerSetSoundReceiverPosition() ); SERVER_FUNCTION_MAPPING( VA_NP_GET_SOUND_RECEIVER_POSITION, ServerGetSoundReceiverPosition() ); SERVER_FUNCTION_MAPPING( VA_NP_SET_SOUND_RECEIVER_ORIENTATION, ServerSetSoundReceiverOrientation() ); SERVER_FUNCTION_MAPPING( VA_NP_GET_SOUND_RECEIVER_ORIENTATION, ServerGetSoundReceiverOrientation() ); SERVER_FUNCTION_MAPPING( VA_NP_SET_SOUND_RECEIVER_ORIENTATION_VU, ServerSetSoundReceiverOrientationVU() ); SERVER_FUNCTION_MAPPING( VA_NP_GET_SOUND_RECEIVER_ORIENTATION_VU, ServerGetSoundReceiverOrientationVU() ); // Scene SERVER_FUNCTION_MAPPING( VA_NP_SCENE_CREATE, ServerCreateScene() ); SERVER_FUNCTION_MAPPING( VA_NP_GET_SCENE_IDS, ServerGetSceneIDs() ); SERVER_FUNCTION_MAPPING( VA_NP_GET_SCENE_INFO, ServerGetSceneInfo() ); SERVER_FUNCTION_MAPPING( VA_NP_GET_PORTAL_IDS, ServerGetSoundPortalIDs() ); SERVER_FUNCTION_MAPPING( VA_NP_GET_PORTAL_NAME, ServerGetSoundPortalName() ); SERVER_FUNCTION_MAPPING( VA_NP_SET_PORTAL_NAME, ServerSetSoundPortalName() ); SERVER_FUNCTION_MAPPING( VA_NP_GET_PORTAL_PARAMETERS, ServerGetSoundPortalParameters() ); SERVER_FUNCTION_MAPPING( VA_NP_SET_PORTAL_STATE, ServerSetPortalParameters() ); // Global functions SERVER_FUNCTION_MAPPING( VA_NP_GET_INPUT_GAIN, ServerGetInputGain() ); SERVER_FUNCTION_MAPPING( VA_NP_SET_INPUT_GAIN, ServerSetInputGain() ); SERVER_FUNCTION_MAPPING( VA_NP_IS_INPUT_MUTED, ServerGetInputMuted() ); SERVER_FUNCTION_MAPPING( VA_NP_SET_INPUT_MUTED, ServerSetInputMuted() ); SERVER_FUNCTION_MAPPING( VA_NP_GET_OUTPUT_GAIN, ServerGetOutputGain() ); SERVER_FUNCTION_MAPPING( VA_NP_SET_OUTPUT_GAIN, ServerSetOutputGain() ); SERVER_FUNCTION_MAPPING( VA_NP_IS_OUTPUT_MUTED, ServerGetOutputMuted() ); SERVER_FUNCTION_MAPPING( VA_NP_SET_OUTPUT_MUTED, ServerSetOutputMuted() ); SERVER_FUNCTION_MAPPING( VA_NP_GET_GLOBAL_AURALIZATION_MODE, ServerGetGlobalAuralizationMode() ); SERVER_FUNCTION_MAPPING( VA_NP_SET_GLOBAL_AURALIZATION_MODE, ServerSetGlobalAuralizationMode() ); SERVER_FUNCTION_MAPPING( VA_NP_GET_ACTIVE_LISTENER, ServerGetActiveListener() ); SERVER_FUNCTION_MAPPING( VA_NP_SET_ACTIVE_LISTENER, ServerSetActiveListener() ); SERVER_FUNCTION_MAPPING( VA_NP_GET_ACTIVE_LISTENER_EXPLICIT_RENDERER, ServerGetActiveListenerExplicitRenderer() ); SERVER_FUNCTION_MAPPING( VA_NP_SET_ACTIVE_LISTENER_EXPLICIT_RENDERER, ServerSetActiveListenerExplicitRenderer() ); SERVER_FUNCTION_MAPPING( VA_NP_GET_CORE_CLOCK, ServerGetCoreClock() ); SERVER_FUNCTION_MAPPING( VA_NP_SET_CORE_CLOCK, ServerSetCoreClock() ); SERVER_FUNCTION_MAPPING( VA_NP_SUBSTITUTE_MACROS, ServerSubstituteMacros() ); SERVER_FUNCTION_MAPPING( VA_NP_RENDERER_GET_INFOS, ServerGetRenderingModuleInfos() ); SERVER_FUNCTION_MAPPING( VA_NP_RENDERER_GET_GAIN, ServerGetRenderingModuleGain() ); SERVER_FUNCTION_MAPPING( VA_NP_RENDERER_SET_GAIN, ServerSetRenderingModuleGain() ); SERVER_FUNCTION_MAPPING( VA_NP_RENDERER_IS_MUTED, ServerIsRenderingModuleMuted() ); SERVER_FUNCTION_MAPPING( VA_NP_RENDERER_SET_MUTED, ServerSetRenderingModuleMuted() ); SERVER_FUNCTION_MAPPING( VA_NP_REPRODUCTION_GET_INFOS, ServerGetReproductionModuleInfos() ); SERVER_FUNCTION_MAPPING( VA_NP_REPRODUCTION_GET_GAIN, ServerGetReproductionModuleGain() ); SERVER_FUNCTION_MAPPING( VA_NP_REPRODUCTION_SET_GAIN, ServerSetReproductionModuleGain() ); SERVER_FUNCTION_MAPPING( VA_NP_REPRODUCTION_IS_MUTED, ServerIsReproductionModuleMuted() ); SERVER_FUNCTION_MAPPING( VA_NP_REPRODUCTION_SET_MUTED, ServerSetReproductionModuleMuted() ); case VA_NP_INVALID: default: { /** @todo: disconnect */ std::ostringstream oStream; oStream << "VANetServer: Unkown Message Type " << nMessageType; VA_EXCEPT2( PROTOCOL_ERROR, oStream.str() ); } } } bool CVANetNetworkProtocol::ProcessMessageFromClient( VistaConnectionIP* pConnection ) { assert( m_pRealCore != NULL ); // just to avoid false connection notifies - these can happen if( pConnection->PendingDataSize() == 0 ) return true; // Falls wir zuletzt eine Antwort gesendet haben, müssen wir nun warten, // bis das senden abgeschlossen ist, bevor wir die message leeren if( m_pLastAnswerConnection != NULL ) m_pLastAnswerConnection->WaitForSendFinish(); try { m_pMessage->ResetMessage(); m_pMessage->SetConnection( pConnection ); m_pMessage->ReadMessage(); } catch( VistaExceptionBase& oException ) { std::cerr << "VANetNetworkProtocol: caught connection exception - " << oException.GetExceptionText() << std::endl; return false; } int nMessageType = m_pMessage->GetMessageType(); // we assume an answer - if an exception occurs, or no answer is // sent, the value will be rewritten m_pMessage->SetAnswerType( VA_NP_SPECIAL_ANSWER ); // Es kann eine gebufferete Nachricht kommen. // In dem fall müssen wir mehrfach Befehle parsen // dies tun wir, bis der MessageBuffer leer ist try { if( nMessageType == VA_NP_SPECIAL_BUFFERED_MESSAGE ) { while( m_pMessage->GetIncomingMessageSize() > 0 ) { nMessageType = m_pMessage->ReadInt(); ServerCallFunctionByMessageType( nMessageType, pConnection ); } } else if( nMessageType == VA_NP_SPECIAL_CLIENT_EVENT ) { int nEventID = m_pMessage->ReadInt(); m_pServer->HandleClientEvent( nEventID, pConnection ); return true; } else { ServerCallFunctionByMessageType( nMessageType, pConnection ); } } catch( CVAException& oException ) { if( oException.GetErrorCode() == CVAException::PROTOCOL_ERROR ) throw; switch( m_pMessage->GetExceptionMode() ) { case IVANetClient::EXC_CLIENT_THROW: { m_pMessage->SetAnswerType( VA_NP_SPECIAL_EXCEPTION ); m_pMessage->WriteException( oException ); m_pMessage->WriteAnswer(); return true; } case IVANetClient::EXC_SERVER_PRINT: { std::cerr << "[IVANetServer]: Caught and swallowed exception :\n" << oException.ToString() << std::endl; return true; } } } if( m_pMessage->GetOutgoingMessageHasData() ) { m_pMessage->WriteAnswer(); } else if( m_pMessage->GetExceptionMode() == IVANetClient::EXC_CLIENT_THROW ) { m_pMessage->SetAnswerType( VA_NP_SPECIAL_NO_EXCEPTION ); m_pMessage->WriteAnswer(); } return true; } bool CVANetNetworkProtocol::GetBufferSynchronisedModification() const { return m_bBufferSynchronisedModification; } void CVANetNetworkProtocol::SetBufferSynchronisedModifications( const bool bSet ) { m_bBufferSynchronisedModification = bSet; } void CVANetNetworkProtocol::ClientPrepareMessageBuffering() { if( m_bBufferSynchronisedModification == false ) return; // @todo: how to handle this? ignore, still buffer command, abort? if( m_bBufferingActive == true ) return; // we are already buffering m_pBufferedMessage->ResetMessage(); m_pBufferedMessage->SetConnection( m_pCommandChannel ); m_pBufferedMessage->SetExceptionMode( IVANetClient::EXC_CLIENT_THROW ); m_pBufferedMessage->SetMessageType( VA_NP_SPECIAL_BUFFERED_MESSAGE ); m_bBufferingActive = true; } int CVANetNetworkProtocol::ClientEndMessageBuffering() { assert( m_bBufferingActive ); m_bBufferingActive = false; int iRet = -1; try { m_pBufferedMessage->SetExceptionMode( m_iExceptionHandlingMode ); m_pBufferedMessage->WriteMessage(); m_pBufferedMessage->ReadAnswer(); iRet = m_pBufferedMessage->ReadInt(); } catch( const VistaExceptionBase& oException ) { std::cerr << "VANetNetworkProtocol: caught exception during ClientEndMessageBuffering - " << oException.GetExceptionText() << std::endl; } return iRet; } int CVANetNetworkProtocol::ClientProcessEventMessageFromServer( VistaConnectionIP* pConnection, std::list liCoreEventHandler ) { m_pEventMessage->SetConnection( pConnection ); try { m_pEventMessage->ReadMessage(); switch( m_pEventMessage->GetMessageType() ) { case VA_EVENT_CORE_EVENT: { CVAEvent oEvent = m_pEventMessage->ReadEvent(); for( std::list::iterator itHandler = liCoreEventHandler.begin(); itHandler != liCoreEventHandler.end(); ++itHandler ) { ( *itHandler )->HandleVAEvent( &oEvent ); } break; } case VA_EVENT_NET_EVENT: { m_pClient->ProcessNetEvent( m_pEventMessage->ReadInt() ); break; } default: { VA_EXCEPT2( PROTOCOL_ERROR, std::string( "Unknown event message type" ) ); } } } catch( VistaExceptionBase& oException ) { VA_EXCEPT2( PROTOCOL_ERROR, std::string( "VANetNetworkProtocol: caught connection exception - " + oException.GetExceptionText() ) ); } return m_pEventMessage->GetMessageType(); } void CVANetNetworkProtocol::ServerPrepareEventMessage( const CVAEvent* pEvent, CVANetMessage* pMessage ) { pMessage->ResetMessage(); pMessage->SetMessageType( VA_EVENT_CORE_EVENT ); pMessage->WriteEvent( *pEvent ); } void CVANetNetworkProtocol::HandleConnectionClose( VistaConnectionIP* pConnection ) { if( m_pLastAnswerConnection == pConnection ) m_pLastAnswerConnection = NULL; if( m_pMessage->GetConnection() == pConnection ) m_pMessage->ClearConnection(); } CVANetMessage* CVANetNetworkProtocol::ServerGetMessage() { return m_pMessage; } void CVANetNetworkProtocol::ServerSendAnswer( CVANetMessage* ) { // nothing to do } CVANetMessage* CVANetNetworkProtocol::ClientInitMessage( int nCommandId, MESSAGE_MODE eMessageMode ) { m_nCurrentMessageMode = eMessageMode; if( eMessageMode == MESSAGE_ALLOWS_BUFFERING && m_bBufferingActive ) { m_pBufferedMessage->WriteInt( nCommandId ); return m_pBufferedMessage; } else { m_pMessage->ResetMessage(); m_pMessage->SetConnection( m_pCommandChannel ); m_pMessage->SetMessageType( nCommandId ); return m_pMessage; } } void CVANetNetworkProtocol::ClientSendCommand( CVANetMessage* pMessage ) { if( pMessage != m_pBufferedMessage ) { int nExceptionMode = -1; switch( m_nCurrentMessageMode ) { case MESSAGE_WITH_ANSWER: case MESSAGE_ENFORCED_EXCEPTION: { nExceptionMode = IVANetClient::EXC_CLIENT_THROW; break; } case MESSAGE_CONDITIONAL_EXCEPTION: case MESSAGE_ALLOWS_BUFFERING: { nExceptionMode = m_iExceptionHandlingMode; break; } } try { pMessage->SetExceptionMode( nExceptionMode ); pMessage->WriteMessage(); if( m_nCurrentMessageMode == MESSAGE_WITH_ANSWER ) { pMessage->ReadAnswer(); if( pMessage->GetAnswerType() == VA_NP_SPECIAL_EXCEPTION ) { throw( pMessage->ReadException() ); } else { assert( pMessage->GetAnswerType() == VA_NP_SPECIAL_ANSWER ); } } else if( nExceptionMode == IVANetClient::EXC_CLIENT_THROW ) { pMessage->ReadAnswer(); if( pMessage->GetAnswerType() == VA_NP_SPECIAL_EXCEPTION ) { throw( pMessage->ReadException() ); } else { assert( pMessage->GetAnswerType() == VA_NP_SPECIAL_NO_EXCEPTION ); } } } catch( const VistaExceptionBase& ) { //@todo } } } void CVANetNetworkProtocol::ClientGetVersionInfo( CVAVersionInfo* pVersionInfo ) { if( !pVersionInfo ) return; CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_VERSION_INFO, MESSAGE_WITH_ANSWER ); ClientSendCommand( pMsg ); *pVersionInfo = pMsg->ReadVersionInfo(); } void CVANetNetworkProtocol::ServerGetVersionInfo() { CVANetMessage* pMsg = ServerGetMessage(); CVAVersionInfo oVersionInfo; m_pRealCore->GetVersionInfo( &oVersionInfo ); pMsg->WriteVersionInfo( oVersionInfo ); } int CVANetNetworkProtocol::ClientGetState() { CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_STATE, MESSAGE_WITH_ANSWER ); ClientSendCommand( pMsg ); return pMsg->ReadInt(); } void CVANetNetworkProtocol::ServerGetState() { CVANetMessage* pMsg = ServerGetMessage(); int iState = m_pRealCore->GetState(); pMsg->WriteInt( iState ); } void CVANetNetworkProtocol::ClientInitialize() { CVANetMessage* pMsg = ClientInitMessage( VA_NP_INITIALIZE, MESSAGE_ENFORCED_EXCEPTION ); ClientSendCommand( pMsg ); } void CVANetNetworkProtocol::ServerInitialize() { m_pRealCore->Initialize(); } void CVANetNetworkProtocol::ClientFinalize() { CVANetMessage* pMsg = ClientInitMessage( VA_NP_FINALIZE, MESSAGE_ENFORCED_EXCEPTION ); ClientSendCommand( pMsg ); } void CVANetNetworkProtocol::ServerFinalize() { m_pRealCore->Finalize(); } void CVANetNetworkProtocol::ClientReset() { CVANetMessage* pMsg = ClientInitMessage( VA_NP_RESET, MESSAGE_ENFORCED_EXCEPTION ); ClientSendCommand( pMsg ); } void CVANetNetworkProtocol::ServerReset() { m_pRealCore->Reset(); } void CVANetNetworkProtocol::ClientAttachEventHandler() { CVANetMessage* pMsg = ClientInitMessage( VA_NP_ATTACH_EVENT_HANDLER, MESSAGE_ENFORCED_EXCEPTION ); ClientSendCommand( pMsg ); } void CVANetNetworkProtocol::ServerAttachEventHandler( VistaConnectionIP* pConn ) { m_pServer->AttachCoreEventHandler( pConn ); } void CVANetNetworkProtocol::ClientDetachEventHandler() { CVANetMessage* pMsg = ClientInitMessage( VA_NP_DETACH_EVENT_HANDLER, MESSAGE_ENFORCED_EXCEPTION ); ClientSendCommand( pMsg ); } void CVANetNetworkProtocol::ServerDetachEventHandler( VistaConnectionIP* pConn ) { m_pServer->DetachCoreEventHandler( pConn ); } void CVANetNetworkProtocol::ClientGetModules( std::vector& m_viModuleInfos ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_MODULES, MESSAGE_WITH_ANSWER ); ClientSendCommand( pMsg ); int nModules = pMsg->ReadInt(); m_viModuleInfos.clear(); m_viModuleInfos.resize( nModules ); for( int i = 0; i < nModules; i++ ) pMsg->ReadModuleInfo( m_viModuleInfos[ i ] ); } void CVANetNetworkProtocol::ServerGetModules() { CVANetMessage* pMsg = ServerGetMessage(); std::vector viModules; m_pRealCore->GetModules( viModules ); pMsg->WriteInt( ( int ) viModules.size() ); for( int i = 0; i < ( int ) viModules.size(); i++ ) pMsg->WriteModuleInfo( viModules[ i ] ); } CVAStruct CVANetNetworkProtocol::ClientCallModule( const std::string& sModuleName, const CVAStruct& oArgs ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_CALL_MODULE, MESSAGE_WITH_ANSWER ); pMsg->WriteString( sModuleName ); pMsg->WriteVAStruct( oArgs ); ClientSendCommand( pMsg ); CVAStruct oReturn; pMsg->ReadVAStruct( oReturn ); return oReturn; } void CVANetNetworkProtocol::ServerCallModule() { CVANetMessage* pMsg = ServerGetMessage(); std::string sModuleName = pMsg->ReadString(); CVAStruct oArgs; pMsg->ReadVAStruct( oArgs ); CVAStruct oReturn = m_pRealCore->CallModule( sModuleName, oArgs ); pMsg->WriteVAStruct( oReturn ); } int CVANetNetworkProtocol::ClientCreateDirectivityFromParameters( const CVAStruct& oParams, const std::string& sName ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_CREATE_DIRECTIVITY, MESSAGE_WITH_ANSWER ); pMsg->WriteVAStruct( oParams ); pMsg->WriteString( sName ); ClientSendCommand( pMsg ); return pMsg->ReadInt(); } void CVANetNetworkProtocol::ServerCreateDirectivityFromParameters() { CVANetMessage* pMsg = ServerGetMessage(); CVAStruct oParams; pMsg->ReadVAStruct( oParams ); std::string sName = pMsg->ReadString(); const int iDirID = m_pRealCore->CreateDirectivityFromParameters( oParams, sName ); pMsg->WriteInt( iDirID ); } bool CVANetNetworkProtocol::ClientDeleteDirectivity( const int iDirID ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_DELETE_DIRECTIVITY, MESSAGE_WITH_ANSWER ); pMsg->WriteInt( iDirID ); ClientSendCommand( pMsg ); return pMsg->ReadBool(); } void CVANetNetworkProtocol::ServerDeleteDirectivity() { CVANetMessage* pMsg = ServerGetMessage(); const int iDirID = pMsg->ReadInt(); const bool bRes = m_pRealCore->DeleteDirectivity( iDirID ); pMsg->WriteBool( bRes ); } CVADirectivityInfo CVANetNetworkProtocol::ClientGetDirectivityInfo( int iDirID ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_DIRECTIVITY_INFO, MESSAGE_WITH_ANSWER ); pMsg->WriteInt( iDirID ); ClientSendCommand( pMsg ); CVADirectivityInfo oDirInfo = pMsg->ReadDirectivityInfo(); return oDirInfo; } void CVANetNetworkProtocol::ServerGetDirectivityInfo() { CVANetMessage* pMsg = ServerGetMessage(); int iDirID = pMsg->ReadInt(); CVADirectivityInfo oDirInfo = m_pRealCore->GetDirectivityInfo( iDirID ); pMsg->WriteDirectivityInfo( oDirInfo ); } void CVANetNetworkProtocol::ClientGetDirectivityInfos( std::vector& vdiDest ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_DIRECTIVITY_INFOS, MESSAGE_WITH_ANSWER ); ClientSendCommand( pMsg ); vdiDest.clear(); int iNumDirectivities = pMsg->ReadInt(); for( int i = 0; i < iNumDirectivities; i++ ) vdiDest.push_back( pMsg->ReadDirectivityInfo() ); } void CVANetNetworkProtocol::ServerGetDirectivityInfos() { CVANetMessage* pMsg = ServerGetMessage(); std::vector vInfos; m_pRealCore->GetDirectivityInfos( vInfos ); pMsg->WriteInt( ( int ) vInfos.size() ); for( size_t i = 0; i < vInfos.size(); i++ ) pMsg->WriteDirectivityInfo( vInfos[ i ] ); } std::string CVANetNetworkProtocol::ClientCreateSignalSourceBufferFromParameters( const CVAStruct& oParams, const std::string& sName ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_CREATE_SIGNAL_SOURCE_BUFFER_FROM_PARAMETERS, MESSAGE_WITH_ANSWER ); pMsg->WriteVAStruct( oParams ); pMsg->WriteString( sName ); ClientSendCommand( pMsg ); return pMsg->ReadString(); } void CVANetNetworkProtocol::ServerCreateSignalSourceBufferFromParameters() { CVANetMessage* pMsg = ServerGetMessage(); CVAStruct oParams; pMsg->ReadVAStruct( oParams ); std::string sName = pMsg->ReadString(); std::string sID = m_pRealCore->CreateSignalSourceBufferFromParameters( oParams, sName ); pMsg->WriteString( sID ); } std::string CVANetNetworkProtocol::ClientCreateTextToSpeechSignalSource( const std::string& sName ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_CREATE_TTS_SIGNAL_SOURCE, MESSAGE_WITH_ANSWER ); pMsg->WriteString( sName ); ClientSendCommand( pMsg ); return pMsg->ReadString(); } void CVANetNetworkProtocol::ServerCreateTextToSpeechSignalSource() { CVANetMessage* pMsg = ServerGetMessage(); std::string sName = pMsg->ReadString(); std::string sID = m_pRealCore->CreateSignalSourceTextToSpeech( sName ); pMsg->WriteString( sID ); } std::string CVANetNetworkProtocol::ClientCreateSequencerSignalSource( const std::string& sName ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_CREATE_SEQUENCER_SIGNALSOURCE, MESSAGE_WITH_ANSWER ); pMsg->WriteString( sName ); ClientSendCommand( pMsg ); return pMsg->ReadString(); } void CVANetNetworkProtocol::ServerCreateSequencerSignalSource() { CVANetMessage* pMsg = ServerGetMessage(); std::string sName = pMsg->ReadString(); std::string sID = m_pRealCore->CreateSignalSourceSequencer( sName ); pMsg->WriteString( sID ); } std::string CVANetNetworkProtocol::ClientCreateNetworkStreamSignalSource( const std::string& sInterface, const int iPort, const std::string& sName ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_CREATE_NETWORK_STREAM_SIGNALSOURCE, MESSAGE_WITH_ANSWER ); pMsg->WriteString( sInterface ); pMsg->WriteInt( iPort ); pMsg->WriteString( sName ); ClientSendCommand( pMsg ); return pMsg->ReadString(); } void CVANetNetworkProtocol::ServerCreateNetworkStreamSignalSource() { CVANetMessage* pMsg = ServerGetMessage(); std::string sInterface = pMsg->ReadString(); int iPort = pMsg->ReadInt(); std::string sName = pMsg->ReadString(); std::string iID = m_pRealCore->CreateSignalSourceNetworkStream( sInterface, iPort, sName ); pMsg->WriteString( iID ); } std::string CVANetNetworkProtocol::ClientCreateEngineSignalSource( const CVAStruct& oParams, const std::string& sName ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_CREATE_ENGINE_SIGNALSOURCE, MESSAGE_WITH_ANSWER ); pMsg->WriteVAStruct( oParams ); pMsg->WriteString( sName ); ClientSendCommand( pMsg ); return pMsg->ReadString(); } void CVANetNetworkProtocol::ServerCreateEngineSignalSource() { CVANetMessage* pMsg = ServerGetMessage(); CVAStruct oParams; pMsg->ReadVAStruct( oParams ); std::string sName = pMsg->ReadString(); std::string sID = m_pRealCore->CreateSignalSourceEngine( oParams, sName ); pMsg->WriteString( sID ); } std::string CVANetNetworkProtocol::ClientCreateSignalSourceMachine( const CVAStruct& oParams, const std::string& sName ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_CREATE_MACHINE_SIGNALSOURCE, MESSAGE_WITH_ANSWER ); pMsg->WriteVAStruct( oParams ); pMsg->WriteString( sName ); ClientSendCommand( pMsg ); return pMsg->ReadString(); } void CVANetNetworkProtocol::ServerCreateSignalSourceMachine() { CVANetMessage* pMsg = ServerGetMessage(); CVAStruct oParams; pMsg->ReadVAStruct( oParams ); std::string sName = pMsg->ReadString(); std::string sID = m_pRealCore->CreateSignalSourceMachine( oParams, sName ); pMsg->WriteString( sID ); } bool CVANetNetworkProtocol::ClientDeleteSignalSource( const std::string& sID ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_DELETE_SIGNALSOURCE, MESSAGE_WITH_ANSWER ); pMsg->WriteString( sID ); ClientSendCommand( pMsg ); return pMsg->ReadBool(); } void CVANetNetworkProtocol::ServerDeleteSignalSource() { CVANetMessage* pMsg = ServerGetMessage(); std::string sID = pMsg->ReadString(); bool bResult = m_pRealCore->DeleteSignalSource( sID ); pMsg->WriteBool( bResult ); } std::string CVANetNetworkProtocol::ClientGetSoundSourceSignalSource( const int iSoundSourceID ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_SOUNDSOURCE_SIGNALSOURCE, MESSAGE_WITH_ANSWER ); pMsg->WriteInt( iSoundSourceID ); ClientSendCommand( pMsg ); return pMsg->ReadString(); } void CVANetNetworkProtocol::ServerGetSoundSourceSignalSource() { CVANetMessage* pMsg = ServerGetMessage(); const int iID = pMsg->ReadInt(); std::string sSignalSourceID = m_pRealCore->GetSoundSourceSignalSource( iID ); pMsg->WriteString( sSignalSourceID ); } CVASignalSourceInfo CVANetNetworkProtocol::ClientGetSignalSourceInfo( const std::string& sSignalSourceID ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_SIGNALSOURCE_INFO, MESSAGE_WITH_ANSWER ); pMsg->WriteString( sSignalSourceID ); ClientSendCommand( pMsg ); CVASignalSourceInfo oSignalSourceInfo = pMsg->ReadSignalSourceInfo(); return oSignalSourceInfo; } void CVANetNetworkProtocol::ServerGetSignalSourceInfo() { CVANetMessage* pMsg = ServerGetMessage(); std::string sSignalSourceID = pMsg->ReadString(); CVASignalSourceInfo oSignalSourceInfo = m_pRealCore->GetSignalSourceInfo( sSignalSourceID ); pMsg->WriteSignalSourceInfo( oSignalSourceInfo ); } void CVANetNetworkProtocol::ClientGetSignalSourceInfos( std::vector& vssiDest ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_SIGNALSOURCE_INFOS, MESSAGE_WITH_ANSWER ); ClientSendCommand( pMsg ); vssiDest.clear(); int iNumSignalSources = pMsg->ReadInt(); for( int i = 0; i < iNumSignalSources; i++ ) vssiDest.push_back( pMsg->ReadSignalSourceInfo() ); } void CVANetNetworkProtocol::ServerGetSignalSourceInfos() { CVANetMessage* pMsg = ServerGetMessage(); std::vector vInfos; m_pRealCore->GetSignalSourceInfos( vInfos ); pMsg->WriteInt( ( int ) vInfos.size() ); for( size_t i = 0; i < vInfos.size(); i++ ) pMsg->WriteSignalSourceInfo( vInfos[ i ] ); } int CVANetNetworkProtocol::ClientGetAudiofileSignalSourcePlaybackState( const std::string& sSignalSourceID ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_AUDIOFILE_SIGNALSOURCE_PLAYSTATE, MESSAGE_WITH_ANSWER ); pMsg->WriteString( sSignalSourceID ); ClientSendCommand( pMsg ); const int iPlayState = pMsg->ReadInt(); return iPlayState; } void CVANetNetworkProtocol::ServerGetAudiofileSignalSourcePlaybackState() { CVANetMessage* pMsg = ServerGetMessage(); std::string sSignalSourceID = pMsg->ReadString(); const int iPlayState = m_pRealCore->GetSignalSourceBufferPlaybackState( sSignalSourceID ); pMsg->WriteInt( iPlayState ); } void CVANetNetworkProtocol::ClientSetAudiofileSignalSourcePlaybackAction( const std::string& sSignalSourceID, const int iPlayAction ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_AUDIOFILE_SIGNALSOURCE_PLAYACTION, MESSAGE_ALLOWS_BUFFERING ); pMsg->WriteString( sSignalSourceID ); pMsg->WriteInt( iPlayAction ); ClientSendCommand( pMsg ); } void CVANetNetworkProtocol::ServerSetAudiofileSignalSourcePlaybackAction() { CVANetMessage* pMsg = ServerGetMessage(); std::string sSignalSourceID = pMsg->ReadString(); int iPlayAction = pMsg->ReadInt(); m_pRealCore->SetSignalSourceBufferPlaybackAction( sSignalSourceID, iPlayAction ); } void CVANetNetworkProtocol::ClientSetSignalSourceBufferLooping( const std::string& sSignalSourceID, const bool bLooping ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_AUDIOFILE_SIGNALSOURCE_LOOPING, MESSAGE_ALLOWS_BUFFERING ); pMsg->WriteString( sSignalSourceID ); pMsg->WriteBool( bLooping ); ClientSendCommand( pMsg ); } void CVANetNetworkProtocol::ServerSetSignalSourceBufferLooping() { CVANetMessage* pMsg = ServerGetMessage(); std::string sSignalSourceID = pMsg->ReadString(); bool bLooping = pMsg->ReadBool(); m_pRealCore->SetSignalSourceBufferLooping( sSignalSourceID, bLooping ); } bool CVANetNetworkProtocol::ClientGetSignalSourceBufferLooping( const std::string& sSignalSourceID ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_AUDIOFILE_SIGNALSOURCE_LOOPING, MESSAGE_WITH_ANSWER ); pMsg->WriteString( sSignalSourceID ); ClientSendCommand( pMsg ); bool bLooping = pMsg->ReadBool(); return bLooping; } void CVANetNetworkProtocol::ServerGetSignalSourceBufferLooping() { CVANetMessage* pMsg = ServerGetMessage(); std::string sSignalSourceID = pMsg->ReadString(); bool bLooping = m_pRealCore->GetSignalSourceBufferLooping( sSignalSourceID ); pMsg->WriteBool( bLooping ); } void CVANetNetworkProtocol::ClientSetAudiofileSignalSourcePlaybackPosition( const std::string& sSignalSourceID, const double dPlaybackPosition ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_AUDIOFILE_SIGNALSOURCE_PLAYPOS, MESSAGE_ALLOWS_BUFFERING ); pMsg->WriteString( sSignalSourceID ); pMsg->WriteDouble( dPlaybackPosition ); ClientSendCommand( pMsg ); } void CVANetNetworkProtocol::ServerSetAudiofileSignalSourcePlaybackPosition() { CVANetMessage* pMsg = ServerGetMessage(); std::string sSignalSourceID = pMsg->ReadString(); double dPlaybackPosition = pMsg->ReadDouble(); m_pRealCore->SetSignalSourceBufferPlaybackPosition( sSignalSourceID, dPlaybackPosition ); } void CVANetNetworkProtocol::ClientSetSignalSourceParameters( const std::string& sSignalSourceID, const CVAStruct& oParams ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_SIGNALSOURCE_PARAMETERS, MESSAGE_ALLOWS_BUFFERING ); pMsg->WriteString( sSignalSourceID ); pMsg->WriteVAStruct( oParams ); ClientSendCommand( pMsg ); return; } void CVANetNetworkProtocol::ServerSetSignalSourceParameters() { CVANetMessage* pMsg = ServerGetMessage(); std::string sID = pMsg->ReadString(); CVAStruct oParams; pMsg->ReadVAStruct( oParams ); m_pRealCore->SetSignalSourceParameters( sID, oParams ); return; } CVAStruct CVANetNetworkProtocol::ClientGetSignalSourceParameters( const std::string& sSignalSourceID, const CVAStruct& oParams ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_SIGNALSOURCE_PARAMETERS, MESSAGE_WITH_ANSWER ); pMsg->WriteString( sSignalSourceID ); pMsg->WriteVAStruct( oParams ); ClientSendCommand( pMsg ); CVAStruct oRet; pMsg->ReadVAStruct( oRet ); return oRet; } void CVANetNetworkProtocol::ServerGetSignalSourceParameters() { CVANetMessage* pMsg = ServerGetMessage(); std::string sID = pMsg->ReadString(); CVAStruct oParams; pMsg->ReadVAStruct( oParams ); CVAStruct oRet = m_pRealCore->GetSignalSourceParameters( sID, oParams ); pMsg->WriteVAStruct( oRet ); return; } void CVANetNetworkProtocol::ClientLockUpdate() { ClientPrepareMessageBuffering(); CVANetMessage* pMsg = ClientInitMessage( VA_NP_LOCK_SCENE, MESSAGE_ALLOWS_BUFFERING ); ClientSendCommand( pMsg ); } void CVANetNetworkProtocol::ServerLockUpdate() { m_pRealCore->LockUpdate(); } int CVANetNetworkProtocol::ClientUnlockScene() { if( m_bBufferingActive == false ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_UNLOCK_SCENE, MESSAGE_WITH_ANSWER ); ClientSendCommand( pMsg ); return pMsg->ReadInt(); } else { ClientInitMessage( VA_NP_UNLOCK_SCENE, MESSAGE_ALLOWS_BUFFERING ); return ClientEndMessageBuffering(); } } void CVANetNetworkProtocol::ServerUnlockUpdate() { CVANetMessage* pMsg = ServerGetMessage(); int iResult = m_pRealCore->UnlockUpdate(); pMsg->WriteInt( iResult ); } bool CVANetNetworkProtocol::ClientGetUpdateLocked() { if( m_bBufferingActive ) return true; CVANetMessage* pMsg = ClientInitMessage( VA_NP_IS_SCENE_LOCKED, MESSAGE_WITH_ANSWER ); ClientSendCommand( pMsg ); return pMsg->ReadBool(); } void CVANetNetworkProtocol::ServerGetUpdateLocked() { CVANetMessage* pMsg = ServerGetMessage(); const bool bResult = m_pRealCore->GetUpdateLocked(); pMsg->WriteBool( bResult ); } void CVANetNetworkProtocol::ClientGetSoundSourceIDs( std::vector& vSoundSourceIDs ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_SOUND_SOURCE_IDS, MESSAGE_WITH_ANSWER ); ClientSendCommand( pMsg ); vSoundSourceIDs.clear(); const int iNumElems = pMsg->ReadInt(); for( int i = 0; i < iNumElems; i++ ) vSoundSourceIDs.push_back( pMsg->ReadInt() ); } void CVANetNetworkProtocol::ServerGetSoundSourceIDs() { CVANetMessage* pMsg = ServerGetMessage(); std::vector vIDs; m_pRealCore->GetSoundSourceIDs( vIDs ); pMsg->WriteInt( ( int ) vIDs.size() ); for( size_t i = 0; i < vIDs.size(); i++ ) pMsg->WriteInt( vIDs[ i ] ); } int CVANetNetworkProtocol::ClientCreateSoundSource( const std::string& sName ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_CREATE_SOUNDSOURCE, MESSAGE_WITH_ANSWER ); pMsg->WriteString( sName ); ClientSendCommand( pMsg ); return pMsg->ReadInt(); } void CVANetNetworkProtocol::ServerCreateSoundSource() { CVANetMessage* pMsg = ServerGetMessage(); std::string sName = pMsg->ReadString(); const int iID = m_pRealCore->CreateSoundSource( sName ); pMsg->WriteInt( iID ); } int CVANetNetworkProtocol::ClientCreateSoundSourceExplicitRenderer( const std::string& sRendererID, const std::string& sName ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_CREATE_SOUNDSOURCE_EXPLICIT_RENDERER, MESSAGE_WITH_ANSWER ); pMsg->WriteString( sRendererID ); pMsg->WriteString( sName ); ClientSendCommand( pMsg ); return pMsg->ReadInt(); } void CVANetNetworkProtocol::ServerCreateSoundSourceExplicitRenderer() { CVANetMessage* pMsg = ServerGetMessage(); std::string sRendererID = pMsg->ReadString(); std::string sName = pMsg->ReadString(); const int iID = m_pRealCore->CreateSoundSourceExplicitRenderer( sRendererID, sName ); pMsg->WriteInt( iID ); } int CVANetNetworkProtocol::ClientDeleteSoundSource( const int iSoundSourceID ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_DELETE_SOUNDSOURCE, MESSAGE_WITH_ANSWER ); pMsg->WriteInt( iSoundSourceID ); ClientSendCommand( pMsg ); return pMsg->ReadInt(); } void CVANetNetworkProtocol::ServerDeleteSoundSource() { CVANetMessage* pMsg = ServerGetMessage(); const int iSoundSourceID = pMsg->ReadInt(); const int iReturn = m_pRealCore->DeleteSoundSource( iSoundSourceID ); pMsg->WriteInt( iReturn ); } void CVANetNetworkProtocol::ClientSetSoundSourceEnabled( const int iID, const bool bEnabled ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_SOUNDSOURCE_ENABLED, MESSAGE_ALLOWS_BUFFERING ); pMsg->WriteInt( iID ); pMsg->WriteBool( bEnabled ); ClientSendCommand( pMsg ); } void CVANetNetworkProtocol::ServerSetSoundSourceEnabled() { CVANetMessage* pMsg = ServerGetMessage(); const int iID = pMsg->ReadInt(); const bool bEnabled = pMsg->ReadBool(); m_pRealCore->SetSoundSourceEnabled( iID, bEnabled ); } bool CVANetNetworkProtocol::ClientGetSoundSourceEnabled( const int iID ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_SOUNDSOURCE_ENABLED, MESSAGE_ALLOWS_BUFFERING ); pMsg->WriteInt( iID ); ClientSendCommand( pMsg ); return pMsg->ReadBool(); } void CVANetNetworkProtocol::ServerGetSoundSourceEnabled() { CVANetMessage* pMsg = ServerGetMessage(); const int iID = pMsg->ReadInt(); const bool bEnabled = m_pRealCore->GetSoundSourceEnabled( iID ); pMsg->WriteBool( bEnabled ); } void CVANetNetworkProtocol::ClientSetSoundSourceName( const int iSoundSourceID, const std::string& sName ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_SOUNDSOURCE_NAME, MESSAGE_ALLOWS_BUFFERING ); pMsg->WriteInt( iSoundSourceID ); pMsg->WriteString( sName ); ClientSendCommand( pMsg ); } void CVANetNetworkProtocol::ServerSetSoundSourceName() { CVANetMessage* pMsg = ServerGetMessage(); const int iSoundSourceID = pMsg->ReadInt(); std::string sName = pMsg->ReadString(); m_pRealCore->SetSoundSourceName( iSoundSourceID, sName ); } std::string CVANetNetworkProtocol::ClientGetSoundSourceName( const int iSoundSourceID ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_SOUNDSOURCE_NAME, MESSAGE_WITH_ANSWER ); pMsg->WriteInt( iSoundSourceID ); ClientSendCommand( pMsg ); return pMsg->ReadString(); } void CVANetNetworkProtocol::ServerGetSoundSourceName() { CVANetMessage* pMsg = ServerGetMessage(); const int iSoundSourceID = pMsg->ReadInt(); std::string sName = m_pRealCore->GetSoundSourceName( iSoundSourceID ); pMsg->WriteString( sName ); } void CVANetNetworkProtocol::ClientSetSoundSourceAuralizationMode( int iSoundSourceID, int iAuralizationMode ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_SOUNDSOURCE_AURAMODE, MESSAGE_ALLOWS_BUFFERING ); pMsg->WriteInt( iSoundSourceID ); pMsg->WriteInt( iAuralizationMode ); ClientSendCommand( pMsg ); } void CVANetNetworkProtocol::ServerSetSoundSourceAuralizationMode() { CVANetMessage* pMsg = ServerGetMessage(); int iSoundSourceID = pMsg->ReadInt(); int iAuralizationMode = pMsg->ReadInt(); m_pRealCore->SetSoundSourceAuralizationMode( iSoundSourceID, iAuralizationMode ); } int CVANetNetworkProtocol::ClientGetSoundSourceAuralizationMode( int iSoundSourceID ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_SOUNDSOURCE_AURAMODE, MESSAGE_WITH_ANSWER ); pMsg->WriteInt( iSoundSourceID ); ClientSendCommand( pMsg ); return pMsg->ReadInt(); } void CVANetNetworkProtocol::ServerGetSoundSourceAuralizationMode() { CVANetMessage* pMsg = ServerGetMessage(); int iSoundSourceID = pMsg->ReadInt(); int iAuralizationMode = m_pRealCore->GetSoundSourceAuralizationMode( iSoundSourceID ); pMsg->WriteInt( iAuralizationMode ); } CVAStruct CVANetNetworkProtocol::ClientGetSoundSourceParameters( const int iID, const CVAStruct& oArgs ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_SOUNDSOURCE_PARAMETERS, MESSAGE_ALLOWS_BUFFERING ); pMsg->WriteInt( iID ); pMsg->WriteVAStruct( oArgs ); ClientSendCommand( pMsg ); CVAStruct oRet; pMsg->ReadVAStruct( oRet ); return oRet; } void CVANetNetworkProtocol::ServerGetSoundSourceParameters() { CVANetMessage* pMsg = ServerGetMessage(); int iID = pMsg->ReadInt(); CVAStruct oArgs; pMsg->ReadVAStruct( oArgs ); CVAStruct oRet = m_pRealCore->GetSoundSourceParameters( iID, oArgs ); pMsg->WriteVAStruct( oRet ); return; } void CVANetNetworkProtocol::ClientSetSoundSourceParameters( int iID, const CVAStruct& oParams ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_SOUNDSOURCE_PARAMETERS, MESSAGE_ALLOWS_BUFFERING ); pMsg->WriteInt( iID ); pMsg->WriteVAStruct( oParams ); ClientSendCommand( pMsg ); return; } void CVANetNetworkProtocol::ServerSetSoundSourceParameters() { CVANetMessage* pMsg = ServerGetMessage(); int iID = pMsg->ReadInt(); CVAStruct oParams; pMsg->ReadVAStruct( oParams ); m_pRealCore->SetSoundSourceParameters( iID, oParams ); return; } int CVANetNetworkProtocol::ClientGetSoundSourceDirectivity( int iSoundSourceID ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_SOUNDSOURCE_DIRECTIVITY, MESSAGE_WITH_ANSWER ); pMsg->WriteInt( iSoundSourceID ); ClientSendCommand( pMsg ); return pMsg->ReadInt(); } void CVANetNetworkProtocol::ServerGetSoundSourceDirectivity() { CVANetMessage* pMsg = ServerGetMessage(); int iSoundSourceID = pMsg->ReadInt(); int iDirectivityID = m_pRealCore->GetSoundSourceDirectivity( iSoundSourceID ); pMsg->WriteInt( iDirectivityID ); } void CVANetNetworkProtocol::ClientSetSoundSourceDirectivity( int iSoundSourceID, int iDirectivityID ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_SOUNDSOURCE_DIRECTIVITY, MESSAGE_ALLOWS_BUFFERING ); pMsg->WriteInt( iSoundSourceID ); pMsg->WriteInt( iDirectivityID ); ClientSendCommand( pMsg ); } void CVANetNetworkProtocol::ServerSetSoundSourceDirectivity() { CVANetMessage* pMsg = ServerGetMessage(); int iSoundSourceID = pMsg->ReadInt(); int iDirectivityID = pMsg->ReadInt(); m_pRealCore->SetSoundSourceDirectivity( iSoundSourceID, iDirectivityID ); } void CVANetNetworkProtocol::ClientSetSoundSourceSoundPower( const int iSoundSourceID, const double dPower ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_SOUNDSOURCE_SOUND_POWER, MESSAGE_ALLOWS_BUFFERING ); pMsg->WriteInt( iSoundSourceID ); pMsg->WriteDouble( dPower ); ClientSendCommand( pMsg ); } void CVANetNetworkProtocol::ServerSetSoundSourceSoundPower() { CVANetMessage* pMsg = ServerGetMessage(); const int iSoundSourceID = pMsg->ReadInt(); const double dPower = pMsg->ReadDouble(); m_pRealCore->SetSoundSourceSoundPower( iSoundSourceID, dPower ); } double CVANetNetworkProtocol::ClientGetSoundSourceSoundPower( const int iSoundSourceID ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_SOUNDSOURCE_SOUND_POWER, MESSAGE_WITH_ANSWER ); pMsg->WriteInt( iSoundSourceID ); ClientSendCommand( pMsg ); return pMsg->ReadDouble(); } void CVANetNetworkProtocol::ServerGetSoundSourceSoundPower() { CVANetMessage* pMsg = ServerGetMessage(); const int iSoundSourceID = pMsg->ReadInt(); const double dPower = m_pRealCore->GetSoundSourceSoundPower( iSoundSourceID ); pMsg->WriteDouble( dPower ); } void CVANetNetworkProtocol::ClientSetSoundSourceMuted( const int iSoundSourceID, const bool bMuted ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_SOUNDSOURCE_MUTED, MESSAGE_ALLOWS_BUFFERING ); pMsg->WriteInt( iSoundSourceID ); pMsg->WriteBool( bMuted ); ClientSendCommand( pMsg ); } void CVANetNetworkProtocol::ServerSetSoundSourceMuted() { CVANetMessage* pMsg = ServerGetMessage(); const int iSoundSourceID = pMsg->ReadInt(); const bool bMuted = pMsg->ReadBool(); m_pRealCore->SetSoundSourceMuted( iSoundSourceID, bMuted ); } bool CVANetNetworkProtocol::ClientGetSoundSourceMuted( const int iSoundSourceID ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_IS_SOUNDSOURCE_MUTED, MESSAGE_WITH_ANSWER ); pMsg->WriteInt( iSoundSourceID ); ClientSendCommand( pMsg ); return pMsg->ReadBool(); } void CVANetNetworkProtocol::ServerGetSoundSourceMuted() { CVANetMessage* pMsg = ServerGetMessage(); const int iSoundSourceID = pMsg->ReadInt(); const bool bMuted = m_pRealCore->GetSoundSourceMuted( iSoundSourceID ); pMsg->WriteBool( bMuted ); } void CVANetNetworkProtocol::ClientSetSoundSourcePose( const int iSoundSourceID, const VAVec3& vPos, const VAQuat& qOrient ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_SOUNDSOURCE_POSE, MESSAGE_ALLOWS_BUFFERING ); pMsg->WriteInt( iSoundSourceID ); pMsg->WriteVec3( vPos ); pMsg->WriteQuat( qOrient ); ClientSendCommand( pMsg ); } void CVANetNetworkProtocol::ServerSetSoundSourcePose() { CVANetMessage* pMsg = ServerGetMessage(); int iSoundSourceID = pMsg->ReadInt(); const VAVec3 v3Pos = pMsg->ReadVec3(); const VAQuat qOrient = pMsg->ReadQuat(); m_pRealCore->SetSoundSourcePose( iSoundSourceID, v3Pos, qOrient ); } void CVANetNetworkProtocol::ClientGetSoundSourcePose( const int iID, VAVec3& vPos, VAQuat& qOrient ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_SOUNDSOURCE_POSE, MESSAGE_WITH_ANSWER ); pMsg->WriteInt( iID ); ClientSendCommand( pMsg ); vPos = pMsg->ReadVec3(); qOrient = pMsg->ReadQuat(); } void CVANetNetworkProtocol::ServerGetSoundSourcePose() { CVANetMessage* pMsg = ServerGetMessage(); const int iID = pMsg->ReadInt(); VAVec3 v3Pos; VAQuat qOrient; m_pRealCore->GetSoundSourcePose( iID, v3Pos, qOrient ); pMsg->WriteVec3( v3Pos ); pMsg->WriteQuat( qOrient ); } void CVANetNetworkProtocol::ClientSetSoundSourcePosition( const int iSoundSourceID, const VAVec3& vPos ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_SOUNDSOURCE_POSITION, MESSAGE_ALLOWS_BUFFERING ); pMsg->WriteInt( iSoundSourceID ); pMsg->WriteVec3( vPos ); ClientSendCommand( pMsg ); } void CVANetNetworkProtocol::ServerSetSoundSourcePosition() { CVANetMessage* pMsg = ServerGetMessage(); int iSoundSourceID = pMsg->ReadInt(); const VAVec3 v3Pos = pMsg->ReadVec3(); m_pRealCore->SetSoundSourcePosition( iSoundSourceID, v3Pos ); } VAVec3 CVANetNetworkProtocol::ClientGetSoundSourcePosition( const int iSoundSourceID ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_SOUNDSOURCE_POSITION, MESSAGE_WITH_ANSWER ); pMsg->WriteInt( iSoundSourceID ); ClientSendCommand( pMsg ); const VAVec3 vPos = pMsg->ReadVec3(); return vPos; } void CVANetNetworkProtocol::ServerGetSoundSourcePosition() { CVANetMessage* pMsg = ServerGetMessage(); const int iSoundSourceID = pMsg->ReadInt(); VAVec3 v3Pos = m_pRealCore->GetSoundSourcePosition( iSoundSourceID ); pMsg->WriteVec3( v3Pos ); } void CVANetNetworkProtocol::ClientSetSoundSourceOrientation( const int iID, const VAQuat& qOrient ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_SOUNDSOURCE_POSITION, MESSAGE_ALLOWS_BUFFERING ); pMsg->WriteInt( iID ); pMsg->WriteQuat( qOrient ); ClientSendCommand( pMsg ); } void CVANetNetworkProtocol::ServerSetSoundSourceOrientation() { CVANetMessage* pMsg = ServerGetMessage(); const int iID = pMsg->ReadInt(); const VAQuat qOrient = pMsg->ReadQuat(); m_pRealCore->SetSoundSourceOrientation( iID, qOrient ); } VAQuat CVANetNetworkProtocol::ClientGetSoundSourceOrientation( const int iID ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_SOUNDSOURCE_ORIENTATION, MESSAGE_WITH_ANSWER ); pMsg->WriteInt( iID ); ClientSendCommand( pMsg ); const VAQuat qOrient = pMsg->ReadQuat(); return qOrient; } void CVANetNetworkProtocol::ServerGetSoundSourceOrientation() { CVANetMessage* pMsg = ServerGetMessage(); const int iID = pMsg->ReadInt(); VAQuat qOrient = m_pRealCore->GetSoundSourceOrientation( iID ); pMsg->WriteQuat( qOrient ); } void CVANetNetworkProtocol::ClientSetSoundSourceOrientationVU( const int iID, const VAVec3& v3View, const VAVec3& v3Up ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_SOUNDSOURCE_ORIENTATION_VU, MESSAGE_ALLOWS_BUFFERING ); pMsg->WriteInt( iID ); pMsg->WriteVec3( v3View ); pMsg->WriteVec3( v3Up ); ClientSendCommand( pMsg ); } void CVANetNetworkProtocol::ServerSetSoundSourceOrientationVU() { CVANetMessage* pMsg = ServerGetMessage(); const int iID = pMsg->ReadInt(); const VAVec3 v3View = pMsg->ReadVec3(); const VAVec3 v3Up = pMsg->ReadVec3(); m_pRealCore->SetSoundSourceOrientationVU( iID, v3View, v3Up ); } void CVANetNetworkProtocol::ClientGetSoundSourceOrientationVU( const int iID, VAVec3& v3View, VAVec3& v3Up ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_SOUNDSOURCE_ORIENTATION_VU, MESSAGE_WITH_ANSWER ); pMsg->WriteInt( iID ); ClientSendCommand( pMsg ); v3View = pMsg->ReadVec3(); v3Up = pMsg->ReadVec3(); } void CVANetNetworkProtocol::ServerGetSoundSourceOrientationVU() { CVANetMessage* pMsg = ServerGetMessage(); const int iID = pMsg->ReadInt(); VAVec3 v3View; VAVec3 v3Up; m_pRealCore->GetSoundSourceOrientationVU( iID, v3View, v3Up ); pMsg->WriteVec3( v3View ); pMsg->WriteVec3( v3Up ); } void CVANetNetworkProtocol::ClientSetSoundSourceSignalSource( const int iSoundSourceID, const std::string& sSignalSourceID ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_SOUNDSOURCE_SIGNALSOURCE, MESSAGE_ALLOWS_BUFFERING ); pMsg->WriteInt( iSoundSourceID ); pMsg->WriteString( sSignalSourceID ); ClientSendCommand( pMsg ); } void CVANetNetworkProtocol::ServerSetSoundSourceSignalSource() { CVANetMessage* pMsg = ServerGetMessage(); const int iSoundSourceID = pMsg->ReadInt(); std::string sSignalID = pMsg->ReadString(); m_pRealCore->SetSoundSourceSignalSource( iSoundSourceID, sSignalID ); } void CVANetNetworkProtocol::ClientGetSoundReceiverIDs( std::vector& vIDs ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_SOUND_RECEIVER_IDS, MESSAGE_WITH_ANSWER ); ClientSendCommand( pMsg ); vIDs.clear(); const int iNumElems = pMsg->ReadInt(); for( int i = 0; i < iNumElems; i++ ) vIDs.push_back( pMsg->ReadInt() ); } void CVANetNetworkProtocol::ServerGetSoundReceiverIDs() { CVANetMessage* pMsg = ServerGetMessage(); std::vector vIDs; m_pRealCore->GetSoundReceiverIDs( vIDs ); pMsg->WriteInt( ( int ) vIDs.size() ); for( size_t i = 0; i < vIDs.size(); i++ ) pMsg->WriteInt( vIDs[ i ] ); } int CVANetNetworkProtocol::ClientCreateSoundReceiver( const std::string& sName ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_CREATE_SOUND_RECEIVER, MESSAGE_WITH_ANSWER ); pMsg->WriteString( sName ); ClientSendCommand( pMsg ); return pMsg->ReadInt(); } void CVANetNetworkProtocol::ServerCreateSoundReceiver() { CVANetMessage* pMsg = ServerGetMessage(); const std::string sName = pMsg->ReadString(); const int iID = m_pRealCore->CreateSoundReceiver( sName ); pMsg->WriteInt( iID ); } int CVANetNetworkProtocol::ClientCreateSoundReceiverExplicitRenderer( const std::string& sRendererID, const std::string& sName ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_CREATE_SOUND_RECEIVER_EXPLICIT_RENDERER, MESSAGE_WITH_ANSWER ); pMsg->WriteString( sRendererID ); pMsg->WriteString( sName ); ClientSendCommand( pMsg ); return pMsg->ReadInt(); } void CVANetNetworkProtocol::ServerCreateSoundReceiverExplicitRenderer() { CVANetMessage* pMsg = ServerGetMessage(); const std::string sRendererID = pMsg->ReadString(); const std::string sName = pMsg->ReadString(); const int iID = m_pRealCore->CreateSoundReceiverExplicitRenderer( sRendererID, sName ); pMsg->WriteInt( iID ); } int CVANetNetworkProtocol::ClientDeleteSoundReceiver( const int iID ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_DELETE_SOUND_RECEIVER, MESSAGE_WITH_ANSWER ); pMsg->WriteInt( iID ); ClientSendCommand( pMsg ); return pMsg->ReadInt(); } void CVANetNetworkProtocol::ServerDeleteSoundReceiver() { CVANetMessage* pMsg = ServerGetMessage(); const int iID = pMsg->ReadInt(); const int iResult = m_pRealCore->DeleteSoundReceiver( iID ); pMsg->WriteInt( iResult ); } void CVANetNetworkProtocol::ClientSetSoundReceiverEnabled( const int iID, const bool bEnabled ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_SOUND_RECEIVER_ENABLED, MESSAGE_ALLOWS_BUFFERING ); pMsg->WriteInt( iID ); pMsg->WriteBool( bEnabled ); ClientSendCommand( pMsg ); } void CVANetNetworkProtocol::ServerSetSoundReceiverEnabled() { CVANetMessage* pMsg = ServerGetMessage(); const int iID = pMsg->ReadInt(); const bool bEnabled = pMsg->ReadBool(); m_pRealCore->SetSoundReceiverEnabled( iID, bEnabled ); } bool CVANetNetworkProtocol::ClientGetSoundReceiverEnabled( const int iID ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_SOUND_RECEIVER_ENABLED, MESSAGE_ALLOWS_BUFFERING ); pMsg->WriteInt( iID ); ClientSendCommand( pMsg ); return pMsg->ReadBool(); } void CVANetNetworkProtocol::ServerGetSoundReceiverEnabled() { CVANetMessage* pMsg = ServerGetMessage(); const int iID = pMsg->ReadInt(); const bool bEnabled = m_pRealCore->GetSoundReceiverEnabled( iID ); pMsg->WriteBool( bEnabled ); } void CVANetNetworkProtocol::ClientSetActiveListenerExplicitRenderer( const int iID, const std::string& sRendererID ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_ACTIVE_LISTENER_EXPLICIT_RENDERER, MESSAGE_ALLOWS_BUFFERING ); pMsg->WriteInt( iID ); pMsg->WriteString( sRendererID ); ClientSendCommand( pMsg ); } void CVANetNetworkProtocol::ServerSetActiveListenerExplicitRenderer() { CVANetMessage* pMsg = ServerGetMessage(); int iID = pMsg->ReadInt(); std::string sRendererID = pMsg->ReadString(); m_pRealCore->SetActiveListenerExplicitRenderer( iID, sRendererID ); } int CVANetNetworkProtocol::ClientGetActiveListenerExplicitRenderer( const std::string& sRendererID ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_ACTIVE_LISTENER_EXPLICIT_RENDERER, MESSAGE_ALLOWS_BUFFERING ); pMsg->WriteString( sRendererID ); ClientSendCommand( pMsg ); const int iID = pMsg->ReadInt(); return iID; } void CVANetNetworkProtocol::ServerGetActiveListenerExplicitRenderer() { CVANetMessage* pMsg = ServerGetMessage(); const std::string sRendererID = pMsg->ReadString(); const int iID = m_pRealCore->GetActiveListenerExplicitRenderer( sRendererID ); pMsg->WriteInt( iID ); } void CVANetNetworkProtocol::ClientSetActiveListener( int iID ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_ACTIVE_LISTENER, MESSAGE_ALLOWS_BUFFERING ); pMsg->WriteInt( iID ); ClientSendCommand( pMsg ); } void CVANetNetworkProtocol::ServerSetActiveListener() { CVANetMessage* pMsg = ServerGetMessage(); const int iID = pMsg->ReadInt(); m_pRealCore->SetActiveListener( iID ); } int CVANetNetworkProtocol::ClientGetActiveListener() { CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_ACTIVE_LISTENER, MESSAGE_WITH_ANSWER ); ClientSendCommand( pMsg ); return pMsg->ReadInt(); } void CVANetNetworkProtocol::ServerGetActiveListener() { CVANetMessage* pMsg = ServerGetMessage(); const int iID = m_pRealCore->GetActiveListener(); pMsg->WriteInt( iID ); } std::string CVANetNetworkProtocol::ClientGetSoundReceiverName( const int iID ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_SOUND_RECEIVER_NAME, MESSAGE_WITH_ANSWER ); pMsg->WriteInt( iID ); ClientSendCommand( pMsg ); return pMsg->ReadString(); } void CVANetNetworkProtocol::ServerGetSoundReceiverName() { CVANetMessage* pMsg = ServerGetMessage(); const int iID = pMsg->ReadInt(); std::string sName = m_pRealCore->GetSoundReceiverName( iID ); pMsg->WriteString( sName ); } void CVANetNetworkProtocol::ClientSetSoundReceiverName( int iID, const std::string& sName ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_SOUND_RECEIVER_NAME, MESSAGE_ALLOWS_BUFFERING ); pMsg->WriteInt( iID ); pMsg->WriteString( sName ); ClientSendCommand( pMsg ); } void CVANetNetworkProtocol::ServerSetSoundReceiverName() { CVANetMessage* pMsg = ServerGetMessage(); const int iID = pMsg->ReadInt(); const std::string sName = pMsg->ReadString(); m_pRealCore->SetSoundReceiverName( iID, sName ); } void CVANetNetworkProtocol::ClientSetSoundReceiverAuralizationMode( const int iID, const int iAuralizationMode ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_SOUND_RECEIVER_AURALIZATION_MODE, MESSAGE_ALLOWS_BUFFERING ); pMsg->WriteInt( iID ); pMsg->WriteInt( iAuralizationMode ); ClientSendCommand( pMsg ); } void CVANetNetworkProtocol::ServerSetSoundReceiverAuralizationMode() { CVANetMessage* pMsg = ServerGetMessage(); const int iID = pMsg->ReadInt(); const int iAuralizationMode = pMsg->ReadInt(); m_pRealCore->SetSoundReceiverAuralizationMode( iID, iAuralizationMode ); } int CVANetNetworkProtocol::ClientGetSoundReceiverAuralizationMode( const int iID ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_SOUND_RECEIVER_AURALIZATION_MODE, MESSAGE_WITH_ANSWER ); pMsg->WriteInt( iID ); ClientSendCommand( pMsg ); return pMsg->ReadInt(); } void CVANetNetworkProtocol::ServerGetSoundReceiverAuralizationMode() { CVANetMessage* pMsg = ServerGetMessage(); const int iID = pMsg->ReadInt(); const int iAuralizationMode = m_pRealCore->GetSoundReceiverAuralizationMode( iID ); pMsg->WriteInt( iAuralizationMode ); } CVAStruct CVANetNetworkProtocol::ClientGetSoundReceiverParameters( const int iID, const CVAStruct& oArgs ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_SOUND_RECEIVER_PARAMETERS, MESSAGE_ALLOWS_BUFFERING ); pMsg->WriteInt( iID ); pMsg->WriteVAStruct( oArgs ); ClientSendCommand( pMsg ); CVAStruct oRet; pMsg->ReadVAStruct( oRet ); return oRet; } void CVANetNetworkProtocol::ServerGetSoundReceiverParameters() { CVANetMessage* pMsg = ServerGetMessage(); const int iID = pMsg->ReadInt(); CVAStruct oArgs; pMsg->ReadVAStruct( oArgs ); CVAStruct oRet = m_pRealCore->GetSoundReceiverParameters( iID, oArgs ); pMsg->WriteVAStruct( oRet ); } void CVANetNetworkProtocol::ClientSetSoundReceiverParameters( const int iID, const CVAStruct& oParams ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_SOUND_RECEIVER_PARAMETERS, MESSAGE_ALLOWS_BUFFERING ); pMsg->WriteInt( iID ); pMsg->WriteVAStruct( oParams ); ClientSendCommand( pMsg ); } void CVANetNetworkProtocol::ServerSetSoundReceiverParameters() { CVANetMessage* pMsg = ServerGetMessage(); int iID = pMsg->ReadInt(); CVAStruct oParams; pMsg->ReadVAStruct( oParams ); m_pRealCore->SetSoundReceiverParameters( iID, oParams ); return; } int CVANetNetworkProtocol::ClientGetSoundReceiverDirectivity( const int iID ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_SOUND_RECEIVER_DIRECTIVITY, MESSAGE_WITH_ANSWER ); pMsg->WriteInt( iID ); ClientSendCommand( pMsg ); return pMsg->ReadInt(); } void CVANetNetworkProtocol::ServerGetSoundReceiverDirectivity() { CVANetMessage* pMsg = ServerGetMessage(); const int iID = pMsg->ReadInt(); int iHRIRID = m_pRealCore->GetSoundReceiverDirectivity( iID ); pMsg->WriteInt( iHRIRID ); } void CVANetNetworkProtocol::ClientSetSoundReceiverDirectivity( const int iID, const int iDirectivityID ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_SOUND_RECEIVER_DIRECTIVITY, MESSAGE_ALLOWS_BUFFERING ); pMsg->WriteInt( iID ); pMsg->WriteInt( iDirectivityID ); ClientSendCommand( pMsg ); } void CVANetNetworkProtocol::ServerSetSoundReceiverDirectivity() { CVANetMessage* pMsg = ServerGetMessage(); const int iID = pMsg->ReadInt(); const int iDirectivity = pMsg->ReadInt(); m_pRealCore->SetSoundReceiverDirectivity( iID, iDirectivity ); } void CVANetNetworkProtocol::ClientCreateScene( const CVAStruct& oParams, const std::string& sName ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_SCENE_CREATE, MESSAGE_ENFORCED_EXCEPTION ); pMsg->WriteVAStruct( oParams ); pMsg->WriteString( sName ); ClientSendCommand( pMsg ); } std::string CVANetNetworkProtocol::ServerCreateScene() { CVANetMessage* pMsg = ServerGetMessage(); CVAStruct oParams; pMsg->ReadVAStruct( oParams ); const std::string sName = pMsg->ReadString(); return m_pRealCore->CreateScene( oParams, sName ); } void CVANetNetworkProtocol::ClientGetSceneIDs( std::vector< std::string >& vsIDs ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_SCENE_IDS, MESSAGE_WITH_ANSWER ); ClientSendCommand( pMsg ); const int iNumElems = pMsg->ReadInt(); for( int i = 0; i < iNumElems; i++ ) vsIDs.push_back( pMsg->ReadString() ); } void CVANetNetworkProtocol::ServerGetSceneIDs() { CVANetMessage* pMsg = ServerGetMessage(); std::vector< std::string > vsIDs; m_pRealCore->GetSceneIDs( vsIDs ); pMsg->WriteInt( int( vsIDs.size() ) ); for( size_t i = 0; i < vsIDs.size(); i++ ) pMsg->WriteString( vsIDs[ i ] ); } CVASceneInfo CVANetNetworkProtocol::ClientGetSceneInfo( const std::string& sID ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_SCENE_INFO, MESSAGE_WITH_ANSWER ); pMsg->WriteString( sID ); ClientSendCommand( pMsg ); CVASceneInfo oSceneInfo = pMsg->ReadSceneInfo(); return oSceneInfo; } void CVANetNetworkProtocol::ServerGetSceneInfo() { CVANetMessage* pMsg = ServerGetMessage(); const std::string sID = pMsg->ReadString(); CVASceneInfo oSceneInfo = m_pRealCore->GetSceneInfo( sID ); pMsg->WriteSceneInfo( oSceneInfo ); } std::string CVANetNetworkProtocol::ClientGetSceneName( const std::string& sID ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_SCENE_NAME, MESSAGE_WITH_ANSWER ); pMsg->WriteString( sID ); ClientSendCommand( pMsg ); return pMsg->ReadString(); } void CVANetNetworkProtocol::ServerGetSceneName() { CVANetMessage* pMsg = ServerGetMessage(); const std::string sID = pMsg->ReadString(); const std::string sName = m_pRealCore->GetSceneName( sID ); pMsg->WriteString( sName ); } void CVANetNetworkProtocol::ClientSetSceneName( const std::string& sID, const std::string& sName ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_SCENE_NAME, MESSAGE_ALLOWS_BUFFERING ); pMsg->WriteString( sID ); pMsg->WriteString( sName ); ClientSendCommand( pMsg ); } void CVANetNetworkProtocol::ServerSetSceneName() { CVANetMessage* pMsg = ServerGetMessage(); const std::string sID = pMsg->ReadString(); const std::string sName = pMsg->ReadString(); m_pRealCore->SetSceneName( sID, sName ); } bool CVANetNetworkProtocol::ClientGetSceneEnabled( const std::string& sID ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_SCENE_ENABLED, MESSAGE_WITH_ANSWER ); pMsg->WriteString( sID ); ClientSendCommand( pMsg ); return pMsg->ReadBool(); } void CVANetNetworkProtocol::ServerGetSceneEnabled() { CVANetMessage* pMsg = ServerGetMessage(); const std::string sID = pMsg->ReadString(); const bool bEnabled = m_pRealCore->GetSceneEnabled( sID ); pMsg->WriteBool( bEnabled ); } void CVANetNetworkProtocol::ClientSetSceneEnabled( const std::string& sID, const bool bEnabled ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_SCENE_ENABLED, MESSAGE_ALLOWS_BUFFERING ); pMsg->WriteString( sID ); pMsg->WriteBool( bEnabled ); ClientSendCommand( pMsg ); } void CVANetNetworkProtocol::ServerSetSceneEnabled() { CVANetMessage* pMsg = ServerGetMessage(); const std::string sID = pMsg->ReadString(); const bool bEnabled = pMsg->ReadBool(); m_pRealCore->SetSceneEnabled( sID, bEnabled ); } void CVANetNetworkProtocol::ClientGetSoundPortalIDs( std::vector& vPortalIDs ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_PORTAL_IDS, MESSAGE_WITH_ANSWER ); ClientSendCommand( pMsg ); vPortalIDs.clear(); int iNumElems = pMsg->ReadInt(); for( int i = 0; i < iNumElems; i++ ) vPortalIDs.push_back( pMsg->ReadInt() ); } void CVANetNetworkProtocol::ServerGetSoundPortalIDs() { CVANetMessage* pMsg = ServerGetMessage(); std::vector vIDs; m_pRealCore->GetSoundPortalIDs( vIDs ); pMsg->WriteInt( ( int ) vIDs.size() ); for( size_t i = 0; i < vIDs.size(); i++ ) pMsg->WriteInt( vIDs[ i ] ); } void CVANetNetworkProtocol::ClientSetPortalName( const int iPortalID, const std::string& sName ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_PORTAL_NAME, MESSAGE_ALLOWS_BUFFERING ); pMsg->WriteInt( iPortalID ); pMsg->WriteString( sName ); ClientSendCommand( pMsg ); } void CVANetNetworkProtocol::ServerSetSoundPortalName() { CVANetMessage* pMsg = ServerGetMessage(); int iPortalID = pMsg->ReadInt(); std::string sPortalName = pMsg->ReadString(); m_pRealCore->SetSoundPortalName( iPortalID, sPortalName ); } std::string CVANetNetworkProtocol::ClientGetSoundPortalName( int iPortalID ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_PORTAL_NAME, MESSAGE_WITH_ANSWER ); pMsg->WriteInt( iPortalID ); ClientSendCommand( pMsg ); return pMsg->ReadString(); } void CVANetNetworkProtocol::ServerGetSoundPortalName() { CVANetMessage* pMsg = ServerGetMessage(); const int iPortalID = pMsg->ReadInt(); std::string sName = m_pRealCore->GetSoundPortalName( iPortalID ); pMsg->WriteString( sName ); } CVAStruct CVANetNetworkProtocol::ClientGetPortalParameters( const int iID ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_PORTAL_PARAMETERS, MESSAGE_WITH_ANSWER ); pMsg->WriteInt( iID ); ClientSendCommand( pMsg ); CVAStruct oParams; pMsg->ReadVAStruct( oParams ); return oParams; } void CVANetNetworkProtocol::ServerGetSoundPortalParameters() { CVANetMessage* pMsg = ServerGetMessage(); const int iID = pMsg->ReadInt(); CVAStruct oParams = m_pRealCore->GetSoundPortalParameters( iID ); pMsg->WriteVAStruct( oParams ); } void CVANetNetworkProtocol::ClientSetSoundPortalParameters( const int iPortalID, const CVAStruct& oParams ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_PORTAL_STATE, MESSAGE_ALLOWS_BUFFERING ); pMsg->WriteInt( iPortalID ); pMsg->WriteVAStruct( oParams ); ClientSendCommand( pMsg ); } void CVANetNetworkProtocol::ServerSetPortalParameters() { CVANetMessage* pMsg = ServerGetMessage(); int iPortalID = pMsg->ReadInt(); CVAStruct oParams; pMsg->ReadVAStruct( oParams ); m_pRealCore->SetSoundPortalParameters( iPortalID, oParams ); } void CVANetNetworkProtocol::ClientSetInputGain( const double dGain ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_INPUT_GAIN, MESSAGE_ALLOWS_BUFFERING ); pMsg->WriteDouble( dGain ); ClientSendCommand( pMsg ); } void CVANetNetworkProtocol::ServerSetInputGain() { CVANetMessage* pMsg = ServerGetMessage(); const double dGain = pMsg->ReadDouble(); m_pRealCore->SetInputGain( dGain ); } double CVANetNetworkProtocol::ClientGetInputGain() { CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_INPUT_GAIN, MESSAGE_WITH_ANSWER ); ClientSendCommand( pMsg ); return pMsg->ReadDouble(); } void CVANetNetworkProtocol::ServerGetInputGain() { CVANetMessage* pMsg = ServerGetMessage(); double dGain = m_pRealCore->GetInputGain(); pMsg->WriteDouble( dGain ); } void CVANetNetworkProtocol::ClientSetInputMuted( const bool bMuted ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_INPUT_MUTED, MESSAGE_ALLOWS_BUFFERING ); pMsg->WriteBool( bMuted ); ClientSendCommand( pMsg ); } void CVANetNetworkProtocol::ServerSetInputMuted() { CVANetMessage* pMsg = ServerGetMessage(); m_pRealCore->SetInputMuted( pMsg->ReadBool() ); } bool CVANetNetworkProtocol::ClientGetInputMuted() { CVANetMessage* pMsg = ClientInitMessage( VA_NP_IS_INPUT_MUTED, MESSAGE_WITH_ANSWER ); ClientSendCommand( pMsg ); return pMsg->ReadBool(); } void CVANetNetworkProtocol::ServerGetInputMuted() { CVANetMessage* pMsg = ServerGetMessage(); bool bMuted = m_pRealCore->GetInputMuted(); pMsg->WriteBool( bMuted ); } void CVANetNetworkProtocol::ClientSetOutputGain( const double dGain ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_OUTPUT_GAIN, MESSAGE_ALLOWS_BUFFERING ); pMsg->WriteDouble( dGain ); ClientSendCommand( pMsg ); } void CVANetNetworkProtocol::ServerSetOutputGain() { CVANetMessage* pMsg = ServerGetMessage(); double dGain = pMsg->ReadDouble(); m_pRealCore->SetOutputGain( dGain ); } double CVANetNetworkProtocol::ClientGetOutputGain() { CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_OUTPUT_GAIN, MESSAGE_WITH_ANSWER ); ClientSendCommand( pMsg ); return pMsg->ReadDouble(); } void CVANetNetworkProtocol::ServerGetOutputGain() { CVANetMessage* pMsg = ServerGetMessage(); const double dGain = m_pRealCore->GetOutputGain(); pMsg->WriteDouble( dGain ); } void CVANetNetworkProtocol::ClientSetGlobalAuralizationMode( const int iAuralizationMode ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_GLOBAL_AURALIZATION_MODE, MESSAGE_CONDITIONAL_EXCEPTION ); pMsg->WriteInt( iAuralizationMode ); ClientSendCommand( pMsg ); } void CVANetNetworkProtocol::ServerSetGlobalAuralizationMode() { CVANetMessage* pMsg = ServerGetMessage(); const int iAuralizationMode = pMsg->ReadInt(); m_pRealCore->SetGlobalAuralizationMode( iAuralizationMode ); } int CVANetNetworkProtocol::ClientGetGlobalAuralizationMode() { CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_GLOBAL_AURALIZATION_MODE, MESSAGE_WITH_ANSWER ); ClientSendCommand( pMsg ); return pMsg->ReadInt(); } void CVANetNetworkProtocol::ServerGetGlobalAuralizationMode() { CVANetMessage* pMsg = ServerGetMessage(); const int iAuralizationMode = m_pRealCore->GetGlobalAuralizationMode(); pMsg->WriteInt( iAuralizationMode ); } void CVANetNetworkProtocol::ClientSetOutputMuted( const bool bMuted ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_OUTPUT_MUTED, MESSAGE_ALLOWS_BUFFERING ); pMsg->WriteBool( bMuted ); ClientSendCommand( pMsg ); } void CVANetNetworkProtocol::ServerSetOutputMuted() { CVANetMessage* pMsg = ServerGetMessage(); m_pRealCore->SetOutputMuted( pMsg->ReadBool() ); } bool CVANetNetworkProtocol::ClientGetOutputMuted() { CVANetMessage* pMsg = ClientInitMessage( VA_NP_IS_OUTPUT_MUTED, MESSAGE_WITH_ANSWER ); ClientSendCommand( pMsg ); return pMsg->ReadBool(); } void CVANetNetworkProtocol::ServerGetOutputMuted() { CVANetMessage* pMsg = ServerGetMessage(); bool bMuted = m_pRealCore->GetOutputMuted(); pMsg->WriteBool( bMuted ); } double CVANetNetworkProtocol::ClientGetCoreClock() { CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_CORE_CLOCK, MESSAGE_WITH_ANSWER ); ClientSendCommand( pMsg ); return pMsg->ReadDouble(); } void CVANetNetworkProtocol::ServerGetCoreClock() { CVANetMessage* pMsg = ServerGetMessage(); const double dClock = m_pRealCore->GetCoreClock(); pMsg->WriteDouble( dClock ); } void CVANetNetworkProtocol::ClientSetCoreClock( const double dSeconds ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_CORE_CLOCK, MESSAGE_ENFORCED_EXCEPTION ); pMsg->WriteDouble( dSeconds ); ClientSendCommand( pMsg ); } void CVANetNetworkProtocol::ServerSetCoreClock() { CVANetMessage* pMsg = ServerGetMessage(); double dClock = pMsg->ReadDouble(); m_pRealCore->SetCoreClock( dClock ); } std::string CVANetNetworkProtocol::ClientSubstituteMacros( const std::string& sStr ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_SUBSTITUTE_MACROS, MESSAGE_WITH_ANSWER ); pMsg->WriteString( sStr ); ClientSendCommand( pMsg ); return pMsg->ReadString(); } void CVANetNetworkProtocol::ServerSubstituteMacros() { CVANetMessage* pMsg = ServerGetMessage(); std::string sStr = pMsg->ReadString(); pMsg->WriteString( m_pRealCore->SubstituteMacros( sStr ) ); } void CVANetNetworkProtocol::ClientSetRenderingModuleGain( const std::string& sID, const double dGain ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_RENDERER_SET_GAIN, MESSAGE_ALLOWS_BUFFERING ); pMsg->WriteString( sID ); pMsg->WriteDouble( dGain ); ClientSendCommand( pMsg ); } void CVANetNetworkProtocol::ServerSetRenderingModuleGain() { CVANetMessage* pMsg = ServerGetMessage(); std::string sID = pMsg->ReadString(); double dGain = pMsg->ReadDouble(); m_pRealCore->SetRenderingModuleGain( sID, dGain ); } void CVANetNetworkProtocol::ClientSetRenderingModuleMuted( const std::string& sID, const bool bMuted ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_RENDERER_SET_MUTED, MESSAGE_ALLOWS_BUFFERING ); pMsg->WriteString( sID ); pMsg->WriteBool( bMuted ); ClientSendCommand( pMsg ); } void CVANetNetworkProtocol::ServerSetRenderingModuleMuted() { CVANetMessage* pMsg = ServerGetMessage(); std::string sID = pMsg->ReadString(); bool bMuted = pMsg->ReadBool(); m_pRealCore->SetRenderingModuleMuted( sID, bMuted ); } double CVANetNetworkProtocol::ClientGetRenderingModuleGain( const std::string& sID ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_RENDERER_GET_GAIN, MESSAGE_WITH_ANSWER ); pMsg->WriteString( sID ); ClientSendCommand( pMsg ); return pMsg->ReadDouble(); } void CVANetNetworkProtocol::ServerGetRenderingModuleGain() { CVANetMessage* pMsg = ServerGetMessage(); std::string sID = pMsg->ReadString(); double dGain = m_pRealCore->GetRenderingModuleGain( sID ); pMsg->WriteDouble( dGain ); } void CVANetNetworkProtocol::ClientGetRenderingModuleInfos( std::vector< CVAAudioRendererInfo >& voRenderer, const bool bFilterEnabled ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_RENDERER_GET_INFOS, MESSAGE_WITH_ANSWER ); pMsg->WriteBool( bFilterEnabled ); ClientSendCommand( pMsg ); int iSize = pMsg->ReadInt(); for( int i = 0; i < iSize; i++ ) voRenderer.push_back( pMsg->ReadAudioRenderingModuleInfo() ); } void CVANetNetworkProtocol::ServerGetRenderingModuleInfos() { CVANetMessage* pMsg = ServerGetMessage(); bool bFilterEnabled = pMsg->ReadBool(); std::vector< CVAAudioRendererInfo > voRenderer; m_pRealCore->GetRenderingModules( voRenderer, bFilterEnabled ); pMsg->WriteInt( ( int ) voRenderer.size() ); for( size_t i = 0; i < voRenderer.size(); i++ ) pMsg->WriteAudioRenderingModuleInfo( voRenderer[ i ] ); return; } void CVANetNetworkProtocol::ClientGetReproductionModuleInfos( std::vector< CVAAudioReproductionInfo >& voRepros, const bool bFilterEnabled ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_REPRODUCTION_GET_INFOS, MESSAGE_WITH_ANSWER ); pMsg->WriteBool( bFilterEnabled ); ClientSendCommand( pMsg ); int iSize = pMsg->ReadInt(); for( int i = 0; i < iSize; i++ ) voRepros.push_back( pMsg->ReadAudioReproductionModuleInfo() ); } void CVANetNetworkProtocol::ServerGetReproductionModuleInfos() { CVANetMessage* pMsg = ServerGetMessage(); bool bFilterEnabled = pMsg->ReadBool(); std::vector< CVAAudioReproductionInfo > voRepros; m_pRealCore->GetReproductionModules( voRepros, bFilterEnabled ); pMsg->WriteInt( ( int ) voRepros.size() ); for( size_t i = 0; i < voRepros.size(); i++ ) pMsg->WriteAudioReproductionModuleInfo( voRepros[ i ] ); } bool CVANetNetworkProtocol::ClientIsRenderingModuleMuted( const std::string& sID ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_RENDERER_IS_MUTED, MESSAGE_WITH_ANSWER ); pMsg->WriteString( sID ); ClientSendCommand( pMsg ); return pMsg->ReadBool(); } void CVANetNetworkProtocol::ServerIsRenderingModuleMuted() { CVANetMessage* pMsg = ServerGetMessage(); std::string sID = pMsg->ReadString(); const bool bMuted = m_pRealCore->GetRenderingModuleMuted( sID ); pMsg->WriteBool( bMuted ); } void CVANetNetworkProtocol::ClientSetReproductionModuleGain( const std::string& sID, const double dGain ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_REPRODUCTION_SET_GAIN, MESSAGE_ALLOWS_BUFFERING ); pMsg->WriteString( sID ); pMsg->WriteDouble( dGain ); ClientSendCommand( pMsg ); } void CVANetNetworkProtocol::ServerSetReproductionModuleGain() { CVANetMessage* pMsg = ServerGetMessage(); std::string sID = pMsg->ReadString(); double dGain = pMsg->ReadDouble(); m_pRealCore->SetReproductionModuleGain( sID, dGain ); } void CVANetNetworkProtocol::ClientSetReproductionModuleMuted( const std::string& sID, const bool bMuted ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_REPRODUCTION_SET_MUTED, MESSAGE_ALLOWS_BUFFERING ); pMsg->WriteString( sID ); pMsg->WriteBool( bMuted ); ClientSendCommand( pMsg ); } void CVANetNetworkProtocol::ServerSetReproductionModuleMuted() { CVANetMessage* pMsg = ServerGetMessage(); std::string sID = pMsg->ReadString(); bool bMuted = pMsg->ReadBool(); m_pRealCore->SetReproductionModuleMuted( sID, bMuted ); } double CVANetNetworkProtocol::ClientGetReproductionModuleGain( const std::string& sID ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_REPRODUCTION_GET_GAIN, MESSAGE_WITH_ANSWER ); pMsg->WriteString( sID ); ClientSendCommand( pMsg ); return pMsg->ReadDouble(); } void CVANetNetworkProtocol::ServerGetReproductionModuleGain() { CVANetMessage* pMsg = ServerGetMessage(); std::string sID = pMsg->ReadString(); double dGain = m_pRealCore->GetReproductionModuleGain( sID ); pMsg->WriteDouble( dGain ); } bool CVANetNetworkProtocol::ClientIsReproductionModuleMuted( const std::string& sID ) { CVANetMessage* pMsg = ClientInitMessage( VA_NP_REPRODUCTION_IS_MUTED, MESSAGE_WITH_ANSWER ); pMsg->WriteString( sID ); ClientSendCommand( pMsg ); return pMsg->ReadBool(); } void CVANetNetworkProtocol::ServerIsReproductionModuleMuted() { CVANetMessage* pMsg = ServerGetMessage(); std::string sID = pMsg->ReadString(); bool bMuted = m_pRealCore->IsReproductionModuleMuted( sID ); pMsg->WriteBool( bMuted ); }