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