コード例 #1
0
            /// <summary>
            /// Creates a BASS stream that represents the song.
            /// </summary>
            /// <param name="flags">The flags to apply to the stream that is created.</param>
            /// <returns>The handle to the BASS stream that was created.</returns>
            public UInt32 CreateInstance(UInt32 flags)
            {
                var fileSystemService = FileSystemService.Create();

                var instance = fileSystemService.OpenRead(file);
                var instanceID = this.nextInstanceID++;
                instances.Add(instanceID, instance);

                var stream = 0u;
                try
                {
                    var procs = new BASS_FILEPROCS(fnClose, fnLength, fnRead, fnSeek);

                    stream = BASSNative.StreamCreateFileUser(1, BASSNative.BASS_STREAM_DECODE, &procs, new IntPtr((int)instanceID));
                    if (!BASSUtil.IsValidHandle(stream))
                        throw new BASSException();
                }
                catch
                {
                    instance.Dispose();
                    instances.Remove(instanceID);
                    throw;
                }

                return stream;
            }
コード例 #2
0
ファイル: BASSNative.cs プロジェクト: prshreshtha/ultraviolet
 public static extern UInt32 StreamCreateFileUser(UInt32 system, UInt32 flags, BASS_FILEPROCS* procs, IntPtr user);