sound.pas

来自「delphi编制的nes模拟器--tNes」· PAS 代码 · 共 67 行

PAS
67
字号
unit sound;

interface
uses
	windows;

type
	TSound=class

		public
			constructor Create();
			destructor destory();
			procedure Snd_Write(addr:Word;data:Byte);
			function  Snd_Read(addr:Word):Byte;
			procedure SetFrameTimes(times:integer);
			procedure EndFrame();

	end;
	function Apu_Init():Boolean;stdcall;
	procedure IO_Write(addr:DWORD;data:DWORD);stdcall;
	function IO_Read(addr:DWORD):integer;stdcall;
	procedure End_frame();stdcall;
	procedure elapse_time(time:integer);stdcall;
	procedure cleanup_sound();stdcall;

implementation
function Apu_Init():Boolean;external 'sound.dll' name 'Apu_Init';
procedure IO_Write(addr:DWORD;data:DWORD);external 'sound.dll' name 'IO_Write';
function IO_Read(addr:DWORD):integer;external 'sound.dll' name 'IO_Read';
procedure End_frame();external 'sound.dll' name 'End_frame';
procedure elapse_time(time:integer);external 'sound.dll' name 'elapse_time';
procedure cleanup_sound();external 'sound.dll' name 'cleanup_sound';

{ TSound }

constructor TSound.Create;
begin
	Apu_Init();
end;

destructor TSound.destory;
begin
	cleanup_sound();
end;

procedure TSound.EndFrame;
begin
	End_frame();
end;

procedure TSound.SetFrameTimes(times: integer);
begin
	elapse_time(times);
end;

function TSound.Snd_Read(addr: Word): Byte;
begin
	result:=IO_Read(addr);
end;

procedure TSound.Snd_Write(addr: Word; data: Byte);
begin
   IO_Write(addr,data);
end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?