Play sound for a given state.

        :param state: a State value.
484451
def play(state):
        
        filename = None
        if state == SoundService.State.welcome:
            filename = "pad_glow_welcome1.wav"
        elif state == SoundService.State.goodbye:
            filename = "pad_glow_power_off.wav"
        elif state == SoundService.State.hotword_detected:
            filename = "pad_soft_on.wav"
        elif state == SoundService.State.asr_text_captured:
            filename = "pad_soft_off.wav"
        elif state == SoundService.State.error:
            filename = "music_marimba_error_chord_2x.wav"

        if filename is not None:
            AudioPlayer.play_async("{}/{}".format(ABS_SOUND_DIR, filename))
612096
def state(self):
        
        if self.method in ['OPTIONS', 'DESCRIBE', 'SETUP', 'PLAY']:
            state = STATE_STARTING
        elif self.method in ['KEEP-ALIVE']:
            state = STATE_PLAYING
        else:
            state = STATE_STOPPED
        _LOGGER.debug('RTSP session (%s) state %s', self.host, state)
        return state
1226301
def set_state_from_file(self, filename):
        
        with self.io(filename, 'r') as fp:
            rstate = fp.read_random_state()
        # set the numpy random state
        numpy.random.set_state(rstate)
        # set emcee's generator to the same state
        self._sampler.random_state = rstate
624908
def _update_state(self, value: str) -> None:
        """"""
        attribute = next(attr for attr in self._device['device_info'].get(
            'Attributes', []) if attr.get(
                'AttributeDisplayName') == 'doorstate')
        if attribute is not None:
            attribute['Value'] = value
884565
def state(self, state):
        ''''''
        logger.debug('client changing to state=%s', ClientState.Names[state])
        self._state = state
966103
async def playing(self):
        """"""
        # TODO: This is hack-ish
        if self._setstate is None:
            await self.protocol.start()

        # No SET_STATE_MESSAGE received yet, use default
        if self._setstate is None:
            return MrpPlaying(protobuf.SetStateMessage(), None)

        return MrpPlaying(self._setstate, self._nowplaying)
403298
def set_state(self, new_state):
        
        # Make sure it's a valid state
        if new_state not in self.STATES:
            raise ValueError('Invalid state value: %r' % new_state)

        # Set the state
        LOGGER.debug('State changing from %s to %s', self.STATES[self.state],
                     self.STATES[new_state])
        self.state = new_state
        self.state_start = time.time()
303780
def set_state(self, state, speed=None):
        
        speed = speed or self.current_fan_speed()
        if state:
            desired_state = {"powered": state, "mode": speed}
        else:
            desired_state = {"powered": state}

        response = self.api_interface.set_device_state(self, {
            "desired_state": desired_state
        })

        self._update_state_from_response(response)
596252
def load_sound(self, loc, title, group):
        '''
        
        '''
        self.sounds.setdefault(group, {})
        self.sounds[group][title] = Sound(loc, self)
705045
def set_state(self, state):
        
        self.basicevent.SetBinaryState(BinaryState=int(state))
        self._state = int(state)
864993
public void setState(String state)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "setState", state);

    this.state = state;

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "setState");
  }
990292
def state(self):
        
        if self.is_active:
            if 'NowPlayingItem' in self.session:
                if self.session['PlayState']['IsPaused']:
                    return STATE_PAUSED
                else:
                    return STATE_PLAYING
            else:
                return STATE_IDLE
        else:
            return STATE_OFF
233849
def state_listener(self, state):
        '''
        
        '''
        if state == KazooState.SUSPENDED:
            self.set_valid(False)
            self.call_error(self.BAD_CONNECTION)
        elif state == KazooState.LOST and not self.do_not_restart:
            self.threaded_start()
        elif state == KazooState.CONNECTED:
            # This is going to throw a SUSPENDED kazoo error
            # which will cause the sessions to be wiped and re established.
            # Used b/c of massive connection pool issues
            self.zoo_client.stop()
23013
def set_state(self, state, *, index=0):
        """"""
        return self.set_values({
            ATTR_DEVICE_STATE: int(state)
        }, index=index)
403331
def _control(self, state):
        

        # Renew subscription if necessary
        if not self._subscription_is_recent():
            self._subscribe()

        cmd = MAGIC + CONTROL + self._mac + PADDING_1 + PADDING_2 + state
        _LOGGER.debug("Sending new state to %s: %s", self.host, ord(state))
        ack_state = self._udp_transact(cmd, self._control_resp, state)
        if ack_state is None:
            raise S20Exception(
                "Device didn't acknowledge control request: {}".format(
                    self.host))
1012842
def play(self):
        """"""
        self._response['shouldEndSession'] = True
        self._response['action']['audio']['interface'] = 'play'
        self._response['action']['audio']['sources'] = []
        return self
1204989
def consume(self, state):
        
        self.state.append(self.func(state))
        return self.state