1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-05 15:09:08 +02:00

Iterations over channels involving third-party effects libraries...

... I don't know whether these libraries support more than two channels with
no problems.

All these places have the comment:

// TODO: more-than-two-channels
This commit is contained in:
Paul Licameli 2018-09-30 11:10:06 -04:00
commit 7eadd7a36f
3 changed files with 29 additions and 25 deletions

View File

@ -252,11 +252,11 @@ bool EffectSBSMS::Process()
auto start = leftTrack->TimeToLongSamples(mCurT0);
auto end = leftTrack->TimeToLongSamples(mCurT1);
WaveTrack* rightTrack = NULL;
if (leftTrack->GetLinked()) {
// TODO: more-than-two-channels
WaveTrack *rightTrack =
* ++ TrackList::Channels(leftTrack).begin();
if (rightTrack) {
double t;
// Assume linked track is wave or null
rightTrack = static_cast<WaveTrack*>(leftTrack->GetLink());
//Adjust bounds by the right tracks markers
t = rightTrack->GetStartTime();

View File

@ -120,10 +120,10 @@ bool EffectSoundTouch::ProcessWithTimeWarper(const TimeWarper &warper)
// Process only if the right marker is to the right of the left marker
if (mCurT1 > mCurT0) {
if (leftTrack->GetLinked()) {
// TODO: more-than-two-channels
auto channels = TrackList::Channels(leftTrack);
if (auto rightTrack = * ++ channels.begin()) {
double t;
// Assume linked track is wave
WaveTrack* rightTrack = static_cast<WaveTrack*>(leftTrack->GetLink());
//Adjust bounds by the right tracks markers
t = rightTrack->GetStartTime();

View File

@ -299,25 +299,25 @@ bool VampEffect::Init()
{
mRate = 0.0;
for (auto left : inputTracks()->Leaders< const WaveTrack >() )
{
if (mRate == 0.0)
{
mRate = left->GetRate();
}
if (left->GetLinked())
{
auto right = static_cast<const WaveTrack*>( left->GetLink() );
// PRL: this loop checked that channels of a track have the same rate,
// but there was no check that all tracks have one rate, and only the first
// is remembered in mRate. Is that correct?
for (auto leader : inputTracks()->Leaders<const WaveTrack>()) {
auto channelGroup = TrackList::Channels( leader );
auto rate = (*channelGroup.first++) -> GetRate();
for(auto channel : channelGroup) {
if (rate != channel->GetRate())
// PRL: Track rate might not match individual clip rates.
// So is this check not adequate?
if (left->GetRate() != right->GetRate())
{
// TODO: more-than-two-channels-message
Effect::MessageBox(_("Sorry, Vamp Plug-ins cannot be run on stereo tracks where the individual channels of the track do not match."));
return false;
}
}
if (mRate == 0.0)
mRate = rate;
}
if (mRate <= 0.0)
@ -361,22 +361,26 @@ bool VampEffect::Process()
std::vector<std::shared_ptr<Effect::AddedAnalysisTrack>> addedTracks;
for (auto left : inputTracks()->Leaders< const WaveTrack >() )
for (auto leader : inputTracks()->Leaders<const WaveTrack>())
{
auto channelGroup = TrackList::Channels(leader);
auto left = *channelGroup.first++;
sampleCount lstart, rstart = 0;
sampleCount len;
GetSamples(left, &lstart, &len);
unsigned channels = 1;
const WaveTrack *right{};
if (left->GetLinked())
const WaveTrack *right = *channelGroup.first++;
if (right)
{
right = static_cast< const WaveTrack* >( left->GetLink() );
channels = 2;
GetSamples(right, &rstart, &len);
}
// TODO: more-than-two-channels
size_t step = mPlugin->getPreferredStepSize();
size_t block = mPlugin->getPreferredBlockSize();