예제 #1
0
 public virtual bool Pause(bool paused)
 {
     return(this.EncoderHandle != 0 && BassEnc.BASS_Encode_SetPaused(this.EncoderHandle, paused));
 }
예제 #2
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);
        }