Changeset 375
- Timestamp:
- 10/26/08 17:05:11 (16 years ago)
- Location:
- trunk/src_apollo/org/apollo
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src_apollo/org/apollo/ApolloSystem.java
r372 r375 55 55 public static final String HELP_MELODYSEARCH_FRAMENAME = SYSTEM_FRAMESET_NAME + 3; 56 56 57 public static final String SETTINGS_NAME_TIMELINE_RMARGIN = "timeline rightmargin";58 public static final String SETTINGS_NAME_TIMELINE_LMARGIN = "timeline leftmargin";57 public static final String SETTINGS_NAME_TIMELINE_RMARGIN = "timelinerightmargin"; 58 public static final String SETTINGS_NAME_TIMELINE_LMARGIN = "timelineleftmargin"; 59 59 60 60 -
trunk/src_apollo/org/apollo/audio/ApolloPlaybackMixer.java
r365 r375 15 15 import org.apollo.mvc.AbstractSubject; 16 16 import org.apollo.mvc.SubjectChangedEvent; 17 import org.apollo.util.ApolloSystemLog;18 17 import org.apollo.util.TrackModelHandler; 19 18 import org.apollo.util.TrackModelLoadManager; … … 551 550 552 551 // Notify observers that some audio has started playing 553 ApolloSystemLog.println("AUDIO PIPELINE THREAD STARTED");554 555 552 ApolloPlaybackMixer.this.fireSubjectChangedLaterOnSwingThread( 556 553 new SubjectChangedEvent(ApolloSubjectChangedEvent.PLAYBACK_STARTED)); … … 820 817 821 818 } 822 823 ApolloSystemLog.println("AUDIO PIPELINE THREAD KILLED"); 824 819 825 820 // Notify observers that playback has finished. 826 821 ApolloPlaybackMixer.this.fireSubjectChangedLaterOnSwingThread( -
trunk/src_apollo/org/apollo/audio/util/SoundDesk.java
r367 r375 829 829 volume = chan.mix.getVolume(); 830 830 } 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 831 840 } else { 832 841 isMuted = chan.mix.isMuted(); 833 842 volume = chan.mix.getVolume(); 834 843 } 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 844 845 chan.tseq.setMuted(isMuted); 845 846 chan.tseq.setVolume(volume); -
trunk/src_apollo/org/apollo/gui/FrameLayoutDaemon.java
r372 r375 7 7 import java.io.File; 8 8 import java.lang.reflect.InvocationTargetException; 9 import java.util.Collection; 9 10 import java.util.HashMap; 10 11 import java.util.Map; … … 72 73 public static final int DEFAULT_LAYOUT_LEFT_MARGIN = 30; 73 74 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; 75 76 public static final int MIN_TRACK_WIDGET_WIDTH = 20; 76 77 public static final int FREE_SPACE_MARGINS = 30; … … 485 486 if (width < MIN_TRACK_WIDGET_WIDTH) 486 487 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 } 487 501 488 502 if (widgetsToFormat.size() == 1) { … … 510 524 int xpos = currentTimeline.getXAtMSTime(atgi.getInitiationTime()); 511 525 iw.setPosition(xpos, iw.getY()); 526 527 for (Item i : enclosedPortions.keySet()) { 528 i.setX(xpos + (enclosedPortions.get(i) * iw.getWidth())); 529 } 512 530 513 531 } -
trunk/src_apollo/org/apollo/gui/TimeAxis.java
r369 r375 4 4 import java.awt.Font; 5 5 import java.awt.FontMetrics; 6 import java.awt.GradientPaint; 6 7 import java.awt.Graphics; 7 8 import java.awt.Graphics2D; … … 11 12 import java.util.LinkedList; 12 13 14 import org.apollo.ApolloSystem; 13 15 import org.expeditee.gui.Browser; 14 16 … … 318 320 319 321 // 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 321 333 g.fillRect(x, y, width, height); 322 334 -
trunk/src_apollo/org/apollo/items/FramePlaybackLauncher.java
r372 r375 180 180 if (tl == null) 181 181 tl = FrameLayoutDaemon.inferTimeline(audioFrame); 182 182 if (tl == null) return; 183 183 184 184 long initiateMS = tl.getMSTimeAtX((int)_x); -
trunk/src_apollo/org/apollo/widgets/SampledTrack.java
r372 r375 65 65 import org.expeditee.gui.FrameGraphics; 66 66 import org.expeditee.gui.FrameIO; 67 import org.expeditee.gui.FrameMouseActions; 67 68 import org.expeditee.gui.MouseEventRouter; 68 69 import org.expeditee.gui.PopupManager; … … 381 382 } 382 383 384 if (!e.isConsumed() && e.getButton() == MouseEvent.BUTTON2) { 385 if (split(true)) 386 e.consume(); 387 } 388 383 389 // Consume events if track is selected for expansion 384 390 if (ExpandedTrackManager.getInstance().isTrackInExpansionSelection(trackModel)) { 385 391 e.consume(); 386 392 } 387 388 393 389 394 } … … 415 420 416 421 // 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(); 481 426 482 427 } … … 1426 1371 } 1427 1372 1373 private boolean ignoreInjection = false; 1428 1374 private MouseEvent lastInsertME = null; 1429 1375 … … 1493 1439 MouseEvent me = MouseEventRouter.getCurrentMouseEvent(); 1494 1440 1495 if ( me != null && me != lastInsertME &&1441 if (!ignoreInjection && me != null && me != lastInsertME && 1496 1442 (me.getButton() == MouseEvent.BUTTON2 || 1497 1443 me.getButton() == MouseEvent.BUTTON3)) { … … 1517 1463 } 1518 1464 1519 } else if ( me == lastInsertME) {1465 } else if (!ignoreInjection && me == lastInsertME) { 1520 1466 // Note due to a injection removing this widget while in the midst of 1521 1467 // anchoring, the widget parent event filtering will not work thus … … 1792 1738 // } 1793 1739 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 } 1794 1824 /** 1795 1825 * Doesn't expand if not anchored ...
Note:
See TracChangeset
for help on using the changeset viewer.