Sudden hearing loss following ringing in ears for years. What caused that?

Various reasons. Sudden hearing loss- what was the reason? Loud explosion can rupture ear drum or permanently damage the hearing apparatus. This can also cause annoying ringing in the ear- tinnitus. Or you may have something called menier's disease. You need to get checked by an ent.
Ask an ENT. It could be nerve damage, fluid or simply wax. An ear, nose and throat specialist can quickly get to the bottom of it and recommend treatment.