public override int Id => 0x18;//24

        public override void Handle(EzClient client, EzPacket packet)
        {
            KeySettings keySettings = client.Setting.GetKeySettings(client.Mode);

            keySettings.KeyOn1             = packet.Data.ReadByte();
            keySettings.KeyOn2             = packet.Data.ReadByte();
            keySettings.KeyOn3             = packet.Data.ReadByte();
            keySettings.KeyOn4             = packet.Data.ReadByte();
            keySettings.KeyOn5             = packet.Data.ReadByte();
            keySettings.KeyOn6             = packet.Data.ReadByte();
            keySettings.KeyAc1             = packet.Data.ReadByte();
            keySettings.KeyAc2             = packet.Data.ReadByte();
            keySettings.KeyAc3             = packet.Data.ReadByte();
            keySettings.KeyAc4             = packet.Data.ReadByte();
            keySettings.KeyAc5             = packet.Data.ReadByte();
            keySettings.KeyAc6             = packet.Data.ReadByte();
            client.Setting.VolumeMenuMusic = packet.Data.ReadByte();
            client.Setting.VolumeMenuSFX   = packet.Data.ReadByte();
            client.Setting.VolumeGameMusic = packet.Data.ReadByte();
            client.Setting.VolumeGameSFX   = packet.Data.ReadByte();
            client.Setting.BgaSettings     = new BgaSettings(packet.Data.ReadByte());
            client.Setting.SkinPosition    = packet.Data.ReadByte();

            IBuffer settings = SettingsPacket.Create(client.Setting, client.Mode);

            Send(client, 0x2D, settings); //45
        }
示例#2
0
        public NeuroScanSampler(IPEndPoint endPoint)
        {
            EndPoint = endPoint;

            _tcpClient = new TcpClient();
            _tcpClient.Connect(endPoint);
            _tcpClient.ReceiveTimeout = 100;
            _stream     = _tcpClient.GetStream();
            _settings   = Handshake(_stream, 1000);
            _dataBuffer = new byte[Math.Max(_settings.BodySize, PacketHeader.HeaderSize)];

            ChannelNum = (ushort)_settings.ChannelNum;
            Frequency  = _settings.SamplingRate;
        }
示例#3
0
        private static IEnumerable <ISample> ReadBlock(Stream stream, SettingsPacket settings, byte[] buffer, long timeout)
        {
            for (;;)
            {
                var header = ReadMessageHeader(stream, buffer, 0, timeout);
                if (!PacketType.Data.IsTypeMatch(header.Type))
                {
                    stream.SkipBytes(header.BodySize);
                    continue;
                }
                ReadStreamFully(stream, buffer, 0, (int)header.BodySize, timeout);
                break;
            }

            var samples = new List <ISample>(settings.SamplesPerBlock);
            var offset  = 0;

            for (var i = 0; i < settings.SamplesPerBlock; i++)
            {
                var channels = new double[settings.ChannelNum];
                for (var j = 0; j < settings.ChannelNum; j++)
                {
                    double rawValue;
                    switch (settings.DataSize)
                    {
                    case 2:
                        rawValue = buffer.ReadInt16(Endianness.LittleEndian, offset);
                        break;

                    case 4:
                        rawValue = buffer.ReadInt32(Endianness.LittleEndian, offset);
                        break;

                    default:
                        rawValue = 0;
                        break;
                    }
                    channels[j] = rawValue * settings.Resolution / 1000000;
                    offset     += settings.DataSize;
                }
                // var markers = new int[settings.EventChannelNum];
                for (var j = 0; j < settings.EventChannelNum; j++)
                {
                    offset += settings.DataSize; // Ignore markers
                }
                samples.Add(new Sample(channels));
            }
            return(samples);
        }
示例#4
0
        private void OnSessionResponse(Response <Session> result, EzClient client, EzPacket packet)
        {
            _logger.Debug("Client ({0}) entered world (SessionKey: {1})", client.Identity, result.Result.Key);


            client.Session = result.Result;

            Channel channel = Server.GetChannel(client.Mode, client.Session.ChannelId);

            channel.Join(client);

            IBuffer response = EzServer.Buffer.Provide();

            response.WriteByte(1);
            response.WriteByte(0);
            response.WriteByte(7);                              //0A?
            response.WriteByte(0);
            response.WriteByte((byte)client.Mode);              // Mode 0=RubyMix  1=STREET MIX  2=CLUB MIX
            response.WriteByte(0);
            response.WriteByte((byte)client.Session.ChannelId); //1-xCH / 0=1ch 1=2ch 2=3ch 3=4ch
            response.WriteByte(0);
            Send(client, 1, response);

            IBuffer characterList = LobbyCharacterListPacket.Create(channel);

            Send(channel.GetLobbyClients(), 2, characterList);

            IBuffer announceRoomPacket = RoomPacket.CreateAnnounceRoomPacket(channel);

            Send(client.Channel.GetLobbyClients(), 13, announceRoomPacket);

            IBuffer applyInventoryPacket = InventoryPacket.ShowInventoryPacket(client.Inventory);

            Send(client, 0x21, applyInventoryPacket);

            IBuffer djPointsPacket = SongPacket.CreateDjPointsPacket();

            Send(client, 0x2B, djPointsPacket); //43

            IBuffer settings = SettingsPacket.Create(client.Setting, client.Mode);

            Send(client, 0x2D, settings); //45
        }