private void removeChannelFromBassMix(IBassAudioChannel channel) { Debug.Assert(Handle != 0); Debug.Assert(channel.Handle != 0); channel.MixerChannelPaused = BassMix.ChannelHasFlag(channel.Handle, BassFlags.MixerChanPause); BassMix.MixerRemoveChannel(channel.Handle); }
/// <summary> /// Removes a channel from the native BASS mix. /// </summary> private void removeChannelFromBassMix(IBassAudioChannel channel) { // TODO: This fails and throws unobserved exceptions in github CI runs on macOS. // Needs further investigation at some point as something is definitely not right. // Debug.Assert(Handle != 0); // Debug.Assert(channel.Handle != 0); channel.MixerChannelPaused = BassMix.ChannelHasFlag(channel.Handle, BassFlags.MixerChanPause); BassMix.MixerRemoveChannel(channel.Handle); }
public bool ChannelPause(IBassAudioChannel channel, bool flushMixer = false) { bool result = BassMix.ChannelAddFlag(channel.Handle, BassFlags.MixerChanPause); if (flushMixer) { flush(); } return(result); }
public bool ChannelPlay(IBassAudioChannel channel, bool restart = false) { if (Handle == 0 || channel.Handle == 0) { return(false); } AddChannelToBassMix(channel); BassMix.ChannelRemoveFlag(channel.Handle, BassFlags.MixerChanPause); return(true); }
public PlaybackState ChannelIsActive(IBassAudioChannel channel) { // The audio channel's state tells us whether it's stalled or stopped. var state = ManagedBass.Bass.ChannelIsActive(channel.Handle); // The channel is always in a playing state unless stopped or stalled as it's a decoding channel. Retrieve the true playing state from the mixer channel. if (state == PlaybackState.Playing) { state = BassMix.ChannelFlags(channel.Handle, BassFlags.Default, BassFlags.Default).HasFlagFast(BassFlags.MixerChanPause) ? PlaybackState.Paused : state; } return(state); }
public void AddChannelToBassMix(IBassAudioChannel channel) { Debug.Assert(Handle != 0); Debug.Assert(channel.Handle != 0); BassFlags flags = BassFlags.MixerChanBuffer | BassFlags.MixerChanNoRampin; if (channel.MixerChannelPaused) { flags |= BassFlags.MixerChanPause; } if (BassMix.MixerAddChannel(Handle, channel.Handle, flags)) { activeChannels.Add(channel); } }
public bool ChannelSetPosition(IBassAudioChannel channel, long position, PositionFlags mode = PositionFlags.Bytes) { // All BASS channels enter a stopped state once they reach the end. // Non-decoding channels remain in the stopped state when seeked afterwards, however decoding channels are put back into a playing state which causes audio to play. // Thus, on seek, in order to reproduce the expectations set out by non-decoding channels, manually pause the mixer channel when the decoding channel is stopped. if (ChannelIsActive(channel) == PlaybackState.Stopped) { ChannelPause(channel, true); } bool result = BassMix.ChannelSetPosition(channel.Handle, position, mode); // Perform a flush so that ChannelGetPosition() immediately returns the new value. flush(); return(result); }
/// <summary> /// Adds a channel to the native BASS mix. /// </summary> public void AddChannelToBassMix(IBassAudioChannel channel) { // TODO: This fails and throws unobserved exceptions in github CI runs on macOS. // Needs further investigation at some point as something is definitely not right. // Debug.Assert(Handle != 0); // Debug.Assert(channel.Handle != 0); BassFlags flags = BassFlags.MixerChanBuffer | BassFlags.MixerChanNoRampin; if (channel.MixerChannelPaused) { flags |= BassFlags.MixerChanPause; } if (BassMix.MixerAddChannel(Handle, channel.Handle, flags)) { activeChannels.Add(channel); } }
public bool StreamFree(IBassAudioChannel channel) { Remove(channel, false); return(ManagedBass.Bass.StreamFree(channel.Handle)); }
public bool ChannelRemoveSync(IBassAudioChannel channel, int sync) => BassMix.ChannelRemoveSync(channel.Handle, sync);
public int ChannelSetSync(IBassAudioChannel channel, SyncFlags type, long parameter, SyncProcedure procedure, IntPtr user = default) => BassMix.ChannelSetSync(channel.Handle, type, parameter, procedure, user);
public int ChannelGetData(IBassAudioChannel channel, float[] buffer, int length) => BassMix.ChannelGetData(channel.Handle, buffer, length);
public bool ChannelGetLevel(IBassAudioChannel channel, [In, Out] float[] levels, float length, LevelRetrievalFlags flags) => BassMix.ChannelGetLevel(channel.Handle, levels, length, flags) != -1;
public long ChannelGetPosition(IBassAudioChannel channel, PositionFlags mode = PositionFlags.Bytes) => BassMix.ChannelGetPosition(channel.Handle);
public BassAmplitudeProcessor(IBassAudioChannel channel) { this.channel = channel; }