private static void PlayMp3(string mp3File) { Task.Run(() => { var mediaPlayer = new MediaPlayer.MediaPlayer {FileName = mp3File}; mediaPlayer.Play(); }); }
private void btnSound_Click(object sender, EventArgs e) { MediaPlayer.MediaPlayer player = new MediaPlayer.MediaPlayer { FileName = (string)btnSound.Tag }; player.Play(); txtTranslation.Focus(); }
private static void PlayMp3(string mp3File) { Task.Run(() => { var mediaPlayer = new MediaPlayer.MediaPlayer { FileName = mp3File }; mediaPlayer.Play(); }); }
private void initializeMidiStorage() { // Any initialization will be done here. // Initialize arrays. midiData = new MidiEventCollection[3]; fileNames = new string[3]; // Initialize Media Player m_mediaPlayer = new MediaPlayer.MediaPlayer(); }
public static double GetVideoDuration(string file) { MediaPlayer.MediaPlayer media = new MediaPlayer.MediaPlayer(); media.Open(file); Thread.Sleep(600); var duration = media.Duration; return(duration); }
public MusicPlayer() { this.currentSongIndex = 0; this.songs = new List <Song>(); this.mediaPlayer = new MediaPlayer.MediaPlayer(); timer = new System.Timers.Timer(); timer.Interval = 1000; timer.Elapsed += OnTimedEvent; timer.AutoReset = true; }
public void exibir_resultado(Double resultado) { if (resultado == 666) { MediaPlayer.MediaPlayer winmp = new MediaPlayer.MediaPlayer(); winmp.FileName = @"123.mid"; winmp.Open(winmp.FileName); winmp.Play(); //SoundPlayer mp = new SoundPlayer(@"C:\Users\srmf32\Documents\Visual Studio 2013\Projects\Calculador Cientifica\Lavender_Town.wav"); //mp.Play(); } this.textBox = resultado.ToString(); }
private void button2_select_mp3_file_and_play_it_Click(object sender, EventArgs e) { //PLAYS A .MP3 FILE //SOURCE: http://csharpexamples.com/play-mp3-wav-files-synchronous-asynchronous-c/ OpenFileDialog OPEN_FILE_DIALOG = new OpenFileDialog(); if (OPEN_FILE_DIALOG.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string MP3_PATH = OPEN_FILE_DIALOG.FileName; var mediaPlayer = new MediaPlayer.MediaPlayer(); mediaPlayer.FileName = MP3_PATH; mediaPlayer.Play(); } }
public frmAlarmFired(AlarmModel alarm) { InitializeComponent(); this.alarm = alarm; lblName.Text = $"Alarm: {alarm.Name}"; textBoxMessage.Text = $"{alarm.Message}"; lblAlarmTime.Text = $"Set for: {alarm.AlarmDateTime}"; //TODO do something better! var mediaPlayer = new MediaPlayer.MediaPlayer(); mediaPlayer.FileName = @".\default.mp3"; mediaPlayer.Play(); UpdateLabels(); }
static void Main(string[] args) { Console.Title = "Riki"; Console.OutputEncoding = Encoding.UTF8; player = new MediaPlayer.MediaPlayer(); backlog = new List <SongParameters>(); generator = new Generator(); GenerateJazz(); string text = ComposeText(); Syntx(text); //Speak(text); //new Thread(() => { Start(); }).Start(); StartPlaying(); Console.ReadKey(); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.win = ((MediaPlayer.MediaPlayer)(target)); #line 6 "..\..\..\MediaPlayer.xaml" this.win.Closing += new System.ComponentModel.CancelEventHandler(this.win_Closing); #line default #line hidden return; case 2: #line 22 "..\..\..\MediaPlayer.xaml" ((System.Windows.Controls.TextBlock)(target)).MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.Border_MouseDown); #line default #line hidden return; case 3: this.titleplay = ((System.Windows.Controls.TextBlock)(target)); #line 23 "..\..\..\MediaPlayer.xaml" this.titleplay.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.Border_MouseDown); #line default #line hidden return; case 4: this.min = ((System.Windows.Controls.Button)(target)); #line 30 "..\..\..\MediaPlayer.xaml" this.min.Click += new System.Windows.RoutedEventHandler(this.min_Click); #line default #line hidden return; case 5: this.max = ((System.Windows.Controls.Button)(target)); #line 36 "..\..\..\MediaPlayer.xaml" this.max.Click += new System.Windows.RoutedEventHandler(this.max_Click); #line default #line hidden return; case 6: this.close = ((System.Windows.Controls.Button)(target)); #line 42 "..\..\..\MediaPlayer.xaml" this.close.Click += new System.Windows.RoutedEventHandler(this.close_Click); #line default #line hidden return; case 7: this.grid = ((System.Windows.Controls.Grid)(target)); #line 50 "..\..\..\MediaPlayer.xaml" this.grid.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.Border_MouseDown); #line default #line hidden return; case 8: this.media = ((System.Windows.Controls.MediaElement)(target)); #line 52 "..\..\..\MediaPlayer.xaml" this.media.MediaEnded += new System.Windows.RoutedEventHandler(this.media_MediaEnded); #line default #line hidden #line 52 "..\..\..\MediaPlayer.xaml" this.media.MediaOpened += new System.Windows.RoutedEventHandler(this.media_MediaOpened); #line default #line hidden return; case 9: this.tags = ((System.Windows.Controls.Grid)(target)); return; case 10: this.imgTag = ((System.Windows.Controls.Image)(target)); return; case 11: this.artist = ((System.Windows.Controls.TextBlock)(target)); return; case 12: this.title = ((System.Windows.Controls.TextBlock)(target)); return; case 13: this.album = ((System.Windows.Controls.TextBlock)(target)); return; case 14: this.genre = ((System.Windows.Controls.TextBlock)(target)); return; case 15: this.year = ((System.Windows.Controls.TextBlock)(target)); return; case 16: this.pllist = ((System.Windows.Controls.Label)(target)); return; case 17: #line 115 "..\..\..\MediaPlayer.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.OpenClosePl); #line default #line hidden return; case 18: this.rb_audio = ((System.Windows.Controls.RadioButton)(target)); #line 132 "..\..\..\MediaPlayer.xaml" this.rb_audio.Checked += new System.Windows.RoutedEventHandler(this.rb_Checked); #line default #line hidden return; case 19: this.rb_video = ((System.Windows.Controls.RadioButton)(target)); #line 134 "..\..\..\MediaPlayer.xaml" this.rb_video.Checked += new System.Windows.RoutedEventHandler(this.rb_Checked); #line default #line hidden return; case 20: this.rb_img = ((System.Windows.Controls.RadioButton)(target)); #line 136 "..\..\..\MediaPlayer.xaml" this.rb_img.Checked += new System.Windows.RoutedEventHandler(this.rb_Checked); #line default #line hidden return; case 21: this.rb_all = ((System.Windows.Controls.RadioButton)(target)); #line 138 "..\..\..\MediaPlayer.xaml" this.rb_all.Checked += new System.Windows.RoutedEventHandler(this.rb_Checked); #line default #line hidden return; case 22: this.listPlay = ((System.Windows.Controls.ListView)(target)); #line 141 "..\..\..\MediaPlayer.xaml" this.listPlay.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.listPlay_SelectionChanged); #line default #line hidden return; case 23: this.createBord = ((System.Windows.Controls.Border)(target)); return; case 24: #line 163 "..\..\..\MediaPlayer.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.create_Click); #line default #line hidden return; case 25: this.newList = ((System.Windows.Controls.TextBox)(target)); return; case 26: this.ok = ((System.Windows.Controls.Button)(target)); #line 172 "..\..\..\MediaPlayer.xaml" this.ok.Click += new System.Windows.RoutedEventHandler(this.ok_Click); #line default #line hidden return; case 27: this.create = ((System.Windows.Controls.Button)(target)); #line 182 "..\..\..\MediaPlayer.xaml" this.create.Click += new System.Windows.RoutedEventHandler(this.create_Click); #line default #line hidden return; case 28: #line 184 "..\..\..\MediaPlayer.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click_1); #line default #line hidden return; case 29: #line 186 "..\..\..\MediaPlayer.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click_2); #line default #line hidden return; case 30: this.pllistContent = ((System.Windows.Controls.Label)(target)); return; case 31: #line 206 "..\..\..\MediaPlayer.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click); #line default #line hidden return; case 32: this.playlistSel = ((System.Windows.Controls.ListView)(target)); #line 214 "..\..\..\MediaPlayer.xaml" this.playlistSel.MouseDoubleClick += new System.Windows.Input.MouseButtonEventHandler(this.pllistContent_MouseDoubleClick); #line default #line hidden #line 215 "..\..\..\MediaPlayer.xaml" this.playlistSel.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.playlistSel_SelectionChanged); #line default #line hidden return; case 33: this.gr = ((System.Windows.Controls.Grid)(target)); return; case 34: this.add = ((System.Windows.Controls.Button)(target)); #line 234 "..\..\..\MediaPlayer.xaml" this.add.Click += new System.Windows.RoutedEventHandler(this.add_Click); #line default #line hidden return; case 35: this.del_elem = ((System.Windows.Controls.Button)(target)); #line 236 "..\..\..\MediaPlayer.xaml" this.del_elem.Click += new System.Windows.RoutedEventHandler(this.del_elem_Click); #line default #line hidden return; case 36: this.cur_file = ((System.Windows.Controls.Button)(target)); #line 239 "..\..\..\MediaPlayer.xaml" this.cur_file.Click += new System.Windows.RoutedEventHandler(this.cur_file_Click); #line default #line hidden return; case 37: this.menu = ((System.Windows.Controls.ContextMenu)(target)); return; case 38: this.openfile = ((System.Windows.Controls.MenuItem)(target)); #line 248 "..\..\..\MediaPlayer.xaml" this.openfile.Click += new System.Windows.RoutedEventHandler(this.openfile_Click); #line default #line hidden return; case 39: this.openlists = ((System.Windows.Controls.MenuItem)(target)); #line 250 "..\..\..\MediaPlayer.xaml" this.openlists.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.Playlist_Click); #line default #line hidden #line 250 "..\..\..\MediaPlayer.xaml" this.openlists.Click += new System.Windows.RoutedEventHandler(this.openlists_Click); #line default #line hidden return; case 40: this.gray = ((System.Windows.Controls.MenuItem)(target)); #line 253 "..\..\..\MediaPlayer.xaml" this.gray.Click += new System.Windows.RoutedEventHandler(this.gray_Click); #line default #line hidden return; case 41: this.blue = ((System.Windows.Controls.MenuItem)(target)); #line 255 "..\..\..\MediaPlayer.xaml" this.blue.Click += new System.Windows.RoutedEventHandler(this.gray_Click); #line default #line hidden return; case 42: this.black = ((System.Windows.Controls.MenuItem)(target)); #line 257 "..\..\..\MediaPlayer.xaml" this.black.Click += new System.Windows.RoutedEventHandler(this.gray_Click); #line default #line hidden return; case 43: #line 260 "..\..\..\MediaPlayer.xaml" ((System.Windows.Controls.MenuItem)(target)).MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.close_Click); #line default #line hidden #line 260 "..\..\..\MediaPlayer.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.MenuItem_Click); #line default #line hidden return; case 44: this.time = ((System.Windows.Controls.Button)(target)); return; case 45: this.timeleft = ((System.Windows.Controls.Button)(target)); return; case 46: this.progress = ((System.Windows.Controls.ProgressBar)(target)); #line 276 "..\..\..\MediaPlayer.xaml" this.progress.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.progress_MouseDown); #line default #line hidden return; case 47: this.slider = ((System.Windows.Controls.Slider)(target)); #line 279 "..\..\..\MediaPlayer.xaml" this.slider.ValueChanged += new System.Windows.RoutedPropertyChangedEventHandler <double>(this.slider_ValueChanged); #line default #line hidden return; case 48: this.btnPplOpen = ((System.Windows.Controls.Button)(target)); #line 294 "..\..\..\MediaPlayer.xaml" this.btnPplOpen.Click += new System.Windows.RoutedEventHandler(this.Playlist_Click); #line default #line hidden return; case 49: this.btnOpenFile = ((System.Windows.Controls.Button)(target)); #line 298 "..\..\..\MediaPlayer.xaml" this.btnOpenFile.Click += new System.Windows.RoutedEventHandler(this.btnOpenFile_Click); #line default #line hidden return; case 50: this.left = ((System.Windows.Controls.Button)(target)); #line 310 "..\..\..\MediaPlayer.xaml" this.left.Click += new System.Windows.RoutedEventHandler(this.left_Click); #line default #line hidden return; case 51: this.pausestate = ((System.Windows.Controls.Label)(target)); return; case 52: this.pause = ((System.Windows.Controls.Button)(target)); #line 314 "..\..\..\MediaPlayer.xaml" this.pause.Click += new System.Windows.RoutedEventHandler(this.pause_Click); #line default #line hidden return; case 53: this.playstate = ((System.Windows.Controls.Label)(target)); return; case 54: this.play = ((System.Windows.Controls.Button)(target)); #line 318 "..\..\..\MediaPlayer.xaml" this.play.Click += new System.Windows.RoutedEventHandler(this.play_Click); #line default #line hidden return; case 55: this.stopstate = ((System.Windows.Controls.Label)(target)); return; case 56: this.stop = ((System.Windows.Controls.Button)(target)); #line 322 "..\..\..\MediaPlayer.xaml" this.stop.Click += new System.Windows.RoutedEventHandler(this.stop_Click); #line default #line hidden return; case 57: this.right = ((System.Windows.Controls.Button)(target)); #line 326 "..\..\..\MediaPlayer.xaml" this.right.Click += new System.Windows.RoutedEventHandler(this.right_Click); #line default #line hidden return; case 58: this.volum = ((System.Windows.Controls.Slider)(target)); #line 340 "..\..\..\MediaPlayer.xaml" this.volum.ValueChanged += new System.Windows.RoutedPropertyChangedEventHandler <double>(this.volum_ValueChanged); #line default #line hidden return; } this._contentLoaded = true; }
public MainForm() { this.Text = "Blotto Beats"; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.MouseDown += this.mouseDown; this.MouseUp += this.mouseUp; this.MouseWheel += this.mouseWheel; this.Paint += this.paint; this.DoubleBuffered = true; this.BackColor = Color.Turquoise; this.TransparencyKey = Color.Turquoise; this.TopMost = Properties.Settings.Default.alwaysOnTop; size = 80; buttons = new List<Button>(); settings = new List<Setting>(); dragging = false; playing = false; progress = 0; score = 0; settingsDropped = false; songLen = 0; songPos = -1; backlog = new List<SongParameters>(); genres = new String[] { null, "Generic", "Classical", "Twelve-tone", "Jazz", "4-Chord Pop/Rock", null }; redditSongs = new List<SongParameters>[genres.Length]; redditThreads = new Thread[genres.Length]; for (int i = 0; i < redditSongs.Length; i++) { redditSongs[i] = new List<SongParameters>(); redditThreads[i] = new Thread(() => refreshReddit(i)); } generator = new Generator(); server = new BBServerConnection(Properties.Settings.Default.lastIP, 3000); player = new MediaPlayer.MediaPlayer(); curGenre = 0; timer = new System.Windows.Forms.Timer(); timer.Interval = 10; timer.Tick += this.tick; origPlayImg = new Bitmap("images/play.png"); origPauseImg = new Bitmap("images/pause.png"); origBackImg = new Bitmap("images/back.png"); origNextImg = new Bitmap("images/next.png"); origUpvoteImg = new Bitmap("images/upvote.png"); origDownvoteImg = new Bitmap("images/downvote.png"); origRedditImg = new Bitmap("images/reddit.png"); origSettingsImg = new Bitmap("images/settings.png"); origAdvSettingsImg = new Bitmap("images/advsettings.png"); origExportImg = new Bitmap("images/export.png"); lightColor = new SolidBrush(Properties.Settings.Default.lightColor); medColor = new SolidBrush(Properties.Settings.Default.medColor); darkColor = new SolidBrush(Properties.Settings.Default.darkColor); sliderColor = new SolidBrush(Properties.Settings.Default.sliderColor); downvoteColor = new SolidBrush(Properties.Settings.Default.downvoteColor); upvoteColor = new SolidBrush(Properties.Settings.Default.upvoteColor); textColor = new SolidBrush(Properties.Settings.Default.textColor); lightInline = new Pen(lightColor); lightInline.Alignment = System.Drawing.Drawing2D.PenAlignment.Inset; lightOutline = new Pen(lightColor); lightOutline.Alignment = System.Drawing.Drawing2D.PenAlignment.Outset; genre = new DropDownSetting(0, "Genre", this, new string[] { "Generic", "Classical", "Twelve-tone", "Jazz", "4-Chord Pop/Rock" }, size); tempo = new TextBoxSetting(1, "Tempo", this, 60, 200, size); seed = new TextBoxSetting(2, "Seed", this, int.MinValue, int.MaxValue, size); settings.Add(genre); settings.Add(tempo); settings.Add(seed); foreach (Setting setting in settings) setting.setVisible(settingsDropped); initButtons(); settingsForm = new AdvancedSettings(this); accountForm = new AccountManagement(this); if (Properties.Settings.Default.username == "null") accountForm.ShowDialog(); else new Thread(() => startUp()).Start(); }
public MediaPlayerAdapter() { this.mediaPlayer = new MediaPlayer.MediaPlayer(); }
public MainForm() { this.Text = "Blotto Beats"; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.MouseDown += this.mouseDown; this.MouseUp += this.mouseUp; this.MouseWheel += this.mouseWheel; this.Paint += this.paint; this.DoubleBuffered = true; this.BackColor = Color.Turquoise; this.TransparencyKey = Color.Turquoise; this.TopMost = Properties.Settings.Default.alwaysOnTop; size = 80; buttons = new List <Button>(); settings = new List <Setting>(); dragging = false; playing = false; progress = 0; score = 0; settingsDropped = false; songLen = 0; songPos = -1; backlog = new List <SongParameters>(); genres = new String[] { null, "Generic", "Classical", "Twelve-tone", "Jazz", "4-Chord Pop/Rock", null }; redditSongs = new List <SongParameters> [genres.Length]; redditThreads = new Thread[genres.Length]; for (int i = 0; i < redditSongs.Length; i++) { redditSongs[i] = new List <SongParameters>(); redditThreads[i] = new Thread(() => refreshReddit(i)); } generator = new Generator(); server = new BBServerConnection(Properties.Settings.Default.lastIP, 3000); player = new MediaPlayer.MediaPlayer(); curGenre = 0; timer = new System.Windows.Forms.Timer(); timer.Interval = 10; timer.Tick += this.tick; origPlayImg = new Bitmap("images/play.png"); origPauseImg = new Bitmap("images/pause.png"); origBackImg = new Bitmap("images/back.png"); origNextImg = new Bitmap("images/next.png"); origUpvoteImg = new Bitmap("images/upvote.png"); origDownvoteImg = new Bitmap("images/downvote.png"); origRedditImg = new Bitmap("images/reddit.png"); origSettingsImg = new Bitmap("images/settings.png"); origAdvSettingsImg = new Bitmap("images/advsettings.png"); origExportImg = new Bitmap("images/export.png"); lightColor = new SolidBrush(Properties.Settings.Default.lightColor); medColor = new SolidBrush(Properties.Settings.Default.medColor); darkColor = new SolidBrush(Properties.Settings.Default.darkColor); sliderColor = new SolidBrush(Properties.Settings.Default.sliderColor); downvoteColor = new SolidBrush(Properties.Settings.Default.downvoteColor); upvoteColor = new SolidBrush(Properties.Settings.Default.upvoteColor); textColor = new SolidBrush(Properties.Settings.Default.textColor); lightInline = new Pen(lightColor); lightInline.Alignment = System.Drawing.Drawing2D.PenAlignment.Inset; lightOutline = new Pen(lightColor); lightOutline.Alignment = System.Drawing.Drawing2D.PenAlignment.Outset; genre = new DropDownSetting(0, "Genre", this, new string[] { "Generic", "Classical", "Twelve-tone", "Jazz", "4-Chord Pop/Rock" }, size); tempo = new TextBoxSetting(1, "Tempo", this, 60, 200, size); seed = new TextBoxSetting(2, "Seed", this, int.MinValue, int.MaxValue, size); settings.Add(genre); settings.Add(tempo); settings.Add(seed); foreach (Setting setting in settings) { setting.setVisible(settingsDropped); } initButtons(); settingsForm = new AdvancedSettings(this); accountForm = new AccountManagement(this); new Thread(() => startUp()).Start(); }
private void StartEffect(string EffectStream) { SoundPlayer player = new SoundPlayer(); var mediaPlayer = new MediaPlayer.MediaPlayer(); player.Stop(); mediaPlayer.Stop(); string[] codes = EffectStream.Split('|'); string sEffectType = ""; string sEffect = ""; foreach (var code in codes) { if (code != "") { sEffectType = code.Substring(0, 1); sEffect = CConfig.Instance.GetEffect(code); } try { switch (sEffectType) { case "H": if (sEffect.Contains("mp3")) { mediaPlayer.FileName = sEffect; mediaPlayer.Play(); } else { player.SoundLocation = sEffect; player.Play(); } break; case "L": int iBrightness1 = Convert.ToInt32(sEffect.Substring(sEffect.IndexOf("Brightness1=") + "Brightness1=".Length, 3)); int iBrightness2 = Convert.ToInt32(sEffect.Substring(sEffect.IndexOf("Brightness2=") + "Brightness2=".Length, 3)); int iSaturation1 = Convert.ToInt32(sEffect.Substring(sEffect.IndexOf("Saturation1=") + "Saturation1=".Length, 3)); int iSaturation2 = Convert.ToInt32(sEffect.Substring(sEffect.IndexOf("Saturation2=") + "Saturation2=".Length, 3)); int iHue1 = Convert.ToInt32(sEffect.Substring(sEffect.IndexOf("Hue1=") + "Hue1=".Length, 5)); int iHue2 = Convert.ToInt32(sEffect.Substring(sEffect.IndexOf("Hue2=") + "Hue2=".Length, 5)); HueLogic.PutBridge(1, true, iSaturation1, iBrightness1, iHue1); HueLogic.PutBridge(2, true, iSaturation2, iBrightness2, iHue2); break; case "O": case "A": try { CConfig.Instance.InterfaceSerial.InterfaceSerialPort.Write(sEffect); } catch { CConfig.Instance.InterfaceSerial.InterfaceSerialPort.Close(); return; } break; default: break; } } catch { } } }
public void exibir_resultado(Double resultado) { if (resultado == 666) { MediaPlayer.MediaPlayer winmp = new MediaPlayer.MediaPlayer(); winmp.FileName = @"123.mid"; winmp.Open(winmp.FileName); winmp.Play(); //SoundPlayer mp = new SoundPlayer(@"C:\Users\srmf32\Documents\Visual Studio 2013\Projects\Calculador Cientifica\Lavender_Town.wav"); //mp.Play(); } this.textBox = resultado.ToString(); }