Skip to content
57 changes: 57 additions & 0 deletions apps/common-app/src/examples/Midi/Midi.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import React from 'react';
import { NativeMedi } from '../../../../../packages/react-native-medi/src';
import { Button, View } from 'react-native';

const Medi: React.FC = () => {
const [sourcePort, setSourcePort] = React.useState("");
const testCallback = () => {
console.log('Calling NativeMedi.test()');
NativeMedi.test();
};

return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Button title="Test" onPress={testCallback} />
<Button title="Prepare MIDI Client" onPress={() => NativeMedi.prepareMIDIClient(false)} />
<Button
title="Get MIDI Sources"
onPress={() => {
const sources = NativeMedi.getSources();
setSourcePort(sources[0]?.id || "");
console.log('MIDI Sources:', sources);
}}
/>
<Button
title="Get MIDI Destinations"
onPress={() => {
const destinations = NativeMedi.getDestinations();
console.log('MIDI Destinations:', destinations);
}}
/>
<Button
title="Open Source Port"
onPress={() => {
if (sourcePort) {
const result = NativeMedi.openPort(sourcePort);
console.log(`Open Port Result for ${sourcePort}:`, result);
} else {
console.log('No source port available to open.');
}
}}
/>
<Button
title="Close Source Port"
onPress={() => {
if (sourcePort) {
const result = NativeMedi.closePort(sourcePort);
console.log(`Close Port Result for ${sourcePort}:`, result);
} else {
console.log('No source port available to close.');
}
}}
/>
</View>
);
};

export default Medi;
8 changes: 8 additions & 0 deletions apps/common-app/src/examples/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import Record from './Record/Record';
import PlaybackSpeed from './PlaybackSpeed/PlaybackSpeed';
import Worklets from './Worklets/Worklets';
import Streaming from './Streaming/Streaming';
import MediTest from './Midi/Midi';

type NavigationParamList = {
Oscillator: undefined;
Expand All @@ -25,6 +26,7 @@ type NavigationParamList = {
Record: undefined;
Worklets: undefined;
Streamer: undefined;
MediTest: undefined;
};

export type ExampleKey = keyof NavigationParamList;
Expand All @@ -38,6 +40,12 @@ export interface Example {
}

export const Examples: Example[] = [
{
key: 'MediTest',
title: 'Medi Test',
subtitle: 'Test react-native-medi turbo module',
screen: MediTest,
},
{
key: 'DrumMachine',
title: 'Drum Machine',
Expand Down
44 changes: 38 additions & 6 deletions apps/fabric-example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,34 @@ PODS:
- hermes-engine (0.81.0):
- hermes-engine/Pre-built (= 0.81.0)
- hermes-engine/Pre-built (0.81.0)
- Medi (0.1.0):
- boost
- DoubleConversion
- fast_float
- fmt
- glog
- hermes-engine
- RCT-Folly
- RCT-Folly/Fabric
- RCTRequired
- RCTTypeSafety
- React-Core
- React-debug
- React-Fabric
- React-featureflags
- React-graphics
- React-ImageManager
- React-jsi
- React-NativeModulesApple
- React-RCTFabric
- React-renderercss
- React-rendererdebug
- React-utils
- ReactCodegen
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- SocketRocket
- Yoga
- RCT-Folly (2024.11.18.00):
- boost
- DoubleConversion
Expand Down Expand Up @@ -2342,7 +2370,7 @@ PODS:
- React-perflogger (= 0.81.0)
- React-utils (= 0.81.0)
- SocketRocket
- RNAudioAPI (0.9.0):
- RNAudioAPI (0.10.0):
- boost
- DoubleConversion
- fast_float
Expand All @@ -2368,10 +2396,10 @@ PODS:
- ReactCodegen
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- RNAudioAPI/audioapi (= 0.9.0)
- RNAudioAPI/audioapi (= 0.10.0)
- SocketRocket
- Yoga
- RNAudioAPI/audioapi (0.9.0):
- RNAudioAPI/audioapi (0.10.0):
- boost
- DoubleConversion
- fast_float
Expand All @@ -2397,10 +2425,10 @@ PODS:
- ReactCodegen
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- RNAudioAPI/audioapi/ios (= 0.9.0)
- RNAudioAPI/audioapi/ios (= 0.10.0)
- SocketRocket
- Yoga
- RNAudioAPI/audioapi/ios (0.9.0):
- RNAudioAPI/audioapi/ios (0.10.0):
- boost
- DoubleConversion
- fast_float
Expand Down Expand Up @@ -2764,6 +2792,7 @@ DEPENDENCIES:
- fmt (from `../../../node_modules/react-native/third-party-podspecs/fmt.podspec`)
- glog (from `../../../node_modules/react-native/third-party-podspecs/glog.podspec`)
- hermes-engine (from `../../../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`)
- Medi (from `../../../node_modules/react-native-medi`)
- RCT-Folly (from `../../../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`)
- RCTDeprecation (from `../../../node_modules/react-native/ReactApple/Libraries/RCTFoundation/RCTDeprecation`)
- RCTRequired (from `../../../node_modules/react-native/Libraries/Required`)
Expand Down Expand Up @@ -2860,6 +2889,8 @@ EXTERNAL SOURCES:
hermes-engine:
:podspec: "../../../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec"
:tag: hermes-2025-07-07-RNv0.81.0-e0fc67142ec0763c6b6153ca2bf96df815539782
Medi:
:path: "../../../node_modules/react-native-medi"
RCT-Folly:
:podspec: "../../../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec"
RCTDeprecation:
Expand Down Expand Up @@ -3015,6 +3046,7 @@ SPEC CHECKSUMS:
fmt: a40bb5bd0294ea969aaaba240a927bd33d878cdd
glog: 5683914934d5b6e4240e497e0f4a3b42d1854183
hermes-engine: e7491a2038f2618c8cd444ed411a6deb350a3742
Medi: bcdcf2b531371b6ad4a479cd13447759d50ec791
RCT-Folly: 846fda9475e61ec7bcbf8a3fe81edfcaeb090669
RCTDeprecation: 0735ab4f6b3ec93a7f98187b5da74d7916e2cf4c
RCTRequired: 8fcc7801bfc433072287b0f24a662e2816e89d0c
Expand Down Expand Up @@ -3081,7 +3113,7 @@ SPEC CHECKSUMS:
ReactAppDependencyProvider: c91900fa724baee992f01c05eeb4c9e01a807f78
ReactCodegen: 8125d6ee06ea06f48f156cbddec5c2ca576d62e6
ReactCommon: 116d6ee71679243698620d8cd9a9042541e44aa6
RNAudioAPI: e08a4157527a2e87879a7bb61880276a0dfc77f6
RNAudioAPI: bddcd2fba8e78164d56ac1f38d23b8cff7923600
RNGestureHandler: 3a73f098d74712952870e948b3d9cf7b6cae9961
RNReanimated: a035264789d1f64cb5adba7085d6aac6e9ec70a7
RNScreens: 6ced6ae8a526512a6eef6e28c2286e1fc2d378c3
Expand Down
3 changes: 2 additions & 1 deletion apps/fabric-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"dependencies": {
"common-app": "workspace:*",
"react": "19.1.0",
"react-native": "0.81.0"
"react-native": "0.81.0",
"react-native-medi": "workspace:*"
},
"devDependencies": {
"prettier": "^3.3.3"
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"workspaces": {
"packages": [
"packages/react-native-audio-api",
"packages/react-native-medi",
"apps/common-app",
"apps/fabric-example"
]
Expand Down
90 changes: 90 additions & 0 deletions packages/react-native-medi/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
---
AccessModifierOffset: -1
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: true
AlignOperands: false
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: false
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ForEachMacros: [FOR_EACH_RANGE, FOR_EACH]
IncludeCategories:
- Regex: '^<.*\.h(pp)?>'
Priority: 1
- Regex: '^<.*'
Priority: 2
- Regex: '.*'
Priority: 3
IndentCaseLabels: true
IndentWidth: 2
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Right
ReflowComments: true
SortIncludes: true
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 2
UseTab: Never
---
Language: ObjC
ColumnLimit: 120
BreakBeforeBraces: WebKit
15 changes: 15 additions & 0 deletions packages/react-native-medi/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true

[*]

indent_style = space
indent_size = 2

end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
10 changes: 10 additions & 0 deletions packages/react-native-medi/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/** @type {import('eslint').ESLint.ConfigData} */
module.exports = {
extends: ['../../.eslintrc.js'],
overrides: [
{
files: ['./src/**/*.{ts,tsx}'],
},
],
ignorePatterns: ['lib', 'example'],
};
3 changes: 3 additions & 0 deletions packages/react-native-medi/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.pbxproj -text
# specific for windows script files
*.bat text eol=crlf
Loading