beeps 0.3.3 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8ee41e529e2fef19d549eaafc03a59d77bda6b457b3d918c9f5c35fcf929ef73
4
- data.tar.gz: d630e5ae0784e1cb5a68a925cbed99674166d8acad08569e46f7021dc564412e
3
+ metadata.gz: fef183d5b385e0ac3007dd66f7a452940e2c62ad55fb16ce5d12d20dc8dcbf30
4
+ data.tar.gz: 78837bb17ed3785fd6bd4085dc2ea3c4289ecd74c4f1cd3db67b539815503149
5
5
  SHA512:
6
- metadata.gz: 7dacf730d824d5cbc175ca6d3c9e4dc39aa69f7b30cc4e270240aa3ab9f0a820a07119146f1d0d55cc0487771d71f9da7cc6435760f6e5ebd40edd3f585756fa
7
- data.tar.gz: e981523810d79702c73f154a96877dd3cf8d7c05683a5df2f4d6717359670829325bd439ae6374b1f291fbdf871f36e83ee2d112fd5abfeeac75f11855ee8719
6
+ metadata.gz: 180665f71bf309872fde63eba13765cab167ac5359c058cab282b354a7aa9082781826eddf03d6625fb1ae46401254e9c0504886d23fd330f8f4a61f85f4c43c
7
+ data.tar.gz: 7b0178557895cc5e48ad1b9ce90f3a4e4dca91af297ebc6a038719e7498c75b9f46cf6d96aa0ec48ef2a1fc9281c3ac83653ba21b538a190310948a5a2e77014
@@ -0,0 +1,85 @@
1
+ #include "beeps/ruby/filter.h"
2
+
3
+
4
+ #include "beeps/ruby/processor.h"
5
+ #include "defs.h"
6
+
7
+
8
+ RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(BEEPS_EXPORT, Beeps::Mixer)
9
+
10
+ #define THIS to<Beeps::Mixer*>(self)
11
+
12
+ #define CHECK RUCY_CHECK_OBJ(Beeps::Mixer, self)
13
+
14
+
15
+ static
16
+ VALUE alloc(VALUE klass)
17
+ {
18
+ return value(new Beeps::RubyProcessor<Beeps::Mixer>, klass);
19
+ }
20
+
21
+ static
22
+ VALUE add_input(VALUE self, VALUE inputs)
23
+ {
24
+ CHECK;
25
+
26
+ const Value* array = inputs.as_array();
27
+ size_t size = inputs.size();
28
+
29
+ for (size_t i = 0; i < size; ++i)
30
+ THIS->add_input(to<Beeps::Processor*>(array[i]));
31
+ return inputs;
32
+ }
33
+
34
+ static
35
+ VALUE remove_input(VALUE self, VALUE inputs)
36
+ {
37
+ CHECK;
38
+
39
+ const Value* array = inputs.as_array();
40
+ size_t size = inputs.size();
41
+
42
+ for (size_t i = 0; i < size; ++i)
43
+ THIS->remove_input(to<Beeps::Processor*>(array[i]));
44
+ return inputs;
45
+ }
46
+
47
+ static
48
+ VALUE each_input(VALUE self)
49
+ {
50
+ CHECK;
51
+
52
+ Value ret;
53
+ for (auto& input : *THIS)
54
+ ret = rb_yield(value(input.get()));
55
+ return ret;
56
+ }
57
+
58
+
59
+ static Class cMixer;
60
+
61
+ void
62
+ Init_beeps_mixer ()
63
+ {
64
+ Module mBeeps = rb_define_module("Beeps");
65
+
66
+ cMixer = mBeeps.define_class("Mixer", Beeps::processor_class());
67
+ rb_define_alloc_func(cMixer, alloc);
68
+ cMixer.define_method( "add_input!", add_input);
69
+ cMixer.define_method("remove_input!", remove_input);
70
+ cMixer.define_method( "each_input!", each_input);
71
+ }
72
+
73
+
74
+ namespace Beeps
75
+ {
76
+
77
+
78
+ Class
79
+ mixer_class ()
80
+ {
81
+ return cMixer;
82
+ }
83
+
84
+
85
+ }// Beeps
@@ -14,6 +14,7 @@ void Init_beeps_file_in ();
14
14
  void Init_beeps_mic_in ();
15
15
 
16
16
  void Init_beeps_gain ();
