Representing a sequence of moves

I'm working on a board game project and I'm having trouble understanding how to store the moves for the game called Go or Igo.
I've already tried using linked lists below. Each stone has a list of next move stones. I have a stone manager that keeps track of the list of possible first moves and these first moves have the list of next moves. A stone can have multiple next moves because you're editing or reviewing a game to show a better variation or if a move was undone during the game.
Below the removal of stones doesn't work.
package test;
import java.util.LinkedList;
public class Main
    public static void main(String[] args)
        SM sm = new SM();
        sm.addStone(new Stone(0));
        sm.addStone(new Stone(1));
        sm.addStone(new Stone(2));
        sm.addStone(new Stone(3));
        sm.addStone(new Stone(4));
        sm.removeStone( sm.getPlay(0), 1);
        sm.print();
class SM
    private Stone       m_C     = null; // the current stone
    private LinkedList  m_Plays = new LinkedList(); // stores the first move[s]
    public void addStone(Stone stone)
        if( isEmpty() )
            m_Plays.addLast(stone);
            m_C = stone;
        else
            m_C.addNext(stone);
            m_C = stone;
    public Stone getPlay(int index) // retrieve a first move
        if( i >= 0 && i < m_Plays.size() )
            return (Stone)m_Plays.get(index);
        return null;
    public void removeStone(Stone stone, int id)
        if( stone == null ) return;
        if( stone.getID() == id )
            stone = null;
            return;
        for( int i=0; i<stone.nextCount(); i++)
            removeStone(stone.getNext(i), id );
    public void print()
        Stone temp = this.getPlay(0);
        do
            System.out.println("ID: " + temp.getID());
            if( temp.isLast() == false )
                temp = temp.getNext(0);
        }while( temp.isLast() == false );
    public boolean isEmpty(){ return m_Plays.isEmpty(); }
class  Stone
    public int                  m_id        = 0;
    private LinkedList          m_Next      = new LinkedList();
    private int                 m_INext     = 0;
    private Stone               m_Previous  = null;
    public Stone( int id )
        m_id = id;
    public int getID()
        return m_id;
    public void addNext(Stone stone)
        m_Next.addLast(stone);
    public Stone getNext(int i)
        if( i >=0 && i < m_Next.size() )
            return (Stone)m_Next.get(i);
        return null;
    public void removeNext(int id)
        for( int i=0; i<m_Next.size(); i++ )
            if( ((Stone)m_Next.get(i)).getID() == id )
                m_Next.remove(i);
    public int nextCount(){ return m_Next.size(); }
    public Stone getPrevious(){ return m_Previous; }
    public void  setPrevious(Stone s){ m_Previous = s; }
    public boolean isLast(){ return m_Next.isEmpty(); }
}I feel either I'm doing something wrong or this implementation isn't possible in Java. My last thought idea to solve this problem was to merely have a single list in the stone manager that stores all the stones. Each stone has a list of ID's that refer to either the next stone or previous stone and I can use this ID to remove/add stones in the list in the stone manager.

Kurorugi wrote:
Below the removal of stones doesn't work.You'll need to provide more detail than "doesn't work."
I'd also suggest more descriptive names for classes, methods, and variables. I have no idea what the "SM" class is supposed to be for, and with the following:
class  Stone
    public int                  m_id        = 0;
    private LinkedList          m_Next      = new LinkedList();
    private int                 m_INext     = 0;
    private Stone               m_Previous  = null;
it's not clear at all what those variables represent. I'm not even sure what a Stone object represents. Is it a stone that has been placed on the board?

