home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.tcl
- Path: sparky!uunet!paladin.american.edu!howland.reston.ans.net!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!agate!boulder!csn!cherokee!durian
- From: durian@advtech.uswest.com (Mike Durian)
- Subject: tclm0.1 - tcl with MIDI extensions (5/7)
- Message-ID: <1993Jan12.203010.20008@advtech.uswest.com>
- Sender: news@advtech.uswest.com (Radio Free Boulder)
- Nntp-Posting-Host: mongo.advtech.uswest.com
- Organization: U S WEST Advanced Technologies
- Date: Tue, 12 Jan 1993 20:30:10 GMT
- Lines: 950
-
- # This is a shell archive. Save it in a file, remove anything before
- # this line, and then unpack it by entering "sh file". Note, it may
- # create directories; files and directories will be owned by you and
- # have default permissions.
- #
- # This archive contains:
- #
- # tclm0.1/doc
- # tclm0.1/doc/README
- # tclm0.1/doc/minfo.1
- # tclm0.1/doc/mplay.1
- # tclm0.1/doc/tclm.1
- # tclm0.1/mlib
- # tclm0.1/mlib/mpu401.c
- # tclm0.1/mlib/mplayutil.h
- # tclm0.1/mlib/mpu401.h
- # tclm0.1/mlib/mutil.h
- #
- echo c - tclm0.1/doc
- mkdir tclm0.1/doc > /dev/null 2>&1
- echo x - tclm0.1/doc/README
- sed 's/^X//' >tclm0.1/doc/README << 'END-of-tclm0.1/doc/README'
- X These man pages want to use the mdoc macro package. This is the
- Xnew Berkeley man page formatter. It can be found with groff.
- END-of-tclm0.1/doc/README
- echo x - tclm0.1/doc/minfo.1
- sed 's/^X//' >tclm0.1/doc/minfo.1 << 'END-of-tclm0.1/doc/minfo.1'
- XMINFO(1) BSD Reference Manual MINFO(1)
- X
- XNNAAMMEE
- X mmiinnffoo - a tcl script to print a Standard MIDI File in human readable form
- X
- XSSYYNNOOPPSSIISS
- X mmiinnffoo [file]
- X
- XDDEESSCCRRIIPPTTIIOONN
- X mmiinnffoo is a ttccll script that reads a Standard MIDI File and prints the data
- X in human readable form. If a file is not specified on the command line
- X mmiinnffoo will read from _s_t_d_i_n.
- X
- XSSEEEE AALLSSOO
- X tclm(3TCLM)
- X
- XAAUUTTHHOORRSS
- X Mike Durian - durian@advtech.uswest.com
- X
- X TCLM Jan 10, 1993 1
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- END-of-tclm0.1/doc/minfo.1
- echo x - tclm0.1/doc/mplay.1
- sed 's/^X//' >tclm0.1/doc/mplay.1 << 'END-of-tclm0.1/doc/mplay.1'
- XMPLAY(1) BSD Reference Manual MPLAY(1)
- X
- XNNAAMMEE
- X mmppllaayy - a tcl script to play Standard MIDI Files
- X
- XSSYYNNOOPPSSIISS
- X mmppllaayy [--rr] [--tt _t_r_a_c_k_s] [--ss _s_p_e_e_d] [file ...]
- X
- XDDEESSCCRRIIPPTTIIOONN
- X mmppllaayy is a ttccll script that plays Standard MIDI Files. Multiple files may
- X be specified on the command line, or files can be read from _s_t_d_i_n. The
- X options are as follows:
- X
- X --rr Play the first file repeatedly. The playing will continue
- X until the process is killed.
- X
- X --tt Specifies a list of tracks to be played instead of the de-
- X fault all. This option has an argument that lists the
- X tracks. The argument needs to be treated as one argument
- X instead of multiple values, and thus should be enclosed in
- X double or single quotes.
- X
- X --ss Specifies a tempo modifier. The argument to this option
- X is a float value in the range 0 to 4 that acts as a multi-
- X pler for the tempo values found in the Standard MIDI
- X Files.
- X
- X Since mmppllaayy makes use of the mmiiddiippllaayy ttccllmm command, this program will on-
- X ly work on BSD/386 systems equiped with a MPU-401 compatible MIDI card.
- X An error message is printed to stderr if the script is run by a ttccllmm in-
- X terpreter without the MPU-401 extensions.
- X
- XSSEEEE AALLSSOO
- X tclm(3TCLM)
- X
- XAAUUTTHHOORRSS
- X Mike Durian - durian@advtech.uswest.com
- X
- X TCLM Jan 10, 1993 1
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- END-of-tclm0.1/doc/mplay.1
- echo x - tclm0.1/doc/tclm.1
- sed 's/^X//' >tclm0.1/doc/tclm.1 << 'END-of-tclm0.1/doc/tclm.1'
- XTCLM(1) BSD Reference Manual TCLM(1)
- X
- XNNAAMMEE
- X ttccllmm - a tcl interpreter with MIDI extensions
- X
- XSSYYNNOOPPSSIISS
- X ttccllmm [--ff [_f_i_l_e_n_a_m_e]]
- X
- XDDEESSCCRRIIPPTTIIOONN
- X ttccllmm is a ttccll interpreter with MIDI extensions allowing it to manipulate
- X Standard MIDI Files and in some cases play Standard MIDI Files. TTccll is a
- X Tool Command Language written by John Ousterhout.
- X
- X ttccllmm has only one option:
- X
- X --ff This option has one optional argument that specifies
- X the name of a file containing tclm commands. These
- X commands are executed in place of reading from stdin.
- X Without the optional argument commands are read from
- X _s_t_d_i_n.
- X Without the --ff option ttccllmm displays a ``tclm:'' prompt and reads commands
- X from _s_t_d_i_n.
- X
- X TTCCLLMM EEXXTTEENNSSIIOONN
- X ttccllmm has a few extensions which aid in the manipulation of Standard MIDI
- X Files (SMF). They are:
- X
- X mmiiddiiccoonnffiigg Changes configuration values in a SMF.
- X
- X mmiiddiiffiixxttoovvaarr Converts fixed length integers to SMF variable length
- X values.
- X
- X mmiiddiiffrreeee Frees the space used by SMF's.
- X
- X mmiiddiiggeett Gets one event from a track in a SMF.
- X
- X mmiiddiimmaakkee Creates an empty SMF.
- X
- X mmiiddiimmppuu Checks to see if the MPU-401 extensions are avail-
- X able.
- X
- X mmiiddiippuutt Puts an event in a track in a SMF.
- X
- X mmiiddiirreeaadd Reads a SMF from an open file descriptor.
- X
- X mmiiddiirreewwiinndd Resets a SMF to its beginning.
- X
- X mmiiddiittiimmiinngg Gets the timing portion of a SMF event.
- X
- X mmiiddiivvaarrttooffiixx Converts a SMF variable length value to a fixed
- X length integer.
- X
- X mmiiddiiwwrriittee Writes a SMF to an open file descriptor.
- X
- X There are also two commands available for playing SMF. Since they use
- X BSDI's MPU-401 device driver, they are only available for BSD/386 ma-
- X chines with an MPU-401 card. The mmiiddiimmppuu command can be used to selec-
- X tively enable or disable MPU-401 specific commands in scripts meant to
- X run on BSD/386 as well as other machines. These commands are:
- X
- X mmiiddiippllaayy Play a SMF.
- X
- X mmiiddiissttoopp Stop a SMF that is currently playing in the background.
- X
- XSSEEEE AALLSSOO
- X midiconfig(3TCLM), midifixtovar(3TCLM), midifree(3TCLM),
- X midiget(3TCLM), midimake(3TCLM), midimpu(3TCLM), midiplay(3TCLM),
- X midiput(3TCLM), midiread(3TCLM), midirewind(3TCLM), midistop(3TCLM),
- X miditiming(3TCLM), midivartofix(3TCLM), midiwrite(3TCLM)
- X
- XAAUUTTHHOORRSS
- X John Ousterhout - ouster@cs.berkely.edu for the TCL stuff
- X Mike Durian - durian@advtech.uswest.com for the MIDI stuff
- X
- X TCLM Jan 10, 1993 2
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- END-of-tclm0.1/doc/tclm.1
- echo c - tclm0.1/mlib
- mkdir tclm0.1/mlib > /dev/null 2>&1
- echo x - tclm0.1/mlib/mpu401.c
- sed 's/^X//' >tclm0.1/mlib/mpu401.c << 'END-of-tclm0.1/mlib/mpu401.c'
- X/* mpu401.c,v 1.3 1993/01/12 19:23:47 durian Exp */
- X/*
- X * Copyright (c) 1993 Michael B. Durian. All rights reserved.
- X *
- X * Redistribution and use in source and binary forms, with or without
- X * modification, are permitted provided that the following conditions
- X * are met:
- X * 1. Redistributions of source code must retain the above copyright
- X * notice, this list of conditions and the following disclaimer.
- X * 2. Redistributions in binary form must reproduce the above copyright
- X * notice, this list of conditions and the following disclaimer in the
- X * documentation and/or other materials provided with the distribution.
- X * 3. All advertising materials mentioning features or use of this software
- X * must display the following acknowledgement:
- X * This product includes software developed by Michael B. Durian.
- X * 4. The name of the the Author may be used to endorse or promote
- X * products derived from this software without specific prior written
- X * permission.
- X *
- X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
- X * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- X * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- X * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- X * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- X * SUCH DAMAGE.
- X */
- X#ifdef MPU
- X#include <stdio.h>
- X#include <stdlib.h>
- X#include <unistd.h>
- X#include <string.h>
- X#include <sys/fcntl.h>
- X#include <sys/ioctl.h>
- X#include <i386/isa/midiioctl.h>
- X#include "mpu401.h"
- X
- X#define MAX_TIME 0xef
- X
- Xint
- Xget_board_event(events_data, events_size, event_data, event_size)
- X unsigned char *events_data;
- X int events_size;
- X unsigned char *event_data;
- X int *event_size;
- X{
- X MESS_STATE state;
- X int delta;
- X int parsed;
- X static unsigned char r_state;
- X
- X *event_size = 0;
- X parsed = 0;
- X delta = 0;
- X state = START;
- X while (!parsed) {
- X if (delta >= events_size)
- X return (-1);
- X switch (state) {
- X case START:
- X if (*events_data < 0xf0) {
- X state = TIMEDEVENT;
- X *event_data++ = *events_data++;
- X (*event_size)++;
- X delta++;
- X break;
- X }
- X switch (*events_data) {
- X case 0xf8: /* timer overflow */
- X *event_data++ = *events_data++;
- X (*event_size)++;
- X delta++;
- X parsed = 1;
- X break;
- X case 0xfc: /* all play tracks ended */
- X case 0xfd: /* clock to PC message */
- X *event_data++ = *events_data++;
- X (*event_size)++;
- X delta++;
- X parsed = 1;
- X break;
- X case 0xf9:
- X /* conductor track request - should never see */
- X *event_data++ = *events_data++;
- X (*event_size)++;
- X delta++;
- X parsed = 1;
- X break;
- X case 0xff:
- X /* system message */
- X *event_data++ = *events_data++;
- X (*event_size)++;
- X delta++;
- X state = SYSMSG;
- X break;
- X case 0xfe:
- X /* command acknowledge - should never see */
- X *event_data++ = *events_data++;
- X (*event_size)++;
- X delta++;
- X parsed = 1;
- X break;
- X case 0xf0:
- X case 0xf1:
- X case 0xf2:
- X case 0xf3:
- X case 0xf4:
- X case 0xf5:
- X case 0xf6:
- X case 0xf7:
- X /* track requests - should never see */
- X *event_data++ = *events_data++;
- X (*event_size)++;
- X delta++;
- X parsed = 1;
- X break;
- X }
- X break;
- X case TIMEDEVENT:
- X if (*events_data < 0xf0) {
- X /* midi channel/voice message */
- X if (*events_data & 0x80) {
- X /* new running status */
- X r_state = (*events_data >> 4) & 0x0f;
- X state = NEWSTATUS;
- X *event_data++ = *events_data++;
- X (*event_size)++;
- X delta++;
- X break;
- X } else {
- X /* midi data byte */
- X /*
- X * if timed messaged are off then
- X * this 1st data byte is actually the
- X * the second
- X * Only when midi not playing, data
- X * transfer is stopped state is active
- X * and timing byte on switch is off
- X */
- X /*
- X * Since we can't know these things
- X * here, we'll assume how this routine
- X * will be used (oh Ghads!), and
- X * pretrend that the the timing byte
- X * is on when we the event was
- X * generated. Why would they want
- X * to put events in a Standard Midi
- X * file if this wasn't the case
- X */
- X *event_data++ = *events_data++;
- X (*event_size)++;
- X delta++;
- X state = MIDIDATA;
- X break;
- X }
- X } else {
- X /* mcc timed event */
- X if (*events_data == 0xf9) {
- X /* measure end message */
- X *event_data++ = *events_data++;
- X (*event_size)++;
- X delta++;
- X parsed = 1;
- X break;
- X } else if (*events_data == 0xfc) {
- X *event_data++ = *events_data++;
- X (*event_size)++;
- X delta++;
- X parsed = 1;
- X break;
- X } else {
- X *event_data++ = *events_data++;
- X (*event_size)++;
- X delta++;
- X parsed = 1;
- X break;
- X }
- X }
- X case NEWSTATUS:
- X /* first nonstatus byte of a midi message */
- X /*
- X * if timed messaged are off then this 1st data byte is
- X * actually the the second.
- X * Only when midi not playing, data transfer is stopped
- X * state is active and timing byte on switch is off.
- X * We're not doing this. See explaination (cop-out)
- X * above
- X */
- X *event_data++ = *events_data++;
- X (*event_size)++;
- X delta++;
- X switch (r_state) {
- X case 0x08:
- X case 0x09:
- X case 0x0a:
- X case 0x0b:
- X case 0x0e:
- X state = MIDIDATA;
- X break;
- X default:
- X parsed = 1;
- X break;
- X }
- X break;
- X case MIDIDATA:
- X /* second data byte of a midi message */
- X *event_data++ = *events_data++;
- X (*event_size)++;
- X delta++;
- X parsed = 1;
- X break;
- X case SYSMSG:
- X /* first byte of a system message. */
- X if (*events_data == 0xf0)
- X /* system exclusive */
- X state = SYSX;
- X else {
- X /* real time message */
- X parsed = 1;
- X }
- X *event_data++ = *events_data++;
- X (*event_size)++;
- X delta++;
- X break;
- X case SYSX:
- X /* system exclusive message */
- X /*
- X * Supposedly the 0xf7 is optional as a terminator.
- X * Since all bytes in the SYSX message are data bytes,
- X * we should be able to tell when it is over by looking
- X * for any byte with high bit set. Of course this is
- X * the first byte of the next message.
- X */
- X if (*events_data & 0x80) {
- X switch (*events_data) {
- X case 0xf7:
- X *event_data++ = *events_data++;
- X (*event_size)++;
- X delta++;
- X parsed = 1;
- X break;
- X case 0xf8:
- X case 0xfc:
- X case 0xfd:
- X case 0xf9:
- X case 0xff:
- X case 0xfe:
- X case 0xf0:
- X case 0xf1:
- X case 0xf2:
- X case 0xf3:
- X case 0xf4:
- X case 0xf5:
- X case 0xf6:
- X /*
- X * abnormal terminators
- X * We'll save these for next go
- X * around and add a terminator
- X */
- X *event_data++ = 0xf7;
- X (*event_size)++;
- X parsed = 1;
- X break;
- X default:
- X /*
- X * we already grabbed the timing
- X * byte. This the the event byte.
- X * since we went on too far we'll
- X * have to decrement the delta.
- X * also cover up that extra byte
- X * with a terminator.
- X */
- X *--event_data = 0x7f;
- X delta--;
- X parsed = 1;
- X break;
- X }
- X } else {
- X *event_data++ = *events_data++;
- X (*event_size)++;
- X delta++;
- X }
- X break;
- X }
- X }
- X return (delta);
- X}
- X
- Xvoid
- Xboard2smf(board_event, board_length, smf_event, smf_length)
- X unsigned char *board_event;
- X int board_length;
- X unsigned char *smf_event;
- X int *smf_length;
- X{
- X static long elapsed = 0;
- X int delta;
- X int i;
- X
- X
- X *smf_length = 0;
- X
- X if (*board_event == 0xf8)
- X elapsed += 240;
- X else {
- X delta = fix2var((long)(*board_event + elapsed), smf_event);
- X elapsed = 0;
- X *smf_length += delta;
- X smf_event += delta;
- X board_event++;
- X for (i = 1; i < board_length; i++) {
- X *smf_event++ = *board_event++;
- X (*smf_length)++;
- X }
- X }
- X
- X return;
- X}
- X
- X
- Xint
- Xsmf2board(track_num, smf_event, smf_size, board_event, t_scalar,
- X need_new_event, event_type)
- X int track_num;
- X unsigned char *smf_event;
- X int smf_size;
- X unsigned char *board_event;
- X int t_scalar;
- X int *need_new_event;
- X EVENT_TYPE *event_type;
- X{
- X static long time_left[MAX_TRAX] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- X 0, 0, 0, 0, 0};
- X static int fraction[MAX_TRAX] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- X 0, 0, 0, 0};
- X static EVENT_TYPE e_type[MAX_TRAX];
- X static int s_size[MAX_TRAX];
- X static int s_pos[MAX_TRAX];
- X static unsigned char s_data[MAX_TRAX][256];
- X static unsigned char *s_event[MAX_TRAX];
- X int delta;
- X int size;
- X
- X *need_new_event = 0;
- X size = 0;
- X if (smf_event != NULL) {
- X memcpy(s_data[track_num], smf_event, smf_size);
- X s_event[track_num] = s_data[track_num];
- X s_pos[track_num] = 0;
- X s_size[track_num] = smf_size;
- X e_type[track_num] = *event_type;
- X
- X time_left[track_num] = var2fix(s_event[track_num], &delta);
- X fraction[track_num] += time_left[track_num] % t_scalar;
- X time_left[track_num] /= t_scalar;
- X if (fraction[track_num] >= t_scalar) {
- X time_left[track_num] += fraction[track_num] / t_scalar;
- X fraction[track_num] %= t_scalar;
- X }
- X s_pos[track_num] += delta;
- X s_event[track_num] += delta;
- X }
- X if (time_left[track_num] >= MAX_TIME) {
- X *board_event++ = 0xf8;
- X size += 1;
- X time_left[track_num] -= MAX_TIME + 1;
- X *event_type = NORMAL;
- X return (size);
- X } else {
- X *board_event++ = (unsigned char) time_left[track_num];
- X size++;
- X time_left[track_num] = 0;
- X *event_type = e_type[track_num];
- X }
- X
- X while (s_pos[track_num]++ < s_size[track_num]) {
- X *board_event++ = *s_event[track_num]++;
- X size++;
- X }
- X
- X *need_new_event = 1;
- X
- X return (size);
- X}
- X
- Xunsigned char
- Xdouble2tempo(d)
- X double d;
- X{
- X double bit_vals[] = {2.0, 1.0, 0.5, 0.25, 0.125, 0.0625,
- X 0.03125, 0.015625};
- X int i;
- X unsigned char tempo_scalar;
- X
- X for (i = 0; i < 8; i++) {
- X if (d < bit_vals[i])
- X tempo_scalar = (tempo_scalar << 1) & ~1;
- X else {
- X tempo_scalar = (tempo_scalar << 1) | 1;
- X d -= bit_vals[i];
- X }
- X }
- X return(tempo_scalar);
- X}
- X
- Xint
- Xadjust_division(division, div_ioctl, tempo_scalar)
- X int division;
- X long *div_ioctl;
- X int *tempo_scalar;
- X{
- X long ioctls[] = {MRES192, MRES168, MRES144, MRES120, MRES96,
- X MRES72, MRES48};
- X int divs[] = {192, 168, 144, 120, 96, 72, 48};
- X int i;
- X int ret_val;
- X
- X ret_val = 0;
- X for (i = 0; i < sizeof(divs) / sizeof(divs[0]); i++) {
- X if (division % divs[i] == 0) {
- X *div_ioctl = ioctls[i];
- X *tempo_scalar = division / divs[i];
- X ret_val = 1;
- X break;
- X }
- X }
- X return (ret_val);
- X}
- X#endif
- END-of-tclm0.1/mlib/mpu401.c
- echo x - tclm0.1/mlib/mplayutil.h
- sed 's/^X//' >tclm0.1/mlib/mplayutil.h << 'END-of-tclm0.1/mlib/mplayutil.h'
- X/* mplayutil.h,v 1.3 1993/01/12 19:23:44 durian Exp */
- X/*
- X * Copyright (c) 1993 Michael B. Durian. All rights reserved.
- X *
- X * Redistribution and use in source and binary forms, with or without
- X * modification, are permitted provided that the following conditions
- X * are met:
- X * 1. Redistributions of source code must retain the above copyright
- X * notice, this list of conditions and the following disclaimer.
- X * 2. Redistributions in binary form must reproduce the above copyright
- X * notice, this list of conditions and the following disclaimer in the
- X * documentation and/or other materials provided with the distribution.
- X * 3. All advertising materials mentioning features or use of this software
- X * must display the following acknowledgement:
- X * This product includes software developed by Michael B. Durian.
- X * 4. The name of the the Author may be used to endorse or promote
- X * products derived from this software without specific prior written
- X * permission.
- X *
- X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
- X * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- X * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- X * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- X * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- X * SUCH DAMAGE.
- X */
- X#ifndef MPLAYUTIL_H
- X#define MPLAYUTIL_H
- X
- Xextern int play_tracks(TCHUNK *, int *, int, int, int);
- Xextern int record_tracks(TCHUNK *, int *, int, TCHUNK *, int, int, int);
- Xextern int process_play_event(int, TCHUNK *, int, int *, int *, int);
- Xextern int process_record_event(int, TCHUNK *);
- Xextern void flush_event(TCHUNK *);
- Xextern void stop_recording(void);
- Xextern SEND_VAL send_event(int, unsigned char *, int, EVENT_TYPE, int);
- Xextern int open_midi_devices(HCHUNK *, TRKS *, int *, int *, unsigned char *);
- Xextern void set_midi_verbose(int);
- X#endif
- END-of-tclm0.1/mlib/mplayutil.h
- echo x - tclm0.1/mlib/mpu401.h
- sed 's/^X//' >tclm0.1/mlib/mpu401.h << 'END-of-tclm0.1/mlib/mpu401.h'
- X/* mpu401.h,v 1.3 1993/01/12 19:23:49 durian Exp */
- X/*
- X * Copyright (c) 1993 Michael B. Durian. All rights reserved.
- X *
- X * Redistribution and use in source and binary forms, with or without
- X * modification, are permitted provided that the following conditions
- X * are met:
- X * 1. Redistributions of source code must retain the above copyright
- X * notice, this list of conditions and the following disclaimer.
- X * 2. Redistributions in binary form must reproduce the above copyright
- X * notice, this list of conditions and the following disclaimer in the
- X * documentation and/or other materials provided with the distribution.
- X * 3. All advertising materials mentioning features or use of this software
- X * must display the following acknowledgement:
- X * This product includes software developed by Michael B. Durian.
- X * 4. The name of the the Author may be used to endorse or promote
- X * products derived from this software without specific prior written
- X * permission.
- X *
- X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
- X * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- X * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- X * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- X * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- X * SUCH DAMAGE.
- X */
- X#ifndef MPU401_H
- X#define MPU401_H
- X
- X#include "mutil.h"
- X
- Xtypedef enum {START, TIMEDEVENT, NEWSTATUS, MIDIDATA, SYSMSG, SYSX} MESS_STATE;
- X
- Xtypedef enum {SEND_ERROR, SEND_VALID, SEND_INVALID, SEND_DONE} SEND_VAL;
- X
- X#ifndef NUM_TRKS
- X#define NUM_TRKS 8
- X#endif
- X
- X#define MAX_TRAX 18
- X
- Xextern int get_board_event(unsigned char *, int, unsigned char *, int *);
- Xextern void board2smf(unsigned char *, int, unsigned char *, int *);
- Xextern int smf2board(int, unsigned char *, int, unsigned char *, int, int *,
- X EVENT_TYPE *);
- Xextern unsigned char double2tempo(double);
- Xextern int adjust_division(int, long *, int *);
- X#endif
- END-of-tclm0.1/mlib/mpu401.h
- echo x - tclm0.1/mlib/mutil.h
- sed 's/^X//' >tclm0.1/mlib/mutil.h << 'END-of-tclm0.1/mlib/mutil.h'
- X/* mutil.h,v 1.3 1993/01/12 19:23:51 durian Exp */
- X/*
- X * Copyright (c) 1993 Michael B. Durian. All rights reserved.
- X *
- X * Redistribution and use in source and binary forms, with or without
- X * modification, are permitted provided that the following conditions
- X * are met:
- X * 1. Redistributions of source code must retain the above copyright
- X * notice, this list of conditions and the following disclaimer.
- X * 2. Redistributions in binary form must reproduce the above copyright
- X * notice, this list of conditions and the following disclaimer in the
- X * documentation and/or other materials provided with the distribution.
- X * 3. All advertising materials mentioning features or use of this software
- X * must display the following acknowledgement:
- X * This product includes software developed by Michael B. Durian.
- X * 4. The name of the the Author may be used to endorse or promote
- X * products derived from this software without specific prior written
- X * permission.
- X *
- X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
- X * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- X * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- X * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- X * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- X * SUCH DAMAGE.
- X */
- X#ifndef MUTIL_H
- X#define MUTIL_H
- X#if defined(i386) || defined(vax)
- X# define mtohl(l) ((((l) << 24) & 0xff000000L) | (((l) << 8) & \
- X 0x00ff0000L) | (((l) >> 8) & 0x0000ff00L) | (((l) >> 24) & \
- X 0x000000ffL))
- X# define htoml(l) ((((l) << 24) & 0xff000000L) | (((l) << 8) & \
- X 0x00ff0000L) | (((l) >> 8) & 0x0000ff00L) | (((l) >> 24) & \
- X 0x000000ffL))
- X# define mtohs(s) ((((s) << 8) & 0xff00) | (((s) >> 8) & 0x00ff))
- X# define htoms(s) ((((s) << 8) & 0xff00) | (((s) >> 8) & 0x00ff))
- X#else
- X# define mtohl(l) l
- X# define mtohs(s) s
- X# define htoml(l) l
- X# define htoms(s) s
- X#endif
- X
- Xtypedef enum {NORMAL = 0xff, SYSEX = 0xf0, METASEQNUM = 0x00, METATEXT = 0x01,
- X METACPY = 0x02, METASEQNAME = 0x03, METAINSTNAME = 0x04, METALYRIC = 0x05,
- X METAMARKER = 0x06, METACUE = 0x07, METACHANPREFIX = 0x20, METAEOT = 0x2f,
- X METATEMPO = 0x51, METASMPTE = 0x54, METATIME = 0x58, METAKEY = 0x59,
- X METASEQSPEC = 0x7f} EVENT_TYPE;
- X
- Xtypedef struct {
- X char str[4];
- X long length;
- X short format;
- X short num_trks;
- X short division;
- X} HCHUNK;
- X
- Xtypedef struct {
- X char str[4];
- X long pos;
- X long length;
- X long msize;
- X unsigned char *events;
- X unsigned char *event_start;
- X} TCHUNK;
- X
- Xtypedef struct {
- X int num_tracks;
- X int tracks[50];
- X} TRKS;
- X
- X/* hack to tell us when reading from stdin if there is anymore data */
- Xextern int MidiEof;
- Xextern char MidiError[];
- X
- X/* function prototypes */
- X#ifdef __STDC__
- X# define _ANSI_ARGS_(x) x
- X#else
- X# define _ANSI_ARGS_(x) ()
- X#endif
- X
- Xextern int get_smf_event _ANSI_ARGS_((TCHUNK *, unsigned char *, EVENT_TYPE *));
- Xextern int put_smf_event _ANSI_ARGS_((TCHUNK *, unsigned char *, int));
- Xextern int read_header_chunk _ANSI_ARGS_((int, HCHUNK *));
- Xextern int read_track_chunk _ANSI_ARGS_((int, TCHUNK *));
- Xextern int skip_track_chunk _ANSI_ARGS_((int));
- Xextern void rewind_track _ANSI_ARGS_((TCHUNK *));
- Xextern void reset_track _ANSI_ARGS_((TCHUNK *));
- Xextern int write_header_chunk _ANSI_ARGS_((int, HCHUNK *));
- Xextern int write_track_chunk _ANSI_ARGS_((int, TCHUNK *));
- Xextern int load_tracks _ANSI_ARGS_((int, HCHUNK *, TCHUNK **, TRKS *));
- Xextern int split_type_zero _ANSI_ARGS_((TCHUNK *));
- Xextern int fix2var _ANSI_ARGS_((long, unsigned char *));
- Xextern long var2fix _ANSI_ARGS_((unsigned char *, int *));
- Xextern void free_track _ANSI_ARGS_((TCHUNK *));
- Xextern int mread _ANSI_ARGS_((int, char *, int));
- Xextern int mwrite _ANSI_ARGS_((int, char *, int));
- Xextern int more_memory _ANSI_ARGS_((char **, int));
- X#endif
- END-of-tclm0.1/mlib/mutil.h
- exit
-
-