Beispiel #1
0
 public override sealed UInt32 BASS_ChannelSetSync(UInt32 handle, UInt32 type, UInt64 param, SyncProc proc, IntPtr user) => pBASS_ChannelSetSync(handle, type, param, proc, user);
Beispiel #2
0
 public static extern UInt32 ChannelSetSync(UInt32 handle, BASSSync type, UInt64 param, SyncProc proc, IntPtr user);
Beispiel #3
0
 public abstract UInt32 BASS_ChannelSetSync(UInt32 handle, UInt32 type, UInt64 param, SyncProc proc, IntPtr user);
Beispiel #4
0
        /// <summary>
        /// Releases the memory associated with the underlying stream object.
        /// </summary>
        private Boolean StopInternal()
        {
            if (stream == 0)
                return false;

            if (!BASSNative.StreamFree(stream))
                throw new BASSException();

            stream = 0;

            syncLoopDelegate = null;
            syncLoop = 0;

            syncEndDelegate = null;
            syncEnd = 0;

            return true;
        }
Beispiel #5
0
        /// <summary>
        /// Plays the specified song.
        /// </summary>
        private Boolean PlayInternal(Song song, Single volume, Single pitch, Single pan, TimeSpan? loopStart, TimeSpan? loopLength)
        {
            Ultraviolet.ValidateResource(song);

            Stop();

            stream = ((BASSSong)song).CreateStream(BASSNative.BASS_STREAM_DECODE);
            stream = BASSFXNative.TempoCreate(stream, BASSNative.BASS_FX_FREESOURCE | BASSNative.BASS_STREAM_AUTOFREE);
            if (!BASSUtil.IsValidHandle(stream))
                throw new BASSException();

            var autoloop = loopStart.HasValue && !loopLength.HasValue;
            var syncloop = loopStart.HasValue && !autoloop;

            BASSUtil.SetIsLooping(stream, autoloop);
            BASSUtil.SetVolume(stream, MathUtil.Clamp(volume, 0f, 1f));
            BASSUtil.SetPitch(stream, MathUtil.Clamp(pitch, -1f, 1f));
            BASSUtil.SetPan(stream, MathUtil.Clamp(pan, -1f, 1f));

            if (loopStart > TimeSpan.Zero && loopLength <= TimeSpan.Zero)
                throw new ArgumentException(nameof(loopLength));

            if (syncloop)
            {
                var loopStartInBytes = BASSNative.ChannelSeconds2Bytes(stream, loopStart.Value.TotalSeconds);
                var loopEndInBytes = BASSNative.ChannelSeconds2Bytes(stream, (loopStart + loopLength).Value.TotalSeconds);
                syncLoopDelegate = SyncLoopThunk;
                syncLoop = BASSNative.ChannelSetSync(stream, BASSSync.SYNC_POS, loopEndInBytes, syncLoopDelegate, new IntPtr((Int32)loopStartInBytes));
                if (syncLoop == 0)
                    throw new BASSException();
            }

            syncEndDelegate = SyncEndThunk;
            syncEnd = BASSNative.ChannelSetSync(stream, BASSSync.SYNC_END, 0, syncEndDelegate, GCHandle.ToIntPtr(gcHandle));
            if (syncEnd == 0)
                throw new BASSException();

            if (!BASSNative.ChannelPlay(stream, true))
                throw new BASSException();

            OnStateChanged();
            OnSongStarted();

            return true;
        }
Beispiel #6
0
 public static UInt32 BASS_ChannelSetSync(UInt32 handle, UInt32 type, UInt64 param, SyncProc proc, IntPtr user) => pBASS_ChannelSetSync(handle, type, param, proc, user);
Beispiel #7
0
 public static extern UInt32 BASS_ChannelSetSync(UInt32 handle, UInt32 type, UInt64 param, SyncProc proc, IntPtr user);
 private static extern UInt32 INTERNAL_BASS_ChannelSetSync(UInt32 handle, UInt32 type, UInt64 param, SyncProc proc, IntPtr user);