Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. mp3 in C#

mp3 in C#

Scheduled Pinned Locked Moved C#
csharpgame-devquestion
9 Posts 6 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Anonymous
    wrote on last edited by
    #1

    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

    P L 2 Replies Last reply
    0
    • A Anonymous

      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

      P Offline
      P Offline
      Paresh Gheewala
      wrote on last edited by
      #2

      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

      A 1 Reply Last reply
      0
      • A Anonymous

        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

        L Offline
        L Offline
        leppie
        wrote on last edited by
        #3

        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

        K J 2 Replies Last reply
        0
        • L leppie

          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

          K Offline
          K Offline
          Kant
          wrote on last edited by
          #4

          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.

          L 1 Reply Last reply
          0
          • K Kant

            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.

            L Offline
            L Offline
            leppie
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            • L leppie

              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

              J Offline
              J Offline
              jtmtv18
              wrote on last edited by
              #6

              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...

              1 Reply Last reply
              0
              • P Paresh Gheewala

                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

                A Offline
                A Offline
                AlexDunn
                wrote on last edited by
                #7

                How?!? May you show me how to use this function, what arguments to pass? What's the IntPtr? which numbers do what (fdwSound)?

                P 1 Reply Last reply
                0
                • A AlexDunn

                  How?!? May you show me how to use this function, what arguments to pass? What's the IntPtr? which numbers do what (fdwSound)?

                  P Offline
                  P Offline
                  Paresh Gheewala
                  wrote on last edited by
                  #8

                  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

                  A 1 Reply Last reply
                  0
                  • P Paresh Gheewala

                    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

                    A Offline
                    A Offline
                    AlexDunn
                    wrote on last edited by
                    #9

                    Thanks : ) - Alex

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups