Audacity  3.0.3
TranscriptionToolBar.cpp
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  TranscriptionToolBar.cpp
6 
7  Shane T. Mueller
8  Leland Lucius
9 
10 *******************************************************************//*******************************************************************/
16 
17 
18 #include "TranscriptionToolBar.h"
19 #include "ToolManager.h"
20 
21 // For compilers that support precompilation, includes "wx/wx.h".
22 #include <wx/wxprec.h>
23 
24 #ifndef WX_PRECOMP
25 #include <wx/choice.h>
26 #include <wx/defs.h>
27 #include <wx/brush.h>
28 #include <wx/image.h>
29 #include <wx/intl.h>
30 #endif // WX_PRECOMP
31 
32 #include "../Envelope.h"
33 
34 #include "AllThemeResources.h"
35 #include "../AudioIO.h"
36 #include "ImageManipulation.h"
37 #include "../KeyboardCapture.h"
38 #include "Project.h"
39 #include "../ProjectAudioManager.h"
40 #include "../ProjectSettings.h"
41 #include "../Envelope.h"
42 #include "ViewInfo.h"
43 #include "../WaveTrack.h"
44 #include "../widgets/AButton.h"
45 #include "../widgets/ASlider.h"
46 #include "../tracks/ui/Scrubbing.h"
47 #include "Prefs.h"
48 
49 #ifdef EXPERIMENTAL_VOICE_DETECTION
50 #include "../VoiceKey.h"
51 #include "../ProjectWindow.h"
52 #endif
53 
55 
59 
60 
61 BEGIN_EVENT_TABLE(TranscriptionToolBar, ToolBar)
63  EVT_COMMAND(wxID_ANY, EVT_CAPTURE_KEY, TranscriptionToolBar::OnCaptureKey)
64 
67  EVT_SLIDER(TTB_PlaySpeedSlider, TranscriptionToolBar::OnSpeedSlider)
68 
69 #ifdef EXPERIMENTAL_VOICE_DETECTION
70  EVT_COMMAND_RANGE(TTB_StartOn, TTB_StartOn,
71  wxEVT_COMMAND_BUTTON_CLICKED, TranscriptionToolBar::OnStartOn)
72  EVT_COMMAND_RANGE(TTB_StartOff, TTB_StartOff,
73  wxEVT_COMMAND_BUTTON_CLICKED, TranscriptionToolBar::OnStartOff)
74  EVT_COMMAND_RANGE(TTB_EndOn, TTB_EndOn,
75  wxEVT_COMMAND_BUTTON_CLICKED, TranscriptionToolBar::OnEndOn)
76  EVT_COMMAND_RANGE(TTB_EndOff, TTB_EndOff,
77  wxEVT_COMMAND_BUTTON_CLICKED, TranscriptionToolBar::OnEndOff)
78  EVT_COMMAND_RANGE(TTB_SelectSound, TTB_SelectSound,
79  wxEVT_COMMAND_BUTTON_CLICKED, TranscriptionToolBar::OnSelectSound)
80  EVT_COMMAND_RANGE(TTB_SelectSilence, TTB_SelectSilence,
81  wxEVT_COMMAND_BUTTON_CLICKED, TranscriptionToolBar::OnSelectSilence)
82  EVT_COMMAND_RANGE(TTB_AutomateSelection, TTB_AutomateSelection,
83  wxEVT_COMMAND_BUTTON_CLICKED, TranscriptionToolBar::OnAutomateSelection)
84  EVT_COMMAND_RANGE(TTB_MakeLabel, TTB_MakeLabel,
85  wxEVT_COMMAND_BUTTON_CLICKED, TranscriptionToolBar::OnMakeLabel)
86  EVT_COMMAND_RANGE(TTB_Calibrate, TTB_Calibrate,
87  wxEVT_COMMAND_BUTTON_CLICKED, TranscriptionToolBar::OnCalibrate)
88  EVT_SLIDER(TTB_SensitivitySlider, TranscriptionToolBar::OnSensitivitySlider)
89 
90  EVT_CHOICE(TTB_KeyType, TranscriptionToolBar::SetKeyType)
91 #endif
93  ; //semicolon enforces proper automatic indenting in emacs.
94 
97 : ToolBar( project,
98  TranscriptionBarID, XO("Play-at-Speed"), wxT("Transcription"), true )
99 {
100  SetPlaySpeed( 1.0 * 100.0 );
101 #ifdef EXPERIMENTAL_VOICE_DETECTION
102  mVk = std::make_unique<VoiceKey>();
103 #endif
104 }
105 
107 {
108 }
109 
111 {
112  auto &toolManager = ToolManager::Get( project );
113  return *static_cast<TranscriptionToolBar*>( toolManager.GetToolBar(TranscriptionBarID) );
114 }
115 
117 {
118  return Get( const_cast<AudacityProject&>( project )) ;
119 }
120 
121 void TranscriptionToolBar::Create(wxWindow * parent)
122 {
123  ToolBar::Create(parent);
124 
125  mBackgroundHeight = 0;
126  mBackgroundWidth = 0;
127 
128 #ifdef EXPERIMENTAL_VOICE_DETECTION
129  mButtons[TTB_StartOn]->Disable();
130  mButtons[TTB_StartOff]->Disable();
131  mButtons[TTB_EndOn]->Disable();
132  mButtons[TTB_EndOff]->Disable();
133  mButtons[TTB_SelectSound]->Disable();
134  mButtons[TTB_SelectSilence]->Disable();
135  mButtons[TTB_Calibrate]->Enable();
136  mButtons[TTB_AutomateSelection]->Disable();
137  mButtons[TTB_MakeLabel]->Enable();
138 #endif
139 
140  //Old code...
141  //Process a dummy event to set up mPlaySpeed
142  //wxCommandEvent dummy;
143  //OnSpeedSlider(dummy);
144 
145  //JKC: Set speed this way is better, as we don't
146  //then stop Audio if it is playing, so we can be playing
147  //audio and open a second project.
148  SetPlaySpeed( (mPlaySpeedSlider->Get()) * 100 );
149 
150  // Simulate a size event to set initial placement/size
151  wxSizeEvent event(GetSize(), GetId());
152  event.SetEventObject(this);
153  GetEventHandler()->ProcessEvent(event);
154 }
155 
157 {
158  mPlaySpeed = value;
160 }
161 
166  TranscriptionToolBar *pBar,
167  teBmps eFore, teBmps eDisabled,
168  int id,
169  const TranslatableString &label)
170 {
171  AButton *&r = pBar->mButtons[id];
172 
173  r = ToolBar::MakeButton(pBar,
174  bmpRecoloredUpSmall, bmpRecoloredDownSmall, bmpRecoloredUpHiliteSmall,bmpRecoloredHiliteSmall,
175  eFore, eFore, eDisabled,
176  wxWindowID(id),
177  wxDefaultPosition,
178  false,
179  theTheme.ImageSize( bmpRecoloredUpSmall ));
180 
181  r->SetLabel(label);
182 // JKC: Unlike ControlToolBar, does not have a focus rect. Shouldn't it?
183 // r->SetFocusRect( r->GetRect().Deflate( 4, 4 ) );
184 
185  pBar->Add( r, 0, wxALIGN_CENTER );
186 
187  return r;
188 }
189 
191  teBmps eFore, teBmps eDisabled,
192  int id, unsigned altIdx)
193 {
195  bmpRecoloredUpSmall, bmpRecoloredDownSmall, bmpRecoloredUpHiliteSmall,bmpRecoloredHiliteSmall,
196  eFore, eFore, eDisabled,
197  theTheme.ImageSize( bmpRecoloredUpSmall ));
198 }
199 
201 {
202  SetBackgroundColour( theTheme.Colour( clrMedium ) );
203 // Very similar to code in ControlToolBar...
204 // Very similar to code in EditToolBar
206 
207  AddButton(this, bmpPlay, bmpPlayDisabled, TTB_PlaySpeed,
208  XO("Play at selected speed"));
209  // 3.1.0 abandoned distinct images for Shift
210  MakeAlternateImages(bmpPlay, bmpPlayDisabled, TTB_PlaySpeed, 1);
211  MakeAlternateImages(bmpCutPreview, bmpCutPreviewDisabled, TTB_PlaySpeed, 2);
213 
214  //Add a slider that controls the speed of playback.
215  const int SliderWidth=100;
218  XO("Playback Speed"),
219  wxDefaultPosition,
220  wxSize(SliderWidth,25),
222  .Style( SPEED_SLIDER )
223  // 6 steps using page up/down, and 60 using arrow keys
224  .Line( 0.16667f )
225  .Page( 1.6667f )
226  );
227  mPlaySpeedSlider->SetSizeHints(wxSize(100, 25), wxSize(2000, 25));
228  mPlaySpeedSlider->Set(mPlaySpeed / 100.0);
229  mPlaySpeedSlider->SetLabel(_("Playback Speed"));
230  Add( mPlaySpeedSlider, 1, wxALIGN_CENTER );
231  mPlaySpeedSlider->Bind(wxEVT_SET_FOCUS,
233  this);
234  mPlaySpeedSlider->Bind(wxEVT_KILL_FOCUS,
236  this);
237 
238 #ifdef EXPERIMENTAL_VOICE_DETECTION
239 // If we need these strings translated, then search and replace
240 // YO by XO and remove this #define.
241 #define YO( x ) Verbatim( x )
242  AddButton(this, bmpTnStartOn, bmpTnStartOnDisabled, TTB_StartOn,
243  YO("Adjust left selection to next onset"));
244  AddButton(this, bmpTnEndOn, bmpTnEndOnDisabled, TTB_EndOn,
245  YO("Adjust right selection to previous offset"));
246  AddButton(this, bmpTnStartOff, bmpTnStartOffDisabled, TTB_StartOff,
247  YO("Adjust left selection to next offset"));
248  AddButton(this, bmpTnEndOff, bmpTnEndOffDisabled, TTB_EndOff,
249  YO("Adjust right selection to previous onset"));
250  AddButton(this, bmpTnSelectSound, bmpTnSelectSoundDisabled, TTB_SelectSound,
251  YO("Select region of sound around cursor"));
252  AddButton(this, bmpTnSelectSilence, bmpTnSelectSilenceDisabled, TTB_SelectSilence,
253  YO("Select region of silence around cursor"));
254  AddButton(this, bmpTnAutomateSelection, bmpTnAutomateSelectionDisabled, TTB_AutomateSelection,
255  YO("Automatically make labels from words"));
256  AddButton(this, bmpTnMakeTag, bmpTnMakeTagDisabled, TTB_MakeLabel,
257  YO("Add label at selection"));
258  AddButton(this, bmpTnCalibrate, bmpTnCalibrateDisabled, TTB_Calibrate,
259  YO("Calibrate voicekey"));
260 
262  TTB_SensitivitySlider,
263  YO("Adjust Sensitivity"),
264  wxDefaultPosition,
265  wxSize(SliderWidth,25),
267  .Style( SPEED_SLIDER ));
268  mSensitivitySlider->Set(.5);
269  mSensitivitySlider->SetLabel(YO("Sensitivity").Translation());
270  Add( mSensitivitySlider, 0, wxALIGN_CENTER );
271 
272  TranslatableStrings choices {
273  YO("Energy"),
274  YO("Sign Changes (Low Threshold)"),
275  YO("Sign Changes (High Threshold)"),
276  YO("Direction Changes (Low Threshold)"),
277  YO("Direction Changes (High Threshold)")
278  };
279 
280  mKeyTypeChoice = safenew wxChoice(this, TTB_KeyType,
281  wxDefaultPosition,
282  wxDefaultSize,
283  transform_container<wxArrayStringEx>( choices,
284  std::mem_fn( &TranslatableString::Translation ) ) );
285  mKeyTypeChoice->SetName(YO("Key type").Translation());
286  mKeyTypeChoice->SetSelection(0);
287  Add( mKeyTypeChoice, 0, wxALIGN_CENTER );
288 #endif
289 
290  // Add a little space
291  Add(2, -1);
292 
293  UpdatePrefs();
294 }
295 
297 {
299 
300  auto gAudioIO = AudioIO::Get();
301  bool canStopAudioStream = (!gAudioIO->IsStreamActive() ||
302  gAudioIO->IsMonitoring() ||
303  gAudioIO->GetOwningProject().get() == p );
304  bool recording = gAudioIO->GetNumCaptureChannels() > 0;
305 
306  // Only interested in audio type tracks
307  bool tracks = p && TrackList::Get( *p ).Any<AudioTrack>(); // PRL: PlayableTrack ?
308  SetEnabled( canStopAudioStream && tracks && !recording );
309 
310 #ifdef EXPERIMENTAL_VOICE_DETECTION
311  if (!p)
312  return;
313  // Is anything selected?
314  const auto &selectedRegion = ViewInfo::Get( *p ).selectedRegion;
315  auto selection = !selectedRegion.isPoint() &&
316  !TrackList::Get( *p ).Selected().empty();
317 
318  mButtons[TTB_Calibrate]->SetEnabled(selection);
319 #endif
320 }
321 
323 {
325 
326  // Set label to pull in language change
327  SetLabel(XO("Play-at-Speed"));
328 
329  // Give base class a chance
331 }
332 
334 {
335  // We could also mention the shift- and ctrl-modified versions in the
336  // tool tip... but it would get long
337 
338  static const struct Entry {
339  int tool;
340  CommandID commandName;
341  TranslatableString untranslatedLabel;
342  CommandID commandName2;
343  TranslatableString untranslatedLabel2;
344  } table[] = {
345  { TTB_PlaySpeed,
346  wxT("PlayAtSpeedLooped"), XO("Play-at-Speed"),
347  wxT("PlayAtSpeed"), XO("Play-at-Speed Once"),
348  },
349  };
350 
351  for (const auto &entry : table) {
352  ComponentInterfaceSymbol commands[] = {
353  { entry.commandName, entry.untranslatedLabel },
354  { entry.commandName2, entry.untranslatedLabel2 },
355  };
357  *mButtons[entry.tool], commands, 2u );
358  }
359 
360 #ifdef EXPERIMENTAL_VOICE_DETECTION
361  mButtons[TTB_StartOn]->SetToolTip(YO("Left-to-On"));
362  mButtons[TTB_EndOn]->SetToolTip( YO("Right-to-Off"));
363  mButtons[TTB_StartOff]->SetToolTip( YO("Left-to-Off"));
364  mButtons[TTB_EndOff]->SetToolTip( YO("Right-to-On"));
365  mButtons[TTB_SelectSound]->SetToolTip( YO("Select-Sound"));
366  mButtons[TTB_SelectSilence]->SetToolTip( YO("Select-Silence"));
367  mButtons[TTB_AutomateSelection]->SetToolTip( YO("Make Labels"));
368  mButtons[TTB_MakeLabel]->SetToolTip( YO("Add Label"));
369  mButtons[TTB_Calibrate]->SetToolTip( YO("Calibrate"));
370 
371  mSensitivitySlider->SetToolTip(YO("Sensitivity").Translation());
372  mKeyTypeChoice->SetToolTip(YO("Key type").Translation());
373 #endif
374 }
375 
376 void TranscriptionToolBar::OnFocus(wxFocusEvent &event)
377 {
378  KeyboardCapture::OnFocus( *this, event );
379 }
380 
381 void TranscriptionToolBar::OnCaptureKey(wxCommandEvent &event)
382 {
383  wxKeyEvent *kevent = (wxKeyEvent *)event.GetEventObject();
384  int keyCode = kevent->GetKeyCode();
385 
386  // Pass LEFT/RIGHT/UP/DOWN/PAGEUP/PAGEDOWN through for input/output sliders
387  if (FindFocus() == mPlaySpeedSlider && (keyCode == WXK_LEFT || keyCode == WXK_RIGHT
388  || keyCode == WXK_UP || keyCode == WXK_DOWN
389  || keyCode == WXK_PAGEUP || keyCode == WXK_PAGEDOWN)) {
390  return;
391  }
392 
393  event.Skip();
394 
395  return;
396 }
397 
398 //This handles key-stroke events????
399 void TranscriptionToolBar::OnKeyEvent(wxKeyEvent & event)
400 {
401  if (event.ControlDown()) {
402  event.Skip();
403  return;
404  }
405 
406  if (event.GetKeyCode() == WXK_SPACE) {
407  auto gAudioIO = AudioIOBase::Get();
408  if (gAudioIO->IsBusy()) {
409  /*Do Stuff Here*/
410  }
411  else {
412  /*Do other stuff Here*/
413  }
414  }
415 }
416 
417 
418 
419 //This changes the state of the various buttons
420 void TranscriptionToolBar::SetButton(bool down, AButton* button)
421 {
422  if (down) {
423  button->PushDown();
424  }
425  else {
426  button->PopUp();
427  }
428 }
429 
431  const WaveTrack *t, sampleCount *s0, sampleCount *slen)
432 {
433  // GetSamples attempts to translate the start and end selection markers into sample indices
434  // These selection numbers are doubles.
435 
437  if (!p) {
438  return;
439  }
440 
441  //First, get the current selection. It is part of the mViewInfo, which is
442  //part of the project
443 
444  const auto &selectedRegion = ViewInfo::Get( *p ).selectedRegion;
445  double start = selectedRegion.t0();
446  double end = selectedRegion.t1();
447 
448  auto ss0 = sampleCount( (start - t->GetOffset()) * t->GetRate() );
449  auto ss1 = sampleCount( (end - t->GetOffset()) * t->GetRate() );
450 
451  if (start < t->GetOffset()) {
452  ss0 = 0;
453  }
454 
455 #if 0
456  //This adjusts the right samplecount to the maximum sample.
457  if (ss1 >= t->GetNumSamples()) {
458  ss1 = t->GetNumSamples();
459  }
460 #endif
461 
462  if (ss1 < ss0) {
463  ss1 = ss0;
464  }
465 
466  *s0 = ss0;
467  *slen = ss1 - ss0;
468 }
469 
470 // PRL: duplicating constants from TimeTrack.cpp
471 //TODO-MB: are these sensible values?
472 #define TIMETRACK_MIN 0.01
473 #define TIMETRACK_MAX 10.0
474 
475 // Come here from button clicks, or commands
476 void TranscriptionToolBar::PlayAtSpeed(bool looped, bool cutPreview)
477 {
478  // Can't do anything without an active project
480  if (!p) {
481  return;
482  }
483 
484  auto &projectAudioManager = ProjectAudioManager::Get( mProject );
485 
486  // Fixed speed play is the old method, that uses a time track.
487  // VariSpeed play reuses Scrubbing.
488  bool bFixedSpeedPlay = !gPrefs->ReadBool(wxT("/AudioIO/VariSpeedPlay"), true);
489  // Scrubbing doesn't support note tracks, but the fixed-speed method using time tracks does.
490  if ( TrackList::Get( *p ).Any< NoteTrack >() )
491  bFixedSpeedPlay = true;
492 
493  // Scrubbing only supports straight through play.
494  // So if looped or cutPreview, we have to fall back to fixed speed.
495  if (looped)
496  cutPreview = false;
497  bFixedSpeedPlay = bFixedSpeedPlay || looped || cutPreview;
498  if (bFixedSpeedPlay)
499  {
500  // Create a BoundedEnvelope if we haven't done so already
501  if (!mEnvelope) {
502  mEnvelope =
503  std::make_unique<BoundedEnvelope>(
504  true, TIMETRACK_MIN, TIMETRACK_MAX, 1.0);
505  // values as in the constructor for TimeTrack
506  mEnvelope->SetRangeLower( 0.9 );
507  mEnvelope->SetRangeUpper( 1.1 );
508  }
509  // Set the speed range
510  //mTimeTrack->SetRangeUpper((double)mPlaySpeed / 100.0);
511  //mTimeTrack->SetRangeLower((double)mPlaySpeed / 100.0);
512  mEnvelope->Flatten((double)mPlaySpeed / 100.0);
513  }
514 
515  // Pop up the button
517 
518  // If IO is busy, abort immediately
519  auto gAudioIO = AudioIOBase::Get();
520  if (gAudioIO->IsBusy())
521  projectAudioManager.Stop();
522 
523  // Get the current play region
524  const auto &viewInfo = ViewInfo::Get( *p );
525  const auto &playRegion = viewInfo.playRegion;
526 
527  // Start playing
528  if (playRegion.GetStart() < 0)
529  return;
530  if (bFixedSpeedPlay)
531  {
532  auto options = DefaultPlayOptions( *p, looped );
533  // No need to set cutPreview options.
534  options.envelope = mEnvelope.get();
535  auto mode =
536  cutPreview ? PlayMode::cutPreviewPlay
537  : looped ? PlayMode::loopedPlay
539  projectAudioManager.PlayPlayRegion(
540  SelectedRegion(playRegion.GetStart(), playRegion.GetEnd()),
541  options,
542  mode);
543  }
544  else
545  {
546  auto &scrubber = Scrubber::Get( *p );
547  scrubber.StartSpeedPlay(GetPlaySpeed(),
548  playRegion.GetStart(), playRegion.GetEnd());
549  }
550 }
551 
552 // Come here from button clicks only
553 void TranscriptionToolBar::OnPlaySpeed(wxCommandEvent & WXUNUSED(event))
554 {
555  auto button = mButtons[TTB_PlaySpeed];
556 
557  // Let control have precedence over shift
558  const bool cutPreview = mButtons[TTB_PlaySpeed]->WasControlDown();
559  const bool looped = !cutPreview &&
560  !button->WasShiftDown();
561  PlayAtSpeed(looped, cutPreview);
562 }
563 
564 void TranscriptionToolBar::OnSpeedSlider(wxCommandEvent& WXUNUSED(event))
565 {
566  SetPlaySpeed( (mPlaySpeedSlider->Get()) * 100 );
568 
569  // If IO is busy, abort immediately
570  // AWD: This is disabled to work around a hang on Linux when PulseAudio is
571  // used. If we figure that one out we can re-enable this code.
572  // auto gAudioIO = AudioIOBase::Get();
573  //if (gAudioIO->IsBusy()) {
574  // OnPlaySpeed(event);
575  //}
576 }
577 
578 #ifdef EXPERIMENTAL_VOICE_DETECTION
579 void TranscriptionToolBar::OnStartOn(wxCommandEvent & WXUNUSED(event))
580 {
581  //If IO is busy, abort immediately
582  auto gAudioIO = AudioIOBase::Get();
583  if (gAudioIO->IsBusy()){
584  SetButton(false,mButtons[TTB_StartOn]);
585  return;
586  }
587 
588  mVk->AdjustThreshold(GetSensitivity());
589 
590  auto t = *TrackList::Get( mProject ).Any< const WaveTrack >().begin();
591  if(t ) {
592  auto wt = static_cast<const WaveTrack*>(t);
593  sampleCount start, len;
594  GetSamples(wt, &start, &len);
595 
596  //Adjust length to end if selection is null
597  //if(len == 0)
598  //len = wt->GetSequence()->GetNumSamples()-start;
599 
600  auto newstart = mVk->OnForward(*wt, start, len);
601  double newpos = newstart.as_double() / wt->GetRate();
602 
603  auto &selectedRegion = ViewInfo::Get( mProject ).selectedRegion;
604  selectedRegion.setT0( newpos );
606 
607  SetButton(false, mButtons[TTB_StartOn]);
608  }
609 }
610 
611 void TranscriptionToolBar::OnStartOff(wxCommandEvent & WXUNUSED(event))
612 {
613  //If IO is busy, abort immediately
614  auto gAudioIO = AudioIOBase::Get();
615  if (gAudioIO->IsBusy()){
616  SetButton(false,mButtons[TTB_StartOff]);
617  return;
618  }
619  mVk->AdjustThreshold(GetSensitivity());
621 
622  SetButton(false, mButtons[TTB_StartOff]);
623  auto t = *TrackList::Get( mProject ).Any< const WaveTrack >().begin();
624  if(t) {
625  auto wt = static_cast<const WaveTrack*>(t);
626  sampleCount start, len;
627  GetSamples(wt, &start, &len);
628 
629  //Adjust length to end if selection is null
630  //if(len == 0)
631  //len = wt->GetSequence()->GetNumSamples()-start;
632 
633  auto newstart = mVk->OffForward(*wt, start, len);
634  double newpos = newstart.as_double() / wt->GetRate();
635 
636  auto &selectedRegion = ViewInfo::Get( mProject ).selectedRegion;
637  selectedRegion.setT0( newpos );
639 
640  SetButton(false, mButtons[TTB_StartOn]);
641  }
642 }
643 
644 void TranscriptionToolBar::OnEndOn(wxCommandEvent & WXUNUSED(event))
645 {
646 
647  //If IO is busy, abort immediately
648  auto gAudioIO = AudioIOBase::Get();
649  if (gAudioIO->IsBusy()){
650  SetButton(false,mButtons[TTB_EndOn]);
651  return;
652  }
653 
654  mVk->AdjustThreshold(GetSensitivity());
656  auto t = *TrackList::Get( mProject ).Any< const WaveTrack >().begin();
657  if(t) {
658  auto wt = static_cast<const WaveTrack*>(t);
659  sampleCount start, len;
660  GetSamples(wt, &start, &len);
661 
662  //Adjust length to end if selection is null
663  if(len == 0)
664  {
665  len = start;
666  start = 0;
667  }
668  auto newEnd = mVk->OnBackward(*wt, start + len, len);
669  double newpos = newEnd.as_double() / wt->GetRate();
670 
671  auto &selectedRegion = ViewInfo::Get( mProject ).selectedRegion;
672  selectedRegion.setT1( newpos );
674 
675  SetButton(false, mButtons[TTB_EndOn]);
676  }
677 }
678 
679 
680 
681 void TranscriptionToolBar::OnEndOff(wxCommandEvent & WXUNUSED(event))
682 {
683 
684  //If IO is busy, abort immediately
685  auto gAudioIO = AudioIOBase::Get();
686  if (gAudioIO->IsBusy()){
687  SetButton(false,mButtons[TTB_EndOff]);
688  return;
689  }
690  mVk->AdjustThreshold(GetSensitivity());
692 
693  auto t = *TrackList::Get( mProject ).Any< const WaveTrack >().begin();
694  if(t) {
695  auto wt = static_cast<const WaveTrack*>(t);
696  sampleCount start, len;
697  GetSamples(wt, &start, &len);
698 
699  //Adjust length to end if selection is null
700  if(len == 0) {
701  len = start;
702  start = 0;
703  }
704  auto newEnd = mVk->OffBackward(*wt, start + len, len);
705  double newpos = newEnd.as_double() / wt->GetRate();
706 
707  auto &selectedRegion = ViewInfo::Get( mProject ).selectedRegion;
708  selectedRegion.setT1( newpos );
710 
711  SetButton(false, mButtons[TTB_EndOff]);
712  }
713 }
714 
715 
716 
717 void TranscriptionToolBar::OnSelectSound(wxCommandEvent & WXUNUSED(event))
718 {
719 
720  //If IO is busy, abort immediately
721  auto gAudioIO = AudioIOBase::Get();
722  if (gAudioIO->IsBusy()){
723  SetButton(false,mButtons[TTB_SelectSound]);
724  return;
725  }
726 
727 
728  mVk->AdjustThreshold(GetSensitivity());
729 
730 
732  if(auto wt = *tl->Any<const WaveTrack>().begin()) {
733  sampleCount start, len;
734  GetSamples(wt, &start, &len);
735 
736  //Adjust length to end if selection is null
737  //if(len == 0)
738  //len = wt->GetSequence()->GetNumSamples()-start;
739 
740  double rate = wt->GetRate();
741  auto newstart = mVk->OffBackward(*wt, start, start);
742  auto newend =
743  mVk->OffForward(*wt, start + len, (int)(tl->GetEndTime() * rate));
744 
745  //reset the selection bounds.
746  auto &selectedRegion = ViewInfo::Get( mProject ).selectedRegion;
747  selectedRegion.setTimes(
748  newstart.as_double() / rate, newend.as_double() / rate );
750 
751  }
752 
753  SetButton(false,mButtons[TTB_SelectSound]);
754 }
755 
756 void TranscriptionToolBar::OnSelectSilence(wxCommandEvent & WXUNUSED(event))
757 {
758 
759  //If IO is busy, abort immediately
760  auto gAudioIO = AudioIOBase::Get();
761  if (gAudioIO->IsBusy()){
762  SetButton(false,mButtons[TTB_SelectSilence]);
763  return;
764  }
765 
766  mVk->AdjustThreshold(GetSensitivity());
767 
768 
770  if(auto wt = *tl->Any<const WaveTrack>().begin()) {
771  sampleCount start, len;
772  GetSamples(wt, &start, &len);
773 
774  //Adjust length to end if selection is null
775  //if(len == 0)
776  //len = wt->GetSequence()->GetNumSamples()-start;
777  double rate = wt->GetRate();
778  auto newstart = mVk->OnBackward(*wt, start, start);
779  auto newend =
780  mVk->OnForward(*wt, start + len, (int)(tl->GetEndTime() * rate));
781 
782  //reset the selection bounds.
783  auto &selectedRegion = ViewInfo::Get( mProject ).selectedRegion;
784  selectedRegion.setTimes(
785  newstart.as_double() / rate, newend.as_double() / rate);
787 
788  }
789 
790  SetButton(false,mButtons[TTB_SelectSilence]);
791 
792 }
793 
794 
795 
796 void TranscriptionToolBar::OnCalibrate(wxCommandEvent & WXUNUSED(event))
797 {
798  //If IO is busy, abort immediately
799  auto gAudioIO = AudioIOBase::Get();
800  if (gAudioIO->IsBusy()){
801  SetButton(false,mButtons[TTB_Calibrate]);
802  return;
803  }
804 
805 
807  if(auto wt = *tl->Any<const WaveTrack>().begin()) {
808  sampleCount start, len;
809  GetSamples(wt, &start, &len);
810 
811  mVk->CalibrateNoise(*wt, start, len);
812  mVk->AdjustThreshold(3);
813 
814  mButtons[TTB_StartOn]->Enable();
815  mButtons[TTB_StartOff]->Enable();
816  mButtons[TTB_EndOn]->Enable();
817  mButtons[TTB_EndOff]->Enable();
818  //mThresholdSensitivity->Set(3);
819 
820  SetButton(false,mButtons[TTB_Calibrate]);
821  }
822 
823  mButtons[TTB_StartOn]->Enable();
824  mButtons[TTB_StartOff]->Enable();
825  mButtons[TTB_EndOn]->Enable();
826  mButtons[TTB_EndOff]->Enable();
827  mButtons[TTB_SelectSound]->Enable();
828  mButtons[TTB_SelectSilence]->Enable();
829  mButtons[TTB_AutomateSelection]->Enable();
830 
831  //Make the sensitivity slider set the sensitivity by processing an event.
832  wxCommandEvent dummy;
833  OnSensitivitySlider(dummy);
834 
835 }
836 
837 #include "../LabelTrack.h"
838 #include "../ProjectHistory.h"
839 #include "../TrackPanel.h"
840 #include "../TrackPanelAx.h"
841 #include "../tracks/labeltrack/ui/LabelTrackView.h"
842 namespace {
843 int DoAddLabel(
844  AudacityProject &project, const SelectedRegion &region )
845 {
846  auto &tracks = TrackList::Get( project );
847  auto &trackFocus = TrackFocus::Get( project );
848  auto &trackPanel = TrackPanel::Get( project );
849  auto &window = ProjectWindow::Get( project );
850 
851  wxString title; // of label
852 
853  // If the focused track is a label track, use that
854  const auto pFocusedTrack = trackFocus.Get();
855 
856  // Look for a label track at or after the focused track
857  auto iter = pFocusedTrack
858  ? tracks.Find(pFocusedTrack)
859  : tracks.Any().begin();
860  auto lt = * iter.Filter< LabelTrack >();
861 
862  // If none found, start a NEW label track and use it
863  if (!lt)
864  lt = tracks.Add( std::make_shared<LabelTrack>() );
865 
866 // LLL: Commented as it seemed a little forceful to remove users
867 // selection when adding the label. This does not happen if
868 // you select several tracks and the last one of those is a
869 // label track...typing a label will not clear the selections.
870 //
871 // SelectNone();
872  lt->SetSelected(true);
873 
874  int index;
875  int focusTrackNumber = -1;
876  index =
877  LabelTrackView::Get( *lt ).AddLabel(region, title, focusTrackNumber);
878 
879  ProjectHistory::Get( project )
880  .PushState(XO("Added label"), XO("Label"));
881 
882  TrackFocus::Get(project).Set(lt);
883  lt->EnsureVisible();
884 
885  trackPanel.SetFocus();
886 
887  return index;
888 }
889 }
890 
891 //This automates selection through a selected region,
892 //selecting its best guess for words and creating labels at those points.
893 
894 void TranscriptionToolBar::OnAutomateSelection(wxCommandEvent & WXUNUSED(event))
895 {
896 
897 
898  //If IO is busy, abort immediately
899  auto gAudioIO = AudioIOBase::Get();
900  if (gAudioIO->IsBusy())
901  {
902  SetButton(false,mButtons[TTB_EndOff]);
903  return;
904  }
905 
906  wxBusyCursor busy;
907 
908  mVk->AdjustThreshold(GetSensitivity());
910  if(auto wt = *tl->Any<const WaveTrack>().begin()) {
911  sampleCount start, len;
912  GetSamples(wt, &start, &len);
913 
914  //Adjust length to end if selection is null
915  if(len == 0)
916  {
917  len = start;
918  start = 0;
919  }
920  sampleCount lastlen = 0;
921  double newStartPos, newEndPos;
922 
923  //This is the minimum word size in samples (.05 is 50 ms)
924  int minWordSize = (int)(wt->GetRate() * .05);
925 
926  //Continue until we have processed the entire
927  //region, or we are making no progress.
928  while(len > 0 && lastlen != len)
929  {
930 
931  lastlen = len;
932 
933  auto newStart = mVk->OnForward(*wt, start, len);
934 
935  //JKC: If no start found then don't add any labels.
936  if( newStart==start)
937  break;
938 
939  //Adjust len by the NEW start position
940  len -= (newStart - start);
941 
942  //Adjust len by the minimum word size
943  len -= minWordSize;
944 
945 
946 
947  //OK, now we have found a NEW starting point. A 'word' should be at least
948  //50 ms long, so jump ahead minWordSize
949 
950  auto newEnd =
951  mVk->OffForward(*wt, newStart + minWordSize, len);
952 
953  //If newEnd didn't move, we should give up, because
954  // there isn't another end before the end of the selection.
955  if(newEnd == (newStart + minWordSize))
956  break;
957 
958 
959  //Adjust len by the NEW word end
960  len -= (newEnd - newStart);
961 
962  //Calculate the start and end of the words, in seconds
963  newStartPos = newStart.as_double() / wt->GetRate();
964  newEndPos = newEnd.as_double() / wt->GetRate();
965 
966 
967  //Increment
968  start = newEnd;
969 
970  DoAddLabel(mProject, SelectedRegion(newStartPos, newEndPos));
972  }
973  SetButton(false, mButtons[TTB_AutomateSelection]);
974  }
975 }
976 
977 void TranscriptionToolBar::OnMakeLabel(wxCommandEvent & WXUNUSED(event))
978 {
979  SetButton(false, mButtons[TTB_MakeLabel]);
980  DoAddLabel( mProject, ViewInfo::Get( mProject ).selectedRegion );
981 }
982 
983 //This returns a double z-score between 0 and 10.
984 double TranscriptionToolBar::GetSensitivity()
985 {
986  return (double)mSensitivity;
987 }
988 
989 void TranscriptionToolBar::OnSensitivitySlider(wxCommandEvent & WXUNUSED(event))
990 {
991  mSensitivity = (mSensitivitySlider->Get());
992 }
993 
994 void TranscriptionToolBar::SetKeyType(wxCommandEvent & WXUNUSED(event))
995 {
996  int value = mKeyTypeChoice->GetSelection();
997 
998  //Only use one key type at a time.
999  switch(value)
1000  {
1001  case 0:
1002  mVk->SetKeyType(true,0,0,0,0);
1003  break;
1004  case 1:
1005  mVk->SetKeyType(0,true,0,0,0);
1006  break;
1007  case 2:
1008  mVk->SetKeyType(0,0,true,0,0);
1009  break;
1010  case 3:
1011  mVk->SetKeyType(0,0,0,true,0);
1012  break;
1013  case 4:
1014  mVk->SetKeyType(0,0,0,0,true);
1015  break;
1016  }
1017 
1018 }
1019 #endif
1020 
1022 {
1024  mPlaySpeedSlider->Refresh();
1025  wxCommandEvent e;
1026  OnSpeedSlider(e);
1027 }
1028 
1030 {
1031  mButtons[TTB_PlaySpeed]->SetEnabled(enabled);
1032 }
1033 
1034 void TranscriptionToolBar::SetPlaying(bool down, bool looped, bool cutPreview)
1035 {
1036  AButton *const button = mButtons[TTB_PlaySpeed];
1037  if (down) {
1038  button->SetAlternateIdx(cutPreview ? 2 : looped ? 1 : 0);
1039  button->PushDown();
1040  }
1041  else {
1042  button->SetAlternateIdx(0);
1043  button->PopUp();
1044  }
1045 }
1046 
1048 {
1049  if (adj < 0) {
1050  mPlaySpeedSlider->Decrease(-adj);
1051  }
1052  else {
1053  mPlaySpeedSlider->Increase(adj);
1054  }
1055  wxCommandEvent e;
1056  OnSpeedSlider(e);
1057 }
1058 
1060  []( AudacityProject &project ){
1061  return ToolBar::Holder{ safenew TranscriptionToolBar{ project } }; }
1062 };
1063 
1064 namespace {
1066  /* i18n-hint: Clicking this menu item shows the toolbar
1067  for transcription (currently just vary play speed) */
1068  TranscriptionBarID, wxT("ShowTranscriptionTB"), XXO("Pla&y-at-Speed Toolbar")
1069 };
1070 }
1071 
TranscriptionToolBar.h
PlayMode::cutPreviewPlay
@ cutPreviewPlay
TranslatableString
Holds a msgid for the translation catalog; may also bind format arguments.
Definition: TranslatableString.h:32
ViewInfo::Get
static ViewInfo & Get(AudacityProject &project)
Definition: ViewInfo.cpp:241
AButton::SetLabel
void SetLabel(const TranslatableString &label)
Definition: AButton.cpp:274
TranscriptionToolBar::SetButton
void SetButton(bool newstate, AButton *button)
Definition: TranscriptionToolBar.cpp:420
teBmps
int teBmps
Definition: ImageManipulation.h:48
LabelTrack::SetSelected
void SetSelected(bool s) override
Definition: LabelTrack.cpp:299
ASlider::Get
float Get(bool convert=true)
Definition: ASlider.cpp:1742
ToolManager.h
Scrubber::Get
static Scrubber & Get(AudacityProject &project)
Definition: Scrubbing.cpp:201
WaveTrack
A Track that contains audio waveform data.
Definition: WaveTrack.h:69
anonymous_namespace{LabelMenus.cpp}::DoAddLabel
int DoAddLabel(AudacityProject &project, const SelectedRegion &region, bool preserveFocus=false)
Definition: LabelMenus.cpp:48
ProjectAudioManager::Get
static ProjectAudioManager & Get(AudacityProject &project)
Definition: ProjectAudioManager.cpp:55
ToolBar::MakeAlternateImages
static void MakeAlternateImages(AButton &button, int idx, teBmps eUp, teBmps eDown, teBmps eHilite, teBmps eDownHi, teBmps eStandardUp, teBmps eStandardDown, teBmps eDisabled, wxSize size)
Definition: ToolBar.cpp:873
gPrefs
FileConfig * gPrefs
Definition: Prefs.cpp:70
AllThemeResources.h
EVT_COMMAND
EVT_COMMAND(wxID_ANY, EVT_FREQUENCYTEXTCTRL_UPDATED, LabelDialog::OnFreqUpdate) LabelDialog
Definition: LabelDialog.cpp:92
TranslatableStrings
std::vector< TranslatableString > TranslatableStrings
Definition: TranslatableString.h:295
TranscriptionToolBar::MakeAlternateImages
void MakeAlternateImages(teBmps eFore, teBmps eDisabled, int id, unsigned altIdx)
Definition: TranscriptionToolBar.cpp:190
IMPLEMENT_CLASS
IMPLEMENT_CLASS(TranscriptionToolBar, ToolBar)
Project.h
AButton
A wxButton with mouse-over behaviour.
Definition: AButton.h:25
TranscriptionToolBar::OnKeyEvent
void OnKeyEvent(wxKeyEvent &event)
Definition: TranscriptionToolBar.cpp:399
EVT_COMMAND_RANGE
EVT_COMMAND_RANGE(TTB_PlaySpeed, TTB_PlaySpeed, wxEVT_COMMAND_BUTTON_CLICKED, TranscriptionToolBar::OnPlaySpeed)
Methods for TranscriptionToolBar.
ASlider::Set
void Set(float value)
Definition: ASlider.cpp:1747
Track::EnsureVisible
void EnsureVisible(bool modifyState=false)
Definition: Track.cpp:100
anonymous_namespace{TranscriptionToolBar.cpp}::sAttachment
AttachedToolBarMenuItem sAttachment
Definition: TranscriptionToolBar.cpp:1065
TranscriptionToolBar::mPlaySpeed
double mPlaySpeed
Definition: TranscriptionToolBar.h:140
TranscriptionToolBar::OnFocus
void OnFocus(wxFocusEvent &event)
Definition: TranscriptionToolBar.cpp:376
ToolBar::mProject
AudacityProject & mProject
Definition: ToolBar.h:235
ToolBar::SetLabel
void SetLabel(const wxString &label) override
Definition: ToolBar.cpp:398
AButton::PopUp
void PopUp()
Definition: AButton.cpp:605
TrackList
A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list o...
Definition: Track.h:1280
ToolManager::Get
static ToolManager & Get(AudacityProject &project)
Definition: ToolManager.cpp:356
entry
static ProjectFileIORegistry::WriterEntry entry
Definition: ProjectSettings.cpp:197
AButton::Disable
void Disable()
Definition: AButton.cpp:580
TrackPanel::Get
static TrackPanel & Get(AudacityProject &project)
Definition: TrackPanel.cpp:227
XO
#define XO(s)
Definition: Internat.h:31
TTB_PlaySpeed
@ TTB_PlaySpeed
Definition: TranscriptionToolBar.h:41
ProjectSettings::Get
static ProjectSettings & Get(AudacityProject &project)
Definition: ProjectSettings.cpp:44
ThemeBase::ImageSize
wxSize ImageSize(int iIndex)
Definition: Theme.cpp:1224
LabelTrack
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:88
ToolBar::Holder
wxWindowPtr< ToolBar > Holder
Definition: ToolBar.h:102
WaveTrack::GetOffset
double GetOffset() const override
Definition: WaveTrack.cpp:237
ProjectWindow::Get
static ProjectWindow & Get(AudacityProject &project)
Definition: ProjectWindow.cpp:535
ASlider::Options
Definition: ASlider.h:238
AButton::WasControlDown
bool WasControlDown()
Definition: AButton.cpp:566
AttachedToolBarMenuItem
Definition: ToolManager.h:224
ComponentInterfaceSymbol
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
Definition: ComponentInterfaceSymbol.h:27
Entry
Definition: EditToolBar.cpp:225
AButton::FollowModifierKeys
void FollowModifierKeys()
Definition: AButton.cpp:330
PlayMode::normalPlay
@ normalPlay
NotifyingSelectedRegion::setTimes
bool setTimes(double t0, double t1)
Definition: ViewInfo.cpp:62
TrackList::GetEndTime
double GetEndTime() const
Definition: Track.cpp:1038
TranscriptionToolBar::OnPlaySpeed
void OnPlaySpeed(wxCommandEvent &event)
Definition: TranscriptionToolBar.cpp:553
wxEVT_COMMAND_BUTTON_CLICKED
wxEVT_COMMAND_BUTTON_CLICKED
Definition: AdornedRulerPanel.cpp:494
TranscriptionToolBar::OnSpeedSlider
void OnSpeedSlider(wxCommandEvent &event)
Definition: TranscriptionToolBar.cpp:564
ViewInfo::selectedRegion
NotifyingSelectedRegion selectedRegion
Definition: ViewInfo.h:229
XXO
#define XXO(s)
Definition: Internat.h:44
TranscriptionToolBar::AdjustPlaySpeed
void AdjustPlaySpeed(float adj)
Definition: TranscriptionToolBar.cpp:1047
TranscriptionToolBar::~TranscriptionToolBar
virtual ~TranscriptionToolBar()
Definition: TranscriptionToolBar.cpp:106
AButton::SetEnabled
void SetEnabled(bool state)
Definition: AButton.h:88
AButton::Enable
void Enable()
Definition: AButton.cpp:571
sampleCount::as_double
double as_double() const
Definition: SampleCount.h:45
NotifyingSelectedRegion::setT1
bool setT1(double t, bool maySwap=true)
Definition: ViewInfo.cpp:82
label
TranslatableString label
Definition: Tags.cpp:756
ToolBar::SetButtonToolTip
static void SetButtonToolTip(AudacityProject &project, AButton &button, const ComponentInterfaceSymbol commands[], size_t nCommands)
Definition: ToolBar.cpp:898
ToolBar::UpdatePrefs
void UpdatePrefs() override
Definition: ToolBar.cpp:605
AudioTrack
Track subclass holding data representing sound (as notes, or samples, or ...)
Definition: Track.h:838
TranscriptionToolBar::mBackgroundHeight
int mBackgroundHeight
Definition: TranscriptionToolBar.h:150
ASlider::Increase
void Increase(float steps)
Definition: ASlider.cpp:1752
AButton::SetAlternateIdx
void SetAlternateIdx(unsigned idx)
Definition: AButton.cpp:320
TranscriptionToolBar::GetPlaySpeed
double GetPlaySpeed() const
Definition: TranscriptionToolBar.h:117
AButton::PushDown
void PushDown()
Definition: AButton.cpp:597
SPEED_SLIDER
#define SPEED_SLIDER
Definition: ASlider.h:35
AudioIOBase::Get
static AudioIOBase * Get()
Definition: AudioIOBase.cpp:89
LabelTrackView::Get
static LabelTrackView & Get(LabelTrack &)
Definition: LabelTrackView.cpp:162
TrackFocus::Get
Track * Get()
Definition: TrackPanelAx.cpp:755
TranscriptionToolBar::mBackgroundWidth
int mBackgroundWidth
Definition: TranscriptionToolBar.h:149
DefaultPlayOptions
AudioIOStartStreamOptions DefaultPlayOptions(AudacityProject &project, bool looped)
Definition: ProjectAudioManager.cpp:1162
ToolBar::Create
virtual void Create(wxWindow *parent)
Definition: ToolBar.cpp:475
ViewInfo.h
TranscriptionToolBar::Create
void Create(wxWindow *parent) override
Definition: TranscriptionToolBar.cpp:121
TranscriptionToolBar::Populate
void Populate() override
Definition: TranscriptionToolBar.cpp:200
theTheme
THEME_API Theme theTheme
Definition: Theme.cpp:79
TIMETRACK_MIN
#define TIMETRACK_MIN
Definition: TranscriptionToolBar.cpp:472
TranscriptionToolBar::OnCaptureKey
void OnCaptureKey(wxCommandEvent &event)
Definition: TranscriptionToolBar.cpp:381
id
int id
Definition: WaveTrackControls.cpp:577
ProjectHistory::PushState
void PushState(const TranslatableString &desc, const TranslatableString &shortDesc)
Definition: ProjectHistory.cpp:90
TranscriptionBarID
@ TranscriptionBarID
Definition: ToolBar.h:79
RegisteredToolbarFactory
Definition: ToolBar.h:261
title
static const auto title
Definition: NoUpdatesAvailableDialog.cpp:22
ASlider
ASlider is a custom slider, allowing for a slicker look and feel.
Definition: ASlider.h:234
TrackList::Get
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:506
TranscriptionToolBar::mPlaySpeedSlider
ASlider * mPlaySpeedSlider
Definition: TranscriptionToolBar.h:139
TranscriptionToolBar::UpdatePrefs
void UpdatePrefs() override
Definition: TranscriptionToolBar.cpp:322
TaggedIdentifier< CommandIdTag, false >
_
#define _(s)
Definition: Internat.h:75
sampleCount
Positions or offsets within audio files need a wide type.
Definition: SampleCount.h:18
AudacityProject
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:92
TranscriptionToolBar::SetEnabled
void SetEnabled(bool enabled)
Definition: TranscriptionToolBar.cpp:1029
ToolBar::MakeButtonBackgroundsSmall
static void MakeButtonBackgroundsSmall()
Definition: ToolBar.cpp:802
TIMETRACK_MAX
#define TIMETRACK_MAX
Definition: TranscriptionToolBar.cpp:473
KeyboardCapture::OnFocus
void OnFocus(wxWindow &window, wxFocusEvent &event)
a function useful to implement a focus event handler The window releases the keyboard if the event is...
Definition: KeyboardCapture.cpp:95
ToolBar
Works with ToolManager and ToolDock to provide a dockable window in which buttons can be placed.
Definition: ToolBar.h:98
TranscriptionToolBar::TranscriptionToolBar
TranscriptionToolBar(AudacityProject &project)
Definition: TranscriptionToolBar.cpp:96
ThemeBase::Colour
wxColour & Colour(int iIndex)
Definition: Theme.cpp:1189
TranscriptionToolBar::SetPlaySpeed
void SetPlaySpeed(double value)
Definition: TranscriptionToolBar.cpp:156
ToolBar::MakeButton
static AButton * MakeButton(wxWindow *parent, teBmps eUp, teBmps eDown, teBmps eHilite, teBmps eDownHi, teBmps eStandardUp, teBmps eStandardDown, teBmps eDisabled, wxWindowID id, wxPoint placement, bool processdownevents, wxSize size)
Definition: ToolBar.cpp:840
TranscriptionToolBar::GetSamples
void GetSamples(const WaveTrack *t, sampleCount *s0, sampleCount *slen)
Definition: TranscriptionToolBar.cpp:430
factory
static RegisteredToolbarFactory factory
Definition: TranscriptionToolBar.cpp:1059
AButton::SetToolTip
void SetToolTip(const TranslatableString &toolTip)
Definition: AButton.cpp:269
NotifyingSelectedRegion::setT0
bool setT0(double t, bool maySwap=true)
Definition: ViewInfo.cpp:72
ProjectSettings::SetPlaySpeed
void SetPlaySpeed(double value)
Definition: ProjectSettings.h:109
TranscriptionToolBar::mButtons
AButton * mButtons[TTBNumButtons]
Definition: TranscriptionToolBar.h:134
NotifyingSelectedRegion::isPoint
bool isPoint() const
Definition: ViewInfo.h:52
NotifyingSelectedRegion::t0
double t0() const
Definition: ViewInfo.h:47
TranscriptionToolBar::ShowPlaySpeedDialog
void ShowPlaySpeedDialog()
Definition: TranscriptionToolBar.cpp:1021
Prefs.h
TranslatableString::Translation
wxString Translation() const
Definition: TranslatableString.h:79
TranscriptionToolBar::mEnvelope
std::shared_ptr< BoundedEnvelope > mEnvelope
Definition: TranscriptionToolBar.h:152
TranscriptionToolBar::Get
static TranscriptionToolBar & Get(AudacityProject &project)
Definition: TranscriptionToolBar.cpp:110
TranscriptionToolBar::SetPlaying
void SetPlaying(bool down, bool looped, bool cutPreview)
Definition: TranscriptionToolBar.cpp:1034
ProjectWindow::RedrawProject
void RedrawProject(const bool bForceWaveTracks=false)
Definition: ProjectWindow.cpp:710
TrackList::Any
auto Any() -> TrackIterRange< TrackType >
Definition: Track.h:1371
TranscriptionToolBar::mSensitivitySlider
ASlider * mSensitivitySlider
Definition: TranscriptionToolBar.h:141
AudioIO::Get
static AudioIO * Get()
Definition: AudioIO.cpp:141
PlayMode::loopedPlay
@ loopedPlay
safenew
#define safenew
Definition: MemoryX.h:10
TranscriptionToolBar
A kind of ToolBar used to help with analysing voice recordings.
Definition: TranscriptionToolBar.h:61
TranscriptionToolBar::EnableDisableButtons
void EnableDisableButtons() override
Definition: TranscriptionToolBar.cpp:296
TranscriptionToolBar::AddButton
static AButton * AddButton(TranscriptionToolBar *pBar, teBmps eFore, teBmps eDisabled, int id, const TranslatableString &label)
Definition: TranscriptionToolBar.cpp:165
TrackList::Selected
auto Selected() -> TrackIterRange< TrackType >
Definition: Track.h:1388
END_EVENT_TABLE
END_EVENT_TABLE()
ASlider::Decrease
void Decrease(float steps)
Definition: ASlider.cpp:1757
LabelTrackView::AddLabel
int AddLabel(const SelectedRegion &region, const wxString &title={}, int restoreFocus=-1)
Definition: LabelTrackView.cpp:2059
ToolBar::Add
void Add(wxWindow *window, int proportion=0, int flag=wxALIGN_TOP, int border=0, wxObject *userData=NULL)
Definition: ToolBar.cpp:686
ImageManipulation.h
ProjectHistory::Get
static ProjectHistory & Get(AudacityProject &project)
Definition: ProjectHistory.cpp:26
NoteTrack
A Track that is used for Midi notes. (Somewhat old code).
Definition: NoteTrack.h:67
TTB_PlaySpeedSlider
@ TTB_PlaySpeedSlider
Definition: TranscriptionToolBar.h:42
TranscriptionToolBar::RegenerateTooltips
void RegenerateTooltips() override
Definition: TranscriptionToolBar.cpp:333
ASlider::Options::Style
Options & Style(int s)
Definition: ASlider.h:250
ASlider::ShowDialog
bool ShowDialog(wxPoint pos=wxPoint(-1, -1))
Definition: ASlider.cpp:1762
TranscriptionToolBar::PlayAtSpeed
void PlayAtSpeed(bool looped, bool cutPreview)
Definition: TranscriptionToolBar.cpp:476
SelectedRegion
Defines a selected portion of a project.
Definition: SelectedRegion.h:35
WaveTrack::GetRate
double GetRate() const
Definition: WaveTrack.cpp:457