Jump to content

  • Log In with Google      Sign In   
  • Create Account


SlimDX sound setting multiple Secondary Buffer Capabilities to true


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 DSalles   Members   -  Reputation: 103

Like
0Likes
Like

Posted 13 March 2014 - 12:26 PM

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.


Sponsor:

#2 Mona2000   Members   -  Reputation: 590

Like
2Likes
Like

Posted 13 March 2014 - 12:33 PM

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, 13 March 2014 - 12:34 PM.


#3 DSalles   Members   -  Reputation: 103

Like
0Likes
Like

Posted 13 March 2014 - 12:53 PM

It worked! Sorry for being such a n00b

I will read more on flags


Edited by DSalles, 13 March 2014 - 12:54 PM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS