Play MP3 with DirectSound

sgt_pinky

Well-known member
Joined
Jan 5, 2005
Messages
80
Location
Melbourne, Australia
Is it possible to play an mp3 with DirectSound? This is what I am using for wav files:

Code:
Dim xx As New Device
xx.SetCooperativeLevel(Me, CooperativeLevel.Priority)
Dim ss As New SecondaryBuffer("c:\file.wav", xx)
ss.Play(0, BufferPlayFlags.Default)

I tried just to put an mp3 as the filename, but it didnt like that at all. Bad mistake to make in a full screen app, let me tell you.
 
I tried just to put an mp3 as the filename, but it didnt like that at all. Bad mistake to make in a full screen app, let me tell you.
Lol. You had to restart your comp?
Tip: Name your project starting with a z next time. When it hangs like that, hit control alt delete (you wont see it), hit z, hit delete, and hit enter. Its sort of confusing to explain. Hitting z will go to the next item on the list (in the task manager) that starts with a z and delete is the same as End Task, and hitting Enter will answer Yes to the Do you want to end task? question. Neat little trick.

If that doesnt work, then youll have to alt+tab to what you think is the task manager and give it a try. It usually always works for me though.

Unfortunately, one of my applications was named something like DirectXTest1, and hitting d, delete, enter, it quit devenvr.exe (.NET), so I couldnt see the error.

Honestly, I dont know the asnwer to your question.

-The Pentium Guy
 
Dim ss As New SecondaryBuffer("c:file.wav", xx)
ss.Play(0, BufferPlayFlags.Default)

try to do something like this:

Dim aud as new Microsoft.DirectX.AudioVideoPlayback.Audio
aud.FileName = "C:/file.wav")
aud.Play
 
Yeah, i am using AudioVideoPlayback at the moment, but I can only play one MP3 at a time like that. I wanted to play a soundtrack, and some long environment noise type sounds as well, and i was wondering if it was possible with DirectSound.

Hehe, yeah, i had to restart, but recently I found a way out of it. I have a Logitech MX700 combo keyboard and mouse, and if I press the moon shape (which sends windows 2000 to sleep, but not XP), it goes to the Welcome screen, then when i go back into XP, i can see the taskbar, and can right click on the app and close it, hehe.
 
Back
Top