ao: use ring buffer and more generic internal api