当前位置: 首页>>代码示例>>C++>>正文


C++ AudacityProject类代码示例

本文整理汇总了C++中AudacityProject的典型用法代码示例。如果您正苦于以下问题:C++ AudacityProject类的具体用法?C++ AudacityProject怎么用?C++ AudacityProject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了AudacityProject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetActiveProject

void ControlToolBar::PlayCurrentRegion(bool looped /* = false */,
                                       bool cutpreview /* = false */)
{
   if (!CanStopAudioStream())
      return;

   AudacityProject *p = GetActiveProject();

   if (p)
   {

      double playRegionStart, playRegionEnd;
      p->GetPlayRegion(&playRegionStart, &playRegionEnd);

      AudioIOStartStreamOptions options(p->GetDefaultPlayOptions());
      options.playLooped = looped;
      if (cutpreview)
         options.timeTrack = NULL;
      ControlToolBar::PlayAppearance appearance =
        cutpreview ? ControlToolBar::PlayAppearance::CutPreview
           : looped ? ControlToolBar::PlayAppearance::Looped
           : ControlToolBar::PlayAppearance::Straight;
      PlayPlayRegion(SelectedRegion(playRegionStart, playRegionEnd),
                     options,
                     (looped ? PlayMode::loopedPlay : PlayMode::normalPlay),
                     appearance);
   }
}
开发者ID:Grunji,项目名称:audacity,代码行数:28,代码来源:ControlToolBar.cpp

示例2: OnDisableMeter

void Meter::StartMonitoring()
{

    if (gAudioIO->IsMonitoring())
        gAudioIO->StopStream();
    else {
#if WANT_METER_MENU
        if (mMeterDisabled) {
            wxCommandEvent dummy;
            OnDisableMeter(dummy);
        }
#endif

        AudacityProject *p = GetActiveProject();
        if (p) {
            gAudioIO->StartMonitoring(p->GetRate());

            MeterToolBar *bar = p->GetMeterToolBar();
            if (bar) {
                Meter *play, *record;
                bar->GetMeters(&play, &record);
                gAudioIO->SetMeters(record, play);
            }
        }
    }

}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:27,代码来源:Meter.cpp

示例3: GetActiveProject

void ControlToolBar::EnableDisableButtons()
{
   AudacityProject *p = GetActiveProject();

   bool tracks = (p && !p->GetTracks()->IsEmpty());
   bool busy = gAudioIO->IsBusy();

#if 0
   if (tracks) {
      if (!busy)
         mPlay->Enable();
   } else mPlay->Disable();
#endif

   //mPlay->SetEnabled(tracks && !busy);
   mPlay->SetEnabled(tracks && !mRecord->IsDown());
   #if (AUDACITY_BRANDING == BRAND_THINKLABS)
      mPlay->SetEnabled(tracks && !mRecord->IsDown() && !mLoopPlay->IsDown());
      mLoopPlay->SetEnabled(tracks && !mRecord->IsDown() && !mPlay->IsDown());
   #endif

   mStop->SetEnabled(busy);
   mRewind->SetEnabled(tracks && !busy);
   mFF->SetEnabled(tracks && !busy);
}
开发者ID:andreipaga,项目名称:audacity,代码行数:25,代码来源:ControlToolBar.cpp

示例4: GetActiveProject

bool BatchCommands::ApplyEffectCommand(const PluginID & ID, const wxString & command, const wxString & params)
{
   //Possibly end processing here, if in batch-debug
   if( ReportAndSkip(command, params))
      return true;

   AudacityProject *project = GetActiveProject();

   //FIXME: for later versions may want to not select-all in batch mode.
   //IF nothing selected, THEN select everything
   // (most effects require that you have something selected).
   project->SelectAllIfNone();

   bool res = false;

   EffectManager::Get().SetBatchProcessing(ID, true);

   // transfer the parameters to the effect...
   if (EffectManager::Get().SetEffectParameters(ID, params))
   {
      // and apply the effect...
      res = project->OnEffect(ID, AudacityProject::OnEffectFlags::kConfigured |
                                  AudacityProject::OnEffectFlags::kSkipState);
   }

   EffectManager::Get().SetBatchProcessing(ID, false);

   return res;
}
开发者ID:MartynShaw,项目名称:audacity,代码行数:29,代码来源:BatchCommands.cpp

示例5: float

