Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Midi message from an input device. Help needed with the messages I'm receiving.

  1. #1
    Junior Member
    Join Date
    Mar 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Midi message from an input device. Help needed with the messages I'm receiving.

    I am using the CDJ-101 midi controller as an input device for a piece of software I am writing for a university project. I have it recognizing different button presses, but I cannot distinguish between clockwise and anti clockwise rotation on the jog wheel. The midi note for the wheel turning is always returned as 53 regardless of direction. The same goes for the "push" rotating button next to the jog wheel.

    Does anyone have any clue as to how to distinguish the direction the jog wheel is being rotated?

    any help is greatly appreciated. Thank you. Lee.

    The code I am using to convert the bytes..

    Java Code:

    public void send(MidiMessage msg, long timeStamp) {
     
            byte[] b = msg.getMessage ();        
            String tmp = bits ( b [0] ) ; 
            int message = convertBits ( tmp ) ;
            int note1 = convertBits ( bits ( b [ 1 ] ) ) ; 
     
    }
     
    public String bits(byte b){
               String bits = "";
               for(int bit=7;bit>=0;--bit){
                    bits = bits + ((b >>> bit) & 1);
               }
             return bits;
          }
     
    public int  convertBits(String bits){
              int res = 0 ; 
              int size = bits.length () ; 
     
              for ( int i = size-1 ; i >= 0 ; i -- ){
                   if ( bits.charAt( i ) == '1' ) {
                       res +=  1 <<(size-i-1) ;  
                   }
              }
              return res ; 
    }

    note1 is always 53 when the jog wheel is being rotated in either direction.


  2. #2
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: Midi message from an input device. Help needed with the messages I'm receiving.

    There must be some parameter which would have the direction value. Re-read the API and try to know how can you get the direction. It's not possible, not to have direction value somewhere.

  3. #3
    Junior Member
    Join Date
    Jun 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Does your device send out sysex?
    If it's not showing up in regular MIDI data my guess us that there is something happening there.

    Good luck!

Similar Threads

  1. How to copy J2ME application to a mobile device
    By vishal21 in forum Java ME (Mobile Edition)
    Replies: 2
    Last Post: January 21st, 2012, 05:52 PM
  2. MIDI files?
    By Blackbird in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: July 3rd, 2011, 12:44 PM
  3. Parsing a string to an int while receiving user input?
    By happyxcrab in forum What's Wrong With My Code?
    Replies: 4
    Last Post: May 11th, 2011, 05:38 PM
  4. make USB Connection with a finger print device
    By Sunil Raghuvanshi in forum Java Theory & Questions
    Replies: 0
    Last Post: January 15th, 2011, 03:24 AM
  5. Java ME / Netbeans : Device Name
    By Drakenmul in forum Java ME (Mobile Edition)
    Replies: 0
    Last Post: July 27th, 2009, 02:37 PM

Tags for this Thread