Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

effect_granular.h 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Copyright (c) 2018 John-Michael Reed
  3. * bleeplabs.com
  4. *
  5. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6. * of this software and associated documentation files (the "Software"), to deal
  7. * in the Software without restriction, including without limitation the rights
  8. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. * copies of the Software, and to permit persons to whom the Software is
  10. * furnished to do so, subject to the following conditions:
  11. *
  12. * The above copyright notice and this permission notice shall be included in all
  13. * copies or substantial portions of the Software.
  14. *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  21. * SOFTWARE.
  22. */
  23. #include "AudioStream.h"
  24. class AudioEffectGranular : public AudioStream
  25. {
  26. public:
  27. AudioEffectGranular(void): AudioStream(1,inputQueueArray) { }
  28. void begin(int16_t *sample_bank_def,int16_t max_len_def);
  29. void length(int16_t max_len_def);
  30. void rate(int16_t playpack_rate_def);
  31. void freeze(int16_t activate,int16_t playpack_rate_def,int16_t grain_length_def);
  32. void shift(int16_t activate,int16_t playpack_rate_def,int16_t grain_length_def);
  33. virtual void update(void);
  34. private:
  35. audio_block_t *inputQueueArray[1];
  36. int16_t *sample_bank;
  37. int16_t max_sample_len;
  38. int16_t write_head;
  39. int16_t read_head;
  40. int16_t grain_mode;
  41. int16_t freeze_len;
  42. int16_t allow_len_change;
  43. int16_t playback_rate;
  44. int16_t capture_trigger;
  45. int16_t capture_index;
  46. int16_t current_mode;
  47. int16_t playpack_rate;
  48. int32_t accumulator;
  49. int32_t play_index;
  50. int32_t increment;
  51. int16_t sample_loaded;
  52. int16_t prev_input;
  53. int16_t zero_cross_up;
  54. int16_t zero_cross_down;
  55. int16_t sample_trigger;
  56. int16_t write_en;
  57. int16_t glitch_cross_len;
  58. int16_t load_req;
  59. int16_t glitch_len;
  60. int16_t glitch_min_len;
  61. int16_t sample_req;
  62. };