Exemplo n.º 1
0
 public void CleanUp()
 {
     this.DeInit(this.fmodSystem);
     this.Bands.Clear();
     this.fmodSystem  = null;
     this.smpSettings = null;
 }
Exemplo n.º 2
0
        public static Equalizer GetEqualizer(FMOD.System system, SMPSettings settings)
        {
            var eq = new Equalizer(system, settings);

            eq.Init(system);
            return(eq);
        }
Exemplo n.º 3
0
 private Equalizer(FMOD.System system, SMPSettings settings) {
   this.smpSettings = settings;
   this.Name = "DefaultEqualizer";
   this.fmodSystem = system;
   this.Bands = new ObservableCollection<EqualizerBand>();
   this.isEnabled = settings.PlayerSettings.EqualizerSettings == null || settings.PlayerSettings.EqualizerSettings.IsEnabled;
 }
Exemplo n.º 4
0
 private Equalizer(FMOD.System system, SMPSettings settings)
 {
     this.smpSettings = settings;
     this.Name        = "DefaultEqualizer";
     this.fmodSystem  = system;
     this.Bands       = new ObservableCollection <EqualizerBand>();
     this.isEnabled   = settings.PlayerSettings.EqualizerSettings == null || settings.PlayerSettings.EqualizerSettings.IsEnabled;
 }
 public MainWindowViewModel(Dispatcher dispatcher)
 {
     this.smpSettings = this.ReadSettings();
       this.PlayerEngine.Configure(dispatcher, this.smpSettings);
       this.PlaylistsViewModel = new PlaylistsViewModel(dispatcher, this.smpSettings);
       this.PlayControlViewModel = new PlayControlViewModel(dispatcher, this.smpSettings, this.PlaylistsViewModel);
       this.PlayInfoViewModel = new PlayInfoViewModel(dispatcher);
       this.MedialibViewModel = new MedialibViewModel(dispatcher);
 }
Exemplo n.º 6
0
 public void CleanUp()
 {
     /*
      *  Shut down
      */
     this.timer.Stop();
     this.CleanUpSound(ref this.sound);
     this.CleanUpEqualizer();
     this.CleanUpSystem(ref this.system);
     this.smpSettings = null;
 }
 public MainWindowViewModel(Dispatcher dispatcher) {
   this.smpSettings = this.ReadSettings();
   this.CustomWindowPlacementSettings = new CustomWindowPlacementSettings(this.smpSettings.MainSettings);
   this.PlayerEngine.Configure(dispatcher, this.smpSettings);
   this.MedialibViewModel = new MedialibViewModel(dispatcher, this.smpSettings);
   this.PlaylistsViewModel = new PlaylistsViewModel(dispatcher, this.smpSettings);
   this.MainViewModel = new MainViewModel(dispatcher) {
     PlayControlViewModel = new PlayControlViewModel(dispatcher, this.smpSettings, this.PlaylistsViewModel, this.MedialibViewModel),
     PlayInfoViewModel = new PlayInfoViewModel(dispatcher)
   };
 }
Exemplo n.º 8
0
        public bool Configure(Dispatcher dispatcher, SMPSettings settings)
        {
            this.smpSettings = settings;

            /*
             *  Global Settings
             */
            var result = FMOD.Factory.System_Create(ref this.system);

            if (!result.ERRCHECK())
            {
                return(false);
            }

            uint version = 0;

            result = this.system.getVersion(ref version);
            result.ERRCHECK();
            if (version < FMOD.VERSION.number)
            {
                //MessageBox.Show("Error!  You are using an old version of FMOD " + version.ToString("X") + ".  This program requires " + FMOD.VERSION.number.ToString("X") + ".");
                //Application.Exit();
                return(false);
            }

            result = this.system.init(1, FMOD.INITFLAGS.NORMAL, (IntPtr)null);
            if (!result.ERRCHECK())
            {
                return(false);
            }

            result = this.system.setStreamBufferSize(64 * 1024, FMOD.TIMEUNIT.RAWBYTES);
            if (!result.ERRCHECK())
            {
                return(false);
            }

            // equalizer
            this.Equalizer = Equalizer.GetEqualizer(this.system, settings);

            this.Volume   = this.smpSettings.PlayerSettings.Volume;
            this.IsMute   = this.smpSettings.PlayerSettings.Mute;
            this.State    = PlayerState.Stop;
            this.LengthMs = 0;

            this.timer = new DispatcherTimer(TimeSpan.FromMilliseconds(10), DispatcherPriority.Normal, this.PlayTimerCallback, dispatcher);
            this.timer.Stop();

            this.Initializied = true;
            return(this.Initializied);
        }