float ContrastDialog::GetDB()
{
//   not good
//  why not?
// what if more than one track?
   float rms = float(0.0);

   AudacityProject *p = GetActiveProject();
   TrackListIterator iter(p->GetTracks());
   Track *t = iter.First();
   if(mT0 > mT1)
   {
      wxMessageDialog m(NULL, _("Start time after after end time!\nPlease enter reasonable times."), _("Error"), wxOK);
      m.ShowModal();
      return 1234.0; // 'magic number', but the whole +ve dB range will 'almost' never occur
   }
   if(mT0 < t->GetStartTime())
      mT0 = t->GetStartTime();
   if(mT1 > t->GetEndTime())
      mT1 = t->GetEndTime();
   if(mT0 > mT1)
   {
      wxMessageDialog m(NULL, _("Times are not reasonable!\nPlease enter reasonable times."), _("Error"), wxOK);
      m.ShowModal();
      return 1234.0;
   }
   if(mT0 == mT1)
      return 1234.0;
   while(t) {  // this isn't quite right.  What to do if more than one track selected?
      ((WaveTrack *)t)->GetRMS(&rms, mT0, mT1);
      t = iter.Next();
   }
   return 20.0*log10(rms);
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:34,代码来源:Contrast.cpp

示例6: GetActiveProject

bool EffectDtmf::Init()
{
   // dialog will be passed values from effect
   // Effect retrieves values from saved config
   // Dialog will take care of using them to initialize controls
   // If there is a selection, use that duration, otherwise use
   // value from saved config: this is useful is user wants to
   // replace selection with dtmf sequence

   if (mT1 > mT0) {
      // there is a selection: let's fit in there...
      // MJS: note that this is just for the TTC and is independent of the track rate
      // but we do need to make sure we have the right number of samples at the project rate
      AudacityProject *p = GetActiveProject();
      double projRate = p->GetRate();
      double quantMT0 = QUANTIZED_TIME(mT0, projRate);
      double quantMT1 = QUANTIZED_TIME(mT1, projRate);
      mDuration = quantMT1 - quantMT0;
      mIsSelection = true;
   } else {
      // retrieve last used values
      gPrefs->Read(wxT("/Effects/DtmfGen/SequenceDuration"), &mDuration, 1L);
      mIsSelection = false;
   }
   gPrefs->Read(wxT("/Effects/DtmfGen/String"), &dtmfString, wxT("audacity"));
   gPrefs->Read(wxT("/Effects/DtmfGen/DutyCycle"), &dtmfDutyCycle, 550L);
   gPrefs->Read(wxT("/Effects/DtmfGen/Amplitude"), &dtmfAmplitude, 0.8f);

   dtmfNTones = wxStrlen(dtmfString);

   return true;
}
开发者ID:GYGit,项目名称:Audacity,代码行数:32,代码来源:DtmfGen.cpp

示例7: ExecCommand

/// This is the function which actually obeys one command.  Rather than applying
/// the command directly, an event containing a reference to the command is sent
/// to the main (GUI) thread. This is because having more than one thread access
/// the GUI at a time causes problems with wxwidgets.
int ExecCommand(wxString *pIn, wxString *pOut)
{
   CommandBuilder builder(*pIn);
   if (builder.WasValid())
   {
      AudacityProject *project = GetActiveProject();
      project->SafeDisplayStatusMessage(wxT("Received script command"));
      Command *cmd = builder.GetCommand();
      ScriptCommandRelay::PostCommand(project, cmd);

      *pOut = wxEmptyString;
   } else
   {
      *pOut = wxT("Syntax error!\n");
      *pOut += builder.GetErrorMessage() + wxT("\n");
      builder.Cleanup();
   }

   // Wait until all responses from the command have been received.
   // The last response is signalled by an empty line.
   wxString msg = ScriptCommandRelay::ReceiveResponse().GetMessage();
   while (msg != wxT("\n"))
   {
      *pOut += msg + wxT("\n");
      msg = ScriptCommandRelay::ReceiveResponse().GetMessage();
   }

   return 0;
}
开发者ID:jeevithag,项目名称:audacity,代码行数:33,代码来源:ScriptCommandRelay.cpp

示例8: WXUNUSED

void TranscriptionToolBar::OnEndOff(wxCommandEvent & WXUNUSED(event))
{

   //If IO is busy, abort immediately
   if (gAudioIO->IsBusy()){
      SetButton(false,mButtons[TTB_EndOff]);
      return;
   }
   mVk->AdjustThreshold(GetSensitivity());
   AudacityProject *p = GetActiveProject();
   TrackList *tl = p->GetTracks();
   TrackListOfKindIterator iter(Track::Wave, tl);

   Track *t = iter.First();   //Make a track
   if(t) {
      auto wt = static_cast<const WaveTrack*>(t);
      sampleCount start, len;
      GetSamples(wt, &start, &len);

      //Adjust length to end if selection is null
      if(len == 0) {
         len = start;
         start = 0;
      }
      auto newEnd = mVk->OffBackward(*wt, start + len, len);
      double newpos = newEnd.as_double() / wt->GetRate();

      p->SetSel1(newpos);
      p->RedrawProject();

      SetButton(false, mButtons[TTB_EndOff]);
   }
}
开发者ID:finefin,项目名称:audacity,代码行数:33,代码来源:TranscriptionToolBar.cpp

示例9: GetActiveProject

void Theme::ApplyUpdatedImages()
{
   AudacityProject *p = GetActiveProject();
   if( p->GetControlToolBar() )
   {
      p->GetControlToolBar()->ReCreateButtons();     
   }
}
开发者ID:andreipaga,项目名称:audacity,代码行数:8,代码来源:Theme.cpp

示例10: GetActiveProject

// in response of a print-document apple event
void AudacityApp::MacPrintFile(const wxString &fileName)
{
   AudacityProject *project = GetActiveProject();
   if (project == NULL || !project->GetTracks()->IsEmpty()) {
      project = CreateNewAudacityProject(gParentWindow);
   }
   project->OpenFile(fileName);
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:9,代码来源:AudacityApp.cpp

示例11: WXUNUSED

void ControlToolBar::OnPlay(wxCommandEvent & WXUNUSED(evt))
{
   StopPlaying();

   AudacityProject *p = GetActiveProject();
   if (p) p->TP_DisplaySelection();

   PlayDefault();
}
开发者ID:PhilSee,项目名称:audacity,代码行数:9,代码来源:ControlToolBar.cpp

示例12: GetActiveProject

void TranscriptionToolBar::EnableDisableButtons()
{
#ifdef EXPERIMENTAL_VOICE_DETECTION
   AudacityProject *p = GetActiveProject();
   if (!p) return;
   // Is anything selected?
   auto selection = p->GetSel0() < p->GetSel1() && p->GetTracks()->Selected();

   mButtons[TTB_Calibrate]->SetEnabled(selection);
#endif
}
开发者ID:SteveDaulton,项目名称:audacity,代码行数:11,代码来源:TranscriptionToolBar.cpp

示例13: EnablePauseCommand

void ControlToolBar::EnablePauseCommand(bool bEnable)
{
   // Enable/disable the "P" key command. 
   // GetActiveProject() won't work for all callers, e.g., MakeButton(), because it hasn't finished initializing.
   AudacityProject* pProj = (AudacityProject*)GetParent(); 
   if (pProj)
   {
      CommandManager* pCmdMgr = pProj->GetCommandManager();
      if (pCmdMgr)
         pCmdMgr->Enable(wxT("Pause"), bEnable);
   }
}
开发者ID:andreipaga,项目名称:audacity,代码行数:12,代码来源:ControlToolBar.cpp

示例14: Apply

bool SelectTimeCommand::Apply(const CommandContext & context){
   // Many commands need focus on track panel.
   // No harm in setting it with a scripted select.
   context.GetProject()->GetTrackPanel()->SetFocus();
   if( !bHasT0 && !bHasT1 )
      return true;

   // Defaults if no value...
   if( !bHasT0 )
      mT0 = 0.0;
   if( !bHasT1 )
      mT1 = 0.0;
   if( !bHasRelativeSpec )
      mRelativeTo = 0;

   AudacityProject * p = context.GetProject();
   double end = p->GetTracks()->GetEndTime();
   double t0;
   double t1;

   const auto &selectedRegion = p->GetViewInfo().selectedRegion;
   switch( bHasRelativeSpec ? mRelativeTo : 0 ){
   default:
   case 0: //project start
      t0 = mT0;
      t1 = mT1;
      break;
   case 1: //project
      t0 = mT0;
      t1 = end + mT1;
      break;
   case 2: //project end;
      t0 = end - mT0;
      t1 = end - mT1;
      break;
   case 3: //selection start
      t0 = mT0 + selectedRegion.t0();
      t1 = mT1 + selectedRegion.t0();
      break;
   case 4: //selection
      t0 = mT0 + selectedRegion.t0();
      t1 = mT1 + selectedRegion.t1();
      break;
   case 5: //selection end
      t0 =  selectedRegion.t1() - mT0;
      t1 =  selectedRegion.t1() - mT1;
      break;
   }

   p->mViewInfo.selectedRegion.setTimes( t0, t1);
   return true;
}
开发者ID:SteveDaulton,项目名称:audacity,代码行数:52,代码来源:SelectCommand.cpp

示例15: GetActiveProject

void ControlToolBar::OnBatch(wxCommandEvent &evt)
{
   AudacityProject *proj = GetActiveProject();
   proj->OnApplyChain();

   mPlay->Enable();
   mStop->Enable();
   mRewind->Enable();
   mFF->Enable();
   mPause->Disable();
   mBatch->Enable();
   mBatch->PopUp();
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:13,代码来源:ControlToolBar.cpp


注:本文中的AudacityProject类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。