def updatePeak(selectedTrack: int):
    """ Updates peak values for the tracks showing on the device. 
    ### Parameters

     - selectedTrack: The currently selected track.
    """

    # Uses the function to know which track group the current track belongs to and truncates the value to get the exact number
    trackGroup = math.trunc(1 / 8 * selectedTrack)

    # Multiplies the trackGroup to 8 to get the index of the first track that has to be shown
    trackFirst = trackGroup * 8

    # Creates peakList if peak values are going to be updated
    peakList = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

    # In case the group track is the 15th one, it will limit the declaration of tracks to 7
    if trackGroup == 15:
        trackLimit = trackFirst + 7

    elif trackGroup != 15:
        trackLimit = trackFirst + 8

    # Gets the 16 peak values that need to be reported to the device by building a list [peakL_0, peakR_0, peakL_1, peakR_1 ...]
    for x in range(trackFirst, trackLimit):
        peakList[(x - trackFirst) * 2] = mixer.getTrackPeaks(x, midi.PEAK_L)
        peakList[(x - trackFirst) * 2 + 1] = mixer.getTrackPeaks(
            x, midi.PEAK_R)

    # Sends the values to the device
    nihia.mixerSendInfo("PEAK", 0, peakValues=peakList)
예제 #2
0
def setPeaks(lights):
    # Get selected mixer track
    selected_track = mixer.trackNumber()
    peakLeft = mixer.getTrackPeaks(selected_track, 0)
    peakRight = mixer.getTrackPeaks(selected_track, 1)

    processPeak(lights, 0, peakLeft)
    processPeak(lights, 1, peakRight)

    return
def OnUpdateMeters():
    # sendMidiBytes(0x00,0x00,0x00)
    for n in range(0, 48):
        # print(bytes([10]))
        p = mixer.getTrackPeaks(n, 2)
        p = int(p * 127)
        if (p > 0):
            # sendMidiBytes(bytes([n]), bytes([p]), bytes([1])
            a = n
            b = p
            c = 1
예제 #4
0
	def OnUpdateMeters(self):

		for m in range(0, len(self.ColT) - 1):
			self.ColT[m].Peak = max(self.ColT[m].Peak, round(mixer.getTrackPeaks(self.ColT[m].TrackNum, midi.PEAK_LR_INV)	* self.MeterMax))
예제 #5
0
 def getPeaks(self, mode=midi.PEAK_LR):
     return mixer.getTrackPeaks(self.index, mode)
def updateLEDs():
    global trackOffset, soloStates

    if LEDmode == 1:

        for i in range(0, 8):
            try:
                # set mute
                if mixer.isTrackMuted(trackOffset + i):
                    device.midiOutMsg(midi.MIDI_NOTEON + ((i * 3) + 1 << 8) +
                                      (0 << 16))
                else:
                    device.midiOutMsg(midi.MIDI_NOTEON + ((i * 3) + 1 << 8) +
                                      (127 << 16))
                # set solo
                if useNormalSolo:
                    if mixer.isTrackSolo(trackOffset + i):
                        device.midiOutMsg(midi.MIDI_NOTEON +
                                          ((i * 3) + 2 << 8) + (127 << 16))
                    else:
                        device.midiOutMsg(midi.MIDI_NOTEON +
                                          ((i * 3) + 2 << 8) + (0 << 16))
                else:
                    if soloStates[i] == 1:
                        device.midiOutMsg(midi.MIDI_NOTEON +
                                          ((i * 3) + 2 << 8) + (127 << 16))
                    else:
                        device.midiOutMsg(midi.MIDI_NOTEON +
                                          ((i * 3) + 2 << 8) + (0 << 16))

                # bottom buttons
                if mixer.getTrackPeaks(
                        trackOffset + i,
                        2) > mixerTreshold and mixer.isTrackMuted(trackOffset +
                                                                  i) == False:
                    device.midiOutMsg(midi.MIDI_NOTEON + ((i * 3) + 3 << 8) +
                                      (127 << 16))
                else:
                    device.midiOutMsg(midi.MIDI_NOTEON + ((i * 3) + 3 << 8) +
                                      (0 << 16))

            except:
                break

    if LEDmode == 2:

        for i in range(0, 8):
            try:

                # left peak
                if mixer.getTrackPeaks(selectedTrack, 0) >= (
                        i / 7) and mixer.isTrackMuted(selectedTrack) == False:
                    device.midiOutMsg(midi.MIDI_NOTEON + ((i * 3) + 1 << 8) +
                                      (127 << 16))
                else:
                    device.midiOutMsg(midi.MIDI_NOTEON + ((i * 3) + 1 << 8) +
                                      (0 << 16))

                # right peak
                if mixer.getTrackPeaks(selectedTrack, 1) >= (
                        i / 7) and mixer.isTrackMuted(selectedTrack) == False:
                    device.midiOutMsg(midi.MIDI_NOTEON + ((i * 3) + 3 << 8) +
                                      (127 << 16))
                else:
                    device.midiOutMsg(midi.MIDI_NOTEON + ((i * 3) + 3 << 8) +
                                      (0 << 16))

            except:
                break

    if LEDmode == 3:

        for i in range(0, 8):
            try:

                # left peak
                if mixer.getTrackPeaks(
                        0, 0) >= (i / 7) and mixer.isTrackMuted(0) == False:
                    device.midiOutMsg(midi.MIDI_NOTEON + ((i * 3) + 1 << 8) +
                                      (127 << 16))
                else:
                    device.midiOutMsg(midi.MIDI_NOTEON + ((i * 3) + 1 << 8) +
                                      (0 << 16))

                # right peak
                if mixer.getTrackPeaks(
                        0, 1) >= (i / 7) and mixer.isTrackMuted(0) == False:
                    device.midiOutMsg(midi.MIDI_NOTEON + ((i * 3) + 3 << 8) +
                                      (127 << 16))
                else:
                    device.midiOutMsg(midi.MIDI_NOTEON + ((i * 3) + 3 << 8) +
                                      (0 << 16))

            except:
                break

    if LEDmode == 4:

        for i in range(0, 8):
            try:

                # master peak
                if mixer.getTrackPeaks(
                        0, 2) >= (i / 7) and mixer.isTrackMuted(0) == False:
                    device.midiOutMsg(midi.MIDI_NOTEON + ((i * 3) + 1 << 8) +
                                      (127 << 16))
                else:
                    device.midiOutMsg(midi.MIDI_NOTEON + ((i * 3) + 1 << 8) +
                                      (0 << 16))

                # selected peak
                if mixer.getTrackPeaks(selectedTrack, 2) >= (
                        i / 7) and mixer.isTrackMuted(selectedTrack) == False:
                    device.midiOutMsg(midi.MIDI_NOTEON + ((i * 3) + 3 << 8) +
                                      (127 << 16))
                else:
                    device.midiOutMsg(midi.MIDI_NOTEON + ((i * 3) + 3 << 8) +
                                      (0 << 16))

            except:
                break