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

Adding VANet header for all headers, the lazy thing

parent 01213960
/*
* --------------------------------------------------------------------------------------------
*
* 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
*
* --------------------------------------------------------------------------------------------
*/
/*!
@section vanet_sec VANet
VANet provides a transparent network communication of calls to the VA interface. It is useful to control a VA server remotely and is the standard way to communicate with VA for inter-process methods and bindings for other scripting languages.
@section license_sec License
Copyright 2015-2017 Institute of Technical Acoustics (ITA), RWTH Aachen University
Licensed under the Apache License, Version 2.0 (the "License");
you may not use the OpenDAFF software package except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
You should also have received a [copy of the License](LICENSE.md) with the VA software package.
@section getting_started Getting started
If you are a C++ developer and want to integrate VANet into your application, the first contact point should be the #VANetClient.
If you want to provide a VA server connection, have a look at #VANetServer.
*/
#ifndef IW_VANET
#define IW_VANET
#include <VANetDefinitions.h>
#include <VANetAudioStreamServer.h>
#include <VANetClient.h>
#include <VANetServer.h>
#include <VANetUtils.h>
#include <VANetVersion.h>
#endif // IW_VANET
......@@ -4,6 +4,7 @@ set( RelativeDir "include" )
set( RelativeSourceGroup "include" )
set( DirFiles
VANet.h
VANetAudioStreamServer.h
VANetClient.h
VANetDefinitions.h
......
......@@ -890,12 +890,16 @@ public:
inline void GetSceneIDs( std::vector< std::string >& vsIDs ) const
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_REQUIRE_CONNECTED;
VA_MUTAL_EXCLUDE;
m_pProtocol->ClientGetSceneIDs( vsIDs );
};
inline void SetSceneName( const std::string& sID, const std::string& sName )
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_REQUIRE_CONNECTED;
VA_MUTAL_EXCLUDE;
m_pProtocol->ClientSetSceneName( sID, sName );
};
inline std::string GetSceneName( const std::string& sID ) const
......@@ -914,14 +918,19 @@ public:
inline void SetSceneEnabled( const std::string& sID, const bool bEnabled = true )
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_REQUIRE_CONNECTED;
VA_MUTAL_EXCLUDE;
return m_pProtocol->ClientSetSceneEnabled( sID, bEnabled );
};
inline bool GetSceneEnabled( const std::string& sID ) const
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_REQUIRE_CONNECTED;
VA_MUTAL_EXCLUDE;
return m_pProtocol->ClientGetSceneEnabled( sID );
};
inline void GetSoundPortalIDs( std::vector< int >& viIDs )
{
VA_REQUIRE_CONNECTED;
......@@ -957,7 +966,6 @@ public:
m_pProtocol->ClientSetSoundPortalParameters( iPortalID, oParams );
};
//! Create a sound portal
inline int CreateSoundPortal( const std::string& sName = "" )
{
VA_EXCEPT_NOT_IMPLEMENTED;
......@@ -1229,17 +1237,23 @@ public:
inline int CreateAcousticMaterial( const CVAAcousticMaterial& oMaterial, const std::string& sName = "" )
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_REQUIRE_CONNECTED;
VA_MUTAL_EXCLUDE;
return m_pProtocol->ClientCreateAcousticMaterial( oMaterial, sName );
};
inline int CreateAcousticMaterialFromParameters( const CVAStruct& oParams, const std::string& sName = "" )
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_REQUIRE_CONNECTED;
VA_MUTAL_EXCLUDE;
return m_pProtocol->ClientCreateAcousticMaterialFromParameters( oParams, sName );
};
inline bool DeleteAcousticMaterial( const int iID )
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_REQUIRE_CONNECTED;
VA_MUTAL_EXCLUDE;
return m_pProtocol->ClientDeleteAcousticMaterial( iID );
};
inline CVAAcousticMaterial GetAcousticMaterialInfo( const int iID ) const
......
......@@ -737,6 +737,30 @@ void CVANetMessage::ClearConnection()
m_pConnection = NULL;
}
CVAAcousticMaterial CVANetMessage::ReadAcousticMaterial()
{
CVAAcousticMaterial oMaterial;
oMaterial.iID = ReadInt();
oMaterial.iType = ReadInt();
ReadVAStruct( oMaterial.oParams );
oMaterial.sName = ReadString();
const size_t n = ReadInt();
for( size_t i = 0; i < n; i++ )
oMaterial.vfValues.push_back( ReadFloat() );
return oMaterial;
}
void CVANetMessage::WriteAcousticMaterial( const CVAAcousticMaterial& oMaterial )
{
WriteInt( oMaterial.iID );
WriteInt( oMaterial.iType );
WriteVAStruct( oMaterial.oParams );
WriteString( oMaterial.sName );
WriteInt( ( int ) oMaterial.vfValues.size() );
for( size_t i = 0; i < oMaterial.vfValues.size(); i++ )
WriteFloat( oMaterial.vfValues[ i ] );
}
void CVANetMessage::WriteAudioRenderingModuleInfo( const CVAAudioRendererInfo& oRenderer )
{
WriteString( oRenderer.sID );
......
......@@ -112,6 +112,8 @@ public:
VistaConnectionIP* GetConnection() const;
void ClearConnection();
CVAAcousticMaterial ReadAcousticMaterial();
private:
int m_nMessageType;
int m_nMessageId;
......@@ -122,6 +124,8 @@ private:
std::vector<VANetCompat::byte> m_vecIncomingBuffer;
VistaConnectionIP* m_pConnection;
public:
void WriteAcousticMaterial( const CVAAcousticMaterial& oMaterial );
};
#endif// IW_VANET_MESSAGE
......@@ -2216,6 +2216,182 @@ void CVANetNetworkProtocol::ServerSetSoundReceiverOrientationVU()
m_pRealCore->SetSoundReceiverOrientationVU( iID, v3View, v3Up );
}
VAQuat CVANetNetworkProtocol::ClientGetSoundReceiverHeadAboveTorsoOrientation( const int iID )
{
CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_SOUND_RECEIVER_HEAD_ABOVE_TORSO_ORIENTATION, MESSAGE_WITH_ANSWER );
pMsg->WriteInt( iID );
ClientSendCommand( pMsg );
return pMsg->ReadQuat();
}
void CVANetNetworkProtocol::ServerGetSoundReceiverHeadAboveTorsoOrientation()
{
CVANetMessage* pMsg = ServerGetMessage();
const int iID = pMsg->ReadInt();
const VAQuat qHATOOrient = m_pRealCore->GetSoundReceiverHeadAboveTorsoOrientation( iID );
pMsg->WriteQuat( qHATOOrient );
}
void CVANetNetworkProtocol::ClientSetSoundReceiverHeadAboveTorsoOrientation( const int iID, const VAQuat& qOrient )
{
CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_SOUND_RECEIVER_HEAD_ABOVE_TORSO_ORIENTATION, MESSAGE_ALLOWS_BUFFERING );
pMsg->WriteInt( iID );
pMsg->WriteQuat( qOrient );
ClientSendCommand( pMsg );
}
void CVANetNetworkProtocol::ServerSetSoundReceiverHeadAboveTorsoOrientation()
{
CVANetMessage* pMsg = ServerGetMessage();
const int iID = pMsg->ReadInt();
const VAQuat qHATOOrient = pMsg->ReadQuat();
m_pRealCore->SetSoundReceiverHeadAboveTorsoOrientation( iID, qHATOOrient );
}
int CVANetNetworkProtocol::ClientGetSoundReceiverGeometryMesh( const int iID )
{
CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_SOUND_RECEIVER_GEOMETRY_MESH, MESSAGE_WITH_ANSWER );
pMsg->WriteInt( iID );
ClientSendCommand( pMsg );
return pMsg->ReadInt();
}
void CVANetNetworkProtocol::ServerGetSoundReceiverGeometryMesh()
{
CVANetMessage* pMsg = ServerGetMessage();
const int iID = pMsg->ReadInt();
const int iGeometryMeshID = m_pRealCore->GetSoundReceiverGeometryMesh( iID );
pMsg->WriteInt( iGeometryMeshID );
}
void CVANetNetworkProtocol::ClientSetSoundReceiverGeometryMesh( const int iID, const int iGeometryMeshID )
{
CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_SOUND_RECEIVER_GEOMETRY_MESH, MESSAGE_ALLOWS_BUFFERING );
pMsg->WriteInt( iID );
pMsg->WriteInt( iGeometryMeshID );
ClientSendCommand( pMsg );
}
void CVANetNetworkProtocol::ServerSetSoundReceiverGeometryMesh()
{
CVANetMessage* pMsg = ServerGetMessage();
const int iID = pMsg->ReadInt();
const int iGeometryMeshID = pMsg->ReadInt();
m_pRealCore->SetSoundReceiverGeometryMesh( iID, iGeometryMeshID );
}
void CVANetNetworkProtocol::ClientGetSoundReceiverRealWorldPose( const int iID, VAVec3& v3Pos, VAQuat& qOrient )
{
CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_SOUND_RECEIVER_REAL_WORLD_POSE, MESSAGE_WITH_ANSWER );
pMsg->WriteInt( iID );
ClientSendCommand( pMsg );
v3Pos = pMsg->ReadVec3();
qOrient = pMsg->ReadQuat();
}
void CVANetNetworkProtocol::ServerGetSoundReceiverRealWorldPose()
{
CVANetMessage* pMsg = ServerGetMessage();
const int iID = pMsg->ReadInt();
VAVec3 v3Pos;
VAQuat qOrient;
m_pRealCore->GetSoundReceiverRealWorldPose( iID, v3Pos, qOrient );
pMsg->WriteVec3( v3Pos );
pMsg->WriteQuat( qOrient );
}
void CVANetNetworkProtocol::ClientSetSoundReceiverRealWorldPose( const int iID, const VAVec3& v3Pos, const VAQuat& qOrient )
{
CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_SOUND_RECEIVER_REAL_WORLD_POSE, MESSAGE_ALLOWS_BUFFERING );
pMsg->WriteInt( iID );
pMsg->WriteVec3( v3Pos );
pMsg->WriteQuat( qOrient );
ClientSendCommand( pMsg );
}
void CVANetNetworkProtocol::ServerSetSoundReceiverRealWorldPose()
{
CVANetMessage* pMsg = ServerGetMessage();
const int iID = pMsg->ReadInt();
const VAVec3 v3Pos = pMsg->ReadVec3();
const VAQuat qOrient = pMsg->ReadQuat();
m_pRealCore->SetSoundReceiverRealWorldPose( iID, v3Pos, qOrient );
}
void CVANetNetworkProtocol::ClientGetSoundReceiverRealWorldPositionOrientationVU( const int iID, VAVec3& v3Pos, VAVec3& v3View, VAVec3& v3Up )
{
CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_SOUND_RECEIVER_REAL_WORLD_POSITION_ORIENTATION_VU, MESSAGE_WITH_ANSWER );
pMsg->WriteInt( iID );
ClientSendCommand( pMsg );
v3Pos = pMsg->ReadVec3();
v3View = pMsg->ReadVec3();
v3Up = pMsg->ReadVec3();
}
void CVANetNetworkProtocol::ServerGetSoundReceiverRealWorldPositionOrientationVU()
{
CVANetMessage* pMsg = ServerGetMessage();
const int iID = pMsg->ReadInt();
VAVec3 v3Pos, v3View, v3Up;
m_pRealCore->GetSoundReceiverRealWorldPositionOrientationVU( iID, v3Pos, v3View, v3Up );
pMsg->WriteVec3( v3Pos );
pMsg->WriteVec3( v3View );
pMsg->WriteVec3( v3Up );
}
void CVANetNetworkProtocol::ClientSetSoundReceiverRealWorldPositionOrientationVU( const int iID, const VAVec3& v3Pos, const VAVec3& v3View, const VAVec3& v3Up )
{
CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_SOUND_RECEIVER_REAL_WORLD_POSITION_ORIENTATION_VU, MESSAGE_ALLOWS_BUFFERING );
pMsg->WriteInt( iID );
pMsg->WriteVec3( v3Pos );
pMsg->WriteVec3( v3View );
pMsg->WriteVec3( v3Up );
ClientSendCommand( pMsg );
}
void CVANetNetworkProtocol::ServerSetSoundReceiverRealWorldPositionOrientationVU()
{
CVANetMessage* pMsg = ServerGetMessage();
const int iID = pMsg->ReadInt();
const VAVec3 v3Pos = pMsg->ReadVec3();
const VAVec3 v3View = pMsg->ReadVec3();
const VAVec3 v3Up = pMsg->ReadVec3();
m_pRealCore->SetSoundReceiverRealWorldPositionOrientationVU( iID, v3Pos, v3View, v3Up );
}
VAQuat CVANetNetworkProtocol::ClientGetSoundReceiverRealWorldHeadAboveTorsoOrientation( const int iID )
{
CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_SOUND_RECEIVER_REAL_WORLD_HEAD_ABOVE_TORSO_ORIENTATION, MESSAGE_WITH_ANSWER );
pMsg->WriteInt( iID );
ClientSendCommand( pMsg );
return pMsg->ReadQuat();
}
void CVANetNetworkProtocol::ServerGetSoundReceiverRealWorldHeadAboveTorsoOrientation()
{
CVANetMessage* pMsg = ServerGetMessage();
const int iID = pMsg->ReadInt();
const VAQuat qHATOOrient = m_pRealCore->GetSoundReceiverRealWorldHeadAboveTorsoOrientation( iID );
pMsg->WriteQuat( qHATOOrient );
}
void CVANetNetworkProtocol::ClientSetSoundReceiverRealWorldHeadAboveTorsoOrientation( const int iID, const VAQuat& qOrient )
{
CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_SOUND_RECEIVER_REAL_WORLD_HEAD_ABOVE_TORSO_ORIENTATION, MESSAGE_ALLOWS_BUFFERING );
pMsg->WriteInt( iID );
pMsg->WriteQuat( qOrient );
ClientSendCommand( pMsg );
}
void CVANetNetworkProtocol::ServerSetSoundReceiverRealWorldHeadAboveTorsoOrientation()
{
CVANetMessage* pMsg = ServerGetMessage();
const int iID = pMsg->ReadInt();
const VAQuat qHATOOrient = pMsg->ReadQuat();
m_pRealCore->SetSoundReceiverRealWorldHeadAboveTorsoOrientation( iID, qHATOOrient );
}
std::string CVANetNetworkProtocol::ClientCreateScene( const CVAStruct& oParams, const std::string& sName )
{
CVANetMessage* pMsg = ClientInitMessage( VA_NP_SCENE_CREATE, MESSAGE_WITH_ANSWER );
......@@ -2704,6 +2880,60 @@ void CVANetNetworkProtocol::ServerGetReproductionModuleInfos()
pMsg->WriteAudioReproductionModuleInfo( voRepros[ i ] );
}
int CVANetNetworkProtocol::ClientCreateAcousticMaterial( const CVAAcousticMaterial& oMaterial, const std::string& sName )
{
CVANetMessage* pMsg = ClientInitMessage( VA_NP_CREATE_ACOUSTIC_MATERIAL, MESSAGE_WITH_ANSWER );
pMsg->WriteAcousticMaterial( oMaterial );
pMsg->WriteString( sName );
ClientSendCommand( pMsg );
return pMsg->ReadInt();
}
void CVANetNetworkProtocol::ServerCreateAcousticMaterial()
{
CVANetMessage* pMsg = ServerGetMessage();
CVAAcousticMaterial oMat = pMsg->ReadAcousticMaterial();
const std::string sName = pMsg->ReadString();
const int iID = m_pRealCore->CreateAcousticMaterial( oMat, sName );
pMsg->WriteInt( iID );
}
int CVANetNetworkProtocol::ClientCreateAcousticMaterialFromParameters( const CVAStruct& oParams, const std::string& sName )
{
CVANetMessage* pMsg = ClientInitMessage( VA_NP_CREATE_ACOUSTIC_MATERIAL_FROM_PARAMETERS, MESSAGE_WITH_ANSWER );
pMsg->WriteVAStruct( oParams );
pMsg->WriteString( sName );
ClientSendCommand( pMsg );
return pMsg->ReadInt();
}
void CVANetNetworkProtocol::ServerCreateAcousticMaterialFromParameters()
{
CVANetMessage* pMsg = ServerGetMessage();
CVAStruct oParams;
pMsg->ReadVAStruct( oParams );
const std::string sName = pMsg->ReadString();
const int iID = m_pRealCore->CreateAcousticMaterialFromParameters( oParams, sName );
pMsg->WriteInt( iID );
}
bool CVANetNetworkProtocol::ClientDeleteAcousticMaterial( const int iID )
{
CVANetMessage* pMsg = ClientInitMessage( VA_NP_DELETE_ACOUSTIC_MATERIAL, MESSAGE_WITH_ANSWER );
pMsg->WriteInt( iID );
ClientSendCommand( pMsg );
return pMsg->ReadBool();
}
void CVANetNetworkProtocol::ServerDeleteAcousticMaterial()
{
CVANetMessage* pMsg = ServerGetMessage();
const int iID = pMsg->ReadInt();
const bool bResult = m_pRealCore->DeleteAcousticMaterial( iID );
pMsg->WriteBool( bResult );
}
bool CVANetNetworkProtocol::ClientIsRenderingModuleMuted( const std::string& sID )
{
CVANetMessage* pMsg = ClientInitMessage( VA_NP_RENDERER_IS_MUTED, MESSAGE_WITH_ANSWER );
......
......@@ -180,6 +180,18 @@ public:
static const int VA_NP_SET_SOUND_RECEIVER_PARAMETERS = 926;
static const int VA_NP_SET_SOUND_RECEIVER_ENABLED = 927;
static const int VA_NP_GET_SOUND_RECEIVER_ENABLED = 928;
static const int VA_NP_GET_SOUND_RECEIVER_HEAD_ABOVE_TORSO_ORIENTATION = 929;
static const int VA_NP_SET_SOUND_RECEIVER_HEAD_ABOVE_TORSO_ORIENTATION = 930;
static const int VA_NP_GET_SOUND_RECEIVER_REAL_WORLD_POSITION_ORIENTATION_VU = 931;
static const int VA_NP_SET_SOUND_RECEIVER_REAL_WORLD_POSITION_ORIENTATION_VU = 932;
static const int VA_NP_GET_SOUND_RECEIVER_GEOMETRY_MESH = 933;
static const int VA_NP_SET_SOUND_RECEIVER_GEOMETRY_MESH = 934;
static const int VA_NP_GET_SOUND_RECEIVER_REAL_WORLD_POSE = 935;
static const int VA_NP_SET_SOUND_RECEIVER_REAL_WORLD_POSE = 936;
static const int VA_NP_GET_SOUND_RECEIVER_REAL_WORLD_HEAD_ABOVE_TORSO_ORIENTATION = 937;
static const int VA_NP_SET_SOUND_RECEIVER_REAL_WORLD_HEAD_ABOVE_TORSO_ORIENTATION = 938;
// Scene
static const int VA_NP_SCENE_CREATE = 1000;
......@@ -196,7 +208,10 @@ public:
static const int VA_NP_GET_PORTAL_PARAMETERS = 1016;
static const int VA_NP_SET_PORTAL_STATE = 1017;
// Global functions
static const int VA_NP_CREATE_ACOUSTIC_MATERIAL = 1400;
static const int VA_NP_CREATE_ACOUSTIC_MATERIAL_FROM_PARAMETERS = 1401;
static const int VA_NP_DELETE_ACOUSTIC_MATERIAL = 1402;
static const int VA_NP_GET_INPUT_GAIN = 1100;
static const int VA_NP_SET_INPUT_GAIN = 1101;
static const int VA_NP_IS_INPUT_MUTED = 1102;
......@@ -215,14 +230,12 @@ public:
static const int VA_NP_GET_ACTIVE_LISTENER_EXPLICIT_RENDERER = 1115;
static const int VA_NP_SET_ACTIVE_LISTENER_EXPLICIT_RENDERER = 1116;
// Global rendering methods
static const int VA_NP_RENDERER_GET_INFOS = 1200;
static const int VA_NP_RENDERER_SET_MUTED = 1201;
static const int VA_NP_RENDERER_IS_MUTED = 1202;
static const int VA_NP_RENDERER_GET_GAIN = 1203;
static const int VA_NP_RENDERER_SET_GAIN = 1204;
// Global reproduction methods
static const int VA_NP_REPRODUCTION_GET_INFOS = 1300;
static const int VA_NP_REPRODUCTION_SET_MUTED = 1301;
static const int VA_NP_REPRODUCTION_IS_MUTED = 1302;
......@@ -569,7 +582,6 @@ public:
VAQuat ClientGetSoundReceiverHeadAboveTorsoOrientation( const int iID );
void ServerGetSoundReceiverHeadAboveTorsoOrientation();
void ClientSetSoundReceiverHeadAboveTorsoOrientation( const int iID, const VAQuat& qOrient );
void ServerSetSoundReceiverHeadAboveTorsoOrientation();
......@@ -704,6 +716,14 @@ public:
void ServerGetReproductionModuleInfos();
int ClientCreateAcousticMaterial( const CVAAcousticMaterial& oMaterial, const std::string& sName );
void ServerCreateAcousticMaterial();
int ClientCreateAcousticMaterialFromParameters( const CVAStruct& oParams, const std::string& sName );
void ServerCreateAcousticMaterialFromParameters();
bool ClientDeleteAcousticMaterial( const int iID );
void ServerDeleteAcousticMaterial();
private:
VistaConnectionIP* m_pCommandChannel;
VistaConnectionIP* m_pHeadChannel;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment