コード例 #1
0
        private void PlayCurrentSound() // pour que le son s'execute encore si le laser monte et descend
        {
            ISimpleAudioPlayer player = Plugin.SimpleAudioPlayer.CrossSimpleAudioPlayer.Current;

            player.Stop();
            player.Play();
        }
コード例 #2
0
        //-------------------------------------------------------------------------------------------------------------------------

        public void SkipSoundStream()
        {
            var stream = GetStreamFromSkipFile("igplayerinvitedecline.mp3");

            SkipSoundPlayer = Plugin.SimpleAudioPlayer.CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();
            SkipSoundPlayer.Load(stream);
        }
コード例 #3
0
        //-------------------------------------------------------------------------------------------------------------------------

        public void ScoreSoundStream()
        {
            var stream = GetStreamFromScoreFile("lvlUP.mp3");

            ScoreSoundPlayer = Plugin.SimpleAudioPlayer.CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();
            ScoreSoundPlayer.Load(stream);
        }
コード例 #4
0
        //-------------------------------------------------------------------------------------------------------------------------
        public void SettingsSoundStream()
        {
            var stream = GetStreamFromSettingsFile("chestOPEN.mp3");

            SettingsSoundPlayer = Plugin.SimpleAudioPlayer.CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();
            SettingsSoundPlayer.Load(stream);
        }
コード例 #5
0
        //-------------------------------------------------------------------------------------------------------------------------
        public void PlayTheGameSoundStream()
        {
            var stream = GetStreamFromPlayTheGameSoundFile("glueenterworldbutton.mp3");

            PlayGameSoundPlayer = Plugin.SimpleAudioPlayer.CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();
            PlayGameSoundPlayer.Load(stream);
        }
コード例 #6
0
        public void PlayAudio(SoundEffectType effect)
        {
            string fileName = "";

            switch (effect)
            {
            case SoundEffectType.FacebookAlert:
                fileName = "~Assets/facebook_sound.mp3";
                break;

            case SoundEffectType.FacebookPop:
                fileName = "~Assets/facebook_pop.mp3";
                break;

            case SoundEffectType.Notification:
                fileName = "";
                break;
            }

            //Platform Specific UWP code for running audio

            ISimpleAudioPlayer player = Plugin.SimpleAudioPlayer.CrossSimpleAudioPlayer.Current;

            player.Load(File.OpenRead(fileName));
            player.Play();
        }
コード例 #7
0
 public void PlayAreaAmbientSounds(GameView gv, string filenameNoExtension)
 {
     if ((filenameNoExtension.Equals("none")) || (filenameNoExtension.Equals("")) || (!gv.mod.playSoundFx))
     {
         //play nothing
         return;
     }
     else
     {
         if (areaAmbientSoundsPlayer == null)
         {
             areaAmbientSoundsPlayer = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();
         }
         try
         {
             areaAmbientSoundsPlayer.Loop = true;
             areaAmbientSoundsPlayer.Load(GetStreamFromFile(gv, filenameNoExtension));
             areaAmbientSoundsPlayer.Play();
         }
         catch (Exception ex)
         {
             if (gv.mod.debugMode) //SD_20131102
             {
                 gv.cc.addLogText("<yl>failed to play area music" + filenameNoExtension + "</yl><BR>");
             }
         }
     }
 }
コード例 #8
0
        public MainViewModel(ref Image Player, ref AbsoluteLayout layout, INavigation Navigation)
        {
            var    assembly    = typeof(App).GetTypeInfo().Assembly;
            Stream audioStream = assembly.GetManifestResourceStream("DragonRun." + "bang.mp3");

            musicPlayer = CrossSimpleAudioPlayer.Current;
            musicPlayer.Load(audioStream);
            musicPlayer.Play();

            this.Player = Player;
            this.Layout = layout;
            Image       = ImageSource.FromFile("pic5.png");
            ImageEnemy  = ImageSource.FromFile("enemy2.png");

            layout          = this.Layout;
            this.Navigation = Navigation;

            AnimationCommand = new Command(() =>
            {
                NewGame();
            });

            TapCommand = new Command(() =>
            {
                if (!isJumpAnimation)
                {
                    JumpAnimation();
                }
            });
            SettingCommand = new Command(async() =>
            {
                await Navigation.PushAsync(new Setting(this.musicPlayer));
            });
        }
コード例 #9
0
        public ListSoundPageViewModel()
        {
            player          = CrossSimpleAudioPlayer.Current;
            SetSoundCommand = new Command(SetSoundAction);
            PopulateList();

            string selectedSound = App.Current.Properties["KeySound"].ToString();

            foreach (Sound s in Sounds)
            {
                if (s.FileName == selectedSound)
                {
                    s.IsSelected = true;
                }
            }

            MessagingCenter.Subscribe <Sound>(this, "ResetSelected", (c) =>
            {
                foreach (Sound s in Sounds)
                {
                    if (s.Name != c.Name)
                    {
                        s.IsSelected = false;
                    }
                    else
                    {
                        s.IsSelected = true;
                        player.Load(GetStreamFromFile(s.FileName));
                        player.Play();
                    }
                }
            });
        }
