Cardiac motion is typically not accounted for during pretreatment imaging for central lung and mediastinal tumors. However, cardiac induced tumor motion averages 5.8mm for esophageal tumors and 3-5 mm for some lung tumors, which can result in positioning errors. Our aim is to reduce both cardiac- and respiratory-induced motion artifacts in thoracic cone beam computed tomography (CBCT) images through gantry velocity and projection rate modulation on a standard linear accelerator (linac). The acquisition of dual cardiac and respiratory gated CBCT thoracic images was simulated using the XCAT phantom with patient-measured respiratory and ECG traces. The gantry velocity and projection rate were modulated based on the cardiac and respiratory signals to maximize the angular consistency between adjacent projections in the gated cardiac-respiratory bin. The mechanical limitations of a gantry-mounted CBCT system were investigated. For our protocol, images were acquired during the 60%-80% window of cardiac phase and 20% displacement either side of peak exhale of the respiratory cycle. The comparator method was the respiratory-only gated CBCT acquisition with constant gantry speed and projection rate in routine use for respiratory correlated four-dimensional (4D) CBCT. All images were reconstructed using the Feldkamp-Davis-Kress (FDK) algorithm. The methods were compared in terms of image sharpness as measured using the edge response width (ERW) and contrast as measured using the contrast to noise ratio (CNR). The effects of the total number of projections acquired and magnitude of cardiac motion on scan time and image quality were also investigated. Median total scan times with our protocol ranged from 117s (40 projections) through to 296s (100 projections), compared with 240s for the conventional protocol (1320 projections). The scan times were dictated by the number of projections acquired, heart rate, length of the respiratory cycle and mechanical constraints of the CBCT system. Our protocol was able to provide between 8% and 43% decrease in the median value of the ERW in the anterior/posterior (AP) direction across the 17 traces when there was 0.5cm of cardiac motion and between 35% and 64% decrease when there was 1.0cm of cardiac motion over conventional acquisition. In the superior-inferior (SI) direction, our protocol was able to provide between 22% and 26% decrease in the median value of the ERW across the 17 traces when there was 0.5cm of cardiac motion and between 30% and 35% decrease when there was 1.0cm of cardiac motion over conventional acquisition. The magnitude of the cardiac motion did not have an observable effect on the median value of the CNR. Across all 17 traces, our adaptive protocol produced noticeably more consistent, albeit lower CNR values compared with conventional acquisition. For the first time, the potential of adapting CBCT image acquisition to changes in the patient's cardiac and respiratory rates simultaneously for applications in radiotherapy was investigated. This work represents a step towards thoracic imaging that reduces the effects of both cardiac and respiratory motion on image quality.