PDFium Delphi Component Docs

EstimateSpokenWordIndex 函式

單元: PDFium
為不回報詞位置的語音引擎估算目前的朗讀詞索引

語法

function EstimateSpokenWordIndex(const Words: TPdfWordBoxes; ElapsedMs: Cardinal; WordsPerMinute: Integer): Integer;

參數

WordsTPdfWordBoxes - 目前朗讀區塊中的詞
ElapsedMsCardinal - 目前區塊開始朗讀後經過的毫秒數
WordsPerMinuteInteger - 估計的語速,設為 0 則使用預設的 175 WPM

傳回值

以 0 為基底的詞索引;當範圍為空或預估時程已結束時,傳回 -1

說明

此輔助函式會以每個詞 60000 / WordsPerMinute 毫秒的方式為整個範圍分配時間預算

每個詞會依文字長度按比例分得預算,再加上少量的詞間停頓權重

備註

範例

WordIndex := EstimateSpokenWordIndex(Words, ElapsedMs, 175);
if WordIndex >= 0 then
  PdfView1.SetReadingWord(Words[WordIndex]);

另請參閱

TPdfWordBox, TPdfReadingSession.EstimatePacing, TPdfReadingSession.Tick