Example #1
0
        /// <summary>Creates a new channel in the network stack with a given encryption IV.</summary>
        void CreateChannel(int Reference, byte[] IV)
        {
            EncryptWrapper ew = new EncryptWrapper(Endpoint, (byte[])Key.Clone(), IV);

            lock (DataChannels)
                DataChannels.Add(Reference, ew);
        }
Example #2
0
        /// <summary>Handler for messages on the control channel.</summary>
        byte[] ControlReply(byte[] IMsg, int IOf, int IOc, out int OOf, out int OOc)
        {
            int         MsgT = GetInt(IMsg, IOf);
            MessageType Type = (MessageType)MsgT;
            int         Reference;

            switch (Type)
            {
            case MessageType.Handshake:
                OOf = IOf; OOc = IOc;
                return(IMsg);

            case MessageType.OpenReference:
                byte[] IV = EncryptWrapper.RequestIV();
                Reference = GetInt(IMsg, IOf + 4);
                CreateChannel(Reference, IV);
                OOf = 0; OOc = IV.Length;
                return(IV);

            case MessageType.CloseReference:
                Reference = GetInt(IMsg, IOf + 4);
                ControlChannel.UnregisterCallback(Reference);
                lock (DataChannels)
                    DataChannels.Remove(Reference);
                OOf = IOf; OOc = IOc;
                return(IMsg);
            }
            OOf = 0; OOc = 0;
            return(new byte[0]);
        }
Example #3
0
File: Song.cs Project: xj0229/gsf
 /// <summary>
 /// Creates a new song with a 3/4 measure size, a tempo of 240 quarter-notes per minute,
 /// mezzo-forte prevailing dynamic level, using a basic note timbre and the specified
 /// audio format settings.
 /// </summary>
 /// <param name="sampleRate">Desired sample rate</param>
 /// <param name="bitsPerSample">Desired bits-per-sample</param>
 /// <param name="channels">Desired data channels</param>
 public Song(SampleRate sampleRate, BitsPerSample bitsPerSample, DataChannels channels)
     : base(sampleRate, bitsPerSample, channels)
 {
     m_measureSize = new MeasureSize(3, NoteValue.Quarter);
     m_tempo       = new Tempo(240, NoteValue.Quarter);
     m_dynamic     = (double)Music.Dynamic.MezzoForte / 100.0D;
     m_timbre      = Music.Timbre.BasicNote;
     m_damping     = Music.Damping.Natural;
     m_noteQueue   = new List <Note>();
 }
Example #4
0
File: Song.cs Project: rmc00/gsf
 /// <summary>
 /// Creates a new song with a 3/4 measure size, a tempo of 240 quarter-notes per minute,
 /// mezzo-forte prevailing dynamic level, using a basic note timbre and the specified
 /// audio format settings.
 /// </summary>
 /// <param name="sampleRate">Desired sample rate</param>
 /// <param name="bitsPerSample">Desired bits-per-sample</param>
 /// <param name="channels">Desired data channels</param>
 public Song(SampleRate sampleRate, BitsPerSample bitsPerSample, DataChannels channels)
     : base(sampleRate, bitsPerSample, channels)
 {
     m_measureSize = new MeasureSize(3, NoteValue.Quarter);
     m_tempo = new Tempo(240, NoteValue.Quarter);
     m_dynamic = (double)Music.Dynamic.MezzoForte / 100.0D;
     m_timbre = Music.Timbre.BasicNote;
     m_damping = Music.Damping.Natural;
     m_noteQueue = new List<Note>();
 }
Example #5
0
 public WaveFile(SampleRate sampleRate, BitsPerSample bitsPerSample, DataChannels channels, WaveFormat audioFormat)
     : this((int)sampleRate, (short)bitsPerSample, (short)channels, (ushort)audioFormat)
 {
 }
Example #6
0
 /// <summary>
 /// Creates a new empty in-memory wave file in Pulse Code Modulation (PCM) audio format.
 /// </summary>
 /// <param name="sampleRate">Desired sample rate.</param>
 /// <param name="bitsPerSample">Desired bits-per-sample.</param>
 /// <param name="channels">Desired data channels.</param>
 public WaveFile(SampleRate sampleRate, BitsPerSample bitsPerSample, DataChannels channels)
     : this((int)sampleRate, (short)bitsPerSample, (short)channels, (ushort)WaveFormat.PCM)
 {
 }
 public LocalDataSender(DataChannels ChannelID, bool ordered, bool reliable) : base(ChannelID, ordered, reliable)
 {
 }
 public LocalDataSource(DataChannels ChannelID, bool ordered, bool reliable)
 {
     this.ChannelID = ChannelID;
     this.ordered   = ordered;
     this.reliable  = reliable;
 }