Bugzilla – Bug 302
Selection length may change when track and project rate don't match
Last modified: 2018-08-20 11:51:45 UTC
Split from now closed bug 123. Al: Maybe we need a flag indicating whether the duration is the length of the selection. That is, if the user selects a region and generates into it without touching the duration control, the duration is calculated separately for each track according to its sample rate, such that the overall clip length always remains the same. Martyn: We have a problem with the things that happen before EffectDtmf::GenerateTrack (and the others). At the point of EffectDtmf::PromptUser() (or Init()) we have no way of knowing how the selection corresponds to the samples (and it will vary with the sample rates of the tracks selected, as you say). I (have applied) a patch that fixes most (all?) cases when clip lengths are wrong. If you have a track at 44100Hz sampling rate and 'just' select 10 samples from sample 5 (that is the LH end of the selection is 'just' far enough to the L to visibly select the first (5th) sample of the selection and the RH end is 'just' far enough to the R to select the 14th sample ('End' @ 15, 'Length' @ 10 in the SelectionBar)) then DTMF will generate the correct number of samples. Similarly for 'almost' selecting another sample at each end. And other combinations. There are some cases when clip lengths get changed but they are 'expected/unavoidable'. When we call up the generator with a selection, the 'samples' are at the project rate. So the example above with 10 samples 'just' selected in a track @ 44100Hz but with a project rate of 8000Hz results in '2' samples selected in the TTC of the DTMF generator. 2 whole samples @ 8000Hz = 11.025 samples @ 44100Hz and so that is what gets generated, an extra sample over that selected by looking at the highlighting of the waveform. Gale: To me the selection in Martyn's example should be adjusted where the track and project rate don't match so that in that case it would show 10 samples when project rate was 44100 and 2 samples where rate was 8000. I also notice that having generated at 8000 Hz and the selection having visibly extended to 11 samples, if you drag the selection RH edge back to where it was so just encompassing 10 samples again, then change project rate back to 44100 Hz, the selection does not change AFAICT but Selection Toolbar now says 11 samples. In fact to see that you don't need to take any action on the selection at all. Generate a 44100 Hz tone in new project, select the 10 samples in Martyn's example, change project rate to 8000 Hz then back to 44100 Hz. Selection does not change but Selection Toolbar now says 11 samples are selected instead of the 10 that are selected.
Closed NOT-A-BUG. There are no steps to reproduce. The Description starts with 'maybe we need...'.