Rather than buying something from the store, I often just choose to make my own. I made this A/B switch because the drivers for my front ports aren't allowing me to record through Audacity properly on my machine. Now this has been done before but I still like to put it up.
What you will need:
A box of some sort to put the components into (I made my own custom, but any small box will do)
Glue of choice (I used two, super glue and epoxy)
Two 3.5mm headphone jacks
Soldering Iron and solder
A length of cable with one intact 3.5mm headphone jack (or build a cable [here]https://www.instructables.com/id/TRS_headphone_plug_rebuild/)
Step 1: Build the Circuit
First thing you will want to do is build the circuit and test it. I discovered some problems with mine. Make sure the polarities are right. Then your going to want to un-solder the the main cable from the circuit so you can fit it through the hole in the box.
Step 2: Add Componets to the Box and Wire
At this point you'll want to glue in the switch and jacks and run the audio cable in through holes you've made. So you should have 4 of them (one should be square for the switch). Once you've glued them in go ahead and solder it all back together.
Step 3: Close Up Shop
As an addition I added a magnet to the back so I could stick it to the side of my case, then glued it shut. A good idea also would be to test the strength of the magnets before gluing it shut. Mine won't attach to the side of the computer like I had hoped but sits on top and won't move easily which is good.
Step 4: Your Finished
Your A/B switch is now complete, plug it in and test it. Happy switching!