function allocateAudioBufferOnHeap(channelCount, bufferSize)
    {
        let heapBufferPointer = Module._malloc(channelCount * bufferSize * Module.HEAPF32.BYTES_PER_ELEMENT)
        let audioBufferOnHeap = Array(channelCount).fill(null)

        audioBufferOnHeap.reduce((pointer, item, index) =>
            {
                audioBufferOnHeap[index] = Module.HEAPF32.subarray(pointer, pointer + bufferSize)
                return pointer + bufferSize
            },
            heapBufferPointer / Module.HEAPF32.BYTES_PER_ELEMENT)

        return {
            pointer: heapBufferPointer,
            buffer: audioBufferOnHeap
        }
    }
// Function to allocate audio buffers on the emscripten heap
Function to allocate audio buffers on the emscripten heap
Function to allocate audio buffers on the emscripten heap
function allocateAudioBufferOnHeap(channelCount, bufferSize)
    {
        let heapBufferPointer = Module._malloc(channelCount * bufferSize * Module.HEAPF32.BYTES_PER_ELEMENT)
        let audioBufferOnHeap = Array(channelCount).fill(null)
        audioBufferOnHeap.reduce((pointer, item, index) =>
            {
                audioBufferOnHeap[index] = Module.HEAPF32.subarray(pointer, pointer + bufferSize)
                return pointer + bufferSize
            },
            heapBufferPointer / Module.HEAPF32.BYTES_PER_ELEMENT)
        return {
            pointer: heapBufferPointer,
            buffer: audioBufferOnHeap
        }
    }
function allocateAudioBufferOnHeap ( channelCount , bufferSize ) { let heapBufferPointer = Module . _malloc ( channelCount * bufferSize * Module . HEAPF32 . BYTES_PER_ELEMENT ) let audioBufferOnHeap = Array ( channelCount ) . fill ( null ) audioBufferOnHeap . reduce ( ( pointer , item , index ) => { audioBufferOnHeap [ index ] = Module . HEAPF32 . subarray ( pointer , pointer + bufferSize ) return pointer + bufferSize } , heapBufferPointer / Module . HEAPF32 . BYTES_PER_ELEMENT ) return { pointer : heapBufferPointer , buffer : audioBufferOnHeap } }
Function to allocate audio buffers on the emscripten heap
Function to allocate audio buffers on the emscripten heap