Пример #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            txtAbout.Rtf = @"{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Calibri;}}
\viewkind4\uc1\pard\sa200\sl240\slmult1\lang11\b\f0\fs20 Modplay\b0  powered by\par
\pard\sa200\sl240\slmult1\tx1704 The Mod Archive\tab https://modarchive.org/\line BASS \tab https://www.un4seen.com/\line ZXTUNE \tab https://zxtune.bitbucket.io/\line BASSZXTUNE \tab https://sourceforge.net/projects/basszxtune/\par
Source available: \tab https://github.com/wex/modplay\par
}";

            try
            {
                favorites.Clear();

                foreach (String t in File.ReadAllLines(@"favorites.txt"))
                {
                    favorites.Add(t);
                }
            } catch (Exception) {}

            if (!Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_LATENCY, this.Handle))
            {
                MessageBox.Show("Initializing audio buffer failed!");
                Application.Exit();
            }

            Bass.BASS_PluginLoad("basszxtune.dll");

            SetVolume(trackVolume.Maximum, trackVolume.Maximum);

            rand = new Random();

            _updateTimer       = new BASSTimer(100);
            _updateTimer.Tick += new EventHandler(timerUpdate_Tick);
        }
        /// <summary>
        ///     Initializes a new instance of the TrackDetails class.
        /// </summary>
        public PlayerDetails()
        {
            InitializeComponent();

            Timer = new BASSTimer(100)
            {
                Interval = 100
            };

            Load += TrackDetails_Load;
            KryptonManager.GlobalPaletteChanged += KryptonManager_GlobalPaletteChanged;

            slider.Slid    += Slider_Slid;
            btnPlay.Click  += btnPlay_Click;
            btnPause.Click += btnPlay_Click;
            Timer.Tick     += Timer_Tick;

            btnPrevious.Click  += btnPrevious_Click;
            btnSkipToEnd.Click += btnSkipToEnd_Click;
            btnNext.Click      += btnNext_Click;
            sldVolume.Scrolled += sldVolume_Slid;
            VisualsShown        = false;
            AlbumArtShown       = true;

            slider.Minimum = 0;
            slider.Maximum = 0;

            SetThemeState();

            _bassVisuals.MaxFFT = BASSData.BASS_DATA_FFT1024;
            _bassVisuals.MaxFrequencySpectrum = Utils.FFTFrequency2Index(16000, 1024, 44100);
        }
Пример #3
0
 public AudioEngine(AudioViewModel vm)
 {
     this.vm = vm;
     Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero);
     _timer       = new BASSTimer(100);
     _timer.Tick += Timer_Tick;
     _timer.Start();
 }
Пример #4
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="TrackWave" /> class.
        /// </summary>
        public TrackWave()
        {
            InitializeComponent();

            // create a secure timer
            _timer       = new BASSTimer(50);
            _timer.Tick += timer_Tick;

            Mode = TrackWaveMode.Shuffler;
        }
Пример #5
0
        public void Open(string path)
        {
            _timer = new BASSTimer(Interval);
            Bass.BASS_StreamFree(_channel);
            _channel  = Bass.BASS_StreamCreateFile(path, 0, 0, BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_STREAM_PRESCAN | BASSFlag.BASS_STREAM_DECODE);
            _channel  = Un4seen.Bass.AddOn.Fx.BassFx.BASS_FX_TempoCreate(_channel, 0);
            _isopened = true;

            if (_channel == 0)
            {
                //throw (new FormatException(Bass.BASS_ErrorGetCode().ToString()));
                _isopened = false;
            }
            Bass.BASS_ChannelGetAttribute(_channel, BASSAttribute.BASS_ATTRIB_FREQ, ref _freq);
        }
    private void Form1_Load(object sender, EventArgs e)
    {
        string file = "..\\..\\mysong.mp3";

        if (Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, Handle))
        {
            _handle = Bass.BASS_StreamCreateFile(file, 0, 0, BASSFlag.BASS_DEFAULT);
            if (Bass.BASS_ChannelPlay(_handle, false))
            {
                _visuals     = new Visuals();
                _timer       = new BASSTimer((int)(1.0d / 10 * 1000));
                _timer.Tick += timer_Tick;
                _timer.Start();
            }
        }
    }
Пример #7
0
        private void OnLoad(object sender, EventArgs e)
        {
            _playListForm = new PlayList(this);

            _specIdx  = Options.MainSettings.PlayerSpectrumIndex;
            _playList = new SortableBindingList <PlayListData>();

            lbTitleText.Text  = "";
            lbArtistText.Text = "";
            lbAlbumText.Text  = "";

            playBackSlider.Enabled = false;

            // create a secure timer
            _updateTimer       = new BASSTimer(_updateInterval);
            _updateTimer.Tick += timerUpdate_Tick;
        }
Пример #8
0
        public AudioEngine(AudioViewModel vm)
        {
            Logger.Instance.WriteLog("Initializing audio engine...");
            this.vm = vm;
            Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero);
            _timer       = new BASSTimer(100);
            _timer.Tick += Timer_Tick;
            _timer.Start();

            if (Bass.BASS_ErrorGetCode() == BASSError.BASS_OK)
            {
                Logger.Instance.WriteLog("Audio engine initialized!");
            }
            else
            {
                Logger.Instance.WriteLog("Audio engine initialized with error! Error code: {0}", LogType.WARNING, Bass.BASS_ErrorGetCode());
            }
        }
Пример #9
0
 public void InitializeSound()
 {
     if (SoundInitialized != true)
     {
         if (Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, Program.playerWindow.Handle))
         {
             BassTimer        = new BASSTimer(500);
             BassTimer.Tick  += new EventHandler(BassTimer_Tick);
             SoundInitialized = true;
             TagInfo          = new TAG_INFO();
         }
         else
         {
             SoundInitialized = false;
             BASSError err = Bass.BASS_ErrorGetCode();
             throw new Exception("Cannot init bass: " + err.ToString());
         }
     }
 }
Пример #10
0
        public DisplayVM()
        {
            if (!Utility.IsDesignMode())
            {
                AudioControllerService.Current.StatusChanged        += Instance_StatusChanged;
                AudioControllerService.Current.StreamCreated        += Instance_StreamCreated;
                AudioControllerService.Current.MetaUpdated          += Instance_MetaUpdated;
                TracklistProvider.Instance.IndexChanged             += Instance_IndexChanged;
                TracklistProvider.Instance.Tracks.CollectionChanged += Tracks_CollectionChanged;

                Reload();

                BASSTimer timer = new BASSTimer();
                timer.Tick    += _timer_Tick;
                timer.Interval = TIMER_MS_INTERVAL;
                //timer.Interval = new TimeSpan(0, 0, 0, 0, TIMER_MS_INTERVAL);
                timer.Start();

                CurrentSpectrumDisplay = WpfControlLibraryBass.Elements.SpectrumAnalyzer.DISPLAY.SPECTRUM_LINE;
            }
        }
 public Status SetTimer(int updateInterval, EventHandler e)
 {
     _updateTimer       = new BASSTimer(updateInterval);
     _updateTimer.Tick += e;
     return(Status.OK);
 }
Пример #12
0
 public AudioControllerService()
 {
     timer       = new BASSTimer(TIMER_MS_INTERVAL);
     timer.Tick += Timer_Tick;
     timer.Start();
 }