Groups | Blog | Home
all groups > c# > october 2003 >

c# : how do play mp3 with c# ???


Du Dang
10/1/2003 10:07:04 PM
i'm making an alarm clock
and i wanna allow the user to choose their own wake up tune

which method is the best way to go ???

thanks

Fred Mellender
10/1/2003 10:44:59 PM
If you can make your sound file a wav file:

using System.Runtime.InteropServices;

///in a class WaveSound, have:

public static void PlaySound()

{

String fileName = @"C:/Windows/Media/tada.wav";

PlaySound(fileName,0,1);

}

[DllImport("winmm.dll")]

private static extern bool PlaySound(string lpszName, int hModule, int
dwFlags);



and then when you want to play the sound

WaveSound.PlaySound();

[quoted text, click to view]

Du Dang
10/2/2003 2:51:53 AM
thanks Fred !!!

i guess i have to make due with wav format

thanks again for helping out,

Du

[quoted text, click to view]

Lynn Harrison
10/2/2003 9:53:39 AM
Du Dang,

There is also the AudioVideo class in the DirectX 9 SDK that can play MP3
files.

--

Lynn Harrison
SHAMELESS PLUG - Introduction to 3D Game Engine Design (C# & DX9)
www.forums.Apress.com

[quoted text, click to view]

Michael Culley
10/2/2003 1:45:27 PM
[quoted text, click to view]

There are plenty of options for playing mp3 in C#. Do a search on google groups with the term "C# mp3" and you will find all the
info you need. There is even a component written in C# with full source that plays mp3s.

--
Michael Culley


Du Dang
10/2/2003 4:28:11 PM
thank you so much for all your help !!!

[quoted text, click to view]

John Young
10/2/2003 10:08:15 PM
Maybe just import the mediaplayer9, and use that to play mp3s. You can hide
the GUI to it if you want.

John

[quoted text, click to view]

AddThis Social Bookmark Button