Ejemplo n.º 1
0
        public static void Init()
        {
            string audFile = "Soundfile Segment and Localize.aud";

            //audFile = "Cluster_datatest.aud";
            audFile = "Cluster_datatest_OneMessage.aud";
            //audFile = "Cluster_datatest_4Cluster.aud";
            //audFile = "100AgentsDirectPositionDataTest.aud";
            //audFile = "100Agents.aud";


            //if (VSSCSharpClient.BeginSoundServerAt("127.0.0.1") != 1)
            if (VSSCSharpClient.BeginSoundServer() != 1)
            {
#if WINDOWS
                Console.WriteLine("Could Not Connect to VSS...");
                Console.WriteLine("Please make sure VSS is running on localhost. also make sure the SOUNDS folder with the audio files for demo is in the same folder as VSS.exe");
                Console.WriteLine("If BeginSoundServerAt is called VSS must be running on the specified ip address.");
                Console.ReadKey();
#endif
                return;
            }

            handle = VSSCSharpClient.AUDinit(audFile);


            if (handle < 0)
            {
#if WINDOWS
                //Console.WriteLine(string.Format("Failed to load audfile {0}\n", audFile));
                //Console.ReadKey();
#endif
                return;
            }
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            int handle;

            float[] data;

            handle = 0;
            string audFile = "Soundfile Segment and Localize.aud";

            audFile = "PoemPhrasesDemo.aud";
            audFile = "PoemGraspThrow_11.22.12.aud";

            //
            //if (VSSCSharpClient.BeginSoundServerAt("127.0.0.1") != 1)
            if (VSSCSharpClient.BeginSoundServer() != 1)
            {
                Console.WriteLine("Could Not Connect to VSS...");
                Console.WriteLine("Please make sure VSS is running on localhost. also make sure the SOUNDS folder with the audio files for demo is in the same folder as VSS.exe");
                Console.WriteLine("If BeginSoundServerAt is called VSS must be running on the specified ip address.");
                Console.ReadKey();
                return;
            }

            //VSSCSharpClient.SetPrintCommands(1);

            handle = VSSCSharpClient.AUDinit(audFile);

            /*
             * if (handle < 0)
             * {
             *  Console.WriteLine(string.Format("Failed to load audfile {0}\n", audFile ));
             *  Console.ReadKey();
             *  return;
             *
             * }
             * */

            string command = "";
            int    index   = 0;
            float  fdata   = 0.0f;

            ListCommands();
            do
            {
                Console.Write("Enter A Command:");

                command = Console.ReadLine();
                //Parse commands for data
                if (command.ToLower().StartsWith("set index"))
                {
                    int.TryParse(command.ToLower().Replace("set index", "").ToString(), out index);
                    Console.WriteLine("index set: " + index);
                }


                if (command.StartsWith("aud"))
                {
                    string AudCommand = command.Replace("aud ", "");
                    VSSCSharpClient.AUDupdate(handle, AudCommand, 0, new float[] { 0.0f });
                }

                if (command.ToLower().StartsWith("set pan"))
                {
                    float.TryParse(command.ToLower().Replace("set pan", "").ToString(), out fdata);
                    Console.WriteLine("data set: " + fdata);
                    command = "set pan";
                }

                if (command.ToLower().StartsWith("set dist"))
                {
                    float.TryParse(command.ToLower().Replace("set dist", "").ToString(), out fdata);
                    Console.WriteLine("data set: " + fdata);
                    command = "set dist";
                }

                switch (command)
                {
                case "PlaySeries":
                case "ps":
                    VSSCSharpClient.AUDupdate(handle, "PlaySeries", 0, new float[] { 0.0f });
                    break;

                case "PlayOne":
                case "po":
                    VSSCSharpClient.AUDupdate(handle, "PlayOne", index, new float[] { 0.0f });
                    break;

                case "JustPause":
                case "jp":
                    VSSCSharpClient.AUDupdate(handle, "JustPause", 0, new float[] { 0.0f });
                    break;

                //Reverse

                case "none":
                    VSSCSharpClient.AUDupdate(handle, "none", 0, new float[] { 0.0f });
                    break;

                case "1":
                    VSSCSharpClient.AUDupdate(handle, "playEvent1", 0, new float[] { 0.0f });
                    break;


                case "5":
                    VSSCSharpClient.AUDupdate(handle, "playEvent5", 0, new float[] { 0.0f });
                    break;

                case "g1":
                    VSSCSharpClient.AUDupdate(handle, "GraspSound1", 0, new float[] { 0.0f });
                    break;

                case "r1":
                    VSSCSharpClient.AUDupdate(handle, "ReleaseSound1", 0, new float[] { 0.0f });
                    break;

                case "throw":
                    VSSCSharpClient.AUDupdate(handle, "ThrowSound", 0, new float[] { 0.0f });
                    break;

                case "ethrow":
                    VSSCSharpClient.AUDupdate(handle, "EndThrow", 0, new float[] { 0.0f });
                    break;

                //SetMyPanning
                case "set pan":
                    //VSSCSharpClient.AUDupdate(handle, "SetMyPanning", 0, new float[] { fdata });
                    VSSCSharpClient.AUDupdateMany(1, new int[] { handle }, "SetMyPanning", 1, new float[] { fdata });
                    break;

                case "set dist":
                    VSSCSharpClient.AUDupdateMany(1, new int[] { handle }, "SetMyDistance", 1, new float[] { fdata });
                    break;

                //SetMyDistance
                default:
                    Console.WriteLine(ListCommands());
                    break;
                }
            } while (command.ToLower() != "q");



            //vss.AUDreset();
            //VSSCSharpClient.AUDreset();           //not sure if I need these
            //VSSCSharpClient.AUDterminate(handle); //not sure if I need these
            VSSCSharpClient.EndSoundServer();


            Console.WriteLine("Finished...");
            Console.ReadKey();
        }
