mirror of
https://github.com/thestk/stk
synced 2026-04-19 22:16:54 +00:00
93 lines
5.8 KiB
HTML
93 lines
5.8 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="tutorial.html">Tutorial</a></CENTER>
|
|
<HR>
|
|
<!-- Generated by Doxygen 1.3.4 -->
|
|
<h1>MidiFileIn.h</h1><div class="fragment"><pre>00001 <span class="comment">/**********************************************************************/</span>
|
|
00016 <span class="comment">/**********************************************************************/</span>
|
|
00017
|
|
00018 <span class="preprocessor">#ifndef STK_MIDIFILEIN_H</span>
|
|
00019 <span class="preprocessor"></span><span class="preprocessor">#define STK_MIDIFILEIN_H</span>
|
|
00020 <span class="preprocessor"></span>
|
|
00021 <span class="preprocessor">#include "Stk.h"</span>
|
|
00022 <span class="preprocessor">#include <string></span>
|
|
00023 <span class="preprocessor">#include <vector></span>
|
|
00024 <span class="preprocessor">#include <fstream></span>
|
|
00025 <span class="preprocessor">#include <sstream></span>
|
|
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>
|
|
00028 {
|
|
00029 <span class="keyword">public</span>:
|
|
00031
|
|
00035 <a class="code" href="classMidiFileIn.html#a0">MidiFileIn</a>( std::string fileName );
|
|
00036
|
|
00038 <a class="code" href="classMidiFileIn.html#a1">~MidiFileIn</a>();
|
|
00039
|
|
00041 <span class="keywordtype">int</span> <a class="code" href="classMidiFileIn.html#a2">getFileFormat</a>() <span class="keyword">const</span>;
|
|
00042
|
|
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>;
|
|
00045
|
|
00047
|
|
00052 <span class="keywordtype">int</span> <a class="code" href="classMidiFileIn.html#a4">getDivision</a>() <span class="keyword">const</span>;
|
|
00053
|
|
00055
|
|
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 );
|
|
00060
|
|
00062
|
|
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 );
|
|
00070
|
|
00072
|
|
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 );
|
|
00085
|
|
00087
|
|
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 );
|
|
00098
|
|
00099 <span class="keyword">protected</span>:
|
|
00100
|
|
00101 <span class="comment">// This protected class function is used for reading variable-length</span>
|
|
00102 <span class="comment">// MIDI file values. It is assumed that this function is called with</span>
|
|
00103 <span class="comment">// the file read pointer positioned at the start of a</span>
|
|
00104 <span class="comment">// variable-length value. The function returns true if the value is</span>
|
|
00105 <span class="comment">// successfully parsed. Otherwise, it returns false.</span>
|
|
00106 <span class="keywordtype">bool</span> readVariableLength( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> *value );
|
|
00107
|
|
00108 std::ifstream file_;
|
|
00109 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nTracks_;
|
|
00110 <span class="keywordtype">int</span> format_;
|
|
00111 <span class="keywordtype">int</span> division_;
|
|
00112 <span class="keywordtype">bool</span> usingTimeCode_;
|
|
00113 std::vector<double> tickSeconds_;
|
|
00114 std::vector<long> trackPointers_;
|
|
00115 std::vector<long> trackOffsets_;
|
|
00116 std::vector<long> trackLengths_;
|
|
00117 std::vector<char> trackStatus_;
|
|
00118
|
|
00119 <span class="comment">// This structure and the following variables are used to save and</span>
|
|
00120 <span class="comment">// keep track of a format 1 tempo map (and the initial tickSeconds</span>
|
|
00121 <span class="comment">// parameter for formats 0 and 2).</span>
|
|
00122 <span class="keyword">struct </span>TempoChange {
|
|
00123 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> count;
|
|
00124 <span class="keywordtype">double</span> tickSeconds;
|
|
00125 };
|
|
00126 std::vector<TempoChange> tempoEvents_;
|
|
00127 std::vector<unsigned long> trackCounters_;
|
|
00128 std::vector<unsigned int> trackTempoIndex_;
|
|
00129 };
|
|
00130
|
|
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-2004 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
|
</table>
|
|
|
|
</BODY>
|
|
</HTML>
|