Version 3.0

This commit is contained in:
Gary Scavone
2013-09-25 11:21:51 +02:00
committed by Stephen Sinclair
parent 7c0ee03d60
commit 868787a5f9
348 changed files with 12471 additions and 9135 deletions

58
STK/RTWvOut.cpp Normal file
View File

@@ -0,0 +1,58 @@
/*******************************************/
/* Real-Time Wave File Output Class, */
/* by Perry R. Cook, 1996 */
/* revised by Gary P. Scavone, 1999 */
/* */
/* This object opens a realtime soundout */
/* device, and pokes buffers of samples */
/* into it. */
/*******************************************/
#include "RTWvOut.h"
#if defined(__STK_REALTIME_)
RTWvOut :: RTWvOut(MY_FLOAT srate, int chans)
{
// We'll let RTSoundIO deal with channel and srate limitations.
channels = chans;
soundIO = new RTSoundIO(srate, channels, "play");
counter = 0;
}
RTWvOut :: ~RTWvOut()
{
soundIO->playBuffer(data,counter);
counter = 0;
while (counter<RT_BUFFER_SIZE) {
data[counter++] = 0;
}
soundIO->playBuffer(data,counter);
soundIO->playBuffer(data,counter); // Are these extra writes necessary?
soundIO->playBuffer(data,counter);
delete soundIO;
}
void RTWvOut :: tick(MY_FLOAT sample)
{
for (int i=0;i<channels;i++)
data[counter++] = (short) (sample * 32000.0);
if (counter >= RT_BUFFER_SIZE) {
soundIO->playBuffer(data,counter);
counter = 0;
}
}
void RTWvOut :: mtick(MY_MULTI samples)
{
for (int i=0;i<channels;i++)
data[counter++] = (short) (*samples++ * 32000.0);
if (counter >= RT_BUFFER_SIZE) {
soundIO->playBuffer(data,counter);
counter = 0;
}
}
#endif