[Stk] RtWvIn, RAWWAVES, etc

Gary Scavone gary@ccrma.Stanford.EDU
Mon, 9 Jun 2003 17:14:43 -0700 (PDT)


Hi Greg,

On Mon, 9 Jun 2003, greg kellum wrote:

>>As for the sound card question, yes, I am having problems getting the 
>>default number and size of RtWvIn's audio buffers to work using Window's 
>>DirectSound API. The sound card is an Echo Audio Gina 20 card. When I used 
>>the STK's defaults (two 1024 buffers), a lot of samples seemed to go lost, 
>>because everything sounded rather grainy, but when I switched to the 
>>settings Cubase used for this card (five 5512 buffers), then everything 
>>sounded fine.  I'd be curious to know how Cubase is able to figure out this 
>>information out;
>>I have no idea whether the program gets this information through DirectSound 
>>or if it has something to do with the ASIO driver protocol. In any case I 
>>suppose as a work around I'll build in a command line argument for the sound 
>>card type and retrieve the appropriate number of buffers and buffer sizes 
>>from a property file.

In general, there is no mechanism in DirectSound for determining the 
"correct" number of buffers and buffer sizes that a card will support.  
For Windows machines, you can typically expect about 8 buffers of 1024 
sample frames each to work.  But of course, that represents a lot of 
latency.  In ASIO, there is a call to get the min and max buffer sizes 
and the "number of buffers" parameter is ignored ... I think ASIO uses 
a double-buffering scheme.

>>By the way do you have any suggestions for how one might go about setting 
>>the directory for the raw waves needed by many of the STK's instruments? One 
>>can specify the value for the RAWWAVES macro in a makefile, but that means 
>>that anyone using a program based on the STK would have to recompile the 
>>program after setting this. And that can be a bit daunting for 
>>non-programmers. One might also set the RAWWAVES macro to retrieve an 
>>environment variable defining the location of the raw waves directory, and 
>>then someone using an STK based program would only have to set this 
>>variable. But that would only work if every STK class using this macro 
>>imported stdlib.h, and even if they did (and most do -- Modulate.cpp is the 
>>only exception I've found), this approach still has the drawback that if a 
>>user forgot to set this variable, they might get a pretty cryptic error 
>>message like "Bus error". Any suggestions?

In the next release (hopefully by mid-July), I've created a static Stk
class variable which can be used to set the RAWWAVES path dynamically
(similar to the way the sample rate works).

--gary