cleanup (tentative) and get ready for merge

This commit is contained in:
Stefano D'Angelo 2024-02-05 13:55:57 +01:00
parent 2d3f850ca0
commit 152a33c65e
10 changed files with 272 additions and 280 deletions

View File

@ -101,7 +101,6 @@ static void data_callback(ma_device* pDevice, void* pOutput, const void* pInput,
const float * in_buf = reinterpret_cast<const float *>(pInput);
float * out_buf = reinterpret_cast<float *>(pOutput);
#if NUM_CHANNELS_IN + NUM_CHANNELS_OUT > 0
ma_uint32 i = 0;
#if NUM_CHANNELS_IN > 0
size_t ix = 0;
@ -128,14 +127,13 @@ static void data_callback(ma_device* pDevice, void* pOutput, const void* pInput,
for (ma_uint32 j = 0; j < n; j++)
for (size_t k = 0; k < NUM_CHANNELS_OUT; k++, iy++)
out_buf[iy] = y_buf[BLOCK_SIZE * k + j];
#elif NUM_CHANNELS_IN == 0
for (ma_uint32 j = 0; j < n; j++)
out_buf[j] = 0;
#endif
i += n;
}
#else
for (ma_uint32 i = 0; i < frameCount; i++)
out_buf[i] = 0.f; // Unique fake channel
#endif
}
extern "C"
@ -273,6 +271,7 @@ JNIEXPORT void JNICALL
JNI_FUNC(nativeAudioStop)(JNIEnv* env, jobject thiz) {
(void)env;
(void)thiz;
ma_device_stop(&device);
ma_device_uninit(&device);
if (mem != NULL)

View File

@ -1,35 +1,38 @@
include vars.mk
ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
COMMON_DIR := $(or $(COMMON_DIR),.)
DATA_DIR := $(or $(DATA_DIR),.)
PLUGIN_DIR := $(or $(PLUGIN_DIR),src)
SOURCES := \
${DATA_DIR}/src/data.h \
${DATA_DIR}/src/index.html \
${COMMON_DIR}/src/app.swift \
${COMMON_DIR}/src/native.mm \
${COMMON_DIR}/src/app-Bridging-Header.h \
${PLUGIN_DIR}/plugin.h \
${C_SRCS_EXTRA} \
${CXX_SRCS_EXTRA}
SOURCES_OUT = $(addprefix build/gen/src/, $(notdir $(SOURCES)))
SOURCES := data.h index.html app.swift native.mm app-Bridging-Header.h platform.h plugin.h
SOURCES_IN := $(addprefix ${ROOT_DIR}/src/, ${SOURCES})
SOURCES_OUT := $(addprefix ${ROOT_DIR}/build/gen/src/, ${SOURCES})
EXT_SOURCES_IN := ${3RDPARTYFILES}
EXT_SOURCES_OUT :=
all: build/gen/${BUNDLE_NAME}.xcodeproj
all: build/gen/${PROJECT_NAME}.xcodeproj
${SOURCES_OUT}: ${SOURCES_IN} ${EXT_SOURCES_IN} | build/gen/src
cp $^ ${ROOT_DIR}/build/gen/src
${EXT_SOURCES_OUT}: ${EXT_SOURCES_IN}
cp ${EXT_SOURCES_IN} ${ROOT_DIR}/build/gen/src/
build/gen/${PROJECT_NAME}.xcodeproj: ${SOURCES_OUT}
build/gen/${BUNDLE_NAME}.xcodeproj: ${SOURCES_OUT}
xcodegen generate --spec project.yml
mv ${PROJECT_NAME}.xcodeproj build/gen/${PROJECT_NAME}.xcodeproj
mv ${BUNDLE_NAME}.xcodeproj build/gen/${BUNDLE_NAME}.xcodeproj
mv Info.plist build/gen/Info.plist
build/gen build/gen/src:
build/gen/src:
mkdir -p $@
clean:
rm -fr build
install:
.PHONY: all clean
.PHONY: all clean install
.SECONDEXPANSION:
PERCENT := %
$(SOURCES_OUT): build/gen/src/%: $$(filter $$(PERCENT)/%,$$(SOURCES)) | build/gen/src
cp $^ $@

View File

@ -1,6 +1,6 @@
name: {{=it.ios_make.projectName}}
name: {{=it.product.bundleName}}
targets:
{{=it.ios_make.targetName}}:
{{=it.product.bundleName}}:
platform: [iOS]
deploymentTarget:
iOS: {{=it.ios_make.deploymentTarget}}
@ -9,11 +9,15 @@ targets:
- path: src
settings:
base:
PRODUCT_BUNDLE_IDENTIFIER: com.orastron.{{=it.product.bundleName}}
PRODUCT_BUNDLE_IDENTIFIER: {{=it.ios_make.productBundleIdentifier}}
SWIFT_OBJC_BRIDGING_HEADER: src/app-Bridging-Header.h
HEADER_SEARCH_PATHS: {{~it.ios_make.header_search_paths:p}}
{{?it.ios_make.headerSearchPaths}}
HEADER_SEARCH_PATHS: {{~it.ios_make.headerSearchPaths :p}}
- {{=p}}{{~}}
{{?}}
info:
path: Info.plist
{{?it.product.buses.filter(x => x.type == "audio" && x.direction == "input").length > 0}}
properties:
NSMicrophoneUsageDescription: Audio input access needed to run the example
NSMicrophoneUsageDescription: Need audio input for processing sound
{{?}}

View File

@ -1,8 +1,8 @@
BUNDLE_NAME := {{=it.product.bundleName}}
PROJECT_NAME := {{=it.ios_make.projectName}}
TARGET_NAME := {{=it.ios_make.targetName}}
C_SRCS_EXTRA := {{=it.make && it.make.cSrcs ? it.make.cSrcs : ""}} {{=it.ios_make && it.ios_make.cSrcs ? it.ios_make.cSrcs : ""}}
CXX_SRCS_EXTRA := {{=it.make && it.make.cxxSrcs ? it.make.cxxSrcs : ""}} {{=it.ios_make && it.ios_make.cxxSrcs ? it.ios_make.cxxSrcs : ""}}
3RDPARTYFILES := {{=it.ios_make["3rdpartyfiles"].join(' ')}}
HAS_MIDI_IN := {{=it.product.buses.filter(x => x.type == "midi" && x.direction == "input").length > 0 ? "yes" : "no"}}
COMMON_DIR := {{=it.ios_make && it.ios_make.commonDir ? it.ios_make.commonDir : (it.make && it.make.commonDir ? it.make.commonDir : "")}}
DATA_DIR := {{=it.ios_make && it.ios_make.dataDir ? it.ios_make.dataDir : (it.make && it.make.dataDir ? it.make.dataDir : "")}}
PLUGIN_DIR := {{=it.ios_make && it.ios_make.pluginDir ? it.ios_make.pluginDir : (it.make && it.make.pluginDir ? it.make.pluginDir : "")}}

View File

@ -50,7 +50,7 @@ CFStringRef midiClientName = NULL;
MIDIClientRef midiClient = NULL;
CFStringRef midiInputName = NULL;
MIDIPortRef midiPort = NULL;
#define MIDIBUFFERLEN 1026
#define MIDIBUFFERLEN 1023
uint8_t midiBuffer[MIDIBUFFERLEN];
int midiBuffer_i = 0;
#endif
@ -89,7 +89,6 @@ static void data_callback(ma_device* pDevice, void* pOutput, const void* pInput,
const float * in_buf = reinterpret_cast<const float *>(pInput);
#endif
float * out_buf = reinterpret_cast<float *>(pOutput);
#if NUM_CHANNELS_IN + NUM_CHANNELS_OUT > 0
ma_uint32 i = 0;
#if NUM_CHANNELS_IN > 0
size_t ix = 0;
@ -110,19 +109,19 @@ static void data_callback(ma_device* pDevice, void* pOutput, const void* pInput,
#if NUM_NON_OPT_CHANNELS_IN > NUM_CHANNELS_IN
memset(zero, 0, BLOCK_SIZE * sizeof(float));
#endif
plugin_process(&instance, x, y, n);
#if NUM_CHANNELS_OUT > 0
for (ma_uint32 j = 0; j < n; j++)
for (size_t k = 0; k < NUM_CHANNELS_OUT; k++, iy++)
out_buf[iy] = y_buf[BLOCK_SIZE * k + j];
#elif NUM_CHANNELS_IN == 0
for (ma_uint32 j = 0; j < n; j++)
out_buf[j] = 0.f;
#endif
i += n;
}
#else
for (ma_uint32 i = 0; i < frameCount; i++)
out_buf[i] = 0.f; // Unique fake channel
#endif
}
#if (NUM_MIDI_INPUTS > 0)
@ -161,7 +160,6 @@ void (^midiReceiveBlock)(const MIDIEventList *evtlist, void *srcConnRefCon) = ^(
extern "C"
char audioStart() {
#if NUM_CHANNELS_IN + NUM_CHANNELS_OUT > 0
# if NUM_CHANNELS_IN == 0
ma_device_config deviceConfig = ma_device_config_init(ma_device_type_playback);
@ -332,6 +330,7 @@ float getParameter(int i) {
mutex.unlock();
return v;
#else
(void)i;
return 0.f;
#endif
}

View File

@ -1,6 +0,0 @@
#ifndef PLATFORM_H
#define PLATFORM_H
#define NDEBUG
#endif

View File

@ -3,9 +3,8 @@ var sep = path.sep;
module.exports = function (data, api) {
api.generateFileFromTemplateFile(`src${sep}data.h`, `src${sep}data.h`, data);
api.generateFileFromTemplateFile(`src${sep}index.html`, `src${sep}index.html`, data);
api.copyFile(`src${sep}native.mm`, `src${sep}native.mm`);
api.copyFile(`src${sep}app-Bridging-Header.h`, `src${sep}app-Bridging-Header.h`);
api.copyFile(`src${sep}platform.h`, `src${sep}platform.h`);
api.generateFileFromTemplateFile(`src${sep}app.swift`, `src${sep}app.swift`, data);
api.generateFileFromTemplateFile(`src${sep}index.html`, `src${sep}index.html`, data);
api.copyFile(`src${sep}app.swift`, `src${sep}app.swift`, data);
};

View File

@ -1,11 +1,8 @@
{
"ios_make": {
"header_search_paths": [],
"3rdpartyfiles": [
"../../../miniaudio/miniaudio.h"
],
"projectName": "tibia_test",
"targetName": "tibia_test",
"headerSearchPaths": [],
"sourcesExtra": [],
"productBundleIdentifier": "com.example.tibia_test",
"deploymentTarget": 16.6
}
}

View File

@ -1,3 +0,0 @@
{
}

View File

@ -19,8 +19,8 @@ $dir/../tibia $dir/product.json,$dir/company.json,$dir/android.json,$dir/android
cp $dir/keystore.jks $dir/../out/android
cp $dir/plugin.h $dir/../out/android/src
$dir/../tibia $dir/product.json,$dir/company.json,$dir/ios.json $dir/../templates/ios $dir/../out/ios
$dir/../tibia $dir/product.json,$dir/company.json,$dir/ios.json,$dir/ios-make.json $dir/../templates/ios-make $dir/../out/ios
$dir/../tibia $dir/product.json,$dir/company.json $dir/../templates/ios $dir/../out/ios
$dir/../tibia $dir/product.json,$dir/company.json,$dir/ios-make.json $dir/../templates/ios-make $dir/../out/ios
cp $dir/plugin.h $dir/../out/ios/src
$dir/../tibia $dir/product.json,$dir/company.json,$dir/cmd.json $dir/../templates/cmd $dir/../out/cmd