platypush/plugins/sound/__init__.py
def release(self, stream_index=None, stream_name=None,
                sound_index=None, midi_note=None, frequency=None):
        """
        Remove a sound from an active stream, either by sound index (use
            :meth:`platypush.sound.plugin.SoundPlugin.query_streams` to get
            the sounds playing on the active streams), midi_note, frequency
            or absolute file path.

        :param stream_index: Stream index (default: sound removed from all the
            active streams)
        :type stream_index: int

        :param stream_name: Stream name (default: sound removed from all the
            active streams)
        :type stream_index: str

        :param sound_index: Sound index
        :type sound_index: int

        :param midi_note: MIDI note
        :type midi_note: int

        :param frequency: Sound frequency
        :type frequency: float
        """

        if stream_name:
            if stream_index:
                raise RuntimeError('stream_index and stream name are ' +
                                   'mutually exclusive')
            stream_index = self.stream_name_to_index.get(stream_name)

        mixes = {
            i: mix for i, mix in self.stream_mixes.items()
        } if stream_index is None else {
            stream_index: self.stream_mixes[stream_index]
        }

        streams_to_stop = []

        for i, mix in mixes.items():
            for j, sound in enumerate(mix):
                if (sound_index is not None and j == sound_index) or \
                        (midi_note is not None
                         and sound.get('midi_note') == midi_note) or \
                        (frequency is not None
                         and sound.get('frequency') == frequency):
                    if len(list(mix)) == 1:
                        # Last sound in the mix
                        streams_to_stop.append(i)
                    else:
                        mix.remove(j)

        if streams_to_stop:
            self.stop_playback(streams_to_stop)

        Remove a sound from an active stream, either by sound index (use
            :meth:`platypush.sound.plugin.SoundPlugin.query_streams` to get
            the sounds playing on the active streams), midi_note, frequency
            or absolute file path.

        :param stream_index: Stream index (default: sound removed from all the
            active streams)
        :type stream_index: int

        :param stream_name: Stream name (default: sound removed from all the
            active streams)
        :type stream_index: str

        :param sound_index: Sound index
        :type sound_index: int

        :param midi_note: MIDI note
        :type midi_note: int

        :param frequency: Sound frequency
        :type frequency: float
        
Remove a sound from an active stream, either by sound index (use
:meth:`platypush.sound.plugin.SoundPlugin.query_streams` to get
the sounds playing on the active streams), midi_note, frequency
or absolute file path.
Remove a sound from an active stream either by sound index ( use : meth : ` platypush . sound . plugin . SoundPlugin . query_streams ` to get the sounds playing on the active streams ) midi_note frequency or absolute file path .
def release(self, stream_index=None, stream_name=None,
                sound_index=None, midi_note=None, frequency=None):
        if stream_name:
            if stream_index:
                raise RuntimeError('stream_index and stream name are ' +
                                   'mutually exclusive')
            stream_index = self.stream_name_to_index.get(stream_name)
        mixes = {
            i: mix for i, mix in self.stream_mixes.items()
        } if stream_index is None else {
            stream_index: self.stream_mixes[stream_index]
        }
        streams_to_stop = []
        for i, mix in mixes.items():
            for j, sound in enumerate(mix):
                if (sound_index is not None and j == sound_index) or \
                        (midi_note is not None
                         and sound.get('midi_note') == midi_note) or \
                        (frequency is not None
                         and sound.get('frequency') == frequency):
                    if len(list(mix)) == 1:
                        streams_to_stop.append(i)
                    else:
                        mix.remove(j)
        if streams_to_stop:
            self.stop_playback(streams_to_stop)
def release ( self , stream_index = None , stream_name = None , sound_index = None , midi_note = None , frequency = None ) : if stream_name : if stream_index : raise RuntimeError ( 'stream_index and stream name are ' + 'mutually exclusive' ) stream_index = self . stream_name_to_index . get ( stream_name ) mixes = { i : mix for i , mix in self . stream_mixes . items ( ) } if stream_index is None else { stream_index : self . stream_mixes [ stream_index ] } streams_to_stop = [ ] for i , mix in mixes . items ( ) : for j , sound in enumerate ( mix ) : if ( sound_index is not None and j == sound_index ) or ( midi_note is not None and sound . get ( 'midi_note' ) == midi_note ) or ( frequency is not None and sound . get ( 'frequency' ) == frequency ) : if len ( list ( mix ) ) == 1 : streams_to_stop . append ( i ) else : mix . remove ( j ) if streams_to_stop : self . stop_playback ( streams_to_stop )
Remove a sound from an active stream, either by sound index (use
:meth:`platypush.sound.plugin.SoundPlugin.query_streams` to get
the sounds playing on the active streams), midi_note, frequency
or absolute file path.
Remove a sound from an active stream either by sound index ( use : meth : ` platypush . sound . plugin . SoundPlugin . query_streams ` to get the sounds playing on the active streams ) midi_note frequency or absolute file path .
"""
        Remove a sound from an active stream, either by sound index (use
            :meth:`platypush.sound.plugin.SoundPlugin.query_streams` to get
            the sounds playing on the active streams), midi_note, frequency
            or absolute file path.

        :param stream_index: Stream index (default: sound removed from all the
            active streams)
        :type stream_index: int

        :param stream_name: Stream name (default: sound removed from all the
            active streams)
        :type stream_index: str

        :param sound_index: Sound index
        :type sound_index: int

        :param midi_note: MIDI note
        :type midi_note: int

        :param frequency: Sound frequency
        :type frequency: float
        """ # Last sound in the mix
self
stream_index
Stream index (default: sound removed from all the
active streams)
Stream index ( default : sound removed from all the active streams )
stream_name
Stream name (default: sound removed from all the
active streams)
Stream name ( default : sound removed from all the active streams )
sound_index
None
midi_note
None
frequency
None