Issue11bTests.inc 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. // Round 165s (issue #11, comment 4): Shift+Space, automation shown in the effect editors, Linux file drops
  2. TEST (issue11b_shift_space_plays_from_the_start_everywhere)
  3. {
  4. using namespace lynx::keys;
  5. KeyMap map;
  6. CHECK (map.conflicts().empty());
  7. // FL 2026 (checked in FL): Space = play / stop back to where playback started, Ctrl+Space = pause,
  8. // Shift+Space = play / stop from the start of the song or pattern — in the Playlist, Piano Roll, Channel Rack...
  9. CHECK (map.find ({ space }, Context::global, false) == "transport.playStop");
  10. CHECK (map.find ({ space, ctrl }, Context::global, false) == "transport.pause");
  11. for (const auto focus : { Context::global, Context::playlist, Context::pianoRoll, Context::channelRack, Context::mixer, Context::browser })
  12. CHECK (map.find ({ space, shift }, focus, false) == "transport.playFromStart");
  13. // also with the typing piano on (Space is not a piano key) and from a plugin / channel window
  14. CHECK (map.find ({ space, shift }, Context::pianoRoll, true) == "transport.playFromStart");
  15. CHECK (map.findFromSecondaryWindow ({ space, shift }, false, false) == "transport.playFromStart");
  16. }
  17. // Comment 4, point 2: an effect editor (Parametric EQ 2's band handles, Fruity Filter's knobs...) draws its slot with
  18. // the automated parameters at their automation's value while the song plays; the Song keeps its own values.
  19. TEST (issue11b_effect_editor_shows_its_automation)
  20. {
  21. using namespace lynx;
  22. const AutomationTarget gain { AutomationTargetKind::effectParam, 1, 0, 2 };
  23. auto song = issue12c::songWithClip (gain);
  24. EffectSlot fx;
  25. fx.kind = EffectKind::parametricEq;
  26. fx.params[2] = 0.5f;
  27. fx.params[3] = 0.3f;
  28. song.mixer[1].effects.push_back (fx);
  29. const auto* stored = &song.mixer[1].effects[0];
  30. AutomationDisplay shown;
  31. ShownEffectSlot view;
  32. // stopped: the Song's slot itself
  33. shown.update (song, 1, 4.0 * ppq, false);
  34. CHECK (view.get (shown, stored, 1, 0, false) == stored);
  35. // playing: a copy with the automated parameter at the playhead's value, the others as stored
  36. shown.update (song, 1, 4.0 * ppq, true);
  37. CHECK (view.changed (shown, 1, 0));
  38. CHECK (! view.changed (shown, 1, 0)); // nothing new: no repaint
  39. const auto* a = view.get (shown, stored, 1, 0, false);
  40. CHECK (a != stored && std::abs (a->params[2] - 0.25f) < 0.01f && a->params[3] == 0.3f && a->kind == fx.kind);
  41. CHECK (stored->params[2] == 0.5f); // the Song is untouched
  42. CHECK (view.get (shown, stored, 1, 0, false) == a);
  43. // another slot / track: not automated
  44. CHECK (! ShownEffectSlot::automates (shown, 1, 1) && ! ShownEffectSlot::automates (shown, 0, 0));
  45. ShownEffectSlot other;
  46. CHECK (other.get (shown, stored, 2, 0, false) == stored);
  47. // moving on: the shown value follows; a hand on the control shows the Song's value
  48. shown.update (song, 1, 12.0 * ppq, true);
  49. CHECK (view.changed (shown, 1, 0));
  50. CHECK (std::abs (view.get (shown, stored, 1, 0, false)->params[2] - 0.75f) < 0.01f);
  51. CHECK (view.get (shown, stored, 1, 0, true) == stored);
  52. // an edit of another parameter shows at once, still with the automated one overlaid
  53. song.mixer[1].effects[0].params[3] = 0.9f;
  54. a = view.get (shown, stored, 1, 0, false);
  55. CHECK (a->params[3] == 0.9f && std::abs (a->params[2] - 0.75f) < 0.01f);
  56. // stopping: back to the Song's values (and a repaint)
  57. shown.update (song, 1, 12.0 * ppq, false);
  58. CHECK (view.changed (shown, 1, 0));
  59. CHECK (view.get (shown, stored, 1, 0, false) == stored);
  60. }