ARAnimation rendering stop working without any code change - sony-smarteyeglass

Could there be any reason why sendARAnimationObject should stop working without any change in the code? Does rendering of bitmaps in a timer depend on any external state like battery level or sensor state etc?
Another issue is that if I use sendARAnimationObjectWithCallback the callback method in the listener onResultSendAnimationObject is never called as stated in the documentation. Could there be any other dependency causing this callback method not called at all?

It works much better with the official SDK v1.0

Now I belive I found the main reason behind. I was not calling disableARAnimationRequest anywhere in my app. Now I am calling it in onPause and it works much better next time I start the app and call enableARAnimationRequest. But I would need someone at sony to confirm this kind of behaviour. Maybe the disable method should be called in some SDK method without putting that burden on the developer. Or some kind of cleanup in SDK when you start your app and enable animation request.

Related

Using wh_shell hook for custom windows-shell(explorer.exe replacement program) C++

So I have spent that past week and a half working on code to simply setup the hook procedure for wh_shell for a program that will replace explorer.exe in the registry and will run as the main desktop program. There seems to be very little information and sources for using this outside of just the windows API which is a bit undescriptive and doesn't explain everything to a great detail. For some reason I just cant get it to work, no matter if I run it inside of explorer.exe, or if I replace the register and make it the default shell. I'm going to ask a couple of things in this post because I think that if you can answer one of these questions you likely have the answer to more.
So first I just have a question about hooks in general: When I run the SetWindowsHookEx(...) function -resource below- it says for var lpfn that a dll is not necessary if the hook is only used to monitor the current process. Now obviously when monitoring events such as window_created, those are events within a different processes which makes me think that the hookproc has to be within a DLL(which is how ive programmed so far). But this is questionable to me because when u are running SetWindowsHookEx(...) the process I wish to monitor do not yet exist until the user decides to start them. Do these processes notify the system when wh_shell events are being done so that I my hook doesnt need to get placed into every process upon creation, or is it more like when I run SetWindowsHookEx(...) with wh_shell that it will place a hook in all processes when the are created. The second resource states that the system just calls the hookproc when these things happen, so then do I even need a DLL, or what process does it need to be hooked to because I dont think it needs to be hooked into everything.
So second I have a question regarding setting my process as default shell - see resources - the resource states any process that registers itself as the default shell(which I assume is just modifying the registry to my process, if not and there is more please let me know) needs to call the SystemsParameterInfo(...) function. So first, does this func need to be called before running SetWindowsHookEx(...) or is there some expected spot it should be elsewhere in my code? Then in regards to the other variables it doesnt specify for, just curious what the recommended would be to set them as, like what are they set as for explorer.exe, and maybe a few other examples(including things NOT to do).
Finally for the sake of testing, using the console will be the most helpful to me here. The console will be used for input to run functions and commands for now(like open the register and swap back the shell to explorer.exe). If my hookproc is within a DLL, I need it to output some messages, I dont want to muddle the same console and I also dont even know if it will output to the same console, so what might be a recommended or potential solution for outputs(again this is temporary and for testing so it doesnt have to be perfect or even great)?
Also I would think windows 11 shouldn't be an issue, but I havent tested on windows 10 system...
I havent included any code as Im pretty sure most of this stuff can be answered without it and that its so few lines of code that its not like typical questions where its like examine my code and help me, maybe some example code you can show me would be really helpful.
Thankyou!
SetWindowsHookEx(...)
https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setwindowshookexa
defaultShell
https://learn.microsoft.com/en-us/windows/win32/winmsg/about-hooks#wh_shell
regards to WH_SHELL section
Testing Environment:
Windows 11 vm running in Hyper-V Manager
You haven't mentioned an important parameter in your description and that is the last argument of SetWindowsHookEx, the thread id.
When it is set to 0 then ..
'[in] Specifies the identifier of the thread with which the hook procedure is to be associated. If this parameter is zero, the hook procedure is associated with all existing threads running in the same desktop as the calling thread.'
That said, then like everything in Windows programming nothing is as what the documentation states, its as if the documentation is a wish-list Microsoft will like Windows to be when it grows up.
Actually even if you manage to get everything right you will see that the shell messages you will get will be VERY few compared to what the documentation states.
I am working on the same issue and when I get it going I will post the results here.

N-API Continuous callbacks for c++ media stream

I'm trying to create a node interface for a c++ media player. Upon decoding of a frame, there is an event which allows me to access the frame data, which I'm trying to funnel into node. But I can't seem to figure out how to get that kind of functionality to work with the functions available in the node api. My approach, for the time being, is to figure out a push mechanism to get the data from c++ to javascript where all i need is to initialize a callback in javascript, since it seems more elegant. If that fails I could create a polling loop in js to check if there is new frame data, but it seems less efficient.
I've tried with napi_create_async_work, by creating a lambda function in the execute parameter function, which would allow me to call napi_make_callback for every frame callback, but then I get the following error :
Fatal error in HandleScope::HandleScope
Entering the V8 API without proper locking in place
I'm likely approaching this incorrectly, its the first time I use n-api.
Any help is welcome, thank you!
The issue is mainly pertaining to the fact you can’t access V8 (JavaScript) memory outside the event-loop’s main thread. If you're creating an async thread, by default you're also creating a new memory stack.
Fortunately, a fix is on the way which should allow thread safe access with
napi_create_threadsafe_function (example here)
Until then
There is a header only C++ package which integrates great with the C++ N-API wrapper
Napi-addon-api is update. These is a good way that use the Napi::ThreadSafeFunction.
Doc and example.

