示例#1
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();
        }
示例#2
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();
        }
示例#3
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>");
             }
         }
     }
 }
        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);
        }
示例#5
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)
            {
            }
        }
示例#6
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();
        }
示例#7
0
        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");
        }
示例#8
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));
        }
示例#9
0
 public static void Init()
 {
     CurrentList = new List <Song> {
     };
     //CurrentQueue = new List<string> { };
     player = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();
 }
示例#10
0
        public MainPage()
        {
            //force color scheme for now
            Preferences.Intstance.ColorScheme = ColorSchemes.Schemes[1];

            var player = CrossSimpleAudioPlayer.Current;

            for (int i = 0; i < (int)DrumType.count; i++)
            {
                players[i]      = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();
                players[i].Loop = false;
            }

            LoadSamples(1);


            InitializeComponent();

            int j = 0;

            foreach (Button button in gridButtons.Children)
            {
                DrumType drum = (DrumType)j;
                button.Clicked += (s, e) => OnDrumButton(drum);
                j++;
            }

            Preferences.Intstance.ColorSchemeUpdated += ColorSchemeUpdated;

            //to set the animations
            ColorSchemeUpdated(this, Preferences.Intstance.ColorScheme.SchemeType);
        }
示例#11
0
        public MainPage()
        {
            //force color scheme for now
            Preferences.Intstance.ColorScheme = ColorSchemes.Schemes[0];

            for (int i = 0; i < (int)DrumType.count; i++)
            {
                players[i]      = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();
                players[i].Loop = false;
            }

            InitializeComponent();

            int j = 0;

            foreach (Button button in gridButtons.Children)
            {
                DrumType drum = (DrumType)j;
                button.Clicked += (s, e) => OnDrumButton(drum);
                j++;
            }

            btnRecord.Clicked += BtnRecordClicked;
            btnPlay.Clicked   += BtnPlayClicked;

            btnSettings.Clicked += (s, e) => Navigation.PushAsync(new ColorSchemePage());
            btnAbout.Clicked    += (s, e) => DisplayAlert("DrumPad", "v0.5.1", "OK");

            Preferences.Intstance.ColorSchemeUpdated += ColorSchemeUpdated;

            //to set the animations
            ColorSchemeUpdated(this, Preferences.Intstance.ColorScheme.SchemeType);
        }
示例#12
0
        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();
            }
        }
示例#13
0
        private void OnTap(View arg1, object arg2)
        {
            App.Current.MainPage = new NavigationPage(new ErrorLog());
            var clickSound = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();

            clickSound.Load("Beep.mp3");
            clickSound.Play();
        }
 public void play(String name)
 {
     player = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();
     player.Load(name);
     player.Volume = 50;
     player.Loop   = true;
     player.Play();
 }
        public MainPage()
        {
            simpleAudioPlayer      = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();
            simpleAudioPlayer.Loop = false;
            bool ret = simpleAudioPlayer.Load(GetStreamFromFile($"Audio.G-0.wav"));

            InitializeComponent();
        }
示例#16
0
        async void OnSettingsClicked(object sender, EventArgs args)
        {
            var clickSound = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();

            clickSound.Load("Files/sfx/optionSelect.wav");
            clickSound.Play();
            await Navigation.PushAsync(new TweakSettings());
        }
示例#17
0
        public AudioPlayer(IFileSystem fileSystem)
        {
            Guard.Against.Null(fileSystem, nameof(fileSystem));

            var audioPath = Path.Combine(fileSystem.AudioDir, "new_message.wav");

            _player = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();
            _player.Load("new_message.wav");
        }
示例#18
0
        int AddAudio(Stream stream, double volume = 1)
        {
            Sound.Add(CrossSimpleAudioPlayer.CreateSimpleAudioPlayer());
            int res = Sound.Count - 1;

            Sound[res].Load(stream);
            Sound[res].Volume = volume;
            return(res);
        }
示例#19
0
        public static ISimpleAudioPlayer LoadAudioPlayer(string resourceId)
        {
            Assembly assembly = typeof(App).GetTypeInfo().Assembly;
            var      stream   = assembly.GetManifestResourceStream(resourceId);
            var      player   = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();

            player.Load(stream);
            return(player);
        }
示例#20
0
文件: Sound.cs 项目: Kronox008/ArTai
        public void LoTRsounds()
        {
            System.Random RandomNumber = new System.Random();

            string soundName0 = "death.wav";        //crash
            string soundName1 = "reddawn.wav";      //works
            string soundName2 = "king.wav";         //crash
            string soundName3 = "shallnotpass.wav"; //works
            string soundName4 = "task.wav";         //works
            string soundName5 = "tried.wav";        //crash
            string soundPath  = "ArTai.Sounds.LoTR.";


            allSounds = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();

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


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

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

            case 2:
                var LoTR2 = GetStream(soundPath, soundName2);
                allSounds.Load(LoTR2);
                break;

            case 3:
                var LoTR3 = GetStream(soundPath, soundName3);
                allSounds.Load(LoTR3);
                break;

            case 4:
                var LoTR4 = GetStream(soundPath, soundName4);
                allSounds.Load(LoTR4);
                break;

            case 5:
                var LoTR5 = GetStream(soundPath, soundName5);
                allSounds.Load(LoTR5);
                break;

            default:
                break;
            }

            allSounds.Volume = Global.SoundVolume;
            allSounds.Play();
        }
        public static void Play(String name, double volume)
        {
            ISimpleAudioPlayer playerStatic;

            playerStatic = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();
            playerStatic.Load(name);
            playerStatic.Volume = volume;
            playerStatic.Play();
        }
