Audacity  3.2.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Friends | List of all members
EffectSBSMS Class Reference

#include <SBSMSEffect.h>

Inheritance diagram for EffectSBSMS:
[legend]
Collaboration diagram for EffectSBSMS:
[legend]

Public Member Functions

bool Process () override
 
void setParameters (double rateStart, double rateEnd, double pitchStart, double pitchEnd, SlideType rateSlideType, SlideType pitchSlideType, bool bLinkRatePitch, bool bRateReferenceInput, bool bPitchReferenceInput)
 
void setParameters (double tempoRatio, double pitchRatio)
 
- Public Member Functions inherited from Effect
 Effect ()
 
virtual ~Effect ()
 
PluginPath GetPath () override
 
VendorSymbol GetVendor () override
 
wxString GetVersion () override
 
TranslatableString GetDescription () override
 
EffectType GetType () override
 Type determines how it behaves. More...
 
EffectFamilySymbol GetFamily () override
 Report identifier and user-visible name of the effect protocol. More...
 
bool IsInteractive () override
 Whether the effect needs a dialog for entry of settings. More...
 
bool IsDefault () override
 Whether the effect sorts "above the line" in the menus. More...
 
bool IsLegacy () override
 
bool SupportsRealtime () override
 Whether the effect supports realtime previewing (while audio is playing). More...
 
bool SupportsAutomation () override
 Whether the effect can be used without the UI, in a macro. More...
 
bool GetAutomationParameters (CommandParameters &parms) override
 Save current settings into parms. More...
 
bool SetAutomationParameters (CommandParameters &parms) override
 Change settings to those stored in parms. More...
 
bool LoadUserPreset (const RegistryPath &name) override
 Change settings to a user-named preset. More...
 
bool SaveUserPreset (const RegistryPath &name) override
 Save current settings as a user-named preset. More...
 
RegistryPaths GetFactoryPresets () override
 Report names of factory presets. More...
 
bool LoadFactoryPreset (int id) override
 Change settings to the preset whose name is GetFactoryPresets()[id] More...
 
bool LoadFactoryDefaults () override
 Change settings back to "factory default". More...
 
bool SetHost (EffectHostInterface *host) override
 
unsigned GetAudioInCount () override
 
unsigned GetAudioOutCount () override
 
int GetMidiInCount () override
 
int GetMidiOutCount () override
 
sampleCount GetLatency () override
 Called for destructive, non-realtime effect computation. More...
 
size_t GetTailSize () override
 
void SetSampleRate (double rate) override
 
size_t SetBlockSize (size_t maxBlockSize) override
 
size_t GetBlockSize () const override
 
bool ProcessInitialize (sampleCount totalLen, ChannelNames chanMap=NULL) override
 Called for destructive, non-realtime effect computation. More...
 
bool ProcessFinalize () override
 Called for destructive, non-realtime effect computation. More...
 
size_t ProcessBlock (float **inBlock, float **outBlock, size_t blockLen) override
 Called for destructive, non-realtime effect computation. More...
 
bool RealtimeInitialize () override
 
bool RealtimeAddProcessor (unsigned numChannels, float sampleRate) override
 
bool RealtimeFinalize () override
 
bool RealtimeSuspend () override
 
bool RealtimeResume () noexcept override
 
bool RealtimeProcessStart () override
 
size_t RealtimeProcess (int group, float **inbuf, float **outbuf, size_t numSamples) override
 
bool RealtimeProcessEnd () noexcept override
 
int ShowClientInterface (wxWindow &parent, wxDialog &dialog, bool forceModal=false) override
 
bool PopulateUI (ShuttleGui &S) final
 Adds controls to a panel that is given as the parent window of S More...
 
bool IsGraphicalUI () override
 
bool ValidateUI () override
 
bool HideUI () override
 
bool CloseUI () override
 
bool CanExportPresets () override
 
void ExportPresets () override
 
void ImportPresets () override
 
bool HasOptions () override
 
void ShowOptions () override
 
EffectDefinitionInterfaceGetDefinition () override
 
double GetDuration () override
 
NumericFormatSymbol GetDurationFormat () override
 
virtual NumericFormatSymbol GetSelectionFormat ()
 
void SetDuration (double duration) override
 
RegistryPath GetUserPresetsGroup (const RegistryPath &name) override
 
RegistryPath GetCurrentSettingsGroup () override
 
RegistryPath GetFactoryDefaultsGroup () override
 
virtual wxString GetSavedStateGroup ()
 
int ShowHostInterface (wxWindow &parent, const EffectDialogFactory &factory, bool forceModal=false) override
 
unsigned TestUIFlags (unsigned mask)
 
void SetPresetParameters (const wxArrayString *Names, const wxArrayString *Values)
 
virtual bool Startup (EffectUIClientInterface *client)
 
virtual bool GetAutomationParametersAsString (wxString &parms)
 
virtual bool SetAutomationParametersFromString (const wxString &parms)
 
