Example #1
0
 public ActionResult Form(Audios model)
 {
     ViewBag.Colecoes = db.ColecoesAudios.Where(col => !col.Excluido && col.Liberado).OrderBy(col => col.Titulo).Select(colecao => new SelectListItem {
         Text = colecao.Titulo, Value = colecao.Id.ToString()
     }).ToList();
     return(PartialView("_Form", model));
 }
Example #2
0
        public ActionResult GetAudioDetail()
        {
            var               stream            = HttpContext.Request.InputStream;
            string            requestJson       = new StreamReader(stream).ReadToEnd(); //json 字符串在此
            JObject           jo                = (JObject)JsonConvert.DeserializeObject(requestJson);
            int               audioId           = Convert.ToInt32(jo["audioId"].ToString());
            Audios            audio             = db.Audios.Where(item => item.Id == audioId).FirstOrDefault();
            AudioDetailDetail audioDetailDetail = new AudioDetailDetail();

            audioDetailDetail.Id    = audio.Id;
            audioDetailDetail.Title = audio.Title;
            audioDetailDetail.PicAD = audio.AudioIndex;
            int originalWidth  = 0;
            int originalHeight = 0;

            if (audio.AudioIndex != null)
            {
                audioDetailDetail.PicAD = audio.AudioIndex;
                System.Drawing.Image imgOriginal = System.Drawing.Image.FromFile(Server.MapPath(HttpUtility.UrlDecode(audio.AudioIndex)));
                originalWidth  = imgOriginal.Width;
                originalHeight = imgOriginal.Height;
            }
            else
            {
                audioDetailDetail.PicAD = "";
            }
            audioDetailDetail.PicWidth  = originalWidth;
            audioDetailDetail.PicHeight = originalHeight;
            audioDetailDetail.AudioLink = audio.AudioLink;
            audioDetailDetail.Content   = "/admin/audio/previewaudio/" + audioId;

            return(Json(new { data = audioDetailDetail }));
        }
