/// <summary>
        /// Initializes the audio manager.
        /// </summary>
        /// <param name="channels">The number of channels to use.</param>
        /// <param name="buffersPerChannel">The number of buffers each channel will contain.</param>
        /// <param name="bytesPerBuffer">The number of bytes in each buffer.</param>
        private void Init(int channels, int buffersPerChannel, int bytesPerBuffer, bool launchThread)
        {
            RunUpdates   = launchThread;
            ChannelCount = channels;
            Channels     = new AudioChannel[channels];

            for (int i = 0; i < channels; i++)
            {
                Channels[i] = new AudioChannel(buffersPerChannel, bytesPerBuffer);
            }

            Manager = this;

            if (launchThread)
            {
                UpdateThread = new Thread(RunUpdateLoop);
                UpdateThread.IsBackground = true;
                UpdateThread.Start();
            }
            else
            {
                UpdateThread = null;
            }
        }
Example #2
0
        /// <summary>
        /// Initializes the audio manager.
        /// </summary>
        /// <param name="channels">The number of channels to use.</param>
        /// <param name="buffersPerChannel">The number of buffers each channel will contain.</param>
        /// <param name="bytesPerBuffer">The number of bytes in each buffer.</param>
        private void Init(int channels, int buffersPerChannel, int bytesPerBuffer, bool launchThread)
        {
            RunUpdates = launchThread;
            ChannelCount = channels;
            Channels = new AudioChannel[channels];

            for (int i = 0; i < channels; i++)
                Channels[i] = new AudioChannel(buffersPerChannel, bytesPerBuffer);

            Manager = this;

            if(launchThread)
            {
                UpdateThread = new Thread(RunUpdateLoop);
                UpdateThread.IsBackground = true;
                UpdateThread.Start();
            }
            else
            {
                UpdateThread = null;
            }
        }