Package com.meapsoft.composers

Examples of com.meapsoft.composers.Composer


 
    //get the settings panel
    ComposerSettingsPanel settingsPanel = lbl.getSettingsPanel();
   
    //create a composer to work with here
    Composer composer;
   
    //initialize the composer here
    //we should always have a settings panel for each composer
    try
    {
      //initialze the composer here
      int error = settingsPanel.initComposer();
     
      //if we have an error, return
      if(error == -1)
      {
        return -1;
      }
     
      composer = settingsPanel.getComposer();
    }
    catch(Exception e)
    {
      GUIUtils.ShowDialog(e, lbl.getName() + " does not have a settings panel", GUIUtils.MESSAGE, mMainScreen)
      return -1;
    }

    //get the slider value
        double crossfade = (double)mFadeSlider.getValue()/1000;
       
        //see what options are selected
        if(mFadeChk.isSelected() & crossfade > 0)
        {
            composer.addCommand("fade("+crossfade+")");
        }
        if(mCrossFadeChk.isSelected() & crossfade > 0)
        {
            composer.addCommand("crossfade("+crossfade+")");
        }
        if(mReverseChk.isSelected())
        {
            composer.addCommand("reverse");
        }
        if(mGainChk.isSelected())
        {
          double gain = Double.parseDouble(mGainValueTxt.getText());
          composer.addCommand("gain(" + gain + ")");
        }

        //should we write the meap file?
        composer.writeMEAPFile = MEAPUtil.writeMEAPFile;
       
      //update the progress bar
      mMainScreen.updateProgressBar("Composing...", composer.getProgress());
       
      //try to actually do the composing here
        try
        {
            composer.doComposer();
        }
        catch(Exception e)
        {
      GUIUtils.ShowDialog(e, "Error running composer", GUIUtils.MESSAGE, mMainScreen);
            return -1;
View Full Code Here


  public synchronized int run()
  {     
        if(!enableBox.isSelected())
            return 0;

        Composer composer = null;
    if (selectedComposer.equals("SortComposer"))
    {
      composer = new SortComposer(featFile, edlFile);
            ((SortComposer)composer).setReverseSort(highLowSortButton.isSelected());
            ((SortComposer)composer).setNormalizeFeatures(normalizeFeatCB.isSelected());
    }
    else if (selectedComposer.equals("NNComposer"))
    {
      composer = new NNComposer(featFile, edlFile);
    }
    else if (selectedComposer.equals("BlipComposer"))
    {
      composer = new BlipComposer(featFile, edlFile);
            ((BlipComposer)composer).setBlipWav(dataDirectory+slash+"blip.wav");
    }
    else if (selectedComposer.equals("MashupComposer"))
    {
      if (chunkDBFeaturesNameFull == null)
      {
        GUIUtils.ShowDialog("MashupComposer: Please select a chunk database features file!", GUIUtils.MESSAGE, meapsoftGUI.jframe);
        return -1;
      }
     
      edlFile = new EDLFile(dataDirectory + slash + dataBaseName + "_using_" +
        chunkDBFeaturesNameShort + ".edl");

            FeatFile chunkDBFile = new FeatFile(chunkDBFeaturesNameFull);
           
      if (!(new File(chunkDBFeaturesNameFull).exists()))
      {
        GUIUtils.ShowDialog("MashupComposer: Please select a chunk database features file!", GUIUtils.MESSAGE, meapsoftGUI.jframe);
        return -1;
      }
       
            composer = new MashupComposer(featFile, chunkDBFile, edlFile);
    }
    else if (selectedComposer.equals("MeapaeMComposer"))
    {
      composer = new MeapaeMComposer(featFile, edlFile);
    }
    else if (selectedComposer.equals("IntraChunkShuffleComposer"))
    {
      int numSubChunks = 4;
     
      try
      {
        numSubChunks = new Integer(intraChunkShuffleNumChunksField.getText()).intValue();
      }
      catch (Exception e)
      {
        GUIUtils.ShowDialog("The number of sub chunks must be >= 2.", GUIUtils.MESSAGE, meapsoftGUI.jframe);
                return -1;
      }
      composer = new IntraChunkShuffleComposer(featFile, edlFile, numSubChunks);
    }
    else if (selectedComposer.equals("HeadBangComposer"))
    {
      composer = new HeadBangComposer(featFile, edlFile, headbangBinSlider.getValue(), headbangLengthSlider.getValue());
    }
    else if (selectedComposer.equals("ThresholdComposer"))
    {
      double top = new Double(thresholdTopField.getText()).doubleValue();
      double bottom = new Double(thresholdBottomField.getText()).doubleValue();
      composer = new ThresholdComposer(featFile, edlFile, top, bottom, insideThresholdButton.isSelected());
    }
    else if (selectedComposer.equals("RotComposer"))
    {
      int bpm = new Integer(rotBeatsPerMeasureField.getText()).intValue();
      int positions = new Integer(rotNumPositionsField.getText()).intValue();
      composer = new RotComposer(featFile, edlFile, bpm, positions, rotLeftButton.isSelected());
    }
    else if (selectedComposer.equals("EDLComposer"))
    {
      EDLFile input = new EDLFile(inputEDLFileNameFull);
      composer = new EDLComposer(input, edlFile);
    }
    else if (selectedComposer.equals("VQComposer"))
    {
      composer = new VQComposer(featFile, edlFile);

            VQComposer vqc = (VQComposer)composer;
            vqc.setCodebookSize(vqNumCodewords.getValue());
            vqc.setBeatsPerCodeword(vqBeatsPerCW.getValue());

            if(vqFeaturesNameFull != null)
            {
                if (!(new File(vqFeaturesNameFull).exists()))
                {
                    GUIUtils.ShowDialog("VQComposer: Please select a valid feature file!",
                                        GUIUtils.MESSAGE, meapsoftGUI.jframe);
                    return -1;
                }
                else
                    vqc.setFeatsToQuantize(new FeatFile(vqFeaturesNameFull));
            }

            if(vqQuantizeTrainingFile.isSelected())
                vqc.setFeatsToQuantize(featFile);
    }
    else if (selectedComposer.equals("HMMComposer"))
    {
      composer = new HMMComposer(featFile, edlFile);

            ((HMMComposer)composer).setCodebookSize(
                hmmNumStates.getValue());

            ((HMMComposer)composer).setBeatsPerCodeword(
                hmmBeatsPerState.getValue());

            ((HMMComposer)composer).setSequenceLength(
                hmmSequenceLength.getValue());
    }
    else if (selectedComposer.equals("ShoobyComposer"))
    {
      int outFileLength = new Integer(shoobyFileLengthField.getText()).intValue();
      int maxClumpWidth = new Integer(shoobyClumpWidthField.getText()).intValue();
      composer = new ShoobyComposer(featFile, edlFile, outFileLength, maxClumpWidth, shoobyDrunkennessSlider.getValue());
    }
    else
    {
      GUIUtils.ShowDialog("I don't recognize that composer!", GUIUtils.MESSAGE, meapsoftGUI.jframe);
      return -1;
    }
   
        double crossfade = (double)fadeDurationSlider.getValue()/1000;
        if(fadeInOutChunks.isSelected() & crossfade > 0)
            composer.addCommand("fade("+crossfade+")");
        if(crossfadeChunks.isSelected() & crossfade > 0)
            composer.addCommand("crossfade("+crossfade+")");
        if(reverseChunks.isSelected())
            composer.addCommand("reverse");
        if(addGainChunks.isSelected())
        {
          double gain = Double.parseDouble(gainValueField.getText());
         
          composer.addCommand("gain(" + gain + ")");
        }

        composer.writeMEAPFile = MEAPUtil.writeMEAPFile;
       
        JPanel progressPanel = new JPanel();
        progressPanel.add(new JLabel("Composing: "));
        JProgressBar progressBar = new JProgressBar(composer.getProgress());
        progressBar.setStringPainted(true);
        progressPanel.add(progressBar);
        meapsoftGUI.setProgressPanel(progressPanel);

        try
        {
            composer.doComposer();
        }
        catch(Exception e)
        {
      GUIUtils.ShowDialog(e, "Error running composer", GUIUtils.MESSAGE, meapsoftGUI.jframe);
            return -1;
View Full Code Here

   
    //lots of dynamic instantiation, yay!
    try
    {
      //create the composer itself (with empty constructor)
      Composer comp = (Composer)(Class.forName("com.meapsoft.composers." + className).newInstance());
     
      //save the data here
      mName = comp.name();
      mDescription = comp.description();
     
      //System.out.println("mDescription: " + mDescription);
     
      //set our text here
      this.setText(mName);
View Full Code Here

TOP

Related Classes of com.meapsoft.composers.Composer

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.