-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'development' of ssh://github.com/gisogrimm/tascar into …
…development
- Loading branch information
Showing
2 changed files
with
45 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
addpath('/usr/share/tascar/matlab'); | ||
|
||
% Install the javaosctomatlab tool from | ||
% https://0110.be/posts/OSC_in_Matlab_on_Windows,_Linux_and_Mac_OS_X_using_Java | ||
% e.g., with | ||
% wget https://0110.be/files/attachments/430/javaosctomatlab.jar | ||
javaaddpath('javaosctomatlab.jar'); | ||
|
||
% create receiver at port 1032: | ||
receiver = com.illposed.osc.OSCPortIn(1032); | ||
try | ||
% Define the OSC method to listen to: | ||
osc_value_listener = com.illposed.osc.MatlabOSCListener(); | ||
receiver.addListener("/value", osc_value_listener); | ||
|
||
osc_quit_listener = com.illposed.osc.MatlabOSCListener(); | ||
receiver.addListener("/quit", osc_quit_listener); | ||
|
||
receiver.startListening(); | ||
runscript = true; | ||
while runscript | ||
msg = osc_value_listener.getMessageArgumentsAsDouble(); | ||
if ~isempty(msg) | ||
msg | ||
end | ||
quitval = osc_quit_listener.getMessageArgumentsAsDouble(); | ||
if ~isempty(quitval) | ||
if quitval > 0 | ||
runscript = false; | ||
end | ||
end | ||
end | ||
clear('osc_quit_listener'); | ||
clear('osc_value_listener'); | ||
receiver.stopListening(); | ||
receiver.close(); | ||
clear('receiver'); | ||
catch | ||
clear('osc_quit_listener'); | ||
clear('osc_value_listener'); | ||
receiver.close(); | ||
clear('receiver'); | ||
warning(lasterror); | ||
end |