#include "dsd_sink.h"
#include "foo_dsd_asio.h"

dsd_sink_t::dsd_sink_t() : dsd_path_t () {
	pCoASIO = NULL;
}

void dsd_sink_t::attach(CoASIO* pC) {
	pCoASIO = pC;
}

void dsd_sink_t::detach() {
	pCoASIO = NULL;
}

void dsd_sink_t::set_state(asio_state_e state) {
	if (p_control) {
		p_control->state = state;
	}
}

void dsd_sink_t::command(dsdcmd_t cmd) {
	switch (cmd.id) {
	case dsdcmd_sink_init:
		attach_control_channel();
		break;
	case dsdcmd_sink_free:
		close_control_channel();
		close_dsddata_channel();
		break;
	case dsdcmd_playback_start:
		attach_dsddata_channel();
		break;
	default:
		break;
	}
}
