📄 mmdmusic.pas
字号:
{========================================================================}
{= (c) 1995-98 SwiftSoft Ronald Dittrich =}
{========================================================================}
{= All Rights Reserved =}
{========================================================================}
{= D 01099 Dresden = Fax.: +49(0)351-8037944 =}
{= Loewenstr.7a = info@swiftsoft.de =}
{========================================================================}
{= Actual versions on http://www.swiftsoft.de/index.html =}
{========================================================================}
{= This code is for reference purposes only and may not be copied or =}
{= distributed in any format electronic or otherwise except one copy =}
{= for backup purposes. =}
{= =}
{= No Delphi Component Kit or Component individually or in a collection=}
{= subclassed or otherwise from the code in this unit, or associated =}
{= .pas, .dfm, .dcu, .asm or .obj files may be sold or distributed =}
{= without express permission from SwiftSoft. =}
{= =}
{= For more licence informations please refer to the associated =}
{= HelpFile. =}
{========================================================================}
{= $Date: 27.01.98 - 18:28:27 $ =}
{========================================================================}
unit MMDMusic;
interface
{$Z4}
{$A+}
{$IFDEF DELPHI3}
{$WEAKPACKAGEUNIT}
{$ENDIF}
uses Windows,MMSystem,ActiveX;
(***************************************************************************
*
* dls1.h
*
*
* Description:
*
* class defines and structures for the Instrument Collection Form
* RIFF DLS.
*
*
* Written by Sonic Foundry 1996. Released for public use.
*
***************************************************************************)
(***************************************************************************
*
*
* Layout of an instrument collection:
*
*
* RIFF [] 'DLS ' [dlid,colh,INSTLIST,WAVEPOOL,INFOLIST]
*
* INSTLIST
* LIST [] 'lins'
* LIST [] 'ins ' [dlid,insh,RGNLIST,ARTLIST,INFOLIST]
* LIST [] 'ins ' [dlid,insh,RGNLIST,ARTLIST,INFOLIST]
* LIST [] 'ins ' [dlid,insh,RGNLIST,ARTLIST,INFOLIST]
*
* RGNLIST
* LIST [] 'lrgn'
* LIST [] 'rgn ' [rgnh,wsmp,wlnk,ARTLIST]
* LIST [] 'rgn ' [rgnh,wsmp,wlnk,ARTLIST]
* LIST [] 'rgn ' [rgnh,wsmp,wlnk,ARTLIST]
*
* ARTLIST
* LIST [] 'lart'
* 'art1' level 1 Articulation connection graph
* 'art2' level 2 Articulation connection graph
* '3rd1' Possible 3rd party articulation structure 1
* '3rd2' Possible 3rd party articulation structure 2 .... and so on
*
* WAVEPOOL
* ptbl [] [pool table]
* LIST [] 'wvpl'
* [path],
* [path],
* LIST [] 'wave' [dlid,RIFFWAVE]
* LIST [] 'wave' [dlid,RIFFWAVE]
* LIST [] 'wave' [dlid,RIFFWAVE]
* LIST [] 'wave' [dlid,RIFFWAVE]
* LIST [] 'wave' [dlid,RIFFWAVE]
*
* INFOLIST
* LIST [] 'INFO'
* 'icmt' 'One of those crazy comments.'
* 'icop' 'Copyright (C) 1996 Sonic Foundry'
*
**************************************************************************)
(**************************************************************************
* FOURCC's used in the DLS file
*************************************************************************)
const
FOURCC_DLS = $20534C44; //mmioFOURCC('D','L','S',' ')
FOURCC_DLID = $64696C64; //mmioFOURCC('d','l','i','d')
FOURCC_COLH = $686C6F63; //mmioFOURCC('c','o','l','h')
FOURCC_WVPL = $6C707677; //mmioFOURCC('w','v','p','l')
FOURCC_PTBL = $6C627470; //mmioFOURCC('p','t','b','l')
FOURCC_PATH = $68746170; //mmioFOURCC('p','a','t','h')
FOURCC_wave = $65766177; //mmioFOURCC('w','a','v','e')
FOURCC_LINS = $736E696C; //mmioFOURCC('l','i','n','s')
FOURCC_INS = $20736E69; //mmioFOURCC('i','n','s',' ')
FOURCC_INSH = $68736E69; //mmioFOURCC('i','n','s','h')
FOURCC_LRGN = $6E67726C; //mmioFOURCC('l','r','g','n')
FOURCC_RGN = $206E6772; //mmioFOURCC('r','g','n',' ')
FOURCC_RGNH = $686E6772; //mmioFOURCC('r','g','n','h')
FOURCC_LART = $7472616C; //mmioFOURCC('l','a','r','t')
FOURCC_ART1 = $31747261; //mmioFOURCC('a','r','t','1')
FOURCC_WLNK = $6B6E6C77; //mmioFOURCC('w','l','n','k')
FOURCC_WSMP = $706D7377; //mmioFOURCC('w','s','m','p')
FOURCC_VERS = $73726576; //mmioFOURCC('v','e','r','s')
(**************************************************************************
* Articulation connection graph definitions
**************************************************************************)
const
{ Generic Sources }
CONN_SRC_NONE = $0000;
CONN_SRC_LFO = $0001;
CONN_SRC_KEYONVELOCITY = $0002;
CONN_SRC_KEYNUMBER = $0003;
CONN_SRC_EG1 = $0004;
CONN_SRC_EG2 = $0005;
CONN_SRC_PITCHWHEEL = $0006;
{ Midi Controllers 0-127 }
CONN_SRC_CC1 = $0081;
CONN_SRC_CC7 = $0087;
CONN_SRC_CC10 = $008a;
CONN_SRC_CC11 = $008b;
{ Generic Destinations }
CONN_DST_NONE = $0000;
CONN_DST_ATTENUATION = $0001;
CONN_DST_PITCH = $0003;
CONN_DST_PAN = $0004;
{ LFO Destinations }
CONN_DST_LFO_FREQUENCY = $0104;
CONN_DST_LFO_STARTDELAY = $0105;
{ EG1 Destinations }
CONN_DST_EG1_ATTACKTIME = $0206;
CONN_DST_EG1_DECAYTIME = $0207;
CONN_DST_EG1_RELEASETIME = $0209;
CONN_DST_EG1_SUSTAINLEVEL = $020a;
{ EG2 Destinations }
CONN_DST_EG2_ATTACKTIME = $030a;
CONN_DST_EG2_DECAYTIME = $030b;
CONN_DST_EG2_RELEASETIME = $030d;
CONN_DST_EG2_SUSTAINLEVEL = $030e;
CONN_TRN_NONE = $0000;
CONN_TRN_CONCAVE = $0001;
type
PDLSID = ^TDLSID;
TDLSID = record
ulData1: DWORD;
usData2: Word;
usData3: Word;
abData4: array[0..7] of Byte;
end;
PDLSVERSION = ^TDLSVERSION;
TDLSVERSION = record
dwVersionMS: DWORD;
dwVersionLS: DWORD;
end;
PCONNECTION = ^TCONNECTION;
TCONNECTION = record
usSource : Word;
usControl : Word;
usDestination: Word;
usTransform : Word;
lScale : DWORD;
end;
{ Level 1 Articulation Data }
PCONNECTIONLIST = ^TCONNECTIONLIST;
TCONNECTIONLIST = record
cbSize : DWORD; // size of the connection list structure
cConnections: DWORD; // count of connections in the list
end;
(**************************************************************************
* Generic type defines for regions and instruments
*************************************************************************)
type
PRGNRANGE = ^TRGNRANGE;
TRGNRANGE = record
usLow : Word;
usHigh: Word;
end;
const
F_INSTRUMENT_DRUMS = $80000000;
type
PMIDILOCALE = ^TMIDILOCALE;
TMIDILOCALE = record
ulBank : DWORD;
ulInstrument: DWORD;
end;
(**************************************************************************
* Header structures found in an DLS file for collection, instruments, and
* regions.
*************************************************************************)
const
F_RGN_OPTION_SELFNONEXCLUSIVE = $0001;
type
PRGNHEADER = ^TRGNHEADER;
TRGNHEADER = record
RangeKey : TRGNRANGE; // Key range
RangeVelocity: TRGNRANGE; // Velocity Range
fusOptions : Word; // Synthesis options for this range
usKeyGroup : Word; // Key grouping for non simultaneous play
// 0 = no group, 1 up is group
// for Level 1 only groups 1-15 are allowed
end;
PINSTHEADER = ^TINSTHEADER;
TINSTHEADER = record
cRegions: DWORD; // Count of regions in this instrument
Locale : TMIDILOCALE; // Intended MIDI locale of this instrument
end;
PDLSHEADER = ^TDLSHEADER;
TDLSHEADER = record
cInstruments: DWORD; // Count of instruments in the collection
end;
(*****************************************************************************
* definitions for the Wave link structure
*****************************************************************************)
(***** For level 1 only WAVELINK_CHANNEL_MONO is valid ******************
* ulChannel allows for up to 32 channels of audio with each bit position
* specifiying a channel of playback
**************************************************************************)
const
WAVELINK_CHANNEL_LEFT = $0001;
WAVELINK_CHANNEL_RIGHT = $0002;
F_WAVELINK_PHASE_MASTER = $0001;
type
PWAVELINK = ^TWAVELINK;
TWAVELINK = record // any paths or links are stored right after struct
fusOptions : WORD; // options flags for this wave
usPhaseGroup: WORD; // Phase grouping for locking channels
ulChannel : DWORD; // channel placement
ulTableIndex: DWORD; // index into the wave pool table, 0 based
end;
const
POOL_CUE_NULL = $ffffffff;
type
PPOOLCUE = ^TPOOLCUE;
TPOOLCUE = record
// ulEntryIndex: DWORD; // Index entry in the list
ulOffset: DWORD; // Offset to the entry in the list
end;
PPOOLTABLE = ^TPOOLTABLE;
TPOOLTABLE = record
cbSize: DWORD; // size of the pool table structure
cCues : DWORD; // count of cues in the list
end;
(*****************************************************************************
* Structures for the "wsmp" chunk
*****************************************************************************)
const
F_WSMP_NO_TRUNCATION = $0001;
F_WSMP_NO_COMPRESSION = $0002;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -