示例#1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="context">Context the audio belongs to. Think of i as an indentifier for the sound you're about to operate on.</param>
 /// <param name="command">What is the system supposed to do?</param>
 /// <param name="identifier">What sound are we doing this to?</param>
 public AudioEvent(object context, AudioCommands command, string identifier = "",
                   Vector3 worldPosition = default(Vector3), Transform followTransform = null)
 {
     AudioCommand    = command;
     Identifier      = identifier;
     Context         = context;
     WorldPosition   = worldPosition;
     FollowTransform = followTransform;
 }
示例#2
0
 internal void Help(string Arg)
 {
     if (String.IsNullOrEmpty(Arg))
     {
         this.Log(MessageStatus.Info, LogStrings.Help.Audio.General);
         return;
     }
     if (AudioCommands.GetCommands().Where(c => c.Alias == Arg.ToLower()).Count() > 0)
     {
         var item = AudioCommands.GetCommands().Where(c => c.Alias == Arg.ToLower()).First();
         this.Log(MessageStatus.Info, "Usage: " + item.Alias + " " + item.Info + Environment.NewLine + item.Help);
         return;
     }
     this.Log(MessageStatus.Error, LogStrings.Error.General.UnknownCommand + Arg);
 }
        public ServerViewModel()
        {
            Server = new Server(IPAddress.Any);
            Server.ClientConnected    += Server_ClientConnected;
            Server.ClientDisconnected += Server_ClientDisconnected;
            Server.MessageReceived    += Server_MessageReceived;
            Server.OnPropertyChanged  += Server_OnPropertyChanged;
            Server.Start();

            Audio   = new AudioCommands(Server, "Audio");
            Visual  = new VisualCommands(Server, "Visuals");
            Windows = new WindowsCommands(Server, "Windows");
            Client  = new ClientCommands(Server, "Client");
            CMD     = new CMDCommands(Server, "CMD");

            Task.Run(() => new ServerDiscovery("gang?", "Dopple gang").Discover());
        }
示例#4
0
        private bool processCmd(byte[] buf)
        {
            if (waudio == null)
            {
                return(false);
            }

            try
            {
                if (buf.Length >= 7)
                {
                    AudioCommands cmd   = (AudioCommands)buf[2];
                    byte[]        param = new byte[2];
                    int           par   = BitConverter.ToInt32(buf, 3);

                    switch (cmd)
                    {
                    case AudioCommands.MODE:
                        AudioMode mode = (AudioMode)par;
                        if (!initializeMode(mode))
                        {
                            Console.WriteLine($"Mode {mode} setting error ");
                            return(false);
                        }
                        else
                        {
                            Console.WriteLine($"Mode {mode} set ");
                        }
                        break;

                    case AudioCommands.MUTE:
                        if (Mode == AudioMode.MODE_NIL)
                        {
                            return(false);
                        }
                        waudio.Mute = par == 1 ? true : false;
                        string onoff = waudio.Mute ? "on" : "off";
                        Console.WriteLine($"Audio Mute {onoff} ");
                        break;

                    case AudioCommands.UDP:
                        if (Mode == AudioMode.MODE_NIL)
                        {
                            return(false);
                        }
                        waudio.UDP = par == 1 ? true : false;
                        onoff      = waudio.UDP ? "on" : "off";
                        Console.WriteLine($"UDP PCM16 output {onoff} ");
                        break;

                    case AudioCommands.UDPPort:
                        if (Mode == AudioMode.MODE_NIL)
                        {
                            return(false);
                        }
                        waudio.UDP_Port = par;
                        Console.WriteLine($"UDP PCM16 output port set: {par} ");
                        break;

                    default:
                        if (Mode == AudioMode.MODE_NIL)
                        {
                            return(false);
                        }
                        break;
                    }
                    return(true);
                }
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                return(false);
            }
            return(true);
        }
 public AudioCommandPacket(int id, AudioCommands playOrDismiss)
     : base()
 {
     ID = id;
     Command = playOrDismiss;
 }
示例#6
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="context">Context the audio belongs to. Think of i as an indentifier for the sound you're about to operate on.</param>
 /// <param name="command">What is the system supposed to do?</param>
 /// <param name="identifier">What sound are we doing this to?</param>
 public AudioEvent(object context, AudioCommands command, string identifier = "")
 {
     AudioCommand = command;
     Identifier   = identifier;
     Context      = context;
 }