コード例 #10
0
        private void ProcessAnswer()
        {
            ISimpleAudioPlayer player = null;

            var responseText = entryAnswer.Text.Trim('\n');

            if (responseText == currentQuestion.Answer)
            {
                correctQuestionCount++;
                labelResult.Text = "Correct";
                BackgroundColor  = Color.FromHex("92ff92");
                player           = playerCorrect;
            }
            else
            {
                labelResult.Text = "Wrong";
                BackgroundColor  = Color.FromHex("feb6b7");
                player           = playerWrong;
            }

            labelQuestion.Text = $"{currentQuestion.Text} {currentQuestion.Answer}";
            player.Play();

            if (IsComplete)
            {
                buttonNext.Text = "Finish!";
            }

            buttonNext.IsVisible = true;
        }
コード例 #11
0
ファイル: SoundService.cs プロジェクト: donmesserli/TicTacToe
        public void PlaySound(string filename)
        {
            ISimpleAudioPlayer player = Plugin.SimpleAudioPlayer.CrossSimpleAudioPlayer.Current;

            player.Load(GetStreamFromFile(filename));
            player.Play();
        }
コード例 #12
0
ファイル: Sound.cs プロジェクト: Kronox008/ArTai
        public void GOTsounds()
        {
            System.Random RandomNumber = new System.Random();

            string soundName0 = "got_s1e5_pays_his_debts.wav";
            string soundName1 = "got_s1e7_win_or_die.wav";
            string soundPath  = "ArTai.Sounds.GOT.";

            allSounds = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();

            int soundNumber = RandomNumber.Next(0, 2);         // 2-1 = total streams


            switch (soundNumber)
            {
            case 0:
                var GOT0 = GetStream(soundPath, soundName0);
                allSounds.Load(GOT0);
                break;

            case 1:
                var GOT1 = GetStream(soundPath, soundName1);
                allSounds.Load(GOT1);
                break;

            default:
                break;
            }

            allSounds.Volume = Global.SoundVolume;
            allSounds.Play();
        }
コード例 #13
0
ファイル: Sound.cs プロジェクト: Kronox008/ArTai
        public void Animalssounds()
        {
            System.Random RandomNumber = new System.Random();

            string soundName0 = "Narwhals.wav";
            string soundPath  = "ArTai.Sounds.Animals.";

            allSounds = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();

            int soundNumber = 0;         // 2-1 = total streams


            switch (soundNumber)
            {
            case 0:
                var ANIMALS0 = GetStream(soundPath, soundName0);
                allSounds.Load(ANIMALS0);
                break;

            default:
                break;
            }

            allSounds.Volume = Global.SoundVolume;
            allSounds.Play();
        }
コード例 #14
0
        public PaymentViewModel()
        {
            Service = new PaymentService();
            Payment p = new Payment();

            this.Name     = Cell.Create(p.name);
            this.Date     = Cell.Create(p.date);
            this.Category = Cell.Create(p.category);
            this.Amount   = Cell.Create(p.amount.ToString());

            this.NameError     = Cell.Derived(Name, ValidateName);
            this.DateError     = Cell.Derived(Date, ValidateDate);
            this.CategoryError = Cell.Derived(Category, ValidateCategory);
            this.AmountError   = Cell.Derived(Amount, ValidateAmount);

            this.ImageUri       = Cell.Create(new Uri("http://cdn.entropiaplanets.com/w/images/4/4b/Replace-me.png"));
            this.ImageVisible   = Cell.Create(true);
            this.LoadingVisible = Cell.Derived(ImageVisible, i => !i);

            Category.ValueChanged += PlayCategorySound;
            Name.ValueChanged     += () => { Namechanged = true; };
            MakeImageRequest();

            var enabled = Cell.Derived(new List <Cell <string> > {
                NameError, DateError, CategoryError, AmountError
            }, cs => cs.All(c => c == ""));

            this.AddPaymentCommand = new AddPaymentCommand(this, enabled);

            player = CrossSimpleAudioPlayer.Current;
        }
コード例 #15
0
        public TabbedPage1(string name)
        {
            InitializeComponent();

            var clr = Color.FromHex("#4A5B64");

            this.BarBackgroundColor = clr;
            this.BindingContext     = this;

            player = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();

            CurrentPage = Children[1];

            Children[0].Appearing += UpdateOnline;
            Send.Clicked          += Send_Clicked;
            this.name              = name;
            Random rand = new Random();

            cellColor = GenColor();

            ConnectsBtn.Clicked += toggleBtn;

            //AddBtn.Clicked += AddEvent;

            hubConnection = new HubConnectionBuilder().WithUrl($"https://backboyserver.azurewebsites.net/chatHub").Build();
            //activeUsers = new List<string>();

            HandleConnections();
        }
