public bool init() { m_player = new WMPLib.WindowsMediaPlayer(); IWMPSettings2 settings = (IWMPSettings2)m_player.settings; bool b = settings.requestMediaAccessRights("full"); if (!b) return b; m_media = m_player.mediaCollection; return true; }
static void Main(string[] args) { //create graphics object to pass to graphics class for any visuals Graphics graphObj = new Graphics(); WMPLib.WindowsMediaPlayer wplayer = new WMPLib.WindowsMediaPlayer(); wplayer.URL = @"C:\Users\RickB\Documents\Kennesaw\CS2350 Obj Orient Prog\CS2350_FinalProject_Team4\CS2350_FinalProject_Team4\Resources\(Disc 2) 03 - Let's Get It On (2003 Remaster Album Version).wav"; wplayer.controls.play(); //set console size and basic attributes Graphics.ConsoleBasics(); Graphics.ConsoleIntro(); //send to opening sequence animation Graphics.HeartsMoving(); //call client object Client currentClient = new Client(); //send client object to compatability class Compatability compare = new Compatability(currentClient.CurrentClient); } //close main
private void listBox1_MouseDoubleClick(object sender, MouseEventArgs e) { if (wplayer == null) { wplayer = new WMPLib.WindowsMediaPlayer(); wplayer.URL = listBox1.Text; label5.Text = wplayer.settings.volume.ToString(); wplayer.PlayStateChange += new WMPLib._WMPOCXEvents_PlayStateChangeEventHandler(wplayer_PlayStateChange); } musplay = !musplay; if (musplay || listBox1.SelectedItem != listBox1.SelectedItem) { button2.Text = "Playing"; wplayer.controls.play(); wplayer.settings.volume = 5; label4.Text = wplayer.currentMedia.getItemInfo("Title"); label2.Text = wplayer.currentMedia.durationString; timer1.Start(); } else { button2.Text = "Paused"; wplayer.controls.stop(); wplayer = null; timer1.Stop(); } }
public PlayerModel() { if (Player == null) { Player = new WindowsMediaPlayer(); } }
public WordFillGame() { InitializeComponent(); play = new WMPLib.WindowsMediaPlayer(); play1 = new WMPLib.WindowsMediaPlayer(); luotChoi = 2; }
private void playBack() { String path = dirs[listBox1.SelectedIndex]; List <String> songs = new List <String>(Directory.GetFiles(path)); wplayer = new WMPLib.WindowsMediaPlayer(); WMPLib.IWMPMedia wt; listBox2.Items.Clear(); foreach (String song in songs) { if (song.Contains(".png") || song.Contains(".jpg") || song.Contains(".jpeg") || song.Contains(".ico")) { pictureBox2.Image = Image.FromFile(song); } if (song.Contains(".mp3") || song.Contains(".flac") || song.Contains(".wav") || song.Contains(".alac")) { wt = wplayer.newMedia(song); wplayer.currentPlaylist.appendItem(wt); listBox2.Items.Add(Path.GetFileName(song)); } } wplayer.controls.play(); wplayer.settings.volume = axSlider1.Value; timer2.Enabled = true; }
public Form1() { WMPLib.WindowsMediaPlayer Player; void PlayFile(String url) { Player = new WMPLib.WindowsMediaPlayer(); Player.PlayStateChange += new WMPLib._WMPOCXEvents_PlayStateChangeEventHandler(Player_PlayStateChange); Player.MediaError += new WMPLib._WMPOCXEvents_MediaErrorEventHandler(Player_MediaError); Player.URL = url; Player.controls.play(); } void Form1_Load(object sender, System.EventArgs e) { // TODO Insert a valid path in the line below. PlayFile(@"c:/music/Commercial.mp3"); } void Player_PlayStateChange(int NewState) { if ((WMPLib.WMPPlayState)NewState == WMPLib.WMPPlayState.wmppsStopped) { this.Close(); } } void Player_MediaError(object pMediaObject) { MessageBox.Show("Cannot play media file."); this.Close(); } }
private void initMusic() { WMPLib.WindowsMediaPlayer wplayer = new WMPLib.WindowsMediaPlayer(); wplayer.URL = @"http://s3rvhub.co.uk/s3rver/gamepack/music/intro1.mp3";// For Local - "C:\Users\Natha\source\repos\ProjectDestiny\ProjectDestiny\Data\Media\Music\Haywrye1.mp3"; wplayer.controls.play(); }
//la apasarea butonului "Incepe testul" se deschide o fereastra noua private void button1_Click(object sender, EventArgs e) { WMPLib.WindowsMediaPlayer sunet = new WMPLib.WindowsMediaPlayer(); sunet.URL = "music.mp3"; sunet.controls.play(); string sir; sir = (textBox1.Text).ToString(); //se actualizeaza N ca numaru de intrebari din test, preluat din textBox Boolean checkNumber = false; if (Int32.TryParse(textBox1.Text, out N)) { N = int.Parse(sir); checkNumber = true; f2.ShowDialog(); return; } else { MessageBox.Show("Ai introdus un numar invalid!\n" + "Incearca sa introduci numar de intrebari din intervalul 1-45 :)"); } }
void EjecutarSonido() { WMPLib.WindowsMediaPlayer wplayer = new WMPLib.WindowsMediaPlayer(); wplayer.URL = "C:\\1.wav"; wplayer.controls.play(); }
private void f_bg_music() { bg_music_on = true; int utwor; int x = rnd.Next(0, 3); bool powtarza = true; while (powtarza == true) { powtarza = false; try { if (x == 0) { utwor = rnd.Next(0, pliki_fortepian.Count()); odtworz(pliki_fortepian[utwor]); prev_open = (fortepian.Controls[utwor] as PictureBox); } else if (x == 1) { utwor = rnd.Next(0, pliki_orkiestra.Count()); odtworz(pliki_orkiestra[utwor]); prev_open = (orkiestra.Controls[utwor] as PictureBox); } else if (x == 2) { utwor = rnd.Next(0, pliki_wokal.Count()); odtworz(pliki_wokal[utwor]); prev_open = (wokal.Controls[utwor] as PictureBox); } } catch { powtarza = true; x = rnd.Next(0, 3); } } }
private void btnClear_Click(object sender, EventArgs e) //Hàm xóa toàn bộ dữ liệu người chơi. { if (File.Exists("dat\\score.txt")) { DialogResult res = MessageBox.Show("This will destroy all existing records.", "Are you sure?", MessageBoxButtons.YesNo); if (res == DialogResult.Yes) { FileInfo score = new FileInfo("dat\\score.txt"); score.IsReadOnly = false; File.Delete("dat\\score.txt"); this.Close(); if (!IsSound) //Nếu người dùng không tắt âm thanh, IsSound trả về false. Khi này, hệ thống phát âm thanh // "đốt giấy" để mô phỏng người dùng xóa dữ liệu, hay "đốt hết văn bản" { WMPLib.WindowsMediaPlayer burn = new WMPLib.WindowsMediaPlayer(); burn.URL = "sounds\\burn.wav"; burn.controls.play(); } } } else { MessageBox.Show("There are no archives to burn!"); } }
public void PlayFile(String url) { Player = new WMPLib.WindowsMediaPlayer(); Player.MediaError += new WMPLib._WMPOCXEvents_MediaErrorEventHandler(Player_MediaError); Player.URL = url; Player.controls.play(); }
private void STARTSOUND1(string url) { STARTSOUNDFIRST = new WMPLib.WindowsMediaPlayer(); STARTSOUNDFIRST.URL = url; STARTSOUNDFIRST.controls.play(); STARTSOUNDFIRST.settings.volume = 5; }
private void PlayFile(object sender, EventArgs e) { try { if (wplayer == null) { wplayer = new WMPLib.WindowsMediaPlayer(); wplayer.URL = listBox1.Text; wplayer.PlayStateChange += new WMPLib._WMPOCXEvents_PlayStateChangeEventHandler(wplayer_PlayStateChange); } musplay = !musplay; if (musplay) { button2.Text = "Playing"; wplayer.controls.play(); wplayer.settings.volume = 5; label4.Text = wplayer.currentMedia.getItemInfo("Title"); label2.Text = wplayer.currentMedia.durationString; timer1.Start(); } else { wplayer.controls.pause(); button2.Text = "Paused"; timer1.Stop(); } } catch { label4.Text = "Invalid action"; } }
private static void PlaySound() { ThreadPool.QueueUserWorkItem( { WMPLib.WindowsMediaPlayer player = new WMPLib.WindowsMediaPlayer(); player.URL = "song.mps"; }
public void playPodcast(string path) { WMPLib.WindowsMediaPlayer wplayer = new WMPLib.WindowsMediaPlayer(); wplayer.windowlessVideo = true; wplayer.URL = path; wplayer.openPlayer(path); }
private void SpeakerCute2(string url) { FS2 = new WMPLib.WindowsMediaPlayer(); FS2.URL = url; FS2.controls.play(); FS2.settings.volume = 150; }
private void SpeakerCute1(string url) { FS1 = new WMPLib.WindowsMediaPlayer(); FS1.URL = url; FS1.controls.play(); FS1.settings.volume = 20; }
private void playMusic_Click(object sender, EventArgs e) { int latnr = 2; WMPLib.WindowsMediaPlayer wplayer = new WMPLib.WindowsMediaPlayer(); axWindowsMediaPlayer1.URL = (@"C:\Users\david\source\repos\RSSReader\RSSReader\bin\Debug\xmlfil\podmusik" + latnr + ".mp3"); //lokal musikfil i lokal mapp startaMusik.controls.play(); }
private void PlayFile(string url) { Player = new WMPLib.WindowsMediaPlayer(); Player.URL = url; Player.controls.play(); Player.settings.setMode("loop", true); Player.settings.volume = 5; }
public void play(int i) { this.wplayer = new WMPLib.WindowsMediaPlayer(); this.wplayer.PlayStateChange += new WMPLib._WMPOCXEvents_PlayStateChangeEventHandler(wplayer_PlayStateChange); this.wplayer.URL = listMusics[i].getPath(); this.wplayer.settings.volume = this.tb.Value; this.wplayer.controls.play(); }
public SoundControl() { sound = new SoundPlayer(); mainSound = new WMPLib.WindowsMediaPlayer(); mainSound.URL = "1.mp3"; mainSound.settings.setMode("loop", true); sound.SoundLocation = "2.wav"; }
private void StartSound(string url) { Start = new WMPLib.WindowsMediaPlayer(); Start.URL = url; Start.controls.play(); Start.settings.setMode("loop", false); Start.settings.volume = 40; }
private void Form1_Load(object sender, EventArgs e) { //Add music when form is opened //Before adding that go to toolbox-->Chose Item ---> COM--->Windows Media Player WMPLib.WindowsMediaPlayer wplayer = new WMPLib.WindowsMediaPlayer(); wplayer.URL = @"C:\Users\Kaneez Fatima\Downloads\huawei_sms.mp3"; wplayer.controls.play(); }
private void Start_MouseClick(object sender, MouseEventArgs e) { WMPLib.WindowsMediaPlayer wplayer = new WMPLib.WindowsMediaPlayer(); wplayer.URL = @"C:\Users\Piotr\Documents\Visual Studio 2015\Projects\Snake\Snake\Wygrana1.mp3"; wplayer.controls.play(); // <-- dziala bez this.Close() this.Close(); }
public Player() : base() { _wmp = new WMPLib.WindowsMediaPlayer(); _wmp.PlayStateChange += new _WMPOCXEvents_PlayStateChangeEventHandler(_wmp_PlayStateChange); //Load(Environment.CurrentDirectory); }
public MusicDriver() { //wplayer.PlayStateChange += new WMPLib._WMPOCXEvents_PlayStateChangeEventHandler(ThreadedTask); wplayer = new WMPLib.WindowsMediaPlayer(); wplayer.PlayStateChange += new WMPLib._WMPOCXEvents_PlayStateChangeEventHandler(PlayerEventHandler); wplayer.MediaError += new WMPLib._WMPOCXEvents_MediaErrorEventHandler(Error); }
public Form1() { InitializeComponent(); WMPLib.WindowsMediaPlayer wplayer = new WMPLib.WindowsMediaPlayer(); wplayer.URL = @"C:\Users\sai\Desktop\abhi\bm.mp3"; wplayer.Controls.Play(); }
public void InitializePlayer() { if (!IsInitialized) { Player = new WindowsMediaPlayer(); IsInitialized = true; PlayedTrack = false; } }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. SpriteBatch = new SpriteBatch(GraphicsDevice); WMPLib.WindowsMediaPlayer wplayer = new WMPLib.WindowsMediaPlayer(); wplayer.URL = "Content/MinstrelGuild.mp3"; wplayer.controls.play(); }
public void Dong(string buf) { if (Filter(buf).Contains("!Dong")) { //new SoundPlayer(@"Sounds\WTD.wav").Play(); .WAV WMPLib.WindowsMediaPlayer a = new WMPLib.WindowsMediaPlayer(); //.mp3 a.URL = @"Sounds\WTD.mp3"; a.controls.play(); } }
public static void Play(string songRelPath) { if (m_isPlaying) { Stop(); m_player.close(); } m_player = new WMPLib.WindowsMediaPlayer(); var filePath=Path.Combine(m_songsBaseLibary, songRelPath); if (!File.Exists(filePath)) { throw new FileNotFoundException("File " + filePath + " doesn't exist"); } m_player.URL = filePath; m_player.controls.play(); m_isPlaying = true; }
SquareView[,] squares; /*!< Tableau a deux dimensions des vues des cases */ #endregion Fields #region Constructors /*! * \fn MainGame() * \brief Constructeur standard de la vue du jeu * \return */ public MainGame() { wplayer = new WMPLib.WindowsMediaPlayer(); InitializeComponent(); controller = new Controller.Controller(this); log = new LogView(this); App.wrapper.setObserver(this); InitializeTabs(); InitializeGameGrid(); InitializePlayersView(); MouseMove += onShootMouseMove; MouseUp += onShootMouseUp; shootLine = new Line(); ShowCurrentPlayer(); animateBackground(); var path = System.IO.Path.Combine( System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) , "sounds/theme.mp3"); wplayer.URL = path; wplayer.controls.play(); wplayer.PlayStateChange += new _WMPOCXEvents_PlayStateChangeEventHandler(player_PlayStateChange); }
//contructor public CurrentSongViewModel(PlayerEngineModel playerModel) { _player = playerModel.MediaPlayer; init(); }
public void Dispose() { bool isEnabled = this.bufferingTimer == null; if (!isEnabled) { this.bufferingTimer.Tick -= new EventHandler(this.BufferingTimerTick); } this.bufferingTimer = null; isEnabled = !this.positionTimer.IsEnabled; if (!isEnabled) { this.positionTimer.Stop(); } this.positionTimer.Tick -= new EventHandler(this.PositionTimerTick); this.positionTimer = null; isEnabled = this.playerObject == null; if (!isEnabled) { playerObject.MediaError += playerObject_MediaError; playerObject.Buffering += playerObject_Buffering; playerObject.MediaChange += playerObject_MediaChange; playerObject.PlayStateChange += playerObject_PlayStateChange; this.playerObject.close(); } this.playerObject = null; }
/// <summary> /// Returns a collection of Song objects from the Windows Media Player library. /// </summary> /// <returns></returns> public static IEnumerable<WmpSong> GetSongsFromLibrary() { WMPLib.WindowsMediaPlayer wmp = new WMPLib.WindowsMediaPlayer(); IWMPMediaCollection media = wmp.mediaCollection; IWMPPlaylist pList = media.getAll(); for (int i = 0; i < pList.count; i++) { IWMPMedia item = pList.get_Item(i); WmpSong currentSong = new WmpSong(); if (item.getItemInfo("CanonicalFiletype") == "mp3") { foreach (LibraryField libField in Enum.GetValues(typeof(LibraryField))) { string attrName; switch (libField) { case LibraryField.AlbumTitle: { attrName = "WM/AlbumTitle"; currentSong.AlbumTitle = item.getItemInfo(attrName); break; } case LibraryField.ArtistName: { attrName = "WM/AlbumArtist"; currentSong.ArtistName = item.getItemInfo(attrName); break; } case LibraryField.CollectionId: { attrName = "WM/WMCollectionID"; currentSong.WmCollectionId = item.getItemInfo(attrName); break; } case LibraryField.DateAdded: { attrName = "AcquisitionTime"; string dateAddedStr = item.getItemInfo(attrName); //Convert from UTC time DateTime utcDateAdded = DateTime.SpecifyKind(DateTime.Parse(dateAddedStr), DateTimeKind.Utc); currentSong.DateAdded = utcDateAdded.ToLocalTime(); break; } case LibraryField.Duration: { attrName = "Duration"; currentSong.Duration = double.Parse(item.getItemInfo(attrName)); break; } //TODO: Add Label support! case LibraryField.LastPlayed: { attrName = "UserLastPlayedTime"; string lastPlayedStr = item.getItemInfo(attrName); if (!string.IsNullOrEmpty(lastPlayedStr)) { //Convert from UTC time DateTime utcLastPlayed = DateTime.SpecifyKind(DateTime.Parse(lastPlayedStr), DateTimeKind.Utc); currentSong.LastPlayed = utcLastPlayed.ToLocalTime(); } break; } case LibraryField.ReleaseDate: { attrName = "ReleaseDate"; string releaseDateStr = item.getItemInfo(attrName); if (!string.IsNullOrEmpty(releaseDateStr)) currentSong.ReleaseDate = DateTime.Parse(releaseDateStr).Date; break; } case LibraryField.SongTitle: { attrName = "Title"; currentSong.SongTitle = item.getItemInfo(attrName); break; } case LibraryField.SongTrackingId: { attrName = "TrackingID"; currentSong.SongTrackingId = item.getItemInfo(attrName); break; } case LibraryField.SourceUrl: { attrName = "SourceURL"; currentSong.SourceUrl = item.getItemInfo(attrName); break; } case LibraryField.TrackNumber: { attrName = "WM/TrackNumber"; currentSong.TrackNumber = int.Parse(item.getItemInfo(attrName)); break; } default: continue; } } yield return currentSong; } } }
private void timer1_Tick(object sender, EventArgs e) { seconds--; if (seconds == -1) { MinutesBox.ReadOnly = false; SecondsBox.ReadOnly = false; SetColor(Color.ForestGreen); timer1.Stop(); } else { if (seconds == 0) { SetColor(Color.Maroon); WMPLib.WindowsMediaPlayer wmp = new WMPLib.WindowsMediaPlayer(); wmp.URL = @"End.wav"; wmp.controls.play(); Console.ReadLine(); } else if (seconds <= 10) { SetColor(Color.Chocolate); } else { SetColor(Color.ForestGreen); } SetTimeBoxNumber(seconds); } }
private PlayerWrapper() { Player = new WindowsMediaPlayer(); Player.settings.volume = 50; }
private void mainForm_Shown(object sender, EventArgs e) { //morhpeus font for prettier labels. not mandatory //MorpheusFont morpheusFont = new MorpheusFont(); //morpheusFont.Load(); //playButtonLabel.Font = new Font(morpheusFont.fontFamily(), 12, FontStyle.Regular); settingsFile.Read(); if (settingsFile.startUpSound() == true) { WMPLib.WindowsMediaPlayer player = new WMPLib.WindowsMediaPlayer(); player.URL = @Directory.GetCurrentDirectory() + "\\sound\\startup.mp3"; player.controls.play(); } //change control properties on runtime //upArrowPicture.Parent = newsTextLabel; //upArrowPicture.Location = new Point(436, -2); //downArrowPicture.Parent = newsTextLabel; //downArrowPicture.Location = new Point(436, 73); trayIcon.BalloonTipTitle = "TrueWoW Launcher"; trayIcon.BalloonTipText = "Launcher minimized to tray. Right click icon for menu."; if (settingsFile.minimizeToTray() == true) { trayIcon.Visible = true; } else { trayIcon.Visible = false; } #region BLP-TEST //try //{ // if (this.blpLoader != null) // { // this.blpLoader.close(); // this.blpLoader = null; // } // FileStream file = new FileStream("example.blp", FileMode.Open); // this.blpLoader = new SereniaBLPLib.BlpFile(file); // // loading bitmap level 0 // loadedBLP = this.blpLoader.getBitmap(0); // Rectangle imgDimensions = new Rectangle(); // imgDimensions.Location = new Point(50, 15); // imgDimensions.Width = 155; // imgDimensions.Height = 32; // playButtonBitmap = loadedBLP.Clone(imgDimensions, loadedBLP.PixelFormat); // playButton.Image = playButtonBitmap; // if (this.blpLoader != null) // { // this.blpLoader.close(); // this.blpLoader = null; // } // file.Close(); // file = new FileStream("Glues-BigButton-Glow.blp", FileMode.Open); // this.blpLoader = new SereniaBLPLib.BlpFile(file); // loadedBLP = this.blpLoader.getBitmap(0); // imgDimensions = new Rectangle(); // imgDimensions.Location = new Point(43, 7); // imgDimensions.Width = 170; // imgDimensions.Height = 50; // playButtonBitmap = loadedBLP.Clone(imgDimensions, loadedBLP.PixelFormat); // playButtonHoover.Image = playButtonBitmap; //} //catch (FileNotFoundException fe) //{ // MessageBox.Show("The 'example.blp' was not found!"); //} #endregion //read data inside zip ZipStorer newsZIP = ZipStorer.Open(@Directory.GetCurrentDirectory() + "\\news\\news.zip", FileAccess.Read); // Read all directory contents List<ZipStorer.ZipFileEntry> dir = newsZIP.ReadCentralDir(); // Extract all files in target directory string path; bool result; foreach (ZipStorer.ZipFileEntry entry in dir) { path = Path.Combine(@Directory.GetCurrentDirectory() + "\\news\\", Path.GetFileName(entry.FilenameInZip)); result = newsZIP.ExtractFile(entry, path); } newsZIP.Close(); this.Refresh(); readedNews.Read(); for (int i = 0; i < readedNews.newsCount(); i++) { Label tmpControl = new Label(); if (i == 0) { tmpControl.BackColor = System.Drawing.Color.Aqua; } else { tmpControl.BackColor = System.Drawing.Color.Gray; } tmpControl.Cursor = System.Windows.Forms.Cursors.Hand; tmpControl.Name = "newsSelector" + i.ToString(); //tmpControl. = "newsSelector" + i.ToString(); tmpControl.Size = new System.Drawing.Size(10, 10); tmpControl.Click += new System.EventHandler(this.newsSelectorSelected_Click); this.Controls.Add(tmpControl); tmpControl.Parent = this.newsPicture; tmpControl.Location = new System.Drawing.Point((3 + (i * 16)), 3); newsSelector.Add(tmpControl); } newsPicture.ImageLocation = @Directory.GetCurrentDirectory() + "\\news\\" + readedNews.newsImg(0); newsTittleLabel.Text = readedNews.newsTittle(0); newsTextLabel.Text = readedNews.newsText(0); newsSelectorHistory = 0; newsLoopWorker.RunWorkerAsync(); }
static Player() { queue = new ConcurrentQueue<Song>(); wmp = new WMPLib.WindowsMediaPlayer(); wmp.PlayStateChange += new _WMPOCXEvents_PlayStateChangeEventHandler(wmp_PlayStateChange); }
protected override string ExecuteOrder(string param = null) { int songalias_beginindex = param.IndexOf(keyword) + keyword.Length; string songalias = param.Substring(songalias_beginindex); try { WMPLib.WindowsMediaPlayer wplayer = new WMPLib.WindowsMediaPlayer(); string path = Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath) + "\\"; string songname; bool songalias_exist = true; // if songalias isn't exist then variable will be toggled in switch instruction switch (songalias) { case song_cantina: songname = "Star Wars - Cantina.mp3"; break; case song_CSI: songname = "The who - Won't get fooled again.mp3"; break; default: { songalias_exist = false; songname = ""; } break; } if (songalias_exist) wplayer.URL = path + songname; wplayer.controls.play(); } catch (Exception e) { return e.Message; } return null; }
private void OnGoOffline(object sender, EventArgs e) { if (!streamIsOnline) return; Debug.Print("OnGoOffline event"); SendMessage(new UbiMessage(String.Format("Twitch: STREAM OFFLINE!"), EndPoint.TwitchTV, EndPoint.Notice)); if (settings.globalEnableSounds) { try { WindowsMediaPlayer a = new WMPLib.WindowsMediaPlayer(); a.URL = settings.globalSoundOfflineFile; a.controls.play(); var counter = 0; while (a.playState == WMPPlayState.wmppsPlaying) { counter++; if (counter > 300) break; Thread.Sleep(10); } } catch { Debug.Print("Exception in OnGoOffline()"); } } if (settings.gohaStreamControl) { if (gohaTVstream.LoggedIn) { if (gohaTVstream.StreamStatus == "on") { if (streamIsOnline) { SendMessage(new UbiMessage(String.Format("Goha: Stream switched off!"), EndPoint.TwitchTV, EndPoint.Notice)); gohaTVstream.SwitchStream(); } } } } if (settings.sc2StreamAutoSwitch) { if (sc2tv.LoggedIn) { if (sc2tv.ChannelIsLive) { sc2tv.setLiveStatus(false); if (!sc2tv.ChannelIsLive) { SendMessage(new UbiMessage(String.Format("Sc2Tv: Stream switched off (Twitch stream went offline)!"), EndPoint.Sc2Tv, EndPoint.Notice)); streamStatus.SetOff(pictureSc2tvStream); } else { throw new Exception("Sc2tv stream wasn't switched! Do it manually!"); } } } } streamStatus.SetOff(pictureStream); streamIsOnline = false; }
private void PlayFile() { Player = new WMPLib.WindowsMediaPlayer(); Player.PlayStateChange += new WMPLib._WMPOCXEvents_PlayStateChangeEventHandler(Player_PlayStateChange); Player.MediaError += new WMPLib._WMPOCXEvents_MediaErrorEventHandler(Player_MediaError); Random random = new Random(); idAudio = Convert.ToInt32(random.Next(1, 3).ToString()); switch (idAudio) { case 1: Player.URL = "C:\\VideoIndaiatuba\\audio1.mp3"; break; case 2: Player.URL = "C:\\VideoIndaiatuba\\audio2.mp3"; break; default: Player.URL = "C:\\VideoIndaiatuba\\audio1.mp3"; break; } Player.controls.play(); }
internal void LoadMusicInTable(List<string> songs) { try { isPlaying = false; PlayButton.BackgroundImage = Pimung.Properties.Resources.playButton2; nowPlaying.Text = ""; elapsedTime.Text = "00:00"; totalTime.Text = "00:00"; fullOval.Width = 0; if (bwMusic.IsBusy) bwMusic.CancelAsync(); if (bwMusic2.IsBusy) bwMusic2.CancelAsync(); if (songPlayed != -1) { MusicToTable[songPlayed].PlayStateChange -= new WMPLib._WMPOCXEvents_PlayStateChangeEventHandler(OnPlayStateChange); aTimer.Elapsed -= new ElapsedEventHandler(OnTimedEvent); MusicToTable[songPlayed].settings.setMode("loop", false); MusicToTable[songPlayed].controls.stop(); songPlayed = -1; } MusicToTable.Clear(); amount = songs.Count; int numberOfRows = songGrid.Rows.Count; for (int j = 0; j < numberOfRows; j++) { songGrid.Rows.Remove(songGrid.Rows[0]); } for (int i = 0; i < songs.Count; i++) { WMPLib.WindowsMediaPlayer song = new WMPLib.WindowsMediaPlayer(); MusicToTable.Add(song); MusicToTable[i].URL = songs[i]; MusicToTable[i].settings.mute = true; MusicToTable[i].PlayStateChange += new WMPLib._WMPOCXEvents_PlayStateChangeEventHandler(AddMusicInTable); } } catch (Exception ext) { MessageBox.Show("Something went wrong :( Are you sure that you haven't changed the files' path? The following exception occurred: " + ext); } }
static int playing(string source, bool playlistMode) { //enables drag and drop if (source.Contains("\"")) { source = source.Replace("\"", ""); } //music player - check if .mp3 or .wav file; error if not, play song if otherwise if ((source.Contains(".mp3") || source.Contains(".wav")) && File.Exists(source)) { WMPLib.WindowsMediaPlayer wplayer = new WMPLib.WindowsMediaPlayer(); string position; ConsoleKeyInfo input; wplayer.URL = source; wplayer.controls.stop(); wplayer.controls.play(); wplayer.settings.volume = 50; //loop for the player controls bool loop = true; while (loop == true) { if (playlistMode == false) //prints different screents for playlist mode <- needs to be better done, without the massive printing { while (Console.KeyAvailable == false) { printlogo(); Console.WriteLine("Now playing: {0}", Path.GetFileNameWithoutExtension(source)); Console.WriteLine("Volume: {0}", wplayer.settings.volume); position = wplayer.controls.currentPositionString; //timer Console.WriteLine("\n{0}\n", position); Console.WriteLine("Up/Down - Volume control"); Console.WriteLine("P - Pause"); Console.WriteLine("S - Stop"); Console.WriteLine("Backspace - Return to main menu"); Thread.Sleep(500); //refresh } } else { while (Console.KeyAvailable == false) { printlogo(); //Console.WriteLine("Playlist: {0}", Program.playPList.input); // <- This part doesn't work, needs to be fixed Console.WriteLine("Now playing: {0}", Path.GetFileNameWithoutExtension(source)); Console.WriteLine("Volume: {0}", wplayer.settings.volume); position = wplayer.controls.currentPositionString; //timer Console.WriteLine("\n{0}\n", position); Console.WriteLine("Up/Down - Volume control"); Console.WriteLine("P - Pause"); Console.WriteLine("S - Skip song"); Console.WriteLine("Backspace - Return to main menu"); Thread.Sleep(500); //refresh } } input = Console.ReadKey(); //read key input if (input.Key == ConsoleKey.UpArrow) //volume up { wplayer.settings.volume += 1; } else if (input.Key == ConsoleKey.DownArrow) //volume down { wplayer.settings.volume -= 1; } else if (input.Key == ConsoleKey.P) //song pause { wplayer.controls.pause(); Console.WriteLine("\nThe song is paused, press any key to unpause."); Console.ReadKey(); wplayer.controls.play(); } else if (input.Key == ConsoleKey.S) //stop { wplayer.controls.stop(); loop = false; return 1; } else if (input.Key == ConsoleKey.Backspace) //return to main menu { wplayer.controls.stop(); loop = false; return 0; } } } else { //message if the file path is wrong or wrong format Console.WriteLine("\nThe location is either incorrect or the file type is not supported."); Console.ReadKey(); } return 1; }
/*! * \fn void onClicNormalSquare(Object sender, MouseEventArgs e) * \brief Appelle le controller avec les coordonnees du clic * \param Object sender, MouseEventArgs e parametres standards inutilises * \return */ public void onClicNormalSquare(Object sender, MouseEventArgs e) { player = new WMPLib.WindowsMediaPlayer(); var path = System.IO.Path.Combine( System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) , "sounds/move.mp3"); player.URL = path; player.controls.play(); int posx = Grid.GetColumn((Rectangle)sender); int posy = Grid.GetRow((Rectangle)sender); controller.clicNormalSquare(posx,posy); }
public void PlayFile(String url) { Player = new WMPLib.WindowsMediaPlayer(); Player.PlayStateChange += new WMPLib._WMPOCXEvents_PlayStateChangeEventHandler(Player_PlayStateChange); Player.MediaError += new WMPLib._WMPOCXEvents_MediaErrorEventHandler(Player_MediaError); Player.URL = url; Player.controls.play(); }
private void playSound(bool success) { bool soundChecked = checkEdit9.Checked; if (soundChecked && success) { WMPLib.WindowsMediaPlayer wplayer = new WMPLib.WindowsMediaPlayer(); wplayer.URL = "s.mp3"; wplayer.controls.play(); } if (soundChecked && !success) { WMPLib.WindowsMediaPlayer wplayer = new WMPLib.WindowsMediaPlayer(); wplayer.URL = "f.wav"; wplayer.controls.play(); } }
//when form loads, load sounds, start new game private void Form1_Load(object sender, EventArgs e) { backgroundplayer = new WindowsMediaPlayer(); backgroundplayer.URL = @backgroundsoundlocation; backgroundplayer.controls.play(); turnplayer = new WindowsMediaPlayer(); turnplayer.URL = @turnsoundlocation; turnplayer.controls.stop(); fruitplayer = new WindowsMediaPlayer(); fruitplayer.URL = @fruitsoundlocation; fruitplayer.controls.stop(); myCanvas = new Bitmap(600, 400); g = Graphics.FromImage(myCanvas); pictureBox1.Image = myCanvas; newGame(); timer1.Start(); }
/*! * \fn void onShootMouseUp(Object sender, MouseEventArgs e) * \brief Realise l'action de shoot, affiche les traces du laser et passe au joueur suivant * \param Object sender l'objet appelant cette methode (non utilise) * \param MouseEventArgs e l'evenement de clic de souris, permet de recuperer les coordonnees du clic * \return */ public virtual void onShootMouseUp(Object sender, MouseEventArgs e) { if ((Utilities.GameStatusType)(App.wrapper.getCurrentStatus()) == Utilities.GameStatusType.ShootType) { player = new WMPLib.WindowsMediaPlayer(); var path = System.IO.Path.Combine( System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) , "sounds/laser.mp3"); player.URL = path; player.controls.play(); System.Windows.Point position = e.GetPosition(gridGame); double posx = (position.X) / sqLong; double posy = (position.Y) / sqHaut; controller.doAction(posx, posy); //Debug.Print("Position clic x:" + posx); //Debug.Print("Position clic y:" + posy); showShootTrace(); passTurn(); } }
public void Init() { this.playerObject = (WMPLib.WindowsMediaPlayer)Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid("6BF52A52-394A-11D3-B153-00C04F79FAA6"))); playerObject.MediaError += playerObject_MediaError; playerObject.Buffering += playerObject_Buffering; playerObject.MediaChange += playerObject_MediaChange; playerObject.PlayStateChange += playerObject_PlayStateChange; DispatcherTimer dispatcherTimer = new DispatcherTimer(); dispatcherTimer.Interval = TimeSpan.FromMilliseconds(500); this.positionTimer = dispatcherTimer; this.positionTimer.Tick += new EventHandler(this.PositionTimerTick); }
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(Exception e){ } } 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(); } } }