Click to See Complete Forum and Search --> : Playing Sounds with C#


dfb78
April 10th, 2003, 07:00 AM
I am working on a small app that will be playing a variety of audio files. I found that by importing winmm.dll, I can play a few wav files OK:

[DllImport("winmm.dll")]
public static extern long PlaySound(String lpszName, long hModule, long dwFlags);

However, with my limited amount of audio and/or media experience, I was wondering if there is something better. Maybe something with more functions available instead of just PlaySound()...just an overall better way to do it. I even only found this DllImport from a sample application somewhere else, so I can't even say I have something to compare with yet. ;P

If it matters, my plan is to really just play wav and mp3 files. Any help would be great.

Thanks

dfb78
April 10th, 2003, 09:40 AM
OR...

I am willing to utilize a TTS engine if the speaking sounds "human". I downloaded and ran a sample app from the Microsoft Speech SDK 5.1, but it literally sounds like an archaic PC talking to you. Are there other voices I am able to use? Is anyone familiar with implementing this?

Thanks

pareshgh
April 10th, 2003, 12:35 PM
that's true,
but COOL is to use
DirectX capabilities.

check out DirectX SDK on MSDN.


Paresh

dfb78
April 11th, 2003, 06:59 AM
Has anyone personally tried installing the DirectX SDK 9.0? I am having the hardest time trying to find the Microsoft.DirectX.xxxxx assemblies. Nothing will compile, it says that the namespace DirectX does not exist in the class or namespace 'Microsoft'. So, I went ahead and installed the SDK again...no luck. I THEN decided to just install the SDK for C#...didn't work either. Any ideas? Am I completely missing something here?

I'm running VS .NET 2003 Final Beta w/ the .NET Framework 1.1 if it matters.

WillemM
April 11th, 2003, 10:31 AM
I definitly recommend using DirectX 9, there's a managed version of the runtime aviable at MSDN.

I used it for my mp3 player :D

dfb78
April 11th, 2003, 10:56 AM
That's what I've got...it isn't working though. :(

It's like it didn't register the components when it was installed or something, but I've reinstalled it 5 times now without any luck.

pareshgh
April 11th, 2003, 12:58 PM
first you should always try out some samples and debug it before even making of your own. I think directX samples do work.

Paresh

dfb78
April 11th, 2003, 01:32 PM
Maybe I'm not being clear...NOTHING works. I can't even start the debuug process because it can't find any of the DirectX assemblies. They are displayed in the Assembly Cache when I go into the .NET Configuration though.

pareshgh
April 11th, 2003, 01:35 PM
then you might be forgeting
the reference part.
go in your project settings.
and on solution add project reference and add that DirectX assembly.

Paresh

dfb78
April 11th, 2003, 02:38 PM
At least we're on the same wavelength here now. ;P I tried that, but the assembly is not able to be added, because I don't know where it is. I searched my entire system and couldn't find it, even though it shows up in my assembly cache. I was able to find a "Managed DirectX" directory with a lot of xml files in it, but after adding the directory (C:\WINDOWS\Microsoft.NET\Managed DirectX\v4.09.00.0900) to my references path in the project, it still failed. I'm really at a loss here because I haven't ran into this sort of problem before. Usually I just add the reference and everything works. And by the way, I'm actually just using a sample right now. I haven't even thought about using my own app yet.

pareshgh
April 11th, 2003, 03:02 PM
you could try other examples like using
winmm as a reference and it will give you a control. you can use that GUI control in your application




PAresh

dfb78
April 11th, 2003, 05:13 PM
Yeah, that's pretty much what I've decided to go with since I can't get the DirectX to work. Oh well, thanks for your time anyway, I appreciate it.

pareshgh
April 11th, 2003, 05:17 PM
if you get it working then give party
lol

:D :D :D