home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume43 / tclmidi / part10 < prev    next >
Internet Message Format  |  1994-07-21  |  62KB

  1. From: durian@boogie.com (Mike Durian)
  2. Newsgroups: comp.sources.misc
  3. Subject: v43i118:  tclmidi - A language for manipulating MIDI files, v2.0, Part10/14
  4. Date: 21 Jul 1994 19:27:45 -0500
  5. Organization: Sterling Software
  6. Sender: kent@sparky.sterling.com
  7. Approved: kent@sparky.sterling.com
  8. Message-ID: <30n3q1$779@sparky.sterling.com>
  9. X-Md4-Signature: dc38e1f3e15aeba8e810a3fdee3e78f4
  10.  
  11. Submitted-by: durian@boogie.com (Mike Durian)
  12. Posting-number: Volume 43, Issue 118
  13. Archive-name: tclmidi/part10
  14. Environment: POSIX, (BSDI, NetBSD, LINUX, SVR4 for optional driver), C++, TCL
  15. Supersedes: tclm: Volume 37, Issue 43-47
  16.  
  17. #! /bin/sh
  18. # This is a shell archive.  Remove anything before this line, then feed it
  19. # into a shell via "sh file" or similar.  To overwrite existing files,
  20. # type "sh file -c".
  21. # Contents:  tclmidi-2.0/contrib/mmap.mt32
  22. #   tclmidi-2.0/device/MidiDevice.h tclmidi-2.0/events/ChanPressure.C
  23. #   tclmidi-2.0/events/Makefile tclmidi-2.0/events/MetaChanPrefix.h
  24. #   tclmidi-2.0/events/MetaKey.h tclmidi-2.0/events/MetaSMPTE.h
  25. #   tclmidi-2.0/events/MetaSeqSpec.h tclmidi-2.0/events/MetaTime.h
  26. #   tclmidi-2.0/events/MetaUnknown.h tclmidi-2.0/events/PitchWheel.C
  27. #   tclmidi-2.0/events/Program.C tclmidi-2.0/events/SystemExcl.h
  28. #   tclmidi-2.0/man/midirecord.n tclmidi-2.0/smf/SMFUtils.C
  29. #   tclmidi-2.0/song/EventTree.h tclmidi-2.0/song/Song.h
  30. # Wrapped by kent@sparky on Thu Jul 21 19:05:16 1994
  31. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin:$PATH ; export PATH
  32. echo If this archive is complete, you will see the following message:
  33. echo '          "shar: End of archive 10 (of 14)."'
  34. if test -f 'tclmidi-2.0/contrib/mmap.mt32' -a "${1}" != "-c" ; then 
  35.   echo shar: Will not clobber existing file \"'tclmidi-2.0/contrib/mmap.mt32'\"
  36. else
  37.   echo shar: Extracting \"'tclmidi-2.0/contrib/mmap.mt32'\" \(3100 characters\)
  38.   sed "s/^X//" >'tclmidi-2.0/contrib/mmap.mt32' <<'END_OF_FILE'
  39. X#!/usr/local/bin/tclmidi
  40. X#
  41. X# mmap.mt32 - a General MIDI -> Roland MT-32 remapping filter
  42. X#
  43. X# Copyright (c) 1994 by Luchezar Georgiev, Bulgaria <lucho@midi.tu-varna.bg>
  44. X#
  45. X# Tip: Run your GM files through this mapper in advance, put the resulting
  46. X# files in a ZIP or other archive, and then use `playzip' or similar shell
  47. X# script to play them from the archive. You'll save both disk space and
  48. X# playing time!
  49. X#
  50. X# It shouldn't be difficult for you to customize this to your synth. Try it!
  51. X
  52. Xif {$argc} {
  53. X    puts stderr {Usage: mmap.mt32 < GMfile.mid > MT-32file.mid}
  54. X    exit 1
  55. X}
  56. X
  57. X# Channel map
  58. Xset cm {1 2 3 4 5 6 7 8 8 9 10 11 12 13 14 15}
  59. X
  60. X# Drum channel for GM ----^
  61. Xset dchan 9
  62. X
  63. X# Drum map
  64. Xset dm       { 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 \
  65. X24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 \
  66. X49 50 51 49 51 54 46 56 49 73 51 60 61 62 63 64 65 66 67 68 69 70 71 72 70 \
  67. X69 75 75 75 62 63 68 67 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 \
  68. X99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 \
  69. X118 119 120 121 122 123 124 125 126 127 }
  70. X
  71. X# Patch map
  72. Xset pm       { 0 1 3 7 5 6 17 21 22 101 101 97 104 103 102 105 12 9 10 13 14 \
  73. X15 87 15 59 60 59 62 61 59 62 62 64 67 66 71 68 69 66 70 53 52 54 56 53 51 \
  74. X57 112 48 50 48 50 34 42 33  122 88 90 94 89 92 95 89 91 78 79 80 81 84 85 \
  75. X86 83 75 73 76 77 110 107 108 72 47 67 75 51 61 72 52 67 32 33 67 34 32 32 \
  76. X33 33 41 36 35 37 45 33 43 32 63 105 105 105 51 81 52 81 23 103 103 113 117\
  77. X113 116 119 124 120 119 124 123 120 119 114 }
  78. X
  79. X# Pitch wheel ratio. MT-32 sensitivity is 12 semitones, while GM - 2
  80. Xset pwratio [expr 12/2]
  81. X
  82. Xset imf [midiread stdin]
  83. Xmidirewind $imf
  84. X
  85. Xset config [midiconfig $imf]
  86. Xset format [lindex $config 0]
  87. Xset division [lindex $config 1]
  88. Xset tracks [lindex $config 2]
  89. X
  90. Xset omf [midimake]
  91. Xmidiconfig $omf $format $division $tracks
  92. X
  93. Xset errMsg ""
  94. X
  95. Xfor {set i 0} {$i < [lindex $tracks 1]} {incr i} {
  96. X    while {[set event [midiget $imf $i next]] != "EOT"} {
  97. X    switch [set type [lindex $event 1]] {
  98. X        "NoteOff" -
  99. X        "NoteOn" -
  100. X        "Note" {
  101. X        if {[lindex $event 2] == $dchan} {
  102. X            # new channel and drum note
  103. X            set event [lreplace $event 2 3 \
  104. X              [lindex $cm [lindex $event 2]] \
  105. X              [lindex $dm [lindex $event 3]]]
  106. X        } else {
  107. X            # new channel only
  108. X            set event [lreplace $event 2 2 \
  109. X              [lindex $cm [lindex $event 2]]]
  110. X        }
  111. X        }
  112. X        "KeyPressure" -
  113. X        "Parameter" -
  114. X        "ChannelPressure" {
  115. X        # new channel
  116. X        set event [lreplace $event 2 2 [lindex $cm [lindex $event 2]]]
  117. X        }
  118. X        "Program" {
  119. X        # new channel and program
  120. X        set event [lreplace $event 2 3 [lindex $cm [lindex $event 2]]\
  121. X          [lindex $pm [lindex $event 3]]]
  122. X        }
  123. X        "PitchWheel" {
  124. X        # new pitchwheel value
  125. X        set pw [expr ([lindex $event 3] - 8192) / $pwratio + 8192]
  126. X        set event [lreplace $event 2 3 [lindex $cm [lindex $event 2]]\
  127. X              $pw]
  128. X        }
  129. X    }
  130. X    # make it robust
  131. X    catch {
  132. X        midiput $omf $i $event
  133. X    } errMsg
  134. X    if {$errMsg != ""} {
  135. X        puts stderr "$errMsg \"$event\""
  136. X    }
  137. X    }
  138. X}
  139. X
  140. Xmidiwrite stdout $omf
  141. Xmidifree $imf
  142. Xmidifree $omf
  143. END_OF_FILE
  144.   if test 3100 -ne `wc -c <'tclmidi-2.0/contrib/mmap.mt32'`; then
  145.     echo shar: \"'tclmidi-2.0/contrib/mmap.mt32'\" unpacked with wrong size!
  146.   fi
  147.   chmod +x 'tclmidi-2.0/contrib/mmap.mt32'
  148.   # end of 'tclmidi-2.0/contrib/mmap.mt32'
  149. fi
  150. if test -f 'tclmidi-2.0/device/MidiDevice.h' -a "${1}" != "-c" ; then 
  151.   echo shar: Will not clobber existing file \"'tclmidi-2.0/device/MidiDevice.h'\"
  152. else
  153.   echo shar: Extracting \"'tclmidi-2.0/device/MidiDevice.h'\" \(2894 characters\)
  154.   sed "s/^X//" >'tclmidi-2.0/device/MidiDevice.h' <<'END_OF_FILE'
  155. X/*-
  156. X * Copyright (c) 1993, 1994 Michael B. Durian.  All rights reserved.
  157. X *
  158. X * Redistribution and use in source and binary forms, with or without
  159. X * modification, are permitted provided that the following conditions
  160. X * are met:
  161. X * 1. Redistributions of source code must retain the above copyright
  162. X *    notice, this list of conditions and the following disclaimer.
  163. X * 2. Redistributions in binary form must reproduce the above copyright
  164. X *    notice, this list of conditions and the following disclaimer in the
  165. X *    documentation and/or other materials provided with the distribution.
  166. X * 3. All advertising materials mentioning features or use of this software
  167. X *    must display the following acknowledgement:
  168. X *    This product includes software developed by Michael B. Durian.
  169. X * 4. The name of the the Author may be used to endorse or promote 
  170. X *    products derived from this software without specific prior written 
  171. X *    permission.
  172. X *
  173. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 
  174. X * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  175. X * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  
  176. X * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
  177. X * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  178. X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  179. X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  180. X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  181. X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  182. X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  183. X * SUCH DAMAGE.
  184. X */
  185. X#ifndef MIDIDEVICE_H
  186. X#define MIDIDEVICE_H
  187. X
  188. X#include "Song.h"
  189. X
  190. Xtypedef void (*MidiDeviceCallback)(const Event *e);
  191. X
  192. Xclass MidiDevice {
  193. Xpublic:
  194. X    MidiDevice();
  195. X    MidiDevice(const char *dev);
  196. X    MidiDevice(const MidiDevice &md);
  197. X    virtual ~MidiDevice();
  198. X
  199. X    virtual int Play(Song *s, int r = 0) = 0;
  200. X    virtual int Record(Song *rec_song, Song *play_song = 0,
  201. X        int r = 0) = 0;
  202. X    virtual int Stop(void) = 0;
  203. X    virtual int Wait(void) = 0;
  204. X    void SetPlayCallback(MidiDeviceCallback pcb) {play_callback = pcb;}
  205. X    void SetRecordCallback(MidiDeviceCallback rcb) {record_callback = rcb;}
  206. X    void SetRepeat(int r) {repeat = r;}
  207. X    void SetMidiThru(int mt) {midithru = (mt != 0);}
  208. X    const char *GetName(void) const {return (name);}
  209. X    const char *GetError(void) const {return (error);}
  210. X    int GetRepeat(void) const {return (repeat);}
  211. X    int GetMidiThru(void) const {return (midithru);}
  212. X    MidiDeviceCallback GetPlayCallback(void) const {return (play_callback);}
  213. X    MidiDeviceCallback GetRecordCallback(void) const
  214. X        {return (record_callback);}
  215. X
  216. X    void SetName(const char *dev);
  217. X    void SetError(const char *err);
  218. Xprivate:
  219. X    char *name;
  220. X    char *error;
  221. X    MidiDeviceCallback record_callback;
  222. X    MidiDeviceCallback play_callback;
  223. X    int repeat;
  224. X    int midithru;
  225. X};
  226. X#endif
  227. END_OF_FILE
  228.   if test 2894 -ne `wc -c <'tclmidi-2.0/device/MidiDevice.h'`; then
  229.     echo shar: \"'tclmidi-2.0/device/MidiDevice.h'\" unpacked with wrong size!
  230.   fi
  231.   # end of 'tclmidi-2.0/device/MidiDevice.h'
  232. fi
  233. if test -f 'tclmidi-2.0/events/ChanPressure.C' -a "${1}" != "-c" ; then 
  234.   echo shar: Will not clobber existing file \"'tclmidi-2.0/events/ChanPressure.C'\"
  235. else
  236.   echo shar: Extracting \"'tclmidi-2.0/events/ChanPressure.C'\" \(3075 characters\)
  237.   sed "s/^X//" >'tclmidi-2.0/events/ChanPressure.C' <<'END_OF_FILE'
  238. X/*-
  239. X * Copyright (c) 1993, 1994 Michael B. Durian.  All rights reserved.
  240. X *
  241. X * Redistribution and use in source and binary forms, with or without
  242. X * modification, are permitted provided that the following conditions
  243. X * are met:
  244. X * 1. Redistributions of source code must retain the above copyright
  245. X *    notice, this list of conditions and the following disclaimer.
  246. X * 2. Redistributions in binary form must reproduce the above copyright
  247. X *    notice, this list of conditions and the following disclaimer in the
  248. X *    documentation and/or other materials provided with the distribution.
  249. X * 3. All advertising materials mentioning features or use of this software
  250. X *    must display the following acknowledgement:
  251. X *    This product includes software developed by Michael B. Durian.
  252. X * 4. The name of the the Author may be used to endorse or promote 
  253. X *    products derived from this software without specific prior written 
  254. X *    permission.
  255. X *
  256. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 
  257. X * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  258. X * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  
  259. X * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
  260. X * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  261. X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  262. X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  263. X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  264. X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  265. X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  266. X * SUCH DAMAGE.
  267. X */
  268. X#include "ChanPressure.h"
  269. X
  270. XChannelPressureEvent::ChannelPressureEvent() : pressure(0)
  271. X{
  272. X}
  273. X
  274. XChannelPressureEvent::ChannelPressureEvent(unsigned long t, unsigned char chan,
  275. X    unsigned char pres) : NormalEvent(t, chan), pressure(pres)
  276. X{
  277. X}
  278. X
  279. XChannelPressureEvent::ChannelPressureEvent(const ChannelPressureEvent &e) : NormalEvent(e),
  280. X    pressure(e.pressure)
  281. X{
  282. X}
  283. X
  284. XChannelPressureEvent &
  285. XChannelPressureEvent::operator=(const ChannelPressureEvent &e)
  286. X{
  287. X
  288. X    (NormalEvent)*this = (NormalEvent)e;
  289. X    pressure = e.pressure;
  290. X    return (*this);
  291. X}
  292. X
  293. Xchar *
  294. XChannelPressureEvent::GetEventStr(void) const
  295. X{
  296. X    ostrstream buf;
  297. X    char *tbuf;
  298. X
  299. X    tbuf = NormalEvent::GetEventStr();
  300. X    buf << tbuf << " Pressure: " << (int)pressure << ends;
  301. X    delete tbuf;
  302. X    return (buf.str());
  303. X}
  304. X
  305. Xconst char *
  306. XChannelPressureEvent::SMFRead(SMFTrack &t)
  307. X{
  308. X    const unsigned char *ptr;
  309. X
  310. X    if ((ptr = t.GetByte()) == 0)
  311. X        return ("Incomplete ChannelPressureEvent");
  312. X    pressure = *ptr;
  313. X    return (0);
  314. X}
  315. X
  316. Xconst char *
  317. XChannelPressureEvent::SMFWrite(SMFTrack &t) const
  318. X{
  319. X
  320. X    if (!t.PutByte(pressure))
  321. X        return ("Out of memory");
  322. X    return (0);
  323. X}
  324. X
  325. Xint
  326. XChannelPressureEvent::Equal(const Event *e) const
  327. X{
  328. X    ChannelPressureEvent *eptr = (ChannelPressureEvent *)e;
  329. X
  330. X    return (NormalEvent::Equal(e) && pressure == eptr->pressure);
  331. X}
  332. X
  333. Xostream &
  334. Xoperator<<(ostream &os, const ChannelPressureEvent &e)
  335. X{
  336. X    char *str;
  337. X
  338. X    os << (str = e.GetEventStr());
  339. X    delete str;
  340. X    return (os);
  341. X}
  342. END_OF_FILE
  343.   if test 3075 -ne `wc -c <'tclmidi-2.0/events/ChanPressure.C'`; then
  344.     echo shar: \"'tclmidi-2.0/events/ChanPressure.C'\" unpacked with wrong size!
  345.   fi
  346.   # end of 'tclmidi-2.0/events/ChanPressure.C'
  347. fi
  348. if test -f 'tclmidi-2.0/events/Makefile' -a "${1}" != "-c" ; then 
  349.   echo shar: Will not clobber existing file \"'tclmidi-2.0/events/Makefile'\"
  350. else
  351.   echo shar: Extracting \"'tclmidi-2.0/events/Makefile'\" \(2879 characters\)
  352.   sed "s/^X//" >'tclmidi-2.0/events/Makefile' <<'END_OF_FILE'
  353. XCXX = CC
  354. XCXX = g++
  355. XCFLAGS = -g
  356. XINCDIRS = -I../smf
  357. X
  358. XEVENTFILES = ChanPressure.o Event.o MetaChanPrefix.o MetaCopy.o MetaCue.o \
  359. X    MetaEOT.o MetaEvent.o MetaInstName.o MetaKey.o MetaLyric.o \
  360. X    MetaMarker.o MetaPortNum.o MetaSMPTE.o MetaSeqName.o MetaSeqNum.o \
  361. X    MetaSeqSpec.o MetaTempo.o MetaText.o MetaTime.o NormalEvent.o \
  362. X    NoteOff.o NoteOn.o KeyPressure.o Parameter.o PitchWheel.o Program.o \
  363. X    SystemExcl.o MetaUnknown.o EventUtil.o Note.o
  364. X
  365. X.SUFFIXES: .C $(SUFFIXES)
  366. X
  367. Xobjs: $(EVENTFILES)
  368. X    touch objs
  369. X
  370. X.C.o:
  371. X    $(CXX) $(CFLAGS) $(INCDIRS) -c -o $@ $<
  372. X
  373. Xclean:
  374. X    -rm *.o objs
  375. X
  376. XChanPressure.o: ChanPressure.h NormalEvent.h Event.h ../smf/SMFTrack.h
  377. XEvent.o: Event.h ../smf/SMFTrack.h
  378. XKeyPressure.o: KeyPressure.h NormalEvent.h Event.h ../smf/SMFTrack.h
  379. XMetaChanPrefix.o: MetaChanPrefix.h MetaEvent.h Event.h ../smf/SMFTrack.h
  380. XMetaCopy.o: MetaCopy.h MetaText.h MetaEvent.h Event.h ../smf/SMFTrack.h
  381. XMetaCue.o: MetaCue.h MetaText.h MetaEvent.h Event.h ../smf/SMFTrack.h
  382. XMetaEOT.o: MetaEOT.h MetaEvent.h Event.h ../smf/SMFTrack.h
  383. XMetaEvent.o: MetaEvent.h Event.h ../smf/SMFTrack.h
  384. XMetaInstName.o: MetaInstName.h MetaText.h MetaEvent.h Event.h ../smf/SMFTrack.h
  385. XMetaKey.o: MetaKey.h MetaEvent.h Event.h ../smf/SMFTrack.h
  386. XMetaLyric.o: MetaLyric.h MetaText.h MetaEvent.h Event.h ../smf/SMFTrack.h
  387. XMetaMarker.o: MetaMarker.h MetaText.h MetaEvent.h Event.h ../smf/SMFTrack.h
  388. XMetaPortNum.o: MetaPortNum.h MetaEvent.h Event.h ../smf/SMFTrack.h
  389. XMetaSMPTE.o: MetaSMPTE.h MetaEvent.h Event.h ../smf/SMFTrack.h
  390. XMetaSeqName.o: MetaSeqName.h MetaText.h MetaEvent.h Event.h ../smf/SMFTrack.h
  391. XMetaSeqNum.o: MetaSeqNum.h MetaEvent.h Event.h ../smf/SMFTrack.h
  392. XMetaSeqSpec.o: MetaSeqSpec.h MetaEvent.h Event.h ../smf/SMFTrack.h
  393. XMetaTempo.o: MetaTempo.h MetaEvent.h Event.h ../smf/SMFTrack.h
  394. XMetaText.o: MetaText.h MetaEvent.h Event.h ../smf/SMFTrack.h
  395. XMetaTime.o: MetaTime.h MetaEvent.h Event.h ../smf/SMFTrack.h
  396. XMetaUnknown.o: MetaUnknown.h MetaEvent.h Event.h ../smf/SMFTrack.h
  397. XNormalEvent.o: NormalEvent.h Event.h ../smf/SMFTrack.h
  398. XNote.o: Note.h NormalEvent.h Event.h ../smf/SMFTrack.h
  399. XNoteOff.o: NoteOff.h Note.h NormalEvent.h Event.h ../smf/SMFTrack.h
  400. XNoteOn.o: NoteOn.h Note.h NormalEvent.h Event.h ../smf/SMFTrack.h
  401. XParameter.o: Parameter.h NormalEvent.h Event.h ../smf/SMFTrack.h
  402. XPitchWheel.o: PitchWheel.h NormalEvent.h Event.h ../smf/SMFTrack.h
  403. XProgram.o: Program.h NormalEvent.h Event.h ../smf/SMFTrack.h
  404. XSystemExcl.o: SystemExcl.h Event.h ../smf/SMFTrack.h
  405. XEventUtil.o: EventUtil.h AllEvents.h Event.h NormalEvent.h Note.h \
  406. X    NoteOff.h NoteOn.h KeyPressure.h Parameter.h Program.h ChanPressure.h \
  407. X    PitchWheel.h SystemExcl.h MetaEvent.h MetaSeqNum.h MetaText.h \
  408. X    MetaCopy.h MetaSeqName.h MetaInstName.h MetaLyric.h MetaMarker.h \
  409. X    MetaCue.h MetaChanPrefix.h MetaEOT.h MetaTempo.h MetaSMPTE.h MetaTime.h \
  410. X    MetaKey.h MetaSeqSpec.h MetaUnknown.h ../smf/SMFTrack.h
  411. END_OF_FILE
  412.   if test 2879 -ne `wc -c <'tclmidi-2.0/events/Makefile'`; then
  413.     echo shar: \"'tclmidi-2.0/events/Makefile'\" unpacked with wrong size!
  414.   fi
  415.   # end of 'tclmidi-2.0/events/Makefile'
  416. fi
  417. if test -f 'tclmidi-2.0/events/MetaChanPrefix.h' -a "${1}" != "-c" ; then 
  418.   echo shar: Will not clobber existing file \"'tclmidi-2.0/events/MetaChanPrefix.h'\"
  419. else
  420.   echo shar: Extracting \"'tclmidi-2.0/events/MetaChanPrefix.h'\" \(2800 characters\)
  421.   sed "s/^X//" >'tclmidi-2.0/events/MetaChanPrefix.h' <<'END_OF_FILE'
  422. X/*-
  423. X * Copyright (c) 1993, 1994 Michael B. Durian.  All rights reserved.
  424. X *
  425. X * Redistribution and use in source and binary forms, with or without
  426. X * modification, are permitted provided that the following conditions
  427. X * are met:
  428. X * 1. Redistributions of source code must retain the above copyright
  429. X *    notice, this list of conditions and the following disclaimer.
  430. X * 2. Redistributions in binary form must reproduce the above copyright
  431. X *    notice, this list of conditions and the following disclaimer in the
  432. X *    documentation and/or other materials provided with the distribution.
  433. X * 3. All advertising materials mentioning features or use of this software
  434. X *    must display the following acknowledgement:
  435. X *    This product includes software developed by Michael B. Durian.
  436. X * 4. The name of the the Author may be used to endorse or promote 
  437. X *    products derived from this software without specific prior written 
  438. X *    permission.
  439. X *
  440. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 
  441. X * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  442. X * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  
  443. X * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
  444. X * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  445. X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  446. X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  447. X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  448. X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  449. X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  450. X * SUCH DAMAGE.
  451. X */
  452. X#ifndef METACHANPREFIX_H
  453. X#define METACHANPREFIX_H
  454. X
  455. X#include "MetaEvent.h"
  456. X
  457. Xclass MetaChannelPrefixEvent : public MetaEvent {
  458. X    friend ostream &operator<<(ostream &os,
  459. X        const MetaChannelPrefixEvent &e);
  460. Xpublic:
  461. X    MetaChannelPrefixEvent();
  462. X    MetaChannelPrefixEvent(unsigned long t, const unsigned char *data,
  463. X        long length);
  464. X    MetaChannelPrefixEvent(const MetaChannelPrefixEvent &e);
  465. X    virtual ~MetaChannelPrefixEvent();
  466. X    virtual Event *Dup(void) const
  467. X        {return (new MetaChannelPrefixEvent(*this));}
  468. X
  469. X    virtual EventType GetType(void) const {return (METACHANNELPREFIX);}
  470. X    virtual char *GetTypeStr(void) const
  471. X        {return ("MetaChannelPrefixEvent");}
  472. X    virtual char *GetEventStr(void) const;
  473. X    const unsigned char *GetData(void) const {return (data);}
  474. X    long GetLength(void) const {return (length);}
  475. X
  476. X    void SetData(const unsigned char *data, long length);
  477. X
  478. X    MetaChannelPrefixEvent &operator=(const MetaChannelPrefixEvent &e);
  479. X
  480. X    virtual const char *SMFRead(SMFTrack &t);
  481. X    virtual const char *SMFWrite(SMFTrack &t) const;
  482. Xprotected:
  483. X    virtual int Equal(const Event *e) const;
  484. Xprivate:
  485. X    unsigned char *data;
  486. X    long length;
  487. X};
  488. X#endif
  489. END_OF_FILE
  490.   if test 2800 -ne `wc -c <'tclmidi-2.0/events/MetaChanPrefix.h'`; then
  491.     echo shar: \"'tclmidi-2.0/events/MetaChanPrefix.h'\" unpacked with wrong size!
  492.   fi
  493.   # end of 'tclmidi-2.0/events/MetaChanPrefix.h'
  494. fi
  495. if test -f 'tclmidi-2.0/events/MetaKey.h' -a "${1}" != "-c" ; then 
  496.   echo shar: Will not clobber existing file \"'tclmidi-2.0/events/MetaKey.h'\"
  497. else
  498.   echo shar: Extracting \"'tclmidi-2.0/events/MetaKey.h'\" \(3099 characters\)
  499.   sed "s/^X//" >'tclmidi-2.0/events/MetaKey.h' <<'END_OF_FILE'
  500. X/*-
  501. X * Copyright (c) 1993, 1994 Michael B. Durian.  All rights reserved.
  502. X *
  503. X * Redistribution and use in source and binary forms, with or without
  504. X * modification, are permitted provided that the following conditions
  505. X * are met:
  506. X * 1. Redistributions of source code must retain the above copyright
  507. X *    notice, this list of conditions and the following disclaimer.
  508. X * 2. Redistributions in binary form must reproduce the above copyright
  509. X *    notice, this list of conditions and the following disclaimer in the
  510. X *    documentation and/or other materials provided with the distribution.
  511. X * 3. All advertising materials mentioning features or use of this software
  512. X *    must display the following acknowledgement:
  513. X *    This product includes software developed by Michael B. Durian.
  514. X * 4. The name of the the Author may be used to endorse or promote 
  515. X *    products derived from this software without specific prior written 
  516. X *    permission.
  517. X *
  518. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 
  519. X * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  520. X * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  
  521. X * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
  522. X * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  523. X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  524. X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  525. X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  526. X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  527. X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  528. X * SUCH DAMAGE.
  529. X */
  530. X#ifndef METAKEY_H
  531. X#define METAKEY_H
  532. X
  533. X#include "MetaEvent.h"
  534. X
  535. Xtypedef enum {KEY_CFLAT = -7, KEY_GFLAT = -6, KEY_DFLAT = -5, KEY_AFLAT = -4,
  536. X    KEY_EFLAT = -3, KEY_BFLAT = -2, KEY_F = -1, KEY_C = 0, KEY_G = 1,
  537. X    KEY_D = 2, KEY_A = 3, KEY_E = 4, KEY_B = 5, KEY_FSHARP = 6,
  538. X    KEY_CSHARP = 7} Key;
  539. X
  540. XKey IntToKey(int i);
  541. Xint KeyToInt(Key k);
  542. X
  543. Xtypedef enum {MODE_MAJOR = 0, MODE_MINOR = 1} Mode;
  544. X
  545. Xextern Key StrToKey(const char *str, int *match);
  546. Xextern Mode StrToMode(const char *str, int *match);
  547. X
  548. Xclass MetaKeyEvent : public MetaEvent {
  549. X    friend ostream &operator<<(ostream &os, const MetaKeyEvent &e);
  550. Xpublic:
  551. X    MetaKeyEvent();
  552. X    MetaKeyEvent(unsigned long t, Key k = KEY_C, Mode m = MODE_MAJOR);
  553. X    MetaKeyEvent(const MetaKeyEvent &e);
  554. X    virtual Event *Dup(void) const {return (new MetaKeyEvent(*this));}
  555. X
  556. X    virtual EventType GetType(void) const {return (METAKEY);}
  557. X    virtual char *GetTypeStr(void) const {return ("MetaKeyEvent");}
  558. X    virtual char *GetEventStr(void) const;
  559. X    Key GetKey(void) const {return (key);}
  560. X    const char *GetKeyStr(void) const;
  561. X    Mode GetMode(void) const {return (mode);}
  562. X    const char *GetModeStr(void) const;
  563. X
  564. X    void SetKey(Key k) {key = k;}
  565. X    void SetMode(Mode m) {mode = m;}
  566. X
  567. X    MetaKeyEvent &operator=(const MetaKeyEvent &e);
  568. X
  569. X    virtual const char *SMFRead(SMFTrack &t);
  570. X    virtual const char *SMFWrite(SMFTrack &t) const;
  571. Xprotected:
  572. X    virtual int Equal(const Event *e) const;
  573. Xprivate:
  574. X    Key key;
  575. X    Mode mode;
  576. X};
  577. X#endif
  578. END_OF_FILE
  579.   if test 3099 -ne `wc -c <'tclmidi-2.0/events/MetaKey.h'`; then
  580.     echo shar: \"'tclmidi-2.0/events/MetaKey.h'\" unpacked with wrong size!
  581.   fi
  582.   # end of 'tclmidi-2.0/events/MetaKey.h'
  583. fi
  584. if test -f 'tclmidi-2.0/events/MetaSMPTE.h' -a "${1}" != "-c" ; then 
  585.   echo shar: Will not clobber existing file \"'tclmidi-2.0/events/MetaSMPTE.h'\"
  586. else
  587.   echo shar: Extracting \"'tclmidi-2.0/events/MetaSMPTE.h'\" \(3170 characters\)
  588.   sed "s/^X//" >'tclmidi-2.0/events/MetaSMPTE.h' <<'END_OF_FILE'
  589. X/*-
  590. X * Copyright (c) 1993, 1994 Michael B. Durian.  All rights reserved.
  591. X *
  592. X * Redistribution and use in source and binary forms, with or without
  593. X * modification, are permitted provided that the following conditions
  594. X * are met:
  595. X * 1. Redistributions of source code must retain the above copyright
  596. X *    notice, this list of conditions and the following disclaimer.
  597. X * 2. Redistributions in binary form must reproduce the above copyright
  598. X *    notice, this list of conditions and the following disclaimer in the
  599. X *    documentation and/or other materials provided with the distribution.
  600. X * 3. All advertising materials mentioning features or use of this software
  601. X *    must display the following acknowledgement:
  602. X *    This product includes software developed by Michael B. Durian.
  603. X * 4. The name of the the Author may be used to endorse or promote 
  604. X *    products derived from this software without specific prior written 
  605. X *    permission.
  606. X *
  607. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 
  608. X * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  609. X * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  
  610. X * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
  611. X * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  612. X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  613. X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  614. X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  615. X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  616. X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  617. X * SUCH DAMAGE.
  618. X */
  619. X#ifndef METASMPTE_H
  620. X#define METASMPTE_H
  621. X
  622. X#include "MetaEvent.h"
  623. X
  624. Xclass MetaSMPTEEvent : public MetaEvent {
  625. X    friend ostream &operator<<(ostream &os, const MetaSMPTEEvent &e);
  626. Xpublic:
  627. X    MetaSMPTEEvent();
  628. X    MetaSMPTEEvent(unsigned long t, unsigned char h, unsigned char m,
  629. X        unsigned char s, unsigned char f, unsigned char ff);
  630. X    MetaSMPTEEvent(const MetaSMPTEEvent &e);
  631. X    virtual Event *Dup(void) const {return (new MetaSMPTEEvent(*this));}
  632. X
  633. X    virtual EventType GetType(void) const {return (METASMPTE);}
  634. X    virtual char *GetTypeStr(void) const {return ("MetaSMPTEEvent");}
  635. X    virtual char *GetEventStr(void) const;
  636. X    unsigned char GetHour(void) const {return (hour);}
  637. X    unsigned char GetMinute(void) const {return (minute);}
  638. X    unsigned char GetSecond(void) const {return (second);}
  639. X    unsigned char GetFrame(void) const {return (frame);}
  640. X    unsigned char GetFractionalFrame(void) const
  641. X        {return (fractional_frame);}
  642. X
  643. X    void SetHour(unsigned char h) {hour = h;}
  644. X    void SetMinute(unsigned char m) {minute = m;}
  645. X    void SetSecond(unsigned char s) {second = s;}
  646. X    void SetFrame(unsigned char f) {frame = f;}
  647. X    void SetFractionalFrame(unsigned char ff) {fractional_frame = ff;}
  648. X
  649. X    MetaSMPTEEvent &operator=(const MetaSMPTEEvent &e);
  650. X
  651. X    virtual const char *SMFRead(SMFTrack &t);
  652. X    virtual const char *SMFWrite(SMFTrack &t) const;
  653. Xprotected:
  654. X    virtual int Equal(const Event *e) const;
  655. Xprivate:
  656. X    unsigned char hour;
  657. X    unsigned char minute;
  658. X    unsigned char second;
  659. X    unsigned char frame;
  660. X    unsigned char fractional_frame;
  661. X};
  662. X#endif
  663. END_OF_FILE
  664.   if test 3170 -ne `wc -c <'tclmidi-2.0/events/MetaSMPTE.h'`; then
  665.     echo shar: \"'tclmidi-2.0/events/MetaSMPTE.h'\" unpacked with wrong size!
  666.   fi
  667.   # end of 'tclmidi-2.0/events/MetaSMPTE.h'
  668. fi
  669. if test -f 'tclmidi-2.0/events/MetaSeqSpec.h' -a "${1}" != "-c" ; then 
  670.   echo shar: Will not clobber existing file \"'tclmidi-2.0/events/MetaSeqSpec.h'\"
  671. else
  672.   echo shar: Extracting \"'tclmidi-2.0/events/MetaSeqSpec.h'\" \(2848 characters\)
  673.   sed "s/^X//" >'tclmidi-2.0/events/MetaSeqSpec.h' <<'END_OF_FILE'
  674. X/*-
  675. X * Copyright (c) 1993, 1994 Michael B. Durian.  All rights reserved.
  676. X *
  677. X * Redistribution and use in source and binary forms, with or without
  678. X * modification, are permitted provided that the following conditions
  679. X * are met:
  680. X * 1. Redistributions of source code must retain the above copyright
  681. X *    notice, this list of conditions and the following disclaimer.
  682. X * 2. Redistributions in binary form must reproduce the above copyright
  683. X *    notice, this list of conditions and the following disclaimer in the
  684. X *    documentation and/or other materials provided with the distribution.
  685. X * 3. All advertising materials mentioning features or use of this software
  686. X *    must display the following acknowledgement:
  687. X *    This product includes software developed by Michael B. Durian.
  688. X * 4. The name of the the Author may be used to endorse or promote 
  689. X *    products derived from this software without specific prior written 
  690. X *    permission.
  691. X *
  692. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 
  693. X * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  694. X * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  
  695. X * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
  696. X * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  697. X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  698. X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  699. X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  700. X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  701. X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  702. X * SUCH DAMAGE.
  703. X */
  704. X#ifndef METASEQSPEC_H
  705. X#define METASEQSPEC_H
  706. X
  707. X#include "MetaEvent.h"
  708. X
  709. Xclass MetaSequencerSpecificEvent : public MetaEvent {
  710. X    friend ostream &operator<<(ostream &os,
  711. X        const MetaSequencerSpecificEvent &e);
  712. Xpublic:
  713. X    MetaSequencerSpecificEvent();
  714. X    MetaSequencerSpecificEvent(unsigned long t, const unsigned char *data,
  715. X        long length);
  716. X    MetaSequencerSpecificEvent(const MetaSequencerSpecificEvent &e);
  717. X    virtual ~MetaSequencerSpecificEvent();
  718. X    virtual Event *Dup(void) const
  719. X        {return (new MetaSequencerSpecificEvent(*this));}
  720. X
  721. X    virtual EventType GetType(void) const {return (METASEQUENCERSPECIFIC);}
  722. X    virtual char *GetTypeStr(void) const
  723. X        {return ("MetaSequencerSpecificEvent");}
  724. X    virtual char *GetEventStr(void) const;
  725. X    const unsigned char *GetData(void) const {return (data);}
  726. X    long GetLength(void) const {return (length);}
  727. X
  728. X    void SetData(const unsigned char *data, long length);
  729. X
  730. X    MetaSequencerSpecificEvent &operator=(
  731. X        const MetaSequencerSpecificEvent &e);
  732. X
  733. X    virtual const char *SMFRead(SMFTrack &t);
  734. X    virtual const char *SMFWrite(SMFTrack &t) const;
  735. Xprotected:
  736. X    virtual int Equal(const Event *e) const;
  737. Xprivate:
  738. X    unsigned char *data;
  739. X    long length;
  740. X};
  741. X#endif
  742. END_OF_FILE
  743.   if test 2848 -ne `wc -c <'tclmidi-2.0/events/MetaSeqSpec.h'`; then
  744.     echo shar: \"'tclmidi-2.0/events/MetaSeqSpec.h'\" unpacked with wrong size!
  745.   fi
  746.   # end of 'tclmidi-2.0/events/MetaSeqSpec.h'
  747. fi
  748. if test -f 'tclmidi-2.0/events/MetaTime.h' -a "${1}" != "-c" ; then 
  749.   echo shar: Will not clobber existing file \"'tclmidi-2.0/events/MetaTime.h'\"
  750. else
  751.   echo shar: Extracting \"'tclmidi-2.0/events/MetaTime.h'\" \(3110 characters\)
  752.   sed "s/^X//" >'tclmidi-2.0/events/MetaTime.h' <<'END_OF_FILE'
  753. X/*-
  754. X * Copyright (c) 1993, 1994 Michael B. Durian.  All rights reserved.
  755. X *
  756. X * Redistribution and use in source and binary forms, with or without
  757. X * modification, are permitted provided that the following conditions
  758. X * are met:
  759. X * 1. Redistributions of source code must retain the above copyright
  760. X *    notice, this list of conditions and the following disclaimer.
  761. X * 2. Redistributions in binary form must reproduce the above copyright
  762. X *    notice, this list of conditions and the following disclaimer in the
  763. X *    documentation and/or other materials provided with the distribution.
  764. X * 3. All advertising materials mentioning features or use of this software
  765. X *    must display the following acknowledgement:
  766. X *    This product includes software developed by Michael B. Durian.
  767. X * 4. The name of the the Author may be used to endorse or promote 
  768. X *    products derived from this software without specific prior written 
  769. X *    permission.
  770. X *
  771. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 
  772. X * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  773. X * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  
  774. X * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
  775. X * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  776. X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  777. X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  778. X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  779. X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  780. X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  781. X * SUCH DAMAGE.
  782. X */
  783. X#ifndef METATIME_H
  784. X#define METATIME_H
  785. X
  786. X#include "MetaEvent.h"
  787. X
  788. Xclass MetaTimeEvent : public MetaEvent {
  789. X    friend ostream &operator<<(ostream &os, const MetaTimeEvent &e);
  790. Xpublic:
  791. X    MetaTimeEvent();
  792. X    MetaTimeEvent(unsigned long time, unsigned char n = 4,
  793. X        unsigned char d = 4, unsigned char c = 24, unsigned char t = 8);
  794. X    MetaTimeEvent(const MetaTimeEvent &e);
  795. X    virtual Event *Dup(void) const {return (new MetaTimeEvent(*this));}
  796. X
  797. X    virtual EventType GetType(void) const {return (METATIME);}
  798. X    virtual char *GetTypeStr(void) const {return ("MetaTimeEvent");}
  799. X    virtual char *GetEventStr(void) const;
  800. X    unsigned char GetNumerator(void) const {return (numerator);}
  801. X    unsigned char GetDenominator(void) const {return (denominator);}
  802. X    unsigned char GetClocksPerBeat(void) const {return (clocks);}
  803. X    unsigned char Get32ndNotesPerQuarterNote(void) const
  804. X        {return (thirty_seconds);}
  805. X
  806. X    void SetNumerator(unsigned char n) {numerator = n;}
  807. X    void SetDenominator(unsigned char d) {denominator = d;}
  808. X    void SetClocksPerBeat(unsigned char c) {clocks = c;}
  809. X    void Set32ndNotesPerQuarterNote(unsigned char t) {thirty_seconds = t;}
  810. X
  811. X    MetaTimeEvent &operator=(const MetaTimeEvent &e);
  812. X
  813. X    virtual const char *SMFRead(SMFTrack &t);
  814. X    virtual const char *SMFWrite(SMFTrack &t) const;
  815. Xprotected:
  816. X    virtual int Equal(const Event *e) const;
  817. Xprivate:
  818. X    unsigned char numerator;
  819. X    unsigned char denominator;
  820. X    unsigned char clocks;
  821. X    unsigned char thirty_seconds;
  822. X};
  823. X#endif
  824. END_OF_FILE
  825.   if test 3110 -ne `wc -c <'tclmidi-2.0/events/MetaTime.h'`; then
  826.     echo shar: \"'tclmidi-2.0/events/MetaTime.h'\" unpacked with wrong size!
  827.   fi
  828.   # end of 'tclmidi-2.0/events/MetaTime.h'
  829. fi
  830. if test -f 'tclmidi-2.0/events/MetaUnknown.h' -a "${1}" != "-c" ; then 
  831.   echo shar: Will not clobber existing file \"'tclmidi-2.0/events/MetaUnknown.h'\"
  832. else
  833.   echo shar: Extracting \"'tclmidi-2.0/events/MetaUnknown.h'\" \(2885 characters\)
  834.   sed "s/^X//" >'tclmidi-2.0/events/MetaUnknown.h' <<'END_OF_FILE'
  835. X/*-
  836. X * Copyright (c) 1993, 1994 Michael B. Durian.  All rights reserved.
  837. X *
  838. X * Redistribution and use in source and binary forms, with or without
  839. X * modification, are permitted provided that the following conditions
  840. X * are met:
  841. X * 1. Redistributions of source code must retain the above copyright
  842. X *    notice, this list of conditions and the following disclaimer.
  843. X * 2. Redistributions in binary form must reproduce the above copyright
  844. X *    notice, this list of conditions and the following disclaimer in the
  845. X *    documentation and/or other materials provided with the distribution.
  846. X * 3. All advertising materials mentioning features or use of this software
  847. X *    must display the following acknowledgement:
  848. X *    This product includes software developed by Michael B. Durian.
  849. X * 4. The name of the the Author may be used to endorse or promote 
  850. X *    products derived from this software without specific prior written 
  851. X *    permission.
  852. X *
  853. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 
  854. X * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  855. X * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  
  856. X * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
  857. X * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  858. X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  859. X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  860. X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  861. X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  862. X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  863. X * SUCH DAMAGE.
  864. X */
  865. X#ifndef METAUNKNOWN_H
  866. X#define METAUNKNOWN_H
  867. X
  868. X#include "MetaEvent.h"
  869. X
  870. Xclass MetaUnknownEvent : public MetaEvent {
  871. X    friend ostream &operator<<(ostream &os, const MetaUnknownEvent &e);
  872. Xpublic:
  873. X    MetaUnknownEvent();
  874. X    MetaUnknownEvent(unsigned char t);
  875. X    MetaUnknownEvent(unsigned long t, const unsigned char *data,
  876. X        long length, unsigned char ty);
  877. X    MetaUnknownEvent(const MetaUnknownEvent &e);
  878. X    virtual ~MetaUnknownEvent();
  879. X    virtual Event *Dup(void) const {return (new MetaUnknownEvent(*this));}
  880. X
  881. X    virtual EventType GetType(void) const {return (METAUNKNOWN);}
  882. X    virtual char *GetTypeStr(void) const {return ("MetaUnknownEvent");}
  883. X    virtual char *GetEventStr(void) const;
  884. X    const unsigned char *GetData(void) const {return (data);}
  885. X    long GetLength(void) const {return (length);}
  886. X    unsigned char GetMetaType(void) const {return (type);}
  887. X
  888. X    void SetData(const unsigned char *data, long length);
  889. X    void SetMetaType(unsigned char t) {type = t;}
  890. X
  891. X    MetaUnknownEvent &operator=(const MetaUnknownEvent &e);
  892. X
  893. X    virtual const char *SMFRead(SMFTrack &t);
  894. X    virtual const char *SMFWrite(SMFTrack &t) const;
  895. Xprotected:
  896. X    virtual int Equal(const Event *e) const;
  897. Xprivate:
  898. X    unsigned char type;
  899. X    unsigned char *data;
  900. X    long length;
  901. X};
  902. X#endif
  903. END_OF_FILE
  904.   if test 2885 -ne `wc -c <'tclmidi-2.0/events/MetaUnknown.h'`; then
  905.     echo shar: \"'tclmidi-2.0/events/MetaUnknown.h'\" unpacked with wrong size!
  906.   fi
  907.   # end of 'tclmidi-2.0/events/MetaUnknown.h'
  908. fi
  909. if test -f 'tclmidi-2.0/events/PitchWheel.C' -a "${1}" != "-c" ; then 
  910.   echo shar: Will not clobber existing file \"'tclmidi-2.0/events/PitchWheel.C'\"
  911. else
  912.   echo shar: Extracting \"'tclmidi-2.0/events/PitchWheel.C'\" \(3109 characters\)
  913.   sed "s/^X//" >'tclmidi-2.0/events/PitchWheel.C' <<'END_OF_FILE'
  914. X/*-
  915. X * Copyright (c) 1993, 1994 Michael B. Durian.  All rights reserved.
  916. X *
  917. X * Redistribution and use in source and binary forms, with or without
  918. X * modification, are permitted provided that the following conditions
  919. X * are met:
  920. X * 1. Redistributions of source code must retain the above copyright
  921. X *    notice, this list of conditions and the following disclaimer.
  922. X * 2. Redistributions in binary form must reproduce the above copyright
  923. X *    notice, this list of conditions and the following disclaimer in the
  924. X *    documentation and/or other materials provided with the distribution.
  925. X * 3. All advertising materials mentioning features or use of this software
  926. X *    must display the following acknowledgement:
  927. X *    This product includes software developed by Michael B. Durian.
  928. X * 4. The name of the the Author may be used to endorse or promote 
  929. X *    products derived from this software without specific prior written 
  930. X *    permission.
  931. X *
  932. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 
  933. X * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  934. X * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  
  935. X * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
  936. X * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  937. X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  938. X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  939. X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  940. X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  941. X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  942. X * SUCH DAMAGE.
  943. X */
  944. X#include "PitchWheel.h"
  945. X
  946. XPitchWheelEvent::PitchWheelEvent() : value(0)
  947. X{
  948. X}
  949. X
  950. XPitchWheelEvent::PitchWheelEvent(unsigned long t, unsigned char chan,
  951. X    short val) : NormalEvent(t, chan), value(val)
  952. X{
  953. X}
  954. X
  955. XPitchWheelEvent::PitchWheelEvent(const PitchWheelEvent &e) : NormalEvent(e),
  956. X    value(e.value)
  957. X{
  958. X}
  959. X
  960. XPitchWheelEvent &
  961. XPitchWheelEvent::operator=(const PitchWheelEvent &e)
  962. X{
  963. X
  964. X    (NormalEvent)*this = (NormalEvent)e;
  965. X    value = e.value;
  966. X    return (*this);
  967. X}
  968. X
  969. Xchar *
  970. XPitchWheelEvent::GetEventStr(void) const
  971. X{
  972. X    ostrstream buf;
  973. X    char *tbuf;
  974. X
  975. X    tbuf = NormalEvent::GetEventStr();
  976. X    buf << tbuf << " Value: " << (int)value << ends;
  977. X    delete tbuf;
  978. X    return(buf.str());
  979. X}
  980. X
  981. Xconst char *
  982. XPitchWheelEvent::SMFRead(SMFTrack &t)
  983. X{
  984. X    const unsigned char *ptr;
  985. X
  986. X    if ((ptr = t.GetByte()) == 0)
  987. X        return ("Incomplete PitchWheelEvent");
  988. X    value = *ptr;
  989. X    if ((ptr = t.GetByte()) == 0)
  990. X        return ("Incomplete PitchWheelEvent");
  991. X    value |= (short)*ptr << 7;
  992. X    return (0);
  993. X}
  994. X
  995. Xconst char *
  996. XPitchWheelEvent::SMFWrite(SMFTrack &t) const
  997. X{
  998. X
  999. X    if (!t.PutByte(value & 0x7f))
  1000. X        return ("Out of memory");
  1001. X    if (!t.PutByte((value >> 7) & 0x7f))
  1002. X        return ("Out of memory");
  1003. X    return (0);
  1004. X}
  1005. X
  1006. Xint
  1007. XPitchWheelEvent::Equal(const Event *e) const
  1008. X{
  1009. X    PitchWheelEvent *eptr = (PitchWheelEvent *)e;
  1010. X
  1011. X    return (NormalEvent::Equal(e) && value == eptr->value);
  1012. X}
  1013. X
  1014. Xostream &
  1015. Xoperator<<(ostream &os, const PitchWheelEvent &e)
  1016. X{
  1017. X    char *str;
  1018. X
  1019. X    os << (str = e.GetEventStr());
  1020. X    delete str;
  1021. X    return (os);
  1022. X}
  1023. END_OF_FILE
  1024.   if test 3109 -ne `wc -c <'tclmidi-2.0/events/PitchWheel.C'`; then
  1025.     echo shar: \"'tclmidi-2.0/events/PitchWheel.C'\" unpacked with wrong size!
  1026.   fi
  1027.   # end of 'tclmidi-2.0/events/PitchWheel.C'
  1028. fi
  1029. if test -f 'tclmidi-2.0/events/Program.C' -a "${1}" != "-c" ; then 
  1030.   echo shar: Will not clobber existing file \"'tclmidi-2.0/events/Program.C'\"
  1031. else
  1032.   echo shar: Extracting \"'tclmidi-2.0/events/Program.C'\" \(2888 characters\)
  1033.   sed "s/^X//" >'tclmidi-2.0/events/Program.C' <<'END_OF_FILE'
  1034. X/*-
  1035. X * Copyright (c) 1993, 1994 Michael B. Durian.  All rights reserved.
  1036. X *
  1037. X * Redistribution and use in source and binary forms, with or without
  1038. X * modification, are permitted provided that the following conditions
  1039. X * are met:
  1040. X * 1. Redistributions of source code must retain the above copyright
  1041. X *    notice, this list of conditions and the following disclaimer.
  1042. X * 2. Redistributions in binary form must reproduce the above copyright
  1043. X *    notice, this list of conditions and the following disclaimer in the
  1044. X *    documentation and/or other materials provided with the distribution.
  1045. X * 3. All advertising materials mentioning features or use of this software
  1046. X *    must display the following acknowledgement:
  1047. X *    This product includes software developed by Michael B. Durian.
  1048. X * 4. The name of the the Author may be used to endorse or promote 
  1049. X *    products derived from this software without specific prior written 
  1050. X *    permission.
  1051. X *
  1052. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 
  1053. X * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  1054. X * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  
  1055. X * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
  1056. X * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1057. X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1058. X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1059. X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1060. X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1061. X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1062. X * SUCH DAMAGE.
  1063. X */
  1064. X#include "Program.h"
  1065. X
  1066. XProgramEvent::ProgramEvent() : value(0)
  1067. X{
  1068. X}
  1069. X
  1070. XProgramEvent::ProgramEvent(unsigned long t, unsigned char chan,
  1071. X    unsigned char val) : NormalEvent(t, chan), value(val)
  1072. X{
  1073. X}
  1074. X
  1075. XProgramEvent::ProgramEvent(const ProgramEvent &e) : NormalEvent(e),
  1076. X    value(e.value)
  1077. X{
  1078. X}
  1079. X
  1080. XProgramEvent &
  1081. XProgramEvent::operator=(const ProgramEvent &e)
  1082. X{
  1083. X
  1084. X    (NormalEvent)*this = (NormalEvent)e;
  1085. X    value = e.value;
  1086. X    return (*this);
  1087. X}
  1088. X
  1089. Xchar *
  1090. XProgramEvent::GetEventStr(void) const
  1091. X{
  1092. X    ostrstream buf;
  1093. X    char *tbuf;
  1094. X
  1095. X    tbuf = NormalEvent::GetEventStr();
  1096. X    buf << tbuf << " Value: " << (int)value << ends;
  1097. X    delete tbuf;
  1098. X    return (buf.str());
  1099. X}
  1100. X
  1101. Xconst char *
  1102. XProgramEvent::SMFRead(SMFTrack &t)
  1103. X{
  1104. X    const unsigned char *ptr;
  1105. X
  1106. X    if ((ptr = t.GetByte()) == 0)
  1107. X        return ("Incomplete ProgramEvent");
  1108. X    value = *ptr;
  1109. X    return (0);
  1110. X}
  1111. X
  1112. Xconst char *
  1113. XProgramEvent::SMFWrite(SMFTrack &t) const
  1114. X{
  1115. X
  1116. X    if (!t.PutByte(value))
  1117. X        return ("Out of memory");
  1118. X    return (0);
  1119. X}
  1120. X
  1121. Xint
  1122. XProgramEvent::Equal(const Event *e) const
  1123. X{
  1124. X    ProgramEvent *eptr = (ProgramEvent *)e;
  1125. X
  1126. X    return (NormalEvent::Equal(e) && value == eptr->value);
  1127. X}
  1128. X
  1129. Xostream &
  1130. Xoperator<<(ostream &os, const ProgramEvent &e)
  1131. X{
  1132. X    char *str;
  1133. X
  1134. X    os << (str = e.GetEventStr());
  1135. X    delete str;
  1136. X    return (os);
  1137. X}
  1138. END_OF_FILE
  1139.   if test 2888 -ne `wc -c <'tclmidi-2.0/events/Program.C'`; then
  1140.     echo shar: \"'tclmidi-2.0/events/Program.C'\" unpacked with wrong size!
  1141.   fi
  1142.   # end of 'tclmidi-2.0/events/Program.C'
  1143. fi
  1144. if test -f 'tclmidi-2.0/events/SystemExcl.h' -a "${1}" != "-c" ; then 
  1145.   echo shar: Will not clobber existing file \"'tclmidi-2.0/events/SystemExcl.h'\"
  1146. else
  1147.   echo shar: Extracting \"'tclmidi-2.0/events/SystemExcl.h'\" \(2938 characters\)
  1148.   sed "s/^X//" >'tclmidi-2.0/events/SystemExcl.h' <<'END_OF_FILE'
  1149. X/*-
  1150. X * Copyright (c) 1993, 1994 Michael B. Durian.  All rights reserved.
  1151. X *
  1152. X * Redistribution and use in source and binary forms, with or without
  1153. X * modification, are permitted provided that the following conditions
  1154. X * are met:
  1155. X * 1. Redistributions of source code must retain the above copyright
  1156. X *    notice, this list of conditions and the following disclaimer.
  1157. X * 2. Redistributions in binary form must reproduce the above copyright
  1158. X *    notice, this list of conditions and the following disclaimer in the
  1159. X *    documentation and/or other materials provided with the distribution.
  1160. X * 3. All advertising materials mentioning features or use of this software
  1161. X *    must display the following acknowledgement:
  1162. X *    This product includes software developed by Michael B. Durian.
  1163. X * 4. The name of the the Author may be used to endorse or promote 
  1164. X *    products derived from this software without specific prior written 
  1165. X *    permission.
  1166. X *
  1167. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 
  1168. X * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  1169. X * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  
  1170. X * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
  1171. X * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1172. X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1173. X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1174. X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1175. X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1176. X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1177. X * SUCH DAMAGE.
  1178. X */
  1179. X#ifndef SYSEXEVENT_H
  1180. X#define SYSEXEVENT_H
  1181. X
  1182. X#include "Event.h"
  1183. X
  1184. Xclass SystemExclusiveEvent : public Event {
  1185. X    friend ostream &operator<<(ostream &os, const SystemExclusiveEvent &e);
  1186. Xpublic:
  1187. X    SystemExclusiveEvent();
  1188. X    SystemExclusiveEvent(unsigned char c);
  1189. X    SystemExclusiveEvent(unsigned long t, const unsigned char *data,
  1190. X        long length);
  1191. X    SystemExclusiveEvent(const SystemExclusiveEvent &e);
  1192. X    virtual ~SystemExclusiveEvent();
  1193. X    virtual Event *Dup(void) const
  1194. X         {return (new SystemExclusiveEvent(*this));}
  1195. X
  1196. X    virtual EventType GetType(void) const {return (SYSTEMEXCLUSIVE);}
  1197. X    virtual char *GetTypeStr(void) const {return ("SystemExclusiveEvent");}
  1198. X    virtual char *GetEventStr(void) const;
  1199. X    const unsigned char *GetData(void) const {return (data);}
  1200. X    long GetLength(void) const {return (length);}
  1201. X    unsigned char GetContinued(void) const {return (continued);}
  1202. X
  1203. X    void SetData(const unsigned char *data, long length);
  1204. X    void SetContinued(unsigned char cont) {continued = cont;}
  1205. X
  1206. X    SystemExclusiveEvent &operator=(const SystemExclusiveEvent &e);
  1207. X
  1208. X    virtual const char *SMFRead(SMFTrack &t);
  1209. X    virtual const char *SMFWrite(SMFTrack &t) const;
  1210. Xprotected:
  1211. X    virtual int Equal(const Event *e) const;
  1212. Xprivate:
  1213. X    unsigned char *data;
  1214. X    unsigned char continued;
  1215. X    long length;
  1216. X};
  1217. X#endif
  1218. END_OF_FILE
  1219.   if test 2938 -ne `wc -c <'tclmidi-2.0/events/SystemExcl.h'`; then
  1220.     echo shar: \"'tclmidi-2.0/events/SystemExcl.h'\" unpacked with wrong size!
  1221.   fi
  1222.   # end of 'tclmidi-2.0/events/SystemExcl.h'
  1223. fi
  1224. if test -f 'tclmidi-2.0/man/midirecord.n' -a "${1}" != "-c" ; then 
  1225.   echo shar: Will not clobber existing file \"'tclmidi-2.0/man/midirecord.n'\"
  1226. else
  1227.   echo shar: Extracting \"'tclmidi-2.0/man/midirecord.n'\" \(1764 characters\)
  1228.   sed "s/^X//" >'tclmidi-2.0/man/midirecord.n' <<'END_OF_FILE'
  1229. X.Dd January 30, 1994
  1230. X.Dt MIDIRECORD N
  1231. X.Os
  1232. X.Sh NAME
  1233. X.Nm midirecord
  1234. X.Nd "tclmidi command to record a MIDI song"
  1235. X.Sh SYNOPSIS
  1236. X.Nm
  1237. X.Ar RecMidiID
  1238. X.Op PlayMidiID Op repeat
  1239. X.Sh DESCRIPTION
  1240. X.Nm
  1241. Xis a
  1242. X.Xr tclmidi 1
  1243. Xcommand that records events from a \%MIDI
  1244. Xdevice and puts them in a \%MIDI song.
  1245. XCurrently, only MPU-401 compatible cards in UART mode are
  1246. Xsupported.
  1247. XA device driver for the MPU-401 is included with this
  1248. Xrelease for the following architectures:
  1249. X.Bl -item -offset indent -compact
  1250. X.It
  1251. XBSD/386
  1252. X.It
  1253. X386BSD and variants
  1254. X.It
  1255. XSVR4
  1256. X.It
  1257. XLinux
  1258. X.El
  1259. X.Pp
  1260. XThe first argument to
  1261. X.Nm
  1262. Xis the \%MIDI song descriptor of the record song.
  1263. XIt should be one returned from
  1264. X.Xr midimake n
  1265. Xor
  1266. X.Xr midiread n .
  1267. XThe second argument is an optional \%MIDI song descriptor
  1268. Xfor a song that should be played while recording.
  1269. XFurthermore, an optional third argument of ``repeat'' may be specified
  1270. Xso the play song will be repeated.
  1271. X.Pp
  1272. XRecording continues until the
  1273. X.Xr midistop n
  1274. Xcommand is issued.
  1275. X.Xr midiwait n
  1276. Xmay be used to block until the play song finishes.
  1277. X.Pp
  1278. XAll recorded events are put into track 0 of the \%MIDI song.
  1279. X.Sh RETURN VALUES
  1280. X.Nm
  1281. Xreturns immediately with 0
  1282. Xif no \%MIDI devices are available, or
  1283. X1 if one is.
  1284. X.Sh BUGS
  1285. XThe MPU-401 device interface
  1286. Xdynamically creates events in the record \%MIDI song
  1287. Xasynchronously.
  1288. XSince this involves a call to
  1289. X.Xr malloc 3
  1290. Xwhich
  1291. Xis not re-entrant, this is a potential hazard.
  1292. XUntil I figure out a way around this, avoid other
  1293. Xcalls to
  1294. X.Xr malloc 3
  1295. Xwhile recording.
  1296. XThreads would provide a good way to work around this, but
  1297. Xuntil they are more common, we'll just have to be careful.
  1298. X.Sh SEE ALSO
  1299. X.Xr tclm 1 ,
  1300. X.Xr midiplay n ,
  1301. X.Xr midiread n ,
  1302. X.Xr midimake n ,
  1303. X.Xr midistop n ,
  1304. X.Xr midiwait n
  1305. X.Sh AUTHOR
  1306. XMike Durian - durian@boogie.com
  1307. END_OF_FILE
  1308.   if test 1764 -ne `wc -c <'tclmidi-2.0/man/midirecord.n'`; then
  1309.     echo shar: \"'tclmidi-2.0/man/midirecord.n'\" unpacked with wrong size!
  1310.   fi
  1311.   # end of 'tclmidi-2.0/man/midirecord.n'
  1312. fi
  1313. if test -f 'tclmidi-2.0/smf/SMFUtils.C' -a "${1}" != "-c" ; then 
  1314.   echo shar: Will not clobber existing file \"'tclmidi-2.0/smf/SMFUtils.C'\"
  1315. else
  1316.   echo shar: Extracting \"'tclmidi-2.0/smf/SMFUtils.C'\" \(3083 characters\)
  1317.   sed "s/^X//" >'tclmidi-2.0/smf/SMFUtils.C' <<'END_OF_FILE'
  1318. X/*-
  1319. X * Copyright (c) 1993, 1994 Michael B. Durian.  All rights reserved.
  1320. X *
  1321. X * Redistribution and use in source and binary forms, with or without
  1322. X * modification, are permitted provided that the following conditions
  1323. X * are met:
  1324. X * 1. Redistributions of source code must retain the above copyright
  1325. X *    notice, this list of conditions and the following disclaimer.
  1326. X * 2. Redistributions in binary form must reproduce the above copyright
  1327. X *    notice, this list of conditions and the following disclaimer in the
  1328. X *    documentation and/or other materials provided with the distribution.
  1329. X * 3. All advertising materials mentioning features or use of this software
  1330. X *    must display the following acknowledgement:
  1331. X *    This product includes software developed by Michael B. Durian.
  1332. X * 4. The name of the the Author may be used to endorse or promote 
  1333. X *    products derived from this software without specific prior written 
  1334. X *    permission.
  1335. X *
  1336. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 
  1337. X * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  1338. X * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  
  1339. X * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
  1340. X * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1341. X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1342. X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1343. X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1344. X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1345. X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1346. X * SUCH DAMAGE.
  1347. X */
  1348. X#include <stdlib.h>
  1349. X#include <unistd.h>
  1350. X#include "SMFUtils.h"
  1351. X
  1352. Xstatic int MEOF = 0;
  1353. X
  1354. Xlong
  1355. XMRead(int fd, char *data, long len)
  1356. X{
  1357. X    int num_read;
  1358. X    int total_read;
  1359. X
  1360. X    total_read = 0;
  1361. X    do {
  1362. X        if ((num_read = read(fd, data, len - total_read)) == -1)
  1363. X            return (-1);
  1364. X        if (num_read == 0)
  1365. X            break;
  1366. X        total_read += num_read;
  1367. X        data += num_read;
  1368. X    } while (len > total_read);
  1369. X    if (total_read == 0)
  1370. X        MEOF = 1;
  1371. X    return (total_read);
  1372. X}
  1373. X
  1374. Xlong
  1375. XMWrite(int fd, char *data, long len)
  1376. X{
  1377. X    int num_written;
  1378. X    int total_written;
  1379. X
  1380. X    total_written = 0;
  1381. X    do {
  1382. X        if ((num_written = write(fd, data, len - total_written)) == -1)
  1383. X            return (-1);
  1384. X        if (num_written == 0)
  1385. X            break;
  1386. X        total_written += num_written;
  1387. X        data += num_written;
  1388. X    } while (len > total_written);
  1389. X    return (total_written);
  1390. X}
  1391. X
  1392. Xint
  1393. XMEof(void)
  1394. X{
  1395. X
  1396. X    return (MEOF);
  1397. X}
  1398. X
  1399. Xvoid
  1400. XClearMEof(void)
  1401. X{
  1402. X
  1403. X    MEOF = 0;
  1404. X}
  1405. X
  1406. Xlong
  1407. XVarToFix(unsigned char *var, int *len)
  1408. X{
  1409. X    long fix;
  1410. X
  1411. X    fix = 0;
  1412. X    *len = 0;
  1413. X    if (*var & 0x80)
  1414. X        do {
  1415. X            fix = (fix << 7) + (*var & 0x7f);
  1416. X            (*len)++;
  1417. X        } while (*var++ & 0x80);
  1418. X    else {
  1419. X        fix = *var++;
  1420. X        (*len)++;
  1421. X    }
  1422. X
  1423. X    return (fix);
  1424. X}
  1425. X
  1426. X
  1427. Xint
  1428. XFixToVar(long fix, unsigned char *var)
  1429. X{
  1430. X    int i;
  1431. X    unsigned char buf[4];
  1432. X    unsigned char *bptr;
  1433. X
  1434. X    buf[0] = buf[1] = buf[2] = buf[3] = 0;
  1435. X    bptr = buf;
  1436. X    *bptr++ = fix & 0x7f;
  1437. X    while ((fix >>= 7) > 0) {
  1438. X        *bptr |= 0x80;
  1439. X        *bptr++ += (fix & 0x7f);
  1440. X    }
  1441. X
  1442. X    i = 0;
  1443. X    do {
  1444. X        *var++ = *--bptr;
  1445. X        i++;
  1446. X    } while (bptr != buf);
  1447. X
  1448. X    return (i);
  1449. X}
  1450. X
  1451. END_OF_FILE
  1452.   if test 3083 -ne `wc -c <'tclmidi-2.0/smf/SMFUtils.C'`; then
  1453.     echo shar: \"'tclmidi-2.0/smf/SMFUtils.C'\" unpacked with wrong size!
  1454.   fi
  1455.   # end of 'tclmidi-2.0/smf/SMFUtils.C'
  1456. fi
  1457. if test -f 'tclmidi-2.0/song/EventTree.h' -a "${1}" != "-c" ; then 
  1458.   echo shar: Will not clobber existing file \"'tclmidi-2.0/song/EventTree.h'\"
  1459. else
  1460.   echo shar: Extracting \"'tclmidi-2.0/song/EventTree.h'\" \(3191 characters\)
  1461.   sed "s/^X//" >'tclmidi-2.0/song/EventTree.h' <<'END_OF_FILE'
  1462. X/*-
  1463. X * Copyright (c) 1993, 1994 Michael B. Durian.  All rights reserved.
  1464. X *
  1465. X * Redistribution and use in source and binary forms, with or without
  1466. X * modification, are permitted provided that the following conditions
  1467. X * are met:
  1468. X * 1. Redistributions of source code must retain the above copyright
  1469. X *    notice, this list of conditions and the following disclaimer.
  1470. X * 2. Redistributions in binary form must reproduce the above copyright
  1471. X *    notice, this list of conditions and the following disclaimer in the
  1472. X *    documentation and/or other materials provided with the distribution.
  1473. X * 3. All advertising materials mentioning features or use of this software
  1474. X *    must display the following acknowledgement:
  1475. X *    This product includes software developed by Michael B. Durian.
  1476. X * 4. The name of the the Author may be used to endorse or promote 
  1477. X *    products derived from this software without specific prior written 
  1478. X *    permission.
  1479. X *
  1480. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 
  1481. X * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  1482. X * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  
  1483. X * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
  1484. X * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1485. X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1486. X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1487. X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1488. X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1489. X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1490. X * SUCH DAMAGE.
  1491. X */
  1492. X#ifndef EVENTTREE_H
  1493. X#define EVENTTREE_H
  1494. X
  1495. X#include <iostream.h>
  1496. X#include <strstream.h>
  1497. X#include <iomanip.h>
  1498. X
  1499. X#include "Event.h"
  1500. X
  1501. Xextern "C" {
  1502. X#include "rb.h"
  1503. X}
  1504. X
  1505. Xtypedef struct rb_node EventTreeNode;
  1506. Xtypedef struct rb_node EventTreeHead;
  1507. X
  1508. Xclass EventTree {
  1509. X    friend ostream &operator<<(ostream &os, const EventTree &t);
  1510. Xpublic:
  1511. X    EventTree();
  1512. X    EventTree(const EventTree &t);
  1513. X    ~EventTree();
  1514. X
  1515. X    Event *GetEvents(unsigned long time);
  1516. X    Event *NextEvent(void);
  1517. X    Event *NextEvent(const Event *e);
  1518. X    Event *NextEvents(void);
  1519. X    Event *NextEvents(const Event *e);
  1520. X    Event *PrevEvent(void);
  1521. X    Event *PrevEvent(const Event *e);
  1522. X    Event *PrevEvents(void);
  1523. X    Event *PrevEvents(const Event *e);
  1524. X    Event *GetFirstEvent(void);
  1525. X    Event *GetFirstEvents(void);
  1526. X    Event *GetLastEvent(void);
  1527. X    Event *GetLastEvents(void);
  1528. X    EventTreeNode *GetFirstNode(void);
  1529. X    EventTreeNode *GetLastNode(void);
  1530. X    EventTreeNode *NextNode(const EventTreeNode *n);
  1531. X    EventTreeNode *PrevNode(const EventTreeNode *n);
  1532. X    unsigned long GetStartTime(void);
  1533. X    unsigned long GetEndTime(void);
  1534. X
  1535. X    int Add(const EventTree &et, unsigned long start, double scalar = 1);
  1536. X    EventTree *GetRange(unsigned long start, unsigned long end) const;
  1537. X    int DeleteRange(unsigned long start, unsigned long end);
  1538. X
  1539. X    Event *PutEvent(const Event &event);
  1540. X    void RewindEvents(void);
  1541. X    int DeleteEvent(const Event &event);
  1542. X
  1543. X    EventTree &operator=(const EventTree &t);
  1544. Xprivate:
  1545. X    void DeleteTree(void);
  1546. X    void CopyTree(const EventTree &t);
  1547. X
  1548. X    EventTreeHead *head;
  1549. X    EventTreeNode *curr_node;
  1550. X    Event *curr_event;
  1551. X};
  1552. X#endif
  1553. END_OF_FILE
  1554.   if test 3191 -ne `wc -c <'tclmidi-2.0/song/EventTree.h'`; then
  1555.     echo shar: \"'tclmidi-2.0/song/EventTree.h'\" unpacked with wrong size!
  1556.   fi
  1557.   # end of 'tclmidi-2.0/song/EventTree.h'
  1558. fi
  1559. if test -f 'tclmidi-2.0/song/Song.h' -a "${1}" != "-c" ; then 
  1560.   echo shar: Will not clobber existing file \"'tclmidi-2.0/song/Song.h'\"
  1561. else
  1562.   echo shar: Extracting \"'tclmidi-2.0/song/Song.h'\" \(3201 characters\)
  1563.   sed "s/^X//" >'tclmidi-2.0/song/Song.h' <<'END_OF_FILE'
  1564. X/*-
  1565. X * Copyright (c) 1993, 1994 Michael B. Durian.  All rights reserved.
  1566. X *
  1567. X * Redistribution and use in source and binary forms, with or without
  1568. X * modification, are permitted provided that the following conditions
  1569. X * are met:
  1570. X * 1. Redistributions of source code must retain the above copyright
  1571. X *    notice, this list of conditions and the following disclaimer.
  1572. X * 2. Redistributions in binary form must reproduce the above copyright
  1573. X *    notice, this list of conditions and the following disclaimer in the
  1574. X *    documentation and/or other materials provided with the distribution.
  1575. X * 3. All advertising materials mentioning features or use of this software
  1576. X *    must display the following acknowledgement:
  1577. X *    This product includes software developed by Michael B. Durian.
  1578. X * 4. The name of the the Author may be used to endorse or promote 
  1579. X *    products derived from this software without specific prior written 
  1580. X *    permission.
  1581. X *
  1582. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 
  1583. X * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  1584. X * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  
  1585. X * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
  1586. X * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1587. X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1588. X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1589. X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1590. X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1591. X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1592. X * SUCH DAMAGE.
  1593. X */
  1594. X#ifndef SONG_H
  1595. X#define SONG_H
  1596. X
  1597. X#include "EventTree.h"
  1598. X
  1599. Xclass Song {
  1600. X    friend ostream &operator<<(ostream &os, const Song &s);
  1601. Xpublic:
  1602. X    Song();
  1603. X    Song(const Song &s);
  1604. X    Song(short num);
  1605. X    Song(short form, short div, short num);
  1606. X    ~Song();
  1607. X
  1608. X    Event *GetEvents(short track, unsigned long time);
  1609. X    Event *NextEvent(short track);
  1610. X    Event *PrevEvent(short track);
  1611. X    short GetFormat(void) const {return (format);}
  1612. X    short GetDivision(void) const {return (division);}
  1613. X    short GetNumTracks(void) const {return (num_tracks);}
  1614. X    EventTree &GetTrack(short track);
  1615. X
  1616. X    Event *PutEvent(short track, const Event &event);
  1617. X    void RewindEvents(void);
  1618. X    void RewindEvents(short track);
  1619. X    int DeleteEvent(short track, const Event &event);
  1620. X    void SetFormat(short form) {format = form;}
  1621. X    void SetDivision(short div) {division = div;}
  1622. X    void SetNumTracks(short num);
  1623. X
  1624. X    int Add(short track, const EventTree &et, unsigned long start,
  1625. X        double scalar = 1.0);
  1626. X    EventTree *GetRange(short track, unsigned long start,
  1627. X        unsigned long end) const;
  1628. X    int DeleteRange(short track, unsigned long start, unsigned long end);
  1629. X
  1630. X    int Merge(short dest_track, const Song &song, short src_track);
  1631. X    int Split(short src_track, Song &meta_song, short meta_track,
  1632. X        Song &normal_song, short normal_track) const;
  1633. X
  1634. X    Song &operator=(const Song &s);
  1635. X
  1636. X    int SMFRead(int fd);
  1637. X    int SMFWrite(int fd);
  1638. X    const char *GetError(void) const;
  1639. X
  1640. X    void SetNotePair(int track_num, Event *event);
  1641. Xprivate:
  1642. X    short format;
  1643. X    short division;
  1644. X    short num_tracks;
  1645. X    EventTree *tracks;
  1646. X    const char *errstr;
  1647. X};
  1648. X#endif
  1649. END_OF_FILE
  1650.   if test 3201 -ne `wc -c <'tclmidi-2.0/song/Song.h'`; then
  1651.     echo shar: \"'tclmidi-2.0/song/Song.h'\" unpacked with wrong size!
  1652.   fi
  1653.   # end of 'tclmidi-2.0/song/Song.h'
  1654. fi
  1655. echo shar: End of archive 10 \(of 14\).
  1656. cp /dev/null ark10isdone
  1657. MISSING=""
  1658. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 ; do
  1659.     if test ! -f ark${I}isdone ; then
  1660.     MISSING="${MISSING} ${I}"
  1661.     fi
  1662. done
  1663. if test "${MISSING}" = "" ; then
  1664.     echo You have unpacked all 14 archives.
  1665.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1666. else
  1667.     echo You still must unpack the following archives:
  1668.     echo "        " ${MISSING}
  1669. fi
  1670. exit 0
  1671. exit 0 # Just in case...
  1672.