AudioAnalysis::write (boost::filesystem::path filename)
{
auto doc = make_shared<xmlpp::Document>();
- xmlpp::Element* root = doc->create_root_node ("AudioAnalysis");
+ auto root = doc->create_root_node("AudioAnalysis");
- root->add_child("Version")->add_child_text(raw_convert<string>(_current_state_version));
+ cxml::add_text_child(root, "Version", raw_convert<string>(_current_state_version));
for (auto& i: _data) {
- auto channel = root->add_child ("Channel");
+ auto channel = cxml::add_child(root, "Channel");
for (auto& j: i) {
- j.as_xml (channel->add_child ("Point"));
+ j.as_xml(cxml::add_child(channel, "Point"));
}
}
for (size_t i = 0; i < _sample_peak.size(); ++i) {
- auto n = root->add_child("SamplePeak");
+ auto n = cxml::add_child(root, "SamplePeak");
n->add_child_text (raw_convert<string> (_sample_peak[i].peak));
n->set_attribute ("Time", raw_convert<string> (_sample_peak[i].time.get()));
}
for (auto i: _true_peak) {
- root->add_child("TruePeak")->add_child_text (raw_convert<string> (i));
+ cxml::add_text_child(root, "TruePeak", raw_convert<string>(i));
}
if (_integrated_loudness) {
- root->add_child("IntegratedLoudness")->add_child_text (raw_convert<string> (_integrated_loudness.get ()));
+ cxml::add_text_child(root, "IntegratedLoudness", raw_convert<string>(_integrated_loudness.get()));
}
if (_loudness_range) {
- root->add_child("LoudnessRange")->add_child_text (raw_convert<string> (_loudness_range.get ()));
+ cxml::add_text_child(root, "LoudnessRange", raw_convert<string>(_loudness_range.get()));
}
if (_analysis_gain) {
- root->add_child("AnalysisGain")->add_child_text (raw_convert<string> (_analysis_gain.get ()));
+ cxml::add_text_child(root, "AnalysisGain", raw_convert<string>(_analysis_gain.get()));
}
- root->add_child("SamplesPerPoint")->add_child_text (raw_convert<string> (_samples_per_point));
- root->add_child("SampleRate")->add_child_text (raw_convert<string> (_sample_rate));
+ cxml::add_text_child(root, "SamplesPerPoint", raw_convert<string>(_samples_per_point));
+ cxml::add_text_child(root, "SampleRate", raw_convert<string>(_sample_rate));
if (_leqm) {
- root->add_child("Leqm")->add_child_text(raw_convert<string>(*_leqm));
+ cxml::add_text_child(root, "Leqm", raw_convert<string>(*_leqm));
}
doc->write_to_file_formatted (filename.string ());