void Color3WayMain::save_data(KeyFrame *keyframe)
{
	FileXML output;

// cause data to be stored directly in text
	output.set_shared_string(keyframe->get_data(), MESSAGESIZE);
	output.tag.set_title("COLOR3WAY");
	for(int i = 0; i < SECTIONS; i++)
	{
		char string[BCTEXTLEN];
		sprintf(string, "HUE_X_%d", i);
		output.tag.set_property(string, config.hue_x[i]);
		sprintf(string, "HUE_Y_%d", i);
		output.tag.set_property(string, config.hue_y[i]);
		sprintf(string, "VALUE_%d", i);
		output.tag.set_property(string, config.value[i]);
		sprintf(string, "SATURATION_%d", i);
		output.tag.set_property(string, config.saturation[i]);
		if(is_defaults())
		{
			sprintf(string, "COPY_TO_ALL_%d", i);
			output.tag.set_property(string, copy_to_all[i]);
		}
	}

	if(is_defaults())
	{
		output.tag.set_property("W",  w);
		output.tag.set_property("H",  h);
	}
	
	output.append_tag();
	output.terminate_string();
}
void Color3WayMain::read_data(KeyFrame *keyframe)
{
	FileXML input;

	input.set_shared_string(keyframe->get_data(), strlen(keyframe->get_data()));

	int result = 0;

	while(!result)
	{
		result = input.read_tag();

		if(!result)
		{
			if(input.tag.title_is("COLOR3WAY"))
			{
				for(int i = 0; i < SECTIONS; i++)
				{
					char string[BCTEXTLEN];
					sprintf(string, "HUE_X_%d", i);
					config.hue_x[i] = input.tag.get_property(string, config.hue_x[i]);
					sprintf(string, "HUE_Y_%d", i);
					config.hue_y[i] = input.tag.get_property(string, config.hue_y[i]);
					sprintf(string, "VALUE_%d", i);
					config.value[i] = input.tag.get_property(string, config.value[i]);
					sprintf(string, "SATURATION_%d", i);
					config.saturation[i] = input.tag.get_property(string, config.saturation[i]);
					
					if(is_defaults())
					{
						sprintf(string, "COPY_TO_ALL_%d", i);
						copy_to_all[i] = input.tag.get_property(string, copy_to_all[i]);
					}
				}

				if(is_defaults())
				{
					w = input.tag.get_property("W", w);
					h = input.tag.get_property("H", h);
				}
			}
		}
	}
}
Esempio n. 3
0
void Synth::read_data(KeyFrame *keyframe)
{
	FileXML input;
	char string[BCTEXTLEN];
// cause htal file to read directly from text
	input.set_shared_input(keyframe->get_data(), strlen(keyframe->get_data()));

//printf("Synth::read_data %s\n", keyframe->get_data());
	int result = 0, current_osc = 0;
	//int total_oscillators = 0;
	while(!result)
	{
		result = input.read_tag();

		if(!result)
		{
			if(input.tag.title_is("SYNTH"))
			{
				config.wetness = input.tag.get_property("WETNESS", config.wetness);
				
				if(is_defaults())
				{
					window_w = input.tag.get_property("WINDOW_W", window_w);
					window_h = input.tag.get_property("WINDOW_H", window_h);
				}
				config.momentary_notes = input.tag.get_property("MOMENTARY_NOTES", config.momentary_notes);

//printf("Synth::read_data %d %d %d\n", __LINE__, window_w, window_h);
				for(int i = 0; i < MAX_FREQS; i++)
				{
					sprintf(string, "BASEFREQ_%d", i);
					config.base_freq[i] = input.tag.get_property(string, (double)0);
				}

				config.wavefunction = input.tag.get_property("WAVEFUNCTION", config.wavefunction);
				//total_oscillators = input.tag.get_property("OSCILLATORS", 0);
			}
			else
			if(input.tag.title_is("OSCILLATOR"))
			{
				if(current_osc >= config.oscillator_config.total)
					config.oscillator_config.append(new SynthOscillatorConfig(current_osc));

				config.oscillator_config.values[current_osc]->read_data(&input);
				current_osc++;
			}
		}
	}

	while(config.oscillator_config.total > current_osc)
		config.oscillator_config.remove_object();
}
Esempio n. 4
0
void GraphicEQ::read_data(KeyFrame *keyframe)
{
	FileXML input;
	int result = 0;

	input.set_shared_string(keyframe->get_data(), strlen(keyframe->get_data()));
	config.points.remove_all_objects();

	while(!result)
	{
		result = input.read_tag();

		if(!result)
		{
			if(input.tag.title_is("GRAPHICEQ"))
			{
				config.window_size = input.tag.get_property("WINDOW_SIZE", config.window_size);
				if(is_defaults())
				{
					w = input.tag.get_property("W", w);
					h = input.tag.get_property("H", h);
				}
			}
			else
			if(input.tag.title_is("POINT"))
			{
				GraphicPoint *point;
				config.points.append(point = new GraphicPoint);
				point->freq = input.tag.get_property("X", 0);
				point->value = input.tag.get_property("Y", 0.0);
			}
		}
	}

//	if(!active_point_exists()) active_point = -1;
}