コード例 #1
2
 /// <summary>
 /// Erstellt eine neue Instanz von WMPlayer
 /// </summary>
 public WMPlayer()
 {
     _wmplayer = new WMPLib.WindowsMediaPlayer(); //Für den Media Player
     _playstatus = PlayStatus.Stop;
     Volume = 100; //Damit das Volume auf 100 ist
     Mute = false; //Damit es nicht stummgeschalten ist
 }
コード例 #2
0
ファイル: Form1.cs プロジェクト: florinbuda85/taskkiller
        private void playSong()
        {
            WMPLib.WindowsMediaPlayer wplayer = new WMPLib.WindowsMediaPlayer();

            wplayer.URL = "sound/alert.mp3";
            wplayer.controls.play();
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: taifonoc/TaifoTools
        private void Port_Box_TextChanged(object sender, EventArgs e)
        {
            if (comboBox1.Text == "MN (固定IP)" && Port_Box.Text != "" && Slot_Box.Text != "" && OnuID_Box.Text != "")
            {
                Cvlan_Box.Text = ((((int.Parse(Slot_Box.Text) - 1) * 4 + int.Parse(Port_Box.Text)) - 1) * 32 + (int.Parse(OnuID_Box.Text) - 1) + 1000).ToString();
            }
            if (comboBox1.Text == "MN (固定IP)")
            {
                if (Port_Box.Text == "" || Slot_Box.Text == "" || OnuID_Box.Text == "")
                {
                    Cvlan_Box.Text = "尚未填入完整Port位";
                }
            }

            if (Port_Box.Text != "")
            {
                if (int.Parse(Port_Box.Text) > 4)
                {
                    WMPLib.WindowsMediaPlayer wplayer = new WMPLib.WindowsMediaPlayer();
                    wplayer.URL = $@"{AppDomain.CurrentDomain.BaseDirectory}DATA/MIC02.mp3";
                    wplayer.controls.play();
                    MessageBox.Show("哇賽 你的OLT 超過4個Portㄝ");
                }
            }
        }
コード例 #4
0
ファイル: Form1.cs プロジェクト: taifonoc/TaifoTools
        // ====================================VIP按鈕====================================

        private void VIP_button_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "zong")
            {
                MessageBox.Show("Right!!");

                int Desktop = 0;
                Desktop = SystemParametersInfo(20, 1, $@"{AppDomain.CurrentDomain.BaseDirectory}DATA/PIC01.jpg");
            }
            else if (textBox1.Text == "yuqin")
            {
                WMPLib.WindowsMediaPlayer wplayer = new WMPLib.WindowsMediaPlayer();
                wplayer.URL = $@"{AppDomain.CurrentDomain.BaseDirectory}DATA/MIC04.mp3";
                wplayer.controls.play();
                MessageBox.Show("恭喜開通:一鍵開通功能!");
                auto_button.Visible  = true;
                richTextBox2.Visible = true;
            }


            else
            {
                WMPLib.WindowsMediaPlayer wplayer = new WMPLib.WindowsMediaPlayer();
                wplayer.URL = $@"{AppDomain.CurrentDomain.BaseDirectory}DATA/MIC01.mp3";
                wplayer.controls.play();
                MessageBox.Show("密碼提示:每個同事的英文名字都可能有不同效果");
            }
        }
コード例 #5
0
ファイル: AudioPlayer.cs プロジェクト: gantonious/game-stuffs
        public static void loadSound(string filename)
        {
            WMPLib.WindowsMediaPlayer player = new WMPLib.WindowsMediaPlayer();

            player.URL = filename;
            player.controls.play();
        }
コード例 #6
0
 private void listView1_SelectedIndexChanged(object sender, EventArgs e)
 {
     //listView1.FocusedItem.SubItems[0].Name
     WMPLib.WindowsMediaPlayer wplayer = new WMPLib.WindowsMediaPlayer();
     wplayer.URL = @"AUDIO\\" + listView1.FocusedItem.SubItems[0].Name + ".mp3";
     wplayer.controls.play();
 }
コード例 #7
0
ファイル: Player.cs プロジェクト: RockOwl/DoubanFMLocal
 public Player(CallbackMethodDelegate callbackPlay)
 {
     this.callbackPlay = callbackPlay;
     player = new WMPLib.WindowsMediaPlayer();
     player.PlayStateChange += new WMPLib._WMPOCXEvents_PlayStateChangeEventHandler(Player_PlayStateChange);
     Volume(30);
 }
