I want to simply an mp3 player built into TunerStudio

For discussion of Phil Tobin's Tuner Studio software (Only about the tuning software itself, not about how to tune or firmware features)

Moderator: LT401Vette

I want to simply an mp3 player built into TunerStudio

Postby Valeriy » Thu Nov 23, 2017 9:40 am

How can I do it please help ! I don't know about plugins but I want to do this. You can create plugins to run with in TunerStudio to update settings in the MegaSquirt, read runtime values, display just about any UI widget in TunerStudio or run calculation based on any OutputChannel or Constant value. The code you write can present this in any way you wish or interact with another component to exchange or combine data with other sources. Once tab based plugins are available, you may want to create a plugin that has little to do directly with your fuel injection controller, perhaps simply an mp3 player built into TunerStudio. Read it and understand nothing :RTFM: :shock: :( http://tunerstudio.com/index.php/manual ... io-plugins Does anyone have experience in this ? I wish the MP3 player tab of the Tuner Studio MS :roll: I want to understand it and how it looks like mp3 player built into TunerStudio?
User avatar
Valeriy
MS/Extra Newbie
 
Posts: 15
Joined: Sat Oct 21, 2017 11:54 am
Location: Kostanay

Re: I want to simply an mp3 player built into TunerStudio

Postby Valeriy » Thu Nov 23, 2017 1:55 pm

I reached this level !
плеер.jpg
плеер.jpg (139.13 KiB) Viewed 205 times
:D What should I write here my MP3 player which is on the local C: drive to open in tunerstudio ms ? :oops:
User avatar
Valeriy
MS/Extra Newbie
 
Posts: 15
Joined: Sat Oct 21, 2017 11:54 am
Location: Kostanay

Re: I want to simply an mp3 player built into TunerStudio

Postby LT401Vette » Mon Nov 27, 2017 9:23 am

Currently plugins will only come up on the menu and open as a dialog.
The API has a place holder for adding tabs, but that hasn't been implemented yet.
Phil Tobin
EFI Analytics, helping to simplify EFI
Next Generation tuning software.
Supporting all MegaSquirt versions and firmwares.
http://www.TunerStudio.com
http://www.efiAnalytics.com/MegaLogViewer/
Support the firmware running your engine:
http://www.msextra.com/doc/donations.html
User avatar
LT401Vette
Super MS/Extra'er
 
Posts: 10389
Joined: Sat Jul 16, 2005 8:07 am
Location: Moorseville, NC

Re: I want to simply an mp3 player built into TunerStudio

Postby Valeriy » Tue Nov 28, 2017 12:24 pm

MP3 player is I for example took in order to understand what parameters should I put in java what would it appeared on the menu. It would be great if there was a tab open at all when it is planned ? But I was wondering what classes I need to write and so on so I can see it even in the MP3 plyer menu ?
Thank you and sorry for my translator !
User avatar
Valeriy
MS/Extra Newbie
 
Posts: 15
Joined: Sat Oct 21, 2017 11:54 am
Location: Kostanay

Re: I want to simply an mp3 player built into TunerStudio

Postby LT401Vette » Tue Nov 28, 2017 4:07 pm

I assume you have been here:
http://www.tunerstudio.com/index.php/ma ... io-plugins

Have you seen the example Plugins and the NetBeans plugin?

Including this plugin:
Code: Select all
/*
 *  Copyright (c) 2005-2012, EFI Analytics. All Rights Reserved.
 * 
 *  For questions or additional information contact:
 *  Phil Tobin
 *  EFI Analytics
 *  p_tobin@yahoo.com
 *
 */

package exampletunerstudioplugin;

import com.efiAnalytics.plugin.ApplicationPlugin;
import com.efiAnalytics.plugin.ecu.ControllerAccess;
import com.efiAnalytics.plugin.ecu.ControllerException;
import com.efiAnalytics.plugin.ecu.MathException;
import com.efiAnalytics.plugin.ecu.OutputChannel;
import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

/**
 *
 * @author Philip Tobin
 */
public class ExampleTunerStudioPlugin extends JPanel implements ApplicationPlugin{

    JLabel rpmReadout = new JLabel();
    JTextField txtReqFuel = new JTextField();
    JPanel pReadouts = null;
    JPanel pSettings = null;
    UiDisplaySample uiDisplay = null;
    ExpressionEvalSample evalSample = null;
    ParameterSample paramSample = null;
   
    ControllerAccess controllerAccess = null;

    boolean pluginEnabled = false;

    public ExampleTunerStudioPlugin(){
        buildUi();
    }

    private void buildUi(){
        setLayout(new BorderLayout());

        pReadouts = new JPanel();
        pReadouts.setLayout(new GridLayout(0,5,10,2));
        pReadouts.setBorder(BorderFactory.createTitledBorder("OutputChannel readouts."));
        add(BorderLayout.NORTH, pReadouts);

        uiDisplay = new UiDisplaySample();
        add(BorderLayout.CENTER, uiDisplay);

        JPanel pSouth = new JPanel();
        pSouth.setLayout(new GridLayout(0,1,5,5));
        evalSample = new ExpressionEvalSample();
        pSouth.add(evalSample);
        paramSample = new ParameterSample();
        pSouth.add(paramSample);

        add(BorderLayout.SOUTH, pSouth);

    }