Example #3
0
        async Task ExecuteLoadAudiosCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Audios.Clear();

                var audios = await AudiosRepository.GetItemsAsync();

                foreach (var audio in audios)
                {
                    Audios.Add(audio);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Example #4
0
    /// <summary>
    /// Called on availability of synthesized data.
    /// </summary>
    /// <param name="sender">The sender.</param>
    /// <param name="e">The <see cref="TranslationSynthesisEventArgs"/> instance containing the event data.</param>
    private void OnSynthesizingEventHandler(object sender, TranslationSynthesisEventArgs e)
    {
        var Clip = e.Result.GetAudio();

        if (Clip.Length > 0)
        {
            Audios.Enqueue(Clip);
            lock (syncRoot)
            {
                isAudioNew = true;
            }
        }



        //var audio = e.Result.GetAudio();
        //if (audio.Length > 0)
        //{
        //    using (var m = new MemoryStream(audio))
        //    {
        //        SoundPlayer simpleSound = new SoundPlayer(m);
        //        simpleSound.Play();
        //    }
        //}
    }
    void Start () {
		audio = GameObject.FindGameObjectWithTag ("audio").GetComponent<AudioSource> ();
		clips = GameObject.FindGameObjectWithTag ("audio").GetComponent<Audios> ();
		levelsToRun = SceneManager.GetActiveScene ().buildIndex;
        rig2d = GetComponent<Rigidbody2D>(); // get the rigidbody2d from gameobject
		anim = GetComponent<Animator>();
	}
        public static void ExecutarAudio(Audios TipoDeAviso)
        {
            switch (TipoDeAviso.ToString())
            {
            case "MP":

                SoundPlayer MP = new SoundPlayer(Properties.Resources.MP);
                MP.Play();
                break;

            case "Ts3":

                SoundPlayer ts = new SoundPlayer(Properties.Resources.Ts3);
                ts.Play();
                break;

            case "Dano":

                SoundPlayer Dano = new SoundPlayer(Properties.Resources.Colisao);
                Dano.Play();

                break;

            case "Conectada":

                SoundPlayer Inicio = new SoundPlayer(Properties.Resources.CarregadoComSucesso);
                Inicio.Play();

                break;

            case "Cancelada":


                SoundPlayer Entregue = new SoundPlayer(Properties.Resources.Cancelada);
                Entregue.Play();

                break;

            case "Entregue":

                SoundPlayer Finalizada = new SoundPlayer(Properties.Resources.CargaEntregue);
                Finalizada.Play();

                break;

            case "Velocidade":

                SoundPlayer Velocidade = new SoundPlayer(Properties.Resources.Camera);
                Velocidade.Play();

                break;

            case "Bip":

                SoundPlayer bip = new SoundPlayer(Properties.Resources.alert);
                bip.Play();

                break;
            }
        }
Example #7
0
        public bool AgregarAudio(string nombreArchivo, string NombreAlbum, string ruta, string nivel, string tipo)
        {
            using (var context = new ccjtvEntities())
            {
                bool guardoAudio;

                try
                {
                    Audios audioNuevo = new Audios();
                    audioNuevo.NombreArchivo = nombreArchivo;
                    audioNuevo.NombreAlbum   = NombreAlbum;
                    audioNuevo.Ruta          = ruta;
                    audioNuevo.Nivel         = nivel;
                    audioNuevo.Tipo          = tipo;

                    context.Audios.Add(audioNuevo);
                    guardoAudio = true;

                    context.SaveChanges();
                }
                catch (Exception)
                {
                    guardoAudio = false;
                }

                return(guardoAudio);
            }
        }
Example #8
0
 private void Awake()
 {
     _instance   = this;
     audioSource = GetComponent <AudioSource>();
     audios      = Resources.Load <Audios>("Audios01");
     DontDestroyOnLoad(this.gameObject);
 }
Example #9
0
 public void Build(Audios items)
 {
     this.items        = items;
     itemsPerRow       = Math.Max(1, ClientSize.Width / itemWidth);
     rowsCount         = 1 + items.Count / itemsPerRow;
     selectedItemIndex = Math.Min(items.Count, selectedItemIndex);
     AutoScrollMinSize = new Size(itemWidth, rowsCount * itemHeight);
 }
Example #10
0
        public static void Play(Audios selected)
        {
            var name = selected == Audios.Beep ? "beep" :
                       selected == Audios.Peep ? "peep" :
                       "plop";

            _audioSource.PlayOneShot(_audios[name]);
        }
Example #11
0
 public void Build(Audios items)
 {
     this.items = items;
     itemsPerRow = Math.Max(1, ClientSize.Width/itemWidth);
     rowsCount = 1 + items.Count/itemsPerRow;
     selectedItemIndex = Math.Min(items.Count, selectedItemIndex);
     AutoScrollMinSize = new Size(itemWidth, rowsCount * itemHeight);
 }
Example #12
0
        public ActionResult GetMeta()
        {
            ShownItems = new Audios(MusicSingltone.Core.GetAudios());

            var audio   = ShownItems.Last();
            var mp3File = new Mp3File(audio.FullPath);

            return(View(mp3File));
        }
Example #13
0
 // Use this for initialization
 void Start()
 {
     bossScript    = GameObject.Find("boss").GetComponent <Boss>();
     spawnerScript = GameObject.Find("Spawner").GetComponent <Spawner>();
     bossObject    = GameObject.Find("boss");
     bossSlot      = GameObject.Find("bossSlot");
     StartCoroutine("power");
     audioScript  = GameObject.Find("Audios").GetComponent <Audios>();
     audioGeneral = GameObject.Find("Audios").GetComponent <AudioSource>();
 }
Example #14
0
        public override void OnNavigatingFrom(NavigatingFromEventArgs e, Dictionary <string, object> viewModelState, bool suspending)
        {
            if (!IsSelectionMode && e.NavigationMode == NavigationMode.New)
            {
                viewModelState[nameof(Audios)]        = JsonConvert.SerializeObject(Audios.ToList());
                viewModelState[nameof(_audiosOffset)] = _audiosOffset;
            }

            base.OnNavigatingFrom(e, viewModelState, suspending);
        }
Example #15
0
 /* 绑定 */
 void Awake()
 {
     instance = this;
     /* 通用 */
     rifleDryFire  = Resources.Load("Audio/Weapon/RifleDryFire") as AudioClip;
     pistolDryFire = Resources.Load("Audio/Weapon/PistolDryFire") as AudioClip;
     blueWin       = Resources.Load("Audio/Playing/BlueWin") as AudioClip;
     redWin        = Resources.Load("Audio/Playing/RedWin") as AudioClip;
     /* AK47 */
     ak47Draw        = Resources.Load("Audio/Weapon/AK47/Draw") as AudioClip;
     ak47ReloadStart = Resources.Load("Audio/Weapon/AK47/ReloadStart") as AudioClip;
     ak47ReloadEnd   = Resources.Load("Audio/Weapon/AK47/ReloadEnd") as AudioClip;
     ak47Shoot       = Resources.Load("Audio/Weapon/AK47/Shoot") as AudioClip;
     /* M4A1 */
     m4a1DrawStart    = Resources.Load("Audio/Weapon/M4A1/DrawStart") as AudioClip;
     m4a1ReloadStart  = Resources.Load("Audio/Weapon/M4A1/ReloadStart") as AudioClip;
     m4a1ReloadMedium = Resources.Load("Audio/Weapon/M4A1/ReloadMedium") as AudioClip;
     m4a1ReloadEnd    = Resources.Load("Audio/Weapon/M4A1/ReloadEnd") as AudioClip; //Also DrawEnd
     m4a1Shoot        = Resources.Load("Audio/Weapon/M4A1/Shoot") as AudioClip;
     /* AWP */
     awpReloadStart = Resources.Load("Audio/Weapon/AWP/ReloadStart") as AudioClip;
     awpReloadEnd   = Resources.Load("Audio/Weapon/AWP/ReloadEnd") as AudioClip;
     awpShoot       = Resources.Load("Audio/Weapon/AWP/Shoot") as AudioClip;
     awpZoom        = Resources.Load("Audio/Weapon/AWP/Zoom") as AudioClip;
     awpDragLag     = Resources.Load("Audio/Weapon/AWP/DragLag") as AudioClip;
     /* Glock18 */
     glock18Shoot = Resources.Load("Audio/Weapon/Glock18/Shoot") as AudioClip;
     /* USP */
     uspDrawStart    = Resources.Load("Audio/Weapon/USP/DrawStart") as AudioClip;
     uspReloadStart  = Resources.Load("Audio/Weapon/USP/ReloadStart") as AudioClip;
     uspReloadMedium = Resources.Load("Audio/Weapon/USP/ReloadMedium") as AudioClip;
     uspReloadEnd    = Resources.Load("Audio/Weapon/USP/ReloadEnd") as AudioClip;
     uspShoot        = Resources.Load("Audio/Weapon/USP/Shoot") as AudioClip;
     /* Knife */
     knifeDraw        = Resources.Load("Audio/Weapon/Knife/Draw") as AudioClip;
     knifeHit1        = Resources.Load("Audio/Weapon/Knife/Hit1") as AudioClip;
     knifeHit2        = Resources.Load("Audio/Weapon/Knife/Hit2") as AudioClip;
     knifeHitAir      = Resources.Load("Audio/Weapon/Knife/HitAir") as AudioClip;
     knifeHitWall     = Resources.Load("Audio/Weapon/Knife/HitWall") as AudioClip;
     knifeCriticalHit = Resources.Load("Audio/Weapon/Knife/CriticalHit") as AudioClip;
     /* Grenade */
     grenadeBounce  = Resources.Load("Audio/Weapon/Grenade/Bounce") as AudioClip;
     grenadeExplode = Resources.Load("Audio/Weapon/Grenade/Explode") as AudioClip;
     /* Bomb */
     bombBeep1         = Resources.Load("Audio/Weapon/Bomb/Beep1") as AudioClip;
     bombBeep2         = Resources.Load("Audio/Weapon/Bomb/Beep2") as AudioClip;
     bombBeep3         = Resources.Load("Audio/Weapon/Bomb/Beep3") as AudioClip;
     bombBeep4         = Resources.Load("Audio/Weapon/Bomb/Beep4") as AudioClip;
     bombBeep5         = Resources.Load("Audio/Weapon/Bomb/Beep5") as AudioClip;
     bombClick         = Resources.Load("Audio/Weapon/Bomb/Click") as AudioClip;
     bombPlanted       = Resources.Load("Audio/Weapon/Bomb/Planted") as AudioClip;
     bombDisplantStart = Resources.Load("Audio/Weapon/Bomb/DisplantStart") as AudioClip;
     bombDisplantEnd   = Resources.Load("Audio/Weapon/Bomb/DisplantEnd") as AudioClip;
     bombExplode       = Resources.Load("Audio/Weapon/Bomb/Explode") as AudioClip;
 }
Example #16
0
    //public
    /// <summary>
    /// A list containing description of target files
    /// </summary>
    /// <summary>
    /// A list containing description of target folders
    /// </summary>

    /// <summary>
    /// initlaize the two lists (Audio_files,Folders)
    /// </summary>
    ///
    public static void Initlaize(string FileName1, string FileName2)
    {
        //Reading From AudiosInfo ..
        FileStream   fs = new FileStream(FileName1, FileMode.Open);
        StreamReader sr = new StreamReader(fs);
        //Reading the first line in the File which contain the Nember of Audios Files..
        string num_of_records = sr.ReadLine();

        //Converting the string value into int by using TypeCasting..
        for (int i = 0; i < num_of_records.Length; i++)
        {
            if (num_of_records[i] != ' ')
            {
                num_of_rec *= 10;
                num_of_rec += (int)num_of_records[i] - '0';
            }
            else
            {
                break;
            }
        }
        //Makeing Array of string to hold the Data from File to split it..
        string[] records = new string[num_of_rec];
        //Makeing a Temp Variable to hold the Data and push it in the List..
        //Loop to Get the Data and split it..
        for (int i = 0; i < num_of_rec; i++)
        {
            Audios aud = new Audios();
            records  = sr.ReadLine().Split(' ');
            aud.name = records[0];
            string[] temp = records[1].Split(':');
            aud.hours        = int.Parse(temp[0]);
            aud.min          = int.Parse(temp[1]);
            aud.sec          = int.Parse(temp[2]);
            aud.total_in_sec = aud.hours * 3600 + aud.min * 60 + aud.sec;
            aud.index        = i + 1;
            Audio_files.Add(aud);
        }
        //Closing the Folder after Geting the Data..
        sr.Close();
        //Reading from Readme to konw the Max_Size of Folder..
        FileStream   f = new FileStream(FileName2, FileMode.Open);
        StreamReader s = new StreamReader(f);

        s.ReadLine();
        string[] Temp = new string[2];
        string[] size = new string[2];
        Temp = s.ReadLine().Split('=');
        size = Temp[1].Split(' ');
        //Closing the File after Reading from it..
        s.Close();
        ////Converting the string value into int by using TypeCasting..
        max_size = int.Parse(size[1]);
    }
Example #17
0
    public void PlayAudio(AudioType audioType)
    {
        Audios    audios    = GetAudioDataByLang(PersistentData.Instance.lang);
        AudioClip audioClip = null;

        switch (audioType)
        {
        case AudioType.langName:
            audioClip = audios.langName;
            break;

        case AudioType.howmany:
            audioClip = audios.howmany;
            break;

        case AudioType.selectLang:
            audioClip = audios.selectLang;
            break;

        case AudioType.ok:
            audioClip = audios.ok;
            break;

        case AudioType.one:
            audioClip = audios.one;
            break;

        case AudioType.two:
            audioClip = audios.two;
            break;

        case AudioType.three:
            audioClip = audios.three;
            break;

        case AudioType.four:
            audioClip = audios.four;
            break;

        case AudioType.five:
            audioClip = audios.five;
            break;

        case AudioType.six:
            audioClip = audios.six;
            break;
        }
        if (audioClip != null)
        {
            audioSource.clip = audioClip;
            audioSource.Play();
        }
    }
Example #18
0
        public void DisplayItems()
        {
            if (InvokeRequired)
            {
                Invoke((MethodInvoker)(DisplayItems));
                return;
            }

            ShownItems = new Audios(Core.GetAudios());//temp !!!!!

            pnAudios.Build(ShownItems);
            lbItemCount.Text = "Items: " + ShownItems.Count;
            Invalidate(true);
        }
Example #19
0
        protected internal void AddAudio(Speech speech)
        {
            if (speech == null)
            {
                throw new ArgumentNullException(nameof(speech));
            }

            if (Audios.Any(x => x.Id == speech.Id))
            {
                Audios.Remove(Audios.SingleOrDefault(x => x.Id == speech.Id));
            }

            Audios.Add(speech);
        }
Example #20
0
        public void DisplayItems()
        {
            if (InvokeRequired)
            {
                Invoke((MethodInvoker)(DisplayItems));
                return;
            }

            ShownItems = new Audios(Core.GetAudios());//temp !!!!!

            pnAudios.Build(ShownItems);
            lbItemCount.Text = "Items: " + ShownItems.Count;
            Invalidate(true);
        }
Example #21
0
    /// <summary>
    /// 播放聲音檔
    /// </summary>
    /// <param name="audio">要播放的聲音</param>
    /// <param name="volume">音量大小,最小是0, 最大是1</param>
    /// <param name="loop">是否循環播放</param>
    public static void Play(Audios audio, float volume = 1, bool loop = false)
    {
        int index = (int)audio;

        if (sounds == null || index >= sounds.Length)
        {
            return;
        }
        CreateAudioSource();

        source.clip   = sounds[index];
        source.volume = volume;
        source.loop   = loop;
        source.Play();
    }
Example #22
0
        public ActionResult Edit(Audios audio, HttpPostedFileBase audioFile)
        {
            if (audioFile != null)
            {
                var path = Server.MapPath("~/conteudo/audios/" + audio.Id + "/");
                audio.Url = Utils.SaveFileBase(path, audioFile);
            }

            audio.Excluido        = false;
            db.Entry(audio).State = EntityState.Modified;
            db.Entry(audio).Property(a => a.DataCadastro).IsModified = false;
            db.SaveChanges();

            return(RedirectToAction("Index"));
        }
Example #23
0
 public ActionResult CellEdit(int id)
 {
     if (Session["admin"] != null)
     {
         ViewBag.IsCreate = true;
         Audios           audio           = db.Audios.Find(id);
         AudioCollections audioCollection = db.AudioCollections.Find(audio.AudioCollectionId);
         ViewBag.CollectionName = audioCollection.Title;
         ViewBag.Category       = audioCollection.Category;
         return(View("CellEdit", audio));
     }
     else
     {
         return(RedirectToAction("Login", "Console"));
     }
 }
Example #24
0
        public ActionResult GetAudios()
        {
            ShownItems = new Audios(MusicSingltone.Core.GetAudios());//temp !!!!!
            var audios = ShownItems.Select(shownItem => new GetAudiosViewModel()
            {
                Sha1HashDescriptor = (SHA1HashDescriptor)shownItem.Data[0],
                Envelope           = (Envelope)shownItem.Data[1],
                VolumeDescriptor   = (VolumeDescriptor)shownItem.Data[2],
                Tempogram          = (Tempogram)shownItem.Data[3],
                FullPath           = shownItem.FullPath,
                State = shownItem.State,
                Tag   = shownItem.Tag
            }).ToList();

            return(View(audios));
        }
Example #25
0
 public void RunAudio(Audios audio)
 {
     if (audio == Audios.menu ||
         audio == Audios.nivel1 ||
         audio == Audios.nivel2 ||
         audio == Audios.nivel3 ||
         audio == Audios.storyboard1a ||
         audio == Audios.storyboard2a ||
         audio == Audios.storyboard1b ||
         audio == Audios.storyboard2b
         )
     {
         AkSoundEngine.StopAll();
     }
     AkSoundEngine.PostEvent(audio.ToString(), gameObject);
 }
Example #26
0
 public ActionResult CellCreate(int collectionId)
 {
     if (Session["admin"] != null)
     {
         AudioCollections audioCollection = db.AudioCollections.Find(collectionId);
         ViewBag.CollectionName = audioCollection.Title;
         ViewBag.Category       = audioCollection.Category;
         ViewBag.IsCreate       = false;
         Audios audio = new Audios();
         audio.AudioCollectionId = collectionId;
         return(View("CellEdit", audio));
     }
     else
     {
         return(RedirectToAction("Login", "Console"));
     }
 }
Example #27
0
        private void tbSearch_TextChanged(object sender, EventArgs e)
        {
            var Pattern = tbSearch.Text;

            try
            {
                var Parts = Pattern.ToLower().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

                if (Parts.Length == 0)
                {
                    DisplayItems();
                    return;
                }

                ShownItems = new Audios();

                foreach (var Item in Core.GetAudios())
                {
                    bool IsFound   = true;
                    var  AudioName = Item.ShortName.ToLower();
                    foreach (var Part in Parts)
                    {
                        if (!AudioName.Contains(Part))
                        {
                            IsFound = false;
                            break;
                        }
                    }

                    if (IsFound)
                    {
                        ShownItems.Add(Item);
                    }
                }

                pnAudios.Build(ShownItems);
                lbItemCount.Text = "Items: " + ShownItems.Count;
                Invalidate(true);
            }
            catch (Exception E)
            {
                Logger.ErrorException("Files processing exception.", E);

                ShowError(E);
            }
        }
Example #28
0
        /// <summary>
        /// Конструктор по умолчанию.
        /// </summary>
        public AudiosViewModel(string uniqueKey, long ownerID)
            : base(uniqueKey)
        {
            _audios            = new AudiosCollection(ownerID);
            _recommendations   = new RecommendedAudiosCollection((ulong)ownerID);
            _popular           = new PopularAudiosCollection();
            _albums            = new AudioAlbumsCollection(ownerID);
            Refresh            = new RelayCommand(() => Audios.Refresh());
            RefreshAlbums      = new RelayCommand(() => Albums.Refresh());
            RefreshPopular     = new RelayCommand(() => Popular.Refresh());
            RefreshRecommended = new RelayCommand(() => Recommendations.Refresh());
            DeleteCommand      = new RelayCommand <VKAudio>(async audio =>
            {
                var request  = new Request.DeleteAudioRequest(audio.ID, audio.OwnerID);
                var response = await request.ExecuteAsync();

                if (response.Error.ErrorType == VKErrors.None)
                {
                    Audios.Remove(audio);
                }
                else
                {
                    await ServiceHelper.DialogService.ShowMessageBox("Произошла ошибка: " + response.Error.ErrorType.ToString(),
                                                                     "Не удалось удалить аудиозапись.");
                }
            });
            DownloadAudio = new RelayCommand <VKAudio>(async audio =>
            {
                var command = new VKSaverDownloadCommand();
                command.Downloads.Add(CoreHelper.GetDownload(audio));

                await command.TryExecute();
            });

#if DEBUG
            if (ViewModelBase.IsInDesignModeStatic)
            {
                for (int i = 0; i < 71; i++)
                {
                    Audios.Add(DesignDataHelper.GetAudio());
                    Recommendations.Add(DesignDataHelper.GetAudio());
                    Popular.Add(DesignDataHelper.GetAudio());
                }
            }
#endif
        }
Example #29
0
    void Start()
    {
        velocidad     = velocidadInicial;
        spawnerObject = GameObject.Find("Spawner");
        zombieScript  = spawnerObject.GetComponent <Zombie>();
        bigScript     = spawnerObject.GetComponent <Big>();
        crispScript   = spawnerObject.GetComponent <Crisp>();
        bossScript    = spawnerObject.GetComponent <Boss>();
        throwScript   = spawnerObject.GetComponent <Throw>();
        aoeScript     = spawnerObject.GetComponent <Aoe>();

        mouse = GameObject.Find("cursor");

        audioSource  = gameObject.GetComponent <AudioSource>();
        audioScript  = GameObject.Find("Audios").GetComponent <Audios>();
        audioGeneral = GameObject.Find("Audios").GetComponent <AudioSource>();

        vidaSprite  = GameObject.Find("vida");
        bonusSprite = GameObject.Find("bonus");
    }
Example #30
0
        private async Task <IEnumerable <Audio> > LoadMoreAudios(uint page)
        {
            var response = await _inTouchWrapper.ExecuteRequest(_inTouch.Audio.GetPopular(
                                                                    OnlyEng, Genres[SelectedGenresItem].Genre, 50, _audiosOffset));

            if (response.IsError)
            {
                throw new Exception(response.Error.ToString());
            }
            else
            {
                if (!Audios.Any() && response.Data.Any())
                {
                    SetDefaultMode();
                }

                _audiosOffset += 50;
                return(response.Data);
            }
        }
Example #31
0
    /// <summary>
    /// 播放一次聲音檔 (可以在 Play 的聲音還在播放下播)
    /// </summary>
    /// <param name="audio">要播放的聲音</param>
    /// <param name="volume">音量大小,最小是0, 沒有最大值</param>
    public static void PlayOneShot(Audios audio, float volume = 1)
    {
        if (muted)
        {
            return;
        }
        int index = (int)audio;

        if (sounds == null || index >= sounds.Length)
        {
            return;
        }
        CreateAudioSource();

        if (!source.isPlaying)
        {
            source.volume = 1;
        }
        source.PlayOneShot(sounds[(int)audio], volume);
    }
Example #32
0
        public ActionResult Create(Audios audio, HttpPostedFileBase audioFile)
        {
            audio.DataCadastro    = DateTime.Now;
            audio.Excluido        = false;
            db.Entry(audio).State = EntityState.Added;

            db.SaveChanges();


            if (audioFile != null)
            {
                var path = Server.MapPath("~/conteudo/audios/" + audio.Id + "/");
                audio.Url             = Utils.SaveFileBase(path, audioFile);
                db.Entry(audio).State = EntityState.Modified;

                db.SaveChanges();
            }


            return(RedirectToAction("Index"));
        }
Example #33
0
        public ActionResult CargarMediaDePrueba()
        {
            TransactionSingletone.stopTransaction();
            db = new RegistroCivilEntities();
            Videos   video   = db.Videos.Find(1);
            Imagenes imagen1 = db.Imagenes.Find(1);
            Imagenes imagen2 = db.Imagenes.Find(2);
            Audios   audio   = db.Audios.Find(1);

            byte[] videoByte   = System.IO.File.ReadAllBytes(HostingEnvironment.ApplicationPhysicalPath + "\\Resources\\video.mp4");
            byte[] imagen1Byte = System.IO.File.ReadAllBytes(HostingEnvironment.ApplicationPhysicalPath + "\\Resources\\BanderaDefault.jpeg");
            byte[] imagen2Byte = System.IO.File.ReadAllBytes(HostingEnvironment.ApplicationPhysicalPath + "\\Resources\\PersonaDefault.jpeg");
            byte[] audioByte   = System.IO.File.ReadAllBytes(HostingEnvironment.ApplicationPhysicalPath + "\\Resources\\himno.mp3");
            video.descripcion   = "Default Interview";
            video.info_bytes    = videoByte;
            imagen1.descripcion = "Bandera Default Pais";
            imagen1.info_bytes  = imagen1Byte;
            imagen2.descripcion = "Foto de Perfil Default";
            imagen2.info_bytes  = imagen2Byte;
            audio.descripcion   = "Audio Default";
            audio.info_bytes    = audioByte;
            try
            {
                //db.Videos.Attach(video);
                //db.Imagenes.Attach(imagen1);
                //db.Imagenes.Attach(imagen2);
                //db.Audios.Attach(audio);
                db.Entry(video).State   = EntityState.Modified;
                db.Entry(imagen1).State = EntityState.Modified;
                db.Entry(imagen2).State = EntityState.Modified;
                db.Entry(audio).State   = EntityState.Modified;
                db.SaveChanges();
                TransactionSingletone.ResetInstance();
                db = TransactionSingletone.db;
            }
            catch (Exception e) {}
            return(RedirectToAction("Index"));
        }
Example #34
0
        private void tbSearch_TextChanged(object sender, EventArgs e)
        {
            var Pattern = tbSearch.Text;
            try
            {
                var Parts = Pattern.ToLower().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

                if (Parts.Length == 0)
                {
                    DisplayItems();
                    return;
                }

                ShownItems = new Audios();

                foreach (var Item in Core.GetAudios())
                {
                    bool IsFound = true;
                    var AudioName = Item.ShortName.ToLower();
                    foreach (var Part in Parts)
                    {
                        if (!AudioName.Contains(Part))
                        {
                            IsFound = false;
                            break;
                        }
                    }

                    if (IsFound)
                        ShownItems.Add(Item);
                }

                pnAudios.Build(ShownItems);
                lbItemCount.Text = "Items: " + ShownItems.Count;
                Invalidate(true);
            }
            catch (Exception E)
            {
                Logger.ErrorException("Files processing exception.", E);

                ShowError(E);
            }
        }
Example #35
0
        public ActionResult GetMeta()
        {
            ShownItems = new Audios(MusicSingltone.Core.GetAudios());

            var audio = ShownItems.Last();
            var mp3File = new Mp3File(audio.FullPath);

            return View(mp3File);
        }
Example #36
0
        public ActionResult GetAudios()
        {
            ShownItems = new Audios(MusicSingltone.Core.GetAudios());//temp !!!!!
            var audios = ShownItems.Select(shownItem => new GetAudiosViewModel()
            {
                Sha1HashDescriptor = (SHA1HashDescriptor)shownItem.Data[0],
                Envelope = (Envelope)shownItem.Data[1],
                VolumeDescriptor = (VolumeDescriptor)shownItem.Data[2],
                Tempogram = (Tempogram)shownItem.Data[3],
                FullPath = shownItem.FullPath,
                State = shownItem.State,
                Tag = shownItem.Tag
            }).ToList();

            return View(audios);
        }
Example #37
0
 public DB()
 {
     Audios = new Audios();
 }