ruby-openal 0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/TODO +160 -0
- data/ext/openal/MANIFEST +9 -0
- data/ext/openal/Makefile +149 -0
- data/ext/openal/extconf.rb +12 -0
- data/ext/openal/mkmf.log +66 -0
- data/ext/openal/openal.c +15 -0
- data/ext/openal/openal.h +50 -0
- data/ext/openal/openal.o +0 -0
- data/ext/openal/openal.so +0 -0
- data/ext/openal/openal_al.c +1406 -0
- data/ext/openal/openal_al.h +53 -0
- data/ext/openal/openal_al.o +0 -0
- data/ext/openal/openal_alc.c +416 -0
- data/ext/openal/openal_alc.h +44 -0
- data/ext/openal/openal_alc.o +0 -0
- data/ext/openal/openal_alut.c +181 -0
- data/ext/openal/openal_alut.h +49 -0
- data/ext/openal/openal_alut.o +0 -0
- data/ruby-openal.gemspec +30 -0
- data/setup.rb +1585 -0
- data/test/test_al.rb +67 -0
- data/test/test_al.rb~ +67 -0
- metadata +72 -0
data/TODO
ADDED
@@ -0,0 +1,160 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
= AL =
|
4
|
+
* DONE global-parameters
|
5
|
+
* DONE renderer-state management
|
6
|
+
* DONE states
|
7
|
+
* DONE errors
|
8
|
+
* DONE extensions
|
9
|
+
|
10
|
+
* DONE listener : AL::Listener
|
11
|
+
+ DONE AL::Listener#orientation (fx,fy,fz,ux,uy,uz)
|
12
|
+
+ DONE AL::Listener#gain (v)
|
13
|
+
+ DONE AL::Listener#position (x,y,z)
|
14
|
+
+ DONE AL::Listener#velocity (x,y,z)
|
15
|
+
+ DONE AL::Listener#to_s
|
16
|
+
|
17
|
+
|
18
|
+
* TESTME~
|
19
|
+
* source : AL::Source
|
20
|
+
* DONE + new
|
21
|
+
* DONE - initialize
|
22
|
+
#* - to_s
|
23
|
+
* DONE - attach(buf) # AL_BUFFER
|
24
|
+
* DONE - play
|
25
|
+
* DONE - stop
|
26
|
+
* DONE - pause
|
27
|
+
* DONE - rewind
|
28
|
+
* DONE - queue_buffers([bufs])
|
29
|
+
* DONE - unqueue_buffers([bufs])
|
30
|
+
* DONE - r: buffers_processed :i # AL_BUFFERS_PROCESSED
|
31
|
+
* DONE - rw: pitch(f) # AL_PITCH > 0
|
32
|
+
* DONE - rw: gain(f) # AL_GAIN > 0
|
33
|
+
* DONE - rw: max_distance(f) # AL_MAX_DISTANCE
|
34
|
+
* DONE - rw: rolloff_factor(f) # AL_ROLLOFF_FACTOR
|
35
|
+
* DONE - rw: reference_distance(f) # AL_REFERENCE_DISTANCE
|
36
|
+
* DONE - rw: min_gain(f) # AL_MIN_GAIN
|
37
|
+
* DONE - rw: max_gain(f) # AL_MAX_GAIN
|
38
|
+
* DONE - rw: cone_outer_gain(f) # AL_CONE_OUTER_GAIN
|
39
|
+
* DONE - rw: cone_inner_angle(f) # AL_CONE_INNER_ANGLE
|
40
|
+
* DONE - rw: cone_outer_angle(f) # AL_CONE_OUTER_ANGLE
|
41
|
+
* DONE - rw: position([x, y, z]) # AL_POSITION
|
42
|
+
* DONE - rw: velocity([x, y, z]) # AL_VELOCITY
|
43
|
+
* DONE - rw: direction([x, y, z]) # AL_DIRECTION
|
44
|
+
* DONE - rw: source_type(enum) # AL_SOURCE_TYPE [AL_UNDERTERMINED, AL_STATIC, AL_STREAMING]
|
45
|
+
* DONE - rw: looping(bool) # AL_LOOPING
|
46
|
+
* DONE - rw: source_state(enum) # AL_SOURCE_STATE [AL_STOPPPED, AL_PLAYING]
|
47
|
+
* DONE - rw: buffers_queued(i) # AL_BUFFERS_QUEUED
|
48
|
+
* DONE - rw: sec_offset(nsec) # AL_SEC_OFFSET
|
49
|
+
* DONE - rw: sample_offset(nsamples) # AL_SAMPLE_OFFSET
|
50
|
+
* DONE - rw: byte_offset(nbytes) # AL_BYTE_OFFSET
|
51
|
+
* DONE - rw: source_relative(bool) # AL_SOURCE_RELATIVE
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
* FIXME~
|
56
|
+
* buffer : AL::Buffer
|
57
|
+
- FIXME attach(sample_data)
|
58
|
+
+ DONE load_from_sample_data(sample_data)
|
59
|
+
+ DONE load_from_file(filename) # alutCreateBufferFromFile
|
60
|
+
+ DONE load_from_string(s) # alutCreateBufferFromFileImage
|
61
|
+
+ DONE load_hello_world # alutCreateBufferHelloWorld
|
62
|
+
+ DONE load_waveform # alutCreateBufferWaveform
|
63
|
+
- DONE r: frequency : ALint
|
64
|
+
- DONE r: size : ALint
|
65
|
+
- DONE r: bits : ALint
|
66
|
+
- DONE r: channels : ALint
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
= ALC =
|
72
|
+
* DONE errors : ALC::Device#get_error
|
73
|
+
* DONE context : ALC::Context
|
74
|
+
* DONE device : ALC::Device
|
75
|
+
* DONE extensions : ALC::Device#...
|
76
|
+
* DONE queries
|
77
|
+
|
78
|
+
* captures : ALC::CaptureDevice
|
79
|
+
* ALC::CaptureDevice
|
80
|
+
* DONE + ALC::CaptureDeivce#new(device_name, frequency : Fixnum, format : ALenum, bufsize : Fixnum)
|
81
|
+
* DONE - ALC::CaptureDevice#close : Boolean
|
82
|
+
* DONE - ALC::CaptureDevice#start
|
83
|
+
* DONE - ALC::CaptureDevice#stop
|
84
|
+
* - ALC::CaptureDevice#retrive???
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
= ALUT =
|
89
|
+
#* NO init
|
90
|
+
* DONE init_without_context
|
91
|
+
* DONE exit
|
92
|
+
* DONE get_error
|
93
|
+
* DONE get_error_string
|
94
|
+
* DONE get_mime_types
|
95
|
+
* DONE major_version
|
96
|
+
* DONE minor_version
|
97
|
+
* DONE sleep
|
98
|
+
|
99
|
+
----
|
100
|
+
|
101
|
+
샘플데이터는 대략
|
102
|
+
* void* data
|
103
|
+
* ALsizei bufsize
|
104
|
+
* ALenum fmt
|
105
|
+
* ALuint freq
|
106
|
+
...요렇게 4개의 데이터를 감싸는데 이를 잘 포장할 방법이 필요하삼. 새로운 클래스를 만들어서 이를 포장해야하겠지?
|
107
|
+
|
108
|
+
* AL::SampleData을 사용해서 이를 공개하도록.
|
109
|
+
* DONE + load_from_file(filename) (alutLoadMemoryFromFile)
|
110
|
+
* DONE + load_from_string(io) (alutLoadMemoryFromFileImage)
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
---
|
115
|
+
|
116
|
+
#include <stdio.h>
|
117
|
+
#include <AL/al.h>
|
118
|
+
#include <AL/alc.h>
|
119
|
+
|
120
|
+
int main( int argc, char *argv[] )
|
121
|
+
{
|
122
|
+
ALCdevice *mydevice;
|
123
|
+
ALubyte mybuf[16384];
|
124
|
+
ALint samples;
|
125
|
+
ALint leftch, rightch;
|
126
|
+
|
127
|
+
// 8000 Hz is really an overkill for my purpose
|
128
|
+
// We assume we'll be able to retrieve our samples at least 10 times
|
129
|
+
// a second. At 8000Hz, 16-bit, stereo, we need OpenAL to buffer at
|
130
|
+
// least 3200 bytes
|
131
|
+
mydevice = alcCaptureOpenDevice( NULL, 8000, AL_FORMAT_STEREO16, 3200 );
|
132
|
+
alcCaptureStart( mydevice );
|
133
|
+
|
134
|
+
// this would be the application main loop
|
135
|
+
while( 1)
|
136
|
+
{
|
137
|
+
// .....
|
138
|
+
|
139
|
+
// ... this would retrieve the samples, whenever I need it
|
140
|
+
|
141
|
+
// Copy the samples from OpenAL to our buffer
|
142
|
+
alcGetIntegerv(mydevice, ALC_CAPTURE_SAMPLES, &samples);
|
143
|
+
if (samples > 0)
|
144
|
+
alcCaptureSamples(mydevice, (ALCvoid *)mybuf, samples);
|
145
|
+
|
146
|
+
|
147
|
+
// process the samples....
|
148
|
+
|
149
|
+
// sleep(1);
|
150
|
+
|
151
|
+
// ......
|
152
|
+
}
|
153
|
+
|
154
|
+
alcCaptureStop( mydevice );
|
155
|
+
alcCaptureCloseDevice( mydevice );
|
156
|
+
|
157
|
+
return 0;
|
158
|
+
}
|
159
|
+
|
160
|
+
##EOF
|
data/ext/openal/MANIFEST
ADDED
data/ext/openal/Makefile
ADDED
@@ -0,0 +1,149 @@
|
|
1
|
+
|
2
|
+
SHELL = /bin/sh
|
3
|
+
|
4
|
+
#### Start of system configuration section. ####
|
5
|
+
|
6
|
+
srcdir = /home/ageldama/my/ruby-openal/trunk/ext/openal
|
7
|
+
topdir = /usr/lib/ruby/1.8/i486-linux
|
8
|
+
hdrdir = $(topdir)
|
9
|
+
VPATH = $(srcdir):$(topdir):$(hdrdir)
|
10
|
+
prefix = $(DESTDIR)/usr
|
11
|
+
exec_prefix = $(DESTDIR)/usr
|
12
|
+
sitedir = $(DESTDIR)/usr/local/lib/site_ruby
|
13
|
+
rubylibdir = $(libdir)/ruby/$(ruby_version)
|
14
|
+
docdir = $(datarootdir)/doc/$(PACKAGE)
|
15
|
+
dvidir = $(docdir)
|
16
|
+
datarootdir = $(prefix)/share
|
17
|
+
archdir = $(rubylibdir)/$(arch)
|
18
|
+
sbindir = $(exec_prefix)/sbin
|
19
|
+
psdir = $(docdir)
|
20
|
+
localedir = $(datarootdir)/locale
|
21
|
+
htmldir = $(docdir)
|
22
|
+
datadir = $(prefix)/share
|
23
|
+
includedir = $(prefix)/include
|
24
|
+
infodir = $(datarootdir)/info
|
25
|
+
sysconfdir = $(DESTDIR)/etc
|
26
|
+
mandir = $(datadir)/man
|
27
|
+
libdir = $(DESTDIR)/usr/lib
|
28
|
+
sharedstatedir = $(prefix)/com
|
29
|
+
oldincludedir = $(DESTDIR)/usr/include
|
30
|
+
pdfdir = $(docdir)
|
31
|
+
sitearchdir = $(sitelibdir)/$(sitearch)
|
32
|
+
bindir = $(exec_prefix)/bin
|
33
|
+
localstatedir = $(DESTDIR)/var
|
34
|
+
sitelibdir = $(sitedir)/$(ruby_version)
|
35
|
+
libexecdir = $(exec_prefix)/libexec
|
36
|
+
|
37
|
+
CC = gcc
|
38
|
+
LIBRUBY = $(LIBRUBY_SO)
|
39
|
+
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
|
40
|
+
LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
|
41
|
+
LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
|
42
|
+
|
43
|
+
RUBY_EXTCONF_H =
|
44
|
+
CFLAGS = -fPIC -Wall -g -fno-strict-aliasing -O2 -fPIC
|
45
|
+
INCFLAGS = -I. -I. -I/usr/lib/ruby/1.8/i486-linux -I/home/ageldama/my/ruby-openal/trunk/ext/openal
|
46
|
+
CPPFLAGS = -DHAVE_SNPRINTF
|
47
|
+
CXXFLAGS = $(CFLAGS)
|
48
|
+
DLDFLAGS = -rdynamic -Wl,-export-dynamic
|
49
|
+
LDSHARED = $(CC) -shared
|
50
|
+
AR = ar
|
51
|
+
EXEEXT =
|
52
|
+
|
53
|
+
RUBY_INSTALL_NAME = ruby1.8
|
54
|
+
RUBY_SO_NAME = ruby1.8
|
55
|
+
arch = i486-linux
|
56
|
+
sitearch = i486-linux
|
57
|
+
ruby_version = 1.8
|
58
|
+
ruby = /usr/bin/ruby1.8
|
59
|
+
RUBY = $(ruby)
|
60
|
+
RM = rm -f
|
61
|
+
MAKEDIRS = mkdir -p
|
62
|
+
INSTALL = /usr/bin/install -c
|
63
|
+
INSTALL_PROG = $(INSTALL) -m 0755
|
64
|
+
INSTALL_DATA = $(INSTALL) -m 644
|
65
|
+
COPY = cp
|
66
|
+
|
67
|
+
#### End of system configuration section. ####
|
68
|
+
|
69
|
+
preload =
|
70
|
+
|
71
|
+
libpath = $(libdir)
|
72
|
+
LIBPATH = -L"$(libdir)"
|
73
|
+
DEFFILE =
|
74
|
+
|
75
|
+
CLEANFILES =
|
76
|
+
DISTCLEANFILES =
|
77
|
+
|
78
|
+
extout =
|
79
|
+
extout_prefix =
|
80
|
+
target_prefix =
|
81
|
+
LOCAL_LIBS =
|
82
|
+
LIBS = $(LIBRUBYARG_SHARED) -lalut -lopenal -lpthread -ldl -lcrypt -lm -lc
|
83
|
+
SRCS = openal.c openal_alut.c openal_alc.c openal_al.c
|
84
|
+
OBJS = openal.o openal_alut.o openal_alc.o openal_al.o
|
85
|
+
TARGET = openal
|
86
|
+
DLLIB = $(TARGET).so
|
87
|
+
EXTSTATIC =
|
88
|
+
STATIC_LIB =
|
89
|
+
|
90
|
+
RUBYCOMMONDIR = $(sitedir)$(target_prefix)
|
91
|
+
RUBYLIBDIR = $(sitelibdir)$(target_prefix)
|
92
|
+
RUBYARCHDIR = $(sitearchdir)$(target_prefix)
|
93
|
+
|
94
|
+
TARGET_SO = $(DLLIB)
|
95
|
+
CLEANLIBS = $(TARGET).so $(TARGET).il? $(TARGET).tds $(TARGET).map
|
96
|
+
CLEANOBJS = *.o *.a *.s[ol] *.pdb *.exp *.bak
|
97
|
+
|
98
|
+
all: $(DLLIB)
|
99
|
+
static: $(STATIC_LIB)
|
100
|
+
|
101
|
+
clean:
|
102
|
+
@-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
|
103
|
+
|
104
|
+
distclean: clean
|
105
|
+
@-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
|
106
|
+
@-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
|
107
|
+
|
108
|
+
realclean: distclean
|
109
|
+
install: install-so install-rb
|
110
|
+
|
111
|
+
install-so: $(RUBYARCHDIR)
|
112
|
+
install-so: $(RUBYARCHDIR)/$(DLLIB)
|
113
|
+
$(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
|
114
|
+
$(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
|
115
|
+
install-rb: pre-install-rb install-rb-default
|
116
|
+
install-rb-default: pre-install-rb-default
|
117
|
+
pre-install-rb: Makefile
|
118
|
+
pre-install-rb-default: Makefile
|
119
|
+
$(RUBYARCHDIR):
|
120
|
+
$(MAKEDIRS) $@
|
121
|
+
|
122
|
+
site-install: site-install-so site-install-rb
|
123
|
+
site-install-so: install-so
|
124
|
+
site-install-rb: install-rb
|
125
|
+
|
126
|
+
.SUFFIXES: .c .m .cc .cxx .cpp .C .o
|
127
|
+
|
128
|
+
.cc.o:
|
129
|
+
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
130
|
+
|
131
|
+
.cxx.o:
|
132
|
+
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
133
|
+
|
134
|
+
.cpp.o:
|
135
|
+
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
136
|
+
|
137
|
+
.C.o:
|
138
|
+
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
139
|
+
|
140
|
+
.c.o:
|
141
|
+
$(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) -c $<
|
142
|
+
|
143
|
+
$(DLLIB): $(OBJS)
|
144
|
+
@-$(RM) $@
|
145
|
+
$(LDSHARED) $(DLDFLAGS) $(LIBPATH) -o $@ $(OBJS) $(LOCAL_LIBS) $(LIBS)
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
$(OBJS): ruby.h defines.h
|
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'mkmf'
|
3
|
+
|
4
|
+
dir_config("openal");
|
5
|
+
|
6
|
+
if have_library('openal', 'alGetError') and
|
7
|
+
have_func('snprintf', 'stdio.h') and
|
8
|
+
have_library('alut', 'alutGetErrorString') then
|
9
|
+
create_makefile("openal");
|
10
|
+
else
|
11
|
+
raise "No OpenAL library found."
|
12
|
+
end
|
data/ext/openal/mkmf.log
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
have_library: checking for alGetError() in -lopenal... -------------------- yes
|
2
|
+
|
3
|
+
"gcc -o conftest -I. -I/usr/lib/ruby/1.8/i486-linux -I/home/ageldama/my/ruby-openal/trunk/ext/openal -Wall -g -fno-strict-aliasing -O2 -fPIC conftest.c -L"/usr/lib" -rdynamic -Wl,-export-dynamic -lruby1.8-static -lopenal -lpthread -ldl -lcrypt -lm -lc"
|
4
|
+
conftest.c: In function ‘t’:
|
5
|
+
conftest.c:3: error: ‘alGetError’ undeclared (first use in this function)
|
6
|
+
conftest.c:3: error: (Each undeclared identifier is reported only once
|
7
|
+
conftest.c:3: error: for each function it appears in.)
|
8
|
+
checked program was:
|
9
|
+
/* begin */
|
10
|
+
1: /*top*/
|
11
|
+
2: int main() { return 0; }
|
12
|
+
3: int t() { void ((*volatile p)()); p = (void ((*)()))alGetError; return 0; }
|
13
|
+
/* end */
|
14
|
+
|
15
|
+
"gcc -o conftest -I. -I/usr/lib/ruby/1.8/i486-linux -I/home/ageldama/my/ruby-openal/trunk/ext/openal -Wall -g -fno-strict-aliasing -O2 -fPIC conftest.c -L"/usr/lib" -rdynamic -Wl,-export-dynamic -lruby1.8-static -lopenal -lpthread -ldl -lcrypt -lm -lc"
|
16
|
+
conftest.c: In function ‘t’:
|
17
|
+
conftest.c:3: warning: implicit declaration of function ‘alGetError’
|
18
|
+
checked program was:
|
19
|
+
/* begin */
|
20
|
+
1: /*top*/
|
21
|
+
2: int main() { return 0; }
|
22
|
+
3: int t() { alGetError(); return 0; }
|
23
|
+
/* end */
|
24
|
+
|
25
|
+
--------------------
|
26
|
+
|
27
|
+
have_func: checking for snprintf()... -------------------- yes
|
28
|
+
|
29
|
+
"gcc -o conftest -I. -I/usr/lib/ruby/1.8/i486-linux -I/home/ageldama/my/ruby-openal/trunk/ext/openal -Wall -g -fno-strict-aliasing -O2 -fPIC conftest.c -L"/usr/lib" -rdynamic -Wl,-export-dynamic -lopenal -lruby1.8-static -lopenal -lpthread -ldl -lcrypt -lm -lc"
|
30
|
+
checked program was:
|
31
|
+
/* begin */
|
32
|
+
1: #include <stdio.h>
|
33
|
+
2:
|
34
|
+
3: /*top*/
|
35
|
+
4: int main() { return 0; }
|
36
|
+
5: int t() { void ((*volatile p)()); p = (void ((*)()))snprintf; return 0; }
|
37
|
+
/* end */
|
38
|
+
|
39
|
+
--------------------
|
40
|
+
|
41
|
+
have_library: checking for alutGetErrorString() in -lalut... -------------------- yes
|
42
|
+
|
43
|
+
"gcc -o conftest -I. -I/usr/lib/ruby/1.8/i486-linux -I/home/ageldama/my/ruby-openal/trunk/ext/openal -Wall -g -fno-strict-aliasing -O2 -fPIC conftest.c -L"/usr/lib" -rdynamic -Wl,-export-dynamic -lopenal -lruby1.8-static -lalut -lopenal -lpthread -ldl -lcrypt -lm -lc"
|
44
|
+
conftest.c: In function ‘t’:
|
45
|
+
conftest.c:3: error: ‘alutGetErrorString’ undeclared (first use in this function)
|
46
|
+
conftest.c:3: error: (Each undeclared identifier is reported only once
|
47
|
+
conftest.c:3: error: for each function it appears in.)
|
48
|
+
checked program was:
|
49
|
+
/* begin */
|
50
|
+
1: /*top*/
|
51
|
+
2: int main() { return 0; }
|
52
|
+
3: int t() { void ((*volatile p)()); p = (void ((*)()))alutGetErrorString; return 0; }
|
53
|
+
/* end */
|
54
|
+
|
55
|
+
"gcc -o conftest -I. -I/usr/lib/ruby/1.8/i486-linux -I/home/ageldama/my/ruby-openal/trunk/ext/openal -Wall -g -fno-strict-aliasing -O2 -fPIC conftest.c -L"/usr/lib" -rdynamic -Wl,-export-dynamic -lopenal -lruby1.8-static -lalut -lopenal -lpthread -ldl -lcrypt -lm -lc"
|
56
|
+
conftest.c: In function ‘t’:
|
57
|
+
conftest.c:3: warning: implicit declaration of function ‘alutGetErrorString’
|
58
|
+
checked program was:
|
59
|
+
/* begin */
|
60
|
+
1: /*top*/
|
61
|
+
2: int main() { return 0; }
|
62
|
+
3: int t() { alutGetErrorString(); return 0; }
|
63
|
+
/* end */
|
64
|
+
|
65
|
+
--------------------
|
66
|
+
|
data/ext/openal/openal.c
ADDED
data/ext/openal/openal.h
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
#ifndef RUBY_OPENAL_H
|
2
|
+
#define RUBY_OPENAL_H
|
3
|
+
|
4
|
+
#ifdef __cplusplus
|
5
|
+
extern "C" {
|
6
|
+
#endif
|
7
|
+
|
8
|
+
#include "AL/al.h"
|
9
|
+
|
10
|
+
#include "openal_al.h"
|
11
|
+
#include "openal_alc.h"
|
12
|
+
#include "openal_alut.h"
|
13
|
+
|
14
|
+
/// data types
|
15
|
+
typedef struct {
|
16
|
+
void* buf;
|
17
|
+
ALsizei bufsize;
|
18
|
+
ALenum fmt;
|
19
|
+
ALuint freq;
|
20
|
+
} al_sample_data_t;
|
21
|
+
|
22
|
+
|
23
|
+
/// function prototypes
|
24
|
+
extern void Init_openal();
|
25
|
+
|
26
|
+
/// AL::SampleData internal object interface
|
27
|
+
extern al_sample_data_t* AL_SampleData_new();
|
28
|
+
extern void AL_SampleData_free(al_sample_data_t* p);
|
29
|
+
|
30
|
+
|
31
|
+
/// helper macros
|
32
|
+
#define albool2rbbool(b) ((b)?(Qtrue):(Qfalse))
|
33
|
+
|
34
|
+
#define RARRAY2ARRAY(rbary, ary, n, convf) \
|
35
|
+
VALUE ___v; int ___c;\
|
36
|
+
for(___c=0;___c<n;___c++){\
|
37
|
+
___v=rb_ary_entry(rbary,___c);\
|
38
|
+
ary[___c]=convf(___v);}
|
39
|
+
|
40
|
+
#define ARRAY2RARRAY(ary, rbary, n, convf) \
|
41
|
+
int ___c; \
|
42
|
+
for(___c=0;___c<n;___c++){\
|
43
|
+
rb_ary_push(rbary, convf(ary[___c]));}\
|
44
|
+
|
45
|
+
|
46
|
+
#ifdef __cplusplus
|
47
|
+
}
|
48
|
+
#endif
|
49
|
+
|
50
|
+
#endif
|