My wife had extra marital affair

I got married in 2009, at that particular time I was not habitual of drinking but after 3yrs of marriage I was hospitalized once in lifetime for anxiety attack and so on I became a medical patient of anxiety issues. And got in to some drinking habit and for the same reason my wife started getting away from me she usually in month or so started calling her parents and choosing going along them after beating me furiously. Her parents also supported her in her such acts. This thing become regular I was in deep love with her but she never entertained my loving nature. After getting mentally tortured and recieving so many injuries from her without even saying a single word to her she even not tried to talk me in deserving manner. Somehow I started it can be something which can be generated in her self there must some kind of provocation. Finally I successfully tracked her affair with one men listening a phone recording of her and her two faces of being a trustful wife on one hand and a ditcher on one hand. So when I found all this act, being a men I was so angry I slapped her and beaten her which is natural for any men. So now she has charged me with 323, 354 (kh) Hindi alphabet, 504, 506 IPC. But still being a father of 8yr daughter I don't want to spoil my family nor her character in court. What can I do now please help to get my family back just for the sake of my daughter.