Ejemplo n.º 3
0
 public static void UpdateCluster_1(float numAgents, Vector2 center, float area, float averageAgentEnergy, float clusterVelocity, Vector3 symmetry)
 {
     VSSCSharpClient.AUDupdate(handle, "updateCluster_1", 9, new float[] { numAgents, center.X, center.Y, area, averageAgentEnergy, clusterVelocity, symmetry.X, symmetry.Y, symmetry.Z });
 }
Ejemplo n.º 4
0
 public static void StopCluster(int index)
 {
     VSSCSharpClient.AUDupdate(handle, "stopCluster" + "_" + index, 1, new float[] { 1 });
 }
Ejemplo n.º 5
0
 public static void StopCluster()
 {
     VSSCSharpClient.AUDupdate(handle, "stopCluster", 1, new float[] { 0 });
 }
Ejemplo n.º 6
0
 public static void SendClusterXY(float x, float y)
 {
     VSSCSharpClient.AUDupdate(handle, "SendXYposition", 2, new float[] { x, y });
 }
Ejemplo n.º 7
0
 public static void TestData()
 {
     //VSSCSharpClient.AUDupdate(handle, "test", 0, new float[] { 0.0f });
     VSSCSharpClient.AUDupdate(handle, "playSeq", 0, new float[] { 0.0f });
 }
Ejemplo n.º 8
0
 public static void PlayPause(float value)
 {
     VSSCSharpClient.AUDupdate(handle, "PlayPause", 1, new float[] { value });
 }
Ejemplo n.º 9
0
 public static void AgentDataRefresh(float[] values)
 {
     VSSCSharpClient.AUDupdate(handle, "AgentDataRefresh", 1, values);
 }
Ejemplo n.º 10
0
 public static void SendXYsymmetry(Vector3 symmetry)
 {
     VSSCSharpClient.AUDupdate(handle, "SendXYsymmetry", 1, new float[] { symmetry.X, symmetry.Y, symmetry.Z });
 }
Ejemplo n.º 11
0
 public static void SendAgentEnergy(float energy)
 {
     VSSCSharpClient.AUDupdate(handle, "SendAgentEnergy", 1, new float[] { energy });
 }
Ejemplo n.º 12
0
 public static void SendArea(float area)
 {
     VSSCSharpClient.AUDupdate(handle, "SendArea", 1, new float[] { area });
 }
Ejemplo n.º 13
0
 public static void SendNumAgents(float numAgents)
 {
     VSSCSharpClient.AUDupdate(handle, "SendNumAgents", 1, new float[] { numAgents });
 }