当前位置: 首页>>代码示例>>C#>>正文


C# IWavePlayer.Stop方法代码示例

本文整理汇总了C#中IWavePlayer.Stop方法的典型用法代码示例。如果您正苦于以下问题:C# IWavePlayer.Stop方法的具体用法?C# IWavePlayer.Stop怎么用?C# IWavePlayer.Stop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IWavePlayer的用法示例。


在下文中一共展示了IWavePlayer.Stop方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PlayKillStreak

        public IWavePlayer PlayKillStreak(string sfxName, string ext = "wav")
        {
            KillStreakDevice = KillStreakDevice ?? new WaveOutEvent();

            var path = SFXPath + sfxName + "." + ext;
            Wait(250);
            AudioFileReader audioFileReader = new AudioFileReader(path);
            audioFileReader.Volume = 0.6f * Volume;

            KillStreakDevice.Stop();
            KillStreakDevice.Init(audioFileReader);
            KillStreakDevice.Play();
            return KillStreakDevice;
        }
开发者ID:jonnelfernandez,项目名称:GTARPG,代码行数:14,代码来源:AudioHandler.cs

示例2: ReleaseWavePlayer

 // Stops and disposes of the wave player. Wave players created through
 // the CreateWavePlayer method should be released by this method.
 private void ReleaseWavePlayer(IWavePlayer player)
 {
     if (player != null)
     {
         player.Stop();
         player.Dispose();
     }
 }
开发者ID:avs009,项目名称:gsf,代码行数:10,代码来源:AudioPlayback.cs

示例3: Run

        public void Run(string[] args)
        {
            m_settingsModel = LoadSettings();
            m_running = true;
            m_eyeClients = new Dictionary<string, TcpClient>();
            m_controllerClients = new Dictionary<string, ControllerItem>();
            m_eyeDataQueue = new Queue<byte[]>();
            m_controllerDataQueue = new Queue<ControllerData>();
            m_commandsQueue = new Queue<Command>();
            m_waveOutDevice = new WaveOut();
            m_audioFileReader = new AudioFileReader("alarms/default.mp3");
            m_waveOutDevice.Init(m_audioFileReader);

            var argMode = ArgMode.None;
            foreach (var arg in args)
            {
                if (argMode == ArgMode.None)
                {
                    if (arg == "-ep" || arg == "--eye-port")
                        argMode = ArgMode.EyePort;
                    else if (arg == "-cp" || arg == "--controller-port")
                        argMode = ArgMode.ControllerPort;
                    else if (arg == "-t" || arg == "--token")
                        argMode = ArgMode.Token;
                    else if (arg == "-tr" || arg == "--treshold")
                        argMode = ArgMode.Treshold;
                    else if (arg == "-aa" || arg == "--armed-alarm")
                        argMode = ArgMode.ArmedAlarm;
                    else if (arg == "-s" || arg == "--silent")
                        argMode = ArgMode.Silent;
                }
                else if (argMode == ArgMode.EyePort)
                {
                    var v = m_settingsModel.EyePort;
                    if (int.TryParse(arg, out v))
                        m_settingsModel.EyePort = v;
                    argMode = ArgMode.None;
                }
                else if (argMode == ArgMode.ControllerPort)
                {
                    var v = m_settingsModel.ControllerPort;
                    if (int.TryParse(arg, out v))
                        m_settingsModel.ControllerPort = v;
                    argMode = ArgMode.None;
                }
                else if (argMode == ArgMode.Token)
                {
                    m_settingsModel.Token = arg.Trim();
                    argMode = ArgMode.None;
                }
                else if (argMode == ArgMode.Treshold)
                {
                    var v = m_settingsModel.Treshold;
                    if (int.TryParse(arg, out v))
                        m_settingsModel.Treshold = v;
                    argMode = ArgMode.None;
                }
                else if (argMode == ArgMode.ArmedAlarm)
                {
                    if (arg == "y" || arg == "yes" || arg == "t" || arg == "true")
                        m_settingsModel.ArmedAlarm = true;
                    else if (arg == "n" || arg == "no" || arg == "f" || arg == "false")
                        m_settingsModel.ArmedAlarm = false;
                    argMode = ArgMode.None;
                }
                else if (argMode == ArgMode.Silent)
                {
                    if (arg == "y" || arg == "yes" || arg == "t" || arg == "true")
                        m_settingsModel.Silent = true;
                    else if (arg == "n" || arg == "no" || arg == "f" || arg == "false")
                        m_settingsModel.Silent = false;
                    argMode = ArgMode.None;
                }
            }

            m_alarmIsArmed = m_settingsModel.ArmedAlarm;
            Console.WriteLine("* Connection token: " + m_settingsModel.Token);

            SpawnEyeListenerTask();
            SpawnControllerListenerTask();
            SpawnEyeProcessorTask();
            SpawnControllerProcessorTask();
            SpawnCommandsExecutorTask();

            while (m_running)
            {
                var line = Console.ReadLine();
                if (line == "exit")
                    m_running = false;
                else if (line == "arm")
                    ArmAlarm();
                else if (line == "disarm")
                    DisarmAlarm();
                else if (line == "alarm-on")
                    StartAlarm();
                else if (line == "alarm-off")
                    StopAlarm();
            }

            lock (m_commandsLock)
//.........这里部分代码省略.........
开发者ID:PsichiX,项目名称:Aegis,代码行数:101,代码来源:Program.cs

示例4: PlayKillStreak

        public IWavePlayer PlayKillStreak(string sfxName, string ext = "wav")
        {
            if (!RPGSettings.PlayKillstreaks) return null;

            KillStreakDevice = KillStreakDevice ?? new WaveOutEvent();

            var path = SFXPath + sfxName + "." + ext;
            Wait(250);
            if (!File.Exists(path))
            {
                RPGLog.Log("Did not find killstreak SFX to play");
                return KillStreakDevice;
            }
            AudioFileReader audioFileReader = new AudioFileReader(path);
            audioFileReader.Volume = 0.6f * Volume;

            KillStreakDevice.Stop();
            KillStreakDevice.Init(audioFileReader);
            KillStreakDevice.Play();
            return KillStreakDevice;
        }
开发者ID:logicspawn,项目名称:GTARPG,代码行数:21,代码来源:AudioHandler.cs

示例5: playSong

        /// <summary>
        /// Method that plays whatever the current song is
        /// </summary>
        private void playSong()
        {
            skipThis = false;
            Stream stream = Subsonic.StreamSong(currentSong.id);

            // Try to move this filling of memory stream into the background...
            Stream ms = new MemoryStream();
            byte[] buffer = new byte[32768];
            int read;
            while ((read = stream.Read(buffer, 0, buffer.Length)) > 0)
            {
                playerThread.ReportProgress(50);

                ms.Write(buffer, 0, read);
            }

            ms.Position = 0;
            Mp3FileReader mp3Reader = new Mp3FileReader(ms);
            WaveStream blockAlignedStream =
                new BlockAlignReductionStream(
                    WaveFormatConversionStream.CreatePcmStream(mp3Reader));
            WaveOut waveOut;
            waveOut = new WaveOut(WaveCallbackInfo.FunctionCallback());
            waveOut.Init(blockAlignedStream);
            waveOut.Play();
            playState = PlaybackState.Playing;
            bool songEnd = false;
            while (playState != PlaybackState.Stopped && !songEnd && !skipThis)
            {
                if (waveOut.PlaybackState == PlaybackState.Stopped)
                    songEnd = true;
                else
                {
                    switch (playState)
                    {
                        case PlaybackState.Paused:
                            waveOut.Pause();
                            break;
                        case PlaybackState.Playing:
                            if (waveOut.PlaybackState != PlaybackState.Playing)
                                waveOut.Play();
                            else
                            {
                                int progress = (int)(100.0 * mp3Reader.CurrentTime.TotalSeconds / mp3Reader.TotalTime.TotalSeconds);
                                playerThread.ReportProgress(progress);
                                Thread.Sleep(100);
                            }
                            break;
                        default:
                            break;
                    }
                }
            }
            //if (playState == PlaybackState.Stopped)
            waveOut.Stop();
            //waveOut.Dispose();
        }
开发者ID:rogerstewart,项目名称:subsonic-csharp,代码行数:60,代码来源:PlayerForm.cs

示例6: Main

    public static void Main()
    {
        Console.Title = "EatSharp";

        Dimitar.SetConsoleWidthAndHeight();

        Console.OutputEncoding = Encoding.UTF8;

        if (returnFromHighScores && returnFromInstructions && returnFromLevelOne && returnFromLevelTwo)
        {
            DrawLogo(20);

            DimitarPiskov.PrintGameName();
            Console.ReadKey();
            Console.Clear();

            DimitarPiskov.Introduction();
            Console.ReadKey();
            Console.Clear();
        }

        // Menu

        Ivaylo.PrintingMenuGame();

        waveOutDevice = new WaveOut();

        ConsoleKeyInfo choice = Console.ReadKey();

        StringBuilder userNickname = new StringBuilder();

        if (choice.Key == ConsoleKey.D1)
        {
            Console.Clear();

            int currentColumn = 15;
            bool inputSuccess = true;
            var nickname = new List<ConsoleKeyInfo>();

            Dimitar.AskUserForNickname(ref currentColumn, ref inputSuccess, nickname);

            Console.ForegroundColor = ConsoleColor.White;

            Mariyan.DrawGameBoardLevelOne();
            Dimitar.StartCounter();

            InitDotsArray(1);

            waveOutDevice.Init(audioFileReader);
            waveOutDevice.Play();

            while (!endLevelOne)
            {
                Thread.Sleep(200);

                Ivaylo.MonsterNMovingLevelOne();
                Dimitar.MonsterIMovingLevelOne();
                Mariyan.MonsterDLevelOne();
                Antonina.monsterEMovingLevelOne();

                Georgi.RefreshScreen(badGuysCoordinates, Mariyan.wallsLevelOne);

                if (points >= 1280) //1280
                {
                    Thread.Sleep(1500);

                    endLevelOne = true;

                    currentLevel = 2;
                    break;
                }

                else if (endGame == false)
                {
                    Dimitar.AskUserToRestartLevelOne(waveOutDevice, audioFileReader);
                }
            }

            waveOutDevice.Stop();

            Dimitar.LevelTwoMessage();
            Console.ReadKey();

            Console.Clear();

            Console.ForegroundColor = ConsoleColor.White;

            Mariyan.DrawGameBoardLevelTwo();
            Dimitar.StartCounter();

            InitDotsArray(2);

            waveOutDevice.Init(audioFileReader);
            waveOutDevice.Play();

            monsterOneCounter = 0;
            monsterTwoCounter = 0;
            monsterThreeCounter = 0;
            monsterFourCounter = 0;

//.........这里部分代码省略.........
开发者ID:GAlex7,项目名称:TA,代码行数:101,代码来源:01.TheGame.cs

示例7: AskUserToRestartLevelTwo

    public static void AskUserToRestartLevelTwo(IWavePlayer waveOutDevice, AudioFileReader audioFileReader)
    {
        waveOutDevice.Stop();

        Console.Clear();

        Console.SetCursorPosition(5, 15);
        Console.Write("Do you want to RESTART");
        Console.SetCursorPosition(13, 16);
        Console.WriteLine("Y/N");

        var check = Console.ReadKey();

        Console.Clear();

        if (check.Key.ToString().ToLower() == "y")
        {
            Console.Clear();

            PackManHydra.monsterOneCounter = 0;
            PackManHydra.monsterTwoCounter = 0;
            PackManHydra.monsterThreeCounter = 0;
            PackManHydra.monsterFourCounter = 0;

            PackManHydra.points = 0;
            PackManHydra.lives = 3;
            PackManHydra.currentLevel = 2;

            Console.ForegroundColor = ConsoleColor.White;

            Mariyan.DrawGameBoardLevelTwo();
            Dimitar.StartCounter();

            PackManHydra.InitDotsArray(1);

            waveOutDevice.Init(audioFileReader);
            waveOutDevice.Play();

            PackManHydra.endGame = true;

            Georgi.RefreshScreen(PackManHydra.badGuysCoordinates, Mariyan.wallsLevelTwo);
        }
        else if (check.Key.ToString().ToLower() == "n")
        {
            Console.Clear();

            PackManHydra.monsterOneCounter = 0;
            PackManHydra.monsterTwoCounter = 0;
            PackManHydra.monsterThreeCounter = 0;
            PackManHydra.monsterFourCounter = 0;

            PackManHydra.points = 0;
            PackManHydra.lives = 3;
            PackManHydra.currentLevel = 1;

            PackManHydra.endGame = true;

            PackManHydra.endLevelOne = false;

            PackManHydra.returnFromLevelTwo = false;
            Console.Clear();

            PackManHydra.Main();
        }
    }
开发者ID:GAlex7,项目名称:TA,代码行数:65,代码来源:Dimitar.cs


注:本文中的IWavePlayer.Stop方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。