---
title: "setDataBuffer(fromAudioBufferList:blockBufferMemoryAllocator:flags:)"
framework: coremedia
role: symbol
role_heading: Instance Method
path: "coremedia/cmsamplebuffer/setdatabuffer(fromaudiobufferlist:blockbuffermemoryallocator:flags:)"
---

# setDataBuffer(fromAudioBufferList:blockBufferMemoryAllocator:flags:)

Creates a block buffer that contains a copy of the data from an audio buffer list, and sets it as the sample buffer’s data.

## Declaration

```swift
func setDataBuffer(fromAudioBufferList bufferList: UnsafePointer<AudioBufferList>, blockBufferMemoryAllocator: CFAllocator? = kCFAllocatorDefault, flags: CMSampleBuffer.Flags = []) throws
```

## Parameters

- `bufferList`: The audio buffer list from which to copy the data.
- `blockBufferMemoryAllocator`: An allocator to use for the memory block that the block buffer holds.
- `flags`: Optional flags that control the operation.

## Discussion

Discussion Pass the audioBufferListAssure16ByteAlignment flag to have the system create 16-byte-aligned buffers.

## See Also

### Modifying Sample Buffers

- [dataBuffer](coremedia/cmsamplebuffer/databuffer.md)
- [setDataBuffer(_:)](coremedia/cmsamplebuffer/setdatabuffer(_:).md)
- [imageBuffer](coremedia/cmsamplebuffer/imagebuffer.md)
- [withAudioBufferList(blockBufferMemoryAllocator:flags:body:)](coremedia/cmsamplebuffer/withaudiobufferlist(blockbuffermemoryallocator:flags:body:).md)
- [copyPCMData(fromRange:into:)](coremedia/cmsamplebuffer/copypcmdata(fromrange:into:).md)
- [audioStreamPacketDescriptions()](coremedia/cmsamplebuffer/audiostreampacketdescriptions().md)
- [withUnsafeAudioStreamPacketDescriptions(_:)](coremedia/cmsamplebuffer/withunsafeaudiostreampacketdescriptions(_:).md)
- [singleSampleBuffers()](coremedia/cmsamplebuffer/singlesamplebuffers().md)
- [CMSampleBuffer.SingleSampleBuffers](coremedia/cmsamplebuffer/singlesamplebuffers.md)
