RBinBR is right. You need to do some serious soul searching and start to make changes. You need to figure out for you the person you want to be. You need to sit down and really think about why these affairs happened and the reasoning behind them. That may take some time. You realize when you say that your H wouldn't spend time with you, so you found someone else to spend time with, you are blaming your H for your affair. This took me a while to figure that out. I would say these things to my H as well. The fact is we made our choices, we made the mistakes, and now we have to face the consequences.
You have stated there are seriuos problems in your M, well I would start looking at each of them and determine how you want to change you so that they don't happen again. Work on your communication skills (get a C or take some courses), think of the person you would like to be, the qualities you know that are inside you and work on them to bring them out.
Your M may be over, true. I know you seem lost and confused. It is a scary place to be. My H constantly flip flops on getting a D. One day he seems happy and wants to stay, the next he hates my guts and wants a D.
Your H will probably say some very hurtful things if and when you start talking. Don't get angry or defensive. Listen and validate his feelings. This will be hard, but it does work.
Don't give up unless you do not want your M. Change and work on yourself and you will feel better. I speak from experience.