native_audio 0.2.0 → 0.3.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.
- checksums.yaml +4 -4
- data/assets/include/SDL2/SDL.h +233 -233
- data/assets/include/SDL2/SDL_assert.h +326 -326
- data/assets/include/SDL2/SDL_atomic.h +415 -415
- data/assets/include/SDL2/SDL_audio.h +1500 -1500
- data/assets/include/SDL2/SDL_bits.h +126 -126
- data/assets/include/SDL2/SDL_blendmode.h +198 -198
- data/assets/include/SDL2/SDL_clipboard.h +141 -141
- data/assets/include/SDL2/SDL_config.h +61 -61
- data/assets/include/SDL2/SDL_config_android.h +194 -194
- data/assets/include/SDL2/SDL_config_emscripten.h +218 -218
- data/assets/include/SDL2/SDL_config_iphoneos.h +217 -217
- data/assets/include/SDL2/SDL_config_macosx.h +277 -277
- data/assets/include/SDL2/SDL_config_minimal.h +95 -95
- data/assets/include/SDL2/SDL_config_ngage.h +89 -89
- data/assets/include/SDL2/SDL_config_os2.h +207 -207
- data/assets/include/SDL2/SDL_config_pandora.h +141 -141
- data/assets/include/SDL2/SDL_config_windows.h +331 -331
- data/assets/include/SDL2/SDL_config_wingdk.h +253 -253
- data/assets/include/SDL2/SDL_config_winrt.h +220 -220
- data/assets/include/SDL2/SDL_config_xbox.h +235 -235
- data/assets/include/SDL2/SDL_copying.h +20 -20
- data/assets/include/SDL2/SDL_cpuinfo.h +594 -594
- data/assets/include/SDL2/SDL_egl.h +2352 -2352
- data/assets/include/SDL2/SDL_endian.h +348 -348
- data/assets/include/SDL2/SDL_error.h +163 -163
- data/assets/include/SDL2/SDL_events.h +1166 -1166
- data/assets/include/SDL2/SDL_filesystem.h +149 -149
- data/assets/include/SDL2/SDL_gamecontroller.h +1074 -1074
- data/assets/include/SDL2/SDL_gesture.h +117 -117
- data/assets/include/SDL2/SDL_guid.h +100 -100
- data/assets/include/SDL2/SDL_haptic.h +1341 -1341
- data/assets/include/SDL2/SDL_hidapi.h +451 -451
- data/assets/include/SDL2/SDL_hints.h +2569 -2569
- data/assets/include/SDL2/SDL_image.h +2173 -2173
- data/assets/include/SDL2/SDL_joystick.h +1066 -1066
- data/assets/include/SDL2/SDL_keyboard.h +353 -353
- data/assets/include/SDL2/SDL_keycode.h +358 -358
- data/assets/include/SDL2/SDL_loadso.h +115 -115
- data/assets/include/SDL2/SDL_locale.h +103 -103
- data/assets/include/SDL2/SDL_log.h +404 -404
- data/assets/include/SDL2/SDL_main.h +275 -275
- data/assets/include/SDL2/SDL_messagebox.h +193 -193
- data/assets/include/SDL2/SDL_metal.h +113 -113
- data/assets/include/SDL2/SDL_misc.h +79 -79
- data/assets/include/SDL2/SDL_mixer.h +2784 -2784
- data/assets/include/SDL2/SDL_mouse.h +465 -465
- data/assets/include/SDL2/SDL_mutex.h +471 -471
- data/assets/include/SDL2/SDL_name.h +33 -33
- data/assets/include/SDL2/SDL_opengl.h +2132 -2132
- data/assets/include/SDL2/SDL_opengl_glext.h +13209 -13209
- data/assets/include/SDL2/SDL_opengles.h +39 -39
- data/assets/include/SDL2/SDL_opengles2.h +52 -52
- data/assets/include/SDL2/SDL_opengles2_gl2.h +656 -656
- data/assets/include/SDL2/SDL_opengles2_gl2ext.h +4033 -4033
- data/assets/include/SDL2/SDL_opengles2_gl2platform.h +27 -27
- data/assets/include/SDL2/SDL_opengles2_khrplatform.h +311 -311
- data/assets/include/SDL2/SDL_pixels.h +644 -644
- data/assets/include/SDL2/SDL_platform.h +261 -261
- data/assets/include/SDL2/SDL_power.h +88 -88
- data/assets/include/SDL2/SDL_quit.h +58 -58
- data/assets/include/SDL2/SDL_rect.h +376 -376
- data/assets/include/SDL2/SDL_render.h +1919 -1919
- data/assets/include/SDL2/SDL_revision.h +6 -6
- data/assets/include/SDL2/SDL_rwops.h +841 -841
- data/assets/include/SDL2/SDL_scancode.h +438 -438
- data/assets/include/SDL2/SDL_sensor.h +322 -322
- data/assets/include/SDL2/SDL_shape.h +155 -155
- data/assets/include/SDL2/SDL_stdinc.h +830 -830
- data/assets/include/SDL2/SDL_surface.h +997 -997
- data/assets/include/SDL2/SDL_system.h +623 -623
- data/assets/include/SDL2/SDL_syswm.h +386 -386
- data/assets/include/SDL2/SDL_test.h +69 -69
- data/assets/include/SDL2/SDL_test_assert.h +105 -105
- data/assets/include/SDL2/SDL_test_common.h +236 -236
- data/assets/include/SDL2/SDL_test_compare.h +69 -69
- data/assets/include/SDL2/SDL_test_crc32.h +124 -124
- data/assets/include/SDL2/SDL_test_font.h +168 -168
- data/assets/include/SDL2/SDL_test_fuzzer.h +386 -386
- data/assets/include/SDL2/SDL_test_harness.h +134 -134
- data/assets/include/SDL2/SDL_test_images.h +78 -78
- data/assets/include/SDL2/SDL_test_log.h +67 -67
- data/assets/include/SDL2/SDL_test_md5.h +129 -129
- data/assets/include/SDL2/SDL_test_memory.h +63 -63
- data/assets/include/SDL2/SDL_test_random.h +115 -115
- data/assets/include/SDL2/SDL_thread.h +464 -464
- data/assets/include/SDL2/SDL_timer.h +222 -222
- data/assets/include/SDL2/SDL_touch.h +150 -150
- data/assets/include/SDL2/SDL_ttf.h +2316 -2316
- data/assets/include/SDL2/SDL_types.h +29 -29
- data/assets/include/SDL2/SDL_version.h +204 -204
- data/assets/include/SDL2/SDL_video.h +2150 -2150
- data/assets/include/SDL2/SDL_vulkan.h +215 -215
- data/assets/include/SDL2/begin_code.h +187 -187
- data/assets/include/SDL2/close_code.h +40 -40
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libFLAC.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libSDL2.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libSDL2_mixer.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libmodplug.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libmpg123.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libogg.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libopus.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libopusfile.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libsndfile.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libstdc++.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libvorbis.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libvorbisfile.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libz.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libFLAC.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libSDL2.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libSDL2_mixer.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libmodplug.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libmpg123.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libogg.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libopus.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libopusfile.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libsndfile.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libstdc++.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libvorbis.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libvorbisfile.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libz.a +0 -0
- data/ext/{audio.c → audio/audio.c} +80 -80
- data/ext/{extconf.h → audio/extconf.h} +3 -3
- data/ext/audio/extconf.rb +115 -0
- data/lib/native_audio.rb +50 -50
- metadata +7 -27
- data/assets/include/GL/glew.h +0 -26427
- data/assets/include/GLES2/gl2.h +0 -656
- data/assets/include/GLES2/gl2ext.h +0 -3949
- data/assets/include/GLES2/gl2ext_angle.h +0 -701
- data/assets/include/GLES2/gl2platform.h +0 -27
- data/assets/include/GLES3/gl3.h +0 -1192
- data/assets/include/GLES3/gl31.h +0 -1507
- data/assets/include/GLES3/gl32.h +0 -1808
- data/assets/include/GLES3/gl3platform.h +0 -27
- data/assets/include/KHR/khrplatform.h +0 -290
- data/assets/macos/universal/lib/libSDL2_image.a +0 -0
- data/assets/macos/universal/lib/libSDL2_ttf.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libglew32.a +0 -0
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libssp.a +0 -1
- data/assets/windows/mingw-w64-ucrt-x86_64/lib/libzstd.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libglew32.a +0 -0
- data/assets/windows/mingw-w64-x86_64/lib/libssp.a +0 -1
- data/assets/windows/mingw-w64-x86_64/lib/libzstd.a +0 -0
- data/ext/extconf.rb +0 -173
- data/lib/audio.bundle +0 -0
- data/lib/audio.so +0 -0
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
#include <ruby.h>
|
|
2
|
-
#include "extconf.h"
|
|
3
|
-
#include <SDL2/SDL.h>
|
|
4
|
-
#include <SDL2/SDL_mixer.h>
|
|
5
|
-
|
|
6
|
-
Mix_Chunk *sounds[1024];
|
|
7
|
-
int sound_count = 0;
|
|
8
|
-
|
|
9
|
-
VALUE audio_play(VALUE self, VALUE channel_id, VALUE clip)
|
|
10
|
-
{
|
|
11
|
-
Mix_Chunk *sound = sounds[NUM2INT(clip)];
|
|
12
|
-
int channel = Mix_PlayChannel(NUM2INT(channel_id), sound, 0);
|
|
13
|
-
return rb_int2inum(channel);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
VALUE audio_load(VALUE self, VALUE file)
|
|
17
|
-
{
|
|
18
|
-
Mix_Chunk *sound = NULL;
|
|
19
|
-
sound = Mix_LoadWAV(StringValueCStr(file));
|
|
20
|
-
if(sound == NULL)
|
|
21
|
-
{
|
|
22
|
-
fprintf(stderr, "Unable to load WAV file: %s\n", Mix_GetError());
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
sounds[0] = sound;
|
|
26
|
-
sound_count++;
|
|
27
|
-
|
|
28
|
-
return rb_int2inum(sound_count - 1);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
VALUE audio_set_pos(VALUE self, VALUE channel_id, VALUE angle, VALUE distance)
|
|
32
|
-
{
|
|
33
|
-
Mix_SetPosition(NUM2INT(channel_id), NUM2INT(angle), NUM2INT(distance));
|
|
34
|
-
return Qnil;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
VALUE audio_stop(VALUE self, VALUE channel_id)
|
|
38
|
-
{
|
|
39
|
-
Mix_HaltChannel(NUM2INT(channel_id));
|
|
40
|
-
return Qnil;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
VALUE audio_pause(VALUE self, VALUE channel_id)
|
|
44
|
-
{
|
|
45
|
-
Mix_Pause(NUM2INT(channel_id));
|
|
46
|
-
return Qnil;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
VALUE audio_resume(VALUE self, VALUE channel_id)
|
|
50
|
-
{
|
|
51
|
-
Mix_Resume(NUM2INT(channel_id));
|
|
52
|
-
return Qnil;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
VALUE audio_set_volume(VALUE self, VALUE channel_id, VALUE volume)
|
|
56
|
-
{
|
|
57
|
-
Mix_Volume(NUM2INT(channel_id), NUM2INT(volume));
|
|
58
|
-
return Qnil;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
void Init_audio()
|
|
62
|
-
{
|
|
63
|
-
if (SDL_Init(SDL_INIT_AUDIO) != 0) { exit(1); }
|
|
64
|
-
|
|
65
|
-
int audio_rate = 22050;
|
|
66
|
-
Uint16 audio_format = AUDIO_S16SYS;
|
|
67
|
-
int audio_channels = 2;
|
|
68
|
-
int audio_buffers = 4096;
|
|
69
|
-
|
|
70
|
-
if(Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers) != 0) { exit(1); }
|
|
71
|
-
|
|
72
|
-
VALUE mAudio = rb_define_module("Audio");
|
|
73
|
-
rb_define_singleton_method(mAudio, "load", audio_load, 1);
|
|
74
|
-
rb_define_singleton_method(mAudio, "play", audio_play, 2);
|
|
75
|
-
rb_define_singleton_method(mAudio, "set_pos", audio_set_pos, 3);
|
|
76
|
-
rb_define_singleton_method(mAudio, "stop", audio_stop, 1);
|
|
77
|
-
rb_define_singleton_method(mAudio, "pause", audio_pause, 1);
|
|
78
|
-
rb_define_singleton_method(mAudio, "resume", audio_resume, 1);
|
|
79
|
-
rb_define_singleton_method(mAudio, "set_volume", audio_set_volume, 2);
|
|
80
|
-
}
|
|
1
|
+
#include <ruby.h>
|
|
2
|
+
#include "extconf.h"
|
|
3
|
+
#include <SDL2/SDL.h>
|
|
4
|
+
#include <SDL2/SDL_mixer.h>
|
|
5
|
+
|
|
6
|
+
Mix_Chunk *sounds[1024];
|
|
7
|
+
int sound_count = 0;
|
|
8
|
+
|
|
9
|
+
VALUE audio_play(VALUE self, VALUE channel_id, VALUE clip)
|
|
10
|
+
{
|
|
11
|
+
Mix_Chunk *sound = sounds[NUM2INT(clip)];
|
|
12
|
+
int channel = Mix_PlayChannel(NUM2INT(channel_id), sound, 0);
|
|
13
|
+
return rb_int2inum(channel);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
VALUE audio_load(VALUE self, VALUE file)
|
|
17
|
+
{
|
|
18
|
+
Mix_Chunk *sound = NULL;
|
|
19
|
+
sound = Mix_LoadWAV(StringValueCStr(file));
|
|
20
|
+
if(sound == NULL)
|
|
21
|
+
{
|
|
22
|
+
fprintf(stderr, "Unable to load WAV file: %s\n", Mix_GetError());
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
sounds[0] = sound;
|
|
26
|
+
sound_count++;
|
|
27
|
+
|
|
28
|
+
return rb_int2inum(sound_count - 1);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
VALUE audio_set_pos(VALUE self, VALUE channel_id, VALUE angle, VALUE distance)
|
|
32
|
+
{
|
|
33
|
+
Mix_SetPosition(NUM2INT(channel_id), NUM2INT(angle), NUM2INT(distance));
|
|
34
|
+
return Qnil;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
VALUE audio_stop(VALUE self, VALUE channel_id)
|
|
38
|
+
{
|
|
39
|
+
Mix_HaltChannel(NUM2INT(channel_id));
|
|
40
|
+
return Qnil;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
VALUE audio_pause(VALUE self, VALUE channel_id)
|
|
44
|
+
{
|
|
45
|
+
Mix_Pause(NUM2INT(channel_id));
|
|
46
|
+
return Qnil;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
VALUE audio_resume(VALUE self, VALUE channel_id)
|
|
50
|
+
{
|
|
51
|
+
Mix_Resume(NUM2INT(channel_id));
|
|
52
|
+
return Qnil;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
VALUE audio_set_volume(VALUE self, VALUE channel_id, VALUE volume)
|
|
56
|
+
{
|
|
57
|
+
Mix_Volume(NUM2INT(channel_id), NUM2INT(volume));
|
|
58
|
+
return Qnil;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
void Init_audio()
|
|
62
|
+
{
|
|
63
|
+
if (SDL_Init(SDL_INIT_AUDIO) != 0) { exit(1); }
|
|
64
|
+
|
|
65
|
+
int audio_rate = 22050;
|
|
66
|
+
Uint16 audio_format = AUDIO_S16SYS;
|
|
67
|
+
int audio_channels = 2;
|
|
68
|
+
int audio_buffers = 4096;
|
|
69
|
+
|
|
70
|
+
if(Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers) != 0) { exit(1); }
|
|
71
|
+
|
|
72
|
+
VALUE mAudio = rb_define_module("Audio");
|
|
73
|
+
rb_define_singleton_method(mAudio, "load", audio_load, 1);
|
|
74
|
+
rb_define_singleton_method(mAudio, "play", audio_play, 2);
|
|
75
|
+
rb_define_singleton_method(mAudio, "set_pos", audio_set_pos, 3);
|
|
76
|
+
rb_define_singleton_method(mAudio, "stop", audio_stop, 1);
|
|
77
|
+
rb_define_singleton_method(mAudio, "pause", audio_pause, 1);
|
|
78
|
+
rb_define_singleton_method(mAudio, "resume", audio_resume, 1);
|
|
79
|
+
rb_define_singleton_method(mAudio, "set_volume", audio_set_volume, 2);
|
|
80
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
#ifndef EXTCONF_H
|
|
2
|
-
#define EXTCONF_H
|
|
3
|
-
#endif
|
|
1
|
+
#ifndef EXTCONF_H
|
|
2
|
+
#define EXTCONF_H
|
|
3
|
+
#endif
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
require 'mkmf'
|
|
2
|
+
|
|
3
|
+
# Get the root directory of the gem (two levels up from ext/audio/)
|
|
4
|
+
ROOT_DIR = File.expand_path('../..', __dir__)
|
|
5
|
+
ASSETS_DIR = File.join(ROOT_DIR, 'assets')
|
|
6
|
+
|
|
7
|
+
# Detect platform
|
|
8
|
+
PLATFORM = case RUBY_PLATFORM
|
|
9
|
+
when /darwin/ then :macos
|
|
10
|
+
when /linux/ then :linux
|
|
11
|
+
when /mingw/ then :windows
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def add_flags(type, flags)
|
|
15
|
+
case type
|
|
16
|
+
when :c then $CFLAGS << " #{flags} "
|
|
17
|
+
when :ld then $LDFLAGS << " #{flags} "
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def check_sdl
|
|
22
|
+
return if have_library('SDL2') && have_library('SDL2_mixer')
|
|
23
|
+
|
|
24
|
+
msg = ["SDL2 libraries not found."]
|
|
25
|
+
|
|
26
|
+
if PLATFORM == :linux
|
|
27
|
+
if system('which apt >/dev/null 2>&1')
|
|
28
|
+
msg << "Install with: sudo apt install libsdl2-dev libsdl2-mixer-dev"
|
|
29
|
+
elsif system('which dnf >/dev/null 2>&1') || system('which yum >/dev/null 2>&1')
|
|
30
|
+
msg << "Install with: sudo dnf install SDL2-devel SDL2_mixer-devel"
|
|
31
|
+
elsif system('which pacman >/dev/null 2>&1')
|
|
32
|
+
msg << "Install with: sudo pacman -S sdl2 sdl2_mixer"
|
|
33
|
+
elsif system('which zypper >/dev/null 2>&1')
|
|
34
|
+
msg << "Install with: sudo zypper install libSDL2-devel libSDL2_mixer-devel"
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
abort msg.join("\n")
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def set_linux_flags
|
|
42
|
+
check_sdl
|
|
43
|
+
add_flags(:ld, "-lSDL2 -lSDL2_mixer -lm")
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def use_dev_libs
|
|
47
|
+
case PLATFORM
|
|
48
|
+
when :macos
|
|
49
|
+
add_flags(:c, `sdl2-config --cflags`)
|
|
50
|
+
add_flags(:c, '-I/opt/homebrew/include')
|
|
51
|
+
add_flags(:ld, `sdl2-config --libs`)
|
|
52
|
+
add_flags(:ld, '-lSDL2 -lSDL2_mixer')
|
|
53
|
+
when :windows
|
|
54
|
+
add_flags(:ld, '-lSDL2 -lSDL2_mixer')
|
|
55
|
+
when :linux
|
|
56
|
+
set_linux_flags
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def use_bundled_libs
|
|
61
|
+
add_flags(:c, '-std=c11')
|
|
62
|
+
|
|
63
|
+
case PLATFORM
|
|
64
|
+
when :macos
|
|
65
|
+
add_flags(:c, "-I#{ASSETS_DIR}/include")
|
|
66
|
+
ldir = "#{ASSETS_DIR}/macos/universal/lib"
|
|
67
|
+
|
|
68
|
+
add_flags(:ld, "#{ldir}/libSDL2.a #{ldir}/libSDL2_mixer.a")
|
|
69
|
+
add_flags(:ld, "#{ldir}/libmpg123.a #{ldir}/libogg.a #{ldir}/libFLAC.a")
|
|
70
|
+
add_flags(:ld, "#{ldir}/libvorbis.a #{ldir}/libvorbisfile.a #{ldir}/libmodplug.a")
|
|
71
|
+
add_flags(:ld, "-lz -liconv -lstdc++")
|
|
72
|
+
|
|
73
|
+
frameworks = %w[Cocoa Carbon GameController ForceFeedback
|
|
74
|
+
AudioToolbox CoreAudio IOKit CoreHaptics CoreVideo Metal]
|
|
75
|
+
add_flags(:ld, frameworks.map { |f| "-Wl,-framework,#{f}" }.join(' '))
|
|
76
|
+
|
|
77
|
+
when :windows
|
|
78
|
+
add_flags(:c, "-I#{ASSETS_DIR}/include")
|
|
79
|
+
|
|
80
|
+
ldir = if RUBY_PLATFORM =~ /ucrt/
|
|
81
|
+
"#{ASSETS_DIR}/windows/mingw-w64-ucrt-x86_64/lib"
|
|
82
|
+
else
|
|
83
|
+
"#{ASSETS_DIR}/windows/mingw-w64-x86_64/lib"
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
add_flags(:ld, "-Wl,--start-group")
|
|
87
|
+
add_flags(:ld, "#{ldir}/libSDL2.a #{ldir}/libSDL2_mixer.a")
|
|
88
|
+
add_flags(:ld, "#{ldir}/libmpg123.a #{ldir}/libFLAC.a #{ldir}/libvorbis.a")
|
|
89
|
+
add_flags(:ld, "#{ldir}/libvorbisfile.a #{ldir}/libogg.a #{ldir}/libmodplug.a")
|
|
90
|
+
add_flags(:ld, "#{ldir}/libopus.a #{ldir}/libopusfile.a #{ldir}/libsndfile.a")
|
|
91
|
+
add_flags(:ld, "#{ldir}/libstdc++.a #{ldir}/libz.a")
|
|
92
|
+
add_flags(:ld, '-lmingw32 -lole32 -loleaut32 -limm32')
|
|
93
|
+
add_flags(:ld, '-lversion -lwinmm -lrpcrt4 -mwindows -lsetupapi -ldwrite')
|
|
94
|
+
add_flags(:ld, "-Wl,--end-group")
|
|
95
|
+
|
|
96
|
+
when :linux
|
|
97
|
+
set_linux_flags
|
|
98
|
+
|
|
99
|
+
else
|
|
100
|
+
use_dev_libs
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# Main configuration
|
|
105
|
+
if ARGV.include?('dev')
|
|
106
|
+
use_dev_libs
|
|
107
|
+
else
|
|
108
|
+
use_bundled_libs
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
$CFLAGS.gsub!(/\n/, ' ')
|
|
112
|
+
$LDFLAGS.gsub!(/\n/, ' ')
|
|
113
|
+
|
|
114
|
+
create_header
|
|
115
|
+
create_makefile('audio')
|
data/lib/native_audio.rb
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative './audio'
|
|
4
|
-
|
|
5
|
-
module NativeAudio
|
|
6
|
-
class Clip
|
|
7
|
-
attr_reader :clip
|
|
8
|
-
|
|
9
|
-
def initialize(path)
|
|
10
|
-
@path = path
|
|
11
|
-
@clip = Audio.load(path)
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
class AudioSource
|
|
16
|
-
def initialize(clip)
|
|
17
|
-
@clip = clip
|
|
18
|
-
@channel = AudioSource.channels.count
|
|
19
|
-
AudioSource.channels << self
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def play
|
|
23
|
-
Audio.play(@channel, @clip.clip)
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def stop
|
|
27
|
-
Audio.stop(@channel)
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def pause
|
|
31
|
-
Audio.pause(@channel)
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def resume
|
|
35
|
-
Audio.resume(@channel)
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def set_pos(angle, distance)
|
|
39
|
-
Audio.set_pos(@channel, angle, distance)
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def set_volume(volume)
|
|
43
|
-
Audio.set_volume(@channel, volume)
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def self.channels
|
|
47
|
-
@channels ||= []
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
end
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative './audio'
|
|
4
|
+
|
|
5
|
+
module NativeAudio
|
|
6
|
+
class Clip
|
|
7
|
+
attr_reader :clip
|
|
8
|
+
|
|
9
|
+
def initialize(path)
|
|
10
|
+
@path = path
|
|
11
|
+
@clip = Audio.load(path)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
class AudioSource
|
|
16
|
+
def initialize(clip)
|
|
17
|
+
@clip = clip
|
|
18
|
+
@channel = AudioSource.channels.count
|
|
19
|
+
AudioSource.channels << self
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def play
|
|
23
|
+
Audio.play(@channel, @clip.clip)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def stop
|
|
27
|
+
Audio.stop(@channel)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def pause
|
|
31
|
+
Audio.pause(@channel)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def resume
|
|
35
|
+
Audio.resume(@channel)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def set_pos(angle, distance)
|
|
39
|
+
Audio.set_pos(@channel, angle, distance)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def set_volume(volume)
|
|
43
|
+
Audio.set_volume(@channel, volume)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def self.channels
|
|
47
|
+
@channels ||= []
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
metadata
CHANGED
|
@@ -1,32 +1,22 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: native_audio
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Max Hatfull
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 2026-01-26 00:00:00.000000000 Z
|
|
11
11
|
dependencies: []
|
|
12
12
|
description: A simple audio library for Ruby
|
|
13
13
|
email:
|
|
14
14
|
- max.hatfull@gmail.com
|
|
15
15
|
executables: []
|
|
16
16
|
extensions:
|
|
17
|
-
- ext/extconf.rb
|
|
17
|
+
- ext/audio/extconf.rb
|
|
18
18
|
extra_rdoc_files: []
|
|
19
19
|
files:
|
|
20
|
-
- assets/include/GL/glew.h
|
|
21
|
-
- assets/include/GLES2/gl2.h
|
|
22
|
-
- assets/include/GLES2/gl2ext.h
|
|
23
|
-
- assets/include/GLES2/gl2ext_angle.h
|
|
24
|
-
- assets/include/GLES2/gl2platform.h
|
|
25
|
-
- assets/include/GLES3/gl3.h
|
|
26
|
-
- assets/include/GLES3/gl31.h
|
|
27
|
-
- assets/include/GLES3/gl32.h
|
|
28
|
-
- assets/include/GLES3/gl3platform.h
|
|
29
|
-
- assets/include/KHR/khrplatform.h
|
|
30
20
|
- assets/include/SDL2/SDL.h
|
|
31
21
|
- assets/include/SDL2/SDL_assert.h
|
|
32
22
|
- assets/include/SDL2/SDL_atomic.h
|
|
@@ -123,9 +113,7 @@ files:
|
|
|
123
113
|
- assets/include/SDL2/close_code.h
|
|
124
114
|
- assets/macos/universal/lib/libFLAC.a
|
|
125
115
|
- assets/macos/universal/lib/libSDL2.a
|
|
126
|
-
- assets/macos/universal/lib/libSDL2_image.a
|
|
127
116
|
- assets/macos/universal/lib/libSDL2_mixer.a
|
|
128
|
-
- assets/macos/universal/lib/libSDL2_ttf.a
|
|
129
117
|
- assets/macos/universal/lib/libmodplug.a
|
|
130
118
|
- assets/macos/universal/lib/libmpg123.a
|
|
131
119
|
- assets/macos/universal/lib/libogg.a
|
|
@@ -134,40 +122,32 @@ files:
|
|
|
134
122
|
- assets/windows/mingw-w64-ucrt-x86_64/lib/libFLAC.a
|
|
135
123
|
- assets/windows/mingw-w64-ucrt-x86_64/lib/libSDL2.a
|
|
136
124
|
- assets/windows/mingw-w64-ucrt-x86_64/lib/libSDL2_mixer.a
|
|
137
|
-
- assets/windows/mingw-w64-ucrt-x86_64/lib/libglew32.a
|
|
138
125
|
- assets/windows/mingw-w64-ucrt-x86_64/lib/libmodplug.a
|
|
139
126
|
- assets/windows/mingw-w64-ucrt-x86_64/lib/libmpg123.a
|
|
140
127
|
- assets/windows/mingw-w64-ucrt-x86_64/lib/libogg.a
|
|
141
128
|
- assets/windows/mingw-w64-ucrt-x86_64/lib/libopus.a
|
|
142
129
|
- assets/windows/mingw-w64-ucrt-x86_64/lib/libopusfile.a
|
|
143
130
|
- assets/windows/mingw-w64-ucrt-x86_64/lib/libsndfile.a
|
|
144
|
-
- assets/windows/mingw-w64-ucrt-x86_64/lib/libssp.a
|
|
145
131
|
- assets/windows/mingw-w64-ucrt-x86_64/lib/libstdc++.a
|
|
146
132
|
- assets/windows/mingw-w64-ucrt-x86_64/lib/libvorbis.a
|
|
147
133
|
- assets/windows/mingw-w64-ucrt-x86_64/lib/libvorbisfile.a
|
|
148
134
|
- assets/windows/mingw-w64-ucrt-x86_64/lib/libz.a
|
|
149
|
-
- assets/windows/mingw-w64-ucrt-x86_64/lib/libzstd.a
|
|
150
135
|
- assets/windows/mingw-w64-x86_64/lib/libFLAC.a
|
|
151
136
|
- assets/windows/mingw-w64-x86_64/lib/libSDL2.a
|
|
152
137
|
- assets/windows/mingw-w64-x86_64/lib/libSDL2_mixer.a
|
|
153
|
-
- assets/windows/mingw-w64-x86_64/lib/libglew32.a
|
|
154
138
|
- assets/windows/mingw-w64-x86_64/lib/libmodplug.a
|
|
155
139
|
- assets/windows/mingw-w64-x86_64/lib/libmpg123.a
|
|
156
140
|
- assets/windows/mingw-w64-x86_64/lib/libogg.a
|
|
157
141
|
- assets/windows/mingw-w64-x86_64/lib/libopus.a
|
|
158
142
|
- assets/windows/mingw-w64-x86_64/lib/libopusfile.a
|
|
159
143
|
- assets/windows/mingw-w64-x86_64/lib/libsndfile.a
|
|
160
|
-
- assets/windows/mingw-w64-x86_64/lib/libssp.a
|
|
161
144
|
- assets/windows/mingw-w64-x86_64/lib/libstdc++.a
|
|
162
145
|
- assets/windows/mingw-w64-x86_64/lib/libvorbis.a
|
|
163
146
|
- assets/windows/mingw-w64-x86_64/lib/libvorbisfile.a
|
|
164
147
|
- assets/windows/mingw-w64-x86_64/lib/libz.a
|
|
165
|
-
-
|
|
166
|
-
- ext/audio.
|
|
167
|
-
- ext/extconf.
|
|
168
|
-
- ext/extconf.rb
|
|
169
|
-
- lib/audio.bundle
|
|
170
|
-
- lib/audio.so
|
|
148
|
+
- ext/audio/audio.c
|
|
149
|
+
- ext/audio/extconf.h
|
|
150
|
+
- ext/audio/extconf.rb
|
|
171
151
|
- lib/native_audio.rb
|
|
172
152
|
homepage: https://github.com/rubyrpg/native_audio
|
|
173
153
|
licenses:
|
|
@@ -187,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
187
167
|
- !ruby/object:Gem::Version
|
|
188
168
|
version: '0'
|
|
189
169
|
requirements: []
|
|
190
|
-
rubygems_version: 3.6.
|
|
170
|
+
rubygems_version: 3.6.2
|
|
191
171
|
specification_version: 4
|
|
192
172
|
summary: A simple audio library for Ruby
|
|
193
173
|
test_files: []
|