Commit f5c3816b authored by Maurice Tayeb Andreas's avatar Maurice Tayeb Andreas

Remove Testfiles

parent 5e7a1355
using UnityEngine;
using System;
using System.Collections;
using VA;
public class VAAdapter : MonoBehaviour {
private VANet m_VA = new VANet();
// Use this for initialization
void Start ()
{
//var dllDirectory = @"Assets/Plugins/VAUnity/bin";
//var dllDirectory = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
//var dllDirectory = @"C:/Users/Public/Documents/Unity Projects/Standard Assets Example Project/Assets/Plugins/VAUnity/bin"; // w
// var dllDirectory = System.Reflection.Assembly.GetExecutingAssembly().Location + @"../../Plugins/VAUnity/bin";
//Environment.SetEnvironmentVariable( "PATH", Environment.GetEnvironmentVariable("PATH") + ";" + dllDirectory );
m_VA.Connect();
}
// Update is called once per frame
void Update ()
{
}
}
using UnityEngine;
using System;
using System.Runtime.InteropServices;
public class ConnectWithAPI : MonoBehaviour {
IntPtr client;
Transform tra;
Transform firsT;
string sourceID;
int SoundSourceID;
public GameObject cube;
int IDHRIR;
int IDListener;
public GameObject firsTperson;
bool ok = false;
void Start () {
tra = GetComponent<Transform>();
firsT=firsTperson.GetComponent<Transform>();
client = CreateClient();
if ((API.Connection(client, "127.0.0.1", 12340))==1)
{
if(API.GetState(client) !=1)
API.Initialize(client);
ok = true;
sourceID = CreateSource();
playAndRepeat();
SoundSourceID = NewSoundSource();
API.SetSoundSourcePosition(client, SoundSourceID, cube.transform.position.x, cube.transform.position.y, -cube.transform.position.z);
API.SetSoundSourceSignalSource(client, SoundSourceID, sourceID);
IDHRIR = loadHRIRDataset();
IDListener = CreateListener(IDHRIR);
API.SetListenerPosition(client, IDListener,tra.transform.position.x, tra.transform.position.y, tra.transform.position.z);
API.SetListenerOrientationYPR(client, IDListener, tra.transform.eulerAngles.y, firsT.transform.eulerAngles.x, 0);
API.SetActiveListener(client, IDListener);
// InvokeRepeating("here", 0, 0.01f);
}
}
void Update () {
if (ok == true)
here();
if (Input.GetKeyDown("p"))
{
CancelInvoke("here");
if (API.Disconnect(client) == 0)
Debug.Log("Disconnected");
UnityEditor.EditorApplication.isPlaying = false;
}
}
void here()
{
API.SetListenerPosition(client,IDListener, tra.transform.position.x, tra.transform.position.y, -tra.transform.position.z);
API.SetListenerOrientationYPR(client, IDListener,-tra.transform.eulerAngles.y, -firsT.transform.eulerAngles.x, 0);
Debug.Log("-" + tra.transform.rotation.eulerAngles.y.ToString());
Debug.Log("-" + firsT.transform.rotation.eulerAngles.x.ToString());
}
IntPtr CreateClient()
{
return API.CreateClient();
}
string CreateSource()
{
return Marshal.PtrToStringAnsi(API.CreateAudiofileSignalSource(client, "C:\\Users\\javier\\Desktop\\VA ejemplos\\ita_demosound.wav", "demo"));
}
void playAndRepeat()
{
/*
-1< No action
0< Stop playback
1< Pause playback
2< Start/resume playback
*/
int PlayState = 2;
bool Lopping = true;
API.SetAudiofileSignalSourcePlaybackAction(client, sourceID, PlayState);
API.SetAudiofileSignalSourceIsLooping(client, sourceID, Lopping);
}
int NewSoundSource()
{
string Name = "new";
int AuralizationMode = 2047;
double Volume = 1.0;
return API.CreateSoundSource(client, Name, AuralizationMode, Volume);
}
int loadHRIRDataset()
{
string FileName = "C:\\Users\\javier\\Desktop\\VA.win32-x64.vc12\\VA.win32-x64.vc12\\data\\HRIR\\ITA-Kunstkopf_HRIR_AP11_Pressure_Equalized_3x3_256.v17.ir.daff";
string Name1 = "default";
return API.LoadHRIRDataset(client, FileName, Name1);
}
int CreateListener(int IDHRIR)
{
string Name3 = "Me";
int AuralizationMode2 = 2047;
return API.CreateListener(client, Name3, AuralizationMode2, IDHRIR);
}
void OnGUI()
{
GUI.Label(new Rect(0, 0, 100, 100), (1.0f / Time.smoothDeltaTime).ToString());
}
}
using System;
using System.Runtime.InteropServices;
public static class VA
{
[DllImport("VACS")]
public static extern IntPtr CreateNetClient();
[DllImport("VACS")]
public static extern bool ConnectLocalNetClient( IntPtr client );
[DllImport("VACS")]
public static extern int ConnectNetClient( IntPtr client, string ServerIP, int Port);
[DllImport("VACS")]
public static extern bool IsConnectedNetClient( IntPtr client );
[DllImport("VACS")]
public static extern bool DisconnectNetClient( IntPtr client );
[DllImport("VACS")]
public static extern bool DisposeNetClient( IntPtr client );
[DllImport("VACS")]
public static extern int GetCore(IntPtr client);
[DllImport("VACS")]
public static extern void GetVersionInfol(IntPtr client, IntPtr pVersionInfo);
//[DllImport("VACS")]
//public static extern void SetDebugStream(IntPtr client, IntPtr posDebug);
[DllImport("VACS")]
public static extern int GetState(IntPtr client);
[DllImport("VACS")]
public static extern void Initialize(IntPtr client);
[DllImport("VACS")]
public static extern void Finalize(IntPtr client);
[DllImport("VACS")]
public static extern void Reset(IntPtr client);
[DllImport("VACS")]
public static extern void AttachCoreEventHandler(IntPtr client, IntPtr pCoreEventHandler);
[DllImport("VACS")]
public static extern void DetachCoreEventHandler(IntPtr client, IntPtr pCoreEventHandler);
//[DllImport("VACS")]
//public static extern void EnumerateModules(IntPtr client, std::vector<CVAModuleInfo> viModuleInfos);
//[DllImport("VACS")]
//public static extern void CallModule(IntPtr client, string sModuleName, CVAStruct oArgs, CVAStruct oReturn);
[DllImport("VACS")]
public static extern int LoadDirectivity(IntPtr client, string sFilename, string sName);
[DllImport("VACS")]
public static extern bool FreeDirectivity(IntPtr client, int iDirID);
//[DllImport("VACS")]
//public static extern CVADirectivityInfo GetDirectivityInfo(IntPtr client, int iDirID);
//[DllImport("VACS")]
//public static extern void GetDirectivityInfos(IntPtr client, std::vector<CVADirectivityInfo> vdiDest);
[DllImport("VACS")]
public static extern int LoadHRIRDataset(IntPtr client, string sFilename, string sName);
[DllImport("VACS")]
public static extern bool FreeHRIRDataset(IntPtr client, int iHRIRID);
//[DllImport("VACS")]
//public static extern CVAHRIRInfo GetHRIRInfo(IntPtr client, int iHRIRID);
//[DllImport("VACS")]
//public static extern void GetHRIRInfos(IntPtr client, std::vector<CVAHRIRInfo> vhiDest);
[DllImport("VACS")]
public static extern int LoadSound(IntPtr client, string sFilename, string sName);
[DllImport("VACS")]
public static extern bool FreeSound(IntPtr client, int iSoundID);
//[DllImport("VACS")]
//public static extern CVASoundInfo GetSoundInfo(IntPtr client, int iSoundID);
//[DllImport("VACS")]
//public static extern void GetSoundInfos(IntPtr client, std::vector<CVASoundInfo>& vsiDest);
[DllImport("VACS")]
public static extern int PlaySound(IntPtr client, int iSoundID, double dVolume);
[DllImport("VACS")]
public static extern IntPtr CreateAudiofileSignalSource(IntPtr client, string sFilename, string sName);
[DllImport("VACS")]
public static extern IntPtr CreateSequencerSignalSource(IntPtr client, string sName);
[DllImport("VACS")]
public static extern IntPtr CreateNetworkStreamSignalSource(IntPtr client, string sInterface, int iPort, string sName);
[DllImport("VACS")]
public static extern IntPtr CreateEngineSignalSource(IntPtr client, string sName);
[DllImport("VACS")]
public static extern IntPtr CreateMachineSignalSource(IntPtr client, string sName);
[DllImport("VACS")]
public static extern bool DeleteSignalSource(IntPtr client, string sID);
//[DllImport("VACS")]
//public static extern IntPtr RegisterSignalSource(IntPtr client, IVAAudioSignalSource* pSignalSource, string sName);
//[DllImport("VACS")]
//public static extern bool UnregisterSignalSource(IntPtr client, IVAAudioSignalSource* pSignalSource);
//[DllImport("VACS")]
//public static extern CVASignalSourceInfo GetSignalSourceInfo(IntPtr client, string sSignalSourceID);
//[DllImport("VACS")]
//public static extern void GetSignalSourceInfos(IntPtr client, std::vector<CVASignalSourceInfo>& vssiDest);
[DllImport("VACS")]
public static extern int GetAudiofileSignalSourcePlaybackState(IntPtr client, string sSignalSourceID);
[DllImport("VACS")]
public static extern void SetAudiofileSignalSourcePlaybackAction(IntPtr client, string sSignalSourceID, int iPlayState);
[DllImport("VACS")]
public static extern void SetAudiofileSignalSourcePlaybackPosition(IntPtr client, string sSignalSourceID, double dPlaybackPosition);
[DllImport("VACS")]
public static extern bool GetAudiofileSignalSourceIsLooping(IntPtr client, string sSignalSourceID);
[DllImport("VACS")]
public static extern void SetAudiofileSignalSourceIsLooping(IntPtr client, string sSignalSourceID, bool bLooping);
[DllImport("VACS")]
public static extern int AddSoundPlayback(IntPtr client, string sSignalSourceID, int iSoundID, int iFlags, double dTimecode);
[DllImport("VACS")]
public static extern bool RemoveSoundPlayback(IntPtr client, int iPlaybackID);
//[DllImport("VACS")]
//public static extern void SetSignalSourceParameters(IntPtr client, string sSignalSourceID, CVAStruct& oParams);
//[DllImport("VACS")]
//public static extern CVAStruct GetSignalSourceParameters(IntPtr client, char *sSignalSourceID, CVAStruct& oParams);
[DllImport("VACS")]
public static extern bool IsSceneLocked(IntPtr client);
[DllImport("VACS")]
public static extern void LockScene(IntPtr client);
[DllImport("VACS")]
public static extern int UnlockScene(IntPtr client);
//[DllImport("VACS")]
//public static extern void GetSoundSourceIDs(IntPtr client, std::vector<int>& vSoundSourceIDs);
[DllImport("VACS")]
public static extern int CreateSoundSource(IntPtr client, string sName, int iAuralizationMode, double dVolume);
[DllImport("VACS")]
public static extern int CreateSoundSourceExplicitRenderer(IntPtr client, string sName, string sRendererID);
[DllImport("VACS")]
public static extern int DeleteSoundSource(IntPtr client, int iSoundSourceID);
[DllImport("VACS")]
public static extern void SetSoundSourceEnabled(IntPtr client, int iSoundSourceID, bool bEnabled);
[DllImport("VACS")]
public static extern bool GetSoundSourceEnabled(IntPtr client, int iSoundSourceID);
[DllImport("VACS")]
public static extern IntPtr GetSoundSourceName(IntPtr client, int iSoundSourceID);
[DllImport("VACS")]
public static extern void SetSoundSourceName(IntPtr client, int iSoundSourceID, string sName);
[DllImport("VACS")]
public static extern IntPtr GetSoundSourceSignalSource(IntPtr client, int iSoundSourceID);
[DllImport("VACS")]
public static extern void SetSoundSourceSignalSource(IntPtr client, int iSoundSourceID, string sSignalSourceID);
[DllImport("VACS")]
public static extern int GetSoundSourceAuralizationMode(IntPtr client, int iSoundSourceID);
[DllImport("VACS")]
public static extern void SetSoundSourceAuralizationMode(IntPtr client, int iSoundSourceID, int iAuralizationMode);
//[DllImport("VACS")]
//public static extern CVAStruct GetSoundSourceParameters(IntPtr client, int iID, CVAStruct oArgs);
//[DllImport("VACS")]
//public static extern void SetSoundSourceParameters(IntPtr client, int iID, CVAStruct oParams);
[DllImport("VACS")]
public static extern int GetSoundSourceDirectivity(IntPtr client, int iSoundSourceID);
[DllImport("VACS")]
public static extern void SetSoundSourceDirectivity(IntPtr client, int iSoundSourceID, int iDirectivityID);
[DllImport("VACS")]
public static extern double GetSoundSourceVolume(IntPtr client, int iSoundSourceID);
[DllImport("VACS")]
public static extern void SetSoundSourceVolume(IntPtr client, int iSoundSourceID, int dGain);
[DllImport("VACS")]
public static extern bool IsSoundSourceMuted(IntPtr client, int iSoundSourceID);
[DllImport("VACS")]
public static extern void SetSoundSourceMuted(IntPtr client, int iSoundSourceID, bool bMuted);
[DllImport("VACS")]
public static extern void GetSoundSourcePosition(IntPtr client, int iSoundSourceID, double x, double y, double z);
[DllImport("VACS")]
public static extern void GetSoundSourceOrientationYPR(IntPtr client, int iSoundSourceID, double yaw, double pitch, double roll);
[DllImport("VACS")]
public static extern void GetSoundSourceOrientationVU(IntPtr client, int iSoundSourceID, double vx, double vy, double vz,
double ux, double uy, double uz);
[DllImport("VACS")]
public static extern void GetSoundSourcePositionOrientationYPR(IntPtr client, int iSoundSourceID,
double x, double y, double z,
double yaw, double pitch, double roll);
[DllImport("VACS")]
public static extern void GetSoundSourcePositionOrientationVU(IntPtr client, int iSoundSourceID,
double px, double py, double pz,
double vx, double vy, double vz,
double ux, double uy, double uz);
[DllImport("VACS")]
public static extern void GetSoundSourcePositionOrientationVelocityYPR(IntPtr client, int iSoundSourceID,
double dPosX, double dPosY, double dPosZ,
double dYaw, double dPitch, double dRoll,
double dVelocityX, double dVelocityY, double dVelocityZ);
[DllImport("VACS")]
public static extern void GetSoundSourcePositionOrientationVelocityVU(IntPtr client, int iSoundSourceID,
double dPosX, double dPosY, double dPosZ,
double dViewX, double dViewY, double dViewZ,
double dUpX, double dUpY, double dUpZ,
double dVelocityX, double dVelocityY, double dVelocityZ);
[DllImport("VACS")]
public static extern void SetSoundSourcePosition(IntPtr client, int iSoundSourceID, double x, double y, double z);
[DllImport("VACS")]
public static extern void SetSoundSourceOrientationYPR(IntPtr client, int iSoundSourceID, double yaw, double pitch, double roll);
[DllImport("VACS")]
public static extern void SetSoundSourceOrientationVU(IntPtr client, int iSoundSourceID,
double vx, double vy, double vz,
double ux, double uy, double uz);
[DllImport("VACS")]
public static extern void SetSoundSourcePositionOrientationYPR(IntPtr client, int iSoundSourceID,
double x, double y, double z,
double yaw, double pitch, double roll);
[DllImport("VACS")]
public static extern void SetSoundSourcePositionOrientationVU(IntPtr client, int iSoundSourceID,
double px, double py, double pz,
double vx, double vy, double vz,
double ux, double uy, double uz);
[DllImport("VACS")]
public static extern void SetSoundSourcePositionOrientationVelocityYPR(IntPtr client, int iSoundSourceID,
double dPosX, double dPosY, double dPosZ,
double dYaw, double dPitch, double dRoll,
double dVelocityX, double dVelocityY, double dVelocityZ);
[DllImport("VACS")]
public static extern void SetSoundSourcePositionOrientationVelocityVU(IntPtr client, int iSoundSourceID,
double dPosX, double dPosY, double dPosZ,
double dViewX, double dViewY, double dViewZ,
double dUpX, double dUpY, double dUpZ,
double dVelocityX, double dVelocityY, double dVelocityZ);
//[DllImport("VACS")]
//public static extern void GetListenerIDs(IntPtr client, std::vector<int>& vListenerIDs);
[DllImport("VACS")]
public static extern int CreateListener(IntPtr client, string sName, int iAuralizationMode, int iHRIRDatasetID);
[DllImport("VACS")]
public static extern int CreateListenerExplicitRenderer(IntPtr client, string sName, string sRendererID);
[DllImport("VACS")]
public static extern void SetActiveListenerExplicitRenderer(IntPtr client, int iListenerID, string sRendererID);
[DllImport("VACS")]
public static extern int GetActiveListenerExplicitRenderer(IntPtr client, string sRendererID);
[DllImport("VACS")]
public static extern int DeleteListener(IntPtr client, int iListenerID);
[DllImport("VACS")]
public static extern void SetListenerEnabled(IntPtr client, int iListenerID, bool bEnabled);
[DllImport("VACS")]
public static extern bool GetListenerEnabled(IntPtr client, int iListenerID);
[DllImport("VACS")]
public static extern IntPtr GetListenerName(IntPtr client, int iListenerID);
[DllImport("VACS")]
public static extern void SetListenerName(IntPtr client, int iListenerID, string sName);
[DllImport("VACS")]
public static extern int GetListenerAuralizationMode(IntPtr client, int iListenerID);
[DllImport("VACS")]
public static extern void SetListenerAuralizationMode(IntPtr client, int iListenerID, int iAuralizationMode);
//[DllImport("VACS")]
//public static extern CVAStruct GetListenerParameters(IntPtr client, int iID, CVAStruct oArgs);
//[DllImport("VACS")]
//public static extern void SetListenerParameters(IntPtr client, int iID, CVAStruct oParams);
[DllImport("VACS")]
public static extern int GetListenerHRIRDataset(IntPtr client, int iListenerID);
[DllImport("VACS")]
public static extern void SetListenerHRIRDataset(IntPtr client, int iListenerID, int iHRIRDatasetID);
[DllImport("VACS")]
public static extern void GetListenerPosition(IntPtr client, int iListenerID,
double x, double y, double z);
[DllImport("VACS")]
public static extern void GetListenerOrientationYPR(IntPtr client, int iListenerID,
double yaw, double pitch, double roll);
[DllImport("VACS")]
public static extern void GetListenerOrientationVU(IntPtr client, int iListenerID,
double vx, double vy, double vz,
double ux, double uy, double uz);
[DllImport("VACS")]
public static extern void GetListenerPositionOrientationYPR(IntPtr client, int iListenerID,
double x, double y, double z,
double yaw, double pitch, double roll);
[DllImport("VACS")]
public static extern void GetListenerPositionOrientationVU(IntPtr client, int iListenerID,
double px, double py, double pz,
double vx, double vy, double vz,
double ux, double uy, double uz);
[DllImport("VACS")]
public static extern void GetListenerPositionOrientationVelocityYPR(IntPtr client, int iListenerID,
double dPosX, double dPosY, double dPosZ,
double dYaw, double dPitch, double dRoll,
double dVelocityX, double dVelocityY, double dVelocityZ);
[DllImport("VACS")]
public static extern void GetListenerPositionOrientationVelocityVU(IntPtr client, int iListenerID,
double dPosX, double dPosY, double dPosZ,
double dViewX, double dViewY, double dViewZ,
double dUpX, double dUpY, double dUpZ,
double dVelocityX, double dVelocityY, double dVelocityZ);
[DllImport("VACS")]
public static extern void SetListenerPosition(IntPtr client, int iListenerID,
double x, double y, double z);
[DllImport("VACS")]
public static extern void SetListenerOrientationYPR(IntPtr client, int iListenerID,
double yaw, double pitch, double roll);
[DllImport("VACS")]
public static extern void SetListenerOrientationVU(IntPtr client, int iListenerID,
double vx, double vy, double vz,
double ux, double uy, double uz);
[DllImport("VACS")]
public static extern void SetListenerPositionOrientationYPR(IntPtr client, int iListenerID,
double x, double y, double z,
double yaw, double pitch, double roll);
[DllImport("VACS")]
public static extern void SetListenerPositionOrientationVU(IntPtr client, int iListenerID,
double px, double py, double pz,
double vx, double vy, double vz,
double ux, double uy, double uz);
[DllImport("VACS")]
public static extern void SetListenerPositionOrientationVelocityYPR(IntPtr client, int iListenerID,
double dPosX, double dPosY, double dPosZ,
double dYaw, double dPitch, double dRoll,
double dVelocityX, double dVelocityY, double dVelocityZ);
[DllImport("VACS")]
public static extern void SetListenerPositionOrientationVelocityVU(IntPtr client, int iListenerID,
double dPosX, double dPosY, double dPosZ,
double dViewX, double dViewY, double dViewZ,
double dUpX, double dUpY, double dUpZ,
double dVelocityX, double dVelocityY, double dVelocityZ);
[DllImport("VACS")]
public static extern void GetListenerRealWorldHeadPositionOrientationVU(IntPtr client, int iListenerID,
double px, double py, double pz,
double vx, double vy, double vz,
double ux, double uy, double uz);
[DllImport("VACS")]
public static extern void SetListenerRealWorldHeadPositionOrientationVU(IntPtr client, int iListenerID,
double px, double py, double pz,
double vx, double vy, double vz,
double ux, double uy, double uz);
[DllImport("VACS")]
public static extern void LoadScene(IntPtr client, string sFilename);
[DllImport("VACS")]
public static extern bool IsSceneLoaded(IntPtr client);
//[DllImport("VACS")]
//public static extern CVASceneInfo GetSceneInfo(IntPtr client);
//[DllImport("VACS")]
//public static extern void GetPortalIDs(IntPtr client, std::vector<int> vPortalIDs);
[DllImport("VACS")]
public static extern IntPtr GetPortalName(IntPtr client, int iPortalID);
[DllImport("VACS")]
public static extern void SetPortalName(IntPtr client, int iPortalID, string sName);
[DllImport("VACS")]
public static extern double GetPortalState(IntPtr client, int iPortalID);
[DllImport("VACS")]
public static extern void SetPortalState(IntPtr client, int iPortalID, double dState);
[DllImport("VACS")]
public static extern bool IsInputMuted(IntPtr client);
[DllImport("VACS")]
public static extern void SetInputMuted(IntPtr client, bool bMuted);
[DllImport("VACS")]
public static extern double GetInputGain(IntPtr client);
[DllImport("VACS")]
public static extern void SetInputGain(IntPtr client, double dGain);
[DllImport("VACS")]
public static extern double GetOutputGain(IntPtr client);
[DllImport("VACS")]