コード例 #1
0
        public override bool Start(ENCODEPROC proc, IntPtr user, bool paused)
        {
            if (base.EncoderHandle != 0 || (proc != null && !this.SupportsSTDOUT))
            {
                return(false);
            }
            BASSEncode bassencode = BASSEncode.BASS_ENCODE_DEFAULT;

            if (base.Force16Bit)
            {
                bassencode |= BASSEncode.BASS_ENCODE_FP_16BIT;
            }
            else
            {
                bassencode |= BASSEncode.BASS_ENCODE_FP_32BIT;
            }
            if (paused)
            {
                bassencode |= BASSEncode.BASS_ENCODE_PAUSE;
            }
            if (base.NoLimit)
            {
                bassencode |= BASSEncode.BASS_ENCODE_CAST_NOLIMIT;
            }
            if (base.UseAsyncQueue)
            {
                bassencode |= BASSEncode.BASS_ENCODE_QUEUE;
            }
            base.EncoderHandle = BassEnc.BASS_Encode_Start(base.ChannelHandle, this.EncoderCommandLine, bassencode, proc, user);
            return(base.EncoderHandle != 0);
        }
コード例 #2
0
        public unsafe override bool Start(ENCODEPROC proc, IntPtr user, bool paused)
        {
            if (base.EncoderHandle != 0 || (proc != null && !this.SupportsSTDOUT))
            {
                return(false);
            }
            if (this.ACM_Codec == null)
            {
                this.ACM_Codec = new ACMFORMAT();
            }
            int num = base.ChannelHandle;

            if (base.InputFile != null)
            {
                num = Bass.BASS_StreamCreateFile(base.InputFile, 0L, 0L, BASSFlag.BASS_STREAM_DECODE);
                if (num == 0)
                {
                    return(false);
                }
            }
            BASSEncode bassencode = BASSEncode.BASS_ENCODE_DEFAULT;

            if (paused && base.InputFile == null)
            {
                bassencode |= BASSEncode.BASS_ENCODE_PAUSE;
            }
            if (base.NoLimit)
            {
                bassencode |= BASSEncode.BASS_ENCODE_CAST_NOLIMIT;
            }
            if (base.UseAsyncQueue)
            {
                bassencode |= BASSEncode.BASS_ENCODE_QUEUE;
            }

            fixed(byte *ptr = this.acmCodecToByteArray())
            {
                if (base.OutputFile == null)
                {
                    base.EncoderHandle = BassEnc.BASS_Encode_StartACM(num, (IntPtr)((void *)ptr), bassencode, proc, user);
                }
                else
                {
                    if (base.OutputFile == null || this.ACM_EncoderType != BASSChannelType.BASS_CTYPE_STREAM_WAV || !this.ACM_WriteWaveHeader)
                    {
                        bassencode |= BASSEncode.BASS_ENCODE_NOHEAD;
                    }
                    base.EncoderHandle = BassEnc.BASS_Encode_StartACMFile(num, (IntPtr)((void *)ptr), bassencode, base.OutputFile);
                }
            }

            if (base.InputFile != null)
            {
                Utils.DecodeAllData(num, true);
            }
            return(base.EncoderHandle != 0);
        }
コード例 #3
0
        public override bool Start(ENCODEPROC proc, IntPtr user, bool paused)
        {
            if (base.EncoderHandle != 0 || (proc != null && !this.SupportsSTDOUT))
            {
                return(false);
            }
            if (base.OutputFile == null)
            {
                return(false);
            }
            int num = base.ChannelHandle;

            if (base.InputFile != null)
            {
                num = Bass.BASS_StreamCreateFile(base.InputFile, 0L, 0L, BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_STREAM_DECODE);
                if (num == 0)
                {
                    return(false);
                }
            }
            BASSEncode bassencode = BASSEncode.BASS_ENCODE_AIFF;

            if (this._aiffBitsPerSample == 16)
            {
                bassencode |= BASSEncode.BASS_ENCODE_FP_16BIT;
            }
            else if (this._aiffBitsPerSample == 24)
            {
                bassencode |= BASSEncode.BASS_ENCODE_FP_24BIT;
            }
            else if (this._aiffBitsPerSample == 8)
            {
                bassencode |= BASSEncode.BASS_ENCODE_FP_8BIT;
            }
            else if (this.AIFF_Use32BitInteger)
            {
                bassencode |= BASSEncode.BASS_ENCODE_FP_32BIT;
            }
            if (paused)
            {
                bassencode |= BASSEncode.BASS_ENCODE_PAUSE;
            }
            if (base.NoLimit)
            {
                bassencode |= BASSEncode.BASS_ENCODE_CAST_NOLIMIT;
            }
            if (base.UseAsyncQueue)
            {
                bassencode |= BASSEncode.BASS_ENCODE_QUEUE;
            }
            base.EncoderHandle = BassEnc.BASS_Encode_Start(num, base.OutputFile, bassencode, null, IntPtr.Zero);
            if (base.InputFile != null)
            {
                Utils.DecodeAllData(num, true);
            }
            return(base.EncoderHandle != 0);
        }
コード例 #4
0
        /// <summary>
        /// Stops the playback and copies the audio stream from CD to a <see cref="Stream"/> in MP3
        /// format asynchronously. If the song was playing before copying, playback will be restored.
        /// </summary>
        /// <param name="TargetStream">The <see cref="Stream"/> where the media is written to.</param>
        /// <param param name="Progress">An <see cref="IProgress{T}"/> instance that will be used to report the save progress. Can be null.</param>
        /// <returns>A <see cref="Task"/> that represents the asynchronous process.</returns>
        public async Task <bool> SaveToAsync(Stream TargetStream, IProgress <LongOperationProgress> Progress)
        {
            bool   RequiresRestore = this.IsPlaying;
            double Position        = this.Position;

            if (this.IsPlaying)
            {
                this.Stop();
            }

            ENCODEPROC proc = new ENCODEPROC(
                (handle, channel, buffer, length, user) => {
                byte[] ManagedBuffer = new byte[length];
                Marshal.Copy(buffer, ManagedBuffer, 0, length);

                TargetStream.Write(ManagedBuffer, 0, length);
            }
                );

            int  DecodingChannel       = Bass.BASS_StreamCreateFile(this.Filename, 0, 0, BASSFlag.BASS_STREAM_DECODE);
            long DecodingChannelLength = Bass.BASS_ChannelGetLength(DecodingChannel);
            int  Handle = BassEnc.BASS_Encode_Start(DecodingChannel, (new Lame()).GetCommandLine(), BASSEncode.BASS_ENCODE_AUTOFREE, proc, IntPtr.Zero);

            LongOperationProgress Status = new LongOperationProgress {
                IsIndetermine = false,
                Maximum       = DecodingChannelLength,
                Position      = 0
            };

            Progress?.Report(Status);

            await Task.Run(() => {
                int BufferLength = 10240;
                byte[] Buffer    = new byte[BufferLength];

                while (Bass.BASS_ChannelGetPosition(DecodingChannel) < DecodingChannelLength)
                {
                    Status.Position += Bass.BASS_ChannelGetData(DecodingChannel, Buffer, BufferLength);
                    Progress?.Report(Status);
                }

                BassEnc.BASS_Encode_Stop(Handle);
            });

            this.ChannelID = Bass.BASS_StreamCreateFile(this.Filename, 0, 0, BASSFlag.BASS_DEFAULT);
            if (RequiresRestore)
            {
                this.Position = Position;
                this.Play();
            }

            return(true);
        }
