public ResultCode AppendAudioOutBufferImpl(ServiceCtx context, long position) { long tag = context.RequestData.ReadInt64(); AudioOutData data = MemoryHelper.Read <AudioOutData>( context.Memory, position); ReadOnlySpan <byte> buffer = context.Memory.GetSpan((ulong)data.SampleBufferPtr, (int)data.SampleBufferSize); _audioOut.AppendBuffer(_track, tag, MemoryMarshal.Cast <byte, short>(buffer)); return(ResultCode.Success); }
public ResultCode AppendAudioOutBufferImpl(ServiceCtx context, long position) { long tag = context.RequestData.ReadInt64(); AudioOutData data = MemoryHelper.Read <AudioOutData>(context.Memory, position); // NOTE: Assume PCM16 all the time, change if new format are found. short[] buffer = new short[data.SampleBufferSize / sizeof(short)]; context.Memory.Read((ulong)data.SampleBufferPtr, MemoryMarshal.Cast <short, byte>(buffer)); _audioOut.AppendBuffer(_track, tag, buffer); return(ResultCode.Success); }
public ResultCode AppendAudioOutBufferImpl(ServiceCtx context, long position) { long tag = context.RequestData.ReadInt64(); AudioOutData data = MemoryHelper.Read <AudioOutData>( context.Memory, position); byte[] buffer = context.Memory.ReadBytes( data.SampleBufferPtr, data.SampleBufferSize); _audioOut.AppendBuffer(_track, tag, buffer); return(ResultCode.Success); }