public CommsController(SupportedChannels channel)
        {
            switch (channel)
            {
            case SupportedChannels.Comm:
            {
                commsChannel    = NinjectIoC.Kernel.Get <ICommsChannel>();
                commChannel     = NinjectIoC.Kernel.Get <ICommsController>();
                msgProcessor    = NinjectIoC.Kernel.Get <IMsgProcessor>();
                this.signalRMgr = NinjectIoC.Kernel.Get <ISignalRClientProxyMgr>();
                break;
            }

            case SupportedChannels.Tcpip:
            {
                commChannel = null;
                break;
            }
            }
        }
Exemple #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AudioInfo"/> class.
        /// </summary>
        /// <param name="format">A description of the audio stream format.</param>
        /// <param name="channels">The number of channels.</param>
        /// <param name="bitsPerSample">
        /// The number of bits per sample, or 0 if the audio is compressed in a lossy fashion.
        /// </param>
        /// <param name="sampleRate">The sample rate.</param>
        /// <param name="sampleCount">The total sample count, or 0 if it cannot be determined.</param>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="format"/> is null or empty.</exception>
        /// <exception cref="ArgumentOutOfRangeException">
        /// Thrown if one or more parameters are outside the supported range.
        /// </exception>
        public AudioInfo(string format, int channels, int bitsPerSample, int sampleRate, long sampleCount)
        {
            Contract.Requires <ArgumentNullException>(!string.IsNullOrEmpty(format));
            Contract.Requires <ArgumentOutOfRangeException>(SupportedChannels.Contains(channels));
            Contract.Requires <ArgumentOutOfRangeException>(bitsPerSample >= 0);
            Contract.Requires <ArgumentOutOfRangeException>(bitsPerSample <= 32);
            Contract.Requires <ArgumentOutOfRangeException>(SupportedSampleRates.Contains(sampleRate));
            Contract.Requires <ArgumentOutOfRangeException>(sampleCount >= 0);
            Contract.Ensures(Format == format);
            Contract.Ensures(Channels == channels);
            Contract.Ensures(BitsPerSample == bitsPerSample);
            Contract.Ensures(SampleRate == sampleRate);
            Contract.Ensures(SampleCount == sampleCount);

            Format        = format;
            Channels      = channels;
            BitsPerSample = bitsPerSample;
            SampleRate    = sampleRate;
            SampleCount   = sampleCount;
            if (sampleCount > 0)
            {
                Length = new TimeSpan(0, 0, (int)Math.Round(sampleCount / (double)sampleRate));
            }
        }