c guru (bit off topic)

thudson at cygnus.com thudson at cygnus.com
Tue Sep 21 15:24:57 CEST 1999


Martin Czech wrote:
> 
> Could one of the c gurus on this list please enlighten me:
> 
> 1. I'm looking for a way to transfer files rapidly into dram.
>    There must be some kind of block-transfer stuff, but how
>    is this encoded in the librarys? fscanf is slow.

On Linux or most unixes, you can use mmap(2). This may even
be supported on non-standard OSes :-).

       #include <unistd.h>
       #include <sys/mman.h>

       #ifdef _POSIX_MAPPED_FILES

       void  *  mmap(void  *start,  size_t length, int prot , int
       flags, int fd, off_t offset);

       int munmap(void *start, size_t length);

       #endif

> 
> 2. Does anyone have a (preferable gnu-c) piece of code,
>    that dumps memory into a sound card (soundblaster)?
>    That way I wouldn't need to read the result file
>    into Cool-Edit or something each time a computation
>    is done.

On Linux, there is a very good driver/interface library called
ALSA (http://www.alsa-project.org/).

Thomas



More information about the Synth-diy mailing list