native_audio 0.3.0 → 0.5.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.
Files changed (143) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +21 -0
  3. data/README.md +152 -0
  4. data/ext/audio/audio.c +541 -43
  5. data/ext/audio/audio.h +34 -0
  6. data/ext/audio/delay_node.c +185 -0
  7. data/ext/audio/delay_node.h +51 -0
  8. data/ext/audio/extconf.rb +12 -110
  9. data/ext/audio/miniaudio.h +95844 -0
  10. data/ext/audio/reverb_node.c +224 -0
  11. data/ext/audio/reverb_node.h +63 -0
  12. data/lib/dummy_audio.rb +94 -0
  13. data/lib/native_audio.rb +78 -7
  14. metadata +12 -132
  15. data/assets/include/SDL2/SDL.h +0 -233
  16. data/assets/include/SDL2/SDL_assert.h +0 -326
  17. data/assets/include/SDL2/SDL_atomic.h +0 -415
  18. data/assets/include/SDL2/SDL_audio.h +0 -1500
  19. data/assets/include/SDL2/SDL_bits.h +0 -126
  20. data/assets/include/SDL2/SDL_blendmode.h +0 -198
  21. data/assets/include/SDL2/SDL_clipboard.h +0 -141
  22. data/assets/include/SDL2/SDL_config.h +0 -61
  23. data/assets/include/SDL2/SDL_config_android.h +0 -194
  24. data/assets/include/SDL2/SDL_config_emscripten.h +0 -218
  25. data/assets/include/SDL2/SDL_config_iphoneos.h +0 -217
  26. data/assets/include/SDL2/SDL_config_macosx.h +0 -277
  27. data/assets/include/SDL2/SDL_config_minimal.h +0 -95
  28. data/assets/include/SDL2/SDL_config_ngage.h +0 -89
  29. data/assets/include/SDL2/SDL_config_os2.h +0 -207
  30. data/assets/include/SDL2/SDL_config_pandora.h +0 -141
  31. data/assets/include/SDL2/SDL_config_windows.h +0 -331
  32. data/assets/include/SDL2/SDL_config_wingdk.h +0 -253
  33. data/assets/include/SDL2/SDL_config_winrt.h +0 -220
  34. data/assets/include/SDL2/SDL_config_xbox.h +0 -235
  35. data/assets/include/SDL2/SDL_copying.h +0 -20
  36. data/assets/include/SDL2/SDL_cpuinfo.h +0 -594
  37. data/assets/include/SDL2/SDL_egl.h +0 -2352
  38. data/assets/include/SDL2/SDL_endian.h +0 -348
  39. data/assets/include/SDL2/SDL_error.h +0 -163
  40. data/assets/include/SDL2/SDL_events.h +0 -1166
  41. data/assets/include/SDL2/SDL_filesystem.h +0 -149
  42. data/assets/include/SDL2/SDL_gamecontroller.h +0 -1074
  43. data/assets/include/SDL2/SDL_gesture.h +0 -117
  44. data/assets/include/SDL2/SDL_guid.h +0 -100
  45. data/assets/include/SDL2/SDL_haptic.h +0 -1341
  46. data/assets/include/SDL2/SDL_hidapi.h +0 -451
  47. data/assets/include/SDL2/SDL_hints.h +0 -2569
  48. data/assets/include/SDL2/SDL_image.h +0 -2173
  49. data/assets/include/SDL2/SDL_joystick.h +0 -1066
  50. data/assets/include/SDL2/SDL_keyboard.h +0 -353
  51. data/assets/include/SDL2/SDL_keycode.h +0 -358
  52. data/assets/include/SDL2/SDL_loadso.h +0 -115
  53. data/assets/include/SDL2/SDL_locale.h +0 -103
  54. data/assets/include/SDL2/SDL_log.h +0 -404
  55. data/assets/include/SDL2/SDL_main.h +0 -275
  56. data/assets/include/SDL2/SDL_messagebox.h +0 -193
  57. data/assets/include/SDL2/SDL_metal.h +0 -113
  58. data/assets/include/SDL2/SDL_misc.h +0 -79
  59. data/assets/include/SDL2/SDL_mixer.h +0 -2784
  60. data/assets/include/SDL2/SDL_mouse.h +0 -465
  61. data/assets/include/SDL2/SDL_mutex.h +0 -471
  62. data/assets/include/SDL2/SDL_name.h +0 -33
  63. data/assets/include/SDL2/SDL_opengl.h +0 -2132
  64. data/assets/include/SDL2/SDL_opengl_glext.h +0 -13209
  65. data/assets/include/SDL2/SDL_opengles.h +0 -39
  66. data/assets/include/SDL2/SDL_opengles2.h +0 -52
  67. data/assets/include/SDL2/SDL_opengles2_gl2.h +0 -656
  68. data/assets/include/SDL2/SDL_opengles2_gl2ext.h +0 -4033
  69. data/assets/include/SDL2/SDL_opengles2_gl2platform.h +0 -27
  70. data/assets/include/SDL2/SDL_opengles2_khrplatform.h +0 -311
  71. data/assets/include/SDL2/SDL_pixels.h +0 -644
  72. data/assets/include/SDL2/SDL_platform.h +0 -261
  73. data/assets/include/SDL2/SDL_power.h +0 -88
  74. data/assets/include/SDL2/SDL_quit.h +0 -58
  75. data/assets/include/SDL2/SDL_rect.h +0 -376
  76. data/assets/include/SDL2/SDL_render.h +0 -1919
  77. data/assets/include/SDL2/SDL_revision.h +0 -6
  78. data/assets/include/SDL2/SDL_rwops.h +0 -841
  79. data/assets/include/SDL2/SDL_scancode.h +0 -438
  80. data/assets/include/SDL2/SDL_sensor.h +0 -322
  81. data/assets/include/SDL2/SDL_shape.h +0 -155
  82. data/assets/include/SDL2/SDL_stdinc.h +0 -830
  83. data/assets/include/SDL2/SDL_surface.h +0 -997
  84. data/assets/include/SDL2/SDL_system.h +0 -623
  85. data/assets/include/SDL2/SDL_syswm.h +0 -386
  86. data/assets/include/SDL2/SDL_test.h +0 -69
  87. data/assets/include/SDL2/SDL_test_assert.h +0 -105
  88. data/assets/include/SDL2/SDL_test_common.h +0 -236
  89. data/assets/include/SDL2/SDL_test_compare.h +0 -69
  90. data/assets/include/SDL2/SDL_test_crc32.h +0 -124
  91. data/assets/include/SDL2/SDL_test_font.h +0 -168
  92. data/assets/include/SDL2/SDL_test_fuzzer.h +0 -386
  93. data/assets/include/SDL2/SDL_test_harness.h +0 -134
  94. data/assets/include/SDL2/SDL_test_images.h +0 -78
  95. data/assets/include/SDL2/SDL_test_log.h +0 -67
  96. data/assets/include/SDL2/SDL_test_md5.h +0 -129
  97. data/assets/include/SDL2/SDL_test_memory.h +0 -63
  98. data/assets/include/SDL2/SDL_test_random.h +0 -115
  99. data/assets/include/SDL2/SDL_thread.h +0 -464
  100. data/assets/include/SDL2/SDL_timer.h +0 -222
  101. data/assets/include/SDL2/SDL_touch.h +0 -150
  102. data/assets/include/SDL2/SDL_ttf.h +0 -2316
  103. data/assets/include/SDL2/SDL_types.h +0 -29
  104. data/assets/include/SDL2/SDL_version.h +0 -204
  105. data/assets/include/SDL2/SDL_video.h +0 -2150
  106. data/assets/include/SDL2/SDL_vulkan.h +0 -215
  107. data/assets/include/SDL2/begin_code.h +0 -187
  108. data/assets/include/SDL2/close_code.h +0 -40
  109. data/assets/macos/universal/lib/libFLAC.a +0 -0
  110. data/assets/macos/universal/lib/libSDL2.a +0 -0
  111. data/assets/macos/universal/lib/libSDL2_mixer.a +0 -0
  112. data/assets/macos/universal/lib/libmodplug.a +0 -0
  113. data/assets/macos/universal/lib/libmpg123.a +0 -0
  114. data/assets/macos/universal/lib/libogg.a +0 -0
  115. data/assets/macos/universal/lib/libvorbis.a +0 -0
  116. data/assets/macos/universal/lib/libvorbisfile.a +0 -0
  117. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libFLAC.a +0 -0
  118. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libSDL2.a +0 -0
  119. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libSDL2_mixer.a +0 -0
  120. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libmodplug.a +0 -0
  121. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libmpg123.a +0 -0
  122. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libogg.a +0 -0
  123. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libopus.a +0 -0
  124. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libopusfile.a +0 -0
  125. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libsndfile.a +0 -0
  126. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libstdc++.a +0 -0
  127. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libvorbis.a +0 -0
  128. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libvorbisfile.a +0 -0
  129. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libz.a +0 -0
  130. data/assets/windows/mingw-w64-x86_64/lib/libFLAC.a +0 -0
  131. data/assets/windows/mingw-w64-x86_64/lib/libSDL2.a +0 -0
  132. data/assets/windows/mingw-w64-x86_64/lib/libSDL2_mixer.a +0 -0
  133. data/assets/windows/mingw-w64-x86_64/lib/libmodplug.a +0 -0
  134. data/assets/windows/mingw-w64-x86_64/lib/libmpg123.a +0 -0
  135. data/assets/windows/mingw-w64-x86_64/lib/libogg.a +0 -0
  136. data/assets/windows/mingw-w64-x86_64/lib/libopus.a +0 -0
  137. data/assets/windows/mingw-w64-x86_64/lib/libopusfile.a +0 -0
  138. data/assets/windows/mingw-w64-x86_64/lib/libsndfile.a +0 -0
  139. data/assets/windows/mingw-w64-x86_64/lib/libstdc++.a +0 -0
  140. data/assets/windows/mingw-w64-x86_64/lib/libvorbis.a +0 -0
  141. data/assets/windows/mingw-w64-x86_64/lib/libvorbisfile.a +0 -0
  142. data/assets/windows/mingw-w64-x86_64/lib/libz.a +0 -0
  143. data/ext/audio/extconf.h +0 -3
