you'll need something in the middle to plug both into as each device will send it's signal separately and then one output to go to the speakers. an easy answer if it fits your set-up is that most tv's will have multiple hdmi inputs and a single digital output (possibly, digital and optical) this single output can go to your pc which will decode it and send it to the speakers for both devices (and any others plugged in as well)
if your not using a tv with such an output or if your pc does not have the audio input, then you'll need some kind of amp that will do the same thing and allow multiple devices to be plugged in and output one signal to the speakers.