コード例 #5
0
        /// <summary>
        /// Initialize MP3 encoding whith LAME
        /// </summary>
        /// <param name="_rechandle"></param>
        /// <returns></returns>
        private bool StartLameEncoding(int _rechandle)
        {
            /* Voir si en utilisant "lameEncoder.OutputFile =  outFile"
             * on pourrait créer un fichier au lieu d'un buffer
             * */
            _lameMemBuffer.Clear();
            _LameEncProc = new ENCODEPROC(LameEncCallback); // Callback function

            lameEncoder = new EncoderLAME(_rechandle);


            if (lameEncoder.EncoderExists == false)
            {
                Console.Write("Encoder does not exists ?\r");
            }


            lameEncoder.InputFile = null;       //STDIN

            if (bSaveToDisk)
            {
                lameEncoder.OutputFile = strSaveFile;
            }
            else
            {
                lameEncoder.OutputFile = null;  //STDOUT - adding file name will prevent the callback from working instead will saving to disk
            }
            lameEncoder.LAME_Bitrate = (int)EncoderLAME.BITRATE.kbps_64;
            lameEncoder.LAME_Mode    = EncoderLAME.LAMEMode.Default;
            lameEncoder.LAME_Quality = EncoderLAME.LAMEQuality.Quality;

            bool bret = lameEncoder.Start(_LameEncProc, IntPtr.Zero, false);

            BASSError txt = Bass.BASS_ErrorGetCode();

            Msg(txt.ToString());

            return(bret);
        }
コード例 #6
0
        public override bool Start(ENCODEPROC proc, IntPtr user, bool paused)
        {
            if (base.EncoderHandle != 0 || (proc != null && !this.SupportsSTDOUT))
            {
                return(false);
            }
            this._paused      = paused;
            this._encoderProc = null;
            this._byteSend    = 0L;
            BASSWMAEncode basswmaencode = BASSWMAEncode.BASS_WMA_ENCODE_DEFAULT;

            if (this.WMA_ForceStandard)
            {
                basswmaencode |= BASSWMAEncode.BASS_WMA_ENCODE_STANDARD;
            }
            else
            {
                if (this.WMA_UsePro)
                {
                    basswmaencode |= BASSWMAEncode.BASS_WMA_ENCODE_PRO;
                }
                if (this.WMA_Use24Bit)
                {
                    basswmaencode |= BASSWMAEncode.BASS_WMA_ENCODE_24BIT;
                    basswmaencode |= BASSWMAEncode.BASS_WMA_ENCODE_PRO;
                }
            }
            this._channel             = base.ChannelHandle;
            this.WMA_TargetNumChans   = base.ChannelNumChans;
            this.WMA_TargetSampleRate = base.ChannelSampleRate;
            if (base.InputFile != null)
            {
                this._channel = Bass.BASS_StreamCreateFile(base.InputFile, 0L, 0L, BASSFlag.BASS_STREAM_DECODE | (this.WMA_Use24Bit ? BASSFlag.BASS_SAMPLE_FLOAT : BASSFlag.BASS_DEFAULT));
                if (this._channel == 0)
                {
                    return(false);
                }
                if (this.WMA_Use24Bit)
                {
                    basswmaencode |= BASSWMAEncode.BASS_SAMPLE_FLOAT;
                }
            }
            else if (base.ChannelBitwidth == 32)
            {
                basswmaencode |= BASSWMAEncode.BASS_SAMPLE_FLOAT;
            }
            else if (base.ChannelBitwidth == 8)
            {
                basswmaencode |= BASSWMAEncode.BASS_SAMPLE_8BITS;
            }
            if (this.WMA_UseNetwork)
            {
                basswmaencode |= BASSWMAEncode.BASS_WMA_ENCODE_SCRIPT;
            }
            int bitrate = this.WMA_Bitrate * 1000;

            if (this.WMA_UseVBR && this.WMA_VBRQuality > 0 && this.WMA_VBRQuality <= 100)
            {
                bitrate = this.WMA_VBRQuality;
            }
            if (proc != null && !this.WMA_UseNetwork)
            {
                this._encoderProc   = proc;
                this._wmEncoderProc = new WMENCODEPROC(this.EncodingWMAHandler);
            }
            if (base.OutputFile == null)
            {
                if (this.WMA_UseNetwork && !this.WMA_UsePublish)
                {
                    if (this.WMA_MultiBitrate != null && this.WMA_MultiBitrate.Length != 0)
                    {
                        int[] array = new int[this.WMA_MultiBitrate.Length];
                        for (int i = 0; i < this.WMA_MultiBitrate.Length; i++)
                        {
                            array[i] = this.WMA_MultiBitrate[i] * 1000;
                        }
                        base.EncoderHandle = BassWma.BASS_WMA_EncodeOpenNetworkMulti(this.WMA_TargetSampleRate, this.WMA_TargetNumChans, basswmaencode, array, this.WMA_NetworkPort, this.WMA_NetworkClients);
                    }
                    else
                    {
                        if (this.WMA_MultiBitrate != null)
                        {
                            bitrate = this.WMA_MultiBitrate[0];
                        }
                        base.EncoderHandle = BassWma.BASS_WMA_EncodeOpenNetwork(this.WMA_TargetSampleRate, this.WMA_TargetNumChans, basswmaencode, bitrate, this.WMA_NetworkPort, this.WMA_NetworkClients);
                    }
                }
                else if (this.WMA_UseNetwork && this.WMA_UsePublish)
                {
                    if (this.WMA_MultiBitrate != null && this.WMA_MultiBitrate.Length > 1)
                    {
                        int[] array2 = new int[this.WMA_MultiBitrate.Length];
                        for (int j = 0; j < this.WMA_MultiBitrate.Length; j++)
                        {
                            array2[j] = this.WMA_MultiBitrate[j] * 1000;
                        }
                        base.EncoderHandle = BassWma.BASS_WMA_EncodeOpenPublishMulti(this.WMA_TargetSampleRate, this.WMA_TargetNumChans, basswmaencode, array2, this.WMA_PublishUrl, this.WMA_PublishUsername, this.WMA_PublishPassword);
                    }
                    else
                    {
                        base.EncoderHandle = BassWma.BASS_WMA_EncodeOpenPublish(this.WMA_TargetSampleRate, this.WMA_TargetNumChans, basswmaencode, bitrate, this.WMA_PublishUrl, this.WMA_PublishUsername, this.WMA_PublishPassword);
                    }
                }
                else if (proc != null)
                {
                    base.EncoderHandle = BassWma.BASS_WMA_EncodeOpen(this.WMA_TargetSampleRate, this.WMA_TargetNumChans, basswmaencode, bitrate, this._wmEncoderProc, user);
                }
            }
            else
            {
                base.EncoderHandle = BassWma.BASS_WMA_EncodeOpenFile(this.WMA_TargetSampleRate, this.WMA_TargetNumChans, basswmaencode, bitrate, base.OutputFile);
                if (base.TAGs != null)
                {
                    if (!string.IsNullOrEmpty(base.TAGs.title))
                    {
                        this.SetTag("Title", base.TAGs.title);
                    }
                    if (!string.IsNullOrEmpty(base.TAGs.artist))
                    {
                        this.SetTag("Author", base.TAGs.artist);
                    }
                    if (!string.IsNullOrEmpty(base.TAGs.album))
                    {
                        this.SetTag("WM/AlbumTitle", base.TAGs.album);
                    }
                    if (!string.IsNullOrEmpty(base.TAGs.albumartist))
                    {
                        this.SetTag("WM/AlbumArtist", base.TAGs.albumartist);
                    }
                    if (!string.IsNullOrEmpty(base.TAGs.year))
                    {
                        this.SetTag("WM/Year", base.TAGs.year);
                    }
                    if (!string.IsNullOrEmpty(base.TAGs.track))
                    {
                        this.SetTag("WM/TrackNumber", base.TAGs.track);
                    }
                    if (!string.IsNullOrEmpty(base.TAGs.disc))
                    {
                        this.SetTag("WM/PartOfSet", base.TAGs.disc);
                    }
                    if (!string.IsNullOrEmpty(base.TAGs.genre))
                    {
                        this.SetTag("WM/Genre", base.TAGs.genre);
                    }
                    if (!string.IsNullOrEmpty(base.TAGs.comment))
                    {
                        this.SetTag("Description", base.TAGs.comment);
                    }
                    if (!string.IsNullOrEmpty(base.TAGs.composer))
                    {
                        this.SetTag("WM/Composer", base.TAGs.composer);
                    }
                    if (!string.IsNullOrEmpty(base.TAGs.conductor))
                    {
                        this.SetTag("WM/Conductor", base.TAGs.conductor);
                    }
                    if (!string.IsNullOrEmpty(base.TAGs.lyricist))
                    {
                        this.SetTag("WM/Writer", base.TAGs.lyricist);
                    }
                    if (!string.IsNullOrEmpty(base.TAGs.remixer))
                    {
                        this.SetTag("WM/ModifiedBy", base.TAGs.remixer);
                    }
                    if (!string.IsNullOrEmpty(base.TAGs.producer))
                    {
                        this.SetTag("WM/Producer", base.TAGs.producer);
                    }
                    if (!string.IsNullOrEmpty(base.TAGs.encodedby))
                    {
                        this.SetTag("WM/EncodedBy", base.TAGs.encodedby);
                    }
                    if (!string.IsNullOrEmpty(base.TAGs.copyright))
                    {
                        this.SetTag("Copyright", base.TAGs.copyright);
                    }
                    if (!string.IsNullOrEmpty(base.TAGs.publisher))
                    {
                        this.SetTag("WM/Publisher", base.TAGs.publisher);
                    }
                    if (!string.IsNullOrEmpty(base.TAGs.bpm))
                    {
                        this.SetTag("WM/BeatsPerMinute", base.TAGs.bpm);
                    }
                    if (!string.IsNullOrEmpty(base.TAGs.grouping))
                    {
                        this.SetTag("WM/ContentGroupDescription", base.TAGs.grouping);
                    }
                    if (!string.IsNullOrEmpty(base.TAGs.rating))
                    {
                        this.SetTag("WM/Rating", base.TAGs.rating);
                    }
                    if (!string.IsNullOrEmpty(base.TAGs.mood))
                    {
                        this.SetTag("WM/Mood", base.TAGs.mood);
                    }
                    if (!string.IsNullOrEmpty(base.TAGs.isrc))
                    {
                        this.SetTag("WM/ISRC", base.TAGs.isrc);
                    }
                    if (base.TAGs.replaygain_track_peak >= 0f)
                    {
                        this.SetTag("replaygain_track_peak", base.TAGs.replaygain_track_peak.ToString("R", CultureInfo.InvariantCulture));
                    }
                    if (base.TAGs.replaygain_track_gain >= -60f && base.TAGs.replaygain_track_gain <= 60f)
                    {
                        this.SetTag("replaygain_track_gain", base.TAGs.replaygain_track_gain.ToString("R", CultureInfo.InvariantCulture) + " dB");
                    }
                }
            }
            if (base.EncoderHandle == 0)
            {
                return(false);
            }
            this._dspCallback = new DSPPROC(this.EncodingDSPHandler);
            this._dspHandle   = Bass.BASS_ChannelSetDSP(base.ChannelHandle, this._dspCallback, IntPtr.Zero, Bass.BASS_GetConfig(BASSConfig.BASS_CONFIG_ENCODE_PRIORITY));
            if (this._dspHandle == 0)
            {
                this.Stop();
                return(false);
            }
            if (base.InputFile != null)
            {
                Utils.DecodeAllData(this._channel, true);
            }
            this._channel = 0;
            return(base.EncoderHandle != 0);
        }
