mciSendString is the API you want.

it allows you send commands to various multimedia devices (mircophones, sound cards, Cd players etc)

mciSendString "open driver alias linein wait shareable", 0, 0, 0

Driver is the device driver or the device name, as stated in System.ini or registry, this can be different for each sound card.
for the line in or line out.

for CD controls:
Click here
thats for a CD player in computer, if you only have one, its quite easy to control and find out track infomation, play by track etc.

once you have opened the CD and the line in, you can specify a play on both at the same time.

before playing its best to "cue" the tracks recording.

for more info read MSDN