OpenNETCF.Media.WaveAudio.Wave Class

November 1, 2006 — Leave a comment

We have received a few customer request to use the Wave.SetVolume and Wave.GetVolume methods in the OpenNETCF.Media.WaveAudio.Wave class.  Unfortunately, there is no default constructor for the Wave class so you cannot directly call these methods.

Using a little bit of Reflection we can get the private contructor of the Wave class using Type.GetConstructors().

Here is some sample code to call Wave.SetVolume and Wave.GetVolume.  (NOTE:  this is currently not supported and may not work in future releases of the Smart Device Framework)

OpenNETCF.Media.WaveAudio.Wave wave = null;

ConstructorInfo[] ci = typeof(OpenNETCF.Media.WaveAudio.Wave).GetConstructors(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);

if (ci.Length == 1)

wave = (OpenNETCF.Media.WaveAudio.Wave)ci[0].Invoke(null);

if (wave != null)


No Comments

Be the first to start the conversation.

Leave a Reply