@@ -0,0 +1,185 @@
1
+ // ============================================================================
2
+ // delay_node.c - Multi-tap delay node implementation
3
+ // ============================================================================
4
+
5
+ #include <stdlib.h>
6
+ #include <string.h>
7
+ #include "delay_node.h"
8
+
9
+ // ============================================================================
10
+ // DSP Callback
11
+ // ============================================================================
12
+
13
+ static void multi_tap_delay_process(ma_node *pNode, const float **ppFramesIn,
14
+ ma_uint32 *pFrameCountIn, float **ppFramesOut,
15
+ ma_uint32 *pFrameCountOut)
16
+ {
17
+ multi_tap_delay_node *node = (multi_tap_delay_node *)pNode;
18
+ const float *pFramesIn = ppFramesIn[0];
19
+ float *pFramesOut = ppFramesOut[0];
20
+ ma_uint32 frameCount = *pFrameCountOut;
21
+ ma_uint32 numChannels = node->channels;
22
+
23
+ for (ma_uint32 iFrame = 0; iFrame < frameCount; iFrame++) {
24
+ for (ma_uint32 iChannel = 0; iChannel < numChannels; iChannel++) {
25
+ ma_uint32 sampleIndex = iFrame * numChannels + iChannel;
26
+ float inputSample = pFramesIn[sampleIndex];
27
+
28
+ // Write to circular buffer
29
+ ma_uint32 writeIndex = (node->write_pos * numChannels) + iChannel;
30
+ node->buffer[writeIndex] = inputSample;
31
+
32
+ // Start with dry signal
33
+ float outputSample = inputSample;
34
+
35
+ // Mix in all active taps
36
+ for (ma_uint32 iTap = 0; iTap < MAX_TAPS_PER_CHANNEL; iTap++) {
37
+ if (node->taps[iTap].active) {
38
+ ma_uint32 delayFrames = node->taps[iTap].delay_frames;
39
+ if (delayFrames > 0 && delayFrames <= node->buffer_size) {
40
+ ma_uint32 readPos = (node->write_pos + node->buffer_size - delayFrames) % node->buffer_size;
41
+ ma_uint32 readIndex = (readPos * numChannels) + iChannel;
42
+ outputSample += node->buffer[readIndex] * node->taps[iTap].volume;
43
+ }
44
+ }
45
+ }
46
+
47
+ pFramesOut[sampleIndex] = outputSample;
48
+ }
49
+
50
+ // Advance write position
51
+ node->write_pos = (node->write_pos + 1) % node->buffer_size;
52
+ }
53
+ }
54
+
55
+ static ma_node_vtable g_multi_tap_delay_vtable = {
56
+ multi_tap_delay_process,
57
+ NULL, // onGetRequiredInputFrameCount
58
+ 1, // inputBusCount
59
+ 1, // outputBusCount
60
+ 0 // flags
61
+ };
62
+
63
+ // ============================================================================
64
+ // Lifecycle
65
+ // ============================================================================
66
+
67
+ ma_result multi_tap_delay_init(multi_tap_delay_node *pNode, ma_node_graph *pNodeGraph,
68
+ ma_uint32 sampleRate, ma_uint32 numChannels)
69
+ {
70
+ if (pNode == NULL) {
71
+ return MA_INVALID_ARGS;
72
+ }
73
+
74
+ memset(pNode, 0, sizeof(*pNode));
75
+
76
+ pNode->sample_rate = sampleRate;
77
+ pNode->channels = numChannels;
78
+ pNode->buffer_size = (ma_uint32)(sampleRate * MAX_DELAY_SECONDS);
79
+ pNode->write_pos = 0;
80
+ pNode->tap_count = 0;
81
+
82
+ // Allocate circular buffer (frames * channels)
83
+ pNode->buffer = (float *)calloc(pNode->buffer_size * numChannels, sizeof(float));
84
+ if (pNode->buffer == NULL) {
85
+ return MA_OUT_OF_MEMORY;
86
+ }
87
+
88
+ // Initialize all taps as inactive
89
+ for (int i = 0; i < MAX_TAPS_PER_CHANNEL; i++) {
90
+ pNode->taps[i].active = MA_FALSE;
91
+ pNode->taps[i].delay_frames = 0;
92
+ pNode->taps[i].volume = 0.0f;
93
+ }
94
+
95
+ // Set up node configuration
96
+ ma_uint32 channelsArray[1] = { numChannels };
97
+ ma_node_config nodeConfig = ma_node_config_init();
98
+ nodeConfig.vtable = &g_multi_tap_delay_vtable;
99
+ nodeConfig.pInputChannels = channelsArray;
100
+ nodeConfig.pOutputChannels = channelsArray;
101
+
102
+ return ma_node_init(pNodeGraph, &nodeConfig, NULL, &pNode->base);
103
+ }
104
+
105
+ void multi_tap_delay_uninit(multi_tap_delay_node *pNode)
106
+ {
107
+ if (pNode == NULL) {
108
+ return;
109
+ }
110
+
111
+ ma_node_uninit(&pNode->base, NULL);
112
+
113
+ if (pNode->buffer != NULL) {
114
+ free(pNode->buffer);
115
+ pNode->buffer = NULL;
116
+ }
117
+ }
118
+
119
+ // ============================================================================
120
+ // Tap Management
121
+ // ============================================================================
122
+
123
+ int multi_tap_delay_add_tap(multi_tap_delay_node *pNode, float time_ms, float volume)
124
+ {
125
+ if (pNode == NULL) {
126
+ return -1;
127
+ }
128
+
129
+ // Find first inactive tap slot
130
+ for (int i = 0; i < MAX_TAPS_PER_CHANNEL; i++) {
131
+ if (!pNode->taps[i].active) {
132
+ ma_uint32 delayFrames = (ma_uint32)((time_ms / 1000.0f) * pNode->sample_rate);
133
+ if (delayFrames > pNode->buffer_size) {
134
+ delayFrames = pNode->buffer_size;
135
+ }
136
+ pNode->taps[i].delay_frames = delayFrames;
137
+ pNode->taps[i].volume = volume;
138
+ pNode->taps[i].active = MA_TRUE;
139
+ pNode->tap_count++;
140
+ return i;
141
+ }
142
+ }
143
+
144
+ return -1; // No slots available
145
+ }
146
+
147
+ void multi_tap_delay_remove_tap(multi_tap_delay_node *pNode, int tap_id)
148
+ {
149
+ if (pNode == NULL || tap_id < 0 || tap_id >= MAX_TAPS_PER_CHANNEL) {
150
+ return;
151
+ }
152
+
153
+ if (pNode->taps[tap_id].active) {
154
+ pNode->taps[tap_id].active = MA_FALSE;
155
+ pNode->taps[tap_id].delay_frames = 0;
156
+ pNode->taps[tap_id].volume = 0.0f;
157
+ pNode->tap_count--;
158
+ }
159
+ }
160
+
161
+ void multi_tap_delay_set_volume(multi_tap_delay_node *pNode, int tap_id, float volume)
162
+ {
163
+ if (pNode == NULL || tap_id < 0 || tap_id >= MAX_TAPS_PER_CHANNEL) {
164
+ return;
165
+ }
166
+
167
+ if (pNode->taps[tap_id].active) {
168
+ pNode->taps[tap_id].volume = volume;
169
+ }
170
+ }
171
+
172
+ void multi_tap_delay_set_time(multi_tap_delay_node *pNode, int tap_id, float time_ms)
173
+ {
174
+ if (pNode == NULL || tap_id < 0 || tap_id >= MAX_TAPS_PER_CHANNEL) {
175
+ return;
176
+ }
177
+
178
+ if (pNode->taps[tap_id].active) {
179
+ ma_uint32 delayFrames = (ma_uint32)((time_ms / 1000.0f) * pNode->sample_rate);
180
+ if (delayFrames > pNode->buffer_size) {
181
+ delayFrames = pNode->buffer_size;
182
+ }
183
+ pNode->taps[tap_id].delay_frames = delayFrames;
184
+ }
185
+ }
@@ -0,0 +1,51 @@
1
+ // ============================================================================
2
+ // delay_node.h - Multi-tap delay node for native_audio
3
+ // ============================================================================
4
+
5
+ #ifndef DELAY_NODE_H
6
+ #define DELAY_NODE_H
7
+
8
+ #include "miniaudio.h"
9
+
10
+ // ============================================================================
11
+ // Constants
12
+ // ============================================================================
13
+
14
+ #define MAX_TAPS_PER_CHANNEL 16
15
+ #define MAX_DELAY_SECONDS 2.0f
16
+
17
+ // ============================================================================
18
+ // Types
19
+ // ============================================================================
20
+
21
+ typedef struct {
22
+ ma_uint32 delay_frames;
23
+ float volume;
24
+ ma_bool32 active;
25
+ } delay_tap;
26
+
27
+ typedef struct {
28
+ ma_node_base base;
29
+ float *buffer;
30
+ ma_uint32 buffer_size; // Size in frames
31
+ ma_uint32 write_pos;
32
+ ma_uint32 channels; // Audio channels (stereo = 2)
33
+ delay_tap taps[MAX_TAPS_PER_CHANNEL];
34
+ ma_uint32 tap_count;
35
+ ma_uint32 sample_rate;
36
+ } multi_tap_delay_node;
37
+
38
+ // ============================================================================
39
+ // Public API
40
+ // ============================================================================
41
+
42
+ ma_result multi_tap_delay_init(multi_tap_delay_node *pNode, ma_node_graph *pNodeGraph,
43
+ ma_uint32 sampleRate, ma_uint32 numChannels);
44
+ void multi_tap_delay_uninit(multi_tap_delay_node *pNode);
45
+
46
+ int multi_tap_delay_add_tap(multi_tap_delay_node *pNode, float time_ms, float volume);
47
+ void multi_tap_delay_remove_tap(multi_tap_delay_node *pNode, int tap_id);
48
+ void multi_tap_delay_set_volume(multi_tap_delay_node *pNode, int tap_id, float volume);
49
+ void multi_tap_delay_set_time(multi_tap_delay_node *pNode, int tap_id, float time_ms);
50
+
51
+ #endif // DELAY_NODE_H
data/ext/audio/extconf.rb CHANGED
@@ -1,115 +1,17 @@
1
1
  require 'mkmf'
2
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
3
+ # miniaudio linking requirements per platform:
4
+ # - macOS: CoreFoundation, CoreAudio, AudioToolbox frameworks
5
+ # - Linux: pthread, dl, m (math)
6
+ # - Windows: uses native APIs via runtime linking, no extra libs needed
7
+
8
+ case RUBY_PLATFORM
9
+ when /darwin/
10
+ $LDFLAGS << " -framework CoreFoundation -framework CoreAudio -framework AudioToolbox "
11
+ when /linux/
12
+ $LDFLAGS << " -ldl -lpthread -lm "
13
+ when /mingw|mswin/
14
+ # Windows uses runtime linking to native audio APIs
19
15
  end
20
16
 
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
17
  create_makefile('audio')