Skip to content

Instantly share code, notes, and snippets.

@BitPuffin
Created December 4, 2013 14:10
Show Gist options
  • Save BitPuffin/7787980 to your computer and use it in GitHub Desktop.
Save BitPuffin/7787980 to your computer and use it in GitHub Desktop.
proc openAudioFile*(path: string): ref PAudioFile =
debug("Allocating TOggVorbisFile memory")
var fileptr = cast[ptr TOggVorbisFile](alloc0(sizeof(TOggVorbisFile)))
debug("Creating new PAudioFile object")
new(result, close)
result.file = fileptr
debug("Opening vorbis file")
if fopen(cstring(path), result.file) != 0:
error("Opening file $1 failed!", path)
raise newException(EIO, "Failed to open file ")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment