mirror of
https://git.vladimir.cc/vladimir/ewsdr.git
synced 2026-08-25 20:37:33 +00:00
chore: refine project documentation
This commit is contained in:
+9
-11
@@ -20,11 +20,10 @@
|
||||
unit AudioInput;
|
||||
|
||||
{
|
||||
PortAudio input — TX microphone capture.
|
||||
Modelled after piHPSDR/portaudio.c (DL1YCF), parallel to AudioOutput.pas.
|
||||
PortAudio input — TX microphone capture, parallel to AudioOutput.pas.
|
||||
|
||||
Key features:
|
||||
- Mono input stream, paFloat32, 48000 Hz (fixed, как в piHPSDR)
|
||||
- Mono input stream, paFloat32, fixed at 48000 Hz
|
||||
- Pa_Initialize called once in Initialize
|
||||
- Ring buffer of MY_MIC_RING_SIZE single-channel Double samples
|
||||
- Callback (PaInCallback) writes mic samples into the ring buffer
|
||||
@@ -44,7 +43,7 @@ uses
|
||||
|
||||
const
|
||||
MY_MIC_BUFFER_SIZE = 128; // PA frames per callback
|
||||
MY_MIC_RING_SIZE = 9600; // ring buffer size (mono), как в piHPSDR
|
||||
MY_MIC_RING_SIZE = 9600; // ring buffer size (mono)
|
||||
|
||||
type
|
||||
TPaError = LongInt;
|
||||
@@ -110,7 +109,7 @@ type
|
||||
FLastError: string;
|
||||
FDeviceIndex: Integer; // -1 = нет устройства (не открывается без явного выбора)
|
||||
|
||||
// Ring buffer (mono double), как в piHPSDR
|
||||
// Ring buffer (mono double)
|
||||
FBuf: array[0..MY_MIC_RING_SIZE - 1] of Double;
|
||||
FInPt: Integer; // write pointer (callback writes)
|
||||
FOutPt: Integer; // read pointer (main thread reads via ReadSample)
|
||||
@@ -208,8 +207,7 @@ const
|
||||
PA_CONTINUE = LongInt(0);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Callback — читает моно float32 из inputBuffer, пишет в кольцевой буфер.
|
||||
// Точно по образцу pa_in_cb из piHPSDR/portaudio.c
|
||||
// Callback — читает mono float32 из inputBuffer и пишет в кольцевой буфер.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function PaInCallback(inputBuffer, outputBuffer: Pointer;
|
||||
@@ -461,7 +459,7 @@ begin
|
||||
end;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Open — открывает input stream, как audio_open_input в piHPSDR
|
||||
// Open — открывает входной аудиопоток.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function TAudioInput.Open: Boolean;
|
||||
@@ -480,7 +478,7 @@ begin
|
||||
if not Initialize then Exit;
|
||||
|
||||
FillChar(InParam, SizeOf(InParam), 0);
|
||||
InParam.channelCount := 1; // Mono, как в piHPSDR
|
||||
InParam.channelCount := 1; // Mono input
|
||||
InParam.device := FDeviceIndex;
|
||||
InParam.sampleFormat := PA_FLOAT32;
|
||||
|
||||
@@ -533,7 +531,7 @@ begin
|
||||
end;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Close — как audio_close_input в piHPSDR
|
||||
// Close — останавливает и закрывает входной аудиопоток.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
procedure TAudioInput.Close;
|
||||
@@ -556,7 +554,7 @@ begin
|
||||
end;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ReadSample — как audio_get_next_mic_sample в piHPSDR
|
||||
// ReadSample — возвращает следующий микрофонный сэмпл из буфера.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function TAudioInput.ReadSample: Double;
|
||||
|
||||
Reference in New Issue
Block a user