コード例 #16
0
 private void CreateToolbars()
 {
     ToolbarItems.Clear();
     if (RequestFrom == RequestSource.Nitnem)
     {
         if (_nitnemBani.Bookmark)
         {
             CreateBookmarkToolbar();
         }
         AudioPlayer = CrossSimpleAudioPlayer.Current;
         try
         {
             AudioPlayer.Load(_nitnemBani.BaniId + ".mp3");
             CreatePlayToolbar();
         }
         catch { }
         if (_nitnemBani.Id == 18) //Asa ki vaar
         {
             CreateKeertanMode();
         }
     }
     else
     {
         //CreateShareToolbar();
         //CreateSimilarShabadToolbar();
         CreateSharePopupToolbar();
     }
 }
コード例 #17
0
        public GameLogicViewModel()
        {
            resetScore();
            operators = new Operators();
            initialize();
            gameStopWatch = new Stopwatch();
            gameStopWatch.Start();


            CalculateCommand = new Command <string>(EvaluateUserChoice);

            var correctAssembly   = typeof(App).GetTypeInfo().Assembly;
            var inCorrectAssembly = typeof(App).GetTypeInfo().Assembly;

            var correctAudioStream = correctAssembly.GetManifestResourceStream("MinuteMath.DingSound.wav");

            correctDing = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();
            correctDing.Load(correctAudioStream);


            var incorrectAudioStream = correctAssembly.GetManifestResourceStream("MinuteMath.duck.wav");

            incorrectQuack = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();
            incorrectQuack.Load(incorrectAudioStream);
        }
コード例 #18
0
ファイル: MainActivity.cs プロジェクト: SJCRPV/Blind-Alley
        private void setSounds()
        {
            ambientSound = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();
            ambientSound.Load("sounds/Ambient.wav");
            ambientSound.Play();
            ambientSound.Loop = true;

            stickSound = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();
            stickSound.Load("sounds/HitTheGround.wav");

            minotaurDistantSound = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();
            minotaurDistantSound.Load("sounds/Distant.wav");

            //minotaurDistant2Sound = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();
            //minotaurDistant2Sound.Load("sounds/Distant2.wav");

            //minotaurNearbySound = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();
            //minotaurNearbySound.Load("sounds/Nearby.wav");

            minotaurDiscoveredSound = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();
            minotaurDiscoveredSound.Load("sounds/Discovered.wav");

            footstepSound = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();
            footstepSound.Load("sounds/Footstep.wav");

            victorySound = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();
            victorySound.Load("sounds/Victory.wav");

            deathSound = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();
            deathSound.Load("sounds/Death.wav");
        }
コード例 #19
0
        private void BtnStop_Clicked(object sender, EventArgs e)
        {
            // await CrossMediaManager.Current.Stop();
            ISimpleAudioPlayer audioPlayer = CrossSimpleAudioPlayer.Current;

            audioPlayer.Stop();
        }
コード例 #20
0
ファイル: MainPage.xaml.cs プロジェクト: garciart/Buzzer
        private void Button_Clicked(object sender, EventArgs e)
        {
            ISimpleAudioPlayer player = Plugin.SimpleAudioPlayer.CrossSimpleAudioPlayer.Current;

            player.Load(GetStreamFromFile("buzzer.mp3"));
            player.Play();
        }
コード例 #21
0
ファイル: MainPage.xaml.cs プロジェクト: zantramte/Postevanka
        private void Button_Clicked(object sender, EventArgs e)
        {
            Button Gumb = sender as Button;

            Posast.Moja_Izbira = Convert.ToInt32(Gumb.Text);

            if (Posast.Preveri_ustreznost())
            {
                var stream = GetStreamFromFile("ja.mp3");
                Igralnik = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();
                Igralnik.Load(stream);
                Igralnik.Play();
                DisplayAlert("Pošastko sporoča", "BRAVO! Pravilna rešitev!", "Nadaljuj");
                Uredi();
            }

            else
            {
                var stream = GetStreamFromFile("ne.mp3");
                Igralnik = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();
                Igralnik.Load(stream);
                Igralnik.Play();
                DisplayAlert("Pošastko sporoča", "NAROBE! Rešitev ni pravilna!", "Nadaljuj");
                Uredi();
            }
        }
コード例 #22
0
ファイル: ScannerPage.xaml.cs プロジェクト: franckyp1/Machina
        private void PlaySound(string soundName)
        {
            ISimpleAudioPlayer player = Plugin.SimpleAudioPlayer.CrossSimpleAudioPlayer.Current;

            player.Load(GetStreamFromFile(soundName));
            player.Play();
        }
