Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

effect_granular.h 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 playpack_rate;
  43. int32_t accumulator;
  44. int16_t prev_input;
  45. int16_t glitch_cross_len;
  46. int16_t glitch_len;
  47. int16_t glitch_min_len;
  48. bool allow_len_change;
  49. bool sample_loaded;
  50. bool write_en;
  51. bool zero_cross_down; // redundant?
  52. bool sample_req;
  53. };