gibberish_stream.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*************************************************************************/
  2. /* gibberish_stream.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* http://www.godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
  9. /* */
  10. /* Permission is hereby granted, free of charge, to any person obtaining */
  11. /* a copy of this software and associated documentation files (the */
  12. /* "Software"), to deal in the Software without restriction, including */
  13. /* without limitation the rights to use, copy, modify, merge, publish, */
  14. /* distribute, sublicense, and/or sell copies of the Software, and to */
  15. /* permit persons to whom the Software is furnished to do so, subject to */
  16. /* the following conditions: */
  17. /* */
  18. /* The above copyright notice and this permission notice shall be */
  19. /* included in all copies or substantial portions of the Software. */
  20. /* */
  21. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  22. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  23. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
  24. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  25. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  26. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  27. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  28. /*************************************************************************/
  29. #ifndef GIBBERISH_STREAM_H
  30. #define GIBBERISH_STREAM_H
  31. #if 0
  32. #include "scene/resources/audio_stream.h"
  33. #include "scene/resources/sample_library.h"
  34. class AudioStreamGibberish : public AudioStream {
  35. OBJ_TYPE( AudioStreamGibberish, AudioStream );
  36. enum {
  37. FP_BITS = 12,
  38. FP_LEN = (1<<12),
  39. };
  40. bool active;
  41. bool paused;
  42. float xfade_time;
  43. float pitch_scale;
  44. float pitch_random_scale;
  45. Vector<Ref<Sample> > _samples;
  46. Vector<int> _rand_pool;
  47. int rand_idx;
  48. _FORCE_INLINE_ int randomize();
  49. struct Playback {
  50. int idx;
  51. uint64_t fp_pos;
  52. float scale;
  53. };
  54. Playback playback[2];
  55. int active_voices;
  56. Ref<SampleLibrary> phonemes;
  57. protected:
  58. virtual int get_channel_count() const;
  59. virtual bool mix(int32_t *p_buffer, int p_frames);
  60. static void _bind_methods();
  61. public:
  62. void set_phonemes(const Ref<SampleLibrary>& p_phonemes);
  63. Ref<SampleLibrary> get_phonemes() const;
  64. virtual void play();
  65. virtual void stop();
  66. virtual bool is_playing() const;
  67. virtual void set_paused(bool p_paused);
  68. virtual bool is_paused(bool p_paused) const;
  69. virtual void set_loop(bool p_enable);
  70. virtual bool has_loop() const;
  71. virtual float get_length() const;
  72. virtual String get_stream_name() const;
  73. virtual int get_loop_count() const;
  74. virtual float get_pos() const;
  75. virtual void seek_pos(float p_time);
  76. virtual UpdateMode get_update_mode() const;
  77. virtual void update();
  78. void set_xfade_time(float p_xfade);
  79. float get_xfade_time() const;
  80. void set_pitch_scale(float p_scale);
  81. float get_pitch_scale() const;
  82. void set_pitch_random_scale(float p_random_scale);
  83. float get_pitch_random_scale() const;
  84. AudioStreamGibberish();
  85. };
  86. #endif
  87. #endif // GIBBERISH_STREAM_H