SlimDX sound setting multiple Secondary Buffer Capabilities to true

Started by
1 comment, last by DSalles 10 years, 1 month ago

I want to set the Secondary Buffer capabilities Control Frequency and Control Volume to true. I can't access the capabilities directly through the BufferDescription class, so am using BufferDecriptionFlags, but this can only hold one flag.

public void initialize(Stream audioStream)
{
inputStream = new MemoryStream();
device = new DirectSound(SlimDX.DirectSound.DirectSoundGuid.DefaultPlaybackDevice);
waveFormat.FormatTag = SlimDX.Multimedia.WaveFormatTag.Pcm;
waveFormat.BitsPerSample = 16;
waveFormat.BlockAlignment = 2;
waveFormat.Channels = 1;
waveFormat.SamplesPerSecond = 16000;
waveFormat.AverageBytesPerSecond = 32000;
bufferDescription = new SlimDX.DirectSound.SoundBufferDescription();
bufferDescription.Format = waveFormat;
bufferDescription.Flags = BufferFlags.ControlFrequency;
bufferDescription.Flags = BufferFlags.ControlVolume;
bufferDescription.SizeInBytes = amountOfTimeToRecord * 2 * waveFormat.AverageBytesPerSecond;
this.audioStream = audioStream;
Ready = true;
}
in the above example, the control frequency is not accessible because the control volume is used instead. Because the BufferFlags object only holds one value. It seems that changing the boolean value of the buffer capabilities should be accessible but I can't seem to do it.
Advertisement

You combine flags by bitwise OR-ing them:


bufferDescription.Flags = BufferFlags.ControlFrequency | BufferFlags.ControlVolume;

I suggest you do some additional reading on flags, they're a core concept in computing.

It worked! Sorry for being such a n00b

I will read more on flags

This topic is closed to new replies.

Advertisement