/// <summary> /// Gets a value indicating whether the specified channel is looping. /// </summary> /// <param name="handle">The handle of the channel to evaluate.</param> /// <returns>true if the channel is looping; otherwise, false.</returns> public static Boolean GetIsLooping(UInt32 handle) { var flags = BASS_ChannelFlags(handle, 0, 0); if (!BASSUtil.IsValidValue(flags)) { throw new BASSException(); } return((flags & BASS_SAMPLE_LOOP) == BASS_SAMPLE_LOOP); }
/// <inheritdoc/> public override void Play(Single volume, Single pitch, Single pan) { Contract.EnsureNotDisposed(this, Disposed); var channel = 0u; if (pitch == 0) { channel = BASS_SampleGetChannel(sample, false); if (!BASSUtil.IsValidHandle(channel)) { throw new BASSException(); } } else { var stream = BASS_StreamCreate(sampleInfo.freq, sampleInfo.chans, sampleInfo.flags | BASS_STREAM_DECODE, STREAMPROC_PUSH, IntPtr.Zero); if (!BASSUtil.IsValidHandle(stream)) { throw new BASSException(); } var pushed = BASS_StreamPutData(stream, sampleData, sampleInfo.length); if (!BASSUtil.IsValidValue(pushed)) { throw new BASSException(); } stream = BASS_FX_TempoCreate(stream, BASS_FX_FREESOURCE | BASS_STREAM_AUTOFREE); if (!BASSUtil.IsValidHandle(stream)) { throw new BASSException(); } channel = stream; BASSUtil.SetPitch(channel, MathUtil.Clamp(pitch, -1f, 1f)); } BASSUtil.SetVolume(channel, MathUtil.Clamp(volume, 0f, 1f)); BASSUtil.SetPan(channel, MathUtil.Clamp(pan, -1f, 1f)); if (!BASS_ChannelPlay(channel, false)) { throw new BASSException(); } }