Exemplo n.º 9
0
    public bool Configure(Dispatcher dispatcher, SMPSettings settings) {
      this.smpSettings = settings;
      /*
          Global Settings
      */
      var result = FMOD.Factory.System_Create(ref this.system);
      if (!result.ERRCHECK()) {
        return false;
      }

      uint version = 0;
      result = this.system.getVersion(ref version);
      result.ERRCHECK();
      if (version < FMOD.VERSION.number) {
        //MessageBox.Show("Error!  You are using an old version of FMOD " + version.ToString("X") + ".  This program requires " + FMOD.VERSION.number.ToString("X") + ".");
        //Application.Exit();
        return false;
      }

      result = this.system.init(1, FMOD.INITFLAGS.NORMAL, (IntPtr)null);
      if (!result.ERRCHECK()) {
        return false;
      }

      result = this.system.setStreamBufferSize(64*1024, FMOD.TIMEUNIT.RAWBYTES);
      if (!result.ERRCHECK()) {
        return false;
      }

      // equalizer
      this.Equalizer = Equalizer.GetEqualizer(this.system, settings);

      this.Volume = this.smpSettings.PlayerSettings.Volume;
      this.IsMute = this.smpSettings.PlayerSettings.Mute;
      this.State = PlayerState.Stop;
      this.LengthMs = 0;

      this.timer = new DispatcherTimer(TimeSpan.FromMilliseconds(10), DispatcherPriority.Normal, this.PlayTimerCallback, dispatcher);
      this.timer.Stop();

      this.Initializied = true;
      return this.Initializied;
    }
    public PlayControlViewModel(Dispatcher dispatcher, SMPSettings settings, PlaylistsViewModel playlistsViewModel, MedialibViewModel medialibViewModel) {
      this.playlistsViewModel = playlistsViewModel;
      this.medialibViewModel = medialibViewModel;

      this.SMPSettings = settings;

      this.PlayerEngine.PlayNextFileAction = () => {
                                               if (this.SMPSettings.PlayerSettings.RepeatMode) {
                                                 if (this.CanPlayOrPause()) {
                                                   var file = this.playlistsViewModel.GetCurrentPlayListFile();
                                                   if (file != null) {
                                                     this.PlayerEngine.Play(file);
                                                   }
                                                 }
                                               } else {
                                                 if (this.CanPlayNext()) {
                                                   this.PlayNext();
                                                 }
                                               }
                                             };
    }
Exemplo n.º 11
0
 public void CleanUp()
 {
     /*
       Shut down
       */
       this.timer.Stop();
       this.CleanUpSound(ref this.sound);
       this.CleanUpEqualizer();
       this.CleanUpSystem(ref this.system);
       this.smpSettings = null;
 }
Exemplo n.º 12
0
 public void CleanUp()
 {
     this.DeInit(this.fmodSystem);
       this.Bands.Clear();
       this.fmodSystem = null;
       this.smpSettings = null;
 }
Exemplo n.º 13
0
 public static Equalizer GetEqualizer(FMOD.System system, SMPSettings settings)
 {
     var eq = new Equalizer(system, settings);
       eq.Init(system);
       return eq;
 }
Exemplo n.º 14
0
    public PlaylistsViewModel(Dispatcher dispatcher, SMPSettings settings) {
      this.smpSettings = settings;

      this.LoadPlayListAsync();
    }
 public PlaylistsViewModel(Dispatcher dispatcher, SMPSettings settings) {
   this.smpSettings = settings;
   this.SelectedPlayListFiles = new ObservableCollection<IMediaFile>();
 }
Exemplo n.º 16
0
 public MedialibViewModel(Dispatcher dispatcher, SMPSettings settings) {
   this.CustomWindowPlacementSettings = new CustomWindowPlacementSettings(settings.MedialibSettings);
   this.MediaFiles = CollectionViewSource.GetDefaultView(new MedialibObservableCollection(null));
 }
 private void WriteSettings(SMPSettings settings) {
   var settingsAsJson = JsonConvert.SerializeObject(settings, Formatting.Indented);
   File.WriteAllText(SMPSettings.SettingsFile, settingsAsJson);
 }