/// <summary>
        /// Initializes the wrapper.
        /// </summary>
        /// <param name="audioSourceDirectory">The directory of the audio source.</param>
        /// <returns>True if successful.</returns>
        public bool Initialize(string audioSourceDirectory)
        {
            try
            {
                _logger = AudioBandLogManager.GetLogger($"AudioSourceWrapper({new DirectoryInfo(audioSourceDirectory).Name})");
                _logger.Debug("Initializing wrapper");

                AppDomain.CurrentDomain.UnhandledException += (o, e) => _logger.Error(e.ExceptionObject as Exception, "Unhandled exception in wrapper");

                _audioSource        = AudioSourceLoader.LoadFromDirectory(audioSourceDirectory);
                _audioSource.Logger = new AudioSourceLogger(_audioSource.Name);

                _audioSource.SettingChanged       += (o, e) => SettingChanged?.Invoke(this, e);
                _audioSource.TrackInfoChanged     += (o, e) => TrackInfoChanged?.Invoke(this, e);
                _audioSource.IsPlayingChanged     += (o, e) => IsPlayingChanged?.Invoke(this, e);
                _audioSource.TrackProgressChanged += (o, e) => TrackProgressChanged?.Invoke(this, e);
                _audioSource.VolumeChanged        += (o, e) => VolumeChanged?.Invoke(this, e);
                _audioSource.ShuffleChanged       += (o, e) => ShuffleChanged?.Invoke(this, e);
                _audioSource.RepeatModeChanged    += (o, e) => RepeatModeChanged?.Invoke(this, e);

                _audioSourceSettingsList = _audioSource.GetSettings();
                foreach (AudioSourceSetting setting in _audioSourceSettingsList)
                {
                    _audioSourceSettings.Add(setting.Attribute.Name, setting);
                }

                _logger.Debug("Wrapper initialization complete");
                return(true);
            }
            catch (Exception e)
            {
                _logger.Error(e);
                return(false);
            }
        }
Beispiel #2
0
        private void OnShufflePropertyChanged(object sender, ShuffleChangedEventArgs e)
        {
            Unsubscribe(e.OldShuffleSongs);
            Subscribe(e.NewShuffleSongs);

            ShuffleChanged?.Invoke(this, new SubscriptionsEventArgs <ISongCollection, ShuffleChangedEventArgs>(sender, e));
        }
Beispiel #3
0
    protected override void OnShuffleChanged(ShuffleChanged e)
    {
        base.OnShuffleChanged(e);

        Image img = m_shuffleBtn.transform.Find("Icon").GetComponent <Image>();

        img.sprite = m_shuffleSprites[(int)e.State];
    }
Beispiel #4
0
    protected override void OnShuffleChanged(ShuffleChanged e)
    {
        base.OnShuffleChanged(e);

        if (m_shuffleBtn != null && m_shuffleSprites != null)
        {
            SetSprite((int)e.State,
                      m_shuffleSprites,
                      m_shuffleBtn.transform.Find("Icon").GetComponent <Image>(),
                      "Missing sprite icons for Shuffle! Make sure you have the same amount of sprites as Repeat States (Check the enum!)");
        }
    }
Beispiel #5
0
        private void NotifyShuffle()
        {
            bool shuffle = _itunesControls.Shuffle;

            if (shuffle == _shuffle)
            {
                return;
            }

            _shuffle = shuffle;
            ShuffleChanged?.Invoke(this, _shuffle);
        }
Beispiel #6
0
        private void NotifyShuffle()
        {
            bool shuffle = _ipc.GetShuffle();

            if (shuffle == _shuffle)
            {
                return;
            }

            _shuffle = shuffle;
            ShuffleChanged?.Invoke(this, _shuffle);
        }
Beispiel #7
0
 public void ProcShuffleChanged(bool value)
 {
     ShuffleChanged?.InvokeOnMainThread(this, value);
 }
Beispiel #8
0
 protected virtual void OnShuffleChanged()
 {
     ShuffleChanged?.Invoke(this, EventArgs.Empty);
 }
 protected virtual void OnShuffleChanged(ShuffleChanged e)
 {
 }