コード例 #7
0
 public abstract bool Start(ENCODEPROC proc, IntPtr user, bool paused);
コード例 #8
0
ファイル: BroadCast.cs プロジェクト: the-alex-mark/proglib-cs
        public bool StartEncoder(ENCODEPROC proc, IntPtr user, bool paused)
        {
            bool result = true;

            if (this.Server.Encoder.Start(proc, user, paused))
            {
                this.RaiseNotification(BroadCastEventType.EncoderStarted, this.Server.Encoder);
            }
            else
            {
                this.Server.LastError        = StreamingServer.STREAMINGERROR.Error_EncoderError;
                this.Server.LastErrorMessage = Enum.GetName(typeof(BASSError), Bass.BASS_ErrorGetCode());
                BASSError basserror = Bass.BASS_ErrorGetCode();
                if (basserror <= BASSError.BASS_ERROR_ILLPARAM)
                {
                    if (basserror != BASSError.BASS_ERROR_FILEOPEN)
                    {
                        if (basserror == BASSError.BASS_ERROR_ILLPARAM)
                        {
                            this.Server.LastError        = StreamingServer.STREAMINGERROR.Error_EncoderError;
                            this.Server.LastErrorMessage = "Illegal parameters used to start encoder!";
                            goto IL_18C;
                        }
                    }
                    else
                    {
                        if (this.Server.Encoder is EncoderWMA)
                        {
                            this.Server.LastError        = StreamingServer.STREAMINGERROR.Error_CreatingConnection;
                            this.Server.LastErrorMessage = "Couldn't connect to the server. Check URL!";
                            goto IL_18C;
                        }
                        this.Server.LastError        = StreamingServer.STREAMINGERROR.Error_EncoderError;
                        this.Server.LastErrorMessage = "Couldn't start the encoder. Check that executable exists!";
                        goto IL_18C;
                    }
                }
                else
                {
                    if (basserror == BASSError.BASS_ERROR_NOTAVAIL)
                    {
                        this.Server.LastError        = StreamingServer.STREAMINGERROR.Error_EncoderError;
                        this.Server.LastErrorMessage = "Encoder codec missing!";
                        goto IL_18C;
                    }
                    switch (basserror)
                    {
                    case BASSError.BASS_ERROR_WMA_WM9:
                    case BASSError.BASS_ERROR_WMA_CODEC:
                        this.Server.LastError        = StreamingServer.STREAMINGERROR.Error_EncoderError;
                        this.Server.LastErrorMessage = "WMA codec missing or WMA9 required!";
                        goto IL_18C;

                    case BASSError.BASS_ERROR_WMA_DENIED:
                        this.Server.LastError        = StreamingServer.STREAMINGERROR.Error_Login;
                        this.Server.LastErrorMessage = "Access denied. Check username/password!";
                        goto IL_18C;
                    }
                }
                this.Server.LastError        = StreamingServer.STREAMINGERROR.Error_EncoderError;
                this.Server.LastErrorMessage = "Some mystery problem occurred when trying to start the encoder!";
IL_18C:
                result = false;
                this.RaiseNotification(BroadCastEventType.EncoderStartError, this.Server.Encoder);
            }
            return(result);
        }
