private StringProperty createModeControl() { MixMode[] modes = MixMode.values(); String[] allowed = new String[modes.length]; for (int i = 0; i < modes.length; i++) { allowed[i] = modes[i].name(); } StringProperty.Binding binding = new StringProperty.Binding() { @Override public void setBoundValue(long time, String value) { mixer.setMode(MixMode.valueOf(value)); } @Override public String getBoundValue() { return mixer.getMode().name(); } }; return StringProperty.create(binding, allowed, mixer.getMode().name()); }
public XFader() { // try { mixer = new XFaderPipe(); pl1 = new Placeholder(); pl2 = new Placeholder(); mixer.addSource(pl1); mixer.addSource(pl2); registerPort(Port.IN + "-1", new DefaultVideoInputPort(this, pl1)); registerPort(Port.IN + "-2", new DefaultVideoInputPort(this, pl2)); registerPort(Port.OUT, new DefaultVideoOutputPort(this, mixer)); StringProperty mode = createModeControl(); registerControl("mode", mode); registerPort("mode", mode.createPort()); NumberProperty mix = createMixControl(); registerControl("mix", mix); registerPort("mix", mix.createPort()); // } catch (SinkIsFullException ex) { // Logger.getLogger(XFader.class.getName()).log(Level.SEVERE, null, ex); // } catch (SourceIsFullException ex) { // Logger.getLogger(XFader.class.getName()).log(Level.SEVERE, null, ex); // } }