Example #1
0
        private void MusikEinschieben(byte[][] aSongs, string sEinschiebeKategorie)
        {
            Initialisieren();

            if (!Convert.ToBoolean(Properties.Settings.Default["Musik_ausschalten"]))
            {
                if (wavePlayer.PlaybackState == PlaybackState.Playing)
                {
                    if (fadeInOut.State == FadeInOutWithStateSampleProvider.FadeState.FullVolume)
                    {
                        if (fadeInOut != null)
                        {
                            fadeInOut.BeginFadeOut(iDauerEinblendungUebergang);
                        }
                    }
                }

                if ((wavePlayerEinschieben.PlaybackState == PlaybackState.Playing || wavePlayerEinschieben.PlaybackState == PlaybackState.Paused) &&
                    sLetzteEinschiebeKategorie == sEinschiebeKategorie)
                {
                    if (fadeInOutEinschieben.State == FadeInOutWithStateSampleProvider.FadeState.Silence)
                    {
                        if (fadeInOutEinschieben != null)
                        {
                            fadeInOutEinschieben.BeginFadeIn(iDauerEinblendungUebergang);
                        }
                    }

                    if (wavePlayerEinschieben.PlaybackState == PlaybackState.Paused)
                    {
                        wavePlayerEinschieben.Play();
                    }

                    return;
                }
                else if (wavePlayerEinschieben.PlaybackState == PlaybackState.Playing || wavePlayerEinschieben.PlaybackState == PlaybackState.Paused)
                {
                    wavePlayerEinschieben.Stop();
                }

                int next = SW.Statisch.Rnd.Next(0, aSongs.Length);

                sourceStreamEinschieben            = new Mp3FileReader(new MemoryStream(aSongs[next]));
                inputStreamEinschieben             = new WaveChannel32(sourceStreamEinschieben);
                fadeInOutEinschieben               = new FadeInOutWithStateSampleProvider(inputStreamEinschieben.ToSampleProvider());
                fadeInOutEinschieben.FadeFinished += fadeInOutEinschieben_FadeFinished;

                inputStreamEinschieben.Volume        = (float)Convert.ToDouble(iMusikLautstaerke) / 100;
                inputStreamEinschieben.PadWithZeroes = false;

                wavePlayerEinschieben.Init(fadeInOutEinschieben);

                if (fadeInOutEinschieben != null)
                {
                    fadeInOutEinschieben.BeginFadeIn(iDauerEinblendungStart);
                }

                wavePlayerEinschieben.Play();
                sLetzteEinschiebeKategorie = sEinschiebeKategorie;
            }
        }
Example #2
0
        public void checkMusik()
        {
            Initialisieren();

            if (!Convert.ToBoolean(Properties.Settings.Default["Musik_ausschalten"]))
            {
                if (wavePlayerEinschieben.PlaybackState == PlaybackState.Playing)
                {
                    if (fadeInOutEinschieben.State == FadeInOutWithStateSampleProvider.FadeState.FullVolume)
                    {
                        if (fadeInOutEinschieben != null)
                        {
                            fadeInOutEinschieben.BeginFadeOut(iDauerEinblendungUebergang);
                        }
                    }
                }

                if (wavePlayer.PlaybackState == PlaybackState.Playing ||
                    wavePlayer.PlaybackState == PlaybackState.Paused)
                {
                    if (fadeInOut.State == FadeInOutWithStateSampleProvider.FadeState.Silence)
                    {
                        if (fadeInOut != null)
                        {
                            fadeInOut.BeginFadeIn(iDauerEinblendungUebergang);
                        }
                    }

                    if (wavePlayer.PlaybackState == PlaybackState.Paused)
                    {
                        wavePlayer.Play();
                    }

                    return;
                }

                if (start)
                {
                    sourceStream            = new Mp3FileReader(new MemoryStream(Song_Intro));
                    inputStream             = new WaveChannel32(sourceStream);
                    fadeInOut               = new FadeInOutWithStateSampleProvider(inputStream.ToSampleProvider());
                    fadeInOut.FadeFinished += fadeInOut_FadeFinished;

                    inputStream.Volume        = (float)Convert.ToDouble(iMusikLautstaerke) / 100;
                    inputStream.PadWithZeroes = false;

                    wavePlayer.Init(fadeInOut);

                    if (fadeInOut != null)
                    {
                        fadeInOut.BeginFadeIn(iDauerEinblendungStart);
                    }

                    wavePlayer.Play();
                    start = false;
                }
                else
                {
                    int next = SW.Statisch.Rnd.Next(0, Songs_Standard.Length);

                    sourceStream            = new Mp3FileReader(new MemoryStream(Songs_Standard[next]));
                    inputStream             = new WaveChannel32(sourceStream);
                    fadeInOut               = new FadeInOutWithStateSampleProvider(inputStream.ToSampleProvider());
                    fadeInOut.FadeFinished += fadeInOut_FadeFinished;

                    inputStream.Volume        = (float)Convert.ToDouble(iMusikLautstaerke) / 100;
                    inputStream.PadWithZeroes = false;

                    wavePlayer.Init(fadeInOut);

                    if (fadeInOut != null)
                    {
                        fadeInOut.BeginFadeIn(iDauerEinblendungStart);
                    }

                    wavePlayer.Play();
                }
            }
        }