Comments (1)
RecordBuffer layout
to allow for dynamic adjustment of seams and compensation for SDL key event delay
the following are the buffer offsets used:
invariant -->
BeginFrameN <= beginFrameN <= currentFrameN < endFrameN <= EndFrameN
initially -->
beginFrameN = currentFrameN = BeginFrameN = BufferMarginSize
endFrameN = EndFrameN = (RecordBufferSize - BufferSize)
on initial trigger -->
beginFrameN = currentFrameN - TriggerLatencySize
on accepting trigger -->
if (currentFrameN > beginFrameN + MINIMUM_LOOP_DURATION) // (issue #12)
endFrameN = currentFrameN
nFrames = endFrameN - TriggerLatencySize - beginFrameN
after each rollover -->
beginFrameN = BeginFrameN
endFrameN = BeginFrameN + nFrames
after first rollover -->
currentFrameN = BeginFrameN + TriggerLatencySize
after subsequent rollovers -->
currentFrameN = BeginFrameN
all of the above offsets are multiples of BufferSize (aka nFramesPerPeriod)
excepting beginFrameN and nFrames
on each rollover (TODO: this is currently only done when copying base loops)
set currentFrameN = BeginFrameN (+ TriggerLatencySize if base loop)
copy tail end of RecordBuffer back to the beginning of RecordBuffer
this will be the LeadIn of the next loop (may or may not be part of a previous loop)
let begin = (beginFrameN + nFrames) - BufferMarginSize
initial base loop -->
RecordBuffer[begin] upto RecordBuffer[endFrameN]
--> RecordBuffer[0]
subsequent loops -->
RecordBuffer[begin] upto RecordBuffer[endFrameN + TriggerLatencySize]
--> RecordBuffer[0]
on creation of each loop
copy the entire buffer to include per loop LeadIn
RecordBuffer[0] upto RecordBuffer[endFrameN]
--> NewLoop[0]
on creation of base loops
set beginFrameN = BeginFrameN
set currentFrameN = BeginFrameN + TriggerLatencySize
set endFrameN = BeginFrameN + nFrames
all subsequent loops will use beginFrameN and endFrameN (dynamically) as seams
on next rollover following creation of each loop
copy the leading BeginFrameN + BufferMarginSize to the end of the previous loop
regardless of creating a new loop from the current data
this will be the leadOut of the previous loop
RecordBuffer[BeginFrameN] upto RecordBuffer[BeginFrameN + BufferMarginSize]
--> PrevLoop[BeginFrameN + nFrames]
INITIAL RECORD BUFFER
currentFrameN // dynamic offset
beginFrameN endFrameN // dynamic offsets
BeginFrameN EndFrameN // static offsets
| |
|<-MarginSize->|<--------(RecordBufferSize - MarginSize)-------->| // sizes
|<---LeadIn--->|<-----------------RolloverRange----------------->| // 'zones'
|<-------------------------RecordBuffer------------------------->| // buffer
INITIAL BASE LOOP
beginFrameN endFrameN // offsets
thisLeadInBegin | | // pointer
| | |
|<-?->|<-MarginSize->|<-----------nFrames------------>|<-MarginSize->|<-?->| // sizes
| |<---LeadIn--->|<--------RolloverRange--------->|<--LeadOut--->| | // 'zones'
| |<-------------------Source-------------------->| | | // data
| |<--------------------Dest--------------------->|<--Pending--->| | // data
| |<--------------------------NewLoop--------------------------->| | // dest
|<------------------------------RecordBuffer------------------------------>| // source
SUBSEQUENT LOOPS
beginFrameN endFrameN // offsets
thisLeadInBegin | | // pointer
| | |
|<-MarginSize->|<-----------nFrames------------>|<-MarginSize->|<----?---->| // sizes
|<---LeadIn--->|<--------RolloverRange--------->|<--LeadOut--->| | // 'zones'
|<-------------------Source-------------------->| | | // data
|<--------------------Dest--------------------->|<--Pending--->| | // data
|<--------------------------NewLoop--------------------------->| | // dest
|<------------------------------RecordBuffer------------------------------>| // source
SHIFT NEXT LEAD-IN
beginFrameN endFrameN // offsets
| nextLeadInBegin | // pointer
| | |
|<-MarginSize->| |<-MarginSize->| | // sizes
|<----Dest---->| |<---Source--->| | // data
|<------------------------------RecordBuffer------------------------------>| // source/dest
COPY PREVIOUS LEAD_OUT (TODO)
beginFrameN endFrameN // offsets
| mixBegin | // pointer
| | |
|<-MarginSize->|<-MarginSize->| |<-MarginSize->| | // sizes
| |<---Source--->| |<----Dest---->| | // data
|<---LeadIn--->|<--------RolloverRange--------->|<--LeadOut--->| | // 'zones'
|<--------------------------NewLoop--------------------------->| | // dest
|<------------------------------RecordBuffer------------------------------>| // source
from loopidity.
Related Issues (20)
- reimplement drawing loops HOT 1
- add pending loop indicators HOT 1
- make input scope function before recording begins HOT 1
- make scopes draw gradient HOT 1
- add nextScene indicator HOT 1
- allow auto scene changing HOT 1
- implement large histogram HOT 1
- port to win32 HOT 1
- transition to makefile project HOT 1
- setup for travis and deb packaging
- implement per-channel VU meters HOT 1
- Build instructions seem outdated. HOT 3
- pkgconfig is not mentioned in the README HOT 1
- make: *** No rule to make target 'install'. Stop. HOT 1
- Change of scene does not start recording a new loop HOT 1
- feature request: variable loop size. HOT 9
- loops get obscured by the massive output level overlay bar HOT 6
- feature request: trigger by threshold HOT 1
- feature request: undo record HOT 1
- Please add documentation HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from loopidity.