"Megadrum Config Tool" released

Discussions of any related software

Moderator: Related software moderators

Re: "Megadrum Config Tool" released

Postby dmitri » Fri Apr 24, 2009 12:05 am

elrules wrote:EDIT 3: dmitri, when you get the error when sending firmware, do you also get in the Application Log a message saying:
Trying to send BIG SYSEX message
The error was: blablabla ?
if so, what appears in blablabla?

This is the error in the application log:

01:03:12 ERROR: Trying to send BIG SYSEX message
The error was: MIDI error return code: 4
01:03:12 ERROR: Updating firmware
dmitri
Site Admin
 
Posts: 8709
Joined: Fri Aug 03, 2007 8:05 pm

Re: "Megadrum Config Tool" released

Postby elrules » Sat Apr 25, 2009 2:27 am

I found the header used by the MidiPort library:
http://doc.ddart.net/msdn/header/includ ... tem.h.html

#define MMSYSERR_BASE 0

#define WAVERR_BASE 32
#define MIDIERR_BASE 64
#define TIMERR_BASE 96
#define JOYERR_BASE 160
#define MCIERR_BASE 256
#define MIXERR_BASE 1024

/* general error return values */
#define MMSYSERR_NOERROR 0 /* no error */
#define MMSYSERR_ERROR (MMSYSERR_BASE + 1) /* unspecified error */
#define MMSYSERR_BADDEVICEID (MMSYSERR_BASE + 2) /* device ID out of range */
#define MMSYSERR_NOTENABLED (MMSYSERR_BASE + 3) /* driver failed enable */
#define MMSYSERR_ALLOCATED (MMSYSERR_BASE + 4) /* device already allocated */
#define MMSYSERR_INVALHANDLE (MMSYSERR_BASE + 5) /* device handle is invalid */
#define MMSYSERR_NODRIVER (MMSYSERR_BASE + 6) /* no device driver present */
#define MMSYSERR_NOMEM (MMSYSERR_BASE + 7) /* memory allocation error */
#define MMSYSERR_NOTSUPPORTED (MMSYSERR_BASE + 8) /* function isn't supported */
#define MMSYSERR_BADERRNUM (MMSYSERR_BASE + 9) /* error value out of range */
#define MMSYSERR_INVALFLAG (MMSYSERR_BASE + 10) /* invalid flag passed */
#define MMSYSERR_INVALPARAM (MMSYSERR_BASE + 11) /* invalid parameter passed */


This is what I have found in the mmsystem.h file, used by MidiPort. Not 100% sure, but the error returned corresponds to this list, so if you get error code 4, then the error is device already allocated.

But I don+t know what it means. Maybe some MIDI connection is opened.
elrules
 
Posts: 629
Joined: Thu Nov 29, 2007 4:51 pm
Location: Murcia, Spain, Europe, The World

Re: "Megadrum Config Tool" released

Postby Ken Forgettable » Sat Apr 25, 2009 9:02 am

elrules wrote:Maybe some MIDI connection is opened.

A Vector of devices of a given type can be obtained through a call to the method enumerateDevices().

writeLongMessage() - This method blocks until the system has handled the message buffer array
If the buffer represents only part of a message, then len should be the length of the byte array.
Other bytes should have their top bits clear, as per the MIDI spec. - EH!

From http://www.softsynth.com/javamidi/doc/jmidi.MidiPort.html
Ken Forgettable
 
Posts: 402
Joined: Tue Jan 06, 2009 5:04 pm

Re: "Megadrum Config Tool" released

Postby elrules » Sat Apr 25, 2009 10:13 am

This is my code:
Code: Select all
            //IF SECURITY SYSEX NEEDED, SEND IT NOW
            if(bootloader == Common.BOOTLOADER_WITH_SECURITY){
                MidiCommon.sendSysex(SysexRequest.firmwareUpdateRequest(),out);
                try{
                    Thread.sleep(1000);
                }catch(Exception e){}
            }

            //REPLACE INPUT NAMES
            byte[] newdata = replaceInputNames(data);
            if(newdata!=null)
                data = newdata; //replace firmware file
            //SEND FIRMWARE AND SHOW RESULTS
            boolean result;
            if(Common.getOS()==Common.WINDOWS)
                result = MidiCommon.sendBigSysex(data, outputDeviceName); //special sendSysex call for windows users
            else
                result = MidiCommon.sendSysex(data,out);

