Fact is I'm going back and forth thru documentation trying to avoid specific issues of this or that audio technology... Nevertheless, I'll insist in Bass. I borrowed the following code below and it's quite simple, but Lazarus failed me claimming the statement of the RecordingCallback call:
project1.lpr(15,51) Error: Incompatible type for arg no. 4: Got "<address of function(LongWord;Pointer;LongWord;LongWord):Boolean;StdCall>", expected "<procedure variable type of function(LongWord;Pointer;LongWord;Pointer):LongBool;StdCall>"
program rec;
uses Windows, Bass;
(* This function called while recording audio *)
function RecordingCallback(h:HRECORD; b:Pointer; l,u: DWord): boolean; stdcall;
var level:dword;
begin
level:=BASS_ChannelGetLevel(h);
write(''#13,LoWord(level),'-',HiWord(level),' ');
Result := True;
end;
begin
BASS_RecordInit(-1);
BASS_RecordStart(44100, 2, 0, @RecordingCallback, nil);
Readln;
BASS_RecordFree;
end.