using DSound = SlimDX.DirectSound;
public class Sound
{
DSound.DirectSound parent = null;
DSound.SoundBufferDescription description;
DSound.SecondarySoundBuffer secBuffer = null;
public Sound(System.Windows.Forms.Form appForm, Guid driverID)
{
this.parent = DSoundDeviceManager.GetDevice(driverID, appForm);
this.description = new DSound.SoundBufferDescription();
if ( this.parent != null )
{
try
{
this.description.Flags =
DSound.BufferFlags.ControlVolume |
DSound.BufferFlags.ControlPan |
DSound.BufferFlags.GlobalFocus;
// read in the WAVE file
byte[] data;
using ( SlimDX.Multimedia.WaveFile file = new SlimDX.Multimedia.WaveFile(@"H:\AudioMono.wav") )
{
this.description.Format = file.Format;
data = new byte[file.Size];
file.Read(data, file.Size);
}
// create new
this.secBuffer = new DSound.SecondarySoundBuffer(this.parent, this.description);
}
catch ( Exception ex )
{
Console.WriteLine(ex.Message);
}
}
}
}
[SlimDX] How to initialize SecondarySoundBuffer?
Hi!
I can't manage to initialize a SecondarySoundBuffer in SlimDX.
I'm trying to do it like this:
I always get an exception:
E_INVALIDARG: An invalid parameter was passed to the returning function (-2147024809)
Can't find any examples how to do it correctly.
Thank you in advance
Karol
And what does your wave format look like? How many channels, what format tag, what sample rate, etc.
Quote:Original post by Mike.PopoloskiLinky
Do the debug runtimes give you any extra information?
Hi guys!
Sorry, forgot to mention that:
Debug Runtime gives no further information.
Using the November SlimDX version.
The format of the 'AudioMono.wav' is:
AverageBytesPerSecond: 22050
BitsPerSample: 8
BlockAlignement: 1
Channels: 1
FormatTag: Pcm
SamplesPerSecond: 22050
Tried it with the 'MusicMono.wav' from the SlimDX sample as well - same problems!
Is it currently possible to replace the DirectSound functionality with XAudio2?
Sorry, forgot to mention that:
Debug Runtime gives no further information.
Using the November SlimDX version.
The format of the 'AudioMono.wav' is:
AverageBytesPerSecond: 22050
BitsPerSample: 8
BlockAlignement: 1
Channels: 1
FormatTag: Pcm
SamplesPerSecond: 22050
Tried it with the 'MusicMono.wav' from the SlimDX sample as well - same problems!
Is it currently possible to replace the DirectSound functionality with XAudio2?
DirectSound should we usable, just like XAudio2. My only guess right now is that for some reason the flags you are specifying are invalid. I'll try it out on my own to see what I come up with.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement