Goals:
Load only a minimal amount of sample data from the disk on load, and then read in chunks just-in-time.
The following properties should be fulfilled:
t
as well as a pointer to the AudioFile object containing the preloaded data. The fron-buffer is initially set to point to the preloaded data.t
is incremented.t
reaches the “trigger point 1”, the loader is signalet to start loading chunk1 into the back-buffer of the EventSample object.t
reaches the end of the front-buffer, the back and front buffers are switched and the “internal” buffer pointer is set to 0.t
reaches “trigger point 2” the loader is signaled to start loading chunk2 into tyhe back-buffer.The samples are stored in multi-channel wav files, so we want to read in multiple channels at once in the loader thread since all channels are played (and therefore loaded) in parallel. Therefore the EventSample should be referencing the Sample object and not the AudioFile object alone…
Receives events/queries for chunk loading.
Request : (filename/ref, channelnumber, position [size from manager??])
If filename/ref and position is the same on consecutive requests, but the channel numbers are different, the requests are reads from the same multi-channel file and is to be collapsed into a single read with writes to multiple buffers.
Once a file is opened, it should stay opened as long as the sample is active.