Exemple #1
0
        private void button1_Copy_Click(object sender, RoutedEventArgs e)
        {
            if (listView.SelectedItem == null)
            {
                return;
            }

            var answer = MessageBox.Show("Czy na pewno chcesz usunąć dźwikęk bazowy.\nMogą od niego zależeć sekwencje i badania.", "Usuwanie dźwięku bazowego", MessageBoxButton.YesNo);

            if (answer == MessageBoxResult.Yes)
            {
                List <Sound> selectedSoundsCopy = new List <Sound>();
                foreach (var selectedSound in listView.SelectedItems)
                {
                    selectedSoundsCopy.Add(selectedSound as Sound);
                }

                foreach (var selectedSound in selectedSoundsCopy)
                {
                    var sound = selectedSound;

                    SoundRepositorySingleton.Instance.Remove(sound);
                    SoundRepositorySingleton.Instance.Flush();

                    AvailableSounds.Remove(sound);
                }
            }
        }
        public void PlaySoundOnce(AvailableSounds sound)
        {
            Sound s = getSound(sound);

            if (!s.wasPlayed)
            {
                s.PlaySoundOnce();
            }
        }
Exemple #3
0
        private void BaseSoundsDefinition_Loaded(object sender, RoutedEventArgs e)
        {
            SoundsCount = 1;
            var sounds = SoundRepositorySingleton.Instance.FindAll().ToList();

            AvailableSounds.Clear();
            sounds.ForEach(x => AvailableSounds.Add(x));

            LoadAllFrequences();
        }
Exemple #4
0
        private void Option_Loaded(object sender, RoutedEventArgs e)
        {
            var sounds = SoundRepositorySingleton.Instance.FindAll().ToList();

            sounds.ForEach(x => AvailableSounds.Add(x));

            LoadSequences();

            LoadAllFrequences();
        }
Exemple #5
0
 public static SoundEffect Get(AvailableSounds sound)
 {
     if (ContentHolder.IsInitialized)
     {
         return(ContentHolder.Sounds[sound]);
     }
     else
     {
         throw new Exception("You forgot to initialize the ContentManager");
     }
 }
Exemple #6
0
        private async void Setup()
        {
            ConfigurationSettings = await ConfigurationServices.GetConfig();

            foreach (string sound in await SoundsServices.GetAvailableSounds())
            {
                AvailableSounds.Add(sound);
            }

            SelectedSound = ConfigurationSettings.SoundConfig.SoundName;
        }
        public Sound(SoundEffect sound, AvailableSounds type, int secondsInterval)
        {
            this.sound     = sound;
            this.type      = type;
            this.wasPlayed = false;
            this.interval  = secondsInterval * 1000;

            timer          = new Timer();
            timer.Elapsed += new ElapsedEventHandler(timer_Elapsed);
            timer.Interval = interval;
        }
Exemple #8
0
        private async void LoadCustomSoundExecuted()
        {
            await SoundsServices.ImportCustomSound();

            foreach (string sound in await SoundsServices.GetAvailableSounds())
            {
                if (!AvailableSounds.Contains(sound))
                {
                    AvailableSounds.Add(sound);
                }
            }
        }
        Sound getSound(AvailableSounds s)
        {
            foreach (Sound sound in sounds)
            {
                if (sound.type == s)
                {
                    return(sound);
                }
            }

            throw new Exception("SOUND IS NOT AVAILABLE");
        }
Exemple #10
0
        //remove sound from list general
        private void button1_Copy_Click(object sender, RoutedEventArgs e)
        {
            if (listView.SelectedItem == null)
            {
                return;
            }

            var sound = listView.SelectedItem as Sound;

            SoundRepositorySingleton.Instance.Remove(sound);
            SoundRepositorySingleton.Instance.Flush();

            AvailableSounds.Remove(sound);
        }
Exemple #11
0
        private void AddSound(string nameOfSound, double freq, double vol)
        {
            Sound  sound     = null;
            double frequency = freq;
            double volume    = vol;
            string name      = nameOfSound;

            sound = new Sound()
            {
                Frequency = frequency,
                Volume    = volume,
                Name      = name
            };

            SoundRepositorySingleton.Instance.Save(sound);
            SoundRepositorySingleton.Instance.Flush();

            AvailableSounds.Add(sound);
        }
Exemple #12
0
 public static SoundEffect Get(AvailableSounds sound) => ContentHolder.Sounds[sound];
 /// <summary>
 /// Method handing out references to the MediaPlayer of the required sound
 /// </summary>
 /// <param name="sound">Key of AvailableSounds Enum</param>
 /// <returns>MediaPlayer reference for sound</returns>
 public MediaPlayer getSound(AvailableSounds sound)
 {
     sounds[sound].Stop();
     return(sounds[sound]);
 }
Exemple #14
0
 public static void Play(AvailableSounds sound, float volume = 1.0f, float pitch = 0f, float pan = 0f)
 {
     Utilities.Try(() => ContentHolder.Get(sound).Play(volume, pitch, pan));
 }