beeps 0.3.3 → 0.3.4

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.
data/src/processor.cpp CHANGED
@@ -14,7 +14,7 @@ namespace Beeps
14
14
  struct Processor::Data
15
15
  {
16
16
 
17
- bool generator = false;
17
+ bool generator = false, started = false;
18
18
 
19
19
  float buffering_seconds = 0;
20
20
 
@@ -22,11 +22,6 @@ namespace Beeps
22
22
 
23
23
  Processor::Ref input;
24
24
 
25
- bool has_generator () const
26
- {
27
- return generator || (input && input->self->has_generator());
28
- }
29
-
30
25
  };// Processor::Data
31
26
 
32
27
 
@@ -57,6 +52,7 @@ namespace Beeps
57
52
  void
58
53
  Processor::reset ()
59
54
  {
55
+ self->started = false;
60
56
  if (self->input) self->input->reset();
61
57
 
62
58
  set_updated();
@@ -79,6 +75,11 @@ namespace Beeps
79
75
  return self->input;
80
76
  }
81
77
 
78
+ void
79
+ Processor::on_start ()
80
+ {
81
+ }
82
+
82
83
  const Processor*
83
84
  Processor::input () const
84
85
  {
@@ -87,7 +88,7 @@ namespace Beeps
87
88
 
88
89
  Processor::operator bool () const
89
90
  {
90
- return self->has_generator();
91
+ return self->generator || (self->input && *self->input);
91
92
  }
92
93
 
93
94
  bool
@@ -99,6 +100,12 @@ namespace Beeps
99
100
  void
100
101
  Processor::process (Context* context, Signals* signals, uint* offset)
101
102
  {
103
+ if (!self->started)
104
+ {
105
+ self->started = true;
106
+ on_start();
107
+ }
108
+
102
109
  if (self->generator)
103
110
  generate(context, signals, offset);
104
111
  else
data/src/signals.cpp CHANGED
@@ -216,6 +216,24 @@ namespace Beeps
216
216
  return resample_frames(to, from, from_offset);
217
217
  }
218
218
 
219
+ void
220
+ Signals_add (Signals* signals, const Signals& add)
221
+ {
222
+ if (!signals)
223
+ argument_error(__FILE__, __LINE__);
224
+ if (signals->nchannels() != add.nchannels())
225
+ argument_error(__FILE__, __LINE__);
226
+
227
+ Frames* sigf = Signals_get_frames(signals);
228
+ Frames* addf = Signals_get_frames(const_cast<Signals*>(&add));
229
+ Float* sigp = &(*sigf)(0, 0);
230
+ Float* addp = &(*addf)(0, 0);
231
+ uint nframes = std::min(sigf->nframes(), addf->nframes());
232
+
233
+ for (uint i = 0; i < nframes; ++i, ++sigp, ++addp)
234
+ *sigp += *addp;
235
+ }
236
+
219
237
  void
220
238
  Signals_multiply (Signals* signals, const Signals& multiplier)
221
239
  {
@@ -226,16 +244,16 @@ namespace Beeps
226
244
  if (signals->capacity() != multiplier.capacity())
227
245
  argument_error(__FILE__, __LINE__);
228
246
 
229
- Frames* sigf = Signals_get_frames(signals);
230
- Frames* mulf = Signals_get_frames(const_cast<Signals*>(&multiplier));
231
- uint nframes = sigf->nframes();
232
- uint stride = sigf->nchannels();
247
+ Frames* sigf = Signals_get_frames(signals);
248
+ Frames* mulf = Signals_get_frames(const_cast<Signals*>(&multiplier));
249
+ uint nchannels = sigf->nchannels();
250
+ uint nframes = sigf->nframes();
233
251
 
234
- for (uint ch = 0; ch < sigf->nchannels(); ++ch)
252
+ for (uint ch = 0; ch < nchannels; ++ch)
235
253
  {
236
254
  Float* sigp = &(*sigf)(0, ch);
237
255
  Float* mulp = &(*mulf)(0, 0);
238
- for (uint i = 0; i < nframes; ++i, sigp += stride, ++mulp)
256
+ for (uint i = 0; i < nframes; i += nchannels, sigp += nchannels, ++mulp)
239
257
  *sigp *= *mulp;
240
258
  }
241
259
  }
data/src/signals.h CHANGED
@@ -39,6 +39,8 @@ namespace Beeps
39
39
 
40
40
  uint Signals_copy (Signals* to, const Signals& from, uint from_offset);
41
41
 
42
+ void Signals_add ( Signals* signals, const Signals& add);
43
+
42
44
  void Signals_multiply (Signals* signals, const Signals& multiplier);
43
45
 
44
46
  template <typename T>
@@ -63,7 +65,7 @@ namespace Beeps
63
65
 
64
66
  public:
65
67
 
66
- Frames (unsigned int nframes = 0, unsigned int nchannels = 0)
68
+ Frames (unsigned int nframes = 0, unsigned int nchannels = 1)
67
69
  : stk::StkFrames(nframes, nchannels)
68
70
  {
69
71
  }
@@ -98,6 +100,11 @@ namespace Beeps
98
100
  bufferSize_ = saved_bufferSize_;
99
101
  }
100
102
 
103
+ uint sample_rate () const
104
+ {
105
+ return dataRate();
106
+ }
107
+
101
108
  uint nchannels () const
102
109
  {
103
110
  return nChannels_;
@@ -34,7 +34,7 @@ class TestProcessor < Test::Unit::TestCase
34
34
  assert_equal gain1, gain2.input
35
35
  end
36
36
 
37
- def test_shift_left()
37
+ def _test_shift_left()
38
38
  osc = B::Oscillator.new
39
39
  gain1 = B::Gain.new
40
40
  gain2 = B::Gain.new
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beeps
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - xordog
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-22 00:00:00.000000000 Z
11
+ date: 2025-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xot
@@ -16,40 +16,40 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.3.3
19
+ version: 0.3.4
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 0.3.3
22
+ version: 0.3.4
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: 0.3.3
29
+ version: 0.3.4
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 0.3.3
32
+ version: 0.3.4
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: rucy
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: 0.3.3
39
+ version: 0.3.4
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: 0.3.3
42
+ version: 0.3.4
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: 0.3.3
49
+ version: 0.3.4
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
- version: 0.3.3
52
+ version: 0.3.4
53
53
  description: Synthesize and play beep sounds.
54
54
  email: xordog@gmail.com
55
55
  executables: []
@@ -63,6 +63,7 @@ extra_rdoc_files:
63
63
  - ".doc/ext/beeps/file_in.cpp"
64
64
  - ".doc/ext/beeps/gain.cpp"
65
65
  - ".doc/ext/beeps/mic_in.cpp"
66
+ - ".doc/ext/beeps/mixer.cpp"
66
67
  - ".doc/ext/beeps/native.cpp"
67
68
  - ".doc/ext/beeps/oscillator.cpp"
68
69
  - ".doc/ext/beeps/pitch_shift.cpp"
@@ -79,6 +80,7 @@ files:
79
80
  - ".doc/ext/beeps/file_in.cpp"
80
81
  - ".doc/ext/beeps/gain.cpp"
81
82
  - ".doc/ext/beeps/mic_in.cpp"
83
+ - ".doc/ext/beeps/mixer.cpp"
82
84
  - ".doc/ext/beeps/native.cpp"
83
85
  - ".doc/ext/beeps/oscillator.cpp"
84
86
  - ".doc/ext/beeps/pitch_shift.cpp"
@@ -108,6 +110,7 @@ files:
108
110
  - ext/beeps/file_in.cpp
109
111
  - ext/beeps/gain.cpp
110
112
  - ext/beeps/mic_in.cpp
113
+ - ext/beeps/mixer.cpp
111
114
  - ext/beeps/native.cpp
112
115
  - ext/beeps/oscillator.cpp
113
116
  - ext/beeps/pitch_shift.cpp
@@ -150,6 +153,7 @@ files:
150
153
  - src/gain.cpp
151
154
  - src/mic_in.cpp
152
155
  - src/mic_in.h
156
+ - src/mixer.cpp
153
157
  - src/openal.cpp
154
158
  - src/openal.h
155
159
  - src/oscillator.cpp
@@ -178,7 +182,8 @@ files:
178
182
  homepage: https://github.com/xord/beeps
179
183
  licenses:
180
184
  - MIT
181
- metadata: {}
185
+ metadata:
186
+ msys2_mingw_dependencies: openal
182
187
  post_install_message:
183
188
  rdoc_options: []
184
189
  require_paths: