beeps 0.1.33 → 0.1.35
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 +4 -4
- data/.doc/ext/beeps/sound.cpp +10 -10
- data/.github/workflows/utils.rb +2 -1
- data/ChangeLog.md +11 -0
- data/VERSION +1 -1
- data/beeps.gemspec +2 -2
- data/ext/beeps/sound.cpp +11 -11
- data/include/beeps/sound.h +2 -2
- data/src/adsr.cpp +1 -1
- data/src/analyser.cpp +1 -1
- data/src/beeps.cpp +3 -0
- data/src/mic_in.cpp +11 -2
- data/src/mic_in.h +2 -0
- data/src/openal.cpp +0 -2
- data/src/processor.cpp +1 -1
- data/src/sound.cpp +20 -20
- data/src/sound.h +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4abd66d942c96bad56f00299a5243e3a0329fab261899a3b8d03446a81a8851e
|
4
|
+
data.tar.gz: 65b195ccb50cd33d18442f09d02efa9c9f07e4c51664ac397327b17a76c0c954
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 684012ab4651e9bf0653e004c0911b98e54cd917dfcfb644df7891e9a9ee9c53f904f7c98fc30cdecdc709813e21165c34d88c5f8a874549128b3b990a60d5a7
|
7
|
+
data.tar.gz: '08b3f641dbc010ae70a23a47f35b84957ecda237ea5bd8629bee8b6dcdd0198cbc1d0de752cb7ec3a2a39e0975635cc80492e635f35c0566e9d3a6999a2688a7'
|
data/.doc/ext/beeps/sound.cpp
CHANGED
@@ -36,15 +36,6 @@ VALUE play(VALUE self)
|
|
36
36
|
return value(THIS->play());
|
37
37
|
}
|
38
38
|
|
39
|
-
static
|
40
|
-
VALUE save(VALUE self, VALUE path)
|
41
|
-
{
|
42
|
-
CHECK;
|
43
|
-
|
44
|
-
THIS->save(path.c_str());
|
45
|
-
return self;
|
46
|
-
}
|
47
|
-
|
48
39
|
static
|
49
40
|
VALUE get_sample_rate(VALUE self)
|
50
41
|
{
|
@@ -103,6 +94,15 @@ VALUE get_loop(VALUE self)
|
|
103
94
|
return value(THIS->loop());
|
104
95
|
}
|
105
96
|
|
97
|
+
static
|
98
|
+
VALUE save(VALUE self, VALUE path)
|
99
|
+
{
|
100
|
+
CHECK;
|
101
|
+
|
102
|
+
THIS->save(path.c_str());
|
103
|
+
return self;
|
104
|
+
}
|
105
|
+
|
106
106
|
static
|
107
107
|
VALUE load(VALUE self, VALUE path)
|
108
108
|
{
|
@@ -121,7 +121,6 @@ Init_beeps_sound ()
|
|
121
121
|
rb_define_alloc_func(cSound, alloc);
|
122
122
|
rb_define_private_method(cSound, "setup", RUBY_METHOD_FUNC(setup), 4);
|
123
123
|
cSound.define_private_method("play!", play);
|
124
|
-
rb_define_method(cSound, "save", RUBY_METHOD_FUNC(save), 1);
|
125
124
|
rb_define_method(cSound, "sample_rate", RUBY_METHOD_FUNC(get_sample_rate), 0);
|
126
125
|
rb_define_method(cSound, "nchannels", RUBY_METHOD_FUNC(get_nchannels), 0);
|
127
126
|
rb_define_method(cSound, "seconds", RUBY_METHOD_FUNC(get_seconds), 0);
|
@@ -129,6 +128,7 @@ Init_beeps_sound ()
|
|
129
128
|
rb_define_method(cSound, "gain", RUBY_METHOD_FUNC(get_gain), 0);
|
130
129
|
rb_define_method(cSound, "loop=", RUBY_METHOD_FUNC(set_loop), 1);
|
131
130
|
rb_define_method(cSound, "loop", RUBY_METHOD_FUNC(get_loop), 0);
|
131
|
+
rb_define_method(cSound, "save", RUBY_METHOD_FUNC(save), 1);
|
132
132
|
rb_define_singleton_method(cSound, "load", RUBY_METHOD_FUNC(load), 1);
|
133
133
|
}
|
134
134
|
|
data/.github/workflows/utils.rb
CHANGED
@@ -20,8 +20,9 @@ def setup_dependencies(build: true, only: nil)
|
|
20
20
|
|
21
21
|
exts.each do |ext|
|
22
22
|
gem = RENAMES[ext.to_sym].then {|s| s || ext}
|
23
|
-
clone = "git clone --depth 1 https://github.com/xord/#{ext}.git ../#{ext}"
|
24
23
|
ver = gemspec[/add_runtime_dependency.*['"]#{gem}['"].*['"]\s*~>\s*([\d\.]+)\s*['"]/, 1]
|
24
|
+
opts = '-c advice.detachedHead=false --depth 1'
|
25
|
+
clone = "git clone #{opts} https://github.com/xord/#{ext}.git ../#{ext}"
|
25
26
|
|
26
27
|
# 'rake subtree:push' pushes all subrepos, so cloning by new tag
|
27
28
|
# often fails before tagging each new tag
|
data/ChangeLog.md
CHANGED
@@ -1,6 +1,17 @@
|
|
1
1
|
# beeps ChangeLog
|
2
2
|
|
3
3
|
|
4
|
+
## [v0.1.35] - 2023-04-30
|
5
|
+
|
6
|
+
- Place the save() method next to load()
|
7
|
+
|
8
|
+
|
9
|
+
## [v0.1.34] - 2023-04-25
|
10
|
+
|
11
|
+
- Clear mic streams on exit
|
12
|
+
- Fix compile errors on assert lines
|
13
|
+
|
14
|
+
|
4
15
|
## [v0.1.33] - 2023-04-22
|
5
16
|
|
6
17
|
- Stream playback is now supported.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.35
|
data/beeps.gemspec
CHANGED
@@ -28,8 +28,8 @@ Gem::Specification.new do |s|
|
|
28
28
|
s.platform = Gem::Platform::RUBY
|
29
29
|
s.required_ruby_version = '>= 2.7.0'
|
30
30
|
|
31
|
-
s.add_runtime_dependency 'xot', '~> 0.1.
|
32
|
-
s.add_runtime_dependency 'rucy', '~> 0.1.
|
31
|
+
s.add_runtime_dependency 'xot', '~> 0.1.34'
|
32
|
+
s.add_runtime_dependency 'rucy', '~> 0.1.34'
|
33
33
|
|
34
34
|
s.add_development_dependency 'rake'
|
35
35
|
s.add_development_dependency 'test-unit'
|
data/ext/beeps/sound.cpp
CHANGED
@@ -39,16 +39,6 @@ RUCY_DEF0(play)
|
|
39
39
|
}
|
40
40
|
RUCY_END
|
41
41
|
|
42
|
-
static
|
43
|
-
RUCY_DEF1(save, path)
|
44
|
-
{
|
45
|
-
CHECK;
|
46
|
-
|
47
|
-
THIS->save(path.c_str());
|
48
|
-
return self;
|
49
|
-
}
|
50
|
-
RUCY_END
|
51
|
-
|
52
42
|
static
|
53
43
|
RUCY_DEF0(get_sample_rate)
|
54
44
|
{
|
@@ -114,6 +104,16 @@ RUCY_DEF0(get_loop)
|
|
114
104
|
}
|
115
105
|
RUCY_END
|
116
106
|
|
107
|
+
static
|
108
|
+
RUCY_DEF1(save, path)
|
109
|
+
{
|
110
|
+
CHECK;
|
111
|
+
|
112
|
+
THIS->save(path.c_str());
|
113
|
+
return self;
|
114
|
+
}
|
115
|
+
RUCY_END
|
116
|
+
|
117
117
|
static
|
118
118
|
RUCY_DEF1(load, path)
|
119
119
|
{
|
@@ -133,7 +133,6 @@ Init_beeps_sound ()
|
|
133
133
|
cSound.define_alloc_func(alloc);
|
134
134
|
cSound.define_private_method("setup", setup);
|
135
135
|
cSound.define_private_method("play!", play);
|
136
|
-
cSound.define_method("save", save);
|
137
136
|
cSound.define_method("sample_rate", get_sample_rate);
|
138
137
|
cSound.define_method("nchannels", get_nchannels);
|
139
138
|
cSound.define_method("seconds", get_seconds);
|
@@ -141,6 +140,7 @@ Init_beeps_sound ()
|
|
141
140
|
cSound.define_method("gain", get_gain);
|
142
141
|
cSound.define_method("loop=", set_loop);
|
143
142
|
cSound.define_method("loop", get_loop);
|
143
|
+
cSound.define_method("save", save);
|
144
144
|
cSound.define_singleton_method("load", load);
|
145
145
|
}
|
146
146
|
|
data/include/beeps/sound.h
CHANGED
@@ -72,8 +72,6 @@ namespace Beeps
|
|
72
72
|
|
73
73
|
SoundPlayer play ();
|
74
74
|
|
75
|
-
void save (const char* path) const;
|
76
|
-
|
77
75
|
double sample_rate () const;
|
78
76
|
|
79
77
|
uint nchannels () const;
|
@@ -88,6 +86,8 @@ namespace Beeps
|
|
88
86
|
|
89
87
|
bool loop () const;
|
90
88
|
|
89
|
+
void save (const char* path) const;
|
90
|
+
|
91
91
|
operator bool () const;
|
92
92
|
|
93
93
|
bool operator ! () const;
|
data/src/adsr.cpp
CHANGED
@@ -150,7 +150,7 @@ namespace Beeps
|
|
150
150
|
size_t len = length_sec >= 0
|
151
151
|
? length_sec * sample_rate
|
152
152
|
: frames->nframes() - start;
|
153
|
-
assert(0 < len && (start + len) < frames->
|
153
|
+
assert(0 < len && (start + len) < frames->nframes());
|
154
154
|
|
155
155
|
return frames->slice(start, len);
|
156
156
|
}
|
data/src/analyser.cpp
CHANGED
@@ -217,7 +217,7 @@ namespace Beeps
|
|
217
217
|
uint from_nsamples = from.nsamples();
|
218
218
|
uint from_start = from_nsamples > to_cap ? from_nsamples - to_cap : 0;
|
219
219
|
uint nsamples = from_nsamples - from_start;
|
220
|
-
assert(to_nsamples + nsamples <=
|
220
|
+
assert(to_nsamples + nsamples <= to_cap);
|
221
221
|
|
222
222
|
for (uint ch = 0; ch < tof->nchannels(); ++ch)
|
223
223
|
{
|
data/src/beeps.cpp
CHANGED
data/src/mic_in.cpp
CHANGED
@@ -81,7 +81,7 @@ namespace Beeps
|
|
81
81
|
|
82
82
|
void get_signals (Signals* signals, uint* gen_offset)
|
83
83
|
{
|
84
|
-
assert(signals && signals->empty() &&
|
84
|
+
assert(signals && signals->empty() && gen_offset);
|
85
85
|
|
86
86
|
if (!is_valid()) return;
|
87
87
|
|
@@ -190,10 +190,19 @@ namespace Beeps
|
|
190
190
|
void
|
191
191
|
MicIn_process_streams ()
|
192
192
|
{
|
193
|
-
for (
|
193
|
+
for (auto& mic : global::mics)
|
194
194
|
mic.buffer_samples();
|
195
195
|
}
|
196
196
|
|
197
|
+
void
|
198
|
+
MicIn_clear_streams ()
|
199
|
+
{
|
200
|
+
for (auto& mic : global::mics)
|
201
|
+
mic.stop();
|
202
|
+
|
203
|
+
global::mics.clear();
|
204
|
+
}
|
205
|
+
|
197
206
|
|
198
207
|
MicIn::MicIn (uint nchannels, double sample_rate)
|
199
208
|
{
|
data/src/mic_in.h
CHANGED
data/src/openal.cpp
CHANGED
data/src/processor.cpp
CHANGED
data/src/sound.cpp
CHANGED
@@ -530,7 +530,7 @@ namespace Beeps
|
|
530
530
|
}
|
531
531
|
|
532
532
|
void
|
533
|
-
|
533
|
+
SoundPlayer_clear_streams ()
|
534
534
|
{
|
535
535
|
for (auto& player : global::players)
|
536
536
|
player.self->clear();
|
@@ -649,11 +649,6 @@ namespace Beeps
|
|
649
649
|
not_implemented_error(__FILE__, __LINE__);
|
650
650
|
}
|
651
651
|
|
652
|
-
virtual void save (const char* path) const
|
653
|
-
{
|
654
|
-
not_implemented_error(__FILE__, __LINE__);
|
655
|
-
}
|
656
|
-
|
657
652
|
virtual double sample_rate () const
|
658
653
|
{
|
659
654
|
return 0;
|
@@ -669,6 +664,11 @@ namespace Beeps
|
|
669
664
|
return 0;
|
670
665
|
}
|
671
666
|
|
667
|
+
virtual void save (const char* path) const
|
668
|
+
{
|
669
|
+
not_implemented_error(__FILE__, __LINE__);
|
670
|
+
}
|
671
|
+
|
672
672
|
virtual bool is_valid () const
|
673
673
|
{
|
674
674
|
return false;
|
@@ -706,14 +706,6 @@ namespace Beeps
|
|
706
706
|
player->self->attach_signals(signals);
|
707
707
|
}
|
708
708
|
|
709
|
-
void save (const char* path) const override
|
710
|
-
{
|
711
|
-
if (!signals)
|
712
|
-
invalid_state_error(__FILE__, __LINE__);
|
713
|
-
|
714
|
-
Signals_save(signals, path);
|
715
|
-
}
|
716
|
-
|
717
709
|
double sample_rate () const override
|
718
710
|
{
|
719
711
|
return signals ? signals.sample_rate() : Super::sample_rate();
|
@@ -729,6 +721,14 @@ namespace Beeps
|
|
729
721
|
return signals ? Signals_get_seconds(signals) : Super::seconds();
|
730
722
|
}
|
731
723
|
|
724
|
+
void save (const char* path) const override
|
725
|
+
{
|
726
|
+
if (!signals)
|
727
|
+
invalid_state_error(__FILE__, __LINE__);
|
728
|
+
|
729
|
+
Signals_save(signals, path);
|
730
|
+
}
|
731
|
+
|
732
732
|
bool is_valid () const override
|
733
733
|
{
|
734
734
|
return signals;
|
@@ -840,12 +840,6 @@ namespace Beeps
|
|
840
840
|
return player;
|
841
841
|
}
|
842
842
|
|
843
|
-
void
|
844
|
-
Sound::save (const char* path) const
|
845
|
-
{
|
846
|
-
self->save(path);
|
847
|
-
}
|
848
|
-
|
849
843
|
double
|
850
844
|
Sound::sample_rate () const
|
851
845
|
{
|
@@ -891,6 +885,12 @@ namespace Beeps
|
|
891
885
|
return self->loop;
|
892
886
|
}
|
893
887
|
|
888
|
+
void
|
889
|
+
Sound::save (const char* path) const
|
890
|
+
{
|
891
|
+
self->save(path);
|
892
|
+
}
|
893
|
+
|
894
894
|
Sound::operator bool () const
|
895
895
|
{
|
896
896
|
return self->is_valid();
|
data/src/sound.h
CHANGED
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.1.
|
4
|
+
version: 0.1.35
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- xordog
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-04-
|
11
|
+
date: 2023-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xot
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.1.
|
19
|
+
version: 0.1.34
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.1.
|
26
|
+
version: 0.1.34
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rucy
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.1.
|
33
|
+
version: 0.1.34
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.1.
|
40
|
+
version: 0.1.34
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|