gibberish_stream.h
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 
32 #if 0
33 #include "scene/resources/audio_stream.h"
34 #include "scene/resources/sample_library.h"
35 class AudioStreamGibberish : public AudioStream {
36 
37  OBJ_TYPE( AudioStreamGibberish, AudioStream );
38 
39  enum {
40 
41  FP_BITS = 12,
42  FP_LEN = (1<<12),
43  };
44  bool active;
45  bool paused;
46 
47  float xfade_time;
48  float pitch_scale;
49  float pitch_random_scale;
50  Vector<Ref<Sample> > _samples;
51  Vector<int> _rand_pool;
52  int rand_idx;
53  _FORCE_INLINE_ int randomize();
54 
55  struct Playback {
56 
57  int idx;
58  uint64_t fp_pos;
59  float scale;
60  };
61 
62  Playback playback[2];
63  int active_voices;
64 
65  Ref<SampleLibrary> phonemes;
66 protected:
67 
68  virtual int get_channel_count() const;
69  virtual bool mix(int32_t *p_buffer, int p_frames);
70 
71  static void _bind_methods();
72 
73 public:
74 
75  void set_phonemes(const Ref<SampleLibrary>& p_phonemes);
76  Ref<SampleLibrary> get_phonemes() const;
77 
78  virtual void play();
79  virtual void stop();
80  virtual bool is_playing() const;
81 
82  virtual void set_paused(bool p_paused);
83  virtual bool is_paused(bool p_paused) const;
84 
85  virtual void set_loop(bool p_enable);
86  virtual bool has_loop() const;
87 
88  virtual float get_length() const;
89 
90  virtual String get_stream_name() const;
91 
92  virtual int get_loop_count() const;
93 
94  virtual float get_pos() const;
95  virtual void seek_pos(float p_time);
96 
97  virtual UpdateMode get_update_mode() const;
98  virtual void update();
99 
100  void set_xfade_time(float p_xfade);
101  float get_xfade_time() const;
102 
103  void set_pitch_scale(float p_scale);
104  float get_pitch_scale() const;
105 
106  void set_pitch_random_scale(float p_random_scale);
107  float get_pitch_random_scale() const;
108 
109  AudioStreamGibberish();
110 };
111 
112 #endif
113 
114 #endif // GIBBERISH_STREAM_H
Definition: audio_stream.h:68
Definition: ustring.h:64
Definition: vector.h:43