private void FileFailed(string file, Exception exception)
        {
            var soundFile = SoundFiles.First(x => x.FullName == file);

            soundFile.ThrownException = exception.ToString();
            soundFile.Status          = Status.Failed;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes this instance.
        /// </summary>
        public static void Initialize()
        {
            if (Base.Initialized)
            {
                return;
            }

            // Sentry.Initialize();
            XorShift.Initialize();

            ScFiles.Initialize();
            CsvFiles.Initialize();
            SoundFiles.Initialize();
            Fingerprint.Initialize();
            Home.Initialize();

            Globals.Initialize();
            ClientGlobals.Initialize();

            MessageFactory.Initialize();
            IpRequester.Initialize();

            Tests.Initialize();

            Base.Initialized = true;;
        }
 public void Remove(SoundFileViewModel soundFileViewModel)
 {
     if (soundFileViewModel != null)
     {
         AudioFileManager.CloseFile(soundFileViewModel.FullName);
         SoundFiles.Remove(soundFileViewModel);
     }
 }
Ejemplo n.º 4
0
 public void PlaySoundFromFile(SoundFiles file, bool loop = false)
 {
     this.currentSource = file;
     this.player.Pause();
     this.player.IsLoopingEnabled = loop;
     this.player.Source           = MediaSource.CreateFromUri(new Uri($"ms-appx:///Assets/{this.currentSource.ToString()}.mp3",
                                                                      UriKind.RelativeOrAbsolute));
     this.player.Play();
 }
Ejemplo n.º 5
0
        public async Task SynthesizeTextAsync(string text)
        {
            // Create a stream from the text. This will be played using a media element.
            this.currentSource = SoundFiles.Default;
            var audio = await this.synthesizer.SynthesizeTextToStreamAsync(text);

            this.player.Source = MediaSource.CreateFromStream(audio, audio.ContentType);
            this.player.Play();
        }
Ejemplo n.º 6
0
 private void playRandomSound()
 {
     if (SoundFiles != null && SoundFiles.Any())
     {
         int index = random.Next(SoundFiles.Count);
         PlaySoundComboBox.SelectedIndex = index;
         string filename = SoundFiles[index];
         playSound(filename); //"Cow_Moo-Mike_Koenig-42670858.mp3");
     }
 }
Ejemplo n.º 7
0
 public void ChangeMediaSource(SoundFiles file)
 {
     if (this.currentSource != file)
     {
         this.currentSource = file;
         this.player.Pause();
         this.player.Source = MediaSource.CreateFromUri(new Uri($"ms-appx:///Assets/{this.currentSource.ToString()}.mp3",
                                                                UriKind.RelativeOrAbsolute));
     }
 }
        public async void Start()
        {
            foreach (var file in SoundFiles)
            {
                file.ThrownException = null;
                if (file.IsSelected)
                {
                    file.Status = Status.Pending;
                }
                else
                {
                    file.Status = Status.Skipped;
                }
            }

            IsRunning = true;
            var overmodulatedFiles = await AudioFileManager.CheckForOvermodulation(
                ProgressChanged,
                BaseVolume,
                SoundFiles.Where(x => x.IsSelected).Select(x => x.FullName),
                SoundFiles.Where(x => x.IsSelectedBaseVolumeFile).Select(x => x.FullName)
                );

            foreach (var file in overmodulatedFiles)
            {
                var soundFile = SoundFiles.First(x => x.FullName == file);
                if (soundFile != null)
                {
                    soundFile.Status     = Status.Warning;
                    soundFile.IsSelected = false;
                }
            }

            await AudioFileManager.AdjustFiles(
                ProgressChanged,
                BaseVolume,
                SoundFiles.Where(x => x.IsSelected).Select(x => x.FullName),
                SoundFiles.Where(x => x.IsSelectedBaseVolumeFile).Select(x => x.FullName),
                FindFileOutputPath,
                FileSucceeded,
                FileFailed);

            IsRunning = false;

            foreach (var file in SoundFiles)
            {
                file.IsSelected = false;
                file.IsSelectedBaseVolumeFile = false;
            }
        }
Ejemplo n.º 9
0
        public static bool PlayCached(string soundFile, int volume = 100)
        {
            var success  = true;
            var fileName = Regex.Replace(soundFile, @"[\\/]+", "\\", SharedRegEx.DefaultOptions);

            try
            {
                CachedSound value;
                if (!SoundFiles.TryGetValue(fileName, out value))
                {
                    value = TryGetSetSoundFile(fileName, volume);
                }
                AudioPlaybackEngine.Instance.PlaySound(value, volume);
            }
            catch (Exception ex)
            {
                Logging.Log(Logger, new LogItem(ex, true));
                success = false;
            }
            return(success);
        }
Ejemplo n.º 10
0
        public AlarmManagerMain(BasicDBServer svr)
        {
            m_svr = svr;
            InitializeComponent();
            SoundFiles s = new SoundFiles(svr);
            this.tabPageSounds.Controls.Add(s);
            s.Dock = DockStyle.Fill;

            AlarmDataSet ds = AlarmDataSet.CreateInstance(svr);
            AlarmSetup s1 = new AlarmSetup(ds);
            this.tabPageSetup.Controls.Add(s1);
            s1.Dock = DockStyle.Fill;

            AlarmQueue q = new AlarmQueue(ds);
            this.tabPageAlarms.Controls.Add(q);
            q.Dock = DockStyle.Fill;

            AlarmDefinition def = new AlarmDefinition(ds);
            this.tabPageAlarmDef.Controls.Add(def);
            def.Dock = DockStyle.Fill;
        }
        public void Drop(IDropInfo dropInfo)
        {
            var files = dropDataToFileList(dropInfo);

            if (!IsRunning && files.Count > 0)
            {
                var fileViewModels = files
                                     .Select(file => Path.GetFullPath(file))
                                     .Where(fullName => !SoundFiles.Any(x => x.FullName.Equals(fullName, StringComparison.OrdinalIgnoreCase)))
                                     .Select(fullName => new SoundFileViewModel(fullName))
                                     .ToList();
                foreach (var fileViewModel in fileViewModels)
                {
                    fileViewModel.IsSelected = true;
                    fileViewModel.IsSelectedBaseVolumeFile = true;
                    if (AudioFileManager.OpenFile(fileViewModel.FullName))
                    {
                        SoundFiles.Add(fileViewModel);
                    }
                }
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Selects the specified sound.
        /// </summary>
        /// <param name="Args">The arguments.</param>
        internal static void Select(params string[] Args)
        {
            if (Args.Length < 3)
            {
                Console.WriteLine("[*] Missing arguments, please use a valid command.");
            }

            SoundHandler.SoundFile = SoundFiles.GetEffectFile(Args[2]);

            if (SoundHandler.SoundFile == null)
            {
                SoundHandler.SoundFile = SoundFiles.GetMusicFile(Args[2]);
            }

            if (SoundHandler.SoundFile != null)
            {
                Console.WriteLine("[*] Selected the specified sound.");
            }
            else
            {
                Console.WriteLine("[*] Invalid arguments, please select an existing sound.");
            }
        }
Ejemplo n.º 13
0
		public Assets()
		{
			Sounds = new SoundFiles(this);
		}
Ejemplo n.º 14
0
		public Assets()
		{
			Sounds = new SoundFiles(this);
			Music = new MusicFiles(this);
		}
 private string FindFileOutputPath(string file)
 {
     return(SoundFiles.First(x => x.FullName == file).OutputFullName);
 }
Ejemplo n.º 16
0
 public Assets()
 {
     Sounds = new SoundFiles(this);
     Music  = new MusicFiles(this);
 }
 private void FileSucceeded(string file)
 {
     SoundFiles.First(x => x.FullName == file).Status = Status.Succeeded;
 }