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

Edited Issue: IeeeFloat to ASIOSTFloat32LSB converter [7979]

$
0
0
If you have sound that's already IeeeFloat but you use ASIO, it seems to me it must be deinterleaved as I found of no way to just pass the interleaved floats through it.

So I've added these to NAudio\Wave\Asio\ASIOSampleConvertor.cs:

case ASIOSampleType.ASIOSTFloat32LSB:
switch (waveFormat.BitsPerSample)
{
case 32:
convertor = (SampleConvertor)ConvertorFloatToFloat2Channels;
break;
}
break;

// IeeeFloat to ASIOSTFloat32LSB (deinterleave)
public static void ConvertorFloatToFloat2Channels(IntPtr inputInterleavedBuffer, IntPtr[] asioOutputBuffers, int nbChannels, int nbSamples)
{
unsafe
{
float* inputSamples = (float*)inputInterleavedBuffer;
float* leftSamples = (float*)asioOutputBuffers[0];
float* rightSamples = (float*)asioOutputBuffers[1];

for (int i = 0; i < nbSamples; i++)
{
*leftSamples++ = inputSamples[0];
*rightSamples++ = inputSamples[1];
inputSamples += 2;
}
}
}

Viewing all articles
Browse latest Browse all 738

Trending Articles



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