示例#1
0
void SampleChannel::writePatch(FILE *fp, int i, bool isProject) {

	const char *path = "";
	if (wave != NULL) {
		path = wave->pathfile.c_str();
		if (isProject)
			path = gBasename(path).c_str();  // make it portable
	}

	fprintf(fp, "samplepath%d=%s\n",     i, path);
	fprintf(fp, "chanSide%d=%d\n",       i, side);
	fprintf(fp, "chanType%d=%d\n",       i, type);
	fprintf(fp, "chanKey%d=%d\n",        i, key);
	fprintf(fp, "chanIndex%d=%d\n",      i, index);
	fprintf(fp, "chanmute%d=%d\n",       i, mute);
	fprintf(fp, "chanMute_s%d=%d\n",     i, mute_s);
	fprintf(fp, "chanSolo%d=%d\n",       i, solo);
	fprintf(fp, "chanvol%d=%f\n",        i, volume);
	fprintf(fp, "chanmode%d=%d\n",       i, mode);
	fprintf(fp, "chanBegin%d=%d\n",      i, begin);
	fprintf(fp, "chanend%d=%d\n",        i, end);
	fprintf(fp, "chanBoost%d=%f\n",      i, boost);
	fprintf(fp, "chanPanLeft%d=%f\n",    i, panLeft);
	fprintf(fp, "chanPanRight%d=%f\n",   i, panRight);
	fprintf(fp, "chanRecActive%d=%d\n",  i, readActions);
	fprintf(fp, "chanPitch%d=%f\n",      i, pitch);

	writePatchMidiIn(fp, i);
	fprintf(fp, "chanMidiInReadActions%d=%u\n", i, midiInReadActions);
	fprintf(fp, "chanMidiInPitch%d=%u\n",       i, midiInPitch);
}
示例#2
0
gdPlugin::gdPlugin(gdPluginList *gdp, Plugin *p, int X, int Y, int W)
	: Fl_Group(X, Y, W, 20), pParent(gdp), pPlugin (p)
{
	begin();
	button    = new gButton(8, y(), 220, 20);
	program   = new gChoice(button->x()+button->w()+4, y(), 132, 20);
	bypass    = new gButton(program->x()+program->w()+4, y(), 20, 20);
	shiftUp   = new gButton(bypass->x()+bypass->w()+4, y(), 20, 20, "", fxShiftUpOff_xpm, fxShiftUpOn_xpm);
	shiftDown = new gButton(shiftUp->x()+shiftUp->w()+4, y(), 20, 20, "", fxShiftDownOff_xpm, fxShiftDownOn_xpm);
	remove    = new gButton(shiftDown->x()+shiftDown->w()+4, y(), 20, 20, "", fxRemoveOff_xpm, fxRemoveOn_xpm);
	end();

	if (pPlugin->status != 1) {  // bad state
		char name[256];
		sprintf(name, "* %s *", gBasename(pPlugin->pathfile).c_str());
		button->copy_label(name);
	}
	else {
		char name[256];
		pPlugin->getProduct(name);
		if (strcmp(name, " ")==0)
			pPlugin->getName(name);

		button->copy_label(name);
		button->callback(cb_openPluginWindow, (void*)this);

		program->callback(cb_setProgram, (void*)this);

		/* loading vst programs */
		/* FIXME - max programs = 128 (unknown source) */

		for (int i=0; i<64; i++) {
			char out[kVstMaxProgNameLen];
			pPlugin->getProgramName(i, out);
			for (int j=0; j<kVstMaxProgNameLen; j++)  // escape FLTK special chars
				if (out[j] == '/' || out[j] == '\\' || out[j] == '&' || out[j] == '_')
					out[j] = '-';
			if (strlen(out) > 0)
				program->add(out);
		}
		if (program->size() == 0) {
			program->add("-- no programs --\0");
			program->deactivate();
		}
		if (pPlugin->getProgram() == -1)
			program->value(0);
		else
			program->value(pPlugin->getProgram());

		bypass->callback(cb_setBypass, (void*)this);
		bypass->type(FL_TOGGLE_BUTTON);
		bypass->value(pPlugin->bypass ? 0 : 1);
	}

	shiftUp->callback(cb_shiftUp, (void*)this);
	shiftDown->callback(cb_shiftDown, (void*)this);
	remove->callback(cb_removePlugin, (void*)this);
}
示例#3
0
文件: wave.cpp 项目: rzr/giada
void Wave::updateName(const char *n) {
	std::string ext = gGetExt(pathfile.c_str());
	name      = gStripExt(gBasename(n).c_str());
	pathfile  = gDirname(pathfile.c_str()) + gGetSlash() + name + "." + ext;
	isLogical = true;

	/* a wave with updated name must become logical, since the underlying
	 * file does not exist yet. */
}
示例#4
0
void Wave::updateName(const char *n)
{
	std::string ext = gGetExt(pathfile.c_str());
	name      = gStripExt(gBasename(n).c_str());
	pathfile  = gDirname(pathfile.c_str()) + gGetSlash() + name + "." + ext;
	isLogical = true;

	
}
示例#5
0
文件: wave.cpp 项目: fourks/giada
int Wave::open(const char *f) {
	pathfile = f;
	name   = gBasename(f);
#if defined(__linux__)
	name   = stripExt(name.c_str());  // in linux gBasename doesn't strip
#endif
	fileIn = sf_open(f, SFM_READ, &inHeader);
	if (fileIn == NULL) {
		printf("[wave] unable to read %s\n", f);
		pathfile = "";
		name     = "";
		return 0;
	}
	isLogical = false;
	isEdited  = false;
	return 1;
}
示例#6
0
文件: wave.cpp 项目: DomiLou/giada
int Wave::open(const char *f)
{
	pathfile = f;
	name     = gStripExt(gBasename(f).c_str());
	fileIn   = sf_open(f, SFM_READ, &inHeader);

	if (fileIn == NULL) {
		gLog("[wave] unable to read %s. %s\n", f, sf_strerror(fileIn));
		pathfile = "";
		name     = "";
		return 0;
	}

	isLogical = false;
	isEdited  = false;

	return 1;
}
示例#7
0
void SampleChannel::writePatch(FILE *fp, int i, bool isProject)
{
	Channel::writePatch(fp, i, isProject);

	const char *path = "";
	if (wave != NULL) {
		path = wave->pathfile.c_str();
		if (isProject)
			path = gBasename(path).c_str();  // make it portable
	}

	fprintf(fp, "samplepath%d=%s\n",     i, path);
	fprintf(fp, "chanKey%d=%d\n",        i, key);
	//fprintf(fp, "columnIndex%d=%d\n",    i, index);
	fprintf(fp, "chanmode%d=%d\n",       i, mode);
	fprintf(fp, "chanBegin%d=%d\n",      i, begin);
	fprintf(fp, "chanend%d=%d\n",        i, end);
	fprintf(fp, "chanBoost%d=%f\n",      i, boost);
	fprintf(fp, "chanRecActive%d=%d\n",  i, readActions);
	fprintf(fp, "chanPitch%d=%f\n",      i, pitch);

	fprintf(fp, "chanMidiInReadActions%d=%u\n", i, midiInReadActions);
	fprintf(fp, "chanMidiInPitch%d=%u\n",       i, midiInPitch);
}
示例#8
0
文件: wave.cpp 项目: DomiLou/giada
std::string Wave::basename() const
{
	return gStripExt(gBasename(pathfile.c_str()).c_str());
}