17
+ void Init_beeps_mixer ();
17
18
  void Init_beeps_envelope ();
18
19
  void Init_beeps_time_stretch ();
19
20
  void Init_beeps_pitch_shift ();
@@ -44,6 +45,7 @@ extern "C" void
44
45
  Init_beeps_mic_in();
45
46
 
46
47
  Init_beeps_gain();
48
+ Init_beeps_mixer();
47
49
  Init_beeps_envelope();
48
50
  Init_beeps_time_stretch();
49
51
  Init_beeps_pitch_shift();
@@ -35,6 +35,37 @@ VALUE get_type(VALUE self)
35
35
  return value(THIS->type());
36
36
  }
37
37
 
38
+ static
39
+ VALUE set_samples(VALUE self, VALUE samples)
40
+ {
41
+ CHECK;
42
+
43
+ Value* array = samples.as_array();
44
+ size_t size = samples.size();
45
+
46
+ std::vector<float> floats;
47
+ floats.reserve(size);
48
+ for (size_t i = 0; i < size; ++i)
49
+ floats.push_back(to<float>(array[i]));
50
+
51
+ THIS->set_samples(&floats[0], floats.size());
52
+ }
53
+
54
+ static
55
+ VALUE each_sample(VALUE self)
56
+ {
57
+ CHECK;
58
+
59
+ const float* floats = THIS->samples();
60
+ size_t size = THIS->nsamples();
61
+ if (!floats || size == 0) return Qnil;
62
+
63
+ Value ret;
64
+ for (size_t i = 0; i < size; ++i)
65
+ ret = rb_yield(value(floats[i]));
66
+ return ret;
67
+ }
68
+
38
69
  static
39
70
  VALUE set_frequency(VALUE self, VALUE frequency)
40
71
  {
@@ -52,6 +83,23 @@ VALUE get_frequency(VALUE self)
52
83
  return value(THIS->frequency());
53
84
  }
54
85
 
86
+ static
87
+ VALUE set_phase(VALUE self, VALUE phase)
88
+ {
89
+ CHECK;
90
+
91
+ THIS->set_phase(to<float>(phase));
92
+ return phase;
93
+ }
94
+
95
+ static
96
+ VALUE get_phase(VALUE self)
97
+ {
98
+ CHECK;
99
+
100
+ return value(THIS->phase());
101
+ }
102
+
55
103
 
56
104
  static Class cOscillator;
57
105
 
@@ -64,14 +112,20 @@ Init_beeps_oscillator ()
64
112
  rb_define_alloc_func(cOscillator, alloc);
65
113
  rb_define_method(cOscillator, "type=", RUBY_METHOD_FUNC(set_type), 1);
66
114
  rb_define_method(cOscillator, "type", RUBY_METHOD_FUNC(get_type), 0);
115
+ rb_define_method(cOscillator, "samples=", RUBY_METHOD_FUNC(set_samples), 1);
116
+ cOscillator.define_method("each_sample!", each_sample);
67
117
  rb_define_method(cOscillator, "frequency=", RUBY_METHOD_FUNC(set_frequency), 1);
68
118
  rb_define_method(cOscillator, "frequency", RUBY_METHOD_FUNC(get_frequency), 0);
119
+ rb_define_method(cOscillator, "phase=", RUBY_METHOD_FUNC(set_phase), 1);
120
+ rb_define_method(cOscillator, "phase", RUBY_METHOD_FUNC(get_phase), 0);
69
121
 
70
122
  cOscillator.define_const("TYPE_NONE", Beeps::Oscillator::TYPE_NONE);
71
123
  cOscillator.define_const("SINE", Beeps::Oscillator::SINE);
72
124
  cOscillator.define_const("TRIANGLE", Beeps::Oscillator::TRIANGLE);
73
125
  cOscillator.define_const("SQUARE", Beeps::Oscillator::SQUARE);
74
126
  cOscillator.define_const("SAWTOOTH", Beeps::Oscillator::SAWTOOTH);
127
+ cOscillator.define_const("NOISE", Beeps::Oscillator::NOISE);
128
+ cOscillator.define_const("SAMPLES", Beeps::Oscillator::SAMPLES);
75
129
  }
76
130
 
77
131
 
@@ -11,6 +11,8 @@ RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(BEEPS_EXPORT, Beeps::Processor)
11
11
 
12
12
  #define CHECK RUCY_CHECK_OBJ(Beeps::Processor, self)
