Exemple #1
0
        void IBassAudio.UpdateDevice(int deviceIndex)
        {
            if (!IsLoaded)
            {
                return;
            }

            // counter-intuitively, this is the correct API to use to migrate a sample to a new device.
            Bass.ChannelSetDevice(sampleId, deviceIndex);
            BassUtils.CheckFaulted(true);
        }
        void IBassAudio.UpdateDevice(int deviceIndex)
        {
            Bass.ChannelSetDevice(activeStream, deviceIndex);
            BassUtils.CheckFaulted(true);

            // Bass may leave us in an invalid state after the output device changes (this is true for "No sound" device)
            // if the observed state was playing before change, we should force things into a good state.
            if (isPlayed)
            {
                // While on windows, changing to "No sound" changes the playback state correctly,
                // on macOS it is left in a playing-but-stalled state. Forcefully stopping first fixes this.
                stopInternal();
                startInternal();
            }
        }
        internal override void UpdateDevice(int deviceIndex)
        {
            // The sample may not have already loaded if a device wasn't present in a previous load attempt.
            if (!IsLoaded)
            {
                loadSample();
            }

            if (!IsLoaded)
            {
                return;
            }

            // counter-intuitively, this is the correct API to use to migrate a sample to a new device.
            Bass.ChannelSetDevice(SampleId, deviceIndex);
            BassUtils.CheckFaulted(true);
        }