Skip to content

Better quality of life for Modulators #22

@Kashumy

Description

@Kashumy

Im not programming in TS. But it would be cool like in my beepmod , if you will add show mod values
in my code it looks like this.
And add preference differentMod below 'use old mod notes'.
its very helping thing or just add it to your pref idk?

if (this._doc.song.getChannelIsMod(this._doc.channel) && this._doc.prefs.differentMod) {
	for (let p = 0; p < note.pins.length; p++) {
		const pin = note.pins[p];
		if (p === 0 || pin.size !== note.pins[p - 1].size) {
			const cap = this._doc.song.getVolumeCap(
				true,
				this._doc.channel,
				this._doc.getCurrentInstrument(this._barOffset),
				pitch
			);
			let x = this._partWidth * (note.start + pin.time);
			const topY = this._pitchToPixelHeight(pitch + pin.interval - this._octaveOffset) -
				((this._pitchHeight - this._pitchBorder) / 2 + 1) * (pin.size / cap);
			const y = topY - 10;
			if (p === 0) x += 10;
			if (p === note.pins.length - 1) x -= 10;
			
			const textEl = document.createElementNS(svgNS, "text");
			textEl.setAttribute("x", prettyNumber(x));
			textEl.setAttribute("y", prettyNumber(y));
			textEl.setAttribute("fill", "white");
			textEl.setAttribute("font-size", "5");
			textEl.setAttribute("text-anchor", "middle");
			const setting = this._doc.song.channels[this._doc.channel].instruments[this._doc.getCurrentInstrument(this._barOffset)].modulators[Config.modCount - 1 - note.pitches[0]];
			
			if (Config.modulators[setting].divider && (Config.modulators[setting].valueRealAdd || (!isNaN(Config.modulators[setting].valueRealAdd) && Config.modulators[setting].valueRealAdd == 0))) {
				textEl.textContent = (((pin.size + Config.modulators[setting].convertRealFactor + Config.modulators[setting].valueRealAdd) / Config.modulators[setting].divider) - 0.2).toFixed(1);
			} else if (Config.modulators[setting].valueRealAdd) {
				textEl.textContent = ((pin.size + Config.modulators[setting].convertRealFactor + Config.modulators[setting].valueRealAdd));
			} else if (Config.modulators[setting].divider) {
				function floorTo1(num) {
					return Math.floor(num * 10) / 10;
				}
				textEl.textContent = floorTo1(
					(pin.size + Config.modulators[setting].convertRealFactor) / Config.modulators[setting].divider
				);
			} else {
				textEl.textContent = ((pin.size + Config.modulators[setting].convertRealFactor));
			}
			this._svgNoteContainer.appendChild(textEl);
		}
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions