Commit 2945d7e
authored
A fault the pump has been torn down for stops turning players away (#49)
* A fault the pump has already been torn down for stops turning players away
`Pump._fault` was both the sentence saying what happened and the refusal
that stopped every later `play()`, and only a fresh boot cleared it. So one
released node took the pump away for the rest of the boot: the speaker came
back on `machine.I2S`, `AudioOut.pumped` read False, the DMA counter never
moved and nothing anywhere said why (#45).
They come apart. `fault()` is the record and survives; `blocked()` is
whether it is still in the way, and the teardown that repairs the pump --
no clients, no thread, no driver, no channel -- clears it, as does the new
`clear_fault()`. A `play()` that fails with nothing left sounding tears the
pump down itself rather than leaving a refusal nobody can see. And a player
that does fall back because the pump is still holding something now says so
once per fault, the way a board with no `wire=` does.
`play(..., raises=True)` is for the caller that asked for the pump:
`audiobusio.I2SOut.retarget` raises a `ValueError` naming which refusal it
is -- a rate change, or a sample that is not signed 16-bit -- and flattening
it to a sentence was all a caller could ever see (audioif#2). `refusal()`
hands the same object to callers that take the `False`; `attach_stream()`
now raises the driver's exception instead of a `RuntimeError` quoting it.
Each of the three new tests was watched failing against its own planted
defect first.
* tests: the board probe that pulled an MP3 through the pump
#40 asked for a prefetcher in front of `MP3Decoder` and an MP3
played on a board through `audiodev`. The prefetcher was already there --
`FILE_BACKED` names `MP3Decoder` beside `WaveFile` -- and what had never
happened is anybody running it.
The probe reports the four things the issue needs: whether the pump took it,
whether a Prefetch was built, whether the DMA clocked the bytes, and what it
sounded like as a digest. `digest()` beside it is the reproducible one, over
a fixed 128 blocks, because the pump's own STATUS_DIGEST covers whatever it
happened to pull before somebody stopped it and moves between runs.
Its comments carry the three traps that each produced a confident wrong
reading first: the status digest is published at run-end, the status block
belongs to the I2SOut and goes when `stop()` closes it, and `play()` retunes
the bus and zeroes the DMA counter under a baseline taken a line earlier.
* pump: a teardown that raises must not replace the refusal it was cleaning up after
`_play`'s except path tears the pump down when nothing is left sounding.
If that teardown raised, the exception the caller actually needs -- the
driver's own `ValueError` naming which refusal it is -- would be replaced by
whatever went wrong on the way out, and under `raises=True` that is the one
they would catch.1 parent e2bce5c commit 2945d7e
4 files changed
Lines changed: 334 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1003 | 1003 | | |
1004 | 1004 | | |
1005 | 1005 | | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
1006 | 1011 | | |
1007 | 1012 | | |
1008 | 1013 | | |
1009 | 1014 | | |
1010 | | - | |
1011 | | - | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
1012 | 1021 | | |
1013 | 1022 | | |
1014 | 1023 | | |
| |||
1054 | 1063 | | |
1055 | 1064 | | |
1056 | 1065 | | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
1057 | 1075 | | |
1058 | 1076 | | |
1059 | 1077 | | |
| |||
1106 | 1124 | | |
1107 | 1125 | | |
1108 | 1126 | | |
1109 | | - | |
1110 | | - | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
1111 | 1142 | | |
1112 | 1143 | | |
1113 | | - | |
| 1144 | + | |
1114 | 1145 | | |
1115 | 1146 | | |
1116 | 1147 | | |
1117 | | - | |
1118 | | - | |
| 1148 | + | |
| 1149 | + | |
1119 | 1150 | | |
1120 | 1151 | | |
1121 | 1152 | | |
| |||
1131 | 1162 | | |
1132 | 1163 | | |
1133 | 1164 | | |
1134 | | - | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
1135 | 1182 | | |
1136 | 1183 | | |
1137 | 1184 | | |
| |||
1155 | 1202 | | |
1156 | 1203 | | |
1157 | 1204 | | |
1158 | | - | |
| 1205 | + | |
1159 | 1206 | | |
1160 | 1207 | | |
1161 | 1208 | | |
| |||
1311 | 1358 | | |
1312 | 1359 | | |
1313 | 1360 | | |
1314 | | - | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
1315 | 1368 | | |
1316 | 1369 | | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
1317 | 1402 | | |
1318 | 1403 | | |
| 1404 | + | |
| 1405 | + | |
1319 | 1406 | | |
1320 | 1407 | | |
1321 | 1408 | | |
| |||
1340 | 1427 | | |
1341 | 1428 | | |
1342 | 1429 | | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
1343 | 1436 | | |
1344 | 1437 | | |
1345 | 1438 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
65 | 70 | | |
66 | 71 | | |
67 | 72 | | |
| |||
315 | 320 | | |
316 | 321 | | |
317 | 322 | | |
318 | | - | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
319 | 336 | | |
320 | 337 | | |
321 | 338 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
0 commit comments