Hi,
I breack my head trying solving this problem but I couldn't, so I post it here for help.
I am trying to use Native plugins to use OpenCV libraries and using c++ language with unity.
I created CallNativeCode file which invokes another file which is the native plugins "HandGestureNative.cpp". Inside "HandGestureNative.cpp" I am trying to create VideoCapture and open the camera, but the camera is not openning.
I made sure that all the opencv dependeinces file has been delared in the file.
Please check the following code inside the "HandGestureNative.cpp":
**
#include "HandGestureNative.h"
#include
//opencv
#include
#include "opencv2/imgcodecs.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/videoio.hpp"
#include
#include
#include
#include
//C++
#include
#include
using namespace cv;
using namespace std;
// Global variables
Mat temp;
float result = 0.0;
#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "HandGestureNative", __VA_ARGS__))
#define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "HandGestureNativex`", __VA_ARGS__))
extern "C" {
float HandGestureNative::HandGestureCall()
{
//Creating camera and assign it to camera 0;
VideoCapture capture;
capture.open(0);
capture >> temp;
if (capture.isOpened()) { result = 5.5; }
else { result = 1.5; }
return result;
}
}
**
Always the return result is 1.5, which means that the camera is not open.
Please help and Thank you :).
↧
Can't open device camera with Native plugins using OpenCV and c++.
↧
Logitech G29 not detected in Unity only in Logitech Gaming Software
I have a Input setup based on the Logitech Gaming SDK from the Asset Store, I tested the package with my development environment and everything went fine using the G29 Racing Wheel, I can see the inputs from the Logitech sample script and my Input wrapper works fine, but, once I built an executable from my project and went to a production environment.
The same Racing Wheel ( exactly the same object used in development ) didn't work with the project, and upon further investigation running Unity 2017.3.0f3 on the production environment I found that the wheel wasn't even detected by Unity, only the Logitech Gaming Software detects it
----------
Unity does detect the wheel as a joystick and I can use the inputs without the SDK ( But as the wheel only uses a few degrees to report full steer when not using the SDK, I can't just use the generic input )
I already tried reinstalling LGS and also checking the scripts from the SDK, even the demo application that comes with the SDK from the official Logitech site can't connect to the wheel
I can't really pinpoint where the problem is because of the nature of the DLL from Logitech
Do someone know how to solve this or at least how to know what the problem really is?
↧
↧
Android import shared object with dependencies,Android DLLImport not working, when .so depends on other .so's.
Hello,
I'm trying to import a native library into my C# Unity Project on Android.
Every thing works fine if the libraries only depend on standard libraries already available by unity.
But if one Library depends on a Library provided by my self unity is not able to load this Library.
How can i tell unity to link libraries against each other?
Best Thomas,Hello,
i'm currently trying to include a rather complex set of native Library in my Unity Project for Android.
Every thing works fine until i try to include a library depending on other native librarys.
So my question is how can i import a shared object that depends on other shared objects in Unity?
↧
IOS native plugin become slow in Unity
Hello everyone,
I have implemented a speech recognition code in native objective C, in this code, there is a block of code that sampling voice about every 100ms and periodically decode the voice, in the native code, everything runs fluency, but when I packaged my native code into a static library and use as a plugin in Unity, the process of sampling voice and decoding voice become slower than in native code, is there something I'm missing? any suggestion would be appreciate.
↧
Passing AndroidJavaObject to C++ method using JNI
I have a precompiled native library that accepts a jobject parameter, which is my applications Android Context. I am correctly getting an instance to my Android Context as an AndroidJavaObject in my unity application. When I call my native library and pass the context, it expects a jobject parameter, so I assumed that i should use getRawObject() method of AndroidJavaObject, but that did not work. Passing the context as AndroidJavaObject also causes an exception
I am really stuck on this. Anyone knows how I can pass an AndroidJavaObject to a native method? How can i marshal an AndroidJavaObject into a jobject so that JNI can understand it?
↧
↧
How to add event to mobile calendar *easily*?
Hello,
Is there a way to add events to mobile device calendar (iOS and Android) without writing native plugins by ourselves?
I found an asset on asset store which provides this feature for Android but I need it for both iOS and Android.
Did anyone do this in the past? Can anyone provide an easy solution?
I don't think I can develop my own native iOS and Android plugin from scratch.
**To Moderators:** Please don't reject/delete this question because a Unity employee who I asked help told me I can re-post my question after it got rejected by another person.
↧
Retrieve/Create OpenGL context for native plugin thread?
How can I create a shared OpenGL context in a worker thread spawned from a native plugin?
Or how can I obtain the main Unity OpenGL context? (As a first step, I guess...)
↧
How to render device camera feed to a texture without using WebCamTexture
Hello Unity Developers,
----------
I want to render device camera feed on a texture in unity with all the features of camera, like, autofocus, focus on particular area, flash etc in which autofocus is mandatory for me. Since, WebCamTexture doesn't have autofocus so I can't use that.
----------
I have already seen many links but didn't find any solution, but here : https://stackoverflow.com/questions/35766200/texture-rendering-on-ios-using-opengl-es-in-unity-project I can see something which can help me, but I am not able to make this working in unity.
----------
Please let me know how can I do that and provide me some piece of code on ios (objective-c) side which can create and render camera on textureID (**GetNativeTexturePtr()**) received from unity.
----------
Edit : **Target Platforms are Android and iOS.**
----------
Any help will be appreciated. I am waiting for your valuable comments.
Thank you in advance.
----------
↧
IOS Phone Gallery Open
I want to Open IOS Phone Gallery
but I don't know how to use Native Plugins I try but failed
if Anyone Know this solution in his project on GitHub please help me
it's urgent
thank you
↧
↧
IOS phone Gallery Open
I want to Open IOS Phone Gallery but I don't know how to use Native Plugins I try but failed if Anyone Know this solution in his project on GitHub please help me
it's urgent
thank you
↧
How to access an Android native plugin in unity ?
I want to integrate Braintree android native plugin into unity. Tried many things found on Internet, but none were a success. I have not idea how it's done. Please help me.
↧
Native plugin asset dependencies
I am working on creating a plugin from native code. The structure of the files needed is as follows:
- ManagedPlugin.dll --- this is what Unity uses
- NativePlugin.dll --- this is the native code
- NativeDependency1.dll --- this is another dll needed by NativePlugin.dll
- NativeDependency2.txt --- this is a non-executable asset file that NativeDependency1.dll needs in the same directory (extension is arbitrary)
As much as I have been looking up online or going through the doc, I could not find any suggestion how to deal with the non-executable dependency. By default Unity does not do anything with it and when you build the player it gets left out.
For windows builds, I was able to create a post build script to edit the VS project and include the files there. However, that's quite a hack and I'm not sure it will be very robust.
Is there any support in Unity for this type of scenario?
↧
Native android plugin stop working when changing scenes
Hi all,
I bought a BLE plugin for android to get some data from a device I have, during the first scene the plugin and the script works fine but when i am changing scenes the connection seem to get lost. Any idea what is causing it?
note: I am using DoNotDestroyOnLoad() on the relevant scripts;
↧
↧
does native audio plugin processcallback stop being called after few empty audio buffer?
Hi I am writing an audio synthesis plugin that outputs audio samples (and does not get any audio samples as input).
Everything works fine until my synthesizer outputs a few frames of empty audio (silence). In that case if the silence is too long (~ 1sec) then processcallback stops being called. i want to have process callback called without stopping at silence.
I use an audio source (singleton) on my player gameobject which I run through and output audiomixer. My synth plugin is added to the mixer as and effect.
It seems like I have to link the audio source to a 'dummy' .wav file in order for sound to be enabled.
My guess is that unity somehow detects that the plugin is producing empty buffers of audio and shuts it off in order to save CPU. I tried unselecting "virtualize effects" in audio part of project settings with no luck.
How do i make unity continue to call processcallback even if the audio buffers are empty ( values set to 0)
↧
NativeAudioPlugin use all 5.1 channels
Hello,
is there a way to generate a 5.1 in a NativeAudioPlugin? I've set Project Settings -> Audio -> Default Speaker Mode to 5.1 and in my effect (in the C implementation), I've set AudioEffectDefinition::channels to 6. I can only get 2 channels in the callbacks (ProcessCallback, CreateCallback), even though I can clearly see in my mixer that the project has 6 channels.
Thanks!
Thomas
↧
Native keyboard height and hide the input field
Hello everyone,
Its just a pain to get the native keyboard height in unity and then hide the native input field.
Hiding the input field work fine on ios and never on android.
For Getting the keyboard height I have searched and came out with several solutions which never worked.
For android none of the below worked for me.
printing them result in 0.
1-
TouchScreenKeyboard.area.height
2-
TouchScreenKeyboard.area.max.y
3 -
public int GetAndroidKeyboardSize()
{
using(AndroidJavaClass UnityClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
{
AndroidJavaObject View = UnityClass.GetStatic("currentActivity").Get("mUnityPlayer").Call("getView");
using(AndroidJavaObject Rct = new AndroidJavaObject("android.graphics.Rect"))
{
View.Call("getWindowVisibleDisplayFrame", Rct);
return Screen.height - Rct.Call("height");
}
}
}
4 -
private float GetKeyboardHeightRatio()
{
#if UNITY_ANDROID
using (AndroidJavaClass UnityClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer")) {
AndroidJavaObject View = UnityClass.GetStatic("currentActivity").Get("mUnityPlayer").Call("getView");
using (AndroidJavaObject rect = new AndroidJavaObject("android.graphics.Rect")) {
View.Call("getWindowVisibleDisplayFrame", rect);
return (float)(Screen.height - rect.Call("height")) / Screen.height;
}
}
#else
return (float)TouchScreenKeyboard.area.height / Screen.height;
#endif
}
Similarly no success on ios with methods 1&2 since 3&4 are only for android.
Temporarily I used a static size as the keyboard size (40% of canvas size) and the UI scaling works but just can't get the value of the soft native keyboard.
And now want to hide the native input field, this time the trouble is only in android.
TouchScreenKeyboard.hideInput = true; ------ doesn't work
this.GetComponent ().shouldHideMobileInput = true; ---- doesn't work
Now before thinking of a plugin just to get a size or hiding the input field, let me know if someone has the simpler solution.
If we need a native plugin for this ... too bad to unity.
Any help or useful links are appreciated.
btw I think I've checked all possible links, please suggest a method you've tried and worked for you.
I am using Unity 2017.3.1
thanks in advance
↧
android time cheat plugin problem with broadcastreceiver
Hi,
i want to make an android plugin wich use **android.intent.action.TIME_SET** so when user changing the time i can tell he cheated !
so here is android java class :
package com.mahdi.detecttime;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.unity3d.player.UnityPlayer;
public class MahdiBridge extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
UnityPlayer.UnitySendMessage("TimeDetector", "OnTchanged", "yes" );
}
}
_ and here is the manifest file
__ and in unity i have a gameobject call "TimeDetector" and a class call "onTimeChanged" and a public function call "OnTchanged" and when OnTchanged function is called i know user is cheating !
and everything is working (when i change time in device that function is called) but its only working if app is running and when i close the unity app in the logcat i get this message:
**"Unity: Native libraries not loaded - dropping message for TimeDetector.OnTchanged"**
its mean the broadcastreceiver has been called but unity is not running to run that function. so how can i fix this i want to when broadcastreceiver is called its wait until i start unity app then its run the function
so how can i do this
thanks.
↧
↧
Need help compiling Unity Native Audio Plugins for Linux, got "multiple definition of" errors.
Hi, my game uses Unity Native Audio Plugins available here:
https://bitbucket.org/Unity-Technologies/nativeaudioplugins/downloads/
That repository includes the sources, as well as a compiled version for Win32, Win64 and Mac... but not for Linux!
The problem is: I'm a total noob in both Linux and C++.
Here is what I've done so far:
- Installed Virtual Box on my Windows 7
- Downloaded and installed a Debian 9.4 (64bits)
- Told apt-get to stop trying to get everything from the virtual install dvds instead of Internet
- `apt-get update`
- `apt-get upgrade`
- `apt-get install build-essential` (for g++)
- `apt-get install module-assistant` (to be able to copy-paste, drag n drop and create shared directories between my Windows and Debian)
- Created a shared directory containing the sources of Unity Native Audio Plugins
- Tried to use the Makefile I found in the sources but got `multiple definition of` errors. I didn't change the sources so it must be a configuration problem. Can someone help me figure out what's going on please? Here is the output in the terminal after typing `make` in the shared directory.
root@VirtualDebian64:/media/sf_SharedFiles/NativeAudioPlugin# make g++ -I. -O2 -fPIC -c AudioPluginUtil.cpp g++ -I. -O2 -fPIC -c Plugin_ConvolutionReverb.cpp g++ -I. -O2 -fPIC -c Plugin_CorrelationMeter.cpp g++ -I. -O2 -fPIC -c Plugin_Equalizer.cpp g++ -I. -O2 -fPIC -c Plugin_Granulator.cpp g++ -I. -O2 -fPIC -c Plugin_ImpulseGenerator.cpp g++ -I. -O2 -fPIC -c Plugin_ImpactGenerator.cpp g++ -I. -O2 -fPIC -c Plugin_LevelMixer.cpp g++ -I. -O2 -fPIC -c Plugin_Lofinator.cpp g++ -I. -O2 -fPIC -c Plugin_LoudnessMeter.cpp g++ -I. -O2 -fPIC -c Plugin_ModalFilter.cpp g++ -I. -O2 -fPIC -c Plugin_Multiband.cpp g++ -I. -O2 -fPIC -c Plugin_NoiseBox.cpp g++ -I. -O2 -fPIC -c Plugin_Oscilloscope.cpp g++ -I. -O2 -fPIC -c Plugin_PitchDetector.cpp g++ -I. -O2 -fPIC -c Plugin_RingModulator.cpp g++ -I. -O2 -fPIC -c Plugin_Routing.cpp g++ -I. -O2 -fPIC -c Plugin_SpatializerReverb.cpp g++ -I. -O2 -fPIC -c Plugin_SpatializerReverb.cpp g++ -I. -O2 -fPIC -c Plugin_StereoWidener.cpp g++ -I. -O2 -fPIC -c Plugin_Synthesizer.cpp g++ -I. -O2 -fPIC -c Plugin_TeeBee.cpp g++ -I. -O2 -fPIC -c Plugin_TeeDee.cpp g++ -I. -O2 -fPIC -c Plugin_Teleport.cpp g++ -I. -O2 -fPIC -c Plugin_TubeResonator.cpp g++ -I. -O2 -fPIC -c Plugin_Vocoder.cpp g++ -I. -O2 -fPIC -c Plugin_WahWah.cpp g++ -I. -O2 -fPIC -c hrtftable.cpp g++ -shared -rdynamic -fPIC -o libAudioPluginDemo.so AudioPluginUtil*.o Plugin_ConvolutionReverb*.o Plugin_CorrelationMeter*.o Plugin_Equalizer*.o Plugin_Granulator*.o Plugin_ImpulseGenerator*.o Plugin_ImpactGenerator*.o Plugin_LevelMixer*.o Plugin_Lofinator*.o Plugin_LoudnessMeter*.o Plugin_ModalFilter*.o Plugin_Multiband*.o Plugin_NoiseBox*.o Plugin_Oscilloscope*.o Plugin_PitchDetector*.o Plugin_RingModulator*.o Plugin_Routing*.o Plugin_Spatializer*.o Plugin_SpatializerReverb*.o Plugin_StereoWidener*.o Plugin_Synthesizer*.o Plugin_TeeBee*.o Plugin_TeeDee*.o Plugin_Teleport*.o Plugin_TubeResonator*.o Plugin_Vocoder*.o Plugin_WahWah*.o hrtftable*.o Plugin_SpatializerReverb.o: In function `SpatializerReverb::InternalRegisterEffectDefinition(UnityAudioEffectDefinition&)': Plugin_SpatializerReverb.cpp:(.text+0x0): multiple definition of `SpatializerReverb::InternalRegisterEffectDefinition(UnityAudioEffectDefinition&)' Plugin_SpatializerReverb.o:Plugin_SpatializerReverb.cpp:(.text+0x0): first defined here Plugin_SpatializerReverb.o: In function `SpatializerReverb::CreateCallback(UnityAudioEffectState*)': Plugin_SpatializerReverb.cpp:(.text+0xa0): multiple definition of `SpatializerReverb::CreateCallback(UnityAudioEffectState*)' Plugin_SpatializerReverb.o:Plugin_SpatializerReverb.cpp:(.text+0xa0): first defined here Plugin_SpatializerReverb.o: In function `SpatializerReverb::ReleaseCallback(UnityAudioEffectState*)': Plugin_SpatializerReverb.cpp:(.text+0xf0): multiple definition of `SpatializerReverb::ReleaseCallback(UnityAudioEffectState*)' Plugin_SpatializerReverb.o:Plugin_SpatializerReverb.cpp:(.text+0xf0): first defined here Plugin_SpatializerReverb.o: In function `SpatializerReverb::SetFloatParameterCallback(UnityAudioEffectState*, int, float)': Plugin_SpatializerReverb.cpp:(.text+0x140): multiple definition of `SpatializerReverb::SetFloatParameterCallback(UnityAudioEffectState*, int, float)' Plugin_SpatializerReverb.o:Plugin_SpatializerReverb.cpp:(.text+0x140): first defined here Plugin_SpatializerReverb.o: In function `SpatializerReverb::GetFloatParameterCallback(UnityAudioEffectState*, int, float*, char*)': Plugin_SpatializerReverb.cpp:(.text+0x1a0): multiple definition of `SpatializerReverb::GetFloatParameterCallback(UnityAudioEffectState*, int, float*, char*)' Plugin_SpatializerReverb.o:Plugin_SpatializerReverb.cpp:(.text+0x1a0): first defined here Plugin_SpatializerReverb.o: In function `SpatializerReverb::GetFloatBufferCallback(UnityAudioEffectState*, char const*, float*, int)': Plugin_SpatializerReverb.cpp:(.text+0x220): multiple definition of `SpatializerReverb::GetFloatBufferCallback(UnityAudioEffectState*, char const*, float*, int)' Plugin_SpatializerReverb.o:Plugin_SpatializerReverb.cpp:(.text+0x220): first defined here Plugin_SpatializerReverb.o: In function `SpatializerReverb::ProcessCallback(UnityAudioEffectState*, float*, float*, unsigned int, int, int)': Plugin_SpatializerReverb.cpp:(.text+0x230): multiple definition of `SpatializerReverb::ProcessCallback(UnityAudioEffectState*, float*, float*, unsigned int, int, int)' Plugin_SpatializerReverb.o:Plugin_SpatializerReverb.cpp:(.text+0x230): first defined here Plugin_SpatializerReverb.o:(.bss+0x0): multiple definition of `reverbmixbuffer' Plugin_SpatializerReverb.o:(.bss+0x0): first defined here collect2: error: ld returned 1 exit status Makefile:40: recipe for target 'libAudioPluginDemo.so' failed make: *** [libAudioPluginDemo.so] Error 1
And here is the Makefile: SRCS=AudioPluginUtil.cpp \ Plugin_ConvolutionReverb.cpp \ Plugin_CorrelationMeter.cpp \ Plugin_Equalizer.cpp \ Plugin_Granulator.cpp \ Plugin_ImpulseGenerator.cpp \ Plugin_ImpactGenerator.cpp \ Plugin_LevelMixer.cpp \ Plugin_Lofinator.cpp \ Plugin_LoudnessMeter.cpp \ Plugin_ModalFilter.cpp \ Plugin_Multiband.cpp \ Plugin_NoiseBox.cpp \ Plugin_Oscilloscope.cpp \ Plugin_PitchDetector.cpp \ Plugin_RingModulator.cpp \ Plugin_Routing.cpp \ Plugin_Spatializer.cpp \ Plugin_SpatializerReverb.cpp \ Plugin_StereoWidener.cpp \ Plugin_Synthesizer.cpp \ Plugin_TeeBee.cpp \ Plugin_TeeDee.cpp \ Plugin_Teleport.cpp \ Plugin_TubeResonator.cpp \ Plugin_Vocoder.cpp \ Plugin_WahWah.cpp \ hrtftable.cpp OBJS=$(SRCS:.cpp=*.o) OUTPUT=libAudioPluginDemo.so CXXFLAGS=-I. -O2 -fPIC LDFLAGS=-shared -rdynamic -fPIC CXX=g++ all: $(OUTPUT) clean: rm -f $(OUTPUT) $(OBJS) $(OUTPUT): $(OBJS) $(CXX) $(LDFLAGS) -o $(OUTPUT) $(OBJS) .cpp.o: $(CXX) $(CXXFLAGS) -c $<
Bonus question: How can I compile a version for Linux 32 and a version for Linux 64?
https://bitbucket.org/Unity-Technologies/nativeaudioplugins/downloads/
That repository includes the sources, as well as a compiled version for Win32, Win64 and Mac... but not for Linux!
The problem is: I'm a total noob in both Linux and C++.
Here is what I've done so far:
- Installed Virtual Box on my Windows 7
- Downloaded and installed a Debian 9.4 (64bits)
- Told apt-get to stop trying to get everything from the virtual install dvds instead of Internet
- `apt-get update`
- `apt-get upgrade`
- `apt-get install build-essential` (for g++)
- `apt-get install module-assistant` (to be able to copy-paste, drag n drop and create shared directories between my Windows and Debian)
- Created a shared directory containing the sources of Unity Native Audio Plugins
- Tried to use the Makefile I found in the sources but got `multiple definition of` errors. I didn't change the sources so it must be a configuration problem. Can someone help me figure out what's going on please? Here is the output in the terminal after typing `make` in the shared directory.
root@VirtualDebian64:/media/sf_SharedFiles/NativeAudioPlugin# make g++ -I. -O2 -fPIC -c AudioPluginUtil.cpp g++ -I. -O2 -fPIC -c Plugin_ConvolutionReverb.cpp g++ -I. -O2 -fPIC -c Plugin_CorrelationMeter.cpp g++ -I. -O2 -fPIC -c Plugin_Equalizer.cpp g++ -I. -O2 -fPIC -c Plugin_Granulator.cpp g++ -I. -O2 -fPIC -c Plugin_ImpulseGenerator.cpp g++ -I. -O2 -fPIC -c Plugin_ImpactGenerator.cpp g++ -I. -O2 -fPIC -c Plugin_LevelMixer.cpp g++ -I. -O2 -fPIC -c Plugin_Lofinator.cpp g++ -I. -O2 -fPIC -c Plugin_LoudnessMeter.cpp g++ -I. -O2 -fPIC -c Plugin_ModalFilter.cpp g++ -I. -O2 -fPIC -c Plugin_Multiband.cpp g++ -I. -O2 -fPIC -c Plugin_NoiseBox.cpp g++ -I. -O2 -fPIC -c Plugin_Oscilloscope.cpp g++ -I. -O2 -fPIC -c Plugin_PitchDetector.cpp g++ -I. -O2 -fPIC -c Plugin_RingModulator.cpp g++ -I. -O2 -fPIC -c Plugin_Routing.cpp g++ -I. -O2 -fPIC -c Plugin_SpatializerReverb.cpp g++ -I. -O2 -fPIC -c Plugin_SpatializerReverb.cpp g++ -I. -O2 -fPIC -c Plugin_StereoWidener.cpp g++ -I. -O2 -fPIC -c Plugin_Synthesizer.cpp g++ -I. -O2 -fPIC -c Plugin_TeeBee.cpp g++ -I. -O2 -fPIC -c Plugin_TeeDee.cpp g++ -I. -O2 -fPIC -c Plugin_Teleport.cpp g++ -I. -O2 -fPIC -c Plugin_TubeResonator.cpp g++ -I. -O2 -fPIC -c Plugin_Vocoder.cpp g++ -I. -O2 -fPIC -c Plugin_WahWah.cpp g++ -I. -O2 -fPIC -c hrtftable.cpp g++ -shared -rdynamic -fPIC -o libAudioPluginDemo.so AudioPluginUtil*.o Plugin_ConvolutionReverb*.o Plugin_CorrelationMeter*.o Plugin_Equalizer*.o Plugin_Granulator*.o Plugin_ImpulseGenerator*.o Plugin_ImpactGenerator*.o Plugin_LevelMixer*.o Plugin_Lofinator*.o Plugin_LoudnessMeter*.o Plugin_ModalFilter*.o Plugin_Multiband*.o Plugin_NoiseBox*.o Plugin_Oscilloscope*.o Plugin_PitchDetector*.o Plugin_RingModulator*.o Plugin_Routing*.o Plugin_Spatializer*.o Plugin_SpatializerReverb*.o Plugin_StereoWidener*.o Plugin_Synthesizer*.o Plugin_TeeBee*.o Plugin_TeeDee*.o Plugin_Teleport*.o Plugin_TubeResonator*.o Plugin_Vocoder*.o Plugin_WahWah*.o hrtftable*.o Plugin_SpatializerReverb.o: In function `SpatializerReverb::InternalRegisterEffectDefinition(UnityAudioEffectDefinition&)': Plugin_SpatializerReverb.cpp:(.text+0x0): multiple definition of `SpatializerReverb::InternalRegisterEffectDefinition(UnityAudioEffectDefinition&)' Plugin_SpatializerReverb.o:Plugin_SpatializerReverb.cpp:(.text+0x0): first defined here Plugin_SpatializerReverb.o: In function `SpatializerReverb::CreateCallback(UnityAudioEffectState*)': Plugin_SpatializerReverb.cpp:(.text+0xa0): multiple definition of `SpatializerReverb::CreateCallback(UnityAudioEffectState*)' Plugin_SpatializerReverb.o:Plugin_SpatializerReverb.cpp:(.text+0xa0): first defined here Plugin_SpatializerReverb.o: In function `SpatializerReverb::ReleaseCallback(UnityAudioEffectState*)': Plugin_SpatializerReverb.cpp:(.text+0xf0): multiple definition of `SpatializerReverb::ReleaseCallback(UnityAudioEffectState*)' Plugin_SpatializerReverb.o:Plugin_SpatializerReverb.cpp:(.text+0xf0): first defined here Plugin_SpatializerReverb.o: In function `SpatializerReverb::SetFloatParameterCallback(UnityAudioEffectState*, int, float)': Plugin_SpatializerReverb.cpp:(.text+0x140): multiple definition of `SpatializerReverb::SetFloatParameterCallback(UnityAudioEffectState*, int, float)' Plugin_SpatializerReverb.o:Plugin_SpatializerReverb.cpp:(.text+0x140): first defined here Plugin_SpatializerReverb.o: In function `SpatializerReverb::GetFloatParameterCallback(UnityAudioEffectState*, int, float*, char*)': Plugin_SpatializerReverb.cpp:(.text+0x1a0): multiple definition of `SpatializerReverb::GetFloatParameterCallback(UnityAudioEffectState*, int, float*, char*)' Plugin_SpatializerReverb.o:Plugin_SpatializerReverb.cpp:(.text+0x1a0): first defined here Plugin_SpatializerReverb.o: In function `SpatializerReverb::GetFloatBufferCallback(UnityAudioEffectState*, char const*, float*, int)': Plugin_SpatializerReverb.cpp:(.text+0x220): multiple definition of `SpatializerReverb::GetFloatBufferCallback(UnityAudioEffectState*, char const*, float*, int)' Plugin_SpatializerReverb.o:Plugin_SpatializerReverb.cpp:(.text+0x220): first defined here Plugin_SpatializerReverb.o: In function `SpatializerReverb::ProcessCallback(UnityAudioEffectState*, float*, float*, unsigned int, int, int)': Plugin_SpatializerReverb.cpp:(.text+0x230): multiple definition of `SpatializerReverb::ProcessCallback(UnityAudioEffectState*, float*, float*, unsigned int, int, int)' Plugin_SpatializerReverb.o:Plugin_SpatializerReverb.cpp:(.text+0x230): first defined here Plugin_SpatializerReverb.o:(.bss+0x0): multiple definition of `reverbmixbuffer' Plugin_SpatializerReverb.o:(.bss+0x0): first defined here collect2: error: ld returned 1 exit status Makefile:40: recipe for target 'libAudioPluginDemo.so' failed make: *** [libAudioPluginDemo.so] Error 1
And here is the Makefile: SRCS=AudioPluginUtil.cpp \ Plugin_ConvolutionReverb.cpp \ Plugin_CorrelationMeter.cpp \ Plugin_Equalizer.cpp \ Plugin_Granulator.cpp \ Plugin_ImpulseGenerator.cpp \ Plugin_ImpactGenerator.cpp \ Plugin_LevelMixer.cpp \ Plugin_Lofinator.cpp \ Plugin_LoudnessMeter.cpp \ Plugin_ModalFilter.cpp \ Plugin_Multiband.cpp \ Plugin_NoiseBox.cpp \ Plugin_Oscilloscope.cpp \ Plugin_PitchDetector.cpp \ Plugin_RingModulator.cpp \ Plugin_Routing.cpp \ Plugin_Spatializer.cpp \ Plugin_SpatializerReverb.cpp \ Plugin_StereoWidener.cpp \ Plugin_Synthesizer.cpp \ Plugin_TeeBee.cpp \ Plugin_TeeDee.cpp \ Plugin_Teleport.cpp \ Plugin_TubeResonator.cpp \ Plugin_Vocoder.cpp \ Plugin_WahWah.cpp \ hrtftable.cpp OBJS=$(SRCS:.cpp=*.o) OUTPUT=libAudioPluginDemo.so CXXFLAGS=-I. -O2 -fPIC LDFLAGS=-shared -rdynamic -fPIC CXX=g++ all: $(OUTPUT) clean: rm -f $(OUTPUT) $(OBJS) $(OUTPUT): $(OBJS) $(CXX) $(LDFLAGS) -o $(OUTPUT) $(OBJS) .cpp.o: $(CXX) $(CXXFLAGS) -c $<
Bonus question: How can I compile a version for Linux 32 and a version for Linux 64?
↧
How to implement callback from android abstract class?
Hi, I am current trying to connect to BLE with AndroidJavaProxy.
This is my implementation:
class ScanCallback : AndroidJavaProxy
{
public ScanCallback() : base("android.bluetooth.le.ScanCallback") { }
public void onScanResult(int callbackType, AndroidJavaObject result)
{
string deviceName = result.Call("getDevice").Call("getDeviceName");
GameObject.Find("debug").GetComponent().text = deviceName;
}
public void onScanFailed(int errorcode)
{
}
public void onBatchScanResults(List results)
{
}
}
However, this only works for interface instead of android abstract class. The logcat i have:
07-09 11:21:12.918 8973-9012/com.AVPL.Beacon E/Unity: AndroidJavaException: java.lang.IllegalArgumentException: android.bluetooth.le.ScanCallback is not an interface
java.lang.IllegalArgumentException: android.bluetooth.le.ScanCallback is not an interface
at java.lang.reflect.Proxy.getProxyClass0(Proxy.java:426)
at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:741)
at com.unity3d.player.ReflectionHelper.newProxyInstance(Unknown Source)
at com.unity3d.player.ReflectionHelper.newProxyInstance(Unknown Source)
at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
at com.unity3d.player.UnityPlayer.c(Unknown Source)
at com.unity3d.player.UnityPlayer$e$2.queueIdle(Unknown Source)
at android.os.MessageQueue.next(MessageQueue.java:392)
at android.os.Looper.loop(Looper.java:139)
at com.unity3d.player.UnityPlayer$e.run(Unknown Source)
↧
Pass camera stream from unity and android plugin
I'm trying to use Firebase's MLKit with unity, trying to use the face detection in my project. While sending a single image works, there is a high ping associated with the plugin call from unity and the time by which the callback actually returns the value. Is there any way to achieve a low latency solution for this, so that a reliable connection can be made?
Unity Code
public void AndroidRender() {
tex = new Texture2D(webcamTexture.width, webcamTexture.height);
textureHolder.GetComponent().texture = tex;
tex.SetPixels32(webcamTexture.GetPixels32());
tex.Apply();
byteObject.Call("passByteArray", colorBytes);
coordinates = byteObject.Call("getData");
}
Java code
public passByteArray(byte[] byteArray) {
if(gotData) {
return; //create new values only if previous one's have been consumed
}
//create bitmap
BitmapFactory.Options bitmapOptions = new BitmapFactory.Options();
bitmapOptions.inMutable = true;
Bitmap bmp = BitmapFactory.decodeByteArray(byteArray, 0, byteArray.length, bitmapOptions);
bmp = rotateBitmap(bmp, 90);
FirebaseVisionImage image = FirebaseVisionImage.fromBitmap(bmp);
//start detection
FirebaseVisionFaceDetector detector = FirebaseVision.getInstance()
.getVisionFaceDetector(options);
Task
- > result =
detector.detectInImage(image)
.addOnSuccessListener(
new OnSuccessListener
- >() {
@Override
public void onSuccess(List
↧