Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimised way to share continuous streams of data to users #23

Open
KonVas opened this issue Apr 4, 2019 · 6 comments

Comments

Projects
None yet
3 participants
@KonVas
Copy link

commented Apr 4, 2019

I am wondering which is the best way to share data with all users on the network, for example generating some values from a master computer and then make these available to everyone providing the solution we have now is a master computer generates the data and parses it to a dictionary then the dictionary is send as OSC message to the rest members using this way:
~addrBook.sendAll('/el', * ~eegBook); or to specific members using peers name and .send method. Is there a more efficient way than that?

@adcxyz

This comment has been minimized.

Copy link
Collaborator

commented Apr 4, 2019

Utopia has OSCDataSpace and OSCObjectSpace for this

@KonVas

This comment has been minimized.

Copy link
Author

commented Apr 4, 2019

@adcxyz

This comment has been minimized.

Copy link
Collaborator

commented Apr 4, 2019

//////////////////////// from Utopia examples: 
// decentralised discovery of participants
// find who's on the network
(
~win = Window("AdHocSociety").front;
~win.layout = VLayout.new.add(~listView = ListView.new);

~addrBook = AddrBook.new;
// to get updates, just add a dependant
~addrBook.addDependant({|addrBook, what, who|
	{~listView.items = addrBook.peers.collectAs({|peer|
		peer.name ++ " | " ++ peer.addr.ip ++ " | " ++ if(peer.online, "online", "offline");
	}, Array)}.defer;
});

~addrBook.addMe; // will automatically add you using your user name

~hail = Hail(~addrBook);
)
// simple objectspace test:
~objSpace = OSCObjectSpace(~addrBook, true);

~objSpace.put(\event, (a: 1, b: 2));

// check on a different machine: 
~objSpace[\event];
// should be ->  ( 'a': 1, 'b': 2 )
@KonVas

This comment has been minimized.

Copy link
Author

commented Apr 4, 2019

@muellmusik

This comment has been minimized.

Copy link
Owner

commented Apr 4, 2019

@KonVas

This comment has been minimized.

Copy link
Author

commented Apr 6, 2019

Thanks for the Input @muellmusik then it means that in the client there is no reason to pack it up again, and make more dictionaries for the ~objSpace as it will be already packed up as one, then we on the clients side can parse it in any way using something like this: ~event = ~objSpace[\event]; and ~event[\el0] ~event[\el1] and so forth. To get a single value we need to use it as an Event ~event[\el0].asEvent and call the value we are looking, such as alpha etc. is this efficient?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.