toxiclibs 0.9.1 → 0.9.2

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.
@@ -7,20 +7,18 @@ Gem::Specification.new do |spec|
7
7
  spec.name = 'toxiclibs'
8
8
  spec.version = Toxiclibs::VERSION
9
9
  spec.has_rdoc = true
10
- spec.extra_rdoc_files = %w{README.md LICENSE.md}
11
- spec.summary = %q{Updated and extended toxiclibs libraries for JRubyArt}
10
+ spec.extra_rdoc_files = %w(README.md LICENSE.md)
11
+ spec.summary = %q(Updated and extended toxiclibs libraries for JRubyArt and propane)
12
12
  spec.description =<<-EOS
13
- Toxiclibs java libraries wrapped in a rubygem. Compiled and tested with JRubyArt-1.2.5 and processing-3.2.1
13
+ Toxiclibs java libraries wrapped in a rubygem. Compiled and tested with JRubyArt-1.3.0 and processing-3.3
14
14
  EOS
15
- spec.licenses = %w{MIT LGPL-3.0}
16
- spec.authors = %w{Karsten\ Schmidt Martin\ Prout}
15
+ spec.licenses = %w(MIT LGPL-3.0)
16
+ spec.authors = %w(Karsten\ Schmidt Martin\ Prout)
17
17
  spec.email = 'mamba2928@yahoo.co.uk'
18
18
  spec.homepage = 'http://ruby-processing.github.io/toxicgem/'
19
19
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
20
  spec.files << 'lib/toxiclibs.jar'
21
- spec.files << 'lib/args4j-2.0.31.jar'
22
- spec.files << 'lib/joal-2.3.1.jar'
21
+ spec.files << 'lib/args4j-2.0.31.jar'
23
22
  spec.require_paths = ['lib']
24
- spec.add_dependency 'jruby_art', '~> 1.2'
25
23
  spec.add_development_dependency 'rake', '~> 11.2', '>= 11.2.2'
26
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: toxiclibs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karsten Schmidt
@@ -9,22 +9,8 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-10-28 00:00:00.000000000 Z
12
+ date: 2017-04-02 00:00:00.000000000 Z
13
13
  dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: jruby_art
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - "~>"
19
- - !ruby/object:Gem::Version
20
- version: '1.2'
21
- type: :runtime
22
- prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - "~>"
26
- - !ruby/object:Gem::Version
27
- version: '1.2'
28
14
  - !ruby/object:Gem::Dependency
29
15
  name: rake
30
16
  requirement: !ruby/object:Gem::Requirement
@@ -46,7 +32,7 @@ dependencies:
46
32
  - !ruby/object:Gem::Version
47
33
  version: 11.2.2
48
34
  description: " Toxiclibs java libraries wrapped in a rubygem. Compiled and tested
49
- with JRubyArt-1.2.5 and processing-3.2.1\n"
35
+ with JRubyArt-1.3.0 and processing-3.3\n"
50
36
  email: mamba2928@yahoo.co.uk
51
37
  executables: []
52
38
  extensions: []
@@ -70,6 +56,7 @@ files:
70
56
  - examples/attract_repel/attract_repel.rb
71
57
  - examples/attract_repel/attractor.rb
72
58
  - examples/attract_repel/particle.rb
59
+ - examples/boolean_shapes.rb
73
60
  - examples/data/ReplicaBold.ttf
74
61
  - examples/data/ti_yong.png
75
62
  - examples/force_directed/cluster.rb
@@ -95,12 +82,12 @@ files:
95
82
  - examples/spherical_harmonics_mesh.rb
96
83
  - examples/test_rect.rb
97
84
  - lib/args4j-2.0.31.jar
98
- - lib/joal-2.3.1.jar
99
85
  - lib/toxiclibs.jar
100
86
  - lib/toxiclibs.rb
101
87
  - lib/toxiclibs/version.rb
102
88
  - pom.rb
103
89
  - pom.xml
90
+ - src/BooleanShapes.java
104
91
  - src/com/toxi/net/ClientListener.java
105
92
  - src/com/toxi/net/ServerListener.java
106
93
  - src/com/toxi/net/ServerListenerAdapter.java
@@ -111,14 +98,6 @@ files:
111
98
  - src/com/toxi/nio/UDPClient.java
112
99
  - src/com/toxi/nio/UDPClientState.java
113
100
  - src/com/toxi/nio/UDPServer.java
