Ignore:
Timestamp:
05/12/12 15:48:45 (12 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
hg-Phase:
(<MercurialRepository 1 'hg:/home/ivaradi/mlx/hg' '/'>, 'public')
Message:

The background sounds play back properly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/flight.py

    r134 r170  
    22
    33#---------------------------------------------------------------------------------------
     4
     5from soundsched import SoundScheduler
    46
    57import const
     
    3234        gui.resetFlightStatus()
    3335
     36        self._soundScheduler = SoundScheduler(self)
     37        self._pilotHotkeyPressed = False
     38        self._checklistHotkeyPressed = False
     39
    3440        self.flareTimeFromFS = False
    3541        self.entranceExam = False
     
    5965        self._flareStartFS = None
    6066
     67        self._tdRate = None
     68
    6169    @property
    6270    def config(self):
     
    103111        """Get the VRef speed of the flight."""
    104112        return self._gui.vref
     113
     114    @property
     115    def tdRate(self):
     116        """Get the touchdown rate if known, None otherwise."""
     117        return self._tdRate
    105118
    106119    def handleState(self, oldState, currentState):
     
    111124        if self.startFuel is None:
    112125            self.startFuel = self.endFuel
     126       
     127        self._soundScheduler.schedule(currentState,
     128                                      self._pilotHotkeyPressed)
     129        self._pilotHotkeyPressed = False
    113130
    114131    def setStage(self, timestamp, stage):
     
    155172        self._flareStartFS = flareStartFS
    156173
    157     def flareFinished(self, flareEnd, flareEndFS):
     174    def flareFinished(self, flareEnd, flareEndFS, tdRate):
    158175        """Called when the flare time has ended.
    159176       
     
    162179        - the flare time
    163180        """
     181        self._tdRate = tdRate
    164182        if self.flareTimeFromFS:
    165183            return (True, flareEndFS - self._flareStartFS)
     
    176194        """Get the fleet and call the given callback."""
    177195        self._gui.getFleetAsync(callback = callback, force = force)
     196
     197    def pilotHotkeyPressed(self):
     198        """Called when the pilot hotkey is pressed."""
     199        self._pilotHotkeyPressed = True
     200
     201    def checklistHotkeyPressed(self):
     202        """Called when the checklist hotkey is pressed."""
     203        self._checklistHotkeyPressed = True
    178204
    179205    def _updateFlownDistance(self, currentState):
Note: See TracChangeset for help on using the changeset viewer.