EasyManua.ls Logo

Townshend Computer Tools DAT-Link - Page 120

Default Icon
208 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
116 Subroutine Library
#include <netaudio.h>
#include <defaults.h>
main(argc,argv)
int argc;
char *argv[];
{
NAport *port;
NAinfo info;
/* Initialize '.datlinkrc' processing */
InitDefaults(argv[0]);
/* Fill 'buffer' with 'samples' samples of audio data */
/* Open connection to DAT-Link server */
port = NAOpen(0);
NAGetDefaultInfo(&info);
/* Set sampling rate to 8000 samples/second */
info.playback.sampleRate = 8000;
/* Set for stereo playback */
info.playback.channels = NA_CHANNELS_STEREO;
/* Set for gain of 2.0 */
info.playback.gain = 2.0;
NASetInfo(port,&info);
/* Open data connection */
NAOpenData(port,NA_PLAY);
/* Send the audio data */
NAWrite(port, (char *)buffer, samples*2);
/* Start playback */
NABegin(port,NA_PLAY);
/* Wait for playback to finish */
NADrain(port);
/* Close connection to server */
NAClose(port);
}

Table of Contents