Exemple #1
0
static PaError StartStream( PaStream *s )
{
    PaError result = paNoError;
    PaSkeletonStream *stream = (PaSkeletonStream*)s;

    PaUtil_ResetBufferProcessor( &stream->bufferProcessor );

    /* IMPLEMENT ME, see portaudio.h for required behavior */

    /* suppress unused function warning. the code in ExampleHostProcessingLoop or
       something similar should be implemented to feed samples to and from the
       host after StartStream() is called.
    */
    (void) ExampleHostProcessingLoop;

    return result;
}
Exemple #2
0
static PaError
StartStream(PaStream *stream)
{
	PaSndioStream *s = (PaSndioStream *)stream;
	unsigned primes, wblksz;
	int err;

	DPR("StartStream: s=%d, a=%d\n", s->stopped, s->active);

	if (!s->stopped) {
		DPR("StartStream: already started\n");
		return paNoError;
	}
	s->stopped = 0;
	s->active = 1;
	s->realpos = 0;
	s->wpos = 0;
	s->rpos = 0;
	PaUtil_ResetBufferProcessor(&s->bufproc);
	if (!sio_start(s->hdl))
		return paUnanticipatedHostError;

	/*
	 * send a complete buffer of silence
	 */
	if (s->mode & SIO_PLAY) {
		wblksz = s->par.round * s->par.pchan * s->par.bps;
		memset(s->wbuf, 0, wblksz);
		for (primes = s->par.bufsz / s->par.round; primes > 0; primes--)
			s->wpos += sio_write(s->hdl, s->wbuf, wblksz);
	}
	if (s->base.streamCallback) {
		err = pthread_create(&s->thread, NULL, sndioThread, s);
		if (err) {
			DPR("SndioStartStream: couldn't create thread\n");
			return paUnanticipatedHostError;
		}
		DPR("StartStream: started...\n");
	}
	return paNoError;
}