virtual bool IsBatchProcessing ()
 
virtual void SetBatchProcessing (bool start)
 
bool DoEffect (double projectRate, TrackList *list, WaveTrackFactory *factory, NotifyingSelectedRegion &selectedRegion, unsigned flags, wxWindow *pParent=nullptr, const EffectDialogFactory &dialogFactory={})
 
bool Delegate (Effect &delegate, wxWindow &parent, const EffectDialogFactory &factory)
 
int MessageBox (const TranslatableString &message, long style=DefaultMessageBoxStyle, const TranslatableString &titleStr={})
 
virtual bool Startup ()
 
- Public Member Functions inherited from EffectUIClientInterface
virtual ~EffectUIClientInterface ()
 
- Public Member Functions inherited from EffectProcessor
virtual ~EffectProcessor ()
 
- Public Member Functions inherited from EffectDefinitionInterface
virtual ~EffectDefinitionInterface ()
 
virtual EffectType GetClassification ()
 Determines which menu it appears in; default same as GetType(). More...
 
virtual bool EnablesDebug ()
 Whether the effect dialog should have a Debug button; default, always false. More...
 
virtual ManualPageID ManualPage ()
 Name of a page in the Audacity alpha manual, default is empty. More...
 
virtual FilePath HelpPage ()
 Fully qualified local help file name, default is empty. More...
 
virtual bool IsHiddenFromMenus ()
 Default is false. More...
 
- Public Member Functions inherited from ComponentInterface
virtual ~ComponentInterface ()
 
TranslatableString GetName ()
 
virtual bool DefineParams (ShuttleParams &WXUNUSED(S))
 
- Public Member Functions inherited from EffectUIHostInterface
virtual ~EffectUIHostInterface ()
 
- Public Member Functions inherited from EffectHostInterface
virtual ~EffectHostInterface ()
 

Static Public Member Functions

static double getInvertedStretchedTime (double rateStart, double rateEnd, SlideType slideType, double outputTime)
 
static double getRate (double rateStart, double rateEnd, SlideType slideType, double t)
 
- Static Public Member Functions inherited from Effect
static void IncEffectCounter ()
 
- Static Public Member Functions inherited from EffectDefinitionInterface
static Identifier GetSquashedName (const Identifier &ident)
 A utility that strips spaces and CamelCases a name. More...
 

Protected Member Functions

ComponentInterfaceSymbol GetSymbol () override
 
- Protected Member Functions inherited from Effect
bool EnableApply (bool enable=true)
 
bool EnablePreview (bool enable=true)
 
virtual bool Init ()
 
virtual bool CheckWhetherSkipEffect ()
 
virtual bool ProcessPass ()
 
virtual bool InitPass1 ()
 
virtual bool InitPass2 ()
 
virtual void End ()
 
virtual double CalcPreviewInputLength (double previewLength)
 
virtual void Preview (bool dryOnly)
 
virtual void PopulateOrExchange (ShuttleGui &S)
 
virtual bool TransferDataToWindow ()
 
virtual bool TransferDataFromWindow ()
 
bool TotalProgress (double frac, const TranslatableString &={})
 
bool TrackProgress (int whichTrack, double frac, const TranslatableString &={})
 
bool TrackGroupProgress (int whichGroup, double frac, const TranslatableString &={})
 
int GetNumWaveTracks ()
 
int GetNumWaveGroups ()
 
void GetBounds (const WaveTrack &track, const WaveTrack *pRight, sampleCount *start, sampleCount *len)
 
void SetLinearEffectFlag (bool linearEffectFlag)
 
void SetPreviewFullSelectionFlag (bool previewDurationFlag)
 
bool IsPreviewing ()
 
void IncludeNotSelectedPreviewTracks (bool includeNotSelected)
 
void CopyInputTracks (bool allSyncLockSelected=false)
 
std::shared_ptr< AddedAnalysisTrackAddAnalysisTrack (const wxString &name=wxString())
 
ModifiedAnalysisTrack ModifyAnalysisTrack (const LabelTrack *pOrigTrack, const wxString &name=wxString())
 
void ReplaceProcessedTracks (const bool bGoodResult)
 
TrackAddToOutputTracks (const std::shared_ptr< Track > &t)
 
const TrackListinputTracks () const
 
const AudacityProjectFindProject () const
 

Protected Attributes

TranslatableString mProxyEffectName { XO("SBSMS Time / Pitch Stretch") }
 
- Protected Attributes inherited from Effect
BasicUI::ProgressDialogmProgress = nullptr
 
double mProjectRate
 
double mSampleRate
 
WaveTrackFactorymFactory
 
std::shared_ptr< TrackListmOutputTracks
 
double mT0
 
double mT1
 
wxArrayString mPresetNames
 
wxArrayString mPresetValues
 
int mPass
 
wxWeakRef< wxDialog > mHostUIDialog
 This smart pointer tracks the lifetime of the dialog. More...
 
wxWeakRef< wxDialog > mUIDialog
 This weak pointer may be the same as the above, or null. More...
 
