예제 #1
0
 public static int BASS_WMA_EncodeOpenPublishMulti(int freq, int chans, BASSWMAEncode flags, int[] bitrates, string url, string user, string pass)
 {
     flags |= BASSWMAEncode.BASS_UNICODE;
     return(BassWma.BASS_WMA_EncodeOpenPublishMultiUnicode(freq, chans, flags, bitrates, url, user, pass));
 }
예제 #2
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);
        }
예제 #3
0
 public static extern int BASS_WMA_EncodeOpenNetworkMulti(int freq, int chans, BASSWMAEncode flags, int[] bitrates, int port, int clients);
예제 #4
0
 private static extern int BASS_WMA_EncodeOpenPublishMultiUnicode(int freq, int chans, BASSWMAEncode flags, int[] bitrates, [MarshalAs(UnmanagedType.LPWStr)][In] string url, [MarshalAs(UnmanagedType.LPWStr)][In] string user, [MarshalAs(UnmanagedType.LPWStr)][In] string pass);
예제 #5
0
 public static int BASS_WMA_EncodeOpenFile(int freq, int chans, BASSWMAEncode flags, int bitrate, string file)
 {
     flags |= BASSWMAEncode.BASS_UNICODE;
     return(BassWma.BASS_WMA_EncodeOpenFileUnicode(freq, chans, flags, bitrate, file));
 }
예제 #6
0
 private static extern int BASS_WMA_EncodeOpenFileUnicode(int freq, int chans, BASSWMAEncode flags, int bitrate, [MarshalAs(UnmanagedType.LPWStr)][In] string file);
예제 #7
0
 public static extern int BASS_WMA_EncodeOpen(int freq, int chans, BASSWMAEncode flags, int bitrate, WMENCODEPROC proc, IntPtr user);
예제 #8
0
 public static int[] BASS_WMA_EncodeGetRates(int freq, int chans, BASSWMAEncode flags)
 {
     return(Utils.IntPtrToArrayNullTermInt32(BassWma.BASS_WMA_EncodeGetRatesPtr(freq, chans, flags)));
 }
예제 #9
0
 private static extern IntPtr BASS_WMA_EncodeGetRatesPtr(int freq, int chans, BASSWMAEncode flags);