Changeset 1558
- Timestamp:
- 05/10/21 11:46:13 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/apollo/audio/util/PlaybackClock.java
r1102 r1558 11 11 import org.apollo.util.AudioMath; 12 12 import org.expeditee.gui.DisplayController; 13 import org.expeditee.settings.audio.AudioSettings; 13 14 14 15 /** 15 16 * The audio playback clock ticks at {@link #CLOCK_RESOLUTION} milliseconds and 16 17 * invokes all registered clock listeners <b>on the same thread as the clock<b>. 17 * Thus the clock is not entir y acurrate: its intention of use is for updating18 * Thus the clock is not entirely accurate: its intention of use is for updating 18 19 * a GUI according to the live frame position in the software mixer. 19 20 * 20 21 * Thus all thread safety precautions and efficiencies are at the users discretion. 21 22 * The ideal usage would be to simply update some data without the need of locking 22 * and returning asap23 * and returning ASAP 23 24 * 24 25 * @see {@link ApolloPlaybackMixer} … … 29 30 public class PlaybackClock { 30 31 31 public static final long CLOCK_RESOLUTION = 300;32 //public static final long CLOCK_RESOLUTION = 50; // used to be 300, then 50, now retrieved from Settings 32 33 33 34 private Clock clockThread = null; … … 76 77 77 78 /** 78 * Adds a PlaybackClockListener for receiv eing notifications whenever audio is played.79 * Adds a PlaybackClockListener for receiving notifications whenever audio is played. 79 80 * 80 81 * @param listener … … 93 94 94 95 /** 95 * Removes a listener such that it wil stop receiving notifications.96 * Removes a listener such that it will stop receiving notifications. 96 97 * 97 98 * @param listener … … 112 113 * live position of the playback. 113 114 * 114 * The clock thread dies once its inter upted.115 * The clock thread dies once its interrupted. 115 116 * 116 117 * @author Brook Novak … … 129 130 boolean shouldRepaint; 130 131 132 int CLOCK_RESOLUTION = AudioSettings.PlaybackClockResolution.get(); 133 131 134 while (!interrupted()) { 132 135 … … 151 154 listener.onTick(framePos, msPos); // trusting that an exception does not occur 152 155 // If one does occur the worst that can happen is the the user doesn't 153 // have playback f reedback.156 // have playback feedback. 154 157 shouldRepaint = true; 155 158 } … … 166 169 sleep(CLOCK_RESOLUTION); 167 170 168 } // Keep updating GUI until inter upted171 } // Keep updating GUI until interrupted 169 172 } catch (InterruptedException e) { // consume 170 173 // Done
Note:
See TracChangeset
for help on using the changeset viewer.