Jump to content
  • Advertisement
Sign in to follow this  
Nimcal

[DirectSound] Question regarding Microsoft.DirectX.DirectSound.CaptureBuffer.Read()

This topic is 3465 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've been trying to find some general information on the Microsoft.DirectX.DirectSound.CaptureBuffer.Read method for the past couple of days and was wondering if someone could assist me with an issue that I'm having. I'm relatively new to the world of DirectSound and recording with it. And it seems that the managed DirectSound documentation has been deemed unnecessary. Recording is taking place with the format of: 44100Hz, 16bit, 2 channel.
byte[] captured_data = (byte[])capture_buffer.Read(capture_offset, typeof(byte), Microsoft.DirectX.DirectSound.LockFlag.None, lock_size);
24 of returned buffer:
207
51 
119 
17 
211 
48 
109 
18 
200 
47 
86 
21 
172 
39 
50 
24 
165 
33 
94 
25 
47 
35 
97 
30
Reading the data like this provides you with the valid 0-255 values. This information is being recorded correctly as far as I can see. I write it back to a file for testing purposes and based on a subjective listening test, there are no problems/anomalies that I can detect.
sbyte[] sbyte_captured_data = (sbyte[])capture_buffer.Read(capture_offset, typeof(sbyte), Microsoft.DirectX.DirectSound.LockFlag.None, lock_size);
24 bytes of returned buffer:
2
57
39
21
57
46
60
14
-64
27
-93
26
-50
-10
-68
-1
92
-23
20
-5
Reading the data like this returns the expected -128-127 sample values. Same process for testing was used to determine validity of the returned values. From what I understand from the PCM wave format, when returning the recorded data in float format, the upper and lower bounds are 1.0, -1.0.
float[] float_captured_data = (float[])capture_buffer.Read(capture_offset, typeof(float), Microsoft.DirectX.DirectSound.LockFlag.None, lock_size);
24 bytes of returned buffer:
-2.154778E+27
-1.324578E+20
-1.235532E+12
-2.060489E+11
-5.823102E+16
-1.105599E+22
-1.193597E+27
-2.349949E+29
-1.780452E+29
-1.548093E+34
2.289202E-37
1.014668E-35
2.126614E-32
1.128582E-29
3.967984E-35
-2.347025E+36
-5.602384E+32
-2.501385E+26
-5.92797E+22
-4.265034E+24
-2.161063E+26
-8.303244E+32
1.716025E-31
1.373039E-23
When reading the data like this, I am provided with values far exceeding the relevant upper and lower limits for float values. Am I missing something obvious or isn't it possible to read floating point values from the capture buffer? A nudge/prod/kick in the right direction would be appreciated. :)

Share this post


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

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!