Skip to content

Instantly share code, notes, and snippets.

@triplefox
Created February 12, 2015 07:47
Show Gist options
  • Save triplefox/6385d0b64904780f8692 to your computer and use it in GitHub Desktop.
Save triplefox/6385d0b64904780f8692 to your computer and use it in GitHub Desktop.
type
Array32Part{.unchecked.} = array[0..0, float32]
Buffer32 = ref object
samples: int
bytes: int
data: ptr Array32Part
proc AllocBuffer32(samples : int): Buffer32 =
let bytes = samples * (sizeof(float32))
Buffer32(samples: samples, bytes : bytes, data: cast[ptr Array32Part](alloc0(bytes)))
proc DeallocBuffer32(b : Buffer32) =
dealloc(cast[pointer](b.data))
var buffer:Buffer32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment