void ClientInitialize()
        {
            M.MAudioClientProperties mproperties;
            mproperties.IsOffload = properties.HardwareOffload;
            mproperties.Category  = properties.BackgroundCapable ?
                                    M.MAudioStreamCategory.BackgroundCapableMedia : M.MAudioStreamCategory.ForegroundOnlyMedia;
            mproperties.Options = properties.RawMode ?
                                  M.MAudioClientStreamOption.Raw : M.MAudioClientStreamOption.None;
            client.SetClientProperties(mproperties);

            if (properties.BackgroundCapable)
            {
                mediaControl.IsPlayEnabled = mediaControl.IsPauseEnabled = true;
            }

            M.MAudioClientStreamFlags flags = new M.MAudioClientStreamFlags();
            flags.StreamEventCallback = true;
            client.Initialize(M.MAudioClientShareMode.Shared, flags, new TimeSpan(0), new TimeSpan(0), format);

            frameCount = client.BufferSize;
            frameSize  = format.FrameSize;
            renderer   = client.GetRenderClient();

            int bufferSize = frameCount * frameSize;

            stream              = new MRenderStream(bufferSize / 2, bufferSize * 2, bufferSize);
            stream.BufferReady += stream_BufferReady;
        }
Exemple #2
0
        void ClientInitialize()
        {
            M.MAudioClientStreamFlags flags = new M.MAudioClientStreamFlags();
            flags.StreamEventCallback = true;
            client.Initialize(M.MAudioClientShareMode.Shared, flags, new TimeSpan(0), new TimeSpan(0), format);

            frameCount = client.BufferSize;
            frameSize  = format.FrameSize;
            capturer   = client.GetCaptureClient();

            int bufferSize = frameCount * frameSize;

            stream = new MCaptureStream(bufferSize);
        }