Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
speechrate.php
1
<?php
9
namespace
Bitrix\Sender\Integration\VoxImplant
;
10
15
class
SpeechRate
16
{
18
private
$speedId;
19
21
private
$text =
''
;
22
28
public
static
function
create
()
29
{
30
return
new
static
();
31
}
32
36
public
function
__construct
()
37
{
38
}
39
46
public
function
withSpeed
($speedId =
null
)
47
{
48
$this->speedId = $speedId;
49
return
$this;
50
}
51
58
public
function
withText
($text =
''
)
59
{
60
$this->text = $text;
61
return
$this;
62
}
63
69
public
function
getDuration
()
70
{
71
return
mb_strlen($this->text) * $this->getRatioPerChar();
72
}
73
74
private
function
getRatioPerChar()
75
{
76
$rates =
self::getList
();
77
$rate = isset($rates[$this->speedId]) ? $rates[$this->speedId] : $rates[
'medium'
];
78
79
return
self::getBaseInterval
() / $rate;
80
}
81
87
public
static
function
getList
()
88
{
89
return
array(
90
'x-slow'
=> 270,
91
'slow'
=> 300,
92
'medium'
=> 340,
93
'fast'
=> 370,
94
'x-fast'
=> 400
95
);
96
}
97
103
public
static
function
getBaseInterval
()
104
{
105
return
30;
106
}
107
}
Bitrix\Sender\Integration\VoxImplant\SpeechRate
Definition
speechrate.php:16
Bitrix\Sender\Integration\VoxImplant\SpeechRate\__construct
__construct()
Definition
speechrate.php:36
Bitrix\Sender\Integration\VoxImplant\SpeechRate\create
static create()
Definition
speechrate.php:28
Bitrix\Sender\Integration\VoxImplant\SpeechRate\withText
withText($text='')
Definition
speechrate.php:58
Bitrix\Sender\Integration\VoxImplant\SpeechRate\withSpeed
withSpeed($speedId=null)
Definition
speechrate.php:46
Bitrix\Sender\Integration\VoxImplant\SpeechRate\getDuration
getDuration()
Definition
speechrate.php:69
Bitrix\Sender\Integration\VoxImplant\SpeechRate\getList
static getList()
Definition
speechrate.php:87
Bitrix\Sender\Integration\VoxImplant\SpeechRate\getBaseInterval
static getBaseInterval()
Definition
speechrate.php:103
Bitrix\Sender\Integration\VoxImplant
Definition
audio.php:9
modules
sender
lib
integration
voximplant
speechrate.php
Создано системой
1.10.0