コード例 #8
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (this.current != null)
            {
                this.current.controls.stop();
            }
            List <string> files = new List <string>();

            foreach (Control item in Controls)
            {
                if (item is Label)
                {
                    if (((Label)item).Text.Split(".".ToCharArray()).Length > 1)
                    {
                        files.Add(((Label)item).Text);
                    }
                }
            }
            files = random.Shuffle <string>(files);

            WMPLib.WindowsMediaPlayer s = new WMPLib.WindowsMediaPlayer();
            this.playlist  = files.ToArray();
            this.current   = s;
            timer2.Enabled = true;
            //Initializes file times
            this.playTime   = 0;
            this.currLength = SoundInfo.GetSoundLength(this.playlist[0]) / 1000;
            timer1.Enabled  = true;
        }
コード例 #9
0
        private void L_Click(object sender, EventArgs e)
        {
            timer2.Enabled = false;
            if (this.current != null)
            {
                this.current.controls.stop();
            }
            string file = ((Control)sender).Text;

            try
            {
                WMPLib.WindowsMediaPlayer s = new WMPLib.WindowsMediaPlayer();
                s.URL = file;
                s.controls.play();

                timer1.Enabled = true;
                //sets the global song playing varaibles
                this.current    = s;
                this.currLength = SoundInfo.GetSoundLength(file) / 1000;
                playTime        = 0;
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message);
            }
        }
コード例 #10
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (current == null)
            {
                return;
            }
            label2.Text = "currently playing:" + current.URL.Split("\\".ToCharArray())[current.URL.Split("\\".ToCharArray()).Length - 1].Split(".".ToCharArray())[0];
            //increasing current play time
            playTime += 0.1f;

            progressBar1.Value = (int)((playTime / (float)currLength) * MAX_PROGRESS_BAR);

            //sets progress bar text to the matching values
            //progressLabel.Text = TimeFormat((int)playTime) + "/" + TimeFormat(currLength);
            progressLabel.Text = ((int)playTime).ToString() + "/" + currLength.ToString();
            if (playTime > currLength)
            {
                current            = null;
                currLength         = 0;
                playTime           = 0;
                timer1.Enabled     = false;
                progressLabel.Text = "";
                playIndex++;
            }
        }
コード例 #11
0
ファイル: player.cs プロジェクト: xXDariusXx/Soundboard
 public void playSpam(string path)
 {
     WMPLib.WindowsMediaPlayer player = new WMPLib.WindowsMediaPlayer();
     player.URL = path;
     player.controls.play();
     spamPlayer.Add(player);
 }
コード例 #12
0
 private void PlayFile(String url)
 {
     Player = new WMPLib.WindowsMediaPlayer();
     Player.PlayStateChange += Player_PlayStateChange;
     Player.URL              = url;
     Player.controls.play();
 }
コード例 #13
0
        public void PlaySound(string file)
        {
            try
            {
                string format = GetAudioFormat(file);

                if (format == MP3)
                {
                    WMPLib.WindowsMediaPlayer wplayer = new WMPLib.WindowsMediaPlayer();
                    wplayer.URL = file;
                    wplayer.controls.play();
                }
                else if (format == WAV)
                {
                    SoundPlayer player = new SoundPlayer(file);
                    player.Play();
                }
                else
                {
                    log.Error("Cannot play sound, unkown file format.");
                }
            }
            catch (Exception ex)
            {
                log.Error("Failed to play success sound:", ex);
            }
        }
コード例 #14
0
ファイル: AudioNotifier.cs プロジェクト: utobe/QuickMon
 public static void PlayCustomSound(string audioFilePath, int volumePerc, int repeats)
 {
     if (audioFilePath.Length > 0 && System.IO.File.Exists(audioFilePath))
     {
         if (CheckWMPInstalled())
         {
             WMPLib.WindowsMediaPlayer wplayer = new WMPLib.WindowsMediaPlayer();
             if (volumePerc > -1)
             {
                 wplayer.settings.volume = volumePerc;
             }
             wplayer.settings.autoStart = false;
             wplayer.URL = audioFilePath;
             wplayer.controls.play();
             wplayer = null;
             if (repeats > 1)
             {
                 for (int i = 1; i < repeats; i++)
                 {
                     System.Threading.Thread.Sleep(500);
                     PlayCustomSound(audioFilePath, volumePerc, 1);
                 }
             }
         }
         else
         {
             throw new Exception("Notification cannot be raised! It appears Windows Media Player is not installed on this computer!");
         }
     }
 }
コード例 #15
0
        public Form1()
        {
            InitializeComponent();

            wmp = new WMPLib.WindowsMediaPlayer();
            browseBtn.Focus();
        }
コード例 #16
0
 public void SetTxt(String str)
 {
     textBox1.Text += str + Environment.NewLine;
     WMPLib.WindowsMediaPlayer player = new WMPLib.WindowsMediaPlayer();
     player.URL = "http://tts.baidu.com/text2audio?lan=zh&pid=101&ie=UTF-8&text=" + str + "&spd=9";
     player.controls.play();
 }//委托的操作,player并没有关闭
