mp3 in C#
-
Hello We have a smal game that we whant to put some music in. We have manage to add wave files but the size become to big, so now we whant to use mp3 or somthing like that. Could i use Windows media player ore do i have to decrompress the mp3 my self(own code)? We have tryed to add media player to ower form but it says that its not singel threaded. Hope you have a way to make this happen Best regards Jimmy
-
Hello We have a smal game that we whant to put some music in. We have manage to add wave files but the size become to big, so now we whant to use mp3 or somthing like that. Could i use Windows media player ore do i have to decrompress the mp3 my self(own code)? We have tryed to add media player to ower form but it says that its not singel threaded. Hope you have a way to make this happen Best regards Jimmy
Try following, [DllImport("winmm.dll", CharSet=CharSet.Ansi)] private static extern bool PlaySound(IntPtr szFileName, IntPtr hmod, int fdwSound); use this method where you want to play mp3 files. -Paresh
-
Hello We have a smal game that we whant to put some music in. We have manage to add wave files but the size become to big, so now we whant to use mp3 or somthing like that. Could i use Windows media player ore do i have to decrompress the mp3 my self(own code)? We have tryed to add media player to ower form but it says that its not singel threaded. Hope you have a way to make this happen Best regards Jimmy
-
Try nBASS (written by me) For most up to date version goto http://sourceforge.net/project/showfiles.php?group_id=74199[^] Hey leppie! Your "proof" seems brilliant and absurd at the same time. - Vikram Punathambekar 28 Apr '03
-
leppie wrote: Try nBASS (written by me) Hey Leppie, one more project from you!! :cool: Yesterday only I ran across your other project MyRC. *thumbs up* Don't :beer: and drive.
Kant wrote: Yesterday only I ran across your other project MyRC. *thumbs up* That was my first program I started when doing C#. Was nice to play around with, but I lost all my database so I stopped. If I had to look back at the code, it would probably look horrible to me now ;P My Plugin automation article is based on that Sharkbite .NET IRC library. To make a plugin assembly that can be unloaded without killing the main program (you know the bad thing of .NET) and hence the connection. BTW how are you liking C#? I see you more and more in this forum :) Hey leppie! Your "proof" seems brilliant and absurd at the same time. - Vikram Punathambekar 28 Apr '03
-
Try nBASS (written by me) For most up to date version goto http://sourceforge.net/project/showfiles.php?group_id=74199[^] Hey leppie! Your "proof" seems brilliant and absurd at the same time. - Vikram Punathambekar 28 Apr '03
hey leppie...i just got a chance now to take a look at nbass.....amazing...i really really like it. Im going to recommend..using it in school...if we ever need the use of sound for our project....Good Work...More amazing code from south africa lol.. Jesse M The Code Project Is Your Friend...
-
Try following, [DllImport("winmm.dll", CharSet=CharSet.Ansi)] private static extern bool PlaySound(IntPtr szFileName, IntPtr hmod, int fdwSound); use this method where you want to play mp3 files. -Paresh
-
How?!? May you show me how to use this function, what arguments to pass? What's the IntPtr? which numbers do what (fdwSound)?
if you are trying to run the audio file. herez the sample for you. (the sample for playing the audio files without any GUI) u might consider running it in threads if u need check the sample. using winmm.dll [DllImport("winmm.dll")] public static extern long PlaySound(String lpszName, long hModule, long dwFlags); -----------------check the following code------ using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.Runtime.InteropServices; using System.IO; namespace WinMediaPlayer { /// /// Summary description for Form1. /// public class Form1 : System.Windows.Forms.Form { [DllImport("winmm.dll")] public static extern long PlaySound(String lpszName, long hModule, long dwFlags); private System.Windows.Forms.Button buttonPlay; private System.Windows.Forms.Label labelFile; private System.Windows.Forms.TextBox textBoxAudioFile; /// /// Required designer variable. /// private System.ComponentModel.Container components = null; public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // } /// /// Clean up any resources being used. /// protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.buttonPlay = new System.Windows.Forms.Button(); this.labelFile = new System.Windows.Forms.Label(); this.textBoxAudioFile = new System.Windows.Forms.TextBox(); this.SuspendLayout(); // // buttonPlay // this.buttonPlay.Location = new System.Drawing.Point(128, 80); this.buttonPlay.Name = "buttonPlay"; this.buttonPlay.Size = new System.Drawing.Size(96, 32); this.buttonPlay.TabIndex = 0; this.buttonPlay.Text = "Play"; this.buttonPlay.Click += new System.EventHandler(this.buttonPlay_Click); // // labelFile // this.labelFile.Location = new System.Drawing.Point(8, 24); this.labelFile.Name = "labelFile"; this.labelFile.Size = new System.Drawing.Size(80, 24); this.labelFile.TabIndex = 1; this.labelFile.Text = "File To Play"; // // textBoxAudioFile // this.textBoxAudio
-
if you are trying to run the audio file. herez the sample for you. (the sample for playing the audio files without any GUI) u might consider running it in threads if u need check the sample. using winmm.dll [DllImport("winmm.dll")] public static extern long PlaySound(String lpszName, long hModule, long dwFlags); -----------------check the following code------ using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.Runtime.InteropServices; using System.IO; namespace WinMediaPlayer { /// /// Summary description for Form1. /// public class Form1 : System.Windows.Forms.Form { [DllImport("winmm.dll")] public static extern long PlaySound(String lpszName, long hModule, long dwFlags); private System.Windows.Forms.Button buttonPlay; private System.Windows.Forms.Label labelFile; private System.Windows.Forms.TextBox textBoxAudioFile; /// /// Required designer variable. /// private System.ComponentModel.Container components = null; public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // } /// /// Clean up any resources being used. /// protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.buttonPlay = new System.Windows.Forms.Button(); this.labelFile = new System.Windows.Forms.Label(); this.textBoxAudioFile = new System.Windows.Forms.TextBox(); this.SuspendLayout(); // // buttonPlay // this.buttonPlay.Location = new System.Drawing.Point(128, 80); this.buttonPlay.Name = "buttonPlay"; this.buttonPlay.Size = new System.Drawing.Size(96, 32); this.buttonPlay.TabIndex = 0; this.buttonPlay.Text = "Play"; this.buttonPlay.Click += new System.EventHandler(this.buttonPlay_Click); // // labelFile // this.labelFile.Location = new System.Drawing.Point(8, 24); this.labelFile.Name = "labelFile"; this.labelFile.Size = new System.Drawing.Size(80, 24); this.labelFile.TabIndex = 1; this.labelFile.Text = "File To Play"; // // textBoxAudioFile // this.textBoxAudio