author | Michael Krelin <hacker@klever.net> | 2006-08-11 16:01:56 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2006-08-11 16:01:56 (UTC) |
commit | 0c21a7a0d5b84dc6726462f0fbe51b8c32433262 (patch) (side-by-side diff) | |
tree | 9df6334cb1a61efebe68f7bcef9aa119a823626a /include/midillo/SMF.h | |
parent | 9bcc235e575a95989a5903394c127accbeef2e0f (diff) | |
download | midillo-0.0.zip midillo-0.0.tar.gz midillo-0.0.tar.bz2 |
initial commit into repository0.0
-rw-r--r-- | include/midillo/SMF.h | 87 |
1 files changed, 87 insertions, 0 deletions
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 <istream> +#include <ostream> +#include <list> +#include <midillo/MThd.h> +#include <midillo/MTrk.h> + +/** + * @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<MTrk_t> 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 */ |