1 | <?php |
||
7 | class Stop |
||
8 | { |
||
9 | private $stringLength; |
||
10 | |||
11 | /** |
||
12 | * Stop constructor. |
||
13 | * |
||
14 | * @param float $stringLength A "string length": the length of string |
||
15 | * between the stop and the bridge, as a fraction |
||
16 | * of the whole string. A string length of 1.0 |
||
17 | * indicates an open string. |
||
18 | */ |
||
19 | public function __construct(float $stringLength) |
||
27 | |||
28 | /** |
||
29 | * Create a Stop instance from a frequency over a string. |
||
30 | * |
||
31 | * @param float $frequency |
||
32 | * @param \ExtendedStrings\Strings\VibratingStringInterface $string |
||
33 | * |
||
34 | * @return \ExtendedStrings\Strings\Stop |
||
35 | */ |
||
36 | public static function fromFrequency(float $frequency, VibratingStringInterface $string): self |
||
45 | |||
46 | /** |
||
47 | * Returns the frequency of the stop (assuming normal stop pressure). |
||
48 | * |
||
49 | * @param VibratingStringInterface $string |
||
50 | * |
||
51 | * @return float |
||
52 | */ |
||
53 | public function getFrequency(VibratingStringInterface $string): float |
||
59 | |||
60 | /** |
||
61 | * Returns the string length for the stop. |
||
62 | * |
||
63 | * @see Stop::__construct() for a definition of "string length" |
||
64 | * |
||
65 | * @return float |
||
66 | */ |
||
67 | public function getStringLength(): float |
||
71 | |||
72 | /** |
||
73 | * Convert a number of cents over a string to a string length. |
||
74 | * |
||
75 | * @see Stop::__construct() for a definition of "string length" |
||
76 | * |
||
77 | * @param float $cents The number of cents between the open string's pitch |
||
78 | * and the stopped pitch. |
||
79 | * |
||
80 | * @return float |
||
81 | */ |
||
82 | private static function centsToStringLength(float $cents): float |
||
86 | } |
||
87 |