@harmonia-audio/native 0.1.1 → 0.1.3

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.
Binary file
package/harmonia.node CHANGED
Binary file
package/index.js CHANGED
@@ -1,84 +1,84 @@
1
- import { createRequire } from 'module';
2
- const require = createRequire(import.meta.url);
3
- const { platform, arch } = process;
4
-
5
- let nativeBinding = null;
6
-
7
- // Логика выбора бинарника в зависимости от ОС
8
- try {
9
- if (platform === 'win32' && arch === 'x64') {
10
- nativeBinding = require('./harmonia.win32-x64-msvc.node');
11
- } else if (platform === 'linux') {
12
- if (arch === 'x64') nativeBinding = require('./harmonia.linux-x64-gnu.node');
13
- else if (arch === 'arm64') nativeBinding = require('./harmonia.linux-arm64-gnu.node');
14
- } else if (platform === 'darwin') {
15
- if (arch === 'x64') nativeBinding = require('./harmonia.darwin-x64.node');
16
- else if (arch === 'arm64') nativeBinding = require('./harmonia.darwin-arm64.node');
17
- }
18
- } catch (e) {
19
- // Игнорируем ошибки здесь, попробуем фолбэк
20
- }
21
-
22
- if (!nativeBinding) {
23
- try {
24
- // Фолбэк для локальной сборки (napi build)
25
- nativeBinding = require('./harmonia.node');
26
- } catch (e) {
27
- throw new Error(`[Harmonia] Failed to load native binding for ${platform}-${arch}. Ensure the .node file exists in the package.`);
28
- }
29
- }
30
-
31
- /**
32
- * Автоматический экспорт всех свойств из нативного модуля.
33
- * Это гарантирует, что OpusEncoder, AudioThread, BiquadFilter,
34
- * и все DSP функции (applyVolume и т.д.) будут доступны.
35
- */
36
- export const {
37
- // Кодеки
38
- OpusEncoder,
39
- OpusDecoder,
40
- opusPacketGetNbChannelsNative,
41
- opusPacketGetNbFramesNative,
42
- opusPacketGetSamplesPerFrameNative,
43
-
44
- // Криптография
45
- sodiumInitialize,
46
- randomBytes,
47
- secretboxEncrypt,
48
- secretboxDecrypt,
49
- xchacha20Encrypt,
50
- xchacha20Decrypt,
51
- aes256gcmAvailable,
52
- aes256gcmEncrypt,
53
-
54
- // RTP & Сеть
55
- buildRtpHeader,
56
- parseRtpHeader,
57
- getRtpPayloadOffset,
58
- RtpPacketBuilder,
59
- configureSocketForAudio,
60
-
61
- // Потоки и буферы
62
- AudioThread,
63
- AudioRingBuffer,
64
-
65
- // DSP & Эффекты (то, что ты заметил)
66
- applyVolume,
67
- stereoWiden,
68
- monoDownmix,
69
- mixAudioStreams,
70
- BiquadFilter,
71
- Compressor,
72
- NoiseGate,
73
- Delay,
74
- LoudnessNormalizer,
75
- ConvolutionReverb,
76
- PhaseVocoder,
77
-
78
- // VAD & Системное
79
- VoiceActivityDetector,
80
- checkIoUringSupport
81
- } = nativeBinding;
82
-
83
- // Дефолтный экспорт для полной совместимости
84
- export default nativeBinding;
1
+ import { createRequire } from 'module';
2
+ const require = createRequire(import.meta.url);
3
+ const { platform, arch } = process;
4
+
5
+ let nativeBinding = null;
6
+
7
+ // Логика выбора бинарника в зависимости от ОС
8
+ try {
9
+ if (platform === 'win32' && arch === 'x64') {
10
+ nativeBinding = require('./harmonia.win32-x64-msvc.node');
11
+ } else if (platform === 'linux') {
12
+ if (arch === 'x64') nativeBinding = require('./harmonia.linux-x64-gnu.node');
13
+ else if (arch === 'arm64') nativeBinding = require('./harmonia.linux-arm64-gnu.node');
14
+ } else if (platform === 'darwin') {
15
+ if (arch === 'x64') nativeBinding = require('./harmonia.darwin-x64.node');
16
+ else if (arch === 'arm64') nativeBinding = require('./harmonia.darwin-arm64.node');
17
+ }
18
+ } catch (e) {
19
+ // Игнорируем ошибки здесь, попробуем фолбэк
20
+ }
21
+
22
+ if (!nativeBinding) {
23
+ try {
24
+ // Фолбэк для локальной сборки (napi build)
25
+ nativeBinding = require('./harmonia.node');
26
+ } catch (e) {
27
+ throw new Error(`[Harmonia] Failed to load native binding for ${platform}-${arch}. Ensure the .node file exists in the package.`);
28
+ }
29
+ }
30
+
31
+ /**
32
+ * Автоматический экспорт всех свойств из нативного модуля.
33
+ * Это гарантирует, что OpusEncoder, AudioThread, BiquadFilter,
34
+ * и все DSP функции (applyVolume и т.д.) будут доступны.
35
+ */
36
+ export const {
37
+ // Кодеки
38
+ OpusEncoder,
39
+ OpusDecoder,
40
+ opusPacketGetNbChannelsNative,
41
+ opusPacketGetNbFramesNative,
42
+ opusPacketGetSamplesPerFrameNative,
43
+
44
+ // Криптография
45
+ sodiumInitialize,
46
+ randomBytes,
47
+ secretboxEncrypt,
48
+ secretboxDecrypt,
49
+ xchacha20Encrypt,
50
+ xchacha20Decrypt,
51
+ aes256gcmAvailable,
52
+ aes256gcmEncrypt,
53
+
54
+ // RTP & Сеть
55
+ buildRtpHeader,
56
+ parseRtpHeader,
57
+ getRtpPayloadOffset,
58
+ RtpPacketBuilder,
59
+ configureSocketForAudio,
60
+
61
+ // Потоки и буферы
62
+ AudioThread,
63
+ AudioRingBuffer,
64
+
65
+ // DSP & Эффекты (то, что ты заметил)
66
+ applyVolume,
67
+ stereoWiden,
68
+ monoDownmix,
69
+ mixAudioStreams,
70
+ BiquadFilter,
71
+ Compressor,
72
+ NoiseGate,
73
+ Delay,
74
+ LoudnessNormalizer,
75
+ ConvolutionReverb,
76
+ PhaseVocoder,
77
+
78
+ // VAD & Системное
79
+ VoiceActivityDetector,
80
+ checkIoUringSupport
81
+ } = nativeBinding;
82
+
83
+ // Дефолтный экспорт для полной совместимости
84
+ export default nativeBinding;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harmonia-audio/native",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -28,18 +28,18 @@
28
28
  "@napi-rs/cli": "^3.0.0"
29
29
  },
30
30
  "optionalDependencies": {
31
- "@harmonia-audio/native-darwin-x64": "0.1.1",
32
- "@harmonia-audio/native-win32-x64-msvc": "0.1.1",
33
- "@harmonia-audio/native-linux-x64-gnu": "0.1.1",
34
- "@harmonia-audio/native-linux-x64-musl": "0.1.1",
35
- "@harmonia-audio/native-linux-arm64-gnu": "0.1.1",
36
- "@harmonia-audio/native-linux-arm64-musl": "0.1.1",
37
- "@harmonia-audio/native-darwin-arm64": "0.1.1",
38
- "@harmonia-audio/native-freebsd-x64": "0.1.1"
31
+ "@harmonia-audio/native-darwin-x64": "0.1.3",
32
+ "@harmonia-audio/native-win32-x64-msvc": "0.1.3",
33
+ "@harmonia-audio/native-linux-x64-gnu": "0.1.3",
34
+ "@harmonia-audio/native-linux-x64-musl": "0.1.3",
35
+ "@harmonia-audio/native-linux-arm64-gnu": "0.1.3",
36
+ "@harmonia-audio/native-linux-arm64-musl": "0.1.3",
37
+ "@harmonia-audio/native-darwin-arm64": "0.1.3",
38
+ "@harmonia-audio/native-freebsd-x64": "0.1.3"
39
39
  },
40
40
  "scripts": {
41
41
  "artifacts": "napi artifacts",
42
- "build": "napi build --platform --release && node fix-dts.js",
42
+ "build": "if [ \"$SKIP_NATIVE_BUILD\" = \"true\" ]; then echo 'Skipping native build...'; else napi build --platform --release && node fix-dts.js; fi",
43
43
  "build:debug": "napi build --platform && node fix-dts.js"
44
44
  }
45
45
  }