| 534 | } |
| 535 | |
| 536 | void ControlToolBar::OnKeyEvent(wxKeyEvent & event) |
| 537 | { |
| 538 | // PRL: is this handler really ever reached? Is the ControlToolBar ever |
| 539 | // focused? Isn't there a global event filter that interprets the spacebar |
| 540 | // key (or other key chosen in preferences) and dispatches to DoPlayStop, |
| 541 | // according to CommandManager's table, before we come to this redundant |
| 542 | // function? |
| 543 | |
| 544 | if (event.ControlDown() || event.AltDown()) { |
| 545 | event.Skip(); |
| 546 | return; |
| 547 | } |
| 548 | |
| 549 | auto gAudioIO = AudioIOBase::Get(); |
| 550 | auto &projectAudioManager = ProjectAudioManager::Get( mProject ); |
| 551 | |
| 552 | // Does not appear to be needed on Linux. Perhaps on some other platform? |
| 553 | // If so, "!CanStopAudioStream()" should probably apply. |
| 554 | if (event.GetKeyCode() == WXK_SPACE) { |
| 555 | if ( projectAudioManager.Playing() || projectAudioManager.Recording() ) { |
| 556 | SetStop(); |
| 557 | projectAudioManager.Stop(); |
| 558 | } |
| 559 | else if (!gAudioIO->IsBusy()) { |
| 560 | projectAudioManager.PlayCurrentRegion(); |
| 561 | } |
| 562 | return; |
| 563 | } |
| 564 | event.Skip(); |
| 565 | } |
| 566 | |
| 567 | void ControlToolBar::OnPlay(wxCommandEvent & WXUNUSED(evt)) |
| 568 | { |