コード例 #9
0
ファイル: BassEnc.cs プロジェクト: the-alex-mark/proglib-cs
 public static int BASS_Encode_Start(int handle, string cmdline, BASSEncode flags, ENCODEPROC proc, IntPtr user, int limit)
 {
     flags |= BASSEncode.BASS_UNICODE;
     return(BassEnc.BASS_Encode_StartUnicode(handle, cmdline, flags, proc, user, limit));
 }
コード例 #10
0
ファイル: BassEnc.cs プロジェクト: the-alex-mark/proglib-cs
 private static extern int BASS_Encode_StartUnicode(int chan, [MarshalAs(UnmanagedType.LPWStr)][In] string cmdline, BASSEncode flags, ENCODEPROC proc, IntPtr user, int limit);
コード例 #11
0
ファイル: BassEnc.cs プロジェクト: the-alex-mark/proglib-cs
 public static extern int BASS_Encode_StartACM(int handle, IntPtr form, BASSEncode flags, ENCODEPROC proc, IntPtr user);
コード例 #12
0
        public override bool Start(ENCODEPROC proc, IntPtr user, bool paused)
        {
            if (base.EncoderHandle != 0 || (proc != null && !this.SupportsSTDOUT))
            {
                return(false);
            }
            if (base.OutputFile == null)
            {
                return(false);
            }
            int num = base.ChannelHandle;

            if (base.InputFile != null)
            {
                num = Bass.BASS_StreamCreateFile(base.InputFile, 0L, 0L, BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_STREAM_DECODE);
                if (num == 0)
                {
                    return(false);
                }
            }
            BASSEncode bassencode = BASSEncode.BASS_ENCODE_PCM;

            if (this._wavUseAIFF)
            {
                bassencode = BASSEncode.BASS_ENCODE_AIFF;
            }
            if (this._wavBitsPerSample == 16)
            {
                bassencode |= BASSEncode.BASS_ENCODE_FP_16BIT;
            }
            else if (this._wavBitsPerSample == 24)
            {
                bassencode |= BASSEncode.BASS_ENCODE_FP_24BIT;
            }
            else if (this._wavBitsPerSample == 8)
            {
                bassencode |= BASSEncode.BASS_ENCODE_FP_8BIT;
            }
            else if (this.WAV_Use32BitInteger)
            {
                bassencode |= BASSEncode.BASS_ENCODE_FP_32BIT;
            }
            if (this.BWF_UseRF64)
            {
                bassencode |= BASSEncode.BASS_ENCODE_RF64;
            }
            if (paused || (base.TAGs != null && !this._wavUseAIFF))
            {
                bassencode |= BASSEncode.BASS_ENCODE_PAUSE;
            }
            if (base.NoLimit)
            {
                bassencode |= BASSEncode.BASS_ENCODE_CAST_NOLIMIT;
            }
            if (base.UseAsyncQueue)
            {
                bassencode |= BASSEncode.BASS_ENCODE_QUEUE;
            }
            if (this._wavBitsPerSample > 16 || base.ChannelSampleRate > 48000 || base.ChannelNumChans > 2)
            {
                bassencode |= BASSEncode.BASS_ENCODE_WFEXT;
            }
            base.EncoderHandle = BassEnc.BASS_Encode_Start(num, base.OutputFile, bassencode, null, IntPtr.Zero);
            if (base.TAGs != null && !this._wavUseAIFF)
            {
                if (this.BWF_AddBEXT)
                {
                    byte[] array = base.TAGs.ConvertToRiffBEXT(true);
                    if (array != null && array.Length != 0)
                    {
                        BassEnc.BASS_Encode_AddChunk(base.EncoderHandle, "bext", array, array.Length);
                    }
                }
                if (this.BWF_AddCART)
                {
                    byte[] array2 = base.TAGs.ConvertToRiffCART(true);
                    if (array2 != null && array2.Length != 0)
                    {
                        BassEnc.BASS_Encode_AddChunk(base.EncoderHandle, "cart", array2, array2.Length);
                    }
                }
                if (this.WAV_AddRiffInfo)
                {
                    byte[] array3 = base.TAGs.ConvertToRiffINFO(false);
                    if (array3 != null && array3.Length != 0)
                    {
                        BassEnc.BASS_Encode_AddChunk(base.EncoderHandle, "LIST", array3, array3.Length);
                    }
                }
            }
            if (base.TAGs != null && !this._wavUseAIFF)
            {
                BassEnc.BASS_Encode_SetPaused(base.EncoderHandle, paused);
            }
            if (base.InputFile != null)
            {
                Utils.DecodeAllData(num, true);
            }
            return(base.EncoderHandle != 0);
        }