wxWindow * mUIParent
 
unsigned mUIFlags { 0 }
 
sampleCount mSampleCnt
 

Private Member Functions

bool ProcessLabelTrack (LabelTrack *track)
 
void Finalize (WaveTrack *orig, WaveTrack *out, const TimeWarper *warper)
 

Private Attributes

double rateStart
 
double rateEnd
 
double pitchStart
 
double pitchEnd
 
bool bLinkRatePitch
 
bool bRateReferenceInput
 
bool bPitchReferenceInput
 
SlideType rateSlideType
 
SlideType pitchSlideType
 
int mCurTrackNum
 
double mCurT0
 
double mCurT1
 
float mTotalStretch
 

Friends

class EffectChangeTempo
 
class EffectChangePitch
 

Additional Inherited Members

- Public Types inherited from Effect
enum  : long { DefaultMessageBoxStyle = wxOK | wxCENTRE }
 
- Static Public Attributes inherited from Effect
static const wxString kUserPresetIdent = wxT("User Preset:")
 
static const wxString kFactoryPresetIdent = wxT("Factory Preset:")
 
static const wxString kCurrentSettingsIdent = wxT("<Current Settings>")
 
static const wxString kFactoryDefaultsIdent = wxT("<Factory Defaults>")
 
- Static Protected Attributes inherited from Effect
static int nEffectsDone =0
 

Detailed Description

Definition at line 29 of file SBSMSEffect.h.

Member Function Documentation

◆ Finalize()

void EffectSBSMS::Finalize ( WaveTrack orig,
WaveTrack out,
const TimeWarper warper 
)
private

Definition at line 432 of file SBSMSEffect.cpp.

433 {
434  // Silenced samples will be inserted in gaps between clips, so capture where these
435  // gaps are for later deletion
436  std::vector<std::pair<double, double>> gaps;
437  double last = mCurT0;
438  auto clips = orig->SortedClipArray();
439  auto front = clips.front();
440  auto back = clips.back();
441  for (auto &clip : clips) {
442  auto st = clip->GetPlayStartTime();
443  auto et = clip->GetPlayEndTime();
444 
445  if (st >= mCurT0 || et < mCurT1) {
446  if (mCurT0 < st && clip == front) {
447  gaps.push_back(std::make_pair(mCurT0, st));
448  }
449  else if (last < st && mCurT0 <= last ) {
450  gaps.push_back(std::make_pair(last, st));
451  }
452 
453  if (et < mCurT1 && clip == back) {
454  gaps.push_back(std::make_pair(et, mCurT1));
455  }
456  }
457  last = et;
458  }
459 
460  // Take the output track and insert it in place of the original sample data
461  orig->ClearAndPaste(mCurT0, mCurT1, out, true, true, warper);
462 
463  // Finally, recreate the gaps
464  for (auto gap : gaps) {
465  auto st = orig->LongSamplesToTime(orig->TimeToLongSamples(gap.first));
466  auto et = orig->LongSamplesToTime(orig->TimeToLongSamples(gap.second));
467  if (st >= mCurT0 && et <= mCurT1 && st != et)
468  {
469  orig->SplitDelete(warper->Warp(st), warper->Warp(et));
470  }
471  }
472 }

References WaveTrack::ClearAndPaste(), gap, SampleTrack::LongSamplesToTime(), mCurT0, mCurT1, WaveTrack::SortedClipArray(), WaveTrack::SplitDelete(), SampleTrack::TimeToLongSamples(), and TimeWarper::Warp().

Referenced by Process().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getInvertedStretchedTime()

double EffectSBSMS::getInvertedStretchedTime ( double  rateStart,
double  rateEnd,
SlideType  slideType,
double  outputTime 
)
static

Definition at line 201 of file SBSMSEffect.cpp.

202 {
203  Slide slide(slideType,rateStart,rateEnd,0);
204  return slide.getInverseStretchedTime(outputTime);
205 }

References rateEnd, and rateStart.

Referenced by EffectTimeScale::CalcPreviewInputLength().

Here is the caller graph for this function:

◆ getRate()

double EffectSBSMS::getRate ( double  rateStart,
double  rateEnd,
SlideType  slideType,
double  t 
)
static

Definition at line 207 of file SBSMSEffect.cpp.

208 {
209  Slide slide(slideType,rateStart,rateEnd,0);
210  return slide.getRate(t);
211 }

References rateEnd, and rateStart.

Referenced by EffectTimeScale::Process().

Here is the caller graph for this function:

◆ GetSymbol()

ComponentInterfaceSymbol EffectSBSMS::GetSymbol ( )
inlineoverrideprotectedvirtual

Reimplemented from Effect.

Reimplemented in EffectTimeScale.

Definition at line 45 of file SBSMSEffect.h.

45 { return mProxyEffectName; }

◆ Process()

bool EffectSBSMS::Process ( )
overridevirtual

If Process() is not overridden, it uses ProcessInitialize(), ProcessBlock(), and ProcessFinalize() methods of EffectProcessor, and also GetLatency() to determine how many leading output samples to discard and how many extra samples to produce.

Reimplemented from Effect.

Reimplemented in EffectTimeScale.

Definition at line 213 of file SBSMSEffect.cpp.

214 {
215  bool bGoodResult = true;
216 
217  //Iterate over each track
218  //all needed because this effect needs to introduce silence in the group tracks to keep sync
219  this->CopyInputTracks(true); // Set up mOutputTracks.
220  mCurTrackNum = 0;
221 
222  double maxDuration = 0.0;
223 
224  // Must sync if selection length will change
225  bool mustSync = (rateStart != rateEnd);
226  Slide rateSlide(rateSlideType,rateStart,rateEnd);
227  Slide pitchSlide(pitchSlideType,pitchStart,pitchEnd);
228  mTotalStretch = rateSlide.getTotalStretch();
229 
230  mOutputTracks->Leaders().VisitWhile( bGoodResult,
231  [&](LabelTrack *lt, const Track::Fallthrough &fallthrough) {
232  if (!(lt->GetSelected() ||
233  (mustSync && SyncLock::IsSyncLockSelected(lt))))
234  return fallthrough();
235  if (!ProcessLabelTrack(lt))
236  bGoodResult = false;
237  },
238  [&](WaveTrack *leftTrack, const Track::Fallthrough &fallthrough) {
239  if (!leftTrack->GetSelected())
240  return fallthrough();
241 
242  //Get start and end times from selection
243  mCurT0 = mT0;
244  mCurT1 = mT1;
245 
246  //Set the current bounds to whichever left marker is
247  //greater and whichever right marker is less
248  mCurT0 = wxMax(mT0, mCurT0);
249  mCurT1 = wxMin(mT1, mCurT1);
250 
251  // Process only if the right marker is to the right of the left marker
252  if (mCurT1 > mCurT0) {
253  auto start = leftTrack->TimeToLongSamples(mCurT0);
254  auto end = leftTrack->TimeToLongSamples(mCurT1);
255 
256  // TODO: more-than-two-channels
257  auto channels = TrackList::Channels(leftTrack);
258  WaveTrack *rightTrack = (channels.size() > 1)
259  ? * ++ channels.first
260  : nullptr;
261  if (rightTrack) {
262  double t;
263 
264  //Adjust bounds by the right tracks markers
265  t = rightTrack->GetStartTime();
266  t = wxMax(mT0, t);
267  mCurT0 = wxMin(mCurT0, t);
268  t = rightTrack->GetEndTime();
269  t = wxMin(mT1, t);
270  mCurT1 = wxMax(mCurT1, t);
271 
272  //Transform the marker timepoints to samples
273  start = leftTrack->TimeToLongSamples(mCurT0);
274  end = leftTrack->TimeToLongSamples(mCurT1);
275 
276  mCurTrackNum++; // Increment for rightTrack, too.
277  }
278 
279  // SBSMS has a fixed sample rate - we just convert to its sample rate and then convert back
280  float srTrack = leftTrack->GetRate();
281  float srProcess = bLinkRatePitch ? srTrack : 44100.0;
282 
283  // the resampler needs a callback to supply its samples
284  ResampleBuf rb;
285  auto maxBlockSize = leftTrack->GetMaxBlockSize();
286  rb.blockSize = maxBlockSize;
287  rb.buf.reinit(rb.blockSize, true);
288  rb.leftTrack = leftTrack;
289  rb.rightTrack = rightTrack?rightTrack:leftTrack;
290  rb.leftBuffer.reinit(maxBlockSize, true);
291  rb.rightBuffer.reinit(maxBlockSize, true);
292 
293  // Samples in selection
294  auto samplesIn = end - start;
295 
296  // Samples for SBSMS to process after resampling
297  auto samplesToProcess = (sampleCount) (samplesIn.as_float() * (srProcess/srTrack));
298 
299  SlideType outSlideType;
300  SBSMSResampleCB outResampleCB;
301 
302  if(bLinkRatePitch) {
303  rb.bPitch = true;
304  outSlideType = rateSlideType;
305  outResampleCB = resampleCB;
306  rb.offset = start;
307  rb.end = end;
308  // Third party library has its own type alias, check it
309  static_assert(sizeof(sampleCount::type) <=
310  sizeof(_sbsms_::SampleCountType),
311  "Type _sbsms_::SampleCountType is too narrow to hold a sampleCount");
312  rb.iface = std::make_unique<SBSMSInterfaceSliding>
313  (&rateSlide, &pitchSlide, bPitchReferenceInput,
314  static_cast<_sbsms_::SampleCountType>
315  ( samplesToProcess.as_long_long() ),
316  0, nullptr);
317 
318  }
319  else {
320  rb.bPitch = false;
321  outSlideType = (srProcess==srTrack?SlideIdentity:SlideConstant);
322  outResampleCB = postResampleCB;
323  rb.ratio = srProcess/srTrack;
324  rb.quality = std::make_unique<SBSMSQuality>(&SBSMSQualityStandard);
325  rb.resampler = std::make_unique<Resampler>(resampleCB, &rb, srProcess==srTrack?SlideIdentity:SlideConstant);
326  rb.sbsms = std::make_unique<SBSMS>(rightTrack ? 2 : 1, rb.quality.get(), true);
327  rb.SBSMSBlockSize = rb.sbsms->getInputFrameSize();
328  rb.SBSMSBuf.reinit(static_cast<size_t>(rb.SBSMSBlockSize), true);
329  rb.offset = start;
330  rb.end = end;
331  rb.iface = std::make_unique<SBSMSEffectInterface>
332  (rb.resampler.get(), &rateSlide, &pitchSlide,
334  static_cast<_sbsms_::SampleCountType>( samplesToProcess.as_long_long() ),
335  0,
336  rb.quality.get());
337  }
338 
339  Resampler resampler(outResampleCB,&rb,outSlideType);
340 
341  audio outBuf[SBSMSOutBlockSize];
342  float outBufLeft[2*SBSMSOutBlockSize];
343  float outBufRight[2*SBSMSOutBlockSize];
344 
345  // Samples in output after SBSMS
346  sampleCount samplesToOutput = rb.iface->getSamplesToOutput();
347 
348  // Samples in output after resampling back
349  auto samplesOut = (sampleCount) (samplesToOutput.as_float() * (srTrack/srProcess));
350 
351  // Duration in track time
352  double duration = (mCurT1-mCurT0) * mTotalStretch;
353 
354  if(duration > maxDuration)
355  maxDuration = duration;
356 
357  auto warper = createTimeWarper(mCurT0,mCurT1,maxDuration,rateStart,rateEnd,rateSlideType);
358 
359  rb.outputLeftTrack = leftTrack->EmptyCopy();
360  if(rightTrack)
361  rb.outputRightTrack = rightTrack->EmptyCopy();
362 
363  long pos = 0;
364  long outputCount = -1;
365 
366  // process
367  while(pos<samplesOut && outputCount) {
368  const auto frames =
369  limitSampleBufferSize( SBSMSOutBlockSize, samplesOut - pos );
370 
371  outputCount = resampler.read(outBuf,frames);
372  for(int i = 0; i < outputCount; i++) {
373  outBufLeft[i] = outBuf[i][0];
374  if(rightTrack)
375  outBufRight[i] = outBuf[i][1];
376  }
377  pos += outputCount;
378  rb.outputLeftTrack->Append((samplePtr)outBufLeft, floatSample, outputCount);
379  if(rightTrack)
380  rb.outputRightTrack->Append((samplePtr)outBufRight, floatSample, outputCount);
381 
382  double frac = (double)pos / samplesOut.as_double();
383  int nWhichTrack = mCurTrackNum;
384  if(rightTrack) {
385  nWhichTrack = 2*(mCurTrackNum/2);
386  if (frac < 0.5)
387  frac *= 2.0; // Show twice as far for each track, because we're doing 2 at once.
388  else {
389  nWhichTrack++;
390  frac -= 0.5;
391  frac *= 2.0; // Show twice as far for each track, because we're doing 2 at once.
392  }
393  }
394  if (TrackProgress(nWhichTrack, frac)) {
395  bGoodResult = false;
396  return;
397  }
398  }
399 
400  {
401  auto pException = rb.mpException;
402  rb.mpException = {};
403  if (pException)
404  std::rethrow_exception(pException);
405  }
406 
407  rb.outputLeftTrack->Flush();
408  if(rightTrack)
409  rb.outputRightTrack->Flush();
410 
411  Finalize(leftTrack, rb.outputLeftTrack.get(), warper.get());
412  if(rightTrack)
413  Finalize(rightTrack, rb.outputRightTrack.get(), warper.get());
414  }
415  mCurTrackNum++;
416  },
417  [&](Track *t) {
418  if (mustSync && SyncLock::IsSyncLockSelected(t))
419  {
420  t->SyncLockAdjust(mCurT1, mCurT0 + (mCurT1 - mCurT0) * mTotalStretch);
421  }
422  }
423  );
424 
425  if (bGoodResult) {
426  ReplaceProcessedTracks(bGoodResult);
427  }
428 
429  return bGoodResult;
430 }

