Package com.neophob.sematrix.core.generator

Examples of com.neophob.sematrix.core.generator.Generator


      switch (cmd) {
      case CHANGE_GENERATOR_A:
        try {
          int nr = col.getCurrentVisual();
          tmp=Integer.parseInt(msg[1]);
          Generator g = col.getPixelControllerGenerator().getGenerator(tmp);
          //silly check of generator exists
          g.getId();
          col.getVisual(nr).setGenerator1(g);
        } catch (Exception e) {
          LOG.log(Level.WARNING, IGNORE_COMMAND, e);
        }
        break;

      case CHANGE_GENERATOR_B:
        try {
          //the new method - used by the gui
          int nr = col.getCurrentVisual();
          tmp=Integer.parseInt(msg[1]);
          Generator g = col.getPixelControllerGenerator().getGenerator(tmp);
          g.getId();
          col.getVisual(nr).setGenerator2(g);
        } catch (Exception e) {
          LOG.log(Level.WARNING,  IGNORE_COMMAND, e);
        }
        break;
View Full Code Here


    //create visuals
    int additionalVisuals = 1+ph.getNrOfAdditionalVisuals();
    LOG.log(Level.INFO, "Initialize "+(nrOfScreens+additionalVisuals)+" Visuals");
    try {
      Generator genPassThru = pixelControllerGenerator.getGenerator(GeneratorName.PASSTHRU);
      Effect effPassThru = pixelControllerEffect.getEffect(EffectName.PASSTHRU);
      Mixer mixPassThru = pixelControllerMixer.getMixer(MixerName.PASSTHRU);
      for (int i=1; i<nrOfScreens+additionalVisuals+1; i++) {
        Generator g = pixelControllerGenerator.getGenerator(
            GeneratorName.values()[ i%(GeneratorName.values().length) ]
            );
        if (g==null) {
          //its possible we select an inactive generator, in this case just ignore it...
          additionalVisuals++;
View Full Code Here

   * Sets the generator1.
   *
   * @param index the new generator1
   */
  public void setGenerator1(int index) {
    Generator g = Collector.getInstance().getPixelControllerGenerator().getGenerator(index);
    if (g!=null) {
      this.generator1 = g;     
    }
  }
View Full Code Here

   * Sets the generator2.
   *
   * @param index the new generator2
   */
  public void setGenerator2(int index) {
    Generator g = Collector.getInstance().getPixelControllerGenerator().getGenerator(index);
    if (g!=null) {
      this.generator2 = g;
    }
  }
View Full Code Here

   */
  public GeneratorGuiCreator(PApplet parentPapplet, int maximalXSize, int maximalYSize, String version) {
        int nrOfScreens = Collector.getInstance().getAllVisuals().size();
        LOG.log(Level.INFO, "create GUI, nr of screens: "+nrOfScreens);
                    
        Generator g = Collector.getInstance().getPixelControllerGenerator().getGenerator(0);
    WindowSizeCalculator wsc = new WindowSizeCalculator(g.getInternalBufferXSize(),
        g.getInternalBufferYSize(), maximalXSize, maximalYSize, nrOfScreens);
       
        //connect the new PApplet to our frame
        gui = new GeneratorGui(wsc);
        gui.init();
        
View Full Code Here

          if (v!=null) {             
            int currentGenerator = v.getGenerator1Idx();
            int nrOfGenerators = 1+col.getPixelControllerGenerator().getSize();

            int count=nrOfGenerators;
            Generator g=null;
            while (count>=0 && g==null) {
              currentGenerator++;
              g = col.getPixelControllerGenerator().getGenerator(currentGenerator%nrOfGenerators);
            }

            if (g!=null && g.getName() != null) {
              v.setGenerator1(currentGenerator%nrOfGenerators);
              validKey = true;
            } else {
              LOG.log(Level.INFO, "Could not find new Generator!");
            }
          }
          break;

        //change current generator 2
        case 'G':
          if (v!=null) {       
            int currentGenerator = v.getGenerator2Idx();
            int nrOfGenerators = 1+col.getPixelControllerGenerator().getSize();

            int count=nrOfGenerators;
            Generator g=null;
            while (count>=0 && g==null) {
              currentGenerator++;
              g = col.getPixelControllerGenerator().getGenerator(currentGenerator%nrOfGenerators);
            }

            if (g!=null && g.getName() != null) {
              v.setGenerator2(currentGenerator%nrOfGenerators);
              validKey = true;
            } else {
              LOG.log(Level.INFO, "Could not find new Generator!");
            }
View Full Code Here

    private void testWithResolution(int x, int y) {
      MatrixData matrix = new MatrixData(x,y);
      PixelControllerEffect pce = new PixelControllerEffect(matrix, sound);
      pce.initAll();

      Generator g = new PassThruGen(matrix);
      Effect e = new PassThru(matrix);
      Mixer m = new Checkbox(matrix);
      ColorSet c = new ColorSet("test", new int[]{1,2,3});
      Visual v = new Visual(g,e,m,c);     
View Full Code Here

    if (visual.getEffect2() == null) {
      return visual.getEffect1Buffer();
    }

    Generator gen1 = visual.getGenerator1();

    //lazy init
    if (flpX == -1) {
      this.flpX = gen1.getInternalBufferXSize()/checkBoxSizeX;         
      //this.flpY = gen1.getInternalBufferYSize()/checkBoxSizeY;
      this.flpY = gen1.getInternalBufferXSize()*gen1.getInternalBufferYSize()/checkBoxSizeY;
      LOG.log(Level.FINE, "Checkbox Mixer lazy init, flpx: {0}, flpY: {1}", new Integer[] {flpX, flpY});
    }

    int[] src1 = visual.getEffect1Buffer();
    int[] src2 = visual.getEffect2Buffer();
    int[] dst = new int [src1.length];   

    boolean flip=true;
   
    boolean flipY=true;

  /* complicated but working implementation
   *
   * for (int y=0; y<checkBoxSizeY; y++) {     
      flip=!flip;
      for (int m=0; m<flpY; m++) {           
        drawHorizontalLine(flip, src1, src2, dst); 
      }

    }*/

    for (int i=0; i<src1.length; i++) {
      if (i%flpX==0) {       
        flip=!flip;
      }
      if (i%flpY==0) {
        flipY=!flipY;
      }
     
      //reset flip state on the beginning of a line
      if (i%gen1.getInternalBufferXSize()==0) {
        flip=flipY;
      }

      try {
        if (flip) {
View Full Code Here

    private void testWithResolution(int x, int y) {
      MatrixData matrix = new MatrixData(x,y);
      PixelControllerResize pcr = new PixelControllerResize();
      pcr.initAll();

      Generator g = new PassThruGen(matrix);
      Effect e = new PassThru(matrix);
      Mixer m = new Checkbox(matrix);
      ColorSet c = new ColorSet("test", new int[]{1,2,3});
      Visual v = new Visual(g,e,m,c);     
View Full Code Here

      for (int y=1; y<38; y++) {
          for (int x=1; x<38; x++) {
              MatrixData matrix = new MatrixData(x,y);

              Generator g = new Fire(matrix);
              Effect e = new PassThru(matrix);
                Visual visual = new Visual(g, e, m, c);       
                   
              IFader fader = new Switch(matrix, 100);
              OutputMapping map = new OutputMapping(fader, 0);
View Full Code Here

TOP

Related Classes of com.neophob.sematrix.core.generator.Generator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.