예제 #1
0
        protected override ICEcast GetStreamClass(int handle, out string msg)
        {
            string mountpoint, name, desc, genre;
            double rate;
            int    irate;

            this.FPinInMountPoint.GetString(0, out mountpoint);
            this.FPinInGenre.GetString(0, out genre);
            this.FPinInDesc.GetString(0, out desc);
            this.FPinInName.GetString(0, out name);
            this.FPinInBitrate.GetValue(0, out rate);
            irate = Convert.ToInt32(rate);

            EncoderOGG ogg = new EncoderOGG(handle);

            ogg.InputFile             = null;
            ogg.OutputFile            = null;
            ogg.EncoderDirectory      = AppDomain.CurrentDomain.BaseDirectory + "\\bin";
            ogg.OGG_UseQualityMode    = false;
            ogg.OGG_Bitrate           = irate;
            ogg.OGG_MinBitrate        = irate;
            ogg.OGG_MaxBitrate        = irate;
            ogg.OGG_UseManagedBitrate = true;
            ogg.Start(null, IntPtr.Zero, true);
            ogg.Pause(false);


            string server, pwd;
            double port;

            this.FPinInServer.GetString(0, out server);
            this.FPinInPort.GetValue(0, out port);
            this.FPinInPwd.GetString(0, out pwd);

            ICEcast ice = new ICEcast(ogg, true);

            ice.MountPoint = mountpoint;

            ice.StreamName        = name;
            ice.StreamDescription = desc;
            ice.StreamGenre       = genre;

            ice.Password      = pwd;
            ice.ServerAddress = server;
            ice.ServerPort    = Convert.ToInt32(port);
            ice.SongTitle     = "Vux Test";
            ice.Username      = "******";


            msg = "OK";
            return(ice);
        }
예제 #2
0
        private void buttonStart_Click(object sender, System.EventArgs e)
        {
            asio = new BassAsioHandler(true, 0, 0, 2, BASSASIOFormat.BASS_ASIO_FORMAT_16BIT, 44100);

            // set a mirror on output channel 0 (for monitoring)
            asio.SetMirror(0);
            this.checkBoxMonitor.Checked = true;

            // start ASIO (actually starts recording/playing)
            BASS_ASIO_INFO info = BassAsio.BASS_ASIO_GetInfo();
            bool           ok   = asio.Start(info.bufmax);

            if (!ok)
            {
                MessageBox.Show("Could not start ASIO : " + BassAsio.BASS_ASIO_ErrorGetCode().ToString());
            }

            // now setup the encoder on the provided asio bass channel (which will be created by the above SetFullDuplex call)
            if (radioButtonLAME.Checked)
            {
                lame              = new EncoderLAME(asio.InputChannel);
                lame.InputFile    = null;               //STDIN
                lame.OutputFile   = "test.mp3";
                lame.LAME_Bitrate = (int)EncoderLAME.BITRATE.kbps_128;
                lame.LAME_Mode    = EncoderLAME.LAMEMode.Default;
                lame.LAME_Quality = EncoderLAME.LAMEQuality.Quality;
                lame.Start(null, IntPtr.Zero, false);
                enc = lame;
            }
            else if (radioButtonOGG.Checked)
            {
                ogg                    = new EncoderOGG(asio.InputChannel);
                ogg.InputFile          = null;          //STDIN
                ogg.OutputFile         = "test.ogg";
                ogg.OGG_UseQualityMode = true;
                ogg.OGG_Quality        = 4.0f;
                ogg.Start(null, IntPtr.Zero, false);
                enc = ogg;
            }
            else if (radioButtonAAC.Checked)
            {
                aac              = new EncoderNeroAAC(asio.InputChannel);
                aac.InputFile    = null;                //STDIN
                aac.OutputFile   = "test.mp4";
                aac.NERO_Bitrate = 64;
                aac.Start(null, IntPtr.Zero, false);
                enc = aac;
            }
            else if (radioButtonWAVE.Checked)
            {
                // writing 16-bit wave file here (even if we use a float asio channel)
                wav            = new EncoderWAV(asio.InputChannel);
                wav.InputFile  = null;                 // STDIN
                wav.OutputFile = "test.wav";
                wav.Start(null, IntPtr.Zero, false);
                enc = wav;
            }

            this.buttonStart.Enabled = false;

            // display the level
            plm               = new DSP_PeakLevelMeter(asio.InputChannel, 0);
            plm.UpdateTime    = 0.1f;          // 100ms
            plm.Notification += new EventHandler(plm_Notification);
        }