Similar Messages

  • Windows error when exporting sequence to movie

    I have a project (Adobe Premiere CS3 - Matrox RT.X2 LE card - Windows XP SP3) with several sequences. I have exported to movie almost all the sequences without problems. But there´s one sequence that when I try to export, when rendering (compiling process), suddenly pop´s up a Windows error saying the program encoutered a problem and will be shut down.
    I cannot figure out why is this happening. Any help?

    This ARTICLE might help you gather some "clues," as to what is happening, when PrPro shuts down.
    However, I feel that Harm has the answer with the Matrox card.
    Good luck,
    Hunt

  • How do I batch convert 700 sequences to .mov and .mv4 files?

    I have 700 separate sequences in FCP. Each one is 20-30 seconds long. I need to rename them and convert them to .mov files and then also .m4v files?
    Is there an easy way to batch this or do I have to do them one by one by one by one..........

    Try using the *Export Queue* (in FCP click Window > Export Queue).
    1. Once the window is open, in the Browser window, highlight the sequences you wish to export.
    2. Click and drag them into the *Export Queue* window. You should see a folder called +Batch 1+, with all your sequences.
    3. Click on the +Batch 1+ folder and press the Settings... button at the bottom of the window.
    4. Set your output destination.
    5. To export full res, the format should be *QuickTime Movie*, and the settings should be *Item Settings*.
    6. Include *Audio and Video*, or *Video Only*, depending on what you need.
    7. Check the *Make Self-Contained* check box.
    If your sequences are NTSC DV, to export .m4v you will want to use Compressor 2, so that you can fix the aspect ratio (NTSC is 720x480 while the iPod size is 640x480 or 320x240. This is the difference between square and rectangular pixels.).
    1. In the *Compressor Preset* window, find the +iPod Video+ folder, and the +iPod Video+ preset inside the folder.
    2. Click the preset and press the *Duplicate Selected Setting* button at the top of the window. A setting called +iPod Video-Copy+ should appear in your Custom folder.
    3. Click on your new setting.
    4. In the Inspector window, use the 6 buttons to change the settings to what you need.
    5. Make sure in the Encoder section, that you choose your size (640 VGA or 320 QVGA) and pick the proper aspect ratio (4:3).
    6. Save your settings.
    7. Drag the full res files you exported from FCP into the Batch window. *Select All* (Command + A).
    8. Right-click in the Setting column and choose your +iPod Video-Copy+. It will apply that setting to all your videos (it may take a while depending on how many you do at once.)
    9. Save your batch.
    10. Submit!
    For renaming, you might try an Automator script. Search the forums or Google, if you need help with that!
    Hope this helps!
    -Tim

  • Screen Sequence for Mov Type 301

    Dear All,
    I am doing two step transfer from one plant to another plant belonging to two diff company codes. When I use 301 movement type, the item detail data is coming at the top and the header data is showing at the bottom of the screen.
    Please suggest where can I change this screen sequence for this movement type.
    Regards
    VT

    I am sorry, Its a typing error. I am talking about 303 itself. When i try to post material document with 303, the item detail is showing at the iter overview's place and vice versa. Could you please suggest where can I change settings so as to get the correct screen sequence?
    Regards
    VT

  • Sequences From FCE saved as .mov to FCPX

    I messed up and did not use the same sequence settings when I set up in my FCE project. As a result when I try to join the four sequences the first sequence is sized differently then the other three. The first sequence is setup in Apple Intermediate Codec and the others are different. When I save each of the sequences as .mov separately they appear to be fine. The problem arises when I try to put them into one sequence in FCE.
    Rather than start all over I asked around in the the FCE discussion and the best suggestion was to download FCP X and start over because FCPX can handle the different types of footage (AVCHD, SD and HD).
    After agonzing over this because of over of a hundred hours of editing so far and still more to go I have downloaded Final Cut Pro X. The thought came to me that if I export each one of the sequences from Final Cut Express as .mov and import those .mov files so that they all can be joined together, the differences that existed in Final Cut Express (because of the different Codec types), will not exist in FCP X. Is this correct? Is it really that simple?
    Please let me know.
    Re: Sequences with different attributes 

    Without knowing the precise details of all the settings of your video it is impossible to give a definite answer.
    The simplest way to find out (if you already have the sequences) is to import them into FCP X and see what happens.
    If you haven't already converted them you should  convert just a minute of each sample (for speed) and import them.

  • Representing a binary sequence with least usage of memory

    Hi
    I'm currently making a program where i need to represent binary sequences ("01001..etc")
    So far for simplicity i've been doing this by String s = "1101" but i need
    to cut down on memory usage, so was wondering which is better to use
    something like
    class Sequence
    boolean sequence[] = "1,1,0,1";
    or possiby with bits?
    also making a class sequence could be hady for storing a few int variables which needs to be calculated often.

    Hmm well after making 2 possible classes, one using a 1000 length String, other using a 1000 bit BitSet, making 250 000 instances of each. The String ones come out better.
    public class Test
        long free;
        long tot;
        long used;  
        public void running()
         free = Runtime.getRuntime().freeMemory();
         tot  = Runtime.getRuntime().totalMemory();
         used = tot - free;
         System.out.println("free: "+ free+"\ntot : "+tot+"\nuse : "+used);
         System.out.println("filling array");
         int array_size = 250000;
         Bitss sarray[] = new Bitss[array_size];
         //Streng sarray[] = new Streng[array_size];
         for(int i=0;i<array_size;i++)
              sarray[i] = new Bitss();
              //sarray[i] = new Streng();
         System.out.println("-------");
         free = Runtime.getRuntime().freeMemory();
         tot  = Runtime.getRuntime().totalMemory();
         used = tot - free;
         System.out.println("free: "+ free+"\ntot : "+tot+"\nuse : "+used);
    }and the two different classes using BitSet and String:
    import java.util.BitSet;
    public class Bitss
        BitSet bitss;
        public Bitss()
         bitss = new BitSet(1000);
    }and
    public class Streng
        String s;
        public Streng()
         s = "12345678901234567890123456789012345678901234567890"+
             "12345678901234567890123456789012345678901234567890"+
             "12345678901234567890123456789012345678901234567890"+
             "12345678901234567890123456789012345678901234567890"+
             "12345678901234567890123456789012345678901234567890"+
             "12345678901234567890123456789012345678901234567890"+
             "12345678901234567890123456789012345678901234567890"+
             "12345678901234567890123456789012345678901234567890"+
             "12345678901234567890123456789012345678901234567890"+
             "12345678901234567890123456789012345678901234567890"+
             "12345678901234567890123456789012345678901234567890"+
             "12345678901234567890123456789012345678901234567890"+
             "12345678901234567890123456789012345678901234567890"+
             "12345678901234567890123456789012345678901234567890"+
             "12345678901234567890123456789012345678901234567890"+
             "12345678901234567890123456789012345678901234567890"+
             "12345678901234567890123456789012345678901234567890"+
             "12345678901234567890123456789012345678901234567890"+
             "12345678901234567890123456789012345678901234567890"+
             "12345678901234567890123456789012345678901234567890";
    }first running the BitSet choise will give:
    D:\UiB\Hovedfag\Java\bits>java Start
    free: 1871160
    tot : 2031616
    use : 160456
    filling array
    free: 6811184
    tot : 51982336
    use : 45171152
    then commenting out the BitSet, and using the String choise:
    D:\UiB\Hovedfag\Java\bits>java Start
    free: 1871160
    tot : 2031616
    use : 160456
    filling array
    free: 718096
    tot : 5828608
    use : 5110512
    Bitset choise uses about 45mb while using a String uses about 5mb?
    I can assume i'm just dumb ;) but could someone explain why it's not the other way around? After all i need something that can be 100-1000 bits long, with a lot of instances, and take very small space.

  • GoPro Camera Raw Lens Profile settings not working for image sequence in Photoshop/AE/Premiere CS6

    Hey Everyone,
    I'm in need of assistance in either Photoshop CS6, After Effects CS6, or Premiere Pro CS6.  I just installed the trials after seeing Russell Brown demo the GoPro Lens Profile correction feature in Camera Raw.  Basically what I'm looking to do is make adjustments (in Adobe Camera Raw) to a series of still images (shot with the time-lapse mode on the GoPro) and then either export those stills through Photoshop or Bridge to a temporary movie file that will be imported into a timeline (with other video clips), or import the JPG files (with Camera Raw settings) directly into After Effects or Premiere as an image sequence.  The latter would be preferable as it'd avoid the extra step of having to render the intermediate/temporary movie file.
    Right now, my current workflow for GoPro time-lapses is:
              - use Bridge CS4 to do basic color correction on the still images
              - save those as TIF files
              - run the TIF files through a custom script to have Hugin 2012.0.0 (open source pano stitcher) remove the fisheye distortion
              - open the new TIF image sequence into QuickTime Player 7 (Pro)
              - export the image sequence as a QuickTime movie file
              - import the movie file into Premiere Elements 10 to place on a timeline with other video clips (as Premiere Elements can't handle the sequence(s) of thousands of still images without crashing)
    If I can go directly from Bridge to a timeline, it'd save a lot of processing time (and it'd be much nicer to preview the images in Bridge without the fisheye distortion)!
    I can prepare the GoPro JPG files through Adobe Camera Raw in Bridge CS6, though when I go to import the JPEG image sequence into Premiere Pro CS6 or After Effects CS6, none of the Camera Raw settings are applied.  If I export the Camera Raw files in Bridge CS6 as DNG files (a step I'd really prefer to avoid) and then import the DNG image sequence into After Effects CS6, the Camera Raw settings are applied except for the Lens Profile settings -- I can pick other cameras but not the GoPro lens profiles when the DNG image sequence loads in After Effects.  It also appears that once I open the DNG files in After Effects CS6, I can no longer access the GoPro Lens Profile in Adobe Bridge CS6 -- the list changes to the same list I get in After Effects.  Premiere Pro CS6 doesn't let me import the DNG files at all.  I've also tried to import the JPG files (as well as the converted DNG files) into an image sequence in Photoshop CS6, though it doesn't allow me to do so (the Image Sequence checkbox is grayed out after I apply the Camera Raw settings in Bridge).
    There could be an issue going on with different Camera Raw versions.  I didn't have Premiere Pro CS6 installed during my initial testing, though now do notice that the Camera Raw dialog in Bridge CS6 only lets me choose compatibility up to "Camera Raw 7.1 and later" when I choose to export the files as DNG.  I thought Camera Raw 8.2 was an option there a couple days ago when I only had installed Photoshop CS6 and After Effects CS6 (though am not 100% certain).
    Please let me know if there is some workaround to get the GoPro lens profile Camera Raw corrections applied in an image sequence in one of the Adobe CS6 products (without having to export the files as temporary TIF or JPG files out of Camera Raw).  I'd greatly prefer to shorten my current workflow for these files.  (I just updated the CS6 trials and have tested all three programs again though I still get the same results described above.)
    Does Lightroom 5 have any option to export Camera Raw image sequences as movie files (or any other feature that might help in simplifying my current workflow)?  I can't install the trial right now as it's not compatible with OS X 10.6.8.  I'd consider upgrading OS X if I knew Lightroom 5 would do what I need, though am waiting for any potential color profile issues to be resolved in OS X 10.9.
    I can open the image sequence in Photoshop CS6 if no Camera Raw settings are applied and then use the Lens Correction Filter to apply the GoPro Lens Profile settings, though I really prefer the Camera Raw interface in Bridge for tweaking image settings.  As soon as I apply Camera Raw settings to the first image, Photoshop CS6 grays out the image sequence checkbox.
    If there isn't a way to take Camera Raw files straight from Adobe Bridge to a timeline, I may stick with my current workflow using CS4 and see what I can do to better automate some of the steps as the TIF export in Bridge, fisheye distortion removal in Hugin, and render in QuickTime Player all take quite a while.  I won't mind waiting for all the processing if I can set it and check back on it in later the next day when it's fully complete.  Is there a way to have Adobe ExtendScript execute an external shell command (i.e.: a command I could type into the bash shell in Terminal in OS X)?  If not, is there a way to call/run an ExtendScript script from the command line and pass a parameter to it that my custom script could use?
    Thanks in advance,
    Mark

    Can you zip up a few of your GoPro images, upload them to dropbox.com and post a share link, here, so others can experiment with them, or do you mean this issue is global to all camera models?

  • Nikon D7000 .MOV files in Premiere Pro and After Effects CS5.5

    I recently upgraded from Production Premium CS5 to CS5.5. Initially Nikon D7000 .MOV files used in previous CS5 Premiere Pro project would not play well in CS5.5. Now .MOV files do work in both PP and AE CS5.5. Here are the steps I followed. Not recommending you follow my steps exactly, just providing info for those that are interested.
    1.       Launch Premiere Pro CS5.5 and open previous PP CS5 project, convert project to CS5.5 and rename project file as not to replace previous CS5 project file.
    a.       At this point .MOV files do not play in new project or in AE CS5.5
    b.      Close Premiere Pro and After Effect if still running.
    2.       Using Adobe Bridge CS5.5, batch rename;
    a.       Make copies of original files to new folder location while renaming file extension from .MOV to .mpg
    b.      Let Adobe Bridge finish creating all new thumbnail previews.
    c.       Leave Bridge running in background.
    3.       Launch Premiere Pro CS5.5, let Premiere finish recreating thumbnail previews if needed.
    a.       Attempt to preview existing .MOV file in project. It worked for me.
    b.      Attempt to play sequence containing .MOV files. It worked for me.
    c.       Attempt to play or modify sequence .MOV files in AE CS5.5 via Dynamic Link within Premiere. It worked for me.
    d.      Close Premiere Pro project and AE projects if open.
    4.       Create new Premiere Pro project and sequence
    a.       Import a different Nikon D7000 .MOV file not previously used or renamed.
    b.      Attempt to play this newly imported .MOV file. This worked for me as well.
    c.       The new, previously un-renamed .MOV file also worked in AE CS5.5 for me.
    I will perform additional tests but at the moment Nikon D7000 .MOV files are working for me in CS5.5 after initially performing a batch rename in Bridge CS5.5 from .MOV to .mpg and letting Bridge create preview files. Even .MOV files not renamed now work.
    An example of Nikon D7000 footage edited with Adobe Premiere Pro CS5.5, After Effects CS5.5, and Sound Booth CS5 can be seen on my blog, http://stevelandonsmyth.typepad.com/steve-landon-smyths-blog/2011/07/my-first-hd -video-shoot-with-nikon-d7000.html
    My system: MacBook Pro 17" 2.3 GHz i7 quad core, 8GB RAM, 500MB SSD
    Message was edited by: Steve Landon-Smyth

    Hello,
    I see 2 post in this thread from Todd that say they are working on a fix and it should be out soon.  One is from July, the other from August.  It is now Sept 7th and I still see no patches or fixes for any bugs.  I spent 400 dollars on an upgrade, but is this upgrade going to be supported?
    This is making me rethink upgrading to the .5's in the future.
    It is a minor bug to most, but in that sense it should be an easy quick fix. Am I wrong? Is this really a complicated issue?
    I apologize if this comes off like a rant, but thats kinda what it is.  It is not hard to batch rename files, but its a pain to have to relink all those files in PP.

  • Setting the order of my mov.s in idvd?

    editing in the latest final cuts express/ exporting fce sequence to mov.s/ dragging mov.s (currently 3) into idvd "revolution main" box/ adding chapters at 5 min. intervals/ cleaning the silly menus (noxious music, whirling things, 38 minute loop duration)/ burning.
    if i have 3 mov.s in the idvd project, idvd chooses the order not me. that's unacceptable. how does it chooses the order and why?
    i suppose there's a way to put it all in a single timeline in final cuts express, make chapter markers in fce to delineate the 3 parts of the project, the doing something with even more submenus in idvd then add the 5 minute chapter markers in there. or is there away to do that?????????????????????
    none of this is " new apple laptop WORKS RIGHT OUT OF THE BOX"!!!

    My experience is that if I drag the movies into an iDVD menu screen one by one, the “tab” order will be the order that I create the movie buttons. By “tab” order, I mean the order in which the buttons will be selected when I use the down-arrow button to go from one button to the next. I assume that's the “sequence” you are referring to.
    Last night I figured out how to change the tab order, albeit in a simple case. I had used an old project as a template for a new one. The old project had three movie buttons on the main menu, and a fourth “?” button that opened a submenu containing some “about” text with no buttons. The tab order was
    Movie1->Movie2->Movie3->?
    I saved as a new project, deleted the existing 3 Movie buttons, and dragged in a single new MovieX. The menu looked fine, with the MovieX button centered in the menu, and the ? button in the lower right corner. But when I ran the DVD simulator, I saw that the tab order was
    ?->MovieX, so that when the DVD menu first appeared, the ? button was selected by default -- not what I wanted.
    I figure I could have just deleted the ? item and recreated it from scratch. I suspect that would have corrected the tab order problem, since the new version would be the last button created. But I was too lazy to retype the About text.
    I went into the Map window (horizontal layout), and I noticed that the order in which the movie and About submenu appeared, to the right of the main menu item, reflected the tab order - the About submenu was above the movie. Looking at the original project showed that its 3 movie items were above its About submenu.
    I tried just dragging the movie to another position -- that didn't work. Here's what did work -- I selected the About submenu, right-clicked it and selected Cut from the popup. The About submenu disappeared, and the movie moved up into its position. Then I selected the main menu item, right-clicked it, and selected Paste from the popup. The About submenu then reappeared to the right of the main menu, but now BELOW the movie.
    Sure enough, when I went back to the DVD simulation, the MovieX button was selected as the default at startup. The final physical DVD also worked as intended.

  • How to edit 16bit TIFF image sequence file in FCP?

    Dear all,
    I have a number of 16 bit TIFF image sequence files (2048 x 1024 resolution) - some of them are RED footage, and others came directly from our f/x guy. We are going into a color correction session in a post house and we've been asked to provide a sequential 16 bit TIFF image sequence of the edited time line.
    I need to do a cross dissolve b/w most of the clips I have. I have created image sequence QT movie (reference files) from the TIFF images. Though they play fine in QT player, when I try importing into FCP, I am met with a "general error". I tried both dragging it into QT, as well as File --> Import.
    I am wondering what can I do to get these clips into FCP in order to apply the cross dissolve transitions I need. Is this a problem relating to the 16bit nature of the TIFF files?
    I tried exporting the TIFF image sequence standalone QT movie, and those imported fine. However, I have a feeling that the standalone movie conversion also decrease my bit depth from 16 to 8. (When I do my final TIFF output from FCP after dissolves / transitions had been applied, each TIFF file is now 8 MB instead of 12 MB, hence my suspicion that the bit depth is adjusted).
    Are there any settings I am missing, or does FCP simply don't support 16 bit image sequence reference file. As a test, I had also converted all my TIFF to jpg, and created jpeg image sequence reference file. These reference QT file can be successfully imported to FCP and I can edit them as if they are a clip.
    If FCP is not able to handle these files, what are my other options? After Effects?
    Any help is appreciated.
    Thank you.
    Michael
    <Edited by Moderator>

    As far as I know, both FCP and Color only support up to 10 bit color, which is 1024 levels for each color channel, more than enough for avoiding color banding.
    If you need 16 bit for sure, I believe AE will support 16 bit output. Another 16 bit application would be the extended version of Photoshop, which has some limited time line capability.

  • Detect Note Changes in MIDI Sequencer

    Hi all,
    I&rsquo;m trying to detect when the MIDI Sequencer changes notes using some kind of a listener to detect when the note changes occur. My example program is able to detect the end of the sequence and I&rsquo;d like to be able to detect note changes and print a message in a similar way. Here is my example code.
    import javax.swing.*;
    import javax.sound.midi.*;
    public class SequencerTestApplet extends JApplet
        public void init()
            SequencerTest seqTest = new SequencerTest();
            seqTest.play();
            System.out.println("Print from init()");
    class SequencerTest
        Sequencer sequencer=null;
        Sequence seq=null;
        Track track=null;
        public SequencerTest()
            try
            {   sequencer = MidiSystem.getSequencer();
                sequencer.open();
                // detect END OF SEQUENCE
                sequencer.addMetaEventListener(
                    new MetaEventListener()
                    {   public void meta(MetaMessage m)
                        {  if (m.getType() == 47) System.out.println("SEQUENCE FINISHED");
                sequencer.setTempoInBPM(40);
                seq = new Sequence(Sequence.PPQ, 16);
                track = seq.createTrack();
            catch (Exception e) { }
        public void play()
            try
            {    // NOTE 1
                ShortMessage noteOnMsg = new ShortMessage();
                noteOnMsg.setMessage(ShortMessage.NOTE_ON, 0, 60, 93);
                track.add(new MidiEvent(noteOnMsg, 0));
                ShortMessage noteOffMsg = new ShortMessage();
                noteOffMsg.setMessage(ShortMessage.NOTE_OFF, 0, 60, 93);
                track.add(new MidiEvent(noteOffMsg, 16));
                // NOTE 2
                ShortMessage noteOnMsg2 = new ShortMessage();
                noteOnMsg2.setMessage(ShortMessage.NOTE_ON, 0, 68, 93);
                track.add(new MidiEvent(noteOnMsg2, 16));
                ShortMessage noteOffMsg2 = new ShortMessage();
                noteOffMsg2.setMessage(ShortMessage.NOTE_OFF, 0, 68, 93);
                track.add(new MidiEvent(noteOffMsg2, 32));
                sequencer.setSequence(seq);
                sequencer.start();
            catch (Exception e) { }
    }In this program the init() method starts the sequencer through the play() method and then continues on so that the &ldquo;print from init()&rdquo; statement is printed from the init() method while the sequencer is still playing. Then after the sequencer is finished, it uses the MetaEventListener to detect the end of the sequence and print the &ldquo;sequence finished&rdquo; message. I&rsquo;d like to be able to make it also detect when the sequence changes notes in a similar way... Start the sequence and move on, but then be able to detect each time a note change occurs and print a message.
    Since I am putting the notes at specific midi ticks (multiples of 16, or &ldquo;quarter notes&rdquo;) I could poll the Sequencer using getTickPosition() to see if the Sequencer&rsquo;s tick position matches a particular multiple of 16. However, the problem with this is it would lock up the program since it would be constantly polling the sequencer and the program wouldn&rsquo;t be able to do anything else while the Sequencer is playing (and I also have a loop option for the Sequencer so that would lock up the program indefinitely).
    Here&rsquo;s what I&rsquo;ve found out and tried so far...
    I read in this [this tutorial|http://java.sun.com/docs/books/tutorial/sound/MIDI-seq-adv.html] on the java sun site (under &ldquo;Specifying Special Event Listeners&rdquo;) that The Java Sound API specifies listener interfaces for control change events (for pitch-bend wheel, data slider, etc.) and meta events (for tempo change commands, end-of-track, etc.) but it says nothing about detecting note changes (note on/off). Also in the [EventListener API|http://java.sun.com/j2se/1.3/docs/api/java/util/class-use/EventListener.html] (under javax.sound.midi) it only lists the ControllerEventListener and the MetaEvenListener.
    I also read here that MIDI event listeners listen for the end of the MIDI stream, so again no info about detecting note changes.
    It seems like the sequencer should have some way of sending out messages (in some fashion) when these note changes happen, but I&rsquo;m not sure how or even if it actually does. I&rsquo;ve looked and looked and everything seems to be coming back to just these two types of listeners for MIDI so maybe it doesn&rsquo;t.
    To be sure the MetaEventListener doesn&rsquo;t detect note changes I changed the MetaMessage from:
    public void meta(MetaMessage m)
    {    if (m.getType() == 47) System.out.println("SEQUENCER FINISHED");
    }to:
    public void meta(MetaMessage m)
    {    System.out.println("" + m.getType());
    }so that it would print out all of the MetaMessages it receives. The only message that printed was &ldquo;47&rdquo; which indicates the end of the sequence. So the MetaEventListener doesn&rsquo;t appear to do what I need it to do.
    I realize this is a rather odd problem and probably not many people have had the need to do something like this, but it never hurts to ask. If anyone has any suggestions on how to solve this problem it would be greatly appreciated.
    Thanks,
    -tkr

    Tekker wrote:
    As another idea, since I can't do it with a listener like I originally wanted to, would adding a separate thread to poll the sequencer and send an interrupt when it matches a particular midi tick be a good route to try? My thinking is this essentially act kind of like a listener by running in the background and reporting back when it changes notes.Yep, that worked! :)
    import javax.swing.*;
    import javax.sound.midi.*;
    public class ThreadTestApplet extends JApplet
         public void init()
              ThreadTest threadTest = new ThreadTest();
              threadTest.play();
              MIDIThread thread = new MIDIThread(threadTest.sequencer);
              thread.start();
              System.out.println("  Print from init() 1");
              try { Thread.sleep(1000); } catch (InterruptedException ie) {}
              System.out.println("  Print from init() 2");
              try { Thread.sleep(1000); } catch (InterruptedException ie) {}
              System.out.println("  Print from init() 3");
              try { Thread.sleep(1000); } catch (InterruptedException ie) {}
              System.out.println("  Print from init() 4");
    class ThreadTest
         Sequencer sequencer=null;
         Sequence seq=null;
         Track track=null;
         public ThreadTest()
              System.out.println("Sequencer Started");
              try
              {     sequencer = MidiSystem.getSequencer();
                   sequencer.open();
                   // detect END OF SEQUENCE
                   sequencer.addMetaEventListener(
                        new MetaEventListener()
                        {  public void meta(MetaMessage m)
                             {     if (m.getType() == 47) System.out.println("SEQUENCER FINISHED");
                   sequencer.setTempoInBPM(40);
                   seq = new Sequence(Sequence.PPQ, 16);
                   track = seq.createTrack();
              catch (Exception e) { }
         public void play()
              try
              {     // NOTE 1
                   ShortMessage noteOnMsg = new ShortMessage();
                   noteOnMsg.setMessage(ShortMessage.NOTE_ON, 0, 60, 93);
                   track.add(new MidiEvent(noteOnMsg, 0));
                   ShortMessage noteOffMsg = new ShortMessage();
                   noteOffMsg.setMessage(ShortMessage.NOTE_OFF, 0, 60, 93);
                   track.add(new MidiEvent(noteOffMsg, 16));
                   // NOTE 2
                   ShortMessage noteOnMsg2 = new ShortMessage();
                   noteOnMsg2.setMessage(ShortMessage.NOTE_ON, 0, 68, 93);
                   track.add(new MidiEvent(noteOnMsg2, 16));
                   ShortMessage noteOffMsg2 = new ShortMessage();
                   noteOffMsg2.setMessage(ShortMessage.NOTE_OFF, 0, 68, 93);
                   track.add(new MidiEvent(noteOffMsg2, 32));
                   sequencer.setSequence(seq);
                   sequencer.start();
              catch (Exception e) { }
    import javax.sound.midi.*;
    public class MIDIThread extends Thread
         Sequencer sequencer=null;
         long midiTick=0;
         long midi_progressionLastChord=32;
         boolean print = true;
         public MIDIThread(Sequencer sequencer)
              this.sequencer = sequencer;
         public void run()
              System.out.println("Thread Started");
              while (midiTick<midi_progressionLastChord)
              {     midiTick = sequencer.getTickPosition();
                   if (midiTick == 0 || midiTick == 16)
                   {     if (print)
                        {     System.out.println("NOTE CHANGE");
                             print = false;
                   else
                        print = true;
    }I put in several print statements (with pauses in the init method) and the init print statements continue to be printed while the sequencer is playing, so it's not locking up the system and the "note change" statements happen when the sequencer changes notes. So this part is working perfectly! :)
    Here's what I got for my output:
    Sequencer Started
    Print from init() 1
    Thread Started
    NOTE CHANGE
    Print from init() 2
    NOTE CHANGE
    Print from init() 3
    SEQUENCER FINISHED
    Print from init() 4
    The only problem I'm having is how to "throw" this action back up to the main init method and have it do the print statement instead of the thread class. Throwing an interrupt apparently won't work as you have to poll it to see if it has been interrupted (so it'd be no different than just polling the sequencer to see if it equals the specific midi tick). Maybe throw an ActionEvent? But how to attach it to my applet? Would I need to create an instance of my applet and then pass that into the thread class so it can catch the ActionEvent? And if I do that will it stop the thread or will it keep the thread running so can detect the other notes?... Or is there a better/simpler way to do this?
    Thanks again,
    -tkr

  • Multiple Movie symbols into one sprite sheet

    I have my character split into different symbols. Arms, Head, Body and so on. Each symbol (movie clip) has its own timeline of animation. How do I get all of my symbols into one clip without losing animation? I've tried selecting all of the symbols and and creating a new movie clip out of all of them together but when I try to covert to sprite sheet, it is just my entire character with no other sequences of movement on the sprite sheet.
    Thank you in advance

    There are a couple of things you could try depending on what exactly you need.
    1. Assuming your character has all the different body parts as separate symbols with their own animations within.
         a. Select all the body-part symbols in Library or on Stage, right-click and select 'Generate Sprite Sheet..' 
         b. Check the sprite sheet preview - each of the selected symbols are packed one after the other.
    2. If you have one Movieclip containing all the body part symbols and you wish to export the animation as it is ==>
         a. Double click on the main movieclip to get inside it.
         b. Select all the body part symbols on stage and change their instance type to Graphic in the Properties panel.
         c. Increase the frames in the main movieclip's timeline (press F5) to cover the entire animation of its children.
         d. Now generate the sprite-sheet for main movieclip from library or stage and check the preview.

  • Very poor Playback of imported image sequence

    Hello,
    I really tried to work around this problem but I'm resigned to see that premiere pro seems to handle very bad the playback of imported sequence of numbered stills.
    I began with premiere elements. I imported my footage as image sequence (from 3dsmax), and saw that the playback was poor. It seemed to be playable after background rendering was finished, but BG rendering is soooo long due to an issue with nvidia hardware. So I'm forced to disable BG rendering, but the problem is that the sequence go unplayable again, etc, etc.
    I decided to install premiere pro cs5 trial to test, thinking that it will definitively fix the problem,
    but... same poor, almost unusable playback with numbered stills.
    I have a strong hardware (dual xeon 5650, quadro 4000, 48gb ram), so I think it's not the cause.
    I disable my antivirus while using premiere.
    Video sequences (avi, mov, etc), play smoothly, but when you work with CG 3D footage, you always export in image sequences, and I want to be able to edit my footages in premiere, as compositing softwares aren't built for the same kind of tasks.
    After effects plays images sequences very smoothly, so why not premiere?
    I did convert my image sequences to avi or mov uncompressed, but even with no compression, there's a significant loss of quality, and I want to avoid this loss to be able to edit my footage and output my final video based on the best image quality possible.
    Thank you for answering

    I have a strong hardware (dual xeon 5650, quadro 4000, 48gb ram), so I think it's not the cause.
    You did not mention your disk setup.
    Playing back numbered image sequences at high resolution is
    probably the most disk IO intensive thing you can ask Premiere to do.
    Without a dedicated RAID controller and multi-disk setup, you will likely be
    forced to timeline preview render all your image sequences for real time playback.
    After effects plays images sequences very smoothly, so why not premiere?
    AE will not play image sequences in real time until you render a RAM preview.
    I did convert my image sequences to avi or mov uncompressed, but even with no compression, there's a significant loss of quality...
    There will be no loss of quality if you use a lossless codec for your
    digital intermediate file (i.e. Lagarith or UT), and these uncompressed files
    will play smoothly in Premiere without needing to render timeline previews.

  • Export changes sequence from 16:9 to 4:3

    Editing Apple ProRes 422 with mts files converted to mp4.  When I export sequence to mov or mp4, the aspect ratio changes from 16:9 to 4:3 and the picture compresses.  I'm using Export>Quicktime Conversion. Is there a setting I can change to correct this?

    Yes, I couldn't find a way to convert the .mts files to .mov and could only convert them to .mp4.  Appreciate your answer but not completely understanding it. So are you saying I should convert my sequence using Export>Quicktime Converter and change the settings to ProRes, or are you saying I should convert the source files to ProRes somehow?

  • Export to mov file failing

    My attempts to export my sequence in mov format using compressor keep failing. I am getting an error in the log that reads, "Failed to create movie markers." I can't figure out what is going wrong.
    Any ideas??

    Thanks for your input. I think the main issue is that i originally captured the video using another peice of software. These files were 1440x1080 so i was getting 'letter boxing' on the left and right. After doing a lot of reading, i now understand the importance of selecting the correct project setting
    Leading on from this, I'm about to do some more filming and have hired a HDV camcorder (Sony HVR 27p - PAL). It's 1080i and can film in interlaced (25 or 50fps) or progressive. (25fps)
    My questions are:
    The required output playback file (mov file format) needs to be progressive. Should i film in progressive as well, or stick with interlaced and change the output settings when creating the output file?
    If i stick with interlaced, do i film in 50 or 25 as the output file needs to be 25fps?
    Although the camera captures 16:9, the pixels are 1440x1080 (which by all accounts in usual with HDV cameras.) Do i select a project setting whose setup is 1440x1080 or do i use 1720x1080?
    Thanks a lot for your help so far.
    Rob

Maybe you are looking for

  • Adobe Bridge CC Smart Collections are not displaying all images in the folder

    I'm having an issue with Bridge CC were I setup a smart collection to monitor my new photos. The folder contains over 300 photos, but is only displaying 160. The only condition I set is to have a minium file size of 10kb, so it should bring in all fi

  • Error when exporting my imovie project

    Hi there, Everytime I try to export my iMovie project I get the following error: "Unable to prepare project for publishing. The project could not be prepared for publishing because an error occurred. (-50)" As proposed in other discussions I have opt

  • Greyed out wifi, bluetooth works perfect

    Hi! i just got myself a iphone 4S a few days ago yesterday my wifi couln't find anything, so i just did the reset network settings when my iphone started up again, my wifi button greyed out and i couln't do a thing with it or see something only the g

  • Lockbox - Multiple customers on one payment advice

    I am having an issue with setting up an EDI process creating a payment advice for automatically clearing customer invoices when there is a head office paying for other branches that are set up as customers themselves. The payment comes over with mult

  • Restore doesn't take

    Itunes tells me it has "detected an Ipod in recovery mode" and that I must restore it before I can use it wiht Itunes. O.k., so I clicked on "restore" and let it blow out all my tunes (no problem, they're backed up) and then it updated the pod to the