Quantcast
Channel: naudio Work Item Rss Feed
Viewing all articles
Browse latest Browse all 738

Created Unassigned: DirectSoundOut fails if WaveFormat is WaveFormatExtraData [16487]

$
0
0
If the WaveFormat of the wave provider used as the parameter for Init is of type WaveFormatExtraData
The call within InitializeDirectSound to GCHandle.Alloc fails with an ArgumentException complaining that the “Object contains non-primitive or non-blittable data.”.

This is due to the extraData array of bytes field. Although it is a fixed size, alloc is still unable to pin the array because the array type itself is non-primitive and so cannot be pinned.


public TestPlay(Stream in)
{
var waveStream = new WaveFileReader(in);
var player = new DirectSoundOut(DirectSoundOut.DSDEVID_DefaultPlayback);
player.Init(waveStream);
player.Play();
//Waiting for play to stop removed for brevity.
}

Viewing all articles
Browse latest Browse all 738

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>