hallon-openal 0.0.3 → 1.0.0
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/CHANGELOG.md +4 -0
- data/README.md +5 -2
- data/ext/hallon/extconf.rb +7 -0
- data/ext/hallon/openal_ext.c +11 -11
- data/lib/hallon/openal/version.rb +1 -1
- metadata +7 -7
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -3,14 +3,17 @@
|
|
3
3
|
This gem supplies Hallon with the ability to stream audio through your
|
4
4
|
speakers using OpenAL.
|
5
5
|
|
6
|
+
As far as API goes it follows the [Hallon audio driver protocol](http://rubydoc.info/github/Burgestrand/Hallon/Hallon/ExampleAudioDriver).
|
7
|
+
|
6
8
|
## Installation
|
7
9
|
|
8
10
|
gem install hallon-openal
|
9
11
|
|
10
12
|
## Issues? Bugs? Feedback?
|
11
13
|
|
12
|
-
|
13
|
-
|
14
|
+
- __Got questions?__ Ask on the mailing list: <mailto:ruby-hallon@googlegroups.com> (<https://groups.google.com/d/forum/ruby-hallon>)
|
15
|
+
- __Found a bug?__ Report an issue: <https://github.com/Burgestrand/hallon-openal/issues/new>
|
16
|
+
- __Have feedback?__ I ❤ feedback! Please send it to the mailing list.
|
14
17
|
|
15
18
|
## License
|
16
19
|
|
data/ext/hallon/extconf.rb
CHANGED
@@ -11,6 +11,9 @@ $CFLAGS << ' -ggdb -O0 -Wextra'
|
|
11
11
|
|
12
12
|
error 'Missing ruby header' unless have_header 'ruby.h'
|
13
13
|
|
14
|
+
# Allow configuration of openal directory
|
15
|
+
dir_config 'openal'
|
16
|
+
|
14
17
|
if have_header('OpenAL/alc.h')
|
15
18
|
# yay, probably mac os!
|
16
19
|
elsif have_header('AL/alc.h')
|
@@ -28,4 +31,8 @@ else
|
|
28
31
|
error 'Missing openal library'
|
29
32
|
end
|
30
33
|
|
34
|
+
%w[alcOpenDevice alGetError].each do |func|
|
35
|
+
abort "Missing function #{func}" unless have_func(func)
|
36
|
+
end
|
37
|
+
|
31
38
|
create_makefile('openal_ext')
|
data/ext/hallon/openal_ext.c
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
#ifdef HAVE_AL_ALC_H
|
5
5
|
# include <AL/alc.h>
|
6
6
|
# include <AL/al.h>
|
7
|
-
#
|
7
|
+
#else
|
8
8
|
# include <OpenAL/alc.h>
|
9
9
|
# include <OpenAL/al.h>
|
10
10
|
#endif
|
@@ -90,7 +90,7 @@ static inline int _oa_format_channels(VALUE self)
|
|
90
90
|
static inline int _oa_format_rate(VALUE self)
|
91
91
|
{
|
92
92
|
VALUE rate = rb_hash_aref(oa_format_get(self), oa_key_rate);
|
93
|
-
return
|
93
|
+
return FIX2INT(rate);
|
94
94
|
}
|
95
95
|
|
96
96
|
static inline VALUE _oa_format_type(VALUE self)
|
@@ -188,14 +188,14 @@ static VALUE oa_stop(VALUE self)
|
|
188
188
|
ALuint source = oa_struct(self)->source;
|
189
189
|
rb_ivar_set(self, oa_iv_playing, Qfalse);
|
190
190
|
|
191
|
-
// remove all buffers from the source
|
192
|
-
alSourcei(source, AL_BUFFER, 0);
|
193
|
-
OA_CHECK_ERRORS("remove buffers!");
|
194
|
-
|
195
191
|
// and stop the source
|
196
192
|
alSourceStop(source);
|
197
193
|
OA_CHECK_ERRORS("stop!");
|
198
194
|
|
195
|
+
// remove all buffers from the source
|
196
|
+
alSourcei(source, AL_BUFFER, 0);
|
197
|
+
OA_CHECK_ERRORS("remove buffers!");
|
198
|
+
|
199
199
|
return self;
|
200
200
|
}
|
201
201
|
|
@@ -267,14 +267,14 @@ static VALUE oa_stream(VALUE self)
|
|
267
267
|
|
268
268
|
for (;;)
|
269
269
|
{
|
270
|
-
// make sure we have no preattached buffers
|
271
|
-
alSourcei(source, AL_BUFFER, 0);
|
272
|
-
OA_CHECK_ERRORS("detach all buffers from the source");
|
273
|
-
|
274
270
|
// make sure we’re not playing audio
|
275
271
|
alSourceStop(source);
|
276
272
|
OA_CHECK_ERRORS("reset driver");
|
277
273
|
|
274
|
+
// make sure we have no preattached buffers
|
275
|
+
alSourcei(source, AL_BUFFER, 0);
|
276
|
+
OA_CHECK_ERRORS("detach all buffers from the source");
|
277
|
+
|
278
278
|
// read the format (it never changes in the inner loop)
|
279
279
|
int f_channels = _oa_format_channels(self);
|
280
280
|
int f_rate = _oa_format_rate(self);
|
@@ -336,7 +336,7 @@ static VALUE oa_stream(VALUE self)
|
|
336
336
|
|
337
337
|
// pucker up all the params
|
338
338
|
ALenum type = f_channels == 1 ? AL_FORMAT_MONO16 : AL_FORMAT_STEREO16;
|
339
|
-
ALsizei size = f_size * num_current_samples;
|
339
|
+
ALsizei size = (ALsizei) f_size * num_current_samples;
|
340
340
|
ALsizei freq = f_rate;
|
341
341
|
|
342
342
|
// queue the data!
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hallon-openal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-05-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: hallon
|
16
|
-
requirement: &
|
16
|
+
requirement: &70151857522300 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0.13'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70151857522300
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &70151857521660 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '2.7'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70151857521660
|
36
36
|
description:
|
37
37
|
email:
|
38
38
|
- kim@burgestrand.se
|
@@ -76,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
76
|
version: '0'
|
77
77
|
requirements: []
|
78
78
|
rubyforge_project:
|
79
|
-
rubygems_version: 1.8.
|
79
|
+
rubygems_version: 1.8.17
|
80
80
|
signing_key:
|
81
81
|
specification_version: 3
|
82
82
|
summary: ! 'OpenAL audio drivers for Hallon: http://rubygems.org/gems/hallon'
|