    public String getIdName() {
        return "tsPluginExample";
    }

    public int getPluginType() {
        return PERSISTENT_DIALOG_PANEL;
        //return TAB_PANEL; // not supported in TunerStudio 1.3x .
    }

    public String getDisplayName() {
        return "Example TunerStudio Plugin";
    }

    public String getDescription() {
        return "A example TunerStudio Plugin implementation to demonstrate "
                + "the use of the TunerStudio Plugin API's";
    }


    public void initialize(ControllerAccess ca) {
        try {
            this.controllerAccess = ca;
            // add the widgets for this controller.
            pReadouts.removeAll();
            // only looking at the main controller, not the CAN controllers.
            // if there is more than one config name, 0 index is the main controller for the project
            String ecuControllerName = ca.getEcuConfigurationNames()[0];
            String[] outputChannelNames = ca.getOutputChannelServer().getOutputChannels(ecuControllerName);
            for (int i = 0; i < outputChannelNames.length && i < 35; i++) {
                // cap it at 30 here
                OutputChannel oc = ca.getOutputChannelServer().getOutputChannel(ecuControllerName, outputChannelNames[i]);
                OutputChannelLabel label = new OutputChannelLabel(oc);
                // subscribe the label for published updates.
                ca.getOutputChannelServer().subscribe(ecuControllerName, oc.getName(), label);
                // add it to the readout panel
                pReadouts.add(label);
            }

            // initialize the UiDisplay
            uiDisplay.initialize(controllerAccess);

            // initialize the Math Evaluation Sample
            evalSample.init(controllerAccess);

            // initialize the Parameter Sample
            paramSample.initialize(controllerAccess);

        } catch (ControllerException ex) {
            Logger.getLogger(ExampleTunerStudioPlugin.class.getName()).log(Level.SEVERE, null, ex);
        }
       
    }

    public boolean displayPlugin(String serialSignature) {
        // evaluate the serialSignature, determine if this plugin
        // should be displayed for this controller.
        pluginEnabled = serialSignature!=null && !serialSignature.isEmpty();
        return pluginEnabled ; // always show menu
    }

    public String getAuthor() {
        return "Phil Tobin";
    }

    public JComponent getPluginPanel() {
        return this;
    }

    public void close() {
        // do any cleanup here as the dialog this was displayed in has been
        // closed. If this is used again a initialize will be called.
        // Make sure the widgets are cleaned up!!!!
        uiDisplay.clearWidgetPanel();
    }
    /** This main is likely not used, but TunerStudio will check the manifest
     * for the an ApplicationPlugin: assignment, if one is not found it will check
     * for a main class and expect that to be an implementation of
     * <code>ApplicationPlugin</code>.
     *
     * @param args the command line arguments
     */
    public static void main(String[] args) {

    }

    /** Here is is simply always enabled, and a more complex
     * condition that evaluates an expression using controllerAccess.evaluateExpression
     * @return
     */
    public boolean isMenuEnabled() {
        boolean useExpression = true;
        controllerAccess = ControllerAccess.getInstance();
        if(useExpression){ // use an expression to enable the menu for this plugin only if settings call for it.
            String mainController = controllerAccess.getEcuConfigurationNames()[0];
            try {
                return controllerAccess.evaluateExpression(mainController, "(userlevel > 127) && (spk_mode0 == 4)") != 0;
            } catch (MathException ex) {
                Logger.getLogger(ExampleTunerStudioPlugin.class.getName()).log(Level.SEVERE, null, ex);
                return true;
            }
        }else{ // just always have it enabled.
            boolean enabled = Math.random() > 0.5;
            System.out.println("Enabled = " + enabled);
            return enabled;
        }
    }

    /** a the URL to be used on the help menu. if null is returned the help menu
     * will be suppressed.
     * @return
     */
    public String getHelpUrl() {
        return "http://tunerstudio.com/index.php/manuals/79-creating-tunerstudio-plugins";
    }

    /** return a version number for informational purposes.
     *
     * @return
     */
    public String getVersion() {
        return "1.01";
    }

    /** return the PluginAPI specification this plug in requires.
     *
     * @return
     */
    public double getRequiredPluginSpec() {
        return 1.0;
    }

}

Phil Tobin
EFI Analytics, helping to simplify EFI
Next Generation tuning software.
Supporting all MegaSquirt versions and firmwares.
http://www.TunerStudio.com
http://www.efiAnalytics.com/MegaLogViewer/
Support the firmware running your engine:
http://www.msextra.com/doc/donations.html
User avatar
LT401Vette
Super MS/Extra'er
 
Posts: 10389
Joined: Sat Jul 16, 2005 8:07 am
Location: Moorseville, NC

Re: I want to simply an mp3 player built into TunerStudio

Postby Valeriy » Wed Nov 29, 2017 1:01 am

Thank you ! Yes, I have visited the site of the plugin and what little I understood from the translation . Now you showed a good example of what I need. Now I understand that much! Thank you! :yeah!:
User avatar
Valeriy
MS/Extra Newbie
 
Posts: 15
Joined: Sat Oct 21, 2017 11:54 am
Location: Kostanay


Return to Tuner Studio

Who is online

Users browsing this forum: Google [Bot] and 2 guests