c guru (bit off topic)

Daniel Gendreau gendreau at rochester.rr.com
Tue Sep 21 20:16:17 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.

If you are doing this in Windows with C++, I have a simple class that maps a
file directly into the memory space without any need for direct transfer
into ram. It uses the window's virtual memory system to do it and works just
like your swapfile with full caching etc. Very efficient. I use it in a pet
softsynth project I have been tinkering with.

If you want more info on how it works, look up CreateFileMapping() and
MapViewOfFile(), but my object makes it much easier to do. I have mapped
200MB wave files into memory and played them without any slowdown or using
up 200MB of RAM!

> 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.

I wrote a group of objects to do this too. They handle reading/writing wave
files, streaming audio via wave-in/wave out, and DirectSound. There are MIDI
I/O objects as well.

Anyone who wants this code, let me know.
I would need to pretty it up a bit before I release it though.
-Dan G.




More information about the Synth-diy mailing list