コード例 #17
0
        public StreamDeck(StreamDeckButton[] buttons)
        {
            if (Constants.ENABLE_BUTTON_CLICK)
            {
                this._buttonClickSound     = new WMPLib.WindowsMediaPlayer();
                this._buttonClickSound.URL = @"Assets\Sounds\button-click.mp3";
                this._buttonClickSound.controls.stop();
            }

            // only activate the timer if it's greater than zero
            if (Constants.BACK_TO_MAIN_TIMER_IN_SECONDS > 0)
            {
                this._backToMain          = new System.Timers.Timer();
                this._backToMain.Interval = (int)TimeSpan.FromSeconds(Constants.BACK_TO_MAIN_TIMER_IN_SECONDS).TotalMilliseconds;
                this._backToMain.Enabled  = true;
                this._backToMain.Elapsed += new System.Timers.ElapsedEventHandler(BackToMain);
            }

            this._streamDeck = StreamDeckSharp.StreamDeck.OpenDevice();

            this._streamDeckButtons = buttons;

            this._streamDeck.KeyStateChanged += this.ButtonClicked;

            this.DrawButtons();
        }
コード例 #18
0
        private void MessageCallBack(IAsyncResult aResult)
        {
            TextBox.CheckForIllegalCrossThreadCalls = false;
            try
            {
                byte[] RecivedData = new byte[Class1.j];
                RecivedData = (byte[])aResult.AsyncState;


                ASCIIEncoding aEncoding      = new ASCIIEncoding();
                string        RecivedMessage = aEncoding.GetString(RecivedData);
                string        decmessage     = dencryptus(RecivedMessage, key.Text.ToString());

                ListMessages.Items.Add(decmessage);
                string path = System.IO.Directory.GetCurrentDirectory() + @"\inchat.mp3";
                WMPLib.WindowsMediaPlayer wplayer = new WMPLib.WindowsMediaPlayer();
                wplayer.URL = path;
                wplayer.controls.play();
                buffer = new byte[1500];

                mySocket.BeginReceiveFrom(buffer, 0, buffer.Length, SocketFlags.None, ref epRemote, new AsyncCallback(MessageCallBack), buffer);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
コード例 #19
0
 public static void seslendirme(string sesyol)
 {
     WMPLib.WindowsMediaPlayer player = new WMPLib.WindowsMediaPlayer();
     player.URL = sesyol;
     player.controls.play();
     System.Threading.Thread.Sleep(1000);
 }
コード例 #20
0
 /// <summary>
 /// Creates a new instance of the WindowsMediaPlayer class and returns it.
 /// </summary>
 /// <param name="audioPath">The path of the audio file.</param>
 /// <returns>Instance of the WindowsMediaPlayer class </returns>
 public static WMPLib.WindowsMediaPlayer GetAudioPlayer(String audioPath)
 {
     WMPLib.WindowsMediaPlayer Player = new WMPLib.WindowsMediaPlayer();
     Player.MediaError += (o) => { MessageBox.Show("Unable to play audio notification.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); };
     Player.URL = audioPath;
     return Player;
 }
コード例 #21
0
        private void Nextsong()
        {
            WMPLib.WindowsMediaPlayer wmp = new WMPLib.WindowsMediaPlayer();

            //adds song from playlist to currently playling and creates the new playlist



            if (currentlyplayingBoolean == false)
            {
                currentlyplayingString = playlist[0];
                wmp.URL = applicationPath + "/media/" + currentlyplayingString;
                currentlyplayingBoolean  = true;                   //sets the boolean to true to inform the system that a song i currently being played
                PresentlyPlayTxtBox.Text = currentlyplayingString; //Adds the song first on the paylist to currently playing textbox and var

                PlayListBox.Items.RemoveAt(0);                     //Removes first item from playlist box

                // Now to remove the first item on the playlist and shift the elements up in the array

                int    count = 0;                              //used to count
                string check = "";                             //can be used to terminate loop when theres no more elements to shift up

                while (check != null)                          //loop until we come accross a null element in the next cell
                {
                    playlist[count]     = playlist[count + 1]; //copies the cell beneath
                    playlist[count + 1] = null;                //clears the cell beneath

                    count++;                                   //increment count
                    check = playlist[count + 1];               //change checker to next element in the list
                }
            }
        }
コード例 #22
0
ファイル: Messanger.cs プロジェクト: Aishaj/AGC.v3
        public void PlaySound(string file)
        {
            try
            {
                string format = GetAudioFormat(file);

                if (format == MP3)
                {
                    WMPLib.WindowsMediaPlayer wplayer = new WMPLib.WindowsMediaPlayer();
                    wplayer.URL = file;
                    wplayer.controls.play();
                }
                else if (format == WAV)
                {
                    SoundPlayer player = new SoundPlayer(file);
                    player.Play();
                }
                else
                {
                    log.Error("Cannot play sound, unkown file format.");
                }
            }
            catch (Exception ex)
            {
                log.Error("Failed to play success sound:", ex);
            }
        }
コード例 #23
0
 public WindowsMediaPlayer(string fileName)
 {
     wmPlayer = new WMPLib.WindowsMediaPlayer();
     FileName = fileName;
     wmPlayer.settings.autoStart = false;
     wmPlayer.URL = FileName;
 }
コード例 #24
0
        private void Audio(int x)
        {
            try {
                WMPLib.WindowsMediaPlayer AudioSet = new WMPLib.WindowsMediaPlayer();


                switch (x)
                {
                case 1:
                    AudioSet.URL = path + @"\dhanushka\mesg_ting.mp3";
                    AudioSet.controls.play();
                    Thread.Sleep(500);
                    break;

                case 2:
                    AudioSet.URL = path + @"\dhanushka\alerto.mp3";
                    AudioSet.controls.play();
                    Thread.Sleep(500);
                    break;

                case 3:
                    AudioSet.URL = path + @"\dhanushka\alert.mp3";
                    AudioSet.controls.play();
                    Thread.Sleep(500);
                    break;
                }
            } catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #25
0
ファイル: Form1.cs プロジェクト: smasher35/COVID-19-PT
 void PlaySound(String sound)
 {
     WMPLib.WindowsMediaPlayer Player;
     WMPLib.WindowsMediaPlayer winmp = new WMPLib.WindowsMediaPlayer();
     winmp.URL = sound;
     winmp.controls.play();
 }
コード例 #26
0
        private void button4_Click(object sender, EventArgs e)
        {
            //wav
            //SoundPlayer simpleSound = new SoundPlayer("https://www.majalisna.com/multimedia/408/208575-1275207271.wav");
            //simpleSound.Play();

            //  wav

            //or you can use embedded resource
            //SoundPlayer sndplayr = new
            //     SoundPlayer(Resources._1);
            //sndplayr.Play();

            //mp3
            //WMPLib.WindowsMediaPlayer wplayer = new WMPLib.WindowsMediaPlayer();

            //wplayer.URL = "114.mp3";
            //wplayer.controls.play();

            //or you can use online url
            // mp3
            WMPLib.WindowsMediaPlayer wplayer = new WMPLib.WindowsMediaPlayer();

            wplayer.URL = "https://server8.mp3quran.net/ahmad_huth/001.mp3";
            wplayer.controls.play();
        }
コード例 #27
0
ファイル: Form1.cs プロジェクト: Utsavk/predictive-dictionary
        private void button1_Click(object sender, EventArgs e)
        {
            WMPLib.WindowsMediaPlayer player = new WMPLib.WindowsMediaPlayer();

            player.URL = project_path + "\\audio\\" + word_searched + ".mp3";
            player.controls.play();
        }
コード例 #28
0
 public frmYouWin()
 {
     InitializeComponent();
     WMPLib.WindowsMediaPlayer player = new WMPLib.WindowsMediaPlayer();
     player.URL = "sound.mp3";
     player.controls.play();
 }
コード例 #29
0
        private async void frmMain_Load(object sender, EventArgs e)
        {
            // setup notification sounds
            this._notificationPlayer     = new WMPLib.WindowsMediaPlayer();
            this._notificationPlayer.URL = @"Assets\Sounds\notification.mp3";
            this._notificationPlayer.controls.stop();

            // load up the buttons
            this._streamDeckButtons = Settings.LoadButtons();

            // initialize the stream deck
            _streamDeck = new StreamDeck(this._streamDeckButtons);

            // create the notification object
            this._notification = new Notifications();

            // check to see if we have permission to access the notifications
            if (!(await this._notification.RequestAccess()))
            {
                throw new Exception("Unable to get notification access from user");
            }


            // setup the timer
            this._notificationCheckTimer          = new Timer();
            this._notificationCheckTimer.Interval = (int)TimeSpan.FromSeconds(Constants.CHECK_TIME_IN_SECONDS).TotalMilliseconds;
            this._notificationCheckTimer.Tick    += new EventHandler(CheckNotification);
            this._notificationCheckTimer.Start();

            // timer will execute every minute, so let's check notifications right on start up
            this.CheckNotification(null, null);
        }
コード例 #30
0
 public WordTestWindow()
 {
     InitializeComponent();
     YahooPlayer  = new WMPLib.WindowsMediaPlayer();
     GooglePlayer = new WMPLib.WindowsMediaPlayer();
     setTest();
 }
コード例 #31
0
ファイル: Form1.cs プロジェクト: Theodred/The-Veil
        public Veil()
        {
            InitializeComponent();
            WMPLib.WindowsMediaPlayer wplayer = new WMPLib.WindowsMediaPlayer();
            wplayer.URL = @"C:\Users\Theodred\Desktop\The Veil\Resources\soundtrack.mp3";
            wplayer.controls.play();
            this.BackColor       = Color.Black;
            this.Bounds          = Screen.PrimaryScreen.Bounds;
            this.FormBorderStyle = FormBorderStyle.None;
            this.WindowState     = FormWindowState.Maximized;

            label_Welcome.ForeColor = Color.White;

            label_Welcome.Location = new Point(x / 2 - label_Welcome.Size.Width / 2, 50);

            button_Start.Location = new Point(1 * x / 3 - 30 - button_Start.Size.Width, y - 100);
            //button_HowTo.Location = new Point(2 * x / 3 - 100 - button_HowTo.Size.Width, y - 100);
            button_AboutTheVeil.Location = new Point(3 * x / 3 - 100 - button_AboutTheVeil.Size.Width, y - 100);

            button_Start.BackColor = Color.Black;
            button_Start.ForeColor = Color.White;

            // button_HowTo.BackColor = Color.Black;
            //button_HowTo.ForeColor = Color.Red;

            button_AboutTheVeil.BackColor = Color.Black;
            button_AboutTheVeil.ForeColor = Color.White;

            panel_Welcome.BackColor = Color.Black;
            panel_Welcome.Location  = new Point(label_Welcome.Location.X - 50, label_Welcome.Location.Y + 200);
            panel_Welcome.Size      = new Size(label_Welcome.Location.X + label_Welcome.Size.Width - 100, button_AboutTheVeil.Location.Y - label_Welcome.Location.Y - 250);

            this.Focus();
        }
コード例 #32
0
ファイル: MainForm.cs プロジェクト: limura/PackterViewer
        void SeThreadMain()
        {
            for (int i = 0; i < ConfigReader.Instance.MaxSENum; i++)
            {
                WMPLib.WindowsMediaPlayer player = new WMPLib.WindowsMediaPlayer();
                if (player != null)
                {
                    player.settings.autoStart = true;
                    sePlayers.Add(player);
                }
            }

            while (true)
            {
                seMutex.WaitOne();
                List <string> playQueue = seQueue;
                seQueue = new List <string>();
                seMutex.ReleaseMutex();

                foreach (string file in playQueue)
                {
                    PlayAudioInThread(file);
                }
                System.Threading.Thread.Sleep(50);
            }
        }
コード例 #33
0
ファイル: PlayableTrack.cs プロジェクト: TheFizz/PFCB
 public void Play(int vol)
 {
     WMPLib.WindowsMediaPlayer wplayer = new WMPLib.WindowsMediaPlayer();
     wplayer.URL             = trackPath;
     wplayer.settings.volume = vol;
     wplayer.controls.play();
 }
コード例 #34
0
        public frmYouWin2(ref WMPLib.WindowsMediaPlayer player, bool mute, bool levelTwo, bool levelThree)
        {
            InitializeComponent();

            // set variables equal to parameters
            level2        = levelTwo;
            level3        = levelThree;
            muteForm      = mute;
            youWin2Player = player;

            if (muteForm == false)
            {
                // play the music
                winPlayer.URL = "YouWin.mp3";
                winPlayer.controls.play();
            }
            else
            {
                // stop the music
                winPlayer.controls.stop();
            }

            // set the level2 variable equal to true
            level2 = true;

            // set the level3 variable equal to true
            level3 = true;
        }
コード例 #35
0
 private void playSound(string filename)
 {
     this.wmediaplayer                 = new WMPLib.WindowsMediaPlayer();
     this.wmediaplayer.URL             = filename;
     this.wmediaplayer.settings.volume = 100;
     this.wmediaplayer.controls.play();
 }
コード例 #36
0
ファイル: MainForm.cs プロジェクト: bcc32/AlarmApp
 public MainForm()
 {
     InitializeComponent();
     soundFileDialog.InitialDirectory = System.Environment.GetFolderPath(Environment.SpecialFolder.MyMusic);
     challengeFileDialog.InitialDirectory = System.Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
     wmPlayer = new WMPLib.WindowsMediaPlayer();
     defaultPlaybackDevice = new CoreAudioController().DefaultPlaybackDevice;
 }
コード例 #37
0
 public static void Play()
 {
     WMPLib.WindowsMediaPlayer pssPss = new WMPLib.WindowsMediaPlayer();
     (pssPss.settings as WMPLib.IWMPSettings).setMode("loop", true);
     string filePath = Path.GetFullPath("daveDeath.wav");
     pssPss.URL = filePath;
    // pssPss.Play
 }
コード例 #38
0
        private void Speak_cmd()
        {
            string sound_url = iSpeechAPI.Synthesis(LearningItem.CurrentSub.Text);

            WMPLib.WindowsMediaPlayer wmp = new WMPLib.WindowsMediaPlayer();
            wmp.URL = sound_url;
            wmp.settings.volume = LearningItem.SpeechVolume;
            wmp.controls.play();
        }
コード例 #39
0
        public Accueil()
        {
            InitializeComponent();

            wplayer = new WMPLib.WindowsMediaPlayer();
            wplayer.URL = "H:/Bureau/Harmonition - Accueil/Harmonition - Accueil/FichiersAudio/ValleeGerudo.mp3";

            wplayer.controls.play();
        }
コード例 #40
0
ファイル: Form1.cs プロジェクト: WebDaD/MultiFileSorter
 public Form1()
 {
     InitializeComponent();
     myOps = new Options();
     mfiles = new List<mFile>();
     files = new List<string>();
     a = new WMPLib.WindowsMediaPlayer();
     a.OpenStateChange += new WMPLib._WMPOCXEvents_OpenStateChangeEventHandler(a_OpenStateChange);
 }
コード例 #41
0
 public MediaPlyr(string file)
 {
     InitializeComponent();
     this.Paint += new PaintEventHandler(MediaPlyr_Paint);
     #if !MONO
     mPlayer = new WMPLib.WindowsMediaPlayer();
     mPlayer.URL = file;
     #endif
     mName = Path.GetFileName(file);
 }
コード例 #42
0
ファイル: Program.cs プロジェクト: hulvei3/MusicStreamer
        public static void test2()
        {
            WMPLib.WindowsMediaPlayer player = new WMPLib.WindowsMediaPlayer();

            WMPLib.IWMPMedia media = player.newMedia("ftp://90.184.75.15/OpenShare/Music/Morten/Deadmau5/Random Album Title/07 I Remember.mp3");

            player.NewStream += new WMPLib._WMPOCXEvents_NewStreamEventHandler(player_NewStream);

            player.controls.playItem(media);
        }
コード例 #43
0
        public static void PlaySound(string soundfile)
        {
            WMPLib.WindowsMediaPlayer Player;

            Player = new WMPLib.WindowsMediaPlayer();
            Player.PlayStateChange +=
                new WMPLib._WMPOCXEvents_PlayStateChangeEventHandler(Player_PlayStateChange);
            Player.URL = soundfile;
            Player.controls.play();
        }
コード例 #44
0
        //contructor
        public CurrentSongViewModel(PlayerEngineModel playerModel)
        {
            _player = playerModel.MediaPlayer;
            _controls = _player.controls;

            IsPlaying = false;
            HasPlayed = false;

            PlayPauseCommand = new PlayPauseCommand(this);
            StopCommand = new StopCommand(this);
        }
コード例 #45
0
ファイル: MenuState.cs プロジェクト: john6tain/2D-RPG-OOP
 public MenuState()
 {
     Initialize();
     string da = Path.GetDirectoryName(Assembly.GetEntryAssembly().CodeBase);
     mplayer = new WMPLib.WindowsMediaPlayer();
         Directory.GetCurrentDirectory();
         mplayer.URL = Path.GetDirectoryName(Assembly.GetEntryAssembly().CodeBase) + @"\Content\songs\menu.mp3";
         mplayer.settings.setMode("loop", false);
        mplayer.controls.play();
     stopMenu = false;
 }
コード例 #46
0
ファイル: MusicPlayer.cs プロジェクト: grasmanek94/SE21
        /// <summary>
        /// Construct the Music Player
        /// </summary>
        public MusicPlayer()
        {
            artists = new List<Artist>();
            songs = new List<Song>();
            playlists = new List<Playlist>();

            wplayer = new WMPLib.WindowsMediaPlayer();

            currentlyPlaying = null;
            currentlyPlayingList = null;
        }
コード例 #47
0
ファイル: Player.cs プロジェクト: RockOwl/DoubanFMLocal
        public void Play(string path)
        {
            player.controls.stop();
            player.close();

            player = new WMPLib.WindowsMediaPlayer();
            player.PlayStateChange += new WMPLib._WMPOCXEvents_PlayStateChangeEventHandler(Player_PlayStateChange);

            player.URL = path;
            player.controls.play();
        }
コード例 #48
0
ファイル: XuLyAmthanh.cs プロジェクト: fordream/store-vnp
 private void definesound()
 {
     WindowsMediaPlayer1 = new WMPLib.WindowsMediaPlayer();
     WindowsMediaPlayer2 = new WMPLib.WindowsMediaPlayer();
     WindowsMediaPlayer3 = new WMPLib.WindowsMediaPlayer();
     WindowsMediaPlayer4 = new WMPLib.WindowsMediaPlayer();
     WindowsMediaPlayer5 = new WMPLib.WindowsMediaPlayer();
     WindowsMediaPlayer6 = new WMPLib.WindowsMediaPlayer();
     WindowsMediaPlayer7 = new WMPLib.WindowsMediaPlayer();
     WindowsMediaPlayer8 = new WMPLib.WindowsMediaPlayer();
 }
コード例 #49
0
ファイル: MainForm.cs プロジェクト: tgjones/software-sandbox
        private void MainForm_Load(object sender, EventArgs e)
        {
            // create media player object
            m_pMediaPlayer = new WMPLib.WindowsMediaPlayerClass();

            // get list of albums
            WMPLib.IWMPStringCollection lAlbums = m_pMediaPlayer.mediaCollection.getAttributeStringCollection("WM/AlbumTitle", "audio");
            lsbAlbums.BeginUpdate();
            for (int i = 0, length = lAlbums.count; i < length; i++)
            {
                lsbAlbums.Items.Add(lAlbums.Item(i));
            }
            lsbAlbums.EndUpdate();
        }
コード例 #50
0
ファイル: Program.cs プロジェクト: hulvei3/MusicStreamer
        public static void test1()
        {
            WMPLib.WindowsMediaPlayer player = new WMPLib.WindowsMediaPlayer();

            player.settings.autoStart = false;
            player.URL = @"C:\Users\Morten Hulvej\Desktop\07 I Remember.mp3";

            player.controls.play();

            for (int i = 10; i > 0; i--)
            {
                Console.WriteLine("Going to sleep for " + i + " seconds..");
                System.Threading.Thread.Sleep(1000);
            }
        }
コード例 #51
0
ファイル: SoundManager.cs プロジェクト: nkasozi/Nkujukira
 public static bool StopPlayingSound()
 {
     try
     {
         if (windows_media_player != null)
         {
             windows_media_player.controls.stop();
         }
         windows_media_player = null;
         return true;
     }
     catch (Exception)
     {
         return false;
     }
 }
コード例 #52
0
ファイル: SoundManager.cs プロジェクト: nkasozi/Nkujukira
        public static bool PlaySound()
        {
            try
            {
                if (windows_media_player == null)
                {
                    windows_media_player = new WMPLib.WindowsMediaPlayer();
                    windows_media_player.URL = ALARM_SOUND;
                    windows_media_player.settings.setMode(WMP_MODE, true);
                    windows_media_player.controls.play();
                    return true;
                }
            }
            catch (Exception)
            {

            }
            return false;
        }
コード例 #53
0
ファイル: Sounds.cs プロジェクト: UgotAlan/SET
        /// <summary>
        /// PlayRight method that takes boolean if mute option is enabled,
        /// and plays audio file if it is not.
        /// </summary>
        /// <param name="playing">boolean true/false</param>
        /// <returns>boolean true/false just for unit testing</returns> 
        public bool PlayRight(bool playing)
        {
            string directoryName = Path.GetDirectoryName(Directory.GetCurrentDirectory());
            directoryName = Path.GetDirectoryName(directoryName);
            directoryName = Path.GetDirectoryName(directoryName);
            directoryName = directoryName + "\\set_sounds\\right\\";
            var rand = new Random();
            var soundFiles = Directory.GetFiles(directoryName, "*wav");
            var playSound = soundFiles[rand.Next(0, soundFiles.Length)];

            var player = new WMPLib.WindowsMediaPlayer();

            if (playing == true)
            {
                player.URL = playSound;
                return true;
            }

            return false;
        }
コード例 #54
0
        public TetrisForm()
        {
            InitializeComponent();

            //stops panel flickering on redraw
            typeof(Panel).InvokeMember("DoubleBuffered",
                BindingFlags.SetProperty | BindingFlags.Instance | BindingFlags.NonPublic,
                null, tetrisPanel, new object[] { true });
            typeof(Panel).InvokeMember("DoubleBuffered",
                BindingFlags.SetProperty | BindingFlags.Instance | BindingFlags.NonPublic,
                null, previewShapePanel, new object[] { true });

            #region Variable_Initialization
            defaultBrush = new SolidBrush(Color.Blue);
            defaultPen = new Pen(Color.LimeGreen, 1);
            types = new char[] { 'L', 'J', 'S', 'Z', 'T', 'O', 'I' };
            grid = new bool[ROWS, COLS];
            fillBrushes = new Brush[ROWS, COLS];
            borderPens = new Pen[ROWS, COLS];
            points = 0;
            backgroundThemePlayer = new WMPLib.WindowsMediaPlayer();
            backgroundThemePlayer.URL = BACKGROUND_THEME_URL;
            backgroundThemePlayer.settings.setMode("Loop", true);
            backgroundThemePlayer.controls.stop();
            gamePlaying = false;
            futureShapes = new Queue<Tetromino>(SHAPES_TO_STORE);
            level = 0;
            rows = 0;
            #endregion

            StyleGUI();

            //InitializeTetrisPanel();

            SetupNewGame();
        }
コード例 #55
0
ファイル: Command.cs プロジェクト: oxydron/Vocals
		public void perform(IntPtr winPointer)
		{
			SetForegroundWindow(winPointer);
			ShowWindow(winPointer, 5);
			foreach (Actions a in actionList)
			{
				a.perform();
			}
			if (answering && answeringString != null)
			{
				try
				{
					SpeechSynthesizer synth = new SpeechSynthesizer();
					if (synth != null)
					{
						synth.SpeakAsync(answeringString);
					}
				}
				catch { }
			}

			if (answeringSound && answeringSoundPath != null)
			{
				if (answeringSoundPath.IndexOf(".wav") == answeringSoundPath.Length - 4)
				{
					System.Media.SoundPlayer player = new System.Media.SoundPlayer();
					player.SoundLocation = answeringSoundPath;
					player.Play();
				}
				else if (answeringSoundPath.IndexOf(".mp3") == answeringSoundPath.Length - 4)
				{
					WMPLib.WindowsMediaPlayer wplayer = new WMPLib.WindowsMediaPlayer();

					wplayer.URL = answeringSoundPath;
					wplayer.controls.play();
				}
			}
		}
コード例 #56
0
ファイル: SongPlayer.cs プロジェクト: shayak/UTalkIPlay
 public SongPlayer()
 {
     WPlayer = new WMPLib.WindowsMediaPlayer();
 }
コード例 #57
0
ファイル: musicCmd.cs プロジェクト: paulhemels/MceController
        public musicCmd(int i)
        {
            which_command = i;

            if (!init_run)
            {
                init_run = true;
                loadTemplate();
                if (Player == null) Player = new WMPLib.WindowsMediaPlayer();
            }
        }
コード例 #58
0
ファイル: Program.cs プロジェクト: rome2high/SearchandCopyMP3
        static void WalkDirectoryTree(System.IO.DirectoryInfo root)
        {
            System.IO.FileInfo[] files = null;
            System.IO.DirectoryInfo[] subDirs = null;

            WMPLib.WindowsMediaPlayer w = new WMPLib.WindowsMediaPlayer();

            try
            {
                files = root.GetFiles("*.*");
            }
            // This is thrown if even one of the files requires permissions greater
            // than the application provides.
            catch (UnauthorizedAccessException e)
            {
                log.Add(e.Message);
            }

            catch (System.IO.DirectoryNotFoundException e)
            {
                Console.WriteLine(e.Message);
            }

            if (files != null)
            {
                foreach (System.IO.FileInfo fi in files)
                {
                    if (fi.Extension.ToLower() == ".mp3")
                    {
                        Console.WriteLine(fi.FullName);
                        WMPLib.IWMPMedia m = w.newMedia(fi.FullName);
                        if (m != null || m.duration != null)
                        {
                            if (m.duration >= dblMinDuration)
                            {
                                sourceMp3Files.Add(fi);
                            }
                        }

                    }
                }

                // Now find all the subdirectories under this directory.
                subDirs = root.GetDirectories();

                foreach (System.IO.DirectoryInfo dirInfo in subDirs)
                {
                    // Resursive call for each subdirectory.
                    WalkDirectoryTree(dirInfo);
                }
            }

            w.close();
        }
コード例 #59
0
ファイル: Form1.cs プロジェクト: AG-Systems/DesktopApps
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            WMPLib.WindowsMediaPlayer wplayer = new WMPLib.WindowsMediaPlayer();

            OpenFileDialog open = new OpenFileDialog();
            if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                f = openFileDialog1.SafeFileNames;
                p = openFileDialog1.FileNames;
                for (int i = 0; i < f.Length; i++)
                {
                    listBox1.Items.Add(f[i]);
                }
                /*
                    foreach (string d in open.FileName)
                    {
                        listBox1.Items.Add(d);
                    }
                    */
            }
        }
コード例 #60
-1
        const string VideoFile = @"tohou.mp4"; // Bad apple!! original video (03:39 length)

        #endregion Fields

        #region Methods

        static void Main(string[] args)
        {
            var files = Directory.EnumerateFiles(ImagePath).ToList();
            var images = files.Select(File.ReadAllBytes).ToArray();

            WMPLib.WindowsMediaPlayer player = new WMPLib.WindowsMediaPlayer();
            player.settings.autoStart = false;
            player.settings.playCount = 1000;
            player.URL = VideoFile;
            Thread.Sleep(1000); // let wmp to finish all the loading shit

            var com = new System.IO.Ports.SerialPort(PortName, 115200, System.IO.Ports.Parity.None, 8, System.IO.Ports.StopBits.One);
            com.Open();

            int currentImage = 0;
            bool isPlaying = false;

            while (currentImage < images.Length)
            {
                com.ReadByte();

                if (!isPlaying)
                {
                    player.controls.play();
                    isPlaying = true;
                }

                var currentPosition = player.controls.currentPosition;

                currentImage = (int)(FPS * currentPosition);
                com.Write(images[Math.Min(currentImage, images.Length - 1)], 0, 504);
            }

            com.Close();
        }