Yup, Datagram Sockets is what you want!faxinadu wrote: ↑Tue Dec 19, 2017 6:59 am ok so this:
http://www.roman10.net/2011/11/22/andro ... h-example/
OSC Receiver and Sender
Re: OSC Receiver
Re: OSC Receiver
Yeah, probably looking to walk before we can run I had a look into Copperlan a while back and from an implementation perspective it's a bit of a nightmare. Super complex and a lot of features that I imagine a tiny fraction of people would use.jksuperstar wrote: ↑Tue Dec 19, 2017 7:03 am I was thinking of Copperlan, the way a remote end can present a list of available parameters to choose from. But maybe I need to know the limitations of OSC better first.
Re: OSC Receiver
Code: Select all
package c.oceanswift.scope1;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.SocketException;
import java.net.UnknownHostException;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final Button button = findViewById(R.id.Randomizer);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
String udpMsg = "/0 12";
DatagramSocket ds = null;
try {
ds = new DatagramSocket();
InetAddress serverAddr = InetAddress.getByName("192.168.1.13");
DatagramPacket dp;
dp = new DatagramPacket(udpMsg.getBytes(), udpMsg.length(), serverAddr, 8000);
ds.send(dp);
} catch (SocketException e) {
e.printStackTrace();
}catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
} finally {
if (ds != null) {
ds.close();
}
}
}
});
}
}
Scope, Android, Web, PC Plugins and Sounds:
http://www.oceanswift.net
Music
https://faxinadu.bandcamp.com/
http://www.oceanswift.net
Music
https://faxinadu.bandcamp.com/
Re: OSC Receiver
Sometimes there can be issues with firewalls, especially when sending across LAN. You might need to add an exception to a firewall on the listening PC.
I'm assuming you don't have any errors from the app? You could also use something like Wireshark to listen for the messages.
I'm assuming you don't have any errors from the app? You could also use something like Wireshark to listen for the messages.
Re: OSC Receiver
i don't have any compile errors but i have some debugger errors when clicking the button. its very much possible i have errors heh. yah im grabbing a sniffer, but imo my code is wrong
Scope, Android, Web, PC Plugins and Sounds:
http://www.oceanswift.net
Music
https://faxinadu.bandcamp.com/
http://www.oceanswift.net
Music
https://faxinadu.bandcamp.com/
Re: OSC Receiver
i think i got better java code now, but checking via the steps outlined in the link, it does not seem like anything is listening on port 8000 on my pc. i got the module open in sdk.
https://stackoverflow.com/questions/481 ... on-windows
https://stackoverflow.com/questions/481 ... on-windows
Scope, Android, Web, PC Plugins and Sounds:
http://www.oceanswift.net
Music
https://faxinadu.bandcamp.com/
http://www.oceanswift.net
Music
https://faxinadu.bandcamp.com/
Re: OSC Receiver
The problem is that all those answers are talking about TCP. Listening on UDP is quite different. Mostly you just want to see if the messages are arriving on your machine now, which is where Wireshark comes in.
Re: OSC Receiver
its showing udp answers too....
yeah im also with wireshark checking
yeah im also with wireshark checking
Scope, Android, Web, PC Plugins and Sounds:
http://www.oceanswift.net
Music
https://faxinadu.bandcamp.com/
http://www.oceanswift.net
Music
https://faxinadu.bandcamp.com/
Re: OSC Receiver
so as far as i can see i am both transiting and receiving but nada on scope
Scope, Android, Web, PC Plugins and Sounds:
http://www.oceanswift.net
Music
https://faxinadu.bandcamp.com/
http://www.oceanswift.net
Music
https://faxinadu.bandcamp.com/
Re: OSC Receiver
Sorry, I only skimmed the page and saw all the stuff about TCP. It looks like you're doing the right thing with your app.
I'm actually just working on the OSC Sender, which I'll probably finish tomorrow. That will at least make it easy to check that stuff is working locally.
Btw. how are you checking that you're getting something on Scope? I generally just plug in one of Simon's Pipe modular modules and look at the values there. You have to be a bit careful with the readouts though, as the SDK often doesn't update them without explicitly refreshing.
I'm actually just working on the OSC Sender, which I'll probably finish tomorrow. That will at least make it easy to check that stuff is working locally.
Btw. how are you checking that you're getting something on Scope? I generally just plug in one of Simon's Pipe modular modules and look at the values there. You have to be a bit careful with the readouts though, as the SDK often doesn't update them without explicitly refreshing.
Re: OSC Receiver
Unfortunately have to go to bed now, as teething baby will be keeping us up all night, but hope to make more progress tomorrow!
Re: OSC Receiver
yeah but once a value is sent, it is held in the array until a new one comes in yeah? its not momentary and reverts... so i should have seen my magic little 12 there by now ehhehe tried refreshing, clicking and declicking the module, going into the array with f2 and other wishful things... hmmm not sure what else to try, kinda stoked and shocked i even got the android part to work (lots of copy paste from online codes heeh).
Scope, Android, Web, PC Plugins and Sounds:
http://www.oceanswift.net
Music
https://faxinadu.bandcamp.com/
http://www.oceanswift.net
Music
https://faxinadu.bandcamp.com/
Re: OSC Receiver
ok i just verified your module works using some random android app called QuickOsc! so still something im doing isn't right
Scope, Android, Web, PC Plugins and Sounds:
http://www.oceanswift.net
Music
https://faxinadu.bandcamp.com/
http://www.oceanswift.net
Music
https://faxinadu.bandcamp.com/
Re: OSC Receiver
it seems the QuickOsc is working via OSC protocol while mine is over UDP... those are the differences i spotted
Scope, Android, Web, PC Plugins and Sounds:
http://www.oceanswift.net
Music
https://faxinadu.bandcamp.com/
http://www.oceanswift.net
Music
https://faxinadu.bandcamp.com/
Re: OSC Receiver
EDIT: fixed issue, i didn't notice the module inherits voices and it was getting 0 voices, sorry my bad, but yeah something to make sure when testing!
ok i have done some more testing and it seems the sdk module is not so reliable.
with the app that i confirmed works, and also seeing it transmit every button press over wireshark without problems, the sdk module seems to work only some of the time.
i have also forwarded the port via my router to the target pc as well as activated dmz host for good measure.
on same procedure ie open sdk, open the module and trasnmit to it sometimes it will connect and sometimes not.
ok i have done some more testing and it seems the sdk module is not so reliable.
with the app that i confirmed works, and also seeing it transmit every button press over wireshark without problems, the sdk module seems to work only some of the time.
i have also forwarded the port via my router to the target pc as well as activated dmz host for good measure.
on same procedure ie open sdk, open the module and trasnmit to it sometimes it will connect and sometimes not.
Scope, Android, Web, PC Plugins and Sounds:
http://www.oceanswift.net
Music
https://faxinadu.bandcamp.com/
http://www.oceanswift.net
Music
https://faxinadu.bandcamp.com/
Re: OSC Receiver
eheh ok new issue - i can not get it to update anything real time.
osc module is connected to an array viewer that has selcount input and value output. a 0-1 normal scope button is connected to the value output.
quickosc is sending a 0 and a 1. the osc module is getting the info and it is passed to the splitter - but the information is not updating real time, only if and when i physically change the selcount to another sel and back, will it show the change.
i am not sure if its an issue from the osc module or the way to view arrays, but i anticipated this stuff i have been banging my head against the wall with some scope array issues lately, that is why i asked for 16 outputs instead of an array.
osc module is connected to an array viewer that has selcount input and value output. a 0-1 normal scope button is connected to the value output.
quickosc is sending a 0 and a 1. the osc module is getting the info and it is passed to the splitter - but the information is not updating real time, only if and when i physically change the selcount to another sel and back, will it show the change.
i am not sure if its an issue from the osc module or the way to view arrays, but i anticipated this stuff i have been banging my head against the wall with some scope array issues lately, that is why i asked for 16 outputs instead of an array.
Scope, Android, Web, PC Plugins and Sounds:
http://www.oceanswift.net
Music
https://faxinadu.bandcamp.com/
http://www.oceanswift.net
Music
https://faxinadu.bandcamp.com/
Re: OSC Receiver
Scope arrays are a mess. Having 16 outputs instead of an array is (IMHO) the preferred way. And arrays are not updated automatically. You need to reload/reconnect the module to get an update.
Last edited by DragonSF on Tue Dec 19, 2017 11:23 pm, edited 1 time in total.
Re: OSC Receiver
You shouldn't do this:w_ellis wrote: ↑Tue Dec 19, 2017 4:49 amGreat, I'll get in touch over PM once I have something that should parse a String Array at input for OSC addresses. Feel free to have a poke around at the code, in case you spot anything I could improve (I'm sure there's plenty!) Most of the relevant stuff is here: https://github.com/bcmodular/scopeosc/t ... ver/Source
asyncOut[OUTPAD_PARAMS].itg = (int)malloc(4 * numParameters);
You have a memory leak here. I'd allocate the memory only once and re-use it. In your case, every per second you are allocating 640bytes=>1h about 2.5 MB of data, which you are not releasing. Scope does not free the data.
And I'm confused:
class ScopeOSCServer : private OSCReceiver
Are you trying to create a server or receiver?
Last edited by DragonSF on Tue Dec 19, 2017 11:32 pm, edited 1 time in total.
Re: OSC Receiver
for sure!
and anyways......... why just 16? any chance for 64?
Scope, Android, Web, PC Plugins and Sounds:
http://www.oceanswift.net
Music
https://faxinadu.bandcamp.com/
http://www.oceanswift.net
Music
https://faxinadu.bandcamp.com/
Re: OSC Receiver
What ever you can handle! (Normally you have to write an interface code for each pin, but my dll generator takes care of this stuff).