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 'include/midillo/SMF.h') diff --git a/include/midillo/SMF.h b/include/midillo/SMF.h new file mode 100644 index 0000000..bec9f7a --- a/dev/null +++ b/include/midillo/SMF.h @@ -0,0 +1,87 @@ +#ifndef __MIDILLO_SMF_H +#define __MIDILLO_SMF_H + +#include +#include +#include +#include +#include + +/** + * @file + * @brief the SMF_t -- standard midi file + */ + +namespace midillo { + using std::istream; + using std::vector; + using std::ostream; + + /** + * Standard midi file object + */ + class SMF_t { + public: + /** + * MThd header chunk + */ + MThd_t mthd; + /** + * The type for collection of MTrk track chunks + */ + typedef list tracks_t; + /** + * MTrk track chunks collection for the file + */ + tracks_t tracks; + + SMF_t() { } + /** + * Construct object from the file + * @see load(const char *f,bool stdinable) + */ + SMF_t(const char *f,bool stdinable=true) { load(f,stdinable); } + /** + * Construct object from the stream + * @see load(istream& s) + */ + SMF_t(istream& s) { load(s); } + + /** + * Load MIDI data from the file + * @param f filename + * @param stdinable true if '-' is treatead as cin input stream + */ + void load(const char *f,bool stdinable=true); + /** + * Load midi data from the stream + * @param s input stream + */ + void load(istream& s); + + /** + * Save MIDI data to the file + * @param f filename + * @param stdoutable true if '-' is treated as cout output stream + */ + void save(const char *f,bool stdoutable=true) const; + /** + * Save MIDI data to the stream + * @param s output stream + */ + void save(ostream& s) const; + + /** + * Dump textual representation of SMF to stream + * @param s output stream + */ + void dump(ostream& s) const; + }; + + inline ostream& operator<<(ostream& s,const SMF_t& smf) { + smf.dump(s); return s; + } + +} + +#endif /* __MIDILLO_SMF_H */ -- cgit v0.9.0.2