How The Faders Work (Code-Wise)?

View previous topic View next topic Go down

How The Faders Work (Code-Wise)?

Post  FinalCloud on Thu Mar 28, 2013 9:38 pm

I am currently working on a project trying to develop some sliders for an Android app that sends OSC messages (nothing commercial), and I am seriously getting confused as to how they are sent in a way that they work properly, I have got buttons working fine, and the sliders do send OSC messages. But when I move the slider (seekbar) on the phone, the slider in reaper just resets to 0. Just gave this a shot and realised that it works in sync with the slider in the DAW. Does anyone know the obvious thing I am missing? Is it doable with just the Android/Java libraries and JavaOSC?

My message currently looks like this "/controller/volume [] "

FinalCloud

Posts : 5
Join date : 2013-03-28

View user profile

Back to top Go down

Re: How The Faders Work (Code-Wise)?

Post  Admin on Fri Mar 29, 2013 5:02 am

Hey FinalCloud

Try checking out these opensource projects:

http://www.java2s.com/Open-Source/Android/MIDI/CatalogMIDI.htm

They all use graphic faders instead of seekbars, but it might help you out.

Also, faders/sliders typically (but not always) send a value from 0 to 1 (float), so what you can try is this:

osc_value_to_be_sent = value_of_seekbar / seekbar_max_value

That'll give you a value from 0 to 1.

Hope that helps a little Smile

Mark

Admin
Admin

Posts : 384
Join date : 2012-11-17

View user profile http://dawosc.forumotion.com

Back to top Go down

Re: How The Faders Work (Code-Wise)?

Post  FinalCloud on Fri Mar 29, 2013 10:31 am

Thanks for the reply mate, I will have a look into these. Regarding FingerplayMidi I have downloaded this from the app store to try it and the sliders within this application actually do the same thing as the slider within my application. Thanks

FinalCloud

Posts : 5
Join date : 2013-03-28

View user profile

Back to top Go down

Re: How The Faders Work (Code-Wise)?

Post  FinalCloud on Fri Mar 29, 2013 1:35 pm

Well I have now got the message looking like this within the reaper listening interface

"volume[f]0.29 []"

The [f] on mine is only because I wrote
android:contentDescription="volume[f]"

And the message currently being displayed is determined by this

public void onProgressChanged(VerticalSeekBar seekBar, int progress,
boolean fromUser) {
float val = scaleOutput(progress);
caller.sendOSCSlid(seekBar.getContentDescription().toString(), val);
}

private float scaleOutput(int progress) {
return minVal + ((maxVal - minVal) * progress / 100.0f);
}


But I cant figure out how to get the number after the square brackets (also apps that work seem to look like this using your app as an example;
Within the listening interface in Reaper "/faderCC1 [f] 0.181102"
When being bound to a control "/faderCC1"

For my app it is like this;
Within the listening interface in Reaper "volume[f]0.29[]"
When being bound to a control "volume[f]0.29"

FinalCloud

Posts : 5
Join date : 2013-03-28

View user profile

Back to top Go down

Re: How The Faders Work (Code-Wise)?

Post  Admin on Fri Mar 29, 2013 3:52 pm

I think your problem maybe linked to JavaOSC. I don't use JavaOSC, so I can't offer any advice for that.

You might want to look at "illposed", which is an OSC engine for android. It's pretty simple to use and the link I posed above shows projects using it (if I remember right).

By using illposed, you set three parameters: prefix, datatype, value

It can get more involved that this, especially when you're dealing with monomes, etc, but that's basically it.

if you have more questions, just post them in this thread. I'll be able to answer your questions more thoroughly when I'm at home and have access to my code.

Admin
Admin

Posts : 384
Join date : 2012-11-17

View user profile http://dawosc.forumotion.com

Back to top Go down

Re: How The Faders Work (Code-Wise)?

Post  FinalCloud on Fri Mar 29, 2013 4:00 pm

Ok thanks man, I thought that JavaOSC was illposed? The packages that contain the javaosc libraries are called com.illposed.osc and com.illposed.osc.utility, the only other Open Sound Control library I have found for Java is NetUtil. But i have looked at the FingerPlayMidi source code, and checked the OSC message it sends, and the slider value does come after the square braces but is not in the range of 0-1. Even though the Finger Play Midi sliders do not actually work properly for me (Using OSC and Reaper anyway, I havent tried it with Midi)

FinalCloud

Posts : 5
Join date : 2013-03-28

View user profile

Back to top Go down

Re: How The Faders Work (Code-Wise)?

Post  Admin on Fri Mar 29, 2013 4:57 pm

oops...you're right about illposed. I was in a hurry when I replied earlier.

Here's the code that I'm using to send an OSC message: (I removed a bunch of extra code so that this example is nice and simple)

Code:
// send message to OSC
Object args[] = new Object[1];  // 1 is the number of values to send

args[0] = OSC1_Integer;

OSCMessage msg = new OSCMessage("/your_controller_prefix", args);
sender.send((OSCPacket)msg);

Admin
Admin

Posts : 384
Join date : 2012-11-17

View user profile http://dawosc.forumotion.com

Back to top Go down

Re: How The Faders Work (Code-Wise)?

Post  FinalCloud on Fri Mar 29, 2013 5:59 pm

You sir are an absolute legend!

Got it working like this;

public void send(String id, float val) {

Object args[] = new Object[1];
args[0] = val;

OSCMessage msg = new OSCMessage("/control/", args);
try {
sender.send((OSCPacket)msg);
} catch (Exception e) {
e.printStackTrace();
}
}

Cannot tell you how much this was bothering me, thanks alot man! Hopefully someone just like me will be able to find this thread for themselves =P

FinalCloud

Posts : 5
Join date : 2013-03-28

View user profile

Back to top Go down

Re: How The Faders Work (Code-Wise)?

Post  Admin on Fri Mar 29, 2013 6:04 pm

Awesome! Glad you got it working Smile

let me know if there's anything else Smile

Mark

Admin
Admin

Posts : 384
Join date : 2012-11-17

View user profile http://dawosc.forumotion.com

Back to top Go down

Re: How The Faders Work (Code-Wise)?

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum