Class UpdateParticipantAudioDecibels

Updates or adds a participant's audio decibel data in the array.

This method checks if a participant's name exists in the audio decibels array. If it does, it updates the participant's averageLoudness; otherwise, it adds a new entry. After modification, it calls updateAudioDecibels to apply the changes to the array.

The options for updating participant audio decibels.

The name of the participant.

The current average loudness of the participant.

The array of current audio decibel entries.

The function to update the audio decibels array.

  • This function does not return a value.
const audioDecibels = [
{ name: 'Alice', averageLoudness: -10 },
{ name: 'Bob', averageLoudness: -12 },
];

const updateAudioDecibels = (newDecibels) => {
console.log('Updated audio decibels:', newDecibels);
};

const updateService = new UpdateParticipantAudioDecibels();

// Update existing participant
updateService.updateParticipantAudioDecibels({
name: 'Alice',
averageLoudness: -8,
audioDecibels,
updateAudioDecibels,
});

// Add a new participant
updateService.updateParticipantAudioDecibels({
name: 'Charlie',
averageLoudness: -15,
audioDecibels,
updateAudioDecibels,
});

Constructors

Methods