示例#22
0
        private void Button_Clicked_1(object sender, EventArgs e)
        {
            var stream = GetStreamFromFile("cartoon.mp3");

            Igralnik = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();
            Igralnik.Load(stream);
            Igralnik.Play();
            Uredi();
        }
示例#23
0
文件: Sound.cs 项目: Kronox008/ArTai
        public void Peoplesounds()
        {
            System.Random RandomNumber = new System.Random();

            string soundName0 = "TechArchaeology.wav";
            string soundName1 = "TechIronWorking.wav";
            string soundName2 = "TechMathematics.wav";
            string soundName3 = "TechSteamPower.wav";
            string soundName4 = "TechTheology.wav";
            string soundName5 = "TechWriting.wav";

            string soundPath = "ArTai.Sounds.People.";

            allSounds = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();

            int soundNumber = RandomNumber.Next(0, 6);

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

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

            case 2:
                var PEOPLE2 = GetStream(soundPath, soundName2);
                allSounds.Load(PEOPLE2);
                break;

            case 3:
                var PEOPLE3 = GetStream(soundPath, soundName3);
                allSounds.Load(PEOPLE3);
                break;

            case 4:
                var PEOPLE4 = GetStream(soundPath, soundName4);
                allSounds.Load(PEOPLE4);
                break;

            case 5:
                var PEOPLE5 = GetStream(soundPath, soundName5);
                allSounds.Load(PEOPLE5);
                break;

            default:
                break;
            }

            allSounds.Volume = Global.SoundVolume;
            allSounds.Play();
        }
示例#24
0
        private void Button_Clicked_2(object sender, EventArgs e)
        {
            Posast.Stevec++;

            if (Posast.Stevec % 2 == 0)
            {
                Gumbo.Text             = "BOŽIČNI NAČIN";
                Slika.Source           = "p1.png";
                G.BackgroundColor      = Color.FromHex("#680580");
                GGG.BackgroundColor    = Color.FromHex("#4B1758");
                Gumbo.BackgroundColor  = Color.FromHex("#701187");
                Glavno.BackgroundColor = Color.FromHex("#EDA4FF");
                Panel.BackgroundColor  = Color.FromHex("#EDA4FF");

                for (int indeks = 0; indeks < Panel.Children.Count; indeks++)
                {
                    if (indeks % 2 != 0)
                    {
                        Panel.Children[indeks].BackgroundColor = Color.FromHex("#701187");
                    }

                    else
                    {
                        Panel.Children[indeks].BackgroundColor = Color.FromHex("#C525ED");
                    }
                }
            }

            else
            {
                var stream = GetStreamFromFile("gu.mp3");
                Igralnik = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();
                Igralnik.Load(stream);
                Igralnik.Play();
                Gumbo.Text             = "POŠASTKOV NAČIN";
                Slika.Source           = "p2.png";
                G.BackgroundColor      = Color.FromHex("#9A1B1B");
                GGG.BackgroundColor    = Color.FromHex("#9A1B1B");
                Gumbo.BackgroundColor  = Color.FromHex("#9A1B1B");
                Glavno.BackgroundColor = Color.FromHex("#FF8989");
                Panel.BackgroundColor  = Color.FromHex("#FF8989");

                for (int indeks = 0; indeks < Panel.Children.Count; indeks++)
                {
                    if (indeks % 2 != 0)
                    {
                        Panel.Children[indeks].BackgroundColor = Color.FromHex("#BF0000");
                    }

                    else
                    {
                        Panel.Children[indeks].BackgroundColor = Color.FromHex("#F05D5D");
                    }
                }
            }
        }
示例#25
0
        public void PlaySound(AppSoundsEnum sound)
        {
            var    assembly    = typeof(App).GetTypeInfo().Assembly;
            Stream audioStream = assembly.GetManifestResourceStream($"XamarinTest.Resources.Sounds.{sound}.mp3");

            var player = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();

            player.Load(audioStream);
            player.Play();
        }
        public LibraryAudioPage()
        {
            InitializeComponent();

            var stream = GetStreamFromFile("Diminished.mp3");

            player = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();
            player.Load(stream);

            InitControls();
        }
示例#27
0
 public PlayingViewModel()
 {
     Player = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();
     Player.PlaybackEnded += PlaybackEnded;
     PlayImage             = ImageSource.FromResource("MusicPlayer.Resources.playButton.png", typeof(PlayingViewModel));
     PauseImage            = ImageSource.FromResource("MusicPlayer.Resources.pauseButton.png", typeof(PlayingViewModel));
     Cover         = ImageSource.FromResource("MusicPlayer.Resources.defaultCover.png", typeof(PlayingViewModel));
     ButtonImage   = PlayImage;
     DurationValue = .1;
     PositionValue = 0;
 }
示例#28
0
        public void Play(Stream stream, bool loop = false)
        {
            var player = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();

            _listOfActiveAudioPlayers.Add(player);
            if (player.Load(stream))
            {
                player.Loop = loop;
                player.Play();
                player.PlaybackEnded += (s, e) => _listOfActiveAudioPlayers.Remove(player);
            }
        }
示例#29
0
        public void Play(string path, bool loop = false)
        {
            Guid guid        = Guid.NewGuid();
            var  audioStream = FileManager.LoadStream(assembly, resources, path);
            var  player      = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();

            if (player.Load(audioStream))
            {
                player.Loop = loop;
                player.Play();
            }
        }
示例#30
0
 public MainWindow()
 {
     InitializeComponent();
     Player = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();;
     TypeComboBox.ItemsSource = new List <string>()
     {
         Type.vocals_.ToString(),
             Type.instrumental_.ToString()
     };
     InputFolderTextBox.Text = Settings.Default.LoadPath;
     LoadButton_Click(null, null);
 }