Esempio n. 1
0
// Start real-time playback.
int poly_start()
{
	if(poly_playback == 1)
	{
		DEBUG_MSG("called poly_start() but playback was in progress");
		return 0;
	}
	poly_playback = 1;
	int status = pthread_create(&poly_thread, NULL, poly_gen_kernel, NULL);
	switch(status)
	{
	case 0:
		break;
	case EAGAIN:
		DEBUG_MSG("insufficient resources to create another thread(EAGAIN)");
		poly_stop();
		return 1;
	case EINVAL:
		DEBUG_MSG("invalid thread attributes(EINVAL)");
		poly_stop();
		return 1;
	case EPERM:
		DEBUG_MSG("insufficient privileges to create thread(EPERM)");
		poly_stop();
		return 1;
	default:
		DEBUG_MSG("unknown pthread_create error");
		poly_stop();
		return 1;
	}
	return 0;
}
Esempio n. 2
0
// De-initialize the libPOLY environment.
void poly_shutdown()
{
	if(poly_playback == 1)
	{
		poly_stop();
	}
	if(poly_card != NULL)
	{
		ao_close(poly_card);
		poly_card = NULL;
	}
	if(poly_format != NULL)
	{
		free(poly_format);
		poly_format = NULL;
	}
	if(poly_ao_init == 1)
	{
		ao_shutdown();
	}
	if(poly_generators != NULL)
	{
		free(poly_generators);
		poly_generators = NULL;
	}
	return;
}
Esempio n. 3
0
// De-initialize the libPOLY environment.
void poly_shutdown()
{
	if(poly_playback == 1)
	{
		poly_stop();
	}
	if(poly_generators != NULL)
	{
		free(poly_generators);
		poly_generators = NULL;
	}
	return;
}