Skip to content

Commit d8e5884

Browse files
exzosexzos
authored andcommitted
fix: rename project
1 parent 0c7368f commit d8e5884

File tree

9 files changed

+32
-31
lines changed

9 files changed

+32
-31
lines changed

android/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
project(test)
1+
project(analyzer)
22
cmake_minimum_required(VERSION 3.9.0)
33

4-
set(PACKAGE_NAME test)
4+
set(PACKAGE_NAME analyzer)
55
set(CMAKE_VERBOSE_MAKEFILE ON)
66
set(CMAKE_CXX_STANDARD 20)
77
set(CACHE_DIR ${CMAKE_SOURCE_DIR}/build)
@@ -17,7 +17,7 @@ add_library(
1717
)
1818

1919
# Add Nitrogen specs :)
20-
include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/test+autolinking.cmake)
20+
include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/analyzer+autolinking.cmake)
2121

2222
# Set up local includes
2323
include_directories("src/main/cpp" "../cpp")

android/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
buildscript {
22
ext.getExtOrDefault = {name ->
3-
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['Test_' + name]
3+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['Analyzer_' + name]
44
}
55

66
repositories {
@@ -22,16 +22,16 @@ def reactNativeArchitectures() {
2222

2323
apply plugin: "com.android.library"
2424
apply plugin: "kotlin-android"
25-
apply from: '../nitrogen/generated/android/test+autolinking.gradle'
25+
apply from: '../nitrogen/generated/android/analyzer+autolinking.gradle'
2626

2727
apply plugin: "com.facebook.react"
2828

2929
def getExtOrIntegerDefault(name) {
30-
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["Test_" + name]).toInteger()
30+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["Analyzer_" + name]).toInteger()
3131
}
3232

3333
android {
34-
namespace "com.margelo.nitro.test"
34+
namespace "com.margelo.nitro.analyzer"
3535

3636
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
3737

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include <jni.h>
2-
#include "testOnLoad.hpp"
2+
#include "analyzerOnLoad.hpp"
33

44
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
5-
return margelo::nitro::test::initialize(vm);
5+
return margelo::nitro::analyzer::initialize(vm);
66
}

android/src/main/java/com/margelo/nitro/test/TestPackage.kt renamed to android/src/main/java/com/margelo/nitro/analyzer/TestPackage.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
package com.margelo.nitro.test
1+
package com.margelo.nitro.analyzer
22

33
import com.facebook.react.TurboReactPackage
44
import com.facebook.react.bridge.NativeModule
55
import com.facebook.react.bridge.ReactApplicationContext
66
import com.facebook.react.module.model.ReactModuleInfoProvider
77

8-
class TestPackage : TurboReactPackage() {
8+
class AnalyzerPackage : TurboReactPackage() {
99
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
1010
return null
1111
}
@@ -16,7 +16,7 @@ class TestPackage : TurboReactPackage() {
1616

1717
companion object {
1818
init {
19-
System.loadLibrary("test")
19+
System.loadLibrary("analyzer")
2020
}
2121
}
2222
}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "HybridTest.hpp"
1+
#include "AudioAnalyzer.hpp"
22
#define MINIAUDIO_IMPLEMENTATION
33
#include "miniaudio.h"
44

@@ -7,11 +7,11 @@
77
#include <algorithm>
88
#include <android/log.h>
99

10-
#define LOG_TAG "HybridTest"
10+
#define LOG_TAG "HybridAudioAnalyzer"
1111

12-
using namespace margelo::nitro::test;
12+
using namespace margelo::nitro::analyzer;
1313

14-
bool HybridTest::decodeAudioFile(const std::string& filePath, std::vector<float>& pcmData, unsigned int& sampleRate) {
14+
bool AudioAnalyzer::decodeAudioFile(const std::string& filePath, std::vector<float>& pcmData, unsigned int& sampleRate) {
1515
ma_decoder decoder;
1616
ma_decoder_config config = ma_decoder_config_init(ma_format_f32, 0, 0);
1717
ma_result file = ma_decoder_init_file(filePath.c_str(), &config, &decoder);
@@ -50,7 +50,7 @@ bool HybridTest::decodeAudioFile(const std::string& filePath, std::vector<float>
5050
}
5151

5252

53-
std::vector<double> HybridTest::computeAmplitude(const std::string& filePath, double outputSampleCount = 1000) {
53+
std::vector<double> AudioAnalyzer::computeAmplitude(const std::string& filePath, double outputSampleCount = 1000) {
5454
size_t outputSampleCountInt = static_cast<size_t>(outputSampleCount);
5555
std::vector<float> pcm;
5656
unsigned int sampleRate = 0;
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
#include "HybridTestSpec.hpp"
1+
#include "HybridAnalyzerSpec.hpp"
22
#include <string>
33
#include <vector>
44

5-
namespace margelo::nitro::test {
6-
struct HybridTest: public HybridTestSpec {
7-
HybridTest() : HybridObject(TAG) {}
5+
namespace margelo::nitro::analyzer {
6+
struct AudioAnalyzer: public HybridAnalyzerSpec {
7+
AudioAnalyzer() : HybridObject(TAG) {}
88
std::vector<double> computeAmplitude(const std::string& filePath, double samplesPerBlock) override;
99

1010
bool decodeAudioFile(const std::string& filePath, std::vector<float>& pcmData, unsigned int& sampleRate);

nitro.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
{
22
"$schema": "https://nitro.margelo.com/nitro.schema.json",
3-
"cxxNamespace": ["test"],
3+
"cxxNamespace": ["analyzer"],
44
"ios": {
5-
"iosModuleName": "Test"
5+
"iosModuleName": "RNAudioAnalyzer"
66
},
77
"android": {
8-
"androidNamespace": ["test"],
9-
"androidCxxLibName": "test"
8+
"androidNamespace": ["analyzer"],
9+
"androidCxxLibName": "analyzer"
1010
},
1111
"autolinking": {
12-
"Test": {
13-
"cpp": "HybridTest"
12+
"Analyzer": {
13+
"cpp": "AudioAnalyzer"
1414
}
1515
},
1616
"ignorePaths": ["node_modules"]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { HybridObject } from 'react-native-nitro-modules';
22

3-
export interface Test extends HybridObject<{ ios: 'c++'; android: 'c++' }> {
3+
export interface Analyzer extends HybridObject<{ ios: 'c++'; android: 'c++' }> {
44
computeAmplitude(filePath: string, outputSampleCount: number): number[];
55
}

src/index.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { NitroModules } from 'react-native-nitro-modules';
2-
import type { Test } from './Test.nitro';
2+
import type { Analyzer } from './Analyzer.nitro';
33

4-
const TestHybridObject = NitroModules.createHybridObject<Test>('Test');
4+
const AnalyzerHybridObject =
5+
NitroModules.createHybridObject<Analyzer>('Analyzer');
56

67
export function computeAmplitude(filePath: string, outputSampleCount: number) {
7-
return TestHybridObject.computeAmplitude(filePath, outputSampleCount);
8+
return AnalyzerHybridObject.computeAmplitude(filePath, outputSampleCount);
89
}

0 commit comments

Comments
 (0)