The two stations (Long Distance and Commuter) are connected so it is similar to transferring at an airport, just follow the signs. They had been doing quite a bit of construction and remodeling at Chamartin, so really can not be much more specific.
Note that the commuter train goes only to Terminal 4, to get to 1,2, or 3 would then require using the inter-terminal bus/shuttle.
What time is your flight? and to where?
While two hours seems "close". figure that two hours for the fast train, maybe up to an hour to get to the airport, 2 or 3 hour check in/security/etc., you are looking at a good 6 hours of travel to make the flight, with lots of moving pieces that can break and disrupt the whole plan. I like to be a bit closer to a departure airport to give me options, but that's me. You will be depending on making that high speed train, and that it will run on time, or at all.