Esempio n. 1
0
        public void Setup()
        {
            _format   = new AudioFormat();
            _samples  = new Dictionary <IAudioProvider, float[]>();
            _mixtures = new Dictionary <IAudioProvider, float[]>();

            _mixer = new MixingProvider(_format, -1);
            _mixer.Append((_first = new Mock <IAudioProvider>()).Object);
            _mixer.Append((_second = new Mock <IAudioProvider>()).Object);
            _mixer.Append((_third = new Mock <IAudioProvider>()).Object);

            _first
            .Setup(s => s.Read(It.IsAny <float[]>(), It.IsAny <int>(), It.IsAny <int>()))
            .Returns <float[], int, int>((buffer, offest, count) => Read(_first.Object, buffer));
            _first
            .Setup(s => s.Write(It.IsAny <ArraySegment <float> >()))
            .Callback <ArraySegment <float> >(samples => Write(_first.Object, samples));

            _second
            .Setup(s => s.Read(It.IsAny <float[]>(), It.IsAny <int>(), It.IsAny <int>()))
            .Returns <float[], int, int>((buffer, offest, count) => Read(_second.Object, buffer));
            _second
            .Setup(s => s.Write(It.IsAny <ArraySegment <float> >()))
            .Callback <ArraySegment <float> >(samples => Write(_second.Object, samples));

            _third
            .Setup(s => s.Read(It.IsAny <float[]>(), It.IsAny <int>(), It.IsAny <int>()))
            .Returns <float[], int, int>((buffer, offest, count) => Read(_third.Object, buffer));
            _third
            .Setup(s => s.Write(It.IsAny <ArraySegment <float> >()))
            .Callback <ArraySegment <float> >(samples => Write(_third.Object, samples));
        }
Esempio n. 2
0
        private Game(string gameCode, string gameName = "")
        {
            GameCode    = gameCode;
            GameName    = gameName;
            Sessions    = new AmongSession[10];
            InputStream = new JoinStream[10];
            Buffers     = new int [10];
            Output      = new MixingProvider(InputStream, 10);

            run = new Thread(VoIPThread);
            games.Add(gameCode, this);
            run.Start(exit);
        }