13
13
 
14
+ #define CALL(fun) RUCY_CALL_SUPER(THIS, fun)
15
+
14
16
 
15
17
  static
16
18
  VALUE alloc(VALUE klass)
@@ -44,6 +46,13 @@ VALUE get_input(VALUE self)
44
46
  return value(THIS->input());
45
47
  }
46
48
 
49
+ static
50
+ VALUE on_start(VALUE self)
51
+ {
52
+ CHECK;
53
+ CALL(on_start());
54
+ }
55
+
47
56
 
48
57
  static Class cProcessor;
49
58
 
@@ -57,6 +66,7 @@ Init_beeps_processor ()
57
66
  rb_define_method(cProcessor, "reset", RUBY_METHOD_FUNC(reset), 0);
58
67
  rb_define_method(cProcessor, "input=", RUBY_METHOD_FUNC(set_input), 1);
59
68
  rb_define_method(cProcessor, "input", RUBY_METHOD_FUNC(get_input), 0);
69
+ rb_define_method(cProcessor, "on_start", RUBY_METHOD_FUNC(on_start), 0);
60
70
  }
61
71
 
62
72
 
@@ -0,0 +1,12 @@
1
+ ## Pull Requests Not Accepted 🚫
2
+
3
+ Thank you for your interest in contributing!
4
+ However, this repository does not accept pull requests directly.
5
+
6
+ ### Where to Contribute?
7
+
8
+ Please submit your changes to the [xord/all](https://github.com/xord/all) monorepo, which serves as the primary repository for all our main libraries.
9
+
10
+ For more details, please refer to our [contribution guidelines](../CONTRIBUTING.md).
11
+
12
+ Thanks for your understanding! 🙌
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,7 @@
1
+ # Contribution Guide
2
+
3
+ Thank you for your interest in contributing!
4
+ However, this repository does not accept pull requests.
5
+ Instead, please submit your changes to the [xord/all](https://github.com/xord/all) monorepo, which serves as the primary repository for all our main libraries.
6
+
7
+ For any questions, feel free to open an issue.
data/ChangeLog.md CHANGED
@@ -1,6 +1,35 @@
1
1
  # beeps ChangeLog
2
2
 
3
3
 
4
+ ## [v0.3.5] - 2025-03-24
5
+
6
+ - Add PULL_REQUEST_TEMPLATE.md
7
+ - Add CONTRIBUTING.md
8
+
9
+
10
+ ## [v0.3.4] - 2025-03-07
11
+
12
+ - Add Mixer class
13
+ - Add Processor#add_input
14
+ - Add Processor#on_start
15
+ - Add new oscillator type NOISE
16
+ - Add new oscillator type SAMPLES, and add Oscillator#samples=
17
+ - Add Oscillator#phase/phase=
18
+ - Add 'openal' to msys2_mingw_dependencies
19
+
20
+ - Processor.new can take inputs
21
+ - Processor#<< returns self
22
+ - Square and sawtooth oscillators discard the first some amount of samples
23
+ - Oscillator::set_type() takes over the phase value
24
+ - Noise oscillator can take frequency parameter
25
+ - Gain#initialize can take param for gain
26
+ - Envelop's default attack, decay, and release time are changed from 0.01 to 0.005
27
+ - Envelop#initialize can take attack, decay, sustain, and release params
28
+ - The attack and release can be canceled by passing 0 to the attack_time and release_time of the Envelope
29
+
30
+ - Temporarily delete Processor#<< to review specifications
31
+
32
+
4
33
  ## [v0.3.3] - 2025-01-23
5
34
 
6
35
  - Update dependencies
data/README.md CHANGED
@@ -1,4 +1,47 @@
1
+ # Beeps - Plays beep sound
1
2
 
2
- # Beeps - Plays beep sound.
3
+ ![License](https://img.shields.io/github/license/xord/beeps)
4
+ ![Build Status](https://github.com/xord/beeps/actions/workflows/test.yml/badge.svg)
5
+ ![Gem Version](https://badge.fury.io/rb/beeps.svg)
3
6
 
4
- by xordog@gmail.com
7
+ ## ⚠️ Notice
8
+
9
+ This repository is a read-only mirror of our monorepo.
10
+ We do not accept pull requests or direct contributions here.
11
+
12
+ ### 🔄 Where to Contribute?
13
+
14
+ All development happens in our [xord/all](https://github.com/xord/all) monorepo, which contains all our main libraries.
15
+ If you'd like to contribute, please submit your changes there.
16
+
17
+ For more details, check out our [Contribution Guidelines](./CONTRIBUTING.md).
18
+
19
+ Thanks for your support! 🙌
20
+
21
+ ## 🚀 About
22
+
23
+ **Beeps** is a simple utility that plays a beep sound.
24
+
25
+ It is designed to be lightweight and easy to use, making it perfect for adding audible notifications to your scripts or applications.
26
+
27
+ ## 📦 Installation
28
+
29
+ Add this line to your Gemfile:
30
+ ```ruby
31
+ $ gem 'beeps'
32
+ ```
33
+
34
+ Then, install gem:
35
+ ```bash
36
+ $ bundle install
37
+ ```
38
+
39
+ Or install it directly:
40
+ ```bash
41
+ $ gem install beeps
42
+ ```
43
+
44
+ ## 📜 License
45
+
46
+ **Beeps** is licensed under the MIT License.
47
+ See the [LICENSE](./LICENSE) file for details.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.3
1
+ 0.3.5
data/beeps.gemspec CHANGED
@@ -25,8 +25,8 @@ Gem::Specification.new do |s|
25
25
  s.platform = Gem::Platform::RUBY
26
26
  s.required_ruby_version = '>= 3.0.0'
27
27
 
28
- s.add_dependency 'xot', '~> 0.3.3', '>= 0.3.3'
29
- s.add_dependency 'rucy', '~> 0.3.3', '>= 0.3.3'
28
+ s.add_dependency 'xot', '~> 0.3.5', '>= 0.3.5'
29
+ s.add_dependency 'rucy', '~> 0.3.5', '>= 0.3.5'
30
30
 
31
31
  s.files = `git ls-files`.split $/
32
32
  s.executables = s.files.grep(%r{^bin/}) {|f| File.basename f}
@@ -34,5 +34,7 @@ Gem::Specification.new do |s|
34
34
  s.extra_rdoc_files = rdocs.to_a
35
35
  s.has_rdoc = true
36
36
 
37
+ s.metadata['msys2_mingw_dependencies'] = 'openal'
38
+
37
39
  s.extensions << 'Rakefile'
38
40
  end
@@ -0,0 +1,89 @@
1
+ #include "beeps/ruby/filter.h"
2
+
3
+
4
+ #include "beeps/ruby/processor.h"
5
+ #include "defs.h"
6
+
7
+
8
+ RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(BEEPS_EXPORT, Beeps::Mixer)
9
+
10
+ #define THIS to<Beeps::Mixer*>(self)
11
+
12
+ #define CHECK RUCY_CHECK_OBJ(Beeps::Mixer, self)
13
+
14
+
15
+ static
16
+ RUCY_DEF_ALLOC(alloc, klass)
17
+ {
18
+ return value(new Beeps::RubyProcessor<Beeps::Mixer>, klass);
19
+ }
20
+ RUCY_END
21
+
22
+ static
23
+ RUCY_DEF1(add_input, inputs)
24
+ {
25
+ CHECK;
26
+
27
+ const Value* array = inputs.as_array();
28
+ size_t size = inputs.size();
29
+
30
+ for (size_t i = 0; i < size; ++i)
31
+ THIS->add_input(to<Beeps::Processor*>(array[i]));
32
+ return inputs;
33
+ }
34
+ RUCY_END
35
+
36
+ static
37
+ RUCY_DEF1(remove_input, inputs)
38
+ {
39
+ CHECK;
40
+
41
+ const Value* array = inputs.as_array();
42
+ size_t size = inputs.size();
43
+
44
+ for (size_t i = 0; i < size; ++i)
45
+ THIS->remove_input(to<Beeps::Processor*>(array[i]));
46
+ return inputs;
47
+ }
48
+ RUCY_END
49
+
50
+ static
51
+ RUCY_DEF0(each_input)
52
+ {
53
+ CHECK;
54
+
55
+ Value ret;
56
+ for (auto& input : *THIS)
57
+ ret = rb_yield(value(input.get()));
58
+ return ret;
59
+ }
60
+ RUCY_END
61
+
62
+
63
+ static Class cMixer;
64
+
65
+ void
66
+ Init_beeps_mixer ()
67
+ {
68
+ Module mBeeps = define_module("Beeps");
69
+
70
+ cMixer = mBeeps.define_class("Mixer", Beeps::processor_class());
71
+ cMixer.define_alloc_func(alloc);
72
+ cMixer.define_method( "add_input!", add_input);
73
+ cMixer.define_method("remove_input!", remove_input);
74
+ cMixer.define_method( "each_input!", each_input);
75
+ }
76
+
77
+
78
+ namespace Beeps
79
+ {
80
+
81
+
82
+ Class
83
+ mixer_class ()
84
+ {
85
+ return cMixer;
86
+ }
87
+
88
+
89
+ }// Beeps
data/ext/beeps/native.cpp CHANGED
@@ -14,6 +14,7 @@ void Init_beeps_file_in ();
14
14
  void Init_beeps_mic_in ();
15
15
 
16
16
  void Init_beeps_gain ();
17
+ void Init_beeps_mixer ();
17
18
  void Init_beeps_envelope ();
18
19
  void Init_beeps_time_stretch ();
19
20
  void Init_beeps_pitch_shift ();
@@ -44,6 +45,7 @@ extern "C" void
44
45
  Init_beeps_mic_in();
45
46
 
46
47
  Init_beeps_gain();
48
+ Init_beeps_mixer();
47
49
  Init_beeps_envelope();
48
50
  Init_beeps_time_stretch();
49
51
  Init_beeps_pitch_shift();
@@ -38,6 +38,39 @@ RUCY_DEF0(get_type)
38
38
  }
39
39
  RUCY_END
40
40
 
41
+ static
42
+ RUCY_DEF1(set_samples, samples)
43
+ {
44
+ CHECK;
45
+
46
+ Value* array = samples.as_array();
47
+ size_t size = samples.size();
48
+
49
+ std::vector<float> floats;
50
+ floats.reserve(size);
51
+ for (size_t i = 0; i < size; ++i)
52
+ floats.push_back(to<float>(array[i]));
53
+
54
+ THIS->set_samples(&floats[0], floats.size());
55
+ }
56
+ RUCY_END
57
+
58
+ static
59
+ RUCY_DEF0(each_sample)
60
+ {
61
+ CHECK;
62
+
63
+ const float* floats = THIS->samples();
64
+ size_t size = THIS->nsamples();
65
+ if (!floats || size == 0) return Qnil;
66
+
67
+ Value ret;
68
+ for (size_t i = 0; i < size; ++i)
69
+ ret = rb_yield(value(floats[i]));
70
+ return ret;
71
+ }
72
+ RUCY_END
73
+
41
74
  static
42
75
  RUCY_DEF1(set_frequency, frequency)
43
76
  {
@@ -57,6 +90,25 @@ RUCY_DEF0(get_frequency)
57
90
  }
58
91
  RUCY_END
59
92
 
93
+ static
94
+ RUCY_DEF1(set_phase, phase)
95
+ {
96
+ CHECK;
97
+
98
+ THIS->set_phase(to<float>(phase));
99
+ return phase;
100
+ }
101
+ RUCY_END
102
+
103
+ static
104
+ RUCY_DEF0(get_phase)
105
+ {
106
+ CHECK;
107
+
108
+ return value(THIS->phase());
109
+ }
110
+ RUCY_END
111
+
60
112
 
61
113
  static Class cOscillator;
62
114
 
@@ -69,14 +121,20 @@ Init_beeps_oscillator ()
69
121
  cOscillator.define_alloc_func(alloc);
70
122
  cOscillator.define_method("type=", set_type);
71
123
  cOscillator.define_method("type", get_type);
124
+ cOscillator.define_method( "samples=", set_samples);
125
+ cOscillator.define_method("each_sample!", each_sample);
72
126
  cOscillator.define_method("frequency=", set_frequency);
73
127
  cOscillator.define_method("frequency", get_frequency);
128
+ cOscillator.define_method("phase=", set_phase);
129
+ cOscillator.define_method("phase", get_phase);
74
130
 
75
131
  cOscillator.define_const("TYPE_NONE", Beeps::Oscillator::TYPE_NONE);
76
132
  cOscillator.define_const("SINE", Beeps::Oscillator::SINE);
77
133
  cOscillator.define_const("TRIANGLE", Beeps::Oscillator::TRIANGLE);
78
134
  cOscillator.define_const("SQUARE", Beeps::Oscillator::SQUARE);
79
135
  cOscillator.define_const("SAWTOOTH", Beeps::Oscillator::SAWTOOTH);
136
+ cOscillator.define_const("NOISE", Beeps::Oscillator::NOISE);
137
+ cOscillator.define_const("SAMPLES", Beeps::Oscillator::SAMPLES);
80
138
  }
81
139
 
82
140
 
@@ -11,6 +11,8 @@ RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(BEEPS_EXPORT, Beeps::Processor)
11
11
 
12
12
  #define CHECK RUCY_CHECK_OBJ(Beeps::Processor, self)
13
13
 
14
+ #define CALL(fun) RUCY_CALL_SUPER(THIS, fun)
15
+
14
16
 
15
17
  static
16
18
  RUCY_DEF_ALLOC(alloc, klass)
@@ -48,6 +50,14 @@ RUCY_DEF0(get_input)
48
50
  }
49
51
  RUCY_END
50
52
 
53
+ static
54
+ RUCY_DEF0(on_start)
55
+ {
56
+ CHECK;
57
+ CALL(on_start());
58
+ }
59
+ RUCY_END
60
+
51
61
 
52
62
  static Class cProcessor;
53
63
 
@@ -61,6 +71,7 @@ Init_beeps_processor ()
61
71
  cProcessor.define_method("reset", reset);
62
72
  cProcessor.define_method("input=", set_input);
63
73
  cProcessor.define_method("input", get_input);
74
+ cProcessor.define_method("on_start", on_start);
64
75
  }
65
76
 
66
77
 
@@ -37,6 +37,47 @@ namespace Beeps
37
37
  };// Gain
38
38
 
39
39
 
40
+ class Mixer : public Filter
41
+ {
42
+
43
+ typedef Filter Super;
44
+
45
+ public:
46
+
47
+ typedef std::vector<Processor::Ref> InputList;
48
+
49
+ typedef InputList:: iterator iterator;
50
+
51
+ typedef InputList::const_iterator const_iterator;
52
+
53
+ Mixer (Processor* input = NULL);
54
+
55
+ virtual ~Mixer ();
56
+
57
+ virtual void add_input (Processor* input);
58
+
59
+ virtual void remove_input (Processor* input);
60
+
61
+ virtual iterator begin ();
62
+
63
+ virtual const_iterator begin () const;
64
+
65
+ virtual iterator end ();
66
+
67
+ virtual const_iterator end () const;
68
+
69
+ virtual void filter (
70
+ Context* context, Signals* signals, uint* offset) override;
71
+
72
+ virtual operator bool () const override;
73
+
74
+ struct Data;
75
+
76
+ Xot::PImpl<Data> self;
77
+
78
+ };// Mixer
79
+
80
+
40
81
  class Envelope : public Filter
41
82
  {
42
83
 
@@ -18,10 +18,15 @@ namespace Beeps
18
18
 
19
19
  public:
20
20
 
21
- enum Type {TYPE_NONE = 0, SINE, TRIANGLE, SQUARE, SAWTOOTH};
21
+ enum Type
22
+ {
23
+ TYPE_NONE = 0, SINE, TRIANGLE, SQUARE, SAWTOOTH, NOISE, SAMPLES
24
+ };
22
25
 
23
26
  Oscillator (Type type = SINE);
24
27
 
28
+ Oscillator (float* samples, size_t size);
29
+
25
30
  virtual ~Oscillator ();
26
31
 
27
32
  virtual void reset () override;
@@ -30,10 +35,20 @@ namespace Beeps
30
35
 
31
36
  virtual Type type () const;
32
37
 
38
+ virtual void set_samples (float* samples, size_t size);
39
+
40
+ virtual const float* samples () const;
41
+
42
+ virtual size_t nsamples () const;
43
+
33
44
  virtual void set_frequency (float frequency);
34
45
 
35
46
  virtual float frequency () const;
36
47
 
48
+ virtual void set_phase (float phase);
49
+
50
+ virtual float phase () const;
51
+
37
52
  virtual void generate (
38
53
  Context* context, Signals* signals, uint* offset) override;
39
54
 
@@ -37,6 +37,8 @@ namespace Beeps
37
37
 
38
38
  virtual const Processor* input () const;
39
39
 
40
+ virtual void on_start ();
41
+
40
42
  virtual operator bool () const;
41
43
 
42
44
  virtual bool operator ! () const;