Changeset 375


Ignore:
Timestamp:
10/26/08 17:05:11 (16 years ago)
Author:
bjn8
Message:

Lots of minor improvements made prior to evluation study, and small things done afterwards for report :)

Location:
trunk/src_apollo/org/apollo
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src_apollo/org/apollo/ApolloSystem.java

    r372 r375  
    5555        public static final String HELP_MELODYSEARCH_FRAMENAME = SYSTEM_FRAMESET_NAME + 3;
    5656       
    57         public static final String SETTINGS_NAME_TIMELINE_RMARGIN = "timeline right margin";
    58         public static final String SETTINGS_NAME_TIMELINE_LMARGIN = "timeline left margin";
     57        public static final String SETTINGS_NAME_TIMELINE_RMARGIN = "timelinerightmargin";
     58        public static final String SETTINGS_NAME_TIMELINE_LMARGIN = "timelineleftmargin";
    5959       
    6060
  • trunk/src_apollo/org/apollo/audio/ApolloPlaybackMixer.java

    r365 r375  
    1515import org.apollo.mvc.AbstractSubject;
    1616import org.apollo.mvc.SubjectChangedEvent;
    17 import org.apollo.util.ApolloSystemLog;
    1817import org.apollo.util.TrackModelHandler;
    1918import org.apollo.util.TrackModelLoadManager;
     
    551550
    552551                        // Notify observers that some audio has started playing
    553                         ApolloSystemLog.println("AUDIO PIPELINE THREAD STARTED");
    554                        
    555552                        ApolloPlaybackMixer.this.fireSubjectChangedLaterOnSwingThread(
    556553                                new SubjectChangedEvent(ApolloSubjectChangedEvent.PLAYBACK_STARTED));
     
    820817                                       
    821818                                }
    822                                
    823                                 ApolloSystemLog.println("AUDIO PIPELINE THREAD KILLED");
    824                                
     819
    825820                                // Notify observers that playback has finished.
    826821                                ApolloPlaybackMixer.this.fireSubjectChangedLaterOnSwingThread(
  • trunk/src_apollo/org/apollo/audio/util/SoundDesk.java

    r367 r375  
    829829                                        volume = chan.mix.getVolume();
    830830                                }
     831                               
     832                                // pre-mix with master mix - if has one
     833                                Channel master = channels.get(chan.masterMixID);
     834                                if (master != null) {
     835                                        assert(master.type == ChannelIDType.Master);
     836                                        isMuted |= master.mix.isMuted();
     837                                        volume *= master.mix.getVolume();
     838                                }
     839
    831840                        } else {
    832841                                isMuted = chan.mix.isMuted();
    833842                                volume = chan.mix.getVolume();
    834843                        }
    835 
    836                         // pre-mix with master mix - if has one
    837                         Channel master = channels.get(chan.masterMixID);
    838                         if (master != null) {
    839                                 assert(master.type == ChannelIDType.Master);
    840                                 isMuted |= master.mix.isMuted();
    841                                 volume *= master.mix.getVolume();
    842                         }
    843                        
     844       
    844845                        chan.tseq.setMuted(isMuted);
    845846                        chan.tseq.setVolume(volume);
  • trunk/src_apollo/org/apollo/gui/FrameLayoutDaemon.java

    r372 r375  
    77import java.io.File;
    88import java.lang.reflect.InvocationTargetException;
     9import java.util.Collection;
    910import java.util.HashMap;
    1011import java.util.Map;
     
    7273        public static final int DEFAULT_LAYOUT_LEFT_MARGIN = 30;
    7374        public static final int MAX_TIMELINE_MARGIN_AREA = 400;
    74         public static final int LAYOUT_MAX_INITIATION_PIXEL = 300;
     75        public static final int LAYOUT_MAX_INITIATION_PIXEL = 100;
    7576        public static final int MIN_TRACK_WIDGET_WIDTH = 20;
    7677        public static final int FREE_SPACE_MARGINS = 30;
     
    485486                                                if (width < MIN_TRACK_WIDGET_WIDTH)
    486487                                                        width = MIN_TRACK_WIDGET_WIDTH;
     488                                               
     489                                                Collection<Item> enclosed = iw.getItems().get(0).getEnclosedItems();
     490                                                Map<Item, Float> enclosedPortions = new HashMap<Item, Float>();
     491                                                if (enclosed != null) {
     492                                                        for (Item i : enclosed) {
     493                                                                if (!(i instanceof WidgetCorner || i instanceof WidgetEdge)) {
     494                                                                        float f = i.getX() - iw.getX();
     495                                                                        f /= iw.getWidth();
     496                                                                        enclosedPortions.put(i, f);
     497                                                                }
     498                                                               
     499                                                        }
     500                                                }
    487501                                               
    488502                                                if (widgetsToFormat.size() == 1) {
     
    510524                                                int xpos = currentTimeline.getXAtMSTime(atgi.getInitiationTime());     
    511525                                                iw.setPosition(xpos, iw.getY());
     526                                               
     527                                                for (Item i : enclosedPortions.keySet()) {
     528                                                        i.setX(xpos + (enclosedPortions.get(i) * iw.getWidth()));
     529                                                }
    512530       
    513531                                        }
  • trunk/src_apollo/org/apollo/gui/TimeAxis.java

    r369 r375  
    44import java.awt.Font;
    55import java.awt.FontMetrics;
     6import java.awt.GradientPaint;
    67import java.awt.Graphics;
    78import java.awt.Graphics2D;
     
    1112import java.util.LinkedList;
    1213
     14import org.apollo.ApolloSystem;
    1315import org.expeditee.gui.Browser;
    1416
     
    318320
    319321                // Draw backing
    320                 g.setColor(backgroundColor);
     322                if (ApolloSystem.useQualityGraphics) {
     323                       
     324                        GradientPaint gp = new GradientPaint(
     325                                        x + (width / 2), y + (int)(height * 0.5), backgroundColor,
     326                                        x + (width / 2), y, SampledTrackGraphView.DEFAULT_BACKGROUND_HIGHTLIGHTS_COLOR);
     327                        ((Graphics2D)g).setPaint(gp);
     328                       
     329                } else {
     330                        g.setColor(backgroundColor);
     331                }
     332               
    321333                g.fillRect(x, y, width, height);
    322334               
  • trunk/src_apollo/org/apollo/items/FramePlaybackLauncher.java

    r372 r375  
    180180                                if (tl == null)
    181181                                        tl = FrameLayoutDaemon.inferTimeline(audioFrame);
    182                                
     182                                if (tl == null) return;
    183183
    184184                                long initiateMS = tl.getMSTimeAtX((int)_x);
  • trunk/src_apollo/org/apollo/widgets/SampledTrack.java

    r372 r375  
    6565import org.expeditee.gui.FrameGraphics;
    6666import org.expeditee.gui.FrameIO;
     67import org.expeditee.gui.FrameMouseActions;
    6768import org.expeditee.gui.MouseEventRouter;
    6869import org.expeditee.gui.PopupManager;
     
    381382                                }
    382383                               
     384                                 if (!e.isConsumed() && e.getButton() == MouseEvent.BUTTON2) {
     385                                                if (split(true))
     386                                                        e.consume();
     387                                        }
     388                               
    383389                                // Consume events if track is selected for expansion
    384390                                if (ExpandedTrackManager.getInstance().isTrackInExpansionSelection(trackModel)) {
    385391                                        e.consume();
    386392                                }
    387                                
    388393               
    389394                        }
     
    415420                               
    416421                                // Delete-and-Split audio command
    417                                 else if (e.isControlDown() && e.getKeyCode() == KeyEvent.VK_DELETE) {
    418                                        
    419                                         // First is selection valid?
    420                                         if (trackModel != null && trackModel.getSelectionLength() > 1
    421                                                         && !fulltrackView.isPlaying()
    422                                                         && (trackModel.getFrameCount() - trackModel.getSelectionLength())  > EditableSampledTrackGraphView.MIN_FRAME_SELECTION_SIZE) {
    423 
    424                                                 // If so... can a slip be performed? i.e. is there unselected audio to
    425                                                 // the left and right of selection
    426                                                 if (trackModel.getSelectionStart() > 0 &&
    427                                                                 (trackModel.getSelectionStart() + trackModel.getSelectionLength()) < trackModel.getFrameCount()) {
    428                                                        
    429                                                         // Perform delete-split
    430                                                         e.consume();
    431                                                        
    432                                                         int rightSideStartFrame = trackModel.getSelectionStart() + trackModel.getSelectionLength();
    433                                                        
    434                                                         // Create a new track widget to contain the right-side audio
    435                                                         byte[] rightsideAudio = new byte[(trackModel.getFrameCount() - rightSideStartFrame) * trackModel.getFormat().getFrameSize()];
    436                                                        
    437                                                         // Copy bytes into new location
    438                                                         System.arraycopy(
    439                                                                         trackModel.getAllAudioBytes(),
    440                                                                         rightSideStartFrame * trackModel.getFormat().getFrameSize(),
    441                                                                         rightsideAudio,
    442                                                                         0, rightsideAudio.length);
    443                                                        
    444                                                         // Let this widget keep the left-side audio
    445                                                         trackModel.setSelection(trackModel.getSelectionStart(), trackModel.getFrameCount() - trackModel.getSelectionStart());
    446                                                         trackModel.removeSelectedBytes();
    447                                                         trackModel.setSelection(0,0);
    448                                                        
    449                                                         // Build the new neighbouring widget
    450                                                         Frame target = getParentFrame();
    451                                                         if (target == null) target = DisplayIO.getCurrentFrame();
    452                                                        
    453                                                         // Determine init time
    454                                                         Mutable.Long initTime = getInitiationTimeFromMeta();
    455                                                        
    456                                                         if (initTime == null) initTime = Mutable.createMutableLong(0);
    457                                                        
    458                                                         initTime.value += AudioMath.framesToMilliseconds(rightSideStartFrame, trackModel.getFormat());
    459                                                        
    460                                                         SampledTrack rightSideTrack = SampledTrack.createFromMemory(
    461                                                                         rightsideAudio,
    462                                                                         trackModel.getFormat(),
    463                                                                         target,
    464                                                                         0, // X Coord overridden
    465                                                                         getY(),
    466                                                                         getName() + " part",
    467                                                                         trackMix);
    468                                                        
    469                                                         // Anchor it
    470                                                         target.addAllItems(rightSideTrack.getItems());
    471                                                        
    472                                                         // Adjust initiation time to be exact
    473                                                         rightSideTrack.setInitiationTime(initTime.value);
    474                                                        
    475                                                         // TODO: FrameLayoutDaemon.getInstance().resumeLayout(this); ?
    476                                                 }
    477                                                
    478                                         }
    479                
    480                                        
     422                                else if (!e.isControlDown() && e.getKeyCode() == KeyEvent.VK_DELETE) {
     423                                       
     424                                        if (split(false))  // try Perform delete-split
     425                                                e.consume();
    481426                                       
    482427                                }
     
    14261371        }
    14271372       
     1373        private boolean ignoreInjection = false;
    14281374        private MouseEvent lastInsertME = null;
    14291375       
     
    14931439                                        MouseEvent me = MouseEventRouter.getCurrentMouseEvent();
    14941440                                       
    1495                                         if (me != null && me != lastInsertME &&
     1441                                        if (!ignoreInjection && me != null && me != lastInsertME &&
    14961442                                                        (me.getButton() == MouseEvent.BUTTON2 ||
    14971443                                                                        me.getButton() == MouseEvent.BUTTON3)) {
     
    15171463                                                }
    15181464                                                       
    1519                                         } else if (me == lastInsertME) {
     1465                                        } else if (!ignoreInjection && me == lastInsertME) {
    15201466                                                // Note due to a injection removing this widget while in the midst of
    15211467                                                // anchoring, the widget parent event filtering will not work thus
     
    17921738//      }
    17931739       
     1740        private boolean split(boolean extractSelection) {
     1741               
     1742                // First is operation valid?
     1743                if (trackModel != null && trackModel.getSelectionLength() > 1
     1744                                && !fulltrackView.isPlaying()
     1745                                && (trackModel.getFrameCount() - trackModel.getSelectionLength())  > EditableSampledTrackGraphView.MIN_FRAME_SELECTION_SIZE) {
     1746
     1747                        // If so... can a slip be performed? i.e. is there unselected audio to
     1748                        // the left and right of selection
     1749                        if (trackModel.getSelectionStart() > 0 &&
     1750                                        (trackModel.getSelectionStart() + trackModel.getSelectionLength()) < trackModel.getFrameCount()) {
     1751                               
     1752                                // Perform split
     1753                                int rightSideStartFrame = trackModel.getSelectionStart() + trackModel.getSelectionLength();
     1754                               
     1755                                // Create a new track widget to contain the right-side audio
     1756                                byte[] rightsideAudio = new byte[(trackModel.getFrameCount() - rightSideStartFrame) * trackModel.getFormat().getFrameSize()];
     1757                               
     1758                                // Copy bytes into new location
     1759                                System.arraycopy(
     1760                                                trackModel.getAllAudioBytes(),
     1761                                                rightSideStartFrame * trackModel.getFormat().getFrameSize(),
     1762                                                rightsideAudio,
     1763                                                0, rightsideAudio.length);
     1764                               
     1765                                byte[] selectedBytes = (extractSelection) ? trackModel.getSelectedFramesCopy() : null;
     1766                               
     1767                                // Let this widget keep the left-side audio
     1768                                trackModel.setSelection(trackModel.getSelectionStart(), trackModel.getFrameCount() - trackModel.getSelectionStart());
     1769                                trackModel.removeSelectedBytes();
     1770                                trackModel.setSelection(0,0);
     1771                               
     1772                                // Build the new neighbouring widget
     1773                                Frame target = getParentFrame();
     1774                                if (target == null) target = DisplayIO.getCurrentFrame();
     1775                               
     1776                                // Determine init time
     1777                                Mutable.Long initTime = getInitiationTimeFromMeta();
     1778                               
     1779                                if (initTime == null) initTime = Mutable.createMutableLong(0);
     1780                               
     1781                                initTime.value += AudioMath.framesToMilliseconds(rightSideStartFrame, trackModel.getFormat());
     1782                               
     1783                                SampledTrack rightSideTrack = SampledTrack.createFromMemory(
     1784                                                rightsideAudio,
     1785                                                trackModel.getFormat(),
     1786                                                target,
     1787                                                0, // X Coord overridden
     1788                                                getY(),
     1789                                                getName() + " part",
     1790                                                trackMix);
     1791       
     1792                                // Anchor it
     1793                                rightSideTrack.ignoreInjection = true;
     1794                                target.addAllItems(rightSideTrack.getItems());
     1795                                rightSideTrack.ignoreInjection = false;
     1796                               
     1797                                // Adjust initiation time to be exact
     1798                                rightSideTrack.setInitiationTime(initTime.value);
     1799                               
     1800                                // If extracting audio then attatch it to the cursor
     1801                                if (selectedBytes != null) {
     1802                                        assert(extractSelection);
     1803       
     1804                                        SampledTrack extractedTrack = SampledTrack.createFromMemory(
     1805                                                        selectedBytes,
     1806                                                        trackModel.getFormat(),
     1807                                                        target,
     1808                                                        getX(), // X Coord overridden
     1809                                                        getY(),
     1810                                                        getName() + " part",
     1811                                                        trackMix);
     1812                                       
     1813                                        FrameMouseActions.pickup(extractedTrack.getItems());
     1814                                       
     1815                                }
     1816                        }
     1817               
     1818                        return true;
     1819                }
     1820               
     1821                return false;
     1822               
     1823        }
    17941824        /**
    17951825         * Doesn't expand if not anchored ...
Note: See TracChangeset for help on using the changeset viewer.