public static void PlayMusic(string path) { WindowsMediaPlayer Player = new WindowsMediaPlayer(); Player.URL = path; Player.controls.play(); }
void PlayTonesLooping(string str) { wmpTone = new WindowsMediaPlayer(); wmpTone.settings.setMode("loop", true); wmpTone.URL = str; wmpTone.controls.play(); }
public Form1() { coleccionmusica = new ArrayList(); InitializeComponent(); reproducciónToolStripMenuItem.Enabled = false; windowsMedia = new WindowsMediaPlayer(); }
public static void Good() { WindowsMediaPlayer player = new WindowsMediaPlayer(); player.URL = @"Data\sounds\correctanswer.mp3"; player.controls.play(); }
private void btnAdd_Click(object sender, EventArgs e) { // file types, that will be allowed to upload openFileDialog1.Filter = "Video files | *.mp4"; // allow/deny user to upload more than one file at a time openFileDialog1.Multiselect = false; // if user clicked OK if (openFileDialog1.ShowDialog() == DialogResult.OK) { try { string path = openFileDialog1.FileName; // get name of file var savePath = ConfigurationManager.AppSettings["SaveVideoRoot"]; if (!Directory.Exists(savePath)) { Directory.CreateDirectory(savePath); } string fakeName = (DateTime.Now.ToString("ddMMyyyyyHHmmss") + "" + openFileDialog1.FileName.Substring(openFileDialog1.FileName.LastIndexOf('.'))); File.Copy(path, (savePath + fakeName), true); var player = new WindowsMediaPlayer(); var clip = player.newMedia(path); var time = TimeSpan.FromSeconds(clip.duration); BLLVideo.Instance.AddFile(connect, new Data.Q_Video() { FileName = openFileDialog1.SafeFileName, FakeName = fakeName, Duration = time }); LoadData(); } catch (Exception ex) { } } }
private void btArara_Click(object sender, EventArgs e) { lbArara.Visible = false; lbArara.Text = "Arara"; lbArara.Visible = true; try { if (som19 == null) { som19 = new WindowsMediaPlayer(); som19.URL = Application.StartupPath + @"\mp3\Arara.mp3"; som19.controls.play(); } if (som19 != null) { som19.controls.play(); } } catch (Exception ex) { MessageBox.Show("Erro" + ex); } }
/// <summary> /// Inits wmp player /// </summary> /// <param name="label1"> </param> public void Init() { player = new WindowsMediaPlayer(); CreatePlaylist cpl = new CreatePlaylist(); player.settings.setMode("loop", true); player.PlayStateChange += new _WMPOCXEvents_PlayStateChangeEventHandler(player_PlayStateChange); }
private void btLeao_Click(object sender, EventArgs e) { lbLeao.Visible = false; lbLeao.Text = "Leão"; lbLeao.Visible = true; try { if (som2 == null) { som2 = new WindowsMediaPlayer(); som2.URL = Application.StartupPath + @"\mp3\Leão.mp3"; som2.controls.play(); } if (som2 != null) { som2.controls.play(); } } catch (Exception ex) { MessageBox.Show("Erro" + ex); } }
public GameState(GraphicsDeviceManager graphics) { this.graphics = graphics; mplayer = new WMPLib.WindowsMediaPlayer(); Directory.GetCurrentDirectory(); mplayer.URL = Path.GetDirectoryName(Assembly.GetEntryAssembly().CodeBase) + @"\Content\songs\mele.mp3"; mplayer.settings.setMode("loop", true); mplayer.controls.stop(); rand = new Random(); one = GameState.playerNow; enemies = new List<Mob>(); one.MaxWidth = 4000; one.MaxHeight = 2500; one.Pics = new Texture2D[4]; boss = new Boss(2000, 2000); one.Speed += 5; boss.Speed = (float)2.41; Initialize(); input = new InputHandler(graphics); enemiesRect = new List<Rectangle>(); enemiesSourceRect = new List<Rectangle>(); for (int i = 0; i < enemies.Count; i++) { enemiesSourceRect.Add(new Rectangle(270 * enemies[i].Frame, 0, 270, 165)); enemiesRect.Add(new Rectangle((int)enemies[i].X, (int)enemies[i].Y, 270, 165)); } }
public MainForm(string[] args) { InitializeComponent(); dtAlertTime = new DateTime(); wmp = new WindowsMediaPlayer(); wmp.PlayStateChange += new _WMPOCXEvents_PlayStateChangeEventHandler(wmp_PlayStateChange); this.Icon = Properties.Resources.clock; niTray.Icon = Properties.Resources.clock; nudHours.Value = 0; nudMinutes.Value = 0; foreach (string arg in args) { try { if (arg.StartsWith("-m")) { txtMessage.Text = arg.Substring(2); } else if (arg.StartsWith("-th")) { nudHours.Value = int.Parse(arg.Substring(3)); } else if (arg.StartsWith("-tm")) { nudMinutes.Value = int.Parse(arg.Substring(3)); } } catch (Exception) { } } }
public static void Init() { backgroundPlayer = new WindowsMediaPlayer(); rocketPlayer = new WindowsMediaPlayer[15]; explosionPlayer = new WindowsMediaPlayer[15]; backgroundPlayer.settings.volume = 30; backgroundPlayer.settings.autoStart = false; backgroundPlayer.settings.setMode("loop", true); for (int i = 0; i < rocketPlayer.Length; i++) { explosionPlayer[i] = new WindowsMediaPlayer(); explosionPlayer[i].settings.autoStart = false; explosionPlayer[i].URL = (@"sounds\explosions\explosion1.mp3"); explosionPlayer[i].settings.volume = 70; } for (int i = 0; i < rocketPlayer.Length; i++) { rocketPlayer[i] = new WindowsMediaPlayer(); rocketPlayer[i].settings.autoStart = false; rocketPlayer[i].URL = @"sounds\rockets\rocket1.mp3"; rocketPlayer[i].settings.volume = 50; } }
private void btCavalo_Click(object sender, EventArgs e) { label7.Visible = false; label7.Text = "Cavalo"; label7.Visible = true; try { if (som7 == null) { som7 = new WindowsMediaPlayer(); som7.URL = Application.StartupPath + @"\mp3\Cavalo.mp3"; som7.controls.play(); } if (som7 != null) { som7.controls.play(); } } catch (Exception ex) { MessageBox.Show("Erro" + ex); } }
public void PlayScoreSound() { //Sound when either player scores WindowsMediaPlayer player = new WindowsMediaPlayer(); player.URL = "Pong Sound - Score.wav"; }
public frmMain() { InitializeComponent(); //Инициализация всех компонентов для рисования. //Фактически, полная загрузка приложения. btmp = new Bitmap(pictureBox.Width, pictureBox.Height); g = Graphics.FromImage(btmp); font = new Font("Segoe print", 12); pictureBox.Image = btmp; wmp = new WindowsMediaPlayer(); pl = new MySoundPlayer(); wmp.URL = "Music\\menu.mp3"; wmp.settings.setMode("Loop", true); wmp.settings.volume = 100; m_rnd = new Random(); //ship = new Ship(pictureBox.Width, pictureBox.Height); space = new Space(pictureBox.Width, pictureBox.Height); Draw = new MyDrawing(g, space.GetWidth, space.GetHeight); director = new StageDirector(pictureBox.Width, pictureBox.Height); x = space.GetWidth / 2; y = space.GetHeight - 100; pictureBox.Cursor.Dispose(); Draw.Menu(pictureBox.Width, pictureBox.Height); now = DateTime.Now; lastCurrent = now; }
private void LoadFolder(string folderPath) { var dirInfo = new DirectoryInfo(folderPath); string AllowedVideoTypes = "*.mkv"; var files = dirInfo.GetFiles(AllowedVideoTypes, SearchOption.TopDirectoryOnly); int season = (int)nudSeason.Value; int startEp = (int)nudEpisodes.Value; foreach (var info in files) { var player = new WindowsMediaPlayer(); var clip = player.newMedia(info.FullName); var file = new ShowFile() { OriginalFileName = info.Name, OriginalFilePath = info.FullName, DirectoryName = info.DirectoryName, FileSize = info.Length, FileSizeString = BytesToString(info.Length), Duration = TimeSpan.FromSeconds(clip.duration).ToString(), Season = season, Episode = startEp, Extension = info.Extension, CreatedAt = info.CreationTime, Skip = false, }; this._showFiles.Add(file); if (CbIncEp.Checked) { startEp++; } } RefreshView(); }
private void btElefante_Click(object sender, EventArgs e) { lbElefante.Visible = false; lbElefante.Text = "Elefante"; lbElefante.Visible = true; try { if (som4 == null) { som4 = new WindowsMediaPlayer(); som4.URL = Application.StartupPath + @"\mp3\Elefante.mp3"; som4.controls.play(); } if (som4 != null) { som4.controls.play(); } } catch (Exception ex) { MessageBox.Show("Erro" + ex); } }
private void btAbacaxi_Click(object sender, EventArgs e) { label1.Visible = false; label1.Text = "Abacaxi"; label1.Visible = true; try { if (som1 == null) { som1 = new WindowsMediaPlayer(); som1.URL = Application.StartupPath + @"\mp3\Abacaxi.mp3"; som1.controls.play(); } if (som1 != null) { som1.controls.play(); } } catch (Exception ex) { MessageBox.Show("Erro" + ex); } }
private void btMelancia_Click(object sender, EventArgs e) { label10.Visible = false; label10.Text = "Melancia"; label10.Visible = true; try { if (som10 == null) { som10 = new WindowsMediaPlayer(); som10.URL = Application.StartupPath + @"\mp3\Melancia.mp3"; som10.controls.play(); } if (som10 != null) { som10.controls.play(); } } catch (Exception ex) { MessageBox.Show("Erro" + ex); } }
private void addButton_Click(object sender, EventArgs e) { if (filePath.Text.ToString() == "") { MessageBox.Show("Please select a valid file"); return; } WindowsMediaPlayer wmp = new WindowsMediaPlayer(); IWMPMedia mediainfo = wmp.newMedia(audioFilePath); int minutes = (int)mediainfo.duration / 60; int seconds = (int)mediainfo.duration % 60; string time; if (seconds < 10) { time = minutes.ToString() + ":0" + seconds.ToString(); } else { time = minutes.ToString() + ":" + seconds.ToString(); } audioList.Items.Add(new ListViewItem(new String[] { id.ToString(), audioName, time })); id++; }
private void Game_Load(object sender, EventArgs e) { tmMain.Start(); //tạo âm thanh khi ăn cá eatFishSound = new WindowsMediaPlayer(); eatFishSound.URL = "songs\\eatFish.mp3"; //Tạo âm thanh khi bị cá xung quanh ăn loseSound = new WindowsMediaPlayer(); loseSound.URL = "songs\\lose.mp3"; //Tạo âm thanh GAMEOVER gameOverSound = new WindowsMediaPlayer(); gameOverSound.URL = "songs\\gameOver.mp3"; //Taọ âm thanh đang chơi playSound = new WindowsMediaPlayer(); playSound.URL = "songs\\play.mp3"; //Tạo âm thanh khi thắng winGameSound = new WindowsMediaPlayer(); winGameSound.URL = "songs\\winLevel.mp3"; gameOverSound.controls.stop(); loseSound.controls.stop(); eatFishSound.controls.stop(); }
public AudioStream(string path) { player = new WindowsMediaPlayer(); player.PlayStateChange += new _WMPOCXEvents_PlayStateChangeEventHandler(player_PlayStateChange); player.MediaError += new _WMPOCXEvents_MediaErrorEventHandler(player_MediaError); player.URL = path; }
public Player(IFileLocator fileLocator) { wmp = new WindowsMediaPlayer(); fileLocator.TrackAdded += FileLocatorOnTrackAdded; foreach (var track in fileLocator.FindTracks()) Queue(track); }
public static void CacheMediaLibrary() { ThreadPool.QueueUserWorkItem(new WaitCallback((state)=> { List<Album> returnedAlbums = new List<Album>(); WindowsMediaPlayer mediaPlayer = null; try { //LogUtility.LogMessage("Started caching"); mediaPlayer = new WindowsMediaPlayer(); CacheAlbums(mediaPlayer); CacheArtists(mediaPlayer); CacheAlbumArtists(mediaPlayer); //LogUtility.LogMessage("Finished caching"); } catch (Exception ex) { LogUtility.LogException(ex); throw; } finally { if (mediaPlayer != null) { mediaPlayer.close(); } } })); }
public FrmMain() { InitializeComponent(); LoadRegex(); redimensionar(); MyPlaylist = new List <Musica>(); lblNomeDaMusica.Text = "..."; r = new Random(); yt = new Youtoba(); Player = new WindowsMediaPlayer(); Player.PlayStateChange += Player_PlayStateChange; ToolTip tt = new ToolTip(); tt.SetToolTip(btPesquisar, "Add song (Search)"); tt.SetToolTip(btBaixoLista, "Mover song down"); tt.SetToolTip(btCimaLista, "Move song up"); tt.SetToolTip(btRemoverDaLista, "Remove from list"); tt.SetToolTip(btSalvarPlaylist, "Save playlist to file"); tt.SetToolTip(btCarregarPlaylist, "Load playlist from file"); tt.SetToolTip(btJanelaStream, "Open live streaming overlay window"); tt.SetToolTip(lblVolume, "Volume"); tt.SetToolTip(brVolume, "Volume"); tt.SetToolTip(cbShuffle, "Shuffle"); tt.SetToolTip(btPlayPause, "Play/Pause"); tt.SetToolTip(btPrev, "Previous"); tt.SetToolTip(btNext, "Next"); }
public static void Bad() { WindowsMediaPlayer player = new WindowsMediaPlayer(); player.URL = @"Data\sounds\wronganswer.mp3"; player.controls.play(); }
private void ShowTime() { mc = new WindowsMediaPlayer(); mc.URL = "EDM-China.mp3"; mc.controls.play(); Label lb = new Label(); lb.Top = 280; lb.Left = 600; lb.AutoSize = true; lb.Text = "Thời gian:"; lb.Font = fTime; lb.BackColor = Color.Transparent; lb.Parent = this; lbShowTime = new Label(); lbShowTime.Top = 280; lbShowTime.Left = 695; lbShowTime.AutoSize = true; lbShowTime.BackColor = Color.Transparent; lbShowTime.Font = fTime; lbShowTime.Parent = this; time = 0; lbShowTime.Text = time.ToString(); timer.Start(); }
private void GetWpAlbums(object state) { var wmp = new WindowsMediaPlayer(); var collection = wmp.mediaCollection; this.authorIndex = collection.getMediaAtom("Author"); this.albumArtistIndex = collection.getMediaAtom("WM/AlbumArtist"); this.albumIndex = collection.getMediaAtom("Album"); IWMPPlaylist allMedia = collection.getAll(); List<ServiceAgnosticAlbum> albums = new List<ServiceAgnosticAlbum>(); for (int i = 0; i < allMedia.count; i++) { var currentMedia = allMedia.get_Item(i); var artistName = GetArtist(currentMedia); var albumName = GetAlbum(currentMedia); if (!string.IsNullOrEmpty(artistName) && !string.IsNullOrEmpty(albumName) && !albums.Any(a => a.AlbumName == albumName && a.ArtistName == artistName)) { albums.Add(new ServiceAgnosticAlbum(albumName, artistName)); } } App.AlbumsToImport = albums; Dispatcher.BeginInvoke(DispatcherPriority.Normal, new ThreadStart(() => this.Navigate(new CollectionImporter()))); }
private void StartMusic() { _player = new WindowsMediaPlayer(); _player.URL = _settings.MusicPath; _player.settings.setMode("Loop", true); _player.controls.play(); }
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) {} } if (answeringSound && answeringSoundPath != null) { if (answeringSoundPath.IndexOf(".wav") == answeringSoundPath.Length - 4) { SoundPlayer player = new SoundPlayer(); player.SoundLocation = answeringSoundPath; player.Play(); } else if (answeringSoundPath.IndexOf(".mp3") == answeringSoundPath.Length - 4) { WindowsMediaPlayer wplayer = new WindowsMediaPlayer(); wplayer.URL = answeringSoundPath; wplayer.controls.play(); } } }
public FillerMusicPlayer() { FillerQueue = new List<FillerSong>(); mediaPlayer = new WindowsMediaPlayer(); mediaPlayer.settings.volume = DEFAULT_VOLUME; }
public void PlayPaddleSound() { //Sound for paddle collision WindowsMediaPlayer player = new WindowsMediaPlayer(); player.URL = "Pong Sound - Paddle.wav"; }
private void Construction() { windowsMediaPlayer = new WindowsMediaPlayer(); PlayEvent += On_Play; PauseEvent += On_Pause; ResumeEvent += On_Resume; NextEvent += On_Next; PrevEvent += On_Prev; StopEvent += On_Stop; TickEvent += On_Tick; DirectoriesLoadedEvent += On_DirectoriesLoaded; TrackChangeEvent += On_TrackChange; PlaybackFailedEvent += On_PlaybackFailed; // PrePlayEvent += MusicPlayer_BeforePlayEvent; MusicUpdatedEvent += MusicPlayer_MusicUpdated; timer = new System.Windows.Forms.Timer(); timer.Interval = 100; timer.Tick += t_Tick; CreateTempPlaybackFiles = true; _isRunning = false; //LoopPlaylist = true; //initialise to -1. If we start at 0 then loading trackmanager //will highlight the first track of the playlist before we start playing anything CurrentTrackIndex = 0; Volume = 10; }
public void Alarm() { WindowsMediaPlayer myplayer = new WindowsMediaPlayer(); myplayer.URL = AppDomain.CurrentDomain.BaseDirectory + "alarm.mp3"; myplayer.controls.play(); }
private void button1_Click(object sender, EventArgs e) { string filepath = textBox1.Text; if (Directory.Exists(filepath)) { string[] files = Directory.GetFiles(filepath); Random r = new Random(); int selectedfile = r.Next(1, files.Length + 1) - 1; try { if (files[selectedfile].Contains(".mp3") == false) { throw new Exception(); } WindowsMediaPlayer wplayer = new WindowsMediaPlayer(); wplayer.URL = @files[selectedfile]; wplayer.controls.play(); label2.Text = files[selectedfile].Replace(filepath, "").Replace("\\", "").Replace(".mp3", ""); } catch { label2.Text = "Sound " + files[selectedfile].Replace(filepath, "").Replace("\\", "") + " failed to play."; } } else { label2.Text = "Could not find directory."; } }
private void timer_Tick(object sender, EventArgs e) { if (a > 0) { int hours; int seconds; int minutes; hours = a / 3600; minutes = (a - (hours * 3600)) / 60; seconds = a - (hours * 3600) - (minutes * 60); lblTime.Content = hours.ToString() + ":" + minutes.ToString() + ":" + seconds.ToString(); a--; speecher(); } else { WindowsMediaPlayer player = new WindowsMediaPlayer(); player.URL = "Message 1.mp3"; player.controls.play(); timer.Stop(); timer.IsEnabled = false; lblTime.Content = "Time is ended"; btnSet.IsEnabled = true; txtHours.Visibility = Visibility.Visible; txtMinutes.Visibility = Visibility.Visible; txtSeconds.Visibility = Visibility.Visible; } }
/// <summary> /// Sets default audio player settings. /// </summary> private void SetAudioSettings() { Playah = new WindowsMediaPlayer(); Playah.PlayStateChange += Playah_PlayStateChange; Playah.settings.autoStart = false; SetOutput = true; }
private void btLaranja_Click(object sender, EventArgs e) { label6.Visible = false; label6.Text = "Laranja"; label6.Visible = true; try { if (som6 == null) { som6 = new WindowsMediaPlayer(); som6.URL = Application.StartupPath + @"\mp3\Laranja.mp3"; som6.controls.play(); } if (som6 != null) { som6.controls.play(); } } catch (Exception ex) { MessageBox.Show("Erro" + ex); } }
public frmInjectionAnimation(GClass91 gclass91_1) { this.InitializeComponent(); this.Region = Class97.smethod_6((Form)this, 40); this.gclass91_0 = gclass91_1; try { this.int_3 = this.pctAarrow.Left; this.timer_1.Interval = 25; this.timer_1.Start(); this.bitmap_0 = (Bitmap)Image.FromStream((Stream) new MemoryStream(new GClass78().DownloadFile(string.Format("http://art.gametdb.com/wii/disc/{0}/{1}.png", this.gclass91_0.ToInject.Region == "USA" ? (object)"US" : (object)"EN", (object)this.gclass91_0.ToInject.ProductId)))); this.bitmap_0.SetResolution(96f, 96f); this.timer_0.Interval = 30; this.timer_0.Start(); } catch { } try { this.windowsMediaPlayer_0 = (WindowsMediaPlayer) new WindowsMediaPlayerClass(); // ISSUE: method pointer this.windowsMediaPlayer_0.add_PlayStateChange(new _WMPOCXEvents_PlayStateChangeEventHandler((object)this, (UIntPtr)__methodptr(method_3))); } catch { } }
public void PlaySong() { WindowsMediaPlayer wmp = new WindowsMediaPlayer(); wmp.URL = this.URL; wmp.controls.play(); }
public Form1() { InitializeComponent(); pl = new WindowsMediaPlayer(); playin = false; progressBar1.Value = 0; time = 0; }
static MediaLibrary() { Player = new WindowsMediaPlayer(); Player.CurrentMediaItemAvailable += MediaLibrary.CurrMediaAvailable; Library = (IWMPMediaCollection2)Player.mediaCollection; }
private void InitializeWindowsMediaPlayer() { WindowsMediaPlayer = new WindowsMediaPlayer(); WindowsMediaPlayer.PlayStateChange += new _WMPOCXEvents_PlayStateChangeEventHandler(Player_PlayStateChange); WindowsMediaPlayer.MediaError += new _WMPOCXEvents_MediaErrorEventHandler(Player_MediaError); WindowsMediaPlayer.settings.autoStart = false; }
public StatePaused(WindowsMediaPlayer mediaPlayer) : base() { //LabelStatus.Text = "Paused"; //btnPauseResume.Text = "Resume"; setMediaPlayer(mediaPlayer); getMediaPlayer().controls.pause(); }
public FillerMusicPlayer() { FillerQueue = new List<FillerSong>(); mediaPlayer = new WindowsMediaPlayer(); mediaPlayer.settings.volume = DEFAULT_VOLUME; this.StartAtBeginning = false; }
public StatePlaying(WindowsMediaPlayer mediaPlayer) : base() { //LabelStatus.Text = "Playing"; //btnPauseResume.Text = "Pause"; //btnPauseResume.Enabled = true; setMediaPlayer(mediaPlayer); getMediaPlayer().controls.play(); }
public KaraokeFilePlayer() { player = new WindowsMediaPlayer(); cdgPlayer = new CDGPlayer(); cdgForm = new CDGForm(); isFormOpen = false; cdgPlayer.ImageInvalidated += ImageInvalidatedHandler; player.PlayStateChange += Player_PlayStateChange; }
public StateStopped(WindowsMediaPlayer mediaPlayer) : base() { //LabelStatus.Text = "Stopped"; //btnPauseResume.Text = "Pause"; //btnPauseResume.Enabled = false; setMediaPlayer(mediaPlayer); getMediaPlayer().controls.stop(); }
protected Sound(string path, bool loop) { Player = new WindowsMediaPlayer { URL = path }; Player.settings.enableErrorDialogs = true; Position = 0; Loop = loop; Player.controls.stop(); PlayerStatus = Status.Stop; Player.PlayStateChange += PlayStateChange; }
public PlayerEngineModel(bool shouldDo_AutoStart, bool show_WMPErrors) { _mediaPlayer = new WindowsMediaPlayer(); // should wmp.dll start playback when the url is set _mediaPlayer.settings.autoStart = shouldDo_AutoStart; // should wmp.dll show errors as dialogs or keep silent _mediaPlayer.settings.enableErrorDialogs = show_WMPErrors; }
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { // Pickup this.pictureBox3.Visible = true; this.pictureBox3.Location = new Point(400, 50); this.pictureBox1.Image = Resources.deadbob; MessageBox.Show("The sword is placed into your inventory and you attack the monster"); WindowsMediaPlayer wmp = new WindowsMediaPlayer(); wmp.URL = Path.Combine(Environment.CurrentDirectory, "CrazyFrog_-_AxelF__lenoob6467_20130515044814.mid"); wmp.controls.play(); }
public MediaFacade(string fileName) { wmp = new WindowsMediaPlayer(); wmp.settings.autoStart = true; wmp.settings.setMode("autoRewind", true); wmp.PlayStateChange += Wmp_PlayStateChange; var media = wmp.newMedia(fileName); if (0.0 == media.duration) throw new Exception("Could not load file '" + fileName + "'"); Length = (float)media.duration; wmp.URL = fileName; }
/// <summary> /// Constructor. /// </summary> public WMP() { _mediaPlayer = new WindowsMediaPlayer(); _media = _mediaPlayer.mediaCollection; _titleIndex = _media.getMediaAtom("Title"); _albumArtistIndex = _media.getMediaAtom("WM/AlbumArtist"); _authorIndex = _media.getMediaAtom("Author"); _albumIndex = _media.getMediaAtom("Album"); _playCountIndex = _media.getMediaAtom("PlayCount"); _userLastPlayedTimeIndex = _media.getMediaAtom("UserLastPlayedTime"); }
public MainForm() { InitializeComponent(); SettingsManager.Load(); this.Icon = Properties.Resources.logo1; wplayer = new WindowsMediaPlayer(); wplayerSongCalls = new WindowsMediaPlayer(); wplayer.settings.volume = SettingsManager.VolumeMain; wplayerSongCalls.settings.volume = SettingsManager.VolumeSpeech; trackBar1.Value = SettingsManager.VolumeMain; trackBar2.Value = SettingsManager.VolumeSpeech; notifyIcon1.Icon = this.Icon; notifyIcon1.Visible = true; notifyIcon1.Text = "WeAreOne Infos"; notifyIcon1.DoubleClick += notifyIcon1_DoubleClick; notifyIcon1.ContextMenu = new ContextMenu(); notifyIcon1.ContextMenu.MenuItems.Add(new MenuItem("Erstellt von Johnny") { Enabled = false }); notifyIcon1.ContextMenu.MenuItems.Add(new MenuItem("-")); notifyIcon1.ContextMenu.MenuItems.Add(new MenuItem("Beenden", (sender, e) => this.Close()) { DefaultItem = true }); timer = new Timer(); timer.Interval = 3000; timer.SynchronizingObject = this; timer.Elapsed += timer_callback; timer.AutoReset = true; timer.Start(); icontimer = new Timer(); icontimer.Interval = 500; icontimer.SynchronizingObject = this; icontimer.Elapsed += icontimer_Elapsed; icontimer.AutoReset = true; icontimer.Start(); wao = new WeAreOne(); wao.OnResponseReceived += wao_OnResponseReceived; wao.OnImageReceived += wao_OnImageReceived; linkLabel1.Click += (sender, e) => Process.Start(current.release); loadingscreen = new LoadingForm(); loadingscreen.ShowDialog(); }
public SongPlayerWindowsMediaPlayer() { player = new WindowsMediaPlayer(); player.settings.volume = 75; _queue = new FairQueue(); _songLibrary = new SongLibrary(); _songLibrary.StatusChanged += OnLibraryStatusChanged; _updateThread = new Thread(new ThreadStart(Update)); _updateThread.Start(); }
public void playSimpleSound(string media) { WindowsMediaPlayer mp = new WindowsMediaPlayer(); byte[] b = (byte[]) Properties.Resources.ResourceManager.GetObject(media); FileInfo fileInfo = new FileInfo("play.mp3"); FileStream fs = fileInfo.OpenWrite(); fs.Write(b, 0, b.Length); fs.Close(); mp.URL = fileInfo.Name; mp.controls.play(); geryt; }
/// <summary> /// Opens a folder browser dialog, finds all the karaoke songs in the selected folder and any subfolders and returns a list of songs found. /// </summary> /// <returns>List of all valid karaoke songs found in the selected folder</returns> public List<Song> GetSongList(string filePath) { //Open the folder dialog and ensure that a folder was selected string folderPath = filePath; if (folderPath.Equals("")) return new List<Song>(); List<Song> songList = new List<Song>(); //List of folders, including subfolders to search over Queue<string> folderQueue = new Queue<string>(); folderQueue.Enqueue(folderPath); //Iterate over the list of folders and get all karaoke songs out while (folderQueue.Count > 0) { string currentPath = folderQueue.Dequeue(); //For the current folder get a list of subfolders foreach (string path in GetSubFoldersForPath(currentPath)) folderQueue.Enqueue(path); //Get a list of all files in this folder DirectoryInfo directory = new DirectoryInfo(currentPath); FileInfo[] files = directory.GetFiles(); List<FileInfo> karaokeFiles = RemoveInvalidKaraokeFiles(files); //Now add the valid karaoke files to the song list foreach (FileInfo songInfo in karaokeFiles) songList.Add(GetSongFromFileName(songInfo.FullName, songInfo.Name)); } //Add the song duration to each of the songs WindowsMediaPlayer player = new WindowsMediaPlayer(); for (int x = 0; x < songList.Count; x++) { IWMPMedia media = player.newMedia(songList[x].pathOnDisk); songList[x].duration = (int)media.duration; if (x % 10 == 0 && ProgressUpdated != null) { ProgressUpdated(this, new ProgressArgs(x, songList.Count)); } } if (ProgressUpdated != null) { ProgressUpdated(this, new ProgressArgs(songList.Count, songList.Count)); } return songList; }
public FormLogin() { InitializeComponent(); initMessages(); docMain = new MainDoc(); fillMainDoc(); player = new WindowsMediaPlayer(); setPlayer(); }
/// <summary> /// The constructor takes 3 args, the path of the WAV audio file, the name of the sample, and what type it is(i.e. guitar/drums/bass) /// </summary> /// <param name="soundFile">The path to the audio file(Must be ina Windows Media Player supported format)</param> /// <param name="soundName">The name of the sample</param> /// <param name="soundType">What instrument type it is</param> public Sample( String soundFile, String soundName, String soundType) { player = new WindowsMediaPlayer(); player.URL = soundFile; name = soundName; type = soundType; isMoving = false; SetIcon(); }
public static void Play(string file) { WindowsMediaPlayer wmp = new WindowsMediaPlayer(); wmp.currentMedia = wmp.newMedia(file); wmp.controls.currentPosition = 600; wmp.controls.play(); }
public Player(IEnumerable<FileInfo> Playlist) { _player = new WindowsMediaPlayer(); playlist = _player.playlistCollection.newPlaylist("myplaylist"); foreach (var file in Playlist) { var media = _player.newMedia(file.FullName); playlist.appendItem(media); } _player.currentPlaylist = playlist; _player.controls.stop(); _player.PlayStateChange += _player_PlayStateChange; }