Page 2 of 3 FirstFirst 123 LastLast
Results 21 to 40 of 43
  1. #21
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,421
    Rep Power
    25

    Default

    -Xprof is an option for the java command. Read the API doc for description.

    java -Xprof -jar <jarname>

  2. #22
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default

    Here is an other jar of the application which should work
    and has no loops in its gui part
    WILLEM DRAGSTRA WEB SITE

  3. #23
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,421
    Rep Power
    25

    Default

    Why do you post the URL given above when your jar file is at the following address:
    http://personales.ya.com/wdragstra/cites.jar

  4. #24
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default

    I do not know how it works but my url directs you to the above. I always use the url (it more personal) and forgot about the above! But way you ask?

  5. #25
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default

    java -Xprof -jar <jarname> I have no idea how to use this code.
    I work with netbeans and do not pretend to understand it very much
    I know how to build a package and open or add files, compile and debug them use the applet viewer...... but that is pretty much it

  6. #26
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,421
    Rep Power
    25

    Default

    java -Xprof -jar <jarname>
    that is call a commandline in DOS and windows. I have no idea how to do it on a mac. On windows, you open a comand prompt, and enter the commandline as above to execute the java program.
    There must be ways in netbeans to add options to the commands it issues to compile and execute java programs.

  7. #27
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default

    The above application works about twenty time slower on a PC compaired to my macbook! I am using the same cites.jar file on both platforms, how can that be?
    When download the jar from the above link, start the application, set both midi drivers and start the START SEQUENCE button how long does it take for the text WAITING FOR CUE 1 to appear on the small info screen (on my mac only 2 to 3 seconds, one my son´s PC more than a minute!!!)
    Maybe I should get JAVA/NETBEANS on PC and compile the app on PC
    Java should be platform independent, but why these big differences (all of the application works fine on mac)?

  8. #28
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default

    by the way you might think it is a processor speed problem...
    it isn´t because on my 400 mhz old G4 mac it takes just a little longer
    (about 6 seconds)

  9. #29
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,421
    Rep Power
    25

    Default

    It takes a long time to display that message on my machine. Here's some of the output from the -Xprof option:
    entering in wait thread
    entering in play thread 1
    opening in Real Time Sequencer index 0
    opening out Java Sound Synthesizer index 3
    start sequence
    MIDI RESET OF FBO1
    DATADUMP 1 DONE
    DATADUMP 2 DONE
    waiting for cue 1

    Flat profile of 264.08 secs (15145 total ticks): AWT-Windows

    Interpreted + native Method
    90.4% 0 + 13691 sun.awt.windows.WToolkit.eventLoop <<<<<<<<<<< WAITING MOSTLY#####
    I think that the program spend 90.4% of its time waiting up to the time the "waiting for cue 1" message. Add some more println() statements to show where and when your code enters wait and after it awakens.

    For better debug messages, add time to the messages you display by adding: + System.currentTimeMillis() at the end of the println() statements.

  10. #30
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default

    I do not understand norm (thanks for your feedback), on my mac book happens the following:

    init:
    deps-jar:
    compile:
    run:
    2008-09-25 21:40:28.915 java[1230] CFLog (0): CFMessagePort: bootstrap_register(): failed 1103 (0x44f), port = 0x10903, name = 'java.ServiceProvider'
    See /usr/include/servers/bootstrap_defs.h for the error codes.
    2008-09-25 21:40:28.916 java[1230] CFLog (99): CFMessagePortCreateLocal(): failed to name Mach port (java.ServiceProvider)
    recievers numb 0 name Real Time Sequencer
    transmiters numb 0 name Real Time Sequencer
    transmiters numb 1 name Java Sound Synthesizer
    midiforFbo1 constructor loaded
    fmEdit loaded
    fboController constructor loaded
    entering in wait thread
    constructor main loaded
    entering in play thread 1 <---- until here appears right away

    Than, when setting the drivers also right away:
    opening in Real Time Sequencer index 0
    opening out Java Sound Synthesizer index 1

    next, after pushing the START SEQUENCE button, after two three seconds:
    start sequence
    MIDI RESET OF FBO1
    DATADUMP 1 DONE
    DATADUMP 2 DONE
    waiting for cue 1

  11. #31
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default

    That was a good one, norm:
    System.currentTimeMillis() - starttime
    I changed the jar of the link
    so you could run the same on your pc?
    and we can compare time.
    I do not understand those incredible differences!

    init:
    deps-jar:
    compile:
    run:
    2008-09-25 22:30:18.421 java[1236] CFLog (0): CFMessagePort: bootstrap_register(): failed 1103 (0x44f), port = 0x10903, name = 'java.ServiceProvider'
    See /usr/include/servers/bootstrap_defs.h for the error codes.
    2008-09-25 22:30:18.422 java[1236] CFLog (99): CFMessagePortCreateLocal(): failed to name Mach port (java.ServiceProvider)
    recievers numb 0 name Real Time Sequencer
    transmiters numb 0 name Real Time Sequencer
    transmiters numb 1 name Java Sound Synthesizer
    midiforFbo1 constructor loaded
    fmEdit loaded
    fboController constructor loaded
    entering in wait thread 1882
    constructor main loaded 1904
    entering in play thread 1 1904
    opening in Real Time Sequencer index 0
    opening out Java Sound Synthesizer index 1
    start sequence
    MIDI RESET OF FBO1
    DATADUMP 1 DONE
    DATADUMP 2 DONE
    WAITING FOR PEDAL 1 (time reset on start seq) 2168

  12. #32
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default

    if the problem lays in the method datadump, here is the code:

    Java Code:
    public void midi_datadump(int dmpt, int k1, int k2)   {
                         //fn= de te laden file met de waarde: citedata.1...273
                         //dt= datageheugen van de parameterwaarden
                         //k1/ k2= van kanaal1 tot kanaal2 overdracht
      int wrd=0, i=0, j=0, h=0, op=0, gt=0;
          int[] df_array;
          df_array = new int[40];
          String kr="";            //lees data van de dump-array voor synth waarden
       
        
         dmpt=(dmpt-1)*39;
         for (i = 1; i < 40; i++)  {
             df_array[i]=dump[i+dmpt-1]; //i: 1=lfo etc/2=op3/3=op4
            // System.out.println("dat dump  "+ i + " > " + df_array[i]);
         }           
         for (j = 1; j < 14; j++)  {   //data algemeen 
           if (j==1) 
             kr="alg";
           else
           if (j==2)
             kr="fdb";
           else
           if (j==3)
             kr="mod";
           else
           if (j==4)
             kr="snc";
           else
           if (j==5)
             kr="wav";
           else
           if (j==6)
             kr="spd";
           else
           if (j==7)
             kr="amd";
           else
           if (j==8)
             kr="pmd";
           else
           if (j==9)
             kr="ams";
           else
           if (j==10)
             kr="pms";
           else
           if (j==11)
             kr="trs";
           else
           if (j==12)
             kr="prt";
           else
           if (j==13)
             kr="prt";
           
           wrd=df_array[j];
           
           syn1(kr,k1,wrd);
           for (i = k1; i < k2+1; i++)  {  
             midi_aansturing1(1,i,p1,hb,lb);          
             dt[i][p1][p2]=wrd;
           }
         }
         
    //op3 aan
         wrd=1;
         syn1("o3",k1,wrd);
         for (i = k1; i < k2+1; i++)  {
           midi_aansturing1(1,i,p1,hb,lb);          
           dt[i][p1][p2]=wrd;
         }
         
    //op4 aan
         wrd=1;
         syn1("o4",k1,wrd);
         for (i = k1; i < k2+1; i++)  {
           midi_aansturing1(1,i,p1,hb,lb);          
           dt[i][p1][p2]=wrd;
         }
         
    //data operator 3 
         op=24;
         for (j = 1; j < 14; j++)  {   //data algemeen 
           if (j==1) 
             kr="ar";
           else
           if (j==2)
             kr="d1r";
           else
           if (j==3)
             kr="d2r";
           else
           if (j==4)
             kr="rr";
           else
           if (j==5)
             kr="d1l";
           else
           if (j==6)
             kr="lev";
           else
           if (j==7)
             kr="adj";
           else
           if (j==8)
             kr="vll";
           else
           if (j==9)
             kr="vlr";
           else
           if (j==10)
             kr="dt1";
           else
           if (j==11)
             kr="dt2";
           else
           if (j==12)
             kr="mul";
           else
           if (j==13)
             kr="am";
      
           wrd=df_array[j+13];
           syn2(kr,k1,wrd,op);
           for (i = k1; i < k2+1; i++)  {
             midi_aansturing1(1,i,p1,hb,lb);          
             dt[i][p1][p2]=wrd;
           }
        }
         
    //data operator4
         op=16;
         for (j = 1; j < 14; j++)  {   //data algemeen 
           if (j==1) 
             kr="ar";
           else
           if (j==2)
             kr="d1r";
           else
           if (j==3)
             kr="d2r";
           else
           if (j==4)
             kr="rr";
           else
           if (j==5)
             kr="d1l";
           else
           if (j==6)
             kr="lev";
           else
           if (j==7)
             kr="adj";
           else
           if (j==8)
             kr="vll";
           else
           if (j==9)
             kr="vlr";
           else
           if (j==10)
             kr="dt1";
           else
           if (j==11)
             kr="dt2";
           else
           if (j==12)
             kr="mul";
           else
           if (j==13)
             kr="am";
           
           wrd=df_array[j+26];
           syn2(kr,k1,wrd,op);
           for (i = k1; i < k2+1; i++)  {
             midi_aansturing1(1,i,p1,hb,lb);          
             dt[i][p1][p2]=wrd;
           }
        }
     }

  13. #33
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default

    this method calls a next one the sends the midi data:

    Java Code:
    public void midi_aansturing1(int sys_k, int kan, int par, int 
                                    dat_h, int dat_l)  {   //aansturing over systeemkanaal 1
          startclk();
          do {} while (clktick<maxwait); // delay loop of 4 mil sec 
          stopclk();
          if (mmjflag)
          md.midi_out(new byte[]{(byte)240, (byte)67, (byte)117, (byte)(sys_k-1), 
          (byte)(24+kan-1), (byte)(64+par), (byte)(dat_l), (byte)(dat_h), (byte)247});
          else
          md.midi_out(new byte[]{(byte)67, (byte)117, (byte)(sys_k-1), 
          (byte)(24+kan-1), (byte)(64+par), (byte)(dat_l), (byte)(dat_h), (byte)247});
          
      }

  14. #34
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default

    and finaly

    Java Code:
     public void midi_out(byte[] data)  {  // principle method to send midi
                sendJavaMidiExcl(240, data); // the sun pc part has a problem of null pointer
            }
    
    
    
     void sendJavaMidiExcl(int status, byte[] data)  {        // this method is only for midi exclusive 
                if (receiver == null) return;
    		
    		try{
    			MidiMessage msg = null;
                            msg = new javax.sound.midi.SysexMessage();
    		try{ ((SysexMessage)msg).setMessage(0xF0, data, data.length); }
                              catch (InvalidMidiDataException imde){return;}
                receiver.send(msg, 0);            
                    }catch (Exception e){}
                 
            }

  15. #35
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default

    I now notice that there is an delay loop of 4 mili sec (midi_aansturing1)
    (I was afraid that the port could deal with the data speed)

  16. #36
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default

    the new jar will not have the delay loop

    http://personales.ya.com/wdragstra/cites.jar

  17. #37
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default

    interesting, I took the delay loops out and noticed that
    the midi device can not deal with the data speed!
    so I put them back on!

  18. #38
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default

    Here is finally the info when compiling the same source code, made on a MAC, on PC!
    It takes more than a minute to do do data dump on PC (62350 m.sec)
    compared to 2 seconds on MAC (2213 m.sec)
    mac is 30X faster and my application therefor does not work on PC
    HOW CAN THAT BE? DOES ANY ONE UNDERSTAND THIS PROBLEM?
    PLEASE HELP ME OUT!
    (THE PROBLEM IS NOT RELATED TO CPU SPEED)



    curs 07-08 init:
    deps-jar:
    compile:
    run:
    recievers numb 0 name Creative Sound Blaster MPU-401
    recievers numb 1 name Real Time Sequencer
    transmiters numb 0 name Mapeador Microsoft MIDI
    transmiters numb 1 name Sint. SW de tabla de ondas GS
    transmiters numb 2 name Creative Sound Blaster MPU-401
    transmiters numb 3 name Real Time Sequencer
    transmiters numb 4 name Java Sound Synthesizer
    midiforFbo1 constructor loaded
    fmEdit loaded
    fboController constructor loaded
    constructor main loaded 12278
    entering in wait thread 12278
    entering in play thread 1 12338
    opening in Real Time Sequencer index 1
    opening out Java Sound Synthesizer index 4
    start sequence
    MIDI RESET OF FBO1
    reset fbo 20380
    entering in soundblock 1 20380
    DATADUMP 1 DONE 45125
    DATADUMP 2 DONE 60037
    WAITING FOR PEDAL 1 (time reset on start seq) 62350 MAC ONLY TAKES 2213 mil sec which is 30 times Less!!!
    DedicaciÛ lectiva, 8’50

  19. #39
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default

    So this is the only thing I can think of:
    -The mmj mac midi driver needs a small delay when sending a large midi data dump to the old FB-01 (4 milsec only, when it is not there the FB-01 goes on tilt through mmj).
    -The sun driver might have that delay internal? When I take it out on PC, the time schedule goes even faster on PC as on MAC. But I can not now I the FB-01 can cope with the data transfere (have no midi interface on PC).

    public void midi_aansturing1(int sys_k, int kan, int par, int
    dat_h, int dat_l) { //aansturing over systeemkanaal 1
    if(mmjflag) { // the delay is not on the sun midi driver
    startclk();
    do {} while (clktick<maxwait); // delay loop of 4 mil sec
    stopclk();
    }
    if (mmjflag)
    md.midi_out(new byte[]{(byte)240, (byte)67, (byte)117, (byte)(sys_k-1),
    (byte)(24+kan-1), (byte)(64+par), (byte)(dat_l), (byte)(dat_h), (byte)247});
    else
    md.midi_out(new byte[]{(byte)67, (byte)117, (byte)(sys_k-1),
    (byte)(24+kan-1), (byte)(64+par), (byte)(dat_l), (byte)(dat_h), (byte)247});

    }

  20. #40
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default

    by the way if you like to try it out at
    http://personales.ya.com/wdragstra/cites.jar
    you´ll find the without delay version
    (to here all sound, you need an FB-01 yamaha module
    or something similar)
    (or you might already have lost interest in this lonely PC/MAC/MIDI
    battle?)

Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. opening of an exe in JFrame
    By smartsubroto in forum New To Java
    Replies: 3
    Last Post: 07-16-2008, 05:01 AM
  2. Prblem in Prepared Statement
    By haneeshrawther in forum JDBC
    Replies: 2
    Last Post: 04-25-2008, 09:49 AM
  3. Using Prepared Statement
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 02-06-2008, 09:22 AM
  4. Opening a workspace twice
    By javaplus in forum Eclipse
    Replies: 0
    Last Post: 01-08-2008, 09:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •