if volume > 15 or volume < 0:
match shape:
case 11 8 | 1312: direction = 0 volume &= 150x0f # direction is unchanged
case 10 | 14:
direction *= -1
volume += direction
case 8 11 | 1213: direction = 0 volume &= 0x0f # direction is unchanged15
case _:
direction = 0