Example #1
0
        public unsafe static void ConvertorFloatToInt2Channels(IntPtr inputInterleavedBuffer, IntPtr[] asioOutputBuffers, int nbChannels, int nbSamples)
        {
            float *ptr  = (float *)((void *)inputInterleavedBuffer);
            int *  ptr2 = (int *)((void *)asioOutputBuffers[0]);
            int *  ptr3 = (int *)((void *)asioOutputBuffers[1]);

            for (int i = 0; i < nbSamples; i++)
            {
                *(ptr2++) = ASIOSampleConvertor.clampToInt((double)(*ptr));
                *(ptr3++) = ASIOSampleConvertor.clampToInt((double)ptr[1]);
                ptr      += 2;
            }
        }
Example #2
0
        public unsafe static void ConvertorFloatToIntGeneric(IntPtr inputInterleavedBuffer, IntPtr[] asioOutputBuffers, int nbChannels, int nbSamples)
        {
            float *ptr = (float *)((void *)inputInterleavedBuffer);

            int *[] array = new int *[nbChannels];
            for (int i = 0; i < nbChannels; i++)
            {
                array[i] = (int *)((void *)asioOutputBuffers[i]);
            }
            for (int j = 0; j < nbSamples; j++)
            {
                for (int k = 0; k < nbChannels; k++)
                {
                    int *[] array2;
                    IntPtr  intPtr;
                    int *   ptr2;
                    (array2 = array)[(int)(intPtr = (IntPtr)k)] = (ptr2 = array2[(int)intPtr]) + 1;
                    *ptr2 = ASIOSampleConvertor.clampToInt((double)(*(ptr++)));
                }
            }
        }