Skip to content

Instantly share code, notes, and snippets.

View Claudiohbsantos's full-sized avatar

Claudio Santos Claudiohbsantos

  • Even
  • New York, NY, US
View GitHub Profile
@Claudiohbsantos
Claudiohbsantos / Reaper_getSamplerate.lua
Last active August 8, 2017 03:43
How to get parameter from reaper RPP file. Reascript API
-- this function reads the RPP and stores it as chunks of 8 Kb in a table. This is more efficient than reading the file line by line (or at least I believe it is, please someone prove me wrong if you disagree =])
function readProjFileToTable(projFile)
local f = assert(io.open(projFile,"r"))
local projectChunks = {}
local BUFSIZE = 2^13 -- 8K
while true do
local projectChunk, rest = f:read(BUFSIZE, "*line")
if not projectChunk then break end
if rest then projectChunk = projectChunk .. rest .. '\n' end
table.insert(projectChunks,projectChunk)