コード例 #1
0
        public void Start(IHardwareDeviceDriver deviceDriver)
        {
            OutputDevices = new IHardwareDevice[Constants.AudioRendererSessionCountMax];

            // TODO: Before enabling this, we need up-mixing from stereo to 5.1.
            // uint channelCount = GetHardwareChannelCount(deviceDriver);
            uint channelCount = 2;

            for (int i = 0; i < OutputDevices.Length; i++)
            {
                // TODO: Don't hardcode sample rate.
                OutputDevices[i] = new HardwareDeviceImpl(deviceDriver, channelCount, Constants.TargetSampleRate);
            }

            _mailbox            = new Mailbox <MailboxMessage>();
            _sessionCommandList = new RendererSession[Constants.AudioRendererSessionCountMax];
            _event.Reset();
            _lastTime   = PerformanceCounter.ElapsedNanoseconds;
            _pauseEvent = deviceDriver.GetPauseEvent();

            StartThread();

            _mailbox.SendMessage(MailboxMessage.Start);

            if (_mailbox.ReceiveResponse() != MailboxMessage.Start)
            {
                throw new InvalidOperationException("Audio Processor Start response was invalid!");
            }
        }
コード例 #2
0
 public ManualResetEvent GetPauseEvent()
 {
     return(_realDriver.GetPauseEvent());
 }