コード例 #23
0
        //-------------------------------------------------------------------------------------------------------------------------
        public void SettingsClosingSoundStream()
        {
            var stream = GetStreamFromSettingsCloseFile("draenei_chest_anims_close.mp3");

            SettingsClosingSoundPlayer = Plugin.SimpleAudioPlayer.CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();
            SettingsClosingSoundPlayer.Load(stream);
        }
コード例 #24
0
ファイル: ScannerPage.xaml.cs プロジェクト: franckyp1/Machina
        private void PlayCurrentSound()
        {
            ISimpleAudioPlayer player = Plugin.SimpleAudioPlayer.CrossSimpleAudioPlayer.Current;

            player.Stop();
            player.Play();
        }
コード例 #25
0
        public void CorrectSoundStream()
        {
            var stream = GetStreamFromCorrectFile("conjure_item.mp3");

            CorrectSoundPlayer = Plugin.SimpleAudioPlayer.CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();
            CorrectSoundPlayer.Load(stream);
        }
コード例 #26
0
        public Ditado(int numeroFase)
        {
            this.numeroFase = numeroFase;


            player  = CrossSimpleAudioPlayer.Current;
            player2 = CrossSimpleAudioPlayer.Current;

            player  = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();
            player2 = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();

            player2.Loop = false;
            player.Loop  = false;

            CarregaLicoes();

            InitializeComponent();

            CarregaBarras();

            carregaFase();

            if (Singleton.Instance.dadosJogador.ProgressoFase[this.numeroFase] != 0)
            {
                progressLesson.Progress = (0.25 * (Singleton.Instance.dadosJogador.ProgressoFase[this.numeroFase]));
            }

            assembly   = GetType().GetTypeInfo().Assembly;
            bitmaptEST = SKBitmap.Decode(assembly.GetManifestResourceStream(resourceBarraHorizontal));
        }
コード例 #27
0
        //-------------------------------------------------------------------------------------------------------------------------
        public void TickSoundStream()
        {
            var stream = GetStreamFromTickFile("dot.mp3");

            TickSoundPlayer = Plugin.SimpleAudioPlayer.CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();
            TickSoundPlayer.Load(stream);
        }
コード例 #28
0
        public ListenPage()
        {
            InitializeComponent();
            //try
            //{
            //    c = Pocketsphinx.Decoder.DefaultConfig();
            //    c.SetString("-hmm", "/models/en-us/mdef");
            //    c.SetString("-dict", "/models/dict/cmudict-en-us.dict");
            //    c.SetFloat("-kws_threshold", 1e-30);

            //    c.SetFloat("-samprate", 44100);
            //    c.SetInt("-nfft", 2048);

            //    d = new Pocketsphinx.Decoder(c);
            //}catch(Exception ex)
            //{
            //    DisplayAlert("Oops!", ex.Message, "OK");
            //}
            recorder = new AudioRecorderService
            {
                StopRecordingAfterTimeout = false,
                //AudioSilenceTimeout = TimeSpan.FromSeconds(2),
                //TotalAudioTimeout = TimeSpan.FromSeconds(20)
            };

            //recorder.FilePath = "/audio";
            player = new AudioPlayer();
            player.FinishedPlaying += Player_FinishedPlaying;
            aplayer = CrossSimpleAudioPlayer.Current;
        }
コード例 #29
0
        public Localisation()
        {
            InitializeComponent();

            _bleService = BLEService.Instance();

            _isAlarmStarted = false;
            _isStarted      = false;
            _firstTimer     = 0;

            // Init player
            _player = CrossSimpleAudioPlayer.Current;
            _player.Load("bing.mp3");
            _player.Volume = 1;

            MessagingCenter.Subscribe <BLEService>(this, "deviceConnectionLost", (sender) =>
            {
                OnDeviceDisconnected();
            });

            MessagingCenter.Subscribe <BLEService, CharacteristicUpdatedEventArgs>(this, "characteristicUpdated", (sender, args) =>
            {
                OnCharacteristicUpdated(args);
            });
        }
コード例 #30
0
        public void StopAreaMusic()
        {
            if (areaMusicPlayer == null)
            {
                areaMusicPlayer = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();
            }
            try
            {
                if (areaMusicPlayer.IsPlaying)
                {
                    areaMusicPlayer.Stop();
                }
            }
            catch (Exception ex)
            {
            }

            if (areaAmbientSoundsPlayer == null)
            {
                areaAmbientSoundsPlayer = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();
            }
            try
            {
                if (areaAmbientSoundsPlayer.IsPlaying)
                {
                    areaAmbientSoundsPlayer.Stop();
                }
            }
            catch (Exception ex)
            {
            }
        }