public void SongPlayer_PlayResetsVolumePitchAndPanWhenNotSpecified(AudioImplementation audioImplementation)
        {
            var songPlayer = default(SongPlayer);
            var song       = default(Song);

            GivenAnUltravioletApplicationWithNoWindow()
            .WithAudioImplementation(audioImplementation)
            .WithInitialization(uv => uv.GetAudio().AudioMuted = true)
            .WithContent(content =>
            {
                songPlayer = SongPlayer.Create();
                song       = content.Load <Song>("Songs/Deep Haze");

                songPlayer.Play(song, 0.25f, 0.50f, 0.75f, false);
                songPlayer.Stop();
                songPlayer.Play(song, false);

                TheResultingValue(songPlayer.Volume).ShouldBe(1f);
                TheResultingValue(songPlayer.Pitch).ShouldBe(0f);
                TheResultingValue(songPlayer.Pan).ShouldBe(0f);
            })
            .OnUpdate((app, time) =>
            {
                songPlayer.Update(time);
            })
            .RunForOneFrame();
        }
        public void SongPlayer_SlidesVolumeCorrectly(AudioImplementation audioImplementation)
        {
            var songPlayer = default(SongPlayer);
            var song       = default(Song);

            GivenAnUltravioletApplicationWithNoWindow()
            .WithAudioImplementation(audioImplementation)
            .WithInitialization(uv => uv.GetAudio().AudioMuted = true)
            .WithContent(content =>
            {
                songPlayer = SongPlayer.Create();
                song       = content.Load <Song>("Songs/Deep Haze");

                songPlayer.Play(song, false);

                TheResultingValue(songPlayer.Volume).ShouldBe(1f);

                songPlayer.SlideVolume(0f, TimeSpan.FromSeconds(1));
            })
            .OnUpdate((app, time) =>
            {
                songPlayer.Update(time);
            })
            .RunFor(TimeSpan.FromSeconds(2));

            TheResultingValue(songPlayer.Volume).ShouldBe(0f);
        }
 public MainMenuState()
 {
     selected     = 0;
     textRenderer = new TextRenderer();
     textRenderer.RegisterGlyphShader("shaky", new Shaky());
     spriteFont = Resources.ContentManager.Load <SpriteFont>(GlobalFontID.TrebuchetMS32);
     selector   = Resources.ContentManager.Load <Sprite>(GlobalSpriteID.selectorplaceholder);
     position   = new Vector2f(50, 50);
     rainy      = Resources.ContentManager.Load <Song>(GlobalSongID.RainyNostalgia);
     songPlayer = SongPlayer.Create();
     songPlayer.Play(rainy);
     songPlayer.IsLooping = true;
 }
예제 #4
0
        public void SongPlayer_ThrowsExceptionIfPanSetWhileNotPlaying()
        {
            var songPlayer = default(SongPlayer);

            Assert.That(() =>
            {
                GivenAnUltravioletApplicationWithNoWindow()
                .WithInitialization(uv => uv.GetAudio().AudioMuted = true)
                .WithContent(content =>
                {
                    songPlayer     = SongPlayer.Create();
                    songPlayer.Pan = 0f;
                })
                .RunFor(TimeSpan.FromSeconds(1));
            },
                        Throws.TypeOf <InvalidOperationException>());
        }
예제 #5
0
        protected override void OnLoadingContent()
        {
            this.content = ContentManager.Create("Content");
            LoadContentManifests();

            this.spriteFont         = this.content.Load <SpriteFont>(GlobalFontID.SegoeUI);
            this.spriteBatch        = SpriteBatch.Create();
            this.stringBuffer       = new StringBuilder();
            this.stringFormatter    = new StringFormatter();
            this.textRenderer       = new TextRenderer();
            this.textLayoutCommands = new TextLayoutCommandStream();

            this.song       = this.content.Load <Song>(GlobalSongID.DeepHaze);
            this.songPlayer = SongPlayer.Create();
            this.songPlayer.Play(this.song);

            base.OnLoadingContent();
        }
예제 #6
0
        //Replace With correct Manager
        protected override void OnLoadingContent()
        {
            Console.WriteLine("Something");
            FileSystemManager fileSystemManager = new FileSystemManager("E:\rendu\\EIP\\MakersSquare\\AComponent");

            this.contentManager = ContentManager.Create("Content");
            LoadContentManifests(contentManager);
            AudioManager audioManager = new AudioManager();
            Song         song         = this.contentManager.Load <Song>(GlobalSongID.SabatonTheLastStand);

            audioManager.addSong(song);


            // this.song = TODO load song
            songPlayer = SongPlayer.Create();
            songPlayer.Play(song);

            base.OnLoadingContent();
        }
예제 #7
0
        public void SongPlayer_PlaySetsVolumePitchAndPan()
        {
            var songPlayer = default(SongPlayer);
            var song       = default(Song);

            GivenAnUltravioletApplicationWithNoWindow()
            .WithInitialization(uv => uv.GetAudio().AudioMuted = true)
            .WithContent(content =>
            {
                songPlayer = SongPlayer.Create();
                song       = content.Load <Song>("Songs/Deep Haze");

                songPlayer.Play(song, 0.25f, 0.50f, 0.75f, false);

                TheResultingValue(songPlayer.Volume).ShouldBe(0.25f);
                TheResultingValue(songPlayer.Pitch).ShouldBe(0.50f);
                TheResultingValue(songPlayer.Pan).ShouldBe(0.75f);
            })
            .RunForOneFrame();
        }
        public void SongPlayer_ThrowsExceptionIfPitchSetWhileNotPlaying(AudioImplementation audioImplementation)
        {
            var songPlayer = default(SongPlayer);

            Assert.That(() =>
            {
                GivenAnUltravioletApplicationWithNoWindow()
                .WithAudioImplementation(audioImplementation)
                .WithInitialization(uv => uv.GetAudio().AudioMuted = true)
                .WithContent(content =>
                {
                    songPlayer       = SongPlayer.Create();
                    songPlayer.Pitch = -1f;
                })
                .OnUpdate((app, time) =>
                {
                    songPlayer.Update(time);
                })
                .RunFor(TimeSpan.FromSeconds(1));
            },
                        Throws.TypeOf <InvalidOperationException>());
        }
예제 #9
0
        public void SongPlayer_SlidesPitchCorrectly()
        {
            var songPlayer = default(SongPlayer);
            var song       = default(Song);

            GivenAnUltravioletApplicationWithNoWindow()
            .WithInitialization(uv => uv.GetAudio().AudioMuted = true)
            .WithContent(content =>
            {
                songPlayer = SongPlayer.Create();
                song       = content.Load <Song>("Songs/Deep Haze");

                songPlayer.Play(song, false);

                TheResultingValue(songPlayer.Pitch).ShouldBe(0f);

                songPlayer.SlidePitch(-1f, TimeSpan.FromSeconds(1));
            })
            .RunFor(TimeSpan.FromSeconds(2));

            TheResultingValue(songPlayer.Pitch).ShouldBe(-1f);
        }
예제 #10
0
 public void Play()
 {
     Played = true;
     player = SongPlayer.Create();
     player.Play(Song, Loop);
 }