Code: Select all
    public static boolean sendBigSysex(byte data[], String outputDeviceName){
        try {
            Vector<String> v = MidiPort.enumerateDevices(MidiPort.MIDIPORT_OUTPUT);
            int i=0;
            for(;i<v.size();i++)
                if( v.elementAt(i)!=null && v.elementAt(i).equals(outputDeviceName))
                    break;
            if(i==v.size()) return false;

            MegadrumConfigTool.log.info("Opening MIDI port to send firmware...");
            MidiPort mp = new MidiPort(i,i);
            mp.open();
            MegadrumConfigTool.log.info("Sending firmware...");
            mp.writeLongMessage(data, data.length, Common.SYSEX_SEND_TIMEOUT);
            MegadrumConfigTool.log.info("Firmware was sent. Now closing...");
            mp.close();
           
            return true;
        } catch (Exception e) {
            MegadrumConfigTool.log.error("Trying to send BIG SYSEX message<br>The error was: "+e.getMessage());
            return false;
        }
    }

I have added now some more info strings to the log. By the way dmitri, I have uploaded a new MegadrumConfigTool.jar but it seems not to get updated. I detected it because the new info written in the log is not shown. Was it copied to the correct folder?
elrules
 
Posts: 629
Joined: Thu Nov 29, 2007 4:51 pm
Location: Murcia, Spain, Europe, The World

Re: "Megadrum Config Tool" released

Postby dmitri » Sat Apr 25, 2009 11:16 am

elrules wrote:I have added now some more info strings to the log. By the way dmitri, I have uploaded a new MegadrumConfigTool.jar but it seems not to get updated. I detected it because the new info written in the log is not shown. Was it copied to the correct folder?

The file system on the server is case sensitive. So, there are now two files there:
MegaDrumConfigTool.jar 256544 30/03/2009
MegadrumConfigTool.jar 256581 25/04/2009
dmitri
Site Admin
 
Posts: 8709
Joined: Fri Aug 03, 2007 8:05 pm

Re: "Megadrum Config Tool" released

Postby elrules » Sat Apr 25, 2009 5:26 pm

Shit dude! ok, i will upload it with an uppercase D


OK dmitri, can you please try this new version I uploaded? Now I close the opened MIDI Out connection before opening the MIdi port through the DLL library, and after sending the firmware I open the midi out again with the Java library. Let's see if the error was due to that different libraries had the MIDI resources at the same time

Code: Select all
            if(Common.getOS()==Common.WINDOWS){
                stopOutput();
                result = MidiCommon.sendBigSysex(data, outputDeviceName); //special sendSysex call for windows users
                startOutput();
            }else{
                result = MidiCommon.sendSysex(data,out);
            }


If it does not work, please tell me what you get in the log.
elrules
 
Posts: 629
Joined: Thu Nov 29, 2007 4:51 pm
Location: Murcia, Spain, Europe, The World

Re: "Megadrum Config Tool" released

Postby dmitri » Sat Apr 25, 2009 6:49 pm

Still the same error with code 4.
dmitri
Site Admin
 
Posts: 8709
Joined: Fri Aug 03, 2007 8:05 pm

Re: "Megadrum Config Tool" released

Postby elrules » Sun Apr 26, 2009 5:15 am

But that error is when opening the MidiPort, or when sending the data? What I mean is, what info messages do you get just before the error?
elrules
 
Posts: 629
Joined: Thu Nov 29, 2007 4:51 pm
Location: Murcia, Spain, Europe, The World

Re: "Megadrum Config Tool" released

Postby dmitri » Sun Apr 26, 2009 9:20 am

10:17:47 INFO: Initialization started
10:17:47 INFO: Configuration file read successfully
10:17:47 INFO: Input names file read successfully
10:17:49 INFO: MIDI IN connection opened 10:17:49
INFO: MIDI OUT connection opened
10:17:49 INFO: Megadrum settings from last session read successfully
10:17:49 INFO: Initialization finished
10:18:30 INFO: MIDI OUT connection closed
10:18:30 INFO: Opening MIDI port to send firmware...
10:18:30 ERROR: Trying to send BIG SYSEX message The error was: MIDI error return code: 4
10:18:30 INFO: MIDI OUT connection opened
10:18:30 ERROR: Updating firmware
dmitri
Site Admin
 
Posts: 8709
Joined: Fri Aug 03, 2007 8:05 pm

Re: "Megadrum Config Tool" released

Postby elrules » Sun Apr 26, 2009 2:38 pm

Just as I imagined, the error is "device already allocated"

Try again with the version I just uploaded. Use the normal bootloader (without security) and go directly to update firmware, without sending or loading any settings from MD.
That way the first time the MIDI device is opened is when you do the firmware update, and let's see if the error persist
elrules
 
Posts: 629
Joined: Thu Nov 29, 2007 4:51 pm
Location: Murcia, Spain, Europe, The World

PreviousNext

Return to Related Software

Who is online

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