114
- - src/toxi/audio/AudioBuffer.java
115
- - src/toxi/audio/AudioSource.java
116
- - src/toxi/audio/DecompressInputStream.java
117
- - src/toxi/audio/IIRFilter.java
118
- - src/toxi/audio/JOALUtil.java
119
- - src/toxi/audio/MultiTimbralManager.java
120
- - src/toxi/audio/SoundListener.java
121
- - src/toxi/audio/SynthUtil.java
122
101
  - src/toxi/color/AccessCriteria.java
123
102
  - src/toxi/color/AlphaAccessor.java
124
103
  - src/toxi/color/CMYKAccessor.java
@@ -481,8 +460,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
481
460
  version: '0'
482
461
  requirements: []
483
462
  rubyforge_project:
484
- rubygems_version: 2.6.3
463
+ rubygems_version: 2.6.11
485
464
  signing_key:
486
465
  specification_version: 4
487
- summary: Updated and extended toxiclibs libraries for JRubyArt
466
+ summary: Updated and extended toxiclibs libraries for JRubyArt and propane
488
467
  test_files: []
@@ -1,229 +0,0 @@
1
- /*
2
- * __ .__ .__ ._____.
3
- * _/ |_ _______ __|__| ____ | | |__\_ |__ ______
4
- * \ __\/ _ \ \/ / |/ ___\| | | || __ \ / ___/
5
- * | | ( <_> > <| \ \___| |_| || \_\ \\___ \
6
- * |__| \____/__/\_ \__|\___ >____/__||___ /____ >
7
- * \/ \/ \/ \/
8
- *
9
- * Copyright (c) 2006-2011 Karsten Schmidt
10
- *
11
- * This library is free software; you can redistribute it and/or
12
- * modify it under the terms of the GNU Lesser General Public
13
- * License as published by the Free Software Foundation; either
14
- * version 2.1 of the License, or (at your option) any later version.
15
- *
16
- * http://creativecommons.org/licenses/LGPL/2.1/
17
- *
18
- * This library is distributed in the hope that it will be useful,
19
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21
- * Lesser General Public License for more details.
22
- *
23
- * You should have received a copy of the GNU Lesser General Public
24
- * License along with this library; if not, write to the Free Software
25
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
26
- * Modified and updated by Martin Prout December 2015
27
- */
28
-
29
- package toxi.audio;
30
-
31
- import java.io.ByteArrayInputStream;
32
- import java.io.IOException;
33
- import java.nio.ByteBuffer;
34
- import com.jogamp.openal.AL;
35
-
36
- /**
37
- * A wrapper for the actual sample data byte buffer in memory. The buffer can be
38
- * queried to find out more information about the underlying audio data.
39
- */
40
- public class AudioBuffer {
41
-
42
- /**
43
- * Format descriptor
44
- */
45
- public enum Format {
46
- MONO8(AL.AL_FORMAT_MONO8, 8, 1), MONO16(AL.AL_FORMAT_MONO16, 16, 1), STEREO8(
47
- AL.AL_FORMAT_STEREO8, 8, 2), STEREO16(AL.AL_FORMAT_STEREO16,
48
- 16, 2);
49
-
50
- public static Format getForID(int id) {
51
- Format format = null;
52
- for (Format f : values()) {
53
- if (f.id == id) {
54
- format = f;
55
- break;
56
- }
57
- }
58
- return format;
59
- }
60
-
61
- private final int id;
62
- private final int numBits;
63
- private final int numChannels;
64
-
65
- private Format(int id, int bits, int channels) {
66
- this.id = id;
67
- this.numBits = bits;
68
- this.numChannels = channels;
69
- }
70
-
71
- public int getID() {
72
- return id;
73
- }
74
-
75
- /**
76
- * @return the numBits
77
- */
78
- public int getNumBits() {
79
- return numBits;
80
- }
81
-
82
- /**
83
- * @return the numChannels
84
- */
85
- public int getNumChannels() {
86
- return numChannels;
87
- }
88
- }
89
-
90
- protected final AL al;
91
- protected ByteBuffer data;
92
-
93
- protected final int id;
94
-
95
- protected final int[] alResult = new int[1];
96
- protected Format format;
97
-
98
- public AudioBuffer(AL al, int bufferID) {
99
- this.id = bufferID;
100
- this.al = al;
101
- }
102
-
103
- public AudioBuffer configure(ByteBuffer data, Format format, int freq) {
104
- return configure(data, format.getID(), freq);
105
- }
106
-
107
- /**
108
- * Configure the audio buffer
109
- *
110
- * @param data
111
- * the raw audio data
112
- * @param format
113
- * the internal format ID of the audio data
114
- * @param freq
115
- * the frequency of the data
116
- * @return
117
- */
118
- public AudioBuffer configure(ByteBuffer data, int format, int freq) {
119
- this.data = data;
120
- this.format = Format.getForID(format);
121
- al.alBufferData(id, format, data, data.capacity(), freq);
122
- return this;
123
- }
124
-
125
- public boolean convertUlawToPCM(boolean isAlaw) {
126
- byte[] ulaw = new byte[getByteSize()];
127
- data.rewind();
128
- data.get(ulaw);
129
- byte[] pcm = new byte[ulaw.length * 2];
130
- ByteArrayInputStream bin = new ByteArrayInputStream(ulaw);
131
- try {
132
- new DecompressInputStream(bin, isAlaw).read(pcm);
133
- configure(ByteBuffer.wrap(pcm), Format.MONO16, getFrequency());
134
- return true;
135
- } catch (IOException e) {
136
- }
137
- return false;
138
- }
139
-
140
- /**
141
- * Deletes this buffer, and frees its resources.
142
- *
143
- * @return true, if removed successfully
144
- */
145
- public boolean delete() {
146
- data = null;
147
- al.alDeleteBuffers(1, new int[] { id }, 0);
148
- return al.alGetError() == AL.AL_NO_ERROR;
149
- }
150
-
151
- /**
152
- * Get the bit-depth of the data, (8 or 16)
153
- *
154
- * @return the bit-depth of the data
155
- */
156
- public final int getBitDepth() {
157
- // al.alGetBufferi(id, AL.AL_BITS, alResult, 0);
158
- // return alResult[0];
159
- return format.getNumBits();
160
- }
161
-
162
- /**
163
- * Gets the size (in bytes) of the raw data contained in this buffer.
164
- *
165
- * @return the size of the data.
166
- */
167
- public final int getByteSize() {
168
- // al.alGetBufferi(id, AL.AL_SIZE, alResult, 0);
169
- // return alResult[0];
170
- return data.capacity();
171
- }
172
-
173
- /**
174
- * Gets the raw data contained in this buffer.
175
- *
176
- * @return the raw buffer data.
177
- */
178
- public final ByteBuffer getData() {
179
- return data;
180
- }
181
-
182
- /**
183
- * Gets the audio frequency of the data contained in this buffer.
184
- *
185
- * @return the frequency of the data
186
- */
187
- public final int getFrequency() {
188
- al.alGetBufferi(id, AL.AL_FREQUENCY, alResult, 0);
189
- return alResult[0];
190
- }
191
-
192
- /**
193
- * Returns the OpenAL reference ID for this buffer.
194
- *
195
- * @return buffer id
196
- */
197
- public final int getID() {
198
- return id;
199
- }
200
-
201
- /**
202
- * Get the number of channels of the data (1-Mono, 2-Stereo)
203
- *
204
- * @return the number of audio channels.
205
- */
206
- public final int getNumChannels() {
207
- // al.alGetBufferi(id, AL.AL_CHANNELS, alResult, 0);
208
- // return alResult[0];
209
- return format.getNumChannels();
210
- }
211
-
212
- /**
213
- * Gets the size (in samples) of the raw data contained in this buffer.
214
- *
215
- * @return sample size.
216
- */
217
- public final int getSampleSize() {
218
- return getByteSize() * 8 / getBitDepth() / getNumChannels();
219
- }
220
-
221
- /**
222
- *
223
- * @return
224
- */
225
- @Override
226
- public String toString() {
227
- return "AudioBuffer: id=" + id + " format=" + format;
228
- }
229
- }
@@ -1,288 +0,0 @@
1
- /*
2
- * __ .__ .__ ._____.
3
- * _/ |_ _______ __|__| ____ | | |__\_ |__ ______
4
- * \ __\/ _ \ \/ / |/ ___\| | | || __ \ / ___/
5
- * | | ( <_> > <| \ \___| |_| || \_\ \\___ \
6
- * |__| \____/__/\_ \__|\___ >____/__||___ /____ >
7
- * \/ \/ \/ \/
8
- *
9
- * Copyright (c) 2006-2011 Karsten Schmidt
10
- *
11
- * This library is free software; you can redistribute it and/or
12
- * modify it under the terms of the GNU Lesser General Public
13
- * License as published by the Free Software Foundation; either
14
- * version 2.1 of the License, or (at your option) any later version.
15
- *
16
- * http://creativecommons.org/licenses/LGPL/2.1/
17
- *
18
- * This library is distributed in the hope that it will be useful,
19
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21
- * Lesser General Public License for more details.
22
- *
23
- * You should have received a copy of the GNU Lesser General Public
24
- * License along with this library; if not, write to the Free Software
25
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
26
- */
27
-
28
- package toxi.audio;
29
-
30
- import com.jogamp.openal.AL;
31
- import toxi.geom.Vec3D;
32
- import toxi.math.MathUtils;
33
-
34
- /**
35
- * A wrapper for {@link AudioBuffer}s and similar to the built in JOAL
36
- * net.java.games.sound3d.Source, though less restrictive. The class extends
37
- * {@link Vec3D} and so can be used to position the sound in 3D space (provided
38
- * the underlying audio hardware does support 3D audio). Unfortunately due to
39
- * OpenAL's limitations only mono samples can be positioned in that way. Stereo
40
- * samples will can only manipulated in terms of gain/volume.
41
- *
42
- * <p>
43
- * If the position of an AudioSource is changed via the public x,y,z vector
44
- * components, the <code>updatePosition()</code> method needs to be called
45
- * afterwards in order to reflect the changes in the OpenAL context.
46
- */
47
- public class AudioSource extends Vec3D {
48
-
49
- protected AL al;
50
-
51
- protected AudioBuffer buffer;
52
-
53
- protected final int id;
54
- protected int size;
55
-
56
- protected final float[] position = { 0.0f, 0.0f, 0.0f };
57
- protected final float[] velocity = { 0.0f, 0.0f, 0.0f };
58
- protected final float[] direction = { 0.0f, 0.0f, 0.0f };
59
-
60
- protected int[] alResult = new int[1];
61
-
62
- protected boolean isLooping;
63
-
64
- public AudioSource(AL al, int id) {
65
- this(al, id, null);
66
- }
67
-
68
- public AudioSource(AL al, int id, AudioBuffer buf) {
69
- super();
70
- this.al = al;
71
- this.id = id;
72
- setBuffer(buf);
73
- }
74
-
75
- /**
76
- * Deletes this source, and free its resources. Note, this method does NOT
77
- * release the associated audio buffer. If you want to remove a source
78
- * including its wave data use
79
- * {@link JOALUtil#deleteSource(AudioSource, boolean)} instead.
80
- *
81
- * @return true, if source was removed successfully
82
- */
83
- public boolean delete() {
84
- stop();
85
- setBuffer(null);
86
- al.alDeleteSources(1, new int[] { id }, 0);
87
- return al.alGetError() == AL.AL_NO_ERROR;
88
- }
89
-
90
- /**
91
- * Gets the buffer associated with this source.
92
- *
93
- * @return the buffer associated with this source
94
- */
95
- public AudioBuffer getBuffer() {
96
- return buffer;
97
- }
98
-
99
- /**
100
- * Gets the number of buffers already processed on this source.
101
- *
102
- * @return the number of buffers already processed on this source.
103
- */
104
- public int getBuffersProcessed() {
105
- al.alGetSourcei(id, AL.AL_BUFFERS_PROCESSED, alResult, 0);
106
- return alResult[0];
107
- }
108
-
109
- public final float[] getDirection() {
110
- return direction;
111
- }
112
-
113
- public final int getID() {
114
- return id;
115
- }
116
-
117
- public final int getOffset() {
118
- al.alGetSourcei(id, AL.AL_SAMPLE_OFFSET, alResult, 0);
119
- return alResult[0];
120
- }
121
-
122
- public final float[] getPosition() {
123
- return position;
124
- }
125
-
126
- public final float[] getVelocity() {
127
- return velocity;
128
- }
129
-
130
- public final boolean isLooping() {
131
- return isLooping;
132
- }
133
-
134
- public final int length() {
135
- return size;
136
- }
137
-
138
- public AudioSource play() {
139
- if (buffer != null) {
140
- al.alSourcePlay(id);
141
- }
142
- return this;
143
- }
144
-
145
- public AudioSource rewind() {
146
- if (buffer != null) {
147
- al.alSourceRewind(id);
148
- }
149
- return this;
150
- }
151
-
152
- /**
153
- * Sets the buffer associated with this source.
154
- *
155
- * @param buffer
156
- * the buffer associated with this source
157
- * @return
158
- */
159
- public final AudioSource setBuffer(AudioBuffer buffer) {
160
- this.buffer = buffer;
161
- if (buffer != null) {
162
- al.alSourcei(id, AL.AL_BUFFER, buffer.getID());
163
- size = buffer.getSampleSize();
164
- } else {
165
- al.alSourcei(id, AL.AL_BUFFER, AL.AL_NONE);
166
- size = 0;
167
- }
168
- return this;
169
- }
170
-
171
- public AudioSource setDirection(float xx, float yy, float zz) {
172
- direction[0] = xx;
173
- direction[1] = yy;
174
- direction[2] = zz;
175
- al.alSourcefv(id, AL.AL_DIRECTION, direction, 0);
176
- return this;
177
- }
178
-
179
- public AudioSource setDirection(float[] d) {
180
- if (d.length == 3) {
181
- direction[0] = d[0];
182
- direction[1] = d[1];
183
- direction[2] = d[2];
184
- al.alSourcefv(id, AL.AL_DIRECTION, direction, 0);
185
- } else {
186
- throw new IllegalArgumentException("wrong number of array elements");
187
- }
188
- return this;
189
- }
190
-
191
- public AudioSource setDirection(Vec3D dir) {
192
- return setDirection(dir.x, dir.y, dir.z);
193
- }
194
-
195
- public AudioSource setGain(float gain) {
196
- al.alSourcef(id, AL.AL_GAIN, gain);
197
- return this;
198
- }
199
-
200
- public AudioSource setLooping(boolean state) {
201
- isLooping = state;
202
- al.alSourcei(id, AL.AL_LOOPING, (state ? AL.AL_TRUE : AL.AL_FALSE));
203
- return this;
204
- }
205
-
206
- public AudioSource setOffset(int off) {
207
- off = MathUtils.clip(off, 0, size - 1);
208
- al.alSourcei(id, AL.AL_SAMPLE_OFFSET, off);
209
- return this;
210
- }
211
-
212
- public AudioSource setPitch(float pitch) {
213
- al.alSourcef(id, AL.AL_PITCH, pitch);
214
- return this;
215
- }
216
-
217
- public AudioSource setPosition(float xx, float yy, float zz) {
218
- position[0] = xx;
219
- position[1] = yy;
220
- position[2] = zz;
221
- al.alSourcefv(id, AL.AL_POSITION, position, 0);
222
- return this;
223
- }
224
-
225
- public AudioSource setPosition(float[] p) {
226
- if (p.length == 3) {
227
- x = position[0] = p[0];
228
- y = position[1] = p[1];
229
- z = position[2] = p[2];
230
- al.alSourcefv(id, AL.AL_POSITION, position, 0);
231
- } else {
232
- throw new IllegalArgumentException("wrong number of array elements");
233
- }
234
- return this;
235
- }
236
-
237
- public AudioSource setPosition(Vec3D p) {
238
- return setPosition(p.x, p.y, p.z);
239
- }
240
-
241
- public AudioSource setReferenceDistance(float d) {
242
- al.alSourcef(id, AL.AL_REFERENCE_DISTANCE, d);
243
- return this;
244
- }
245
-
246
- public AudioSource setVelocity(float xx, float yy, float zz) {
247
- velocity[0] = xx;
248
- velocity[1] = yy;
249
- velocity[2] = zz;
250
- al.alSourcefv(id, AL.AL_VELOCITY, velocity, 0);
251
- return this;
252
- }
253
-
254
- public AudioSource setVelocity(float[] v) {
255
- if (v.length == 3) {
256
- velocity[0] = v[0];
257
- velocity[1] = v[1];
258
- velocity[2] = v[2];
259
- al.alSourcefv(id, AL.AL_VELOCITY, velocity, 0);
260
- } else {
261
- throw new IllegalArgumentException("wrong number of array elements");
262
- }
263
- return this;
264
- }
265
-
266
- public AudioSource setVelocity(Vec3D p) {
267
- return setVelocity(p.x, p.y, p.z);
268
- }
269
-
270
- public AudioSource stop() {
271
- al.alSourceStop(id);
272
- return this;
273
- }
274
-
275
- @Override
276
- public String toString() {
277
- return "AudioSource: id=" + id
278
- + (buffer != null ? " buffer=" + buffer.toString() : "");
279
- }
280
-
281
- public AudioSource updatePosition() {
282
- position[0] = x;
283
- position[1] = y;
284
- position[2] = z;
285
- al.alSourcefv(id, AL.AL_POSITION, position, 0);
286
- return this;
287
- }
288
- }