dart-ffi

Accessing assets from C++ plugin through Flutter

混江龙づ霸主 提交于 2021-02-10 06:35:28
问题 I'm trying to use Google Oboe for a 3D audio processing app due to it's low latency. The app will have a C++ backend, which does the processing, and the frontend is done with Flutter. I'm running a couple of tests to see if it'll work but I'm having issues loading assets from Flutter to Oboe. I checked the example RhythmGame in Oboe's repo, done with Java, but couldn't quiet find a way of doing that straight from Dart to C++. The connection between front and backend is through dart::ffi Here

Using AssetManager class from Android NDK in a Flutter app

♀尐吖头ヾ 提交于 2021-02-10 03:04:43
问题 I've been trying to use the Android NDK's AssetManager class in my Flutter app, that works with Google Oboe, to access to audio files. Following this example in the Oboe repository, I learned that they obtain the AssetManager from Java like this: JNIEXPORT void JNICALL Java_com_google_oboe_sample_rhythmgame_MainActivity_native_1onStart(JNIEnv *env, jobject instance, jobject jAssetManager) { AAssetManager *assetManager = AAssetManager_fromJava(env, jAssetManager); if (assetManager == nullptr)

Using AssetManager class from Android NDK in a Flutter app

女生的网名这么多〃 提交于 2021-02-10 03:03:28
问题 I've been trying to use the Android NDK's AssetManager class in my Flutter app, that works with Google Oboe, to access to audio files. Following this example in the Oboe repository, I learned that they obtain the AssetManager from Java like this: JNIEXPORT void JNICALL Java_com_google_oboe_sample_rhythmgame_MainActivity_native_1onStart(JNIEnv *env, jobject instance, jobject jAssetManager) { AAssetManager *assetManager = AAssetManager_fromJava(env, jAssetManager); if (assetManager == nullptr)

Using AssetManager class from Android NDK in a Flutter app

不羁的心 提交于 2021-02-10 03:00:09
问题 I've been trying to use the Android NDK's AssetManager class in my Flutter app, that works with Google Oboe, to access to audio files. Following this example in the Oboe repository, I learned that they obtain the AssetManager from Java like this: JNIEXPORT void JNICALL Java_com_google_oboe_sample_rhythmgame_MainActivity_native_1onStart(JNIEnv *env, jobject instance, jobject jAssetManager) { AAssetManager *assetManager = AAssetManager_fromJava(env, jAssetManager); if (assetManager == nullptr)

flutter/dart: How to use async callback with Dart FFI?

独自空忆成欢 提交于 2021-01-28 01:12:27
问题 My app's backend is written in C++ and the frontend in Dart/flutter. I'd love to have the backend notify frontend whenever data is ready. This requires implementing an async callback scheme between Dart and C++. Environment $ flutter doctor -v [✓] Flutter (Channel stable, 1.20.1, on Mac OS X 10.15.5 19F101, locale en-CN) • Flutter version 1.20.1 at /Applications/Android/flutter • Framework revision 2ae34518b8 (2 days ago), 2020-08-05 19:53:19 -0700 • Engine revision c8e3b94853 • Dart version

How to convert Uint8List to C equivalent datatype using dart:ffi

≡放荡痞女 提交于 2021-01-01 06:21:49
问题 I am trying to send an image to my Custom C++ code which I am planning to run using dart:ffi. I have successfully run the hello world problem where I send two integers and get the some of them as another intiger. Now I want to send a whole image to it and process it on my C++ code. I am able to get Uint8List from the CameraImage using the below code Future<ui.Image> convertCameraImageToUiImage(CameraImage image) async { imglib.Image libImage = imglib.Image.fromBytes( image.width, image.height

How to convert Uint8List to C equivalent datatype using dart:ffi

拈花ヽ惹草 提交于 2021-01-01 06:20:30
问题 I am trying to send an image to my Custom C++ code which I am planning to run using dart:ffi. I have successfully run the hello world problem where I send two integers and get the some of them as another intiger. Now I want to send a whole image to it and process it on my C++ code. I am able to get Uint8List from the CameraImage using the below code Future<ui.Image> convertCameraImageToUiImage(CameraImage image) async { imglib.Image libImage = imglib.Image.fromBytes( image.width, image.height

Dart/Flutter ffi (Foreig Function Interface) native callbacks eg: sqlite3_exec

有些话、适合烂在心里 提交于 2020-06-29 04:19:04
问题 Hello I am using dart:ffi to build an interface with my native c/c++ library. and I needed a way to get a callback from c to dart as an example in sqlite: int sqlite3_exec( sqlite3*, /* An open database */ const char *sql, /* SQL to be evaluated */ int (*callback)(void*,int,char**,char**), /* Callback function */ void *, /* 1st argument to callback */ char **errmsg /* Error msg written here */ ); the third parameter in sqlite3_exec is function pointer to a callback. so if I called this