Esempio n. 1
0
        /// <summary>
        /// This method calls <see cref="Bass.Init(int, int, DeviceInitFlags, IntPtr, IntPtr)"/>.
        /// It can be overridden for unit testing.
        /// </summary>
        protected virtual bool InitBass(int device)
        {
            if (Bass.CurrentDevice == device)
            {
                return(true);
            }

            // reduce latency to a known sane minimum.
            Bass.Configure(ManagedBass.Configuration.DeviceBufferLength, 10);
            Bass.Configure(ManagedBass.Configuration.PlaybackBufferLength, 100);

            // this likely doesn't help us but also doesn't seem to cause any issues or any cpu increase.
            Bass.Configure(ManagedBass.Configuration.UpdatePeriod, 5);

            // without this, if bass falls back to directsound legacy mode the audio playback offset will be way off.
            Bass.Configure(ManagedBass.Configuration.TruePlayPosition, 0);

            // Enable custom BASS_CONFIG_MP3_OLDGAPS flag for backwards compatibility.
            Bass.Configure((ManagedBass.Configuration) 68, 1);

            // For iOS devices, set the default audio policy to one that obeys the mute switch.
            Bass.Configure(ManagedBass.Configuration.IOSMixAudio, 5);

            // ensure there are no brief delays on audio operations (causing stream STALLs etc.) after periods of silence.
            Bass.Configure(ManagedBass.Configuration.DevNonStop, true);

            // Always provide a default device. This should be a no-op, but we have asserts for this behaviour.
            Bass.Configure(ManagedBass.Configuration.IncludeDefaultDevice, true);

            // Disable BASS_CONFIG_DEV_TIMEOUT flag to keep BASS audio output from pausing on device processing timeout.
            // See https://www.un4seen.com/forum/?topic=19601 for more information.
            Bass.Configure((ManagedBass.Configuration) 70, false);

            return(AudioThread.InitDevice(device));
        }
Esempio n. 2
0
        /// <summary>
        /// This method calls <see cref="Bass.Init(int, int, DeviceInitFlags, IntPtr, IntPtr)"/>.
        /// It can be overridden for unit testing.
        /// </summary>
        protected virtual bool InitBass(int device)
        {
            if (Bass.CurrentDevice == device)
            {
                return(true);
            }

            // reduce latency to a known sane minimum.
            Bass.Configure(ManagedBass.Configuration.DeviceBufferLength, 10);
            Bass.Configure(ManagedBass.Configuration.PlaybackBufferLength, 100);

            // this likely doesn't help us but also doesn't seem to cause any issues or any cpu increase.
            Bass.Configure(ManagedBass.Configuration.UpdatePeriod, 5);

            // without this, if bass falls back to directsound legacy mode the audio playback offset will be way off.
            Bass.Configure(ManagedBass.Configuration.TruePlayPosition, 0);

            // Enable custom BASS_CONFIG_MP3_OLDGAPS flag for backwards compatibility.
            Bass.Configure((ManagedBass.Configuration) 68, 1);

            // For iOS devices, set the default audio policy to one that obeys the mute switch.
            Bass.Configure(ManagedBass.Configuration.IOSMixAudio, 5);

            // ensure there are no brief delays on audio operations (causing stream STALLs etc.) after periods of silence.
            Bass.Configure(ManagedBass.Configuration.DevNonStop, true);

            return(AudioThread.InitDevice(device));
        }