What was the capital of Wales before Machynlleth?

There is no record of one as such. The first formalised capital recognised in UK law was Cardiff in 1955