|
From: Benno S. <be...@ga...> - 2003-08-11 13:44:08
|
Scrive Christian Schoenebeck <chr...@ep...>:
> Hi!
>
> I thought about adding mmap() support as a compile time option to the Akai
> and
> Giga libs. I would also recommend to place the sample head cache (for the
> first couple of sample chunks to allow instant triggering of the samples)
> directly into those libs, so the engine doesn't have to care about
> maintaining such things. What do you think?
>
Hmm not sure if this would be a good idea (that the lib handles the caching
of the first samples).
The fact is that the playback engine will need to know about the
cached size, offset where to switch from ram to disk based playback etc
anyway, plus the engine could decide to cache different amounts of samples
depending on some factors thus I think it is better if your lib just
interprets all chunks and returns data structures describing the data
contained in them.
As for the chunks containing the actual samples it is sufficient to
export the offset (relative to the file) where they begin and the total
length.
Basically linuxsampler should do the following
handle=libgig->parsefile("file.gig");
now the engine reads the structs exported by libgig
traverse_datastructs_of_parsed_chunks(handle);
// file can be closed since the engine will do it's own filehandling
// (could be via read() or mmap() thus IMHO it is better to let
// libgig close it's file handles
libgig->closefile(handle);
fd=engine->open("file.gig"); (regular posix open() call)
// the engine now has all data it needs to play the sample
// sample attributes data structs and sample offsets within files stored
// in GIG chunks accessible via libgig->handle...
sampler_playback_main_loop();
Is this ok for you Christian ?
cheers,
Benno
http://linuxsampler.sourceforge.net
-------------------------------------------------
This mail sent through http://www.gardena.net
|