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 start = leftTrack->TimeToLongSamples(mCurT0);
auto end = leftTrack->TimeToLongSamples(mCurT1); auto end = leftTrack->TimeToLongSamples(mCurT1);
WaveTrack* rightTrack = NULL; // TODO: more-than-two-channels
if (leftTrack->GetLinked()) { WaveTrack *rightTrack =
* ++ TrackList::Channels(leftTrack).begin();
if (rightTrack) {
double t; double t;
// Assume linked track is wave or null
rightTrack = static_cast<WaveTrack*>(leftTrack->GetLink());
//Adjust bounds by the right tracks markers //Adjust bounds by the right tracks markers
t = rightTrack->GetStartTime(); 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 // Process only if the right marker is to the right of the left marker
if (mCurT1 > mCurT0) { if (mCurT1 > mCurT0) {
if (leftTrack->GetLinked()) { // TODO: more-than-two-channels
auto channels = TrackList::Channels(leftTrack);
if (auto rightTrack = * ++ channels.begin()) {
double t; double t;
// Assume linked track is wave
WaveTrack* rightTrack = static_cast<WaveTrack*>(leftTrack->GetLink());
//Adjust bounds by the right tracks markers //Adjust bounds by the right tracks markers
t = rightTrack->GetStartTime(); t = rightTrack->GetStartTime();

View File

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