Sign in to follow this  
DSalles

SlimDX sound setting multiple Secondary Buffer Capabilities to true

Recommended Posts

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.

Share this post


Link to post
Share on other sites

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.

Edited by Mona2000

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this