mirror of
https://github.com/thestk/stk
synced 2026-01-11 20:11:52 +00:00
95 lines
7.4 KiB
HTML
95 lines
7.4 KiB
HTML
<HTML>
|
|
<HEAD>
|
|
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
|
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
|
</HEAD>
|
|
<BODY BGCOLOR="#FFFFFF">
|
|
<CENTER>
|
|
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
|
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
|
<HR>
|
|
<!-- Generated by Doxygen 1.4.4 -->
|
|
<div class="nav">
|
|
<a class="el" href="dir_000000.html">include</a></div>
|
|
<h1>MidiFileIn.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/**********************************************************************/</span>
|
|
<a name="l00016"></a>00016 <span class="comment">/**********************************************************************/</span>
|
|
<a name="l00017"></a>00017
|
|
<a name="l00018"></a>00018 <span class="preprocessor">#ifndef STK_MIDIFILEIN_H</span>
|
|
<a name="l00019"></a>00019 <span class="preprocessor"></span><span class="preprocessor">#define STK_MIDIFILEIN_H</span>
|
|
<a name="l00020"></a>00020 <span class="preprocessor"></span>
|
|
<a name="l00021"></a>00021 <span class="preprocessor">#include "Stk.h"</span>
|
|
<a name="l00022"></a>00022 <span class="preprocessor">#include <string></span>
|
|
<a name="l00023"></a>00023 <span class="preprocessor">#include <vector></span>
|
|
<a name="l00024"></a>00024 <span class="preprocessor">#include <fstream></span>
|
|
<a name="l00025"></a>00025 <span class="preprocessor">#include <sstream></span>
|
|
<a name="l00026"></a>00026
|
|
<a name="l00027"></a><a class="code" href="classMidiFileIn.html">00027</a> <span class="keyword">class </span><a class="code" href="classMidiFileIn.html">MidiFileIn</a> : <span class="keyword">public</span> <a class="code" href="classStk.html">Stk</a>
|
|
<a name="l00028"></a>00028 {
|
|
<a name="l00029"></a>00029 <span class="keyword">public</span>:
|
|
<a name="l00031"></a>00031
|
|
<a name="l00035"></a>00035 <a class="code" href="classMidiFileIn.html#a0">MidiFileIn</a>( std::string fileName );
|
|
<a name="l00036"></a>00036
|
|
<a name="l00038"></a>00038 <a class="code" href="classMidiFileIn.html#a1">~MidiFileIn</a>();
|
|
<a name="l00039"></a>00039
|
|
<a name="l00041"></a>00041 <span class="keywordtype">int</span> <a class="code" href="classMidiFileIn.html#a2">getFileFormat</a>() <span class="keyword">const</span>;
|
|
<a name="l00042"></a>00042
|
|
<a name="l00044"></a>00044 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classMidiFileIn.html#a3">getNumberOfTracks</a>() <span class="keyword">const</span>;
|
|
<a name="l00045"></a>00045
|
|
<a name="l00047"></a>00047
|
|
<a name="l00052"></a>00052 <span class="keywordtype">int</span> <a class="code" href="classMidiFileIn.html#a4">getDivision</a>() <span class="keyword">const</span>;
|
|
<a name="l00053"></a>00053
|
|
<a name="l00055"></a>00055
|
|
<a name="l00059"></a>00059 <span class="keywordtype">void</span> <a class="code" href="classMidiFileIn.html#a5">rewindTrack</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> track = 0 );
|
|
<a name="l00060"></a>00060
|
|
<a name="l00062"></a>00062
|
|
<a name="l00069"></a>00069 <span class="keywordtype">double</span> <a class="code" href="classMidiFileIn.html#a6">getTickSeconds</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> track = 0 );
|
|
<a name="l00070"></a>00070
|
|
<a name="l00072"></a>00072
|
|
<a name="l00084"></a>00084 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classMidiFileIn.html#a7">getNextEvent</a>( std::vector<unsigned char> *event, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> track = 0 );
|
|
<a name="l00085"></a>00085
|
|
<a name="l00087"></a>00087
|
|
<a name="l00097"></a>00097 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classMidiFileIn.html#a8">getNextMidiEvent</a>( std::vector<unsigned char> *midiEvent, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> track = 0 );
|
|
<a name="l00098"></a>00098
|
|
<a name="l00099"></a>00099 <span class="keyword">protected</span>:
|
|
<a name="l00100"></a>00100
|
|
<a name="l00101"></a>00101 <span class="comment">// This protected class function is used for reading variable-length</span>
|
|
<a name="l00102"></a>00102 <span class="comment">// MIDI file values. It is assumed that this function is called with</span>
|
|
<a name="l00103"></a>00103 <span class="comment">// the file read pointer positioned at the start of a</span>
|
|
<a name="l00104"></a>00104 <span class="comment">// variable-length value. The function returns true if the value is</span>
|
|
<a name="l00105"></a>00105 <span class="comment">// successfully parsed. Otherwise, it returns false.</span>
|
|
<a name="l00106"></a>00106 <span class="keywordtype">bool</span> readVariableLength( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> *value );
|
|
<a name="l00107"></a>00107
|
|
<a name="l00108"></a>00108 std::ifstream file_;
|
|
<a name="l00109"></a>00109 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nTracks_;
|
|
<a name="l00110"></a>00110 <span class="keywordtype">int</span> format_;
|
|
<a name="l00111"></a>00111 <span class="keywordtype">int</span> division_;
|
|
<a name="l00112"></a>00112 <span class="keywordtype">bool</span> usingTimeCode_;
|
|
<a name="l00113"></a>00113 std::vector<double> tickSeconds_;
|
|
<a name="l00114"></a>00114 std::vector<long> trackPointers_;
|
|
<a name="l00115"></a>00115 std::vector<long> trackOffsets_;
|
|
<a name="l00116"></a>00116 std::vector<long> trackLengths_;
|
|
<a name="l00117"></a>00117 std::vector<char> trackStatus_;
|
|
<a name="l00118"></a>00118
|
|
<a name="l00119"></a>00119 <span class="comment">// This structure and the following variables are used to save and</span>
|
|
<a name="l00120"></a>00120 <span class="comment">// keep track of a format 1 tempo map (and the initial tickSeconds</span>
|
|
<a name="l00121"></a>00121 <span class="comment">// parameter for formats 0 and 2).</span>
|
|
<a name="l00122"></a>00122 <span class="keyword">struct </span>TempoChange {
|
|
<a name="l00123"></a>00123 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> count;
|
|
<a name="l00124"></a>00124 <span class="keywordtype">double</span> tickSeconds;
|
|
<a name="l00125"></a>00125 };
|
|
<a name="l00126"></a>00126 std::vector<TempoChange> tempoEvents_;
|
|
<a name="l00127"></a>00127 std::vector<unsigned long> trackCounters_;
|
|
<a name="l00128"></a>00128 std::vector<unsigned int> trackTempoIndex_;
|
|
<a name="l00129"></a>00129 };
|
|
<a name="l00130"></a>00130
|
|
<a name="l00131"></a>00131 <span class="preprocessor">#endif</span>
|
|
</pre></div><HR>
|
|
|
|
<table>
|
|
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
|
<tr><td>©1995-2007 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
|
</table>
|
|
|
|
</BODY>
|
|
</HTML>
|