Consistent samplerate handling for playback and recording - Alex
[terminatorX.git] / src / tX_vtt.cc
index 5d9c0d8946c6950c7024bd848a23cb11d105157a..40f3152f7118e4e4426602f3f68e7e52ebe141e2 100644 (file)
@@ -1990,3 +1990,18 @@ void vtt_class :: hide_control(bool hide) {
        control_hidden=hide;
        gui_hide_control_panel(this, hide);     
 }
+
+void vtt_class :: set_sample_rate(int samplerate) {
+       list <vtt_class *> :: iterator vtt;
+       double sr=(double) samplerate;
+       
+       for (vtt=main_list.begin(); vtt!=main_list.end() ; vtt++) {
+               if ((*vtt)->audiofile) {
+                       double file_rate=(*vtt)->audiofile->get_sample_rate();
+                       (*vtt)->audiofile_pitch_correction=file_rate/sr;
+               } else {
+                       (*vtt)->audiofile_pitch_correction=1.0;
+               }
+               (*vtt)->recalc_pitch();
+       }
+}