📄 directmusic.pas
字号:
(*==========================================================================;
*
* Copyright (C) 1995-1997 Microsoft Corporation. All Rights Reserved.
*
* Files: dls1.h dls2.h dmdls.h dmerror.h dmksctrl.h
dmusicc.h dmusici.h dmusicf.h dmusbuff.h
* Content: DirectMusic, DirectSetup
*
* DirectX 7.0 Delphi adaptation by Erik Unger
*
* Modyfied: 26-Feb-2000
*
* Download: http://www.delphi-jedi.org/DelphiGraphics/
* E-Mail: Erik.Unger@gmx.at
*
***************************************************************************)
{$MINENUMSIZE 4}
{$ALIGN ON}
unit DirectMusic;
interface
uses
Windows,
MMSystem,
ActiveX,
DirectSound;
function MAKE_HRESULT(sev,fac,code: DWORD) : HResult;
type
mmioFOURCC = array [0..3] of Char;
(*==========================================================================;
//
// dls1.h
//
//
// Description:
//
// Interface 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 : mmioFOURCC = ('D','L','S',' ');
FOURCC_DLID : mmioFOURCC = ('d','l','i','d');
FOURCC_COLH : mmioFOURCC = ('c','o','l','h');
FOURCC_WVPL : mmioFOURCC = ('w','v','p','l');
FOURCC_PTBL : mmioFOURCC = ('p','t','b','l');
FOURCC_PATH : mmioFOURCC = ('p','a','t','h');
FOURCC_wave : mmioFOURCC = ('w','a','v','e');
FOURCC_LINS : mmioFOURCC = ('l','i','n','s');
FOURCC_INS : mmioFOURCC = ('i','n','s',' ');
FOURCC_INSH : mmioFOURCC = ('i','n','s','h');
FOURCC_LRGN : mmioFOURCC = ('l','r','g','n');
FOURCC_RGN : mmioFOURCC = ('r','g','n',' ');
FOURCC_RGNH : mmioFOURCC = ('r','g','n','h');
FOURCC_LART : mmioFOURCC = ('l','a','r','t');
FOURCC_ART1 : mmioFOURCC = ('a','r','t','1');
FOURCC_WLNK : mmioFOURCC = ('w','l','n','k');
FOURCC_WSMP : mmioFOURCC = ('w','s','m','p');
FOURCC_VERS : mmioFOURCC = ('v','e','r','s');
(*/////////////////////////////////////////////////////////////////////////
// Articulation connection graph definitions
////////////////////////////////////////////////////////////////////////(*)
(* 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 = packed record
ulData1 : ULONG;
usData2 : Word;
usData3 : Word;
abData4 : array [0..7] of BYTE;
end;
PDLSVersion = ^TDLSVersion;
TDLSVersion = packed record
dwVersionMS,
dwVersionLS : DWORD;
end;
PConnection = ^TConnection;
TConnection = packed record
usSource : Word;
usControl : Word;
SuDestination : Word;
usTransform : Word;
lScale : LongInt;
end;
(* Level 1 Articulation Data *)
PConnectionList = ^TConnectionList;
TConnectionList = packed record
cbSize : ULONG; (* size of the connection list structure *)
cConnections : ULONG; (* count of connections in the list *)
end;
(*/////////////////////////////////////////////////////////////////////////
// Generic type defines for regions and instruments
////////////////////////////////////////////////////////////////////////(*)
PRGNRange = ^TRGNRange;
TRGNRange = packed record
usLow : Word;
usHigh : Word;
end;
const
F_INSTRUMENT_DRUMS = $80000000;
type
PMIDILocale = ^TMIDILocale;
TMIDILocale = packed record
ulBank : ULONG;
ulInstrument : ULONG;
end;
(*/////////////////////////////////////////////////////////////////////////
// Header structures found in an DLS file for collection, instruments, and
// regions.
////////////////////////////////////////////////////////////////////////(*)
const
F_RGN_OPTION_SELFNONEXCLUSIVE = $0001;
type
PRGNHeader = ^TRGNHeader;
TRGNHeader = packed 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 = packed record
cRegions : ULONG; (* Count of regions in this instrument *)
Locale : TMIDILocale; (* Intended MIDI locale of this instrument *)
end;
PDLSHeader = ^TDLSHeader;
TDLSHeader = packed record
cInstruments : ULONG;
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 = packed 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 : ULONG; (* channel placement *)
ulTableIndex : ULONG; (* index into the wave pool table, 0 based *)
end;
const
POOL_CUE_NULL = $ffffffff;
type
PPoolCUE = ^TPoolCUE;
TPoolCUE = packed record
ulOffset : ULONG;
end;
PPoolTable = ^TPoolTable;
TPoolTable = packed record
cbSize : ULONG; (* size of the pool table structure *)
cCues : ULONG; (* count of cues in the list *)
end;
(*////////////////////////////////////////////////////////////////////////////
// Structures for the "wsmp" chunk
///////////////////////////////////////////////////////////////////////////(*)
const
F_WSMP_NO_TRUNCATION = $0001;
F_WSMP_NO_COMPRESSION = $0002;
type
PWSMPL = ^TWSMPL;
TWSMPL = packed record
cbSize : ULONG;
usUnityNote : Word; (* MIDI Unity Playback Note *)
sFineTune : SmallInt; (* Fine Tune in log tuning *)
lAttenuation : Integer; (* Overall Attenuation to be applied to data *)
fulOptions : ULONG; (* Flag options *)
cSampleLoops : ULONG; (* Count of Sample loops, 0 loops is one shot *)
end;
(* This loop type is a normal forward playing loop which is continually *)
(* played until the envelope reaches an off threshold in the release *)
(* portion of the volume envelope *)
const
WLOOP_TYPE_FORWARD = 0;
type
TWLoop = packed record
cbSize : ULONG;
ulType : ULONG; (* Loop Type *)
ulStart : ULONG; (* Start of loop in samples *)
ulLength : ULONG; (* Length of loop in samples *)
end;
(*******************************************************************************
dls2.h
Description:
Interface defines and structures for the DLS2 extensions of DLS.
Written by Microsoft 1998. Released for public use.
*******************************************************************************)
(*
FOURCC's used in the DLS2 file, in addition to DLS1 chunks
*)
const
FOURCC_RGN2 : mmioFOURCC = ('r','g','n','2');
FOURCC_LAR2 : mmioFOURCC = ('l','a','r','2');
FOURCC_ART2 : mmioFOURCC = ('a','r','t','2');
FOURCC_CDL : mmioFOURCC = ('c','d','l',' ');
// FOURCC_DLID : mmioFOURCC = ('d','l','i','d');
(*
Articulation connection graph definitions. These are in addition to
the definitions in the DLS1 header.
*)
const
(* Generic Sources (in addition to DLS1 sources. *)
CONN_SRC_POLYPRESSURE = $0007; (* Polyphonic Pressure *)
CONN_SRC_CHANNELPRESSURE = $0008; (* Channel Pressure *)
CONN_SRC_VIBRATO = $0009; (* Vibrato LFO *)
CONN_SRC_MONOPRESSURE = $000a; (* MIDI Mono pressure *)
(* Midi Controllers *)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -