/// <param name="audioFormat">WavWriterLowLevel.WAVE_FORMAT_PCM or WavWriterLowLevel.WAVE_FORMAT_IEEE_FLOAT</param> public static bool Write(BinaryWriter bw, int numChannels, int bitsPerSample, int audioFormat, int sampleRate, long numFrames, WWUtil.LargeArray <byte> sampleArray) { if (IsRf64Size(sampleArray.LongLength)) { WriteRF64Header(bw, numChannels, bitsPerSample, audioFormat, sampleRate, numFrames); } else { WriteRiffHeader(bw, numChannels, bitsPerSample, audioFormat, sampleRate, sampleArray.LongLength); } for (int i = 0; i < sampleArray.ArrayNum(); ++i) { var pcmFragment = sampleArray.ArrayNth(i); bw.Write(pcmFragment); } if ((sampleArray.LongLength & 1) == 1) { byte pad = 0; bw.Write(pad); } return(true); }
public bool AddPlayPcmData(int pcmId, WWUtil.LargeArray <byte> data) { if (!AddPlayPcmDataAllocateMemory(pcmId, data.LongLength)) { return(false); } long posBytes = 0; for (int i = 0; i < data.ArrayNum(); ++i) { var fragment = data.ArrayNth(i); if (!AddPlayPcmDataSetPcmFragment(pcmId, posBytes, fragment)) { return(false); } posBytes += fragment.LongLength; } return(true); }