Changeset 1558


Ignore:
Timestamp:
05/10/21 11:46:13 (3 years ago)
Author:
davidb
Message:

Changed to CLOCK_RESOLUTION comes from the users Settings frameset; also some comment/spelling tidyup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/apollo/audio/util/PlaybackClock.java

    r1102 r1558  
    1111import org.apollo.util.AudioMath;
    1212import org.expeditee.gui.DisplayController;
     13import org.expeditee.settings.audio.AudioSettings;
    1314
    1415/**
    1516 * The audio playback clock ticks at {@link #CLOCK_RESOLUTION} milliseconds and
    1617 * invokes all registered clock listeners <b>on the same thread as the clock<b>.
    17  * Thus the clock is not entiry acurrate: its intention of use is for updating
     18 * Thus the clock is not entirely accurate: its intention of use is for updating
    1819 * a GUI according to the live frame position in the software mixer.
    1920 *
    2021 * Thus all thread safety precautions and efficiencies are at the users discretion.
    2122 * The ideal usage would be to simply update some data without the need of locking
    22  * and returning asap
     23 * and returning ASAP
    2324 *
    2425 * @see {@link ApolloPlaybackMixer}
     
    2930public class PlaybackClock {
    3031       
    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
    3233       
    3334        private Clock clockThread = null;
     
    7677       
    7778        /**
    78          * Adds a PlaybackClockListener for receiveing notifications whenever audio is played.
     79         * Adds a PlaybackClockListener for receiving notifications whenever audio is played.
    7980         *
    8081         * @param listener
     
    9394       
    9495        /**
    95          * Removes a listener such that it wil stop receiving notifications.
     96         * Removes a listener such that it will stop receiving notifications.
    9697         *
    9798         * @param listener
     
    112113         * live position of the playback.
    113114         *
    114          * The clock thread dies once its interupted.
     115         * The clock thread dies once its interrupted.
    115116         *
    116117         * @author Brook Novak
     
    129130                                boolean shouldRepaint;
    130131                               
     132                                int CLOCK_RESOLUTION = AudioSettings.PlaybackClockResolution.get();
     133
    131134                                while (!interrupted()) {
    132135
     
    151154                                                                listener.onTick(framePos, msPos); // trusting that an exception does not occur
    152155                                                                // If one does occur the worst that can happen is the the user doesn't
    153                                                                 // have playback freedback.
     156                                                                // have playback feedback.
    154157                                                                shouldRepaint = true;
    155158                                                        }
     
    166169                                        sleep(CLOCK_RESOLUTION);
    167170                                       
    168                                 } // Keep updating GUI until interupted
     171                                } // Keep updating GUI until interrupted
    169172                        } catch (InterruptedException e) { // consume
    170173                                // Done
Note: See TracChangeset for help on using the changeset viewer.