Skip to content

Dev Notes

Andre Hui edited this page Nov 26, 2022 · 19 revisions

Adding Voice Changer Effects:

Files involved:

  • interface/fxmanager.cpp
  • interface/fxmanager.h
  • audiofx/iaudiofx.h
  • Your own DSP library

Instructions:

  1. Subclass IAudioFX, and reimplement all the virtual functions.
  • Process(float *buf) - should call the processing function of your own DSP library. Applies the effect in place.
  • Get(std::string item) - returns the float value of the parameter indicated by item. This function should map strings to different Get functions of your library.
  • Set(std::string item, int val) - sets the value of the parameter indicated by item, to val. This function should map strings to different Set functions of your library, and pre-process the values to be compatible with your library.
  • GetEnabled() - should call a function in your own library, to check if the effect is enabled.
  • SetEnabled(bool enabled) - should call a function in your own library, to set whether the effect is enabled.
  1. Set up paramMap to contain all parameters you want to be exposed to the front end, as well as their corresponding widgets.
  2. Include your new class in fxmanager.h
  3. Add a new instance of your class starting at line 5 of fxmanager.cpp. Note that the order at which effects are added does matter, as effects are applied in the order in which they're added to the fxs map.

Use the following example: fxs.insert({"effectNameHere", std::unique_ptr(new ClassNameHere(argumentsHere))});

  1. Update the defaultObj json object to include your new effect and parameters.

Widgets:

Currently 2 widgets are available. If more specific widgets are needed, let me know.

  1. "FXDial" - requires a min and max argument - a discrete dial, good for settings parameters that lie in a range
  2. "FXKeyPicker" - requires no extra arguments - a 12-key keyboard, with each key representing a bit (least significant is C, most significant is B), useful when the effect relies on note selection.

paramType Struct:

  • type - the widget type
  • unit - the unit of the parameter
  • toolTip - a description of what the parameter does
  • min - an integer representing the minimum value this parameter can take
  • max - an integer representing the maximum value this parameter can take

Notes:

  • We set parameter values using integers because it makes more sense for the front end, where all widgets use discrete values. This keeps the front end simple, and makes sure devs don't need to worry about the front end when adding new effects.
  • All names (effect name, parameter names) are case sensitive, and used when generating the front end UI component.

UI Testing:

Basic Functionality:

  • Add Bind
    • With 0/1+ items in list
  • Remove Bind - check all remaining binds are still correct
    • Remove with no bind selected
      • Expect no response/change
    • Remove 1st bind in list of 2
      • Expect 2nd bind left in list
    • Remove 2nd bind in list of 3
      • Expect 1st and 3rd bind left
    • Remove last bind in list of 2
      • Expect 1st bind left
    • Remove last remaining bind
      • Expect no binds left
  • Rebind
    • To unused key
      • Expect key to be rebinded
    • To used key
      • Expect key to be ignored
    • Cancel with Esc
      • Expect key to return to previous state
    • Clear with Bkspc
      • Expect key to show "None"

Soundboard:

  • Monitor Slider
    • Increase/decrease slider
      • Clip volume should change with slider
  • Hotkey Test
    • Select
      • From no hotkey selected
        • Expect soundboard settings panel to refresh
      • Currently selected hotkey
        • Expect no change
      • Unselected hotkey
        • Expect soundboard settings panel to refresh
    • Soundboard Settings
      • Select hotkey with no clip
        • Expect no waveform, play button disabled, trash button disabled, clip volume disabled
        • Expect load file enabled, stop playback enabled, checkbox settings enabled, modifier key enabled
      • Select hotkey with clip
        • Expect all soundboard settings panel elements to be enabled
      • Checkbox Settings
        • Toggle Mic/Sys Audio
          • Test by recording clips to that hotkey and ensuring behavior is as intended
        • Toggle overlap
          • Test by playing back the clip and ensuring behavior is as intended
      • Modifier Key
        • Bind/Unbind/Rebind
          • Check json file for appropriate updates
        • Record over hotkey
          • Hold mod key with any soundboard hotkey and check if a new clip is recorded
      • Load File
        • Select 48000Hz .mp3
        • Select 44100Hz .mp3
        • Select 48000Hz .wav
        • Select 44100Hz .wav
        • Load over empty clip
          • Expect clip to be loaded, waveform, play button, trash button, clip volume become enabled
        • Load over existing clip
          • Expect current clip to be overrided
        • Cancel loading
          • Expect no changes
      • Delete File
        • Expect waveform, play button, trash button, clip volume to become disabled
      • Play button
        • Expect sample assigned to selected hotkey to be played
      • Stop button
        • Expect all clips to be stopped
      • Volume slider
        • Expect selected clip's playback volume to change, and nothing else

Voice Changer:

  • Monitor Slider
    • Increase/decrease slider
      • Voice volume should change accordingly
  • Hotkey Test
    • Select
      • "Off" key
        • Expect all effects to be off and uneditable
        • Expect remove button to be disabled
      • Normal key
        • Expect effects assigned to that key to become disabled
        • Expect values of the widgets to be updated
  • Tab Widget
    • Toggle enabled
      • Expect effect to show up in overlay HUD
      • Expect tab light to light up when enabled, turn off when disabled
    • Parameter changed
      • Expect effect to sound different
      • Expect json to be updated

Settings Menu:

  • Output Device
    • Expect json to be updated
  • HUD
    • Change position
      • Expect position to change on main monitor
    • Disable
      • Expect no HUD
    • Enable
      • When no effects active
        • Expect no HUD
      • When an effect is active
        • Expect HUD to pop up
  • Start with Windows
    • Enable
      • Expect shortcut to be generated in Startup folder
    • Disable
      • Expect no shortcut in Startup folder
  • Reset
    • Expect audio to cut off momentarily and then return
  • Check for Updates
    • Button pressed
      • Expect popup window to appear momentarily notifying of new updates
    • Autocheck for Updates
      • Restart the app, and expect the popup window to appear if an update is available, otherwise expect no popup windows