From 0c21a7a0d5b84dc6726462f0fbe51b8c32433262 Mon Sep 17 00:00:00 2001 From: Michael Krelin Date: Fri, 11 Aug 2006 16:01:56 +0000 Subject: initial commit into repository --- (limited to 'lib/MTrk.cc') diff --git a/lib/MTrk.cc b/lib/MTrk.cc new file mode 100644 index 0000000..fa1e0f8 --- a/dev/null +++ b/lib/MTrk.cc @@ -0,0 +1,34 @@ +#include +#include +#include +#include + +namespace midillo { + using std::copy; + using std::ostream_iterator; + using std::endl; + + void MTrk_t::load(istream& s) { + header.load(s); + if(header.id_number!=chunk_id_MTrk) + throw exception_unexpected_input(CODEPOINT,"MTrk chunk expected"); + events.load(s); + } + + void MTrk_t::save(ostream& s) const { + chunk_header_t h = header; + h.id_number = chunk_id_MTrk; + h.length = events.calculate_save_size(); + h.save(s); + events.save(s); + } + + void MTrk_t::dump(ostream& s) const { + s << " " << header << endl + << " "; + copy( + events.begin(), events.end(), + ostream_iterator(s,"\n ") ); + } + +} -- cgit v0.9.0.2