Jump to content
  • Advertisement
Sign in to follow this  
DSalles

SlimDX sound setting multiple Secondary Buffer Capabilities to true

This topic is 2044 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
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.

Edited by Mona2000

Share this post


Link to post
Share on other sites

It worked! Sorry for being such a n00b

I will read more on flags

Edited by DSalles

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!