[.net] DirectX.Buffer error

Started by
1 comment, last by DarkDrag0n 19 years, 7 months ago
Im having a problem with my audio using C# and Managed DirectX in the device. I know I have the address right. im getting a: ArgumentException was unhandled value does not fall within the expected range exception I have narrowed the code down to this, here's the code

public class FX
{
 private List<Buffer> AudioFiles = new List<Buffer>();
 private Device dev;

 public FX()
        {
            dev = new Device();

            dev.SetCooperativeLevel(new Control(), CooperativeLevel.Priority);
        }

 public void openSound(string address)
        {
            AudioFiles.Add(new Buffer(address, dev));
        }
}

When the new buffer is made it throws an exception. Oh and if you were wondering address = "C:\B.mp3". Oh and for those of you who noticed it I made a mistake in the title it should be DirectX.DirectSound.Buffer [Edited by - DarkDrag0n on September 20, 2004 12:44:12 AM]
Advertisement
I don't know if this is what is causing your problem and I could be totaly wrong about this, but I don't believe that DirectSound will just play mp3 files. You will probably have to get some knid of decoder and decode them into wave data before you can drop them into the sound card.
Ya I just tryed useing a wav file and it works now. Thanks for your help.

This topic is closed to new replies.

Advertisement