References sampleCount::as_float(), bLinkRatePitch, ResampleBuf::blockSize, ResampleBuf::bPitch, bPitchReferenceInput, ResampleBuf::buf, TrackList::Channels(), Effect::CopyInputTracks(), createTimeWarper(), WaveTrack::EmptyCopy(), ResampleBuf::end, Finalize(), floatSample, WaveTrack::GetEndTime(), WaveTrack::GetMaxBlockSize(), WaveTrack::GetRate(), Track::GetSelected(), WaveTrack::GetStartTime(), ResampleBuf::iface, SyncLock::IsSyncLockSelected(), ResampleBuf::leftBuffer, ResampleBuf::leftTrack, limitSampleBufferSize(), mCurT0, mCurT1, mCurTrackNum, Effect::mOutputTracks, ResampleBuf::mpException, Effect::mT0, Effect::mT1, mTotalStretch, ResampleBuf::offset, ResampleBuf::outputLeftTrack, ResampleBuf::outputRightTrack, pitchEnd, pitchSlideType, pitchStart, postResampleCB(), ProcessLabelTrack(), ResampleBuf::quality, rateEnd, rateSlideType, rateStart, ResampleBuf::ratio, ArrayOf< X >::reinit(), Effect::ReplaceProcessedTracks(), resampleCB(), ResampleBuf::resampler, ResampleBuf::rightBuffer, ResampleBuf::rightTrack, ResampleBuf::sbsms, ResampleBuf::SBSMSBlockSize, ResampleBuf::SBSMSBuf, SBSMSOutBlockSize, SampleTrack::TimeToLongSamples(), and Effect::TrackProgress().

Referenced by EffectTimeScale::Process().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ProcessLabelTrack()

bool EffectSBSMS::ProcessLabelTrack ( LabelTrack track)
private

Definition at line 193 of file SBSMSEffect.cpp.

194 {
196  RegionTimeWarper warper{ mT0, mT1, std::move(warper1) };
197  lt->WarpLabels(warper);
198  return true;
199 }

References createTimeWarper(), Effect::mT0, Effect::mT1, mTotalStretch, rateEnd, rateSlideType, rateStart, and LabelTrack::WarpLabels().

Referenced by Process().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setParameters() [1/2]

void EffectSBSMS::setParameters ( double  rateStart,
double  rateEnd,
double  pitchStart,
double  pitchEnd,
SlideType  rateSlideType,
SlideType  pitchSlideType,
bool  bLinkRatePitch,
bool  bRateReferenceInput,
bool  bPitchReferenceInput 
)

Definition at line 148 of file SBSMSEffect.cpp.

151 {
152  this->rateStart = rateStartIn;
153  this->rateEnd = rateEndIn;
154  this->pitchStart = pitchStartIn;
155  this->pitchEnd = pitchEndIn;
156  this->bLinkRatePitch = bLinkRatePitchIn;
157  this->rateSlideType = rateSlideTypeIn;
158  this->pitchSlideType = pitchSlideTypeIn;
159  this->bRateReferenceInput = bRateReferenceInputIn;
160  this->bPitchReferenceInput = bPitchReferenceInputIn;
161 }

References bLinkRatePitch, bPitchReferenceInput, bRateReferenceInput, pitchEnd, pitchSlideType, pitchStart, rateEnd, rateSlideType, and rateStart.

Referenced by EffectTimeScale::Process(), and setParameters().

Here is the caller graph for this function:

◆ setParameters() [2/2]

void EffectSBSMS::setParameters ( double  tempoRatio,
double  pitchRatio 
)

Definition at line 163 of file SBSMSEffect.cpp.

164 {
165  setParameters(tempoRatio, tempoRatio, pitchRatio, pitchRatio,
166  SlideConstant, SlideConstant, false, false, false);
167 }

References setParameters().

Here is the call graph for this function:

Friends And Related Function Documentation

◆ EffectChangePitch

friend class EffectChangePitch
friend

Definition at line 61 of file SBSMSEffect.h.

◆ EffectChangeTempo

friend class EffectChangeTempo
friend

Definition at line 60 of file SBSMSEffect.h.

Member Data Documentation

◆ bLinkRatePitch

bool EffectSBSMS::bLinkRatePitch
private

Definition at line 52 of file SBSMSEffect.h.

Referenced by Process(), and setParameters().

◆ bPitchReferenceInput

bool EffectSBSMS::bPitchReferenceInput
private

Definition at line 52 of file SBSMSEffect.h.

Referenced by Process(), and setParameters().

◆ bRateReferenceInput

bool EffectSBSMS::bRateReferenceInput
private

Definition at line 52 of file SBSMSEffect.h.

Referenced by setParameters().

◆ mCurT0

double EffectSBSMS::mCurT0
private

Definition at line 56 of file SBSMSEffect.h.

Referenced by Finalize(), and Process().

◆ mCurT1

double EffectSBSMS::mCurT1
private

Definition at line 57 of file SBSMSEffect.h.

Referenced by Finalize(), and Process().

◆ mCurTrackNum

int EffectSBSMS::mCurTrackNum
private

Definition at line 55 of file SBSMSEffect.h.

Referenced by Process().

◆ mProxyEffectName

TranslatableString EffectSBSMS::mProxyEffectName { XO("SBSMS Time / Pitch Stretch") }
protected

Definition at line 41 of file SBSMSEffect.h.

◆ mTotalStretch

float EffectSBSMS::mTotalStretch
private

Definition at line 58 of file SBSMSEffect.h.

Referenced by Process(), and ProcessLabelTrack().

◆ pitchEnd

double EffectSBSMS::pitchEnd
private

Definition at line 51 of file SBSMSEffect.h.

Referenced by Process(), and setParameters().

◆ pitchSlideType

SlideType EffectSBSMS::pitchSlideType
private

Definition at line 54 of file SBSMSEffect.h.

Referenced by Process(), and setParameters().

◆ pitchStart

double EffectSBSMS::pitchStart
private

Definition at line 51 of file SBSMSEffect.h.

Referenced by Process(), and setParameters().

◆ rateEnd

double EffectSBSMS::rateEnd
private

◆ rateSlideType

SlideType EffectSBSMS::rateSlideType
private

Definition at line 53 of file SBSMSEffect.h.

Referenced by Process(), ProcessLabelTrack(), and setParameters().

◆ rateStart

double EffectSBSMS::rateStart
private

The documentation for this class was generated from the following files:
EffectSBSMS::mProxyEffectName
TranslatableString mProxyEffectName
Definition: SBSMSEffect.h:41
EffectSBSMS::rateEnd
double rateEnd
Definition: SBSMSEffect.h:51
WaveTrack
A Track that contains audio waveform data.
Definition: WaveTrack.h:75
EffectSBSMS::mTotalStretch
float mTotalStretch
Definition: SBSMSEffect.h:58
EffectSBSMS::bPitchReferenceInput
bool bPitchReferenceInput
Definition: SBSMSEffect.h:52
EffectSBSMS::pitchStart
double pitchStart
Definition: SBSMSEffect.h:51
ResampleBuf::leftBuffer
ArrayOf< float > leftBuffer
Definition: SBSMSEffect.cpp:51
WaveTrack::GetEndTime
double GetEndTime() const override
Get the time at which the last clip in the track ends, plus recorded stuff.
Definition: WaveTrack.cpp:2014
Effect::CopyInputTracks
void CopyInputTracks(bool allSyncLockSelected=false)
Definition: Effect.cpp:1834
EffectSBSMS::mCurT1
double mCurT1
Definition: SBSMSEffect.h:57
TrackList::Channels
static auto Channels(TrackType *pTrack) -> TrackIterRange< TrackType >
Definition: Track.h:1483
Effect::mT1
double mT1
Definition: Effect.h:424
ArrayOf::reinit
void reinit(Integral count, bool initialize=false)
Definition: MemoryX.h:57
ResampleBuf::sbsms
std::unique_ptr< SBSMS > sbsms
Definition: SBSMSEffect.cpp:55
SBSMSOutBlockSize
@ SBSMSOutBlockSize
Definition: SBSMSEffect.cpp:28
LabelTrack
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:89
ResampleBuf::mpException
std::exception_ptr mpException
Definition: SBSMSEffect.cpp:65
gap
static const int gap
Definition: MeterPanel.cpp:256
WaveTrack::ClearAndPaste
void ClearAndPaste(double t0, double t1, const Track *src, bool preserve=true, bool merge=true, const TimeWarper *effectWarper=NULL)
Definition: WaveTrack.cpp:917
sampleCount::as_float
float as_float() const
Definition: SampleCount.h:44
WaveTrack::EmptyCopy
Holder EmptyCopy(const SampleBlockFactoryPtr &pFactory={}) const
Definition: WaveTrack.cpp:709
WaveTrack::SplitDelete
void SplitDelete(double t0, double t1)
Definition: WaveTrack.cpp:1167
WaveTrack::SortedClipArray
WaveClipPointers SortedClipArray()
Definition: WaveTrack.cpp:2722
ResampleBuf
Definition: SBSMSEffect.cpp:32
EffectSBSMS::mCurTrackNum
int mCurTrackNum
Definition: SBSMSEffect.h:55
floatSample
@ floatSample
Definition: SampleFormat.h:34
ResampleBuf::rightBuffer
ArrayOf< float > rightBuffer
Definition: SBSMSEffect.cpp:52
ResampleBuf::offset
sampleCount offset
Definition: SBSMSEffect.cpp:49
ResampleBuf::blockSize
size_t blockSize
Definition: SBSMSEffect.cpp:47
Effect::mT0
double mT0
Definition: Effect.h:423
postResampleCB
long postResampleCB(void *cb_data, SBSMSFrame *data)
Definition: SBSMSEffect.cpp:137
SyncLock::IsSyncLockSelected
static bool IsSyncLockSelected(const Track *pTrack)
Definition: SyncLock.cpp:43
EffectSBSMS::bLinkRatePitch
bool bLinkRatePitch
Definition: SBSMSEffect.h:52
ResampleBuf::quality
std::unique_ptr< SBSMSQuality > quality
Definition: SBSMSEffect.cpp:61
EffectSBSMS::bRateReferenceInput
bool bRateReferenceInput
Definition: SBSMSEffect.h:52
RegionTimeWarper
No change before the specified region; during the region, warp according to the given warper; after t...
Definition: TimeWarper.h:192
ResampleBuf::ratio
double ratio
Definition: SBSMSEffect.cpp:45
ResampleBuf::iface
std::unique_ptr< SBSMSInterface > iface
Definition: SBSMSEffect.cpp:56
Effect::ReplaceProcessedTracks
void ReplaceProcessedTracks(const bool bGoodResult)
Definition: Effect.cpp:1956
Track::Fallthrough
Continuation<> Fallthrough
Type of arguments passed as optional second parameter to TypeSwitch<void>() cases.
Definition: Track.h:499
EffectSBSMS::ProcessLabelTrack
bool ProcessLabelTrack(LabelTrack *track)
Definition: SBSMSEffect.cpp:193
WaveTrack::GetStartTime
double GetStartTime() const override
Get the time at which the first clip in the track starts.
Definition: WaveTrack.cpp:1994
sampleCount::type
long long type
Definition: SampleCount.h:20
WaveTrack::GetMaxBlockSize
size_t GetMaxBlockSize() const override
This returns a nonnegative number of samples meant to size a memory buffer.
Definition: WaveTrack.cpp:1811
TimeWarper::Warp
virtual double Warp(double originalTime) const =0
Effect::mOutputTracks
std::shared_ptr< TrackList > mOutputTracks
Definition: Effect.h:422
EffectSBSMS::rateStart
double rateStart
Definition: SBSMSEffect.h:51
Track::GetSelected
bool GetSelected() const
Definition: Track.h:428
samplePtr
char * samplePtr
Definition: SampleFormat.h:49
ResampleBuf::leftTrack
WaveTrack * leftTrack
Definition: SBSMSEffect.cpp:53
resampleCB
long resampleCB(void *cb_data, SBSMSFrame *data)
Definition: SBSMSEffect.cpp:89
ResampleBuf::outputLeftTrack
std::shared_ptr< WaveTrack > outputLeftTrack
Definition: SBSMSEffect.cpp:62
Track
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:224
ResampleBuf::outputRightTrack
std::shared_ptr< WaveTrack > outputRightTrack
Definition: SBSMSEffect.cpp:63
ResampleBuf::end
sampleCount end
Definition: SBSMSEffect.cpp:50
ResampleBuf::rightTrack
WaveTrack * rightTrack
Definition: SBSMSEffect.cpp:54
sampleCount
Positions or offsets within audio files need a wide type.
Definition: SampleCount.h:18
EffectSBSMS::pitchSlideType
SlideType pitchSlideType
Definition: SBSMSEffect.h:54
WaveTrack::GetRate
double GetRate() const override
Definition: WaveTrack.cpp:495
EffectSBSMS::mCurT0
double mCurT0
Definition: SBSMSEffect.h:56
SampleTrack::TimeToLongSamples
sampleCount TimeToLongSamples(double t0) const
Convert correctly between an (absolute) time in seconds and a number of samples.
Definition: SampleTrack.cpp:35
EffectSBSMS::Finalize
void Finalize(WaveTrack *orig, WaveTrack *out, const TimeWarper *warper)
Definition: SBSMSEffect.cpp:432
ResampleBuf::buf
ArrayOf< audio > buf
Definition: SBSMSEffect.cpp:44
ResampleBuf::bPitch
bool bPitch
Definition: SBSMSEffect.cpp:43
EffectSBSMS::pitchEnd
double pitchEnd
Definition: SBSMSEffect.h:51
limitSampleBufferSize
size_t limitSampleBufferSize(size_t bufferSize, sampleCount limit)
Definition: SampleCount.cpp:23
SampleTrack::LongSamplesToTime
double LongSamplesToTime(sampleCount pos) const
Convert correctly between a number of samples and an (absolute) time in seconds.
Definition: SampleTrack.cpp:40
Effect::TrackProgress
bool TrackProgress(int whichTrack, double frac, const TranslatableString &={})
Definition: Effect.cpp:1788
ResampleBuf::SBSMSBlockSize
long SBSMSBlockSize
Definition: SBSMSEffect.cpp:48
ResampleBuf::SBSMSBuf
ArrayOf< audio > SBSMSBuf
Definition: SBSMSEffect.cpp:57
createTimeWarper
std::unique_ptr< TimeWarper > createTimeWarper(double t0, double t1, double duration, double rateStart, double rateEnd, SlideType rateSlideType)
Definition: SBSMSEffect.cpp:169
EffectSBSMS::rateSlideType
SlideType rateSlideType
Definition: SBSMSEffect.h:53
ResampleBuf::resampler
std::unique_ptr< Resampler > resampler
Definition: SBSMSEffect.cpp:60
EffectSBSMS::setParameters
void setParameters(double rateStart, double rateEnd, double pitchStart, double pitchEnd, SlideType rateSlideType, SlideType pitchSlideType, bool bLinkRatePitch, bool bRateReferenceInput, bool bPitchReferenceInput)
Definition: SBSMSEffect.cpp:148