library KMedia;{ Important note about DLL memory management: ShareMem must be the first unit in your library's USES clause AND your project's (select Project-View Source) USES clause if your DLL exports any procedures or functions that pass strings as parameters or function results. This applies to all strings passed to and from your DLL--even those that are nested in records and classes. ShareMem is the interface unit to the BORLNDMM.DLL shared memory manager, which must be deployed along with your DLL. To avoid using BORLNDMM.DLL, pass string information using PChar or ShortString parameters. }uses SysUtils,K,Classes,MmSystem,Windows,ActiveX;{$R *.res} Var DSound : TDirectSound; AudioStatic : Array[0..99] of TAudioStatic; AudioStream : Array[0..99] of TAudioStream; SoundStream : Array[0..99] of TSoundStream; Video : TVideo; AudioCD : TAudioCD; I : Integer;function KM_Initialize(DeviceId : Integer; Hwnd : Integer; SpeakerConfig: Dword) : Boolean; stdcall; begin Result := DSound.Initialize(DeviceID,Hwnd,SpeakerConfig); end;function KM_Free : Boolean; stdcall; begin Result := DSound.Free; end;function KM_SetupOutput(SamplesPerSec : Integer; BitsPerSample : Integer; Stereo : Boolean) : Boolean; stdcall; begin Result := DSound.SetupOutput(SamplesPerSec,BitsPerSample,Stereo); end;function KM_GetDeviceList : TStrings; stdcall; begin Result := DSound.GetDeviceList; end; function KM_AStatic_CreateFromFile(ID : Integer; FileName : Pchar; UseDSP_3D : Boolean; DSP_Volume : Integer) : Boolean; stdcall; begin Result := False; if (ID >=0) and (ID <99) then begin Result := AudioStatic[ID].CreateFromFile(Dsound.GetDSound,FileName,UseDSP_3D,DSP_Volume); end; end;function KM_AStatic_Free(ID : Integer) : Boolean; stdcall; begin Result := False; if (ID >=0) and (ID <99) then begin Result := AudioStatic[ID].Free; end; end;function KM_AStatic_Play(ID : Integer; Loop : Boolean) : Boolean; stdcall; begin Result := False; if (ID >=0) and (ID <99) then begin Result := AudioStatic[ID].Play(Loop); end; end;function KM_AStatic_Stop(ID : Integer) : Boolean; stdcall; begin Result := False; if (ID >=0) and (ID <99) then begin Result := AudioStatic[ID].Stop; end; end;function KM_AStatic_IsPlaying(ID : Integer) : Boolean; stdcall; begin Result := False; if (ID >=0) and (ID <99) then begin Result := AudioStatic[ID].IsPlaying; end; end;function KM_AStatic_IsStop(ID : Integer) : Boolean; stdcall; begin Result := False; if (ID >=0) and (ID <99) then begin Result := AudioStatic[ID].IsStop; end; end;function KM_AStatic_IsLooping(ID : Integer) : Boolean; stdcall; begin Result := False; if (ID >=0) and (ID <99) then begin Result := AudioStatic[ID].IsLooping; end; end;function KM_AStatic_SetVolume(ID : Integer; Volume: Integer): Boolean; stdcall; begin Result := False; if (ID >=0) and (ID <99) then begin Result := AudioStatic[ID].SetVolume(Volume); end; end;function KM_AStatic_GetVolume(ID : Integer) : Integer; stdcall; begin Result := -1; if (ID >=0) and (ID <99) then begin Result := AudioStatic[ID].GetVolume; end; end;function KM_AStatic_DefaultFrequency(ID : Integer) : Integer; stdcall; begin Result := -1; if (ID >=0) and (ID <99) then begin Result := AudioStatic[ID].DefaultFrequency; end; end;function KM_AStatic_SetFrequency(ID : Integer; Frequency : Integer) : Boolean; stdcall; begin Result := False; if (ID >=0) and (ID <99) then begin Result := AudioStatic[ID].SetFrequency(Frequency); end; end;function KM_AStatic_GetFrequency(ID : Integer) : Integer; stdcall; begin Result := -1; if (ID >=0) and (ID <99) then begin Result := AudioStatic[ID].GetFrequency; end; end;function KM_AStatic_Set3DPosition(ID : Integer; X,Y,Z : Integer) : Boolean; stdcall; begin Result := False; if (ID >=0) and (ID <99) then begin Result := AudioStatic[ID].Set3DPosition(X,Y,Z); end; end;function KM_AStatic_Get3DPosition(ID : Integer) : TD3DVector; stdcall; Var _Value : TD3DVector; begin _Value.X := 0; _Value.Y := 0; _Value.Z := 0; Result := _Value; if (ID >=0) and (ID <99) then begin Result := AudioStatic[ID].Get3DPosition; end; end;{ KM_AStream_ }function KM_AStream_CreateFromFile(ID : Integer; FileName : Pchar; BufferLength : Integer) : Boolean; stdcall; begin Result := False; if (ID >=0) and (ID <99) then begin Result := AudioStream[ID].CreateFromFile(Dsound.GetDSound,FileName,BufferLength); end; end;function KM_AStream_Free(ID : Integer) : Boolean; stdcall; begin Result := False; if (ID >=0) and (ID <99) then begin Result := AudioStream[ID].Free; end; end;function KM_AStream_Play(ID : Integer) : Boolean; stdcall; begin Result := False; if (ID >=0) and (ID <99) then begin Result := AudioStream[ID].Play; end; end;function KM_AStream_Stop(ID : Integer) : Boolean; stdcall; begin Result := False; if (ID >=0) and (ID <99) then begin Result := AudioStream[ID].Stop; end; end;function KM_AStream_EnableLoop(ID : Integer; Loop: Boolean) : Boolean; stdcall; begin Result := False; if (ID >=0) and (ID <99) then begin Result := AudioStream[ID].EnableLoop(Loop); end; end;function KM_AStream_EnableDSP_3D(ID : Integer; DSP_3D : Boolean; Volume : Integer) : Boolean; stdcall; begin Result := False; if (ID >=0) and (ID <99) then begin Result := AudioStream[ID].EnableDSP_3D(DSP_3D,Volume); end; end;function KM_AStream_DefaultFrequency(ID : Integer) : Integer; stdcall; begin Result := -1; if (ID >=0) and (ID <99) then begin Result := AudioStream[ID].DefaultFrequency; end; end;
function KM_AStream_SetFrequency(ID : Integer; Frequency : Integer) : Boolean; stdcall; begin Result := False; if (ID >=0) and (ID <99) then begin Result := AudioStream[ID].SetFrequency(Frequency); end; end;function KM_AStream_GetFrequency(ID : Integer) : Integer; stdcall; begin Result := -1; if (ID >=0) and (ID <99) then begin Result := AudioStream[ID].GetFrequency; end; end;function KM_AStream_SetVolume(ID : Integer; Volume : Integer) : Boolean; stdcall; begin Result := False; if (ID >=0) and (ID <99) then begin Result := AudioStream[ID].SetVolume(Volume); end; end;function KM_AStream_GetVolume(ID : Integer) : Integer; stdcall; begin Result := -1; if (ID >=0) and (ID <99) then begin Result := AudioStream[ID].GetVolume; end; end;function KM_AStream_Set3DPosition(ID : Integer; X,Y,Z : Integer) : Boolean; stdcall; begin Result := False; if (ID >=0) and (ID <99) then begin Result := AudioStream[ID].Set3DPosition(X,Y,Z); end; end;function KM_AStream_Get3DPosition(ID : Integer) : TD3DVector; stdcall; Var _Value : TD3DVector; begin _Value.X := 0; _Value.Y := 0; _Value.Z := 0; Result := _Value; if (ID >=0) and (ID <99) then begin Result := AudioStream[ID].Get3DPosition; end; end;function KM_AStream_IsPlaying(ID : Integer) : Boolean; stdcall; begin Result := AudioStream[ID].IsPlaying ; end;function KM_AStream_IsStop(ID : Integer) : Boolean; stdcall; begin Result := AudioStream[ID].IsStop ; end; {Video}function KM_Video_CreateFromFile(Hwnd : Integer; FileName : Pchar) : Boolean; stdcall; begin Result := Video.CreateFromFile(Hwnd,FileName); end;function KM_Video_Free : Boolean; stdcall; begin Result := Video.Free; end;function KM_Video_IsVideoFile(FileName : Pchar) : Boolean; stdcall; begin Result := Video.IsVideoFile(FileName); end;function KM_Video_Play : Boolean; stdcall; begin Result := Video.Play; end;function KM_Video_Pause : Boolean; stdcall; begin Result := Video.Pause; end;function KM_Video_Stop : Boolean; stdcall; begin Result := Video.Stop; end;function KM_Video_IsPlaying : Boolean; stdcall; begin Result := Video.IsPlaying; end;function KM_Video_IsPause : Boolean; stdcall; begin Result := Video.IsPause; end;function KM_Video_IsStop : Boolean; stdcall; begin Result := Video.IsStop; end;function KM_Video_SetVolume(Volume : Integer) : Boolean; stdcall; begin Result := Video.SetVolume(Volume); end;function KM_Video_GetVolume : Integer; stdcall; begin Result := Video.GetVolume; end;function KM_Video_SetBalance(Balance : Integer) : Boolean; stdcall; begin Result := Video.SetBalance(Balance); end;function KM_Video_GetBalance : Integer; stdcall; begin Result := Video.GetBalance; end;function KM_Video_SetPositions(Positions : Int64) : Boolean; stdcall; begin Result := Video.SetPositions(Positions); end;function KM_Video_GetPositions : Int64; stdcall; begin Result := Video.GetPositions; end;
function KM_Video_SetRate(Rate : Double) : Boolean; stdcall; begin Result := Video.SetRate(Rate); end;function KM_Video_GetRate : Double; stdcall; begin Result := Video.GetRate; end;function KM_Video_GetDuration: Int64; stdcall; begin Result := Video.GetDuration; end;function KM_Video_SetWindowPosition(Left : Integer; Top : Integer; Width : Integer; Height : Integer) : Boolean; stdcall; begin Result := Video.SetWindowPosition(Left,Top,Width,Height); end;function KM_Video_EnableFullScreen(FullScreen : Boolean) : Boolean; stdcall; begin Result := Video.EnableFullScreen(FullScreen); end;function KM_Video_IsFullScreen : Boolean; stdcall; begin Result := Video.IsFullScreen; end;function KM_Video_HideCursor(Hide : Boolean) : Boolean; stdcall; begin Result := Video.HideCursor(Hide); end;function KM_Video_IsPlayComplete : Boolean; stdcall; begin Result := Video.IsPlayComplete; end; {AudioCD}function KM_AudioCD_Initialize : Boolean; stdcall; begin Result := AudioCD.Initialize; end;function KM_AudioCD_Free : Boolean; stdcall; begin Result := AudioCD.Free; end;function KM_AudioCD_Play(TrackID : Integer) : Boolean; stdcall; begin Result := AudioCD.Play(TrackID); end;function KM_AudioCD_Stop : Boolean; stdcall; begin Result := AudioCD.Stop; end;function KM_AudioCD_Pause : Boolean; stdcall; begin Result := AudioCD.Pause; end;function KM_AudioCD_Resume : Boolean; stdcall; begin Result := AudioCD.Resume; end;function KM_AudioCD_GetAudioDiskInfo : Integer; stdcall; begin Result := AudioCD.GetAudioDiskInfo; end;function KM_AudioCD_CloseDoor : Boolean; stdcall; begin Result := AudioCD.CloseDoor; end;function KM_AudioCD_EjectDoor : Boolean; stdcall; begin Result := AudioCD.EjectDoor; end; {SoundStream}function KM_SSound_CreateFromFile(ID : Integer; FileName : Pchar) : Boolean; stdcall; begin Result := False; if (ID >=0) and (ID <99) then begin Result := SoundStream[ID].CreateFromFile(FileName); end; end;function KM_SSound_Free(ID : Integer) : Boolean; stdcall; begin Result := False; if (ID >=0) and (ID <99) then begin Result := SoundStream[ID].Free; end; end;function KM_SSound_Play(ID : Integer) : Boolean; stdcall; begin Result := False; if (ID >=0) and (ID <99) then begin Result := SoundStream[ID].Play; end; end;function KM_SSound_Stop(ID : Integer) : Boolean; stdcall; begin Result := False; if (ID >=0) and (ID <99) then begin Result := SoundStream[ID].Stop; end; end;function KM_SSound_Pause(ID : Integer) : Boolean; stdcall; begin Result := False; if (ID >=0) and (ID <99) then begin Result := SoundStream[ID].Pause; end; end;function KM_SSound_SetBalance(ID : Integer; Balance : Integer) : Boolean; stdcall; begin Result := False; if (ID >=0) and (ID <99) then begin Result := SoundStream[ID].SetBalance(Balance); end; end;function KM_SSound_SetPositions(ID : Integer; Positions : Int64) : Boolean; stdcall; begin Result := False; if (ID >=0) and (ID <99) then begin Result := SoundStream[ID].SetPositions(Positions); end; end;function KM_SSound_SetRate(ID : Integer; Rate : Double) : Boolean; stdcall; begin Result := False; if (ID >=0) and (ID <99) then begin Result := SoundStream[ID].SetRate(Rate); end; end;function KM_SSound_SetVolume(ID : Integer; Volume : Integer) : Boolean; stdcall; begin Result := False; if (ID >=0) and (ID <99) then begin Result := SoundStream[ID].SetVolume(Volume); end; end;function KM_SSound_GetBalance(ID : Integer) : Integer; stdcall; begin Result := 0; if (ID >=0) and (ID <99) then begin Result := SoundStream[ID].GetBalance; end; end;function KM_SSound_GetDuration(ID : Integer) : Int64; stdcall; begin Result := -1; if (ID >=0) and (ID <99) then begin Result := SoundStream[ID].GetDuration ; end; end;function KM_SSound_GetPositions(ID : Integer) : Int64; stdcall; begin Result := -1; if (ID >=0) and (ID <99) then begin Result := SoundStream[ID].GetPositions; end; end;function KM_SSound_GetRate(ID : Integer) : Double; stdcall; begin Result := -1; if (ID >=0) and (ID <99) then begin Result := SoundStream[ID].GetRate; end; end;function KM_SSound_GetVolume(ID : Integer) : Integer; stdcall; begin Result := -1; if (ID >=0) and (ID <99) then begin Result := SoundStream[ID].GetVolume; end; end;function KM_SSound_IsPlaying(ID : Integer) : Boolean; stdcall; begin Result := False; if (ID >=0) and (ID <99) then begin Result := SoundStream[ID].IsPlaying; end; end;function KM_SSound_IsPause(ID : Integer) : Boolean; stdcall; begin Result := False; if (ID >=0) and (ID <99) then begin Result := SoundStream[ID].IsPause; end; end;function KM_SSound_IsStop(ID : Integer) : Boolean; stdcall; begin Result := False; if (ID >=0) and (ID <99) then begin Result := SoundStream[ID].IsStop; end; end;function KM_SSound_IsPlayComplete(ID : Integer) : Boolean; stdcall; begin Result := False; if (ID >=0) and (ID <99) then begin Result := SoundStream[ID].IsPlayComplete; end; end;function KM_SSound_IsValidFile(ID : Integer; FileName : Pchar) : Boolean; stdcall; begin Result := False; if (ID >=0) and (ID <99) then begin Result := SoundStream[ID].IsValidFile(FileName); end; end;exports KM_Initialize, KM_Free, KM_SetupOutput, KM_GetDeviceList, KM_AStatic_CreateFromFile, KM_AStatic_Free, KM_AStatic_Play, KM_AStatic_Stop, KM_AStatic_IsPlaying, KM_AStatic_IsStop, KM_AStatic_IsLooping, KM_AStatic_SetVolume, KM_AStatic_GetVolume, KM_AStatic_DefaultFrequency, KM_AStatic_SetFrequency, KM_AStatic_GetFrequency, KM_AStatic_Set3DPosition, KM_AStatic_Get3DPosition, KM_AStream_CreateFromFile, KM_AStream_Free, KM_AStream_Play, KM_AStream_Stop, KM_AStream_EnableLoop, KM_AStream_EnableDSP_3D, KM_AStream_DefaultFrequency, KM_AStream_SetFrequency, KM_AStream_GetFrequency, KM_AStream_SetVolume, KM_AStream_GetVolume, KM_AStream_Set3DPosition, KM_AStream_Get3DPosition, KM_AStream_IsPlaying, KM_AStream_IsStop, KM_Video_CreateFromFile, KM_Video_Free, KM_Video_IsVideoFile, KM_Video_Play, KM_Video_Pause, KM_Video_Stop, KM_Video_IsPlaying, KM_Video_IsPause, KM_Video_IsStop, KM_Video_SetVolume, KM_Video_GetVolume, KM_Video_SetBalance, KM_Video_GetBalance, KM_Video_SetPositions, KM_Video_GetPositions, KM_Video_SetRate, KM_Video_GetRate, KM_Video_GetDuration, KM_Video_SetWindowPosition, KM_Video_EnableFullScreen, KM_Video_IsFullScreen, KM_Video_HideCursor, KM_Video_IsPlayComplete, KM_AudioCD_Initialize, KM_AudioCD_Free, KM_AudioCD_Play, KM_AudioCD_Stop, KM_AudioCD_Pause, KM_AudioCD_Resume, KM_AudioCD_GetAudioDiskInfo, KM_AudioCD_CloseDoor, KM_AudioCD_EjectDoor, KM_SSound_CreateFromFile, KM_SSound_Free, KM_SSound_Play, KM_SSound_Stop, KM_SSound_Pause, KM_SSound_SetBalance, KM_SSound_SetPositions, KM_SSound_SetRate, KM_SSound_SetVolume, KM_SSound_GetBalance, KM_SSound_GetDuration, KM_SSound_GetPositions, KM_SSound_GetRate, KM_SSound_GetVolume, KM_SSound_IsPlaying, KM_SSound_IsPause, KM_SSound_IsStop, KM_SSound_IsPlayComplete, KM_SSound_IsValidFile;begin CoInitialize(nil); DSound := TDirectSound.Create; AudioCD := TAudioCD.Create; Video := TVideo.Create; for i := 0 to 99 do begin AudioStatic[i] := TAudioStatic.Create; AudioStream[i] := TAudioStream.Create; SoundStream[i] := TSoundStream.Create; end; end.
Function X( A : Integer ) : Boolean; Stdcall;
first unit in your library's USES clause AND your project's (select
Project-View Source) USES clause if your DLL exports any procedures or
functions that pass strings as parameters or function results. This
applies to all strings passed to and from your DLL--even those that
are nested in records and classes. ShareMem is the interface unit to
the BORLNDMM.DLL shared memory manager, which must be deployed along
with your DLL. To avoid using BORLNDMM.DLL, pass string information
using PChar or ShortString parameters. }uses
SysUtils,K,Classes,MmSystem,Windows,ActiveX;{$R *.res}
Var
DSound : TDirectSound;
AudioStatic : Array[0..99] of TAudioStatic;
AudioStream : Array[0..99] of TAudioStream;
SoundStream : Array[0..99] of TSoundStream;
Video : TVideo;
AudioCD : TAudioCD;
I : Integer;function KM_Initialize(DeviceId : Integer; Hwnd : Integer; SpeakerConfig: Dword) : Boolean; stdcall;
begin
Result := DSound.Initialize(DeviceID,Hwnd,SpeakerConfig);
end;function KM_Free : Boolean; stdcall;
begin
Result := DSound.Free;
end;function KM_SetupOutput(SamplesPerSec : Integer; BitsPerSample : Integer; Stereo : Boolean) : Boolean; stdcall;
begin
Result := DSound.SetupOutput(SamplesPerSec,BitsPerSample,Stereo);
end;function KM_GetDeviceList : TStrings; stdcall;
begin
Result := DSound.GetDeviceList;
end;
function KM_AStatic_CreateFromFile(ID : Integer; FileName : Pchar; UseDSP_3D : Boolean; DSP_Volume : Integer) : Boolean; stdcall;
begin
Result := False;
if (ID >=0) and (ID <99) then
begin
Result := AudioStatic[ID].CreateFromFile(Dsound.GetDSound,FileName,UseDSP_3D,DSP_Volume);
end;
end;function KM_AStatic_Free(ID : Integer) : Boolean; stdcall;
begin
Result := False;
if (ID >=0) and (ID <99) then
begin
Result := AudioStatic[ID].Free;
end;
end;function KM_AStatic_Play(ID : Integer; Loop : Boolean) : Boolean; stdcall;
begin
Result := False;
if (ID >=0) and (ID <99) then
begin
Result := AudioStatic[ID].Play(Loop);
end;
end;function KM_AStatic_Stop(ID : Integer) : Boolean; stdcall;
begin
Result := False;
if (ID >=0) and (ID <99) then
begin
Result := AudioStatic[ID].Stop;
end;
end;function KM_AStatic_IsPlaying(ID : Integer) : Boolean; stdcall;
begin
Result := False;
if (ID >=0) and (ID <99) then
begin
Result := AudioStatic[ID].IsPlaying;
end;
end;function KM_AStatic_IsStop(ID : Integer) : Boolean; stdcall;
begin
Result := False;
if (ID >=0) and (ID <99) then
begin
Result := AudioStatic[ID].IsStop;
end;
end;function KM_AStatic_IsLooping(ID : Integer) : Boolean; stdcall;
begin
Result := False;
if (ID >=0) and (ID <99) then
begin
Result := AudioStatic[ID].IsLooping;
end;
end;function KM_AStatic_SetVolume(ID : Integer; Volume: Integer): Boolean; stdcall;
begin
Result := False;
if (ID >=0) and (ID <99) then
begin
Result := AudioStatic[ID].SetVolume(Volume);
end;
end;function KM_AStatic_GetVolume(ID : Integer) : Integer; stdcall;
begin
Result := -1;
if (ID >=0) and (ID <99) then
begin
Result := AudioStatic[ID].GetVolume;
end;
end;function KM_AStatic_DefaultFrequency(ID : Integer) : Integer; stdcall;
begin
Result := -1;
if (ID >=0) and (ID <99) then
begin
Result := AudioStatic[ID].DefaultFrequency;
end;
end;function KM_AStatic_SetFrequency(ID : Integer; Frequency : Integer) : Boolean; stdcall;
begin
Result := False;
if (ID >=0) and (ID <99) then
begin
Result := AudioStatic[ID].SetFrequency(Frequency);
end;
end;function KM_AStatic_GetFrequency(ID : Integer) : Integer; stdcall;
begin
Result := -1;
if (ID >=0) and (ID <99) then
begin
Result := AudioStatic[ID].GetFrequency;
end;
end;function KM_AStatic_Set3DPosition(ID : Integer; X,Y,Z : Integer) : Boolean; stdcall;
begin
Result := False;
if (ID >=0) and (ID <99) then
begin
Result := AudioStatic[ID].Set3DPosition(X,Y,Z);
end;
end;function KM_AStatic_Get3DPosition(ID : Integer) : TD3DVector; stdcall;
Var
_Value : TD3DVector;
begin
_Value.X := 0;
_Value.Y := 0;
_Value.Z := 0;
Result := _Value;
if (ID >=0) and (ID <99) then
begin
Result := AudioStatic[ID].Get3DPosition;
end;
end;{ KM_AStream_ }function KM_AStream_CreateFromFile(ID : Integer; FileName : Pchar; BufferLength : Integer) : Boolean; stdcall;
begin
Result := False;
if (ID >=0) and (ID <99) then
begin
Result := AudioStream[ID].CreateFromFile(Dsound.GetDSound,FileName,BufferLength);
end;
end;function KM_AStream_Free(ID : Integer) : Boolean; stdcall;
begin
Result := False;
if (ID >=0) and (ID <99) then
begin
Result := AudioStream[ID].Free;
end;
end;function KM_AStream_Play(ID : Integer) : Boolean; stdcall;
begin
Result := False;
if (ID >=0) and (ID <99) then
begin
Result := AudioStream[ID].Play;
end;
end;function KM_AStream_Stop(ID : Integer) : Boolean; stdcall;
begin
Result := False;
if (ID >=0) and (ID <99) then
begin
Result := AudioStream[ID].Stop;
end;
end;function KM_AStream_EnableLoop(ID : Integer; Loop: Boolean) : Boolean; stdcall;
begin
Result := False;
if (ID >=0) and (ID <99) then
begin
Result := AudioStream[ID].EnableLoop(Loop);
end;
end;function KM_AStream_EnableDSP_3D(ID : Integer; DSP_3D : Boolean; Volume : Integer) : Boolean; stdcall;
begin
Result := False;
if (ID >=0) and (ID <99) then
begin
Result := AudioStream[ID].EnableDSP_3D(DSP_3D,Volume);
end;
end;function KM_AStream_DefaultFrequency(ID : Integer) : Integer; stdcall;
begin
Result := -1;
if (ID >=0) and (ID <99) then
begin
Result := AudioStream[ID].DefaultFrequency;
end;
end;
begin
Result := False;
if (ID >=0) and (ID <99) then
begin
Result := AudioStream[ID].SetFrequency(Frequency);
end;
end;function KM_AStream_GetFrequency(ID : Integer) : Integer; stdcall;
begin
Result := -1;
if (ID >=0) and (ID <99) then
begin
Result := AudioStream[ID].GetFrequency;
end;
end;function KM_AStream_SetVolume(ID : Integer; Volume : Integer) : Boolean; stdcall;
begin
Result := False;
if (ID >=0) and (ID <99) then
begin
Result := AudioStream[ID].SetVolume(Volume);
end;
end;function KM_AStream_GetVolume(ID : Integer) : Integer; stdcall;
begin
Result := -1;
if (ID >=0) and (ID <99) then
begin
Result := AudioStream[ID].GetVolume;
end;
end;function KM_AStream_Set3DPosition(ID : Integer; X,Y,Z : Integer) : Boolean; stdcall;
begin
Result := False;
if (ID >=0) and (ID <99) then
begin
Result := AudioStream[ID].Set3DPosition(X,Y,Z);
end;
end;function KM_AStream_Get3DPosition(ID : Integer) : TD3DVector; stdcall;
Var
_Value : TD3DVector;
begin
_Value.X := 0;
_Value.Y := 0;
_Value.Z := 0;
Result := _Value;
if (ID >=0) and (ID <99) then
begin
Result := AudioStream[ID].Get3DPosition;
end;
end;function KM_AStream_IsPlaying(ID : Integer) : Boolean; stdcall;
begin
Result := AudioStream[ID].IsPlaying ;
end;function KM_AStream_IsStop(ID : Integer) : Boolean; stdcall;
begin
Result := AudioStream[ID].IsStop ;
end; {Video}function KM_Video_CreateFromFile(Hwnd : Integer; FileName : Pchar) : Boolean; stdcall;
begin
Result := Video.CreateFromFile(Hwnd,FileName);
end;function KM_Video_Free : Boolean; stdcall;
begin
Result := Video.Free;
end;function KM_Video_IsVideoFile(FileName : Pchar) : Boolean; stdcall;
begin
Result := Video.IsVideoFile(FileName);
end;function KM_Video_Play : Boolean; stdcall;
begin
Result := Video.Play;
end;function KM_Video_Pause : Boolean; stdcall;
begin
Result := Video.Pause;
end;function KM_Video_Stop : Boolean; stdcall;
begin
Result := Video.Stop;
end;function KM_Video_IsPlaying : Boolean; stdcall;
begin
Result := Video.IsPlaying;
end;function KM_Video_IsPause : Boolean; stdcall;
begin
Result := Video.IsPause;
end;function KM_Video_IsStop : Boolean; stdcall;
begin
Result := Video.IsStop;
end;function KM_Video_SetVolume(Volume : Integer) : Boolean; stdcall;
begin
Result := Video.SetVolume(Volume);
end;function KM_Video_GetVolume : Integer; stdcall;
begin
Result := Video.GetVolume;
end;function KM_Video_SetBalance(Balance : Integer) : Boolean; stdcall;
begin
Result := Video.SetBalance(Balance);
end;function KM_Video_GetBalance : Integer; stdcall;
begin
Result := Video.GetBalance;
end;function KM_Video_SetPositions(Positions : Int64) : Boolean; stdcall;
begin
Result := Video.SetPositions(Positions);
end;function KM_Video_GetPositions : Int64; stdcall;
begin
Result := Video.GetPositions;
end;
begin
Result := Video.SetRate(Rate);
end;function KM_Video_GetRate : Double; stdcall;
begin
Result := Video.GetRate;
end;function KM_Video_GetDuration: Int64; stdcall;
begin
Result := Video.GetDuration;
end;function KM_Video_SetWindowPosition(Left : Integer; Top : Integer; Width : Integer; Height : Integer) : Boolean; stdcall;
begin
Result := Video.SetWindowPosition(Left,Top,Width,Height);
end;function KM_Video_EnableFullScreen(FullScreen : Boolean) : Boolean; stdcall;
begin
Result := Video.EnableFullScreen(FullScreen);
end;function KM_Video_IsFullScreen : Boolean; stdcall;
begin
Result := Video.IsFullScreen;
end;function KM_Video_HideCursor(Hide : Boolean) : Boolean; stdcall;
begin
Result := Video.HideCursor(Hide);
end;function KM_Video_IsPlayComplete : Boolean; stdcall;
begin
Result := Video.IsPlayComplete;
end; {AudioCD}function KM_AudioCD_Initialize : Boolean; stdcall;
begin
Result := AudioCD.Initialize;
end;function KM_AudioCD_Free : Boolean; stdcall;
begin
Result := AudioCD.Free;
end;function KM_AudioCD_Play(TrackID : Integer) : Boolean; stdcall;
begin
Result := AudioCD.Play(TrackID);
end;function KM_AudioCD_Stop : Boolean; stdcall;
begin
Result := AudioCD.Stop;
end;function KM_AudioCD_Pause : Boolean; stdcall;
begin
Result := AudioCD.Pause;
end;function KM_AudioCD_Resume : Boolean; stdcall;
begin
Result := AudioCD.Resume;
end;function KM_AudioCD_GetAudioDiskInfo : Integer; stdcall;
begin
Result := AudioCD.GetAudioDiskInfo;
end;function KM_AudioCD_CloseDoor : Boolean; stdcall;
begin
Result := AudioCD.CloseDoor;
end;function KM_AudioCD_EjectDoor : Boolean; stdcall;
begin
Result := AudioCD.EjectDoor;
end;
{SoundStream}function KM_SSound_CreateFromFile(ID : Integer; FileName : Pchar) : Boolean; stdcall;
begin
Result := False;
if (ID >=0) and (ID <99) then
begin
Result := SoundStream[ID].CreateFromFile(FileName);
end;
end;function KM_SSound_Free(ID : Integer) : Boolean; stdcall;
begin
Result := False;
if (ID >=0) and (ID <99) then
begin
Result := SoundStream[ID].Free;
end;
end;function KM_SSound_Play(ID : Integer) : Boolean; stdcall;
begin
Result := False;
if (ID >=0) and (ID <99) then
begin
Result := SoundStream[ID].Play;
end;
end;function KM_SSound_Stop(ID : Integer) : Boolean; stdcall;
begin
Result := False;
if (ID >=0) and (ID <99) then
begin
Result := SoundStream[ID].Stop;
end;
end;function KM_SSound_Pause(ID : Integer) : Boolean; stdcall;
begin
Result := False;
if (ID >=0) and (ID <99) then
begin
Result := SoundStream[ID].Pause;
end;
end;function KM_SSound_SetBalance(ID : Integer; Balance : Integer) : Boolean; stdcall;
begin
Result := False;
if (ID >=0) and (ID <99) then
begin
Result := SoundStream[ID].SetBalance(Balance);
end;
end;function KM_SSound_SetPositions(ID : Integer; Positions : Int64) : Boolean; stdcall;
begin
Result := False;
if (ID >=0) and (ID <99) then
begin
Result := SoundStream[ID].SetPositions(Positions);
end;
end;function KM_SSound_SetRate(ID : Integer; Rate : Double) : Boolean; stdcall;
begin
Result := False;
if (ID >=0) and (ID <99) then
begin
Result := SoundStream[ID].SetRate(Rate);
end;
end;function KM_SSound_SetVolume(ID : Integer; Volume : Integer) : Boolean; stdcall;
begin
Result := False;
if (ID >=0) and (ID <99) then
begin
Result := SoundStream[ID].SetVolume(Volume);
end;
end;function KM_SSound_GetBalance(ID : Integer) : Integer; stdcall;
begin
Result := 0;
if (ID >=0) and (ID <99) then
begin
Result := SoundStream[ID].GetBalance;
end;
end;function KM_SSound_GetDuration(ID : Integer) : Int64; stdcall;
begin
Result := -1;
if (ID >=0) and (ID <99) then
begin
Result := SoundStream[ID].GetDuration ;
end;
end;function KM_SSound_GetPositions(ID : Integer) : Int64; stdcall;
begin
Result := -1;
if (ID >=0) and (ID <99) then
begin
Result := SoundStream[ID].GetPositions;
end;
end;function KM_SSound_GetRate(ID : Integer) : Double; stdcall;
begin
Result := -1;
if (ID >=0) and (ID <99) then
begin
Result := SoundStream[ID].GetRate;
end;
end;function KM_SSound_GetVolume(ID : Integer) : Integer; stdcall;
begin
Result := -1;
if (ID >=0) and (ID <99) then
begin
Result := SoundStream[ID].GetVolume;
end;
end;function KM_SSound_IsPlaying(ID : Integer) : Boolean; stdcall;
begin
Result := False;
if (ID >=0) and (ID <99) then
begin
Result := SoundStream[ID].IsPlaying;
end;
end;function KM_SSound_IsPause(ID : Integer) : Boolean; stdcall;
begin
Result := False;
if (ID >=0) and (ID <99) then
begin
Result := SoundStream[ID].IsPause;
end;
end;function KM_SSound_IsStop(ID : Integer) : Boolean; stdcall;
begin
Result := False;
if (ID >=0) and (ID <99) then
begin
Result := SoundStream[ID].IsStop;
end;
end;function KM_SSound_IsPlayComplete(ID : Integer) : Boolean; stdcall;
begin
Result := False;
if (ID >=0) and (ID <99) then
begin
Result := SoundStream[ID].IsPlayComplete;
end;
end;function KM_SSound_IsValidFile(ID : Integer; FileName : Pchar) : Boolean; stdcall;
begin
Result := False;
if (ID >=0) and (ID <99) then
begin
Result := SoundStream[ID].IsValidFile(FileName);
end;
end;exports
KM_Initialize,
KM_Free,
KM_SetupOutput,
KM_GetDeviceList,
KM_AStatic_CreateFromFile,
KM_AStatic_Free,
KM_AStatic_Play,
KM_AStatic_Stop,
KM_AStatic_IsPlaying,
KM_AStatic_IsStop,
KM_AStatic_IsLooping,
KM_AStatic_SetVolume,
KM_AStatic_GetVolume,
KM_AStatic_DefaultFrequency,
KM_AStatic_SetFrequency,
KM_AStatic_GetFrequency,
KM_AStatic_Set3DPosition,
KM_AStatic_Get3DPosition,
KM_AStream_CreateFromFile,
KM_AStream_Free,
KM_AStream_Play,
KM_AStream_Stop,
KM_AStream_EnableLoop,
KM_AStream_EnableDSP_3D,
KM_AStream_DefaultFrequency,
KM_AStream_SetFrequency,
KM_AStream_GetFrequency,
KM_AStream_SetVolume,
KM_AStream_GetVolume,
KM_AStream_Set3DPosition,
KM_AStream_Get3DPosition,
KM_AStream_IsPlaying,
KM_AStream_IsStop,
KM_Video_CreateFromFile,
KM_Video_Free,
KM_Video_IsVideoFile,
KM_Video_Play,
KM_Video_Pause,
KM_Video_Stop,
KM_Video_IsPlaying,
KM_Video_IsPause,
KM_Video_IsStop,
KM_Video_SetVolume,
KM_Video_GetVolume,
KM_Video_SetBalance,
KM_Video_GetBalance,
KM_Video_SetPositions,
KM_Video_GetPositions,
KM_Video_SetRate,
KM_Video_GetRate,
KM_Video_GetDuration,
KM_Video_SetWindowPosition,
KM_Video_EnableFullScreen,
KM_Video_IsFullScreen,
KM_Video_HideCursor,
KM_Video_IsPlayComplete,
KM_AudioCD_Initialize,
KM_AudioCD_Free,
KM_AudioCD_Play,
KM_AudioCD_Stop,
KM_AudioCD_Pause,
KM_AudioCD_Resume,
KM_AudioCD_GetAudioDiskInfo,
KM_AudioCD_CloseDoor,
KM_AudioCD_EjectDoor,
KM_SSound_CreateFromFile,
KM_SSound_Free,
KM_SSound_Play,
KM_SSound_Stop,
KM_SSound_Pause,
KM_SSound_SetBalance,
KM_SSound_SetPositions,
KM_SSound_SetRate,
KM_SSound_SetVolume,
KM_SSound_GetBalance,
KM_SSound_GetDuration,
KM_SSound_GetPositions,
KM_SSound_GetRate,
KM_SSound_GetVolume,
KM_SSound_IsPlaying,
KM_SSound_IsPause,
KM_SSound_IsStop,
KM_SSound_IsPlayComplete,
KM_SSound_IsValidFile;begin
CoInitialize(nil);
DSound := TDirectSound.Create;
AudioCD := TAudioCD.Create;
Video := TVideo.Create;
for i := 0 to 99 do
begin
AudioStatic[i] := TAudioStatic.Create;
AudioStream[i] := TAudioStream.Create;
SoundStream[i] := TSoundStream.Create;
end;
end.
www.2ccc.com在这两个网站中搜索dll,例子很多的