static int init_input_device(phastream_t *as, float rate, unsigned channels, unsigned format) {
	ca_dev *cadev = (ca_dev *) as->drvinfo;

	set_data_source(get_audiodeviceid(cadev->inputID), 1, get_datasourceid(cadev->inputID));
	set_recorded_format(as, rate, channels, format);
	set_input_callback(get_audiodeviceid(cadev->inputID), input_proc, as);
	return 0; // OK
}
Beispiel #2
0
gint update_data_source_name(GtkWidget *widget, gpointer data)
{
	if (data_source_name) {
		g_free(data_source_name);
	}
	data_source_name = gtk_combo_box_get_active_text(GTK_COMBO_BOX(widget));
	set_data_source();
}
int set_data_source_fd(State **ps, int fd, int64_t offset, int64_t length) {
    char path[256] = "";

    //int myfd = dup(fd);
    FILE *file = fdopen(fd, "rb");
    
    if (file && (fseek(file, offset, SEEK_SET) == 0)) {
        //int fdd = fileno(file);
        char str[20];
        sprintf(str, "pipe:%d", fd);
        strcat(path, str);
    }
    
    return set_data_source(ps, path, NULL);
}
static int init_output_device(phastream_t *as, float rate, unsigned channels, unsigned format) {
	OSStatus err = noErr;
	ca_dev *cadev = (ca_dev *) as->drvinfo;

	set_data_source(get_audiodeviceid(cadev->outputID), 0, get_datasourceid(cadev->outputID));

	init_audio_unit(&cadev->outputAU);
	set_played_format(cadev->outputAU, rate, channels, format);
	set_audio_unit_device(cadev->outputAU, get_audiodeviceid(cadev->outputID));
	set_render_callback(cadev->outputAU, output_renderer, as);

	err = AudioUnitInitialize(cadev->outputAU);
	if (err) {
		DBG_DYNA_AUDIO_DRV ("!!CoreAudio: AudioUnitInitialize-SF=%4.4s, %ld\n", (char*)&err, err);
		return -1;
	}
	
	return 0; //OK
}