BHO: getting a notification when onload finishes executing

I'm writing a BHO that should make a slight modification to a specific page. I'd be using DISPID_DOCUMENTCOMPLETE, but the problem is that the page loads more contents using AJAX on it's onload function.
I think the perfect solution for me would be to run my code after onload has returned. Is there any way to get notified when this happens?
Edit: Actually, its not onload, it's jQuery's ready. I'm afraid there's no clean way to achieve what I want. I guess I'll have to implement a timer and check the page periodically, although I hoped to avoid that.
You could try to use DISPID_HTMLDOCUMENTEVENTS2_ONREADYSTATECHANGE (you must advise for DIID_HTMLDocumentEvents2) and then use get_readyState from IHTMLDocument2.
You are lucky that your page is a specific one, you may see a specific sequence of events you can rely on. The general case indeed involves periodic poll (imho)

Calling a function after another function is called

I'm programming a controller for use with Ableton Live 8 using the Python-based API. In my code I use a method provided in the API to watch for changes in a property's value, and call a function whenever the value changes. My goal is to change the color of the clip when the value change is noticed.
I have my code completed, and it compiles without error. From Ableton's log:
742234 ms. RemoteScriptError: RuntimeError
742234 ms. RemoteScriptError: :
742234 ms. RemoteScriptError: Changes cannot be triggered by notifications
742234 ms. RemoteScriptError:
It appears this is the result of using the built-in notification system to make a change to the live set during notification. Triggering the actual change AFTER the listening function has finished executing should work. Is this possible using Python?
Edit for clarification:
currently we have
value change noticed, function called
function attempts to change the clips color (results in error)
we need
listener notices value change, function called
function finds the new color value
function execution ends
another function is called outside the listener's scope, and changes the clips color
I did a lot in M4L and know this error by heart :)
I'm afraid you can't do anything about that - to my noob eyes it looks like a built-in security mechanism so you can't loop (Something changed? Change it! Something changed...).
In M4L i used Javascript Tasks to separate the steps (Tasks forget nearly everything),
something like
Observer -> Something changed
Create a Task that reacts
task.execute() or task.schedule(time)
Maybe the python threading module can achieve something similar?
BTW, if you happen to understand anything about the _Framework-Tasks, let me know.
I was having the same issue trying to delete a track from a clip stop listener, then I found this thread and followed #user2323980 suggestion.
There seems to be a "_tasks" object on every Framework class (I found it throught log_message inside ClipSlotComponent and ControlSurface) that handles concurrency between tasks. And it's really simple to use it:
self._tasks.add(Task.run(func, args))
I found some uses of it on Push and MK2 scripts, those are good references.

How do I create a timer run my program repeatedly? C++

I want create timer in my program so that I can cause it to rerun every minute and I don't know how to do it in a C++ Application. In C# I could just create a timer but I'm struggling here now...
sleep(); is not an option because as far as I know it makes your program inactive for X seconds, I need my app to be active and working, calculating all the time. This is because my code is used to constantly input information into a MS Access table. I was able to create the necessary components of my code to connect and perform the insert/update to the table but this is just on of the many components to the code that I am creating. Please help me with this little (or big?) problem, I'm very new to C++ and learning ATM, but I am developing a fast learning curve. Thanks
I suppose you work on Windows, since you mentioned C#. So take a look at SetTimer, and if it is a MFC app, then look at CWnd::SetTimer.
Every platform provides api for creating a timer, which will give you a callback usually after timer expires. You can just search for the api available on your platform.
If you are using windows use setTimer function.
If you're using C++ .NET, you can use the same Timer class(es) as C#, just use the C++ syntax (using gcnew instead of new, use the ^ for GC references).
Otherwise you could just have a loop:
while (should_keep_looping) {
// do what you need to do
// if necessary:
sleep(1);
}
See here: http://www.cplusplus.com/forum/beginner/317/
There is on built in "timer" in C++, and you are correct about the behavior of sleep(). The above thread describes a custom implementation.
if you have a window you can use its message queue, as suggested by Als and Marius in their answers
you can use some task dispatcher and some timer to register a callback, e.g. functionality provided by Boost.Asio and its deadline_timer (example)
you can check if timer expired between your tasks manually as proposed in BlackJack's link
or you can create separate thread and make it call your callback when time came. Pros: you can use sleep() there and you callback will be called in parallel with your main thread. Cons: worry about synchronization