Table of Contents

Chapter 1--MIDI and Windows 95
What is MIDI, Anyway?
Simple Connections
Why Not Use the MCI Sequencer or Streams?
The Windows MIDI Connection
The MaxMidi ToolKit
Rolling Your Own

Chapter 2--The Musical Instrument Digital Interface
Get the Spec
The MIDI Protocol
Channel Voice Messages--Note On/Note Off, Aftertouch, Control Change,
Program Change, Pitch Bend
Channel Mode Messages
System Messages
System Real-Time Messages
System Exclusive Messages
MIDI Time Code and SMPTE
General MIDI
The General MIDI Mode
General MIDI Requirements
The GM Sound Set
The Percussion Map
MIDI Evolution

Chapter 3--Using MIDI in Windows
Organization of the ToolKit
Windows and DLLs
Windows 95 and the Win16 Mutex
Timers and Windows 95
Low-Level MMSYSTEM MIDI Functions
MIDI Input Functions
MIDI Output Functions
Putting MIDI to Use

Chapter 4--Sending MIDI
It's An Event
Devices and Drivers
Identifying Devices
Initializing the MaxMidi System
Opening the MIDI Output Device
Sending An Event
Closing MIDI Output
Other Useful MIDI Output Functions
Inside MIDI Output
Callbacks and Fixed Code Segments
MIDI Output Data Flow

Chapter 5--Receiving MIDI
Opening and Using MIDI Input
Opening in Greater Detail
Controlling MIDI Input
The Input Queue
Closing MIDI Input
Inside MIDI Input
MIDI Input Data Flow

Chapter 6--System Exclusive Messages
One Stream--Handling Short and Long Messages
Sending and Receiving Sysexes
Long Messages and Buffers
MIDI Headers and Buffers
MIDI Input Data Flow Changes
MIDI Output Data Flow Changes

Chapter 7--Keeping Time
Of Ticks and Tempo
Resolution and Accuracy
Generating Ticks
Processing Timestamps
Inside the Tick Generator
MIDI Time Code Synchronization
Starting SMPTE/MTC Synchronization
MIDI Timing Clock Synchronization
Chasing MIDI Clock Sync

Chapter 8--MaxMidi Synchronization
Using the Sync Functions
Playing Back in Time
Sync Data Flow
MIDI Input Data Flow Changes
MIDI Output Data Flow Changes

Chapter 9--I Want My C++
Microsoft Visual C++ and the Microsoft Foundation Classes
The CMaxMidiIn Class
The CMaxMidiOut Class
The CMaxMidiSync Class
Attaching the Sync device
Tempo and Resolution

Chapter 10--Using the ToolKit with Microsoft Visual C++
The Application Framework
Adding MIDI to MFC Applications
Compiler Configuration
Add the ToolKit Files
Use the ToolKit Classes
Receiving and Sending MIDI
Adding Device Menus

Chapter 11--Handling Sysex Messages in C++
Receiving Sysex Messages
Sending Sysex Messages
Loading and Saving Sysex Files

Chapter 12--A Simple Sequencer
Recording a Track
Playing Back the Track

Chapter 13--Standard MIDI Files
SMFs Use Chunks
Variable-Length Values
Format 0 and Format 1 Files
The SMF Header Chunk
Track Chunks
Meta Events
Reading an SMF in C
Writing an SMF in C
Other MaxMidi SMF Functions
The CMaxMidiSMF Class
Inside the MaxMidi DLL SMF Routines

Chapter 14--Enhancing the Sequencer
Playing Multiple Tracks
The Multi-Track Sequencer Revealed
Writing a Standard MIDI File
Reading a Standard MIDI File

Chapter 15--Go Forth and Write
Use the Source
Expanding the MIDI Horizon
Building An Even Better ToolKit


Appendix A--The MIDI ToolKit APIs
MaxMidi Function Reference
MIDI Output Functions
MIDI Input Functions
Synchronization Functions
Standard MIDI File Functions
System Functions
Error Codes
MaxMidi Structures
MaxMidi C++ Classes
MIDI Output Class -- CMaxMidiOut
MIDI Input Class -- CMaxMidiIn
MIDI Sync Class -- CMaxMidiSync
MIDI Input Menu Class -- CMidiInDeviceMenu
MIDI Output Menu Class -- CMidiOutDeviceMenu
Track Class -- CMaxMidiTrack
Standard MIDI File Class -- CMaxMidiSMF

Appendix B--MaxMidi DLL Source Code
MaxMidi Header Files--MaxMidi.h, MxDll.h
MxMidi16 DLL Source--MidiIn.c, MidiOut.c, Sync.c, MxMidi.def
MxMidi32 DLL Source--MxMidi32.c, SMF.c, MxMidi32.def, Thunk Script

Appendix C--MaxMidi C++ Classes Source Code
CMaxMidiIn, CMaxMidiOut, CMaxMidiSync, CMaxMidiTrack,
CMaxMidiSMF, CMidiInDeviceMenu, CMidiOutDeviceMenu

Appendix D--MidiSpy, SxLib, and MaxSeq Source Code
MidiSpy, SxLib, MaxSeq

MaxMidi ToolKit License Agreement