Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Holiday Hacking 1: Architecture: Flatten key press handling #83

Merged
merged 8 commits into from
Jan 2, 2024

Commits on Dec 1, 2023

  1. Simplify Piano key_pressed array handling.

    - Rely on default init values
    - Deduplicate range check
    Jules Kerssemakers committed Dec 1, 2023
    Configuration menu
    Copy the full SHA
    a4827ef View commit details
    Browse the repository at this point in the history
  2. Extract PianoListener interface for all up/down logic (prep for liste…

    …ner pattern)
    Jules Kerssemakers committed Dec 1, 2023
    Configuration menu
    Copy the full SHA
    be8cc37 View commit details
    Browse the repository at this point in the history
  3. make Piano new dispatching hub of key up/down events, via PianoListener.

    The hub itself shouldn't implement its own listener-interface, to avoid
    infititely-recursive triggers, so un-implement PianoListener, and rename the
    'onKey*'-methods to 'doKey*' to signal their importance.
    Jules Kerssemakers committed Dec 1, 2023
    Configuration menu
    Copy the full SHA
    ff4ba8d View commit details
    Browse the repository at this point in the history
  4. Extract sound-sample handling from Piano to new SoundSet class.

    Jules Kerssemakers committed Dec 1, 2023
    Configuration menu
    Copy the full SHA
    145f6f0 View commit details
    Browse the repository at this point in the history
  5. Unify soundset-related folder- and prefix-handling into SoundSet stat…

    …ic helpers.
    
    The old `SOUNDSET_DIR_PREFIX` already indicated in its name it wanted to live
    in a SoundSet class.
    Additionally, it's not just for DIRs, since it's also (ab?)used to get at the
    translation keys.
    As such, move the prefix to SoundSet, and isntead use SoundSet helpers
    everywhere the prefix is currently used.
    
    Also, the SoundSet class, which is already handling the raw folder access,
    is a far better candidate for scanning that folder, than the current SettingsFragment.
    Jules Kerssemakers committed Dec 1, 2023
    Configuration menu
    Copy the full SHA
    e7e9e29 View commit details
    Browse the repository at this point in the history
  6. Extract an interface for SoundSet as prep for test-dummy SoundSets.

    An interface for something with only one sane implementation (SampledSoundSet)
    might seem like overkill, but this allows us to write tests without adding
    a dependency on a mocking framework, which would be worse overkill.
    Jules Kerssemakers committed Dec 1, 2023
    Configuration menu
    Copy the full SHA
    4538c3a View commit details
    Browse the repository at this point in the history
  7. Free Piano of last Context-awareness: convert sound-playing to PianoL…

    …istener.
    
    Move the last context-awareness out of piano, by converting `play_sound()`,
    including all its supporting infrastructure, to external PianoListener.
    
    Rather than one single, complex Melody-Preference-checking Listener,
    use a strategy pattern with two simple listeners:
     - one for 'normal' behaviour: StraightKeySoundMaker
     - one for melodies: MelodicKeySoundMaker
    
    Choose which one to listen with only once during piano-init, rather than
    checking melody-not-null on every key-press.
    Jules Kerssemakers committed Dec 1, 2023
    Configuration menu
    Copy the full SHA
    aa8a3b5 View commit details
    Browse the repository at this point in the history
  8. Group sound-related stuff into 'sound' package.

    It was getting cluttered in the main package.
    Jules Kerssemakers committed Dec 1, 2023
    Configuration menu
    Copy the full SHA
    bb5a284 View commit details
    Browse the repository at this point in the history