Skip to content

Commit

Permalink
fix copyright detection
Browse files Browse the repository at this point in the history
  • Loading branch information
spessasus committed Sep 28, 2024
1 parent 7949833 commit 2413cd3
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 41 deletions.
1 change: 1 addition & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/spessasynth_lib/midi_parser/midi_loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ class MIDI extends BasicMIDI
if(this.RMIDInfo['ICOP'])
{
copyrightDetected = true;
this.copyright = readBytesAsString(this.RMIDInfo['ICOP'], this.RMIDInfo['ICOP'].length);
this.copyright = readBytesAsString(this.RMIDInfo['ICOP'], this.RMIDInfo['ICOP'].length, undefined, false).replaceAll("\n", " ");
}
if(this.RMIDInfo['INAM'])
{
this.rawMidiName = this.RMIDInfo[RMIDINFOChunks.name];
this.midiName = readBytesAsString(this.rawMidiName, this.rawMidiName.length, undefined, false);
this.midiName = readBytesAsString(this.rawMidiName, this.rawMidiName.length, undefined, false).replaceAll("\n", " ");
nameDetected = true;
}
// these can be used interchangeably
Expand Down
14 changes: 8 additions & 6 deletions src/spessasynth_lib/synthetizer/worklet_processor.min.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
cd "$(dirname "$0")"
cd "$(dirname "$0")" || exit
esbuild worklet_processor.js --bundle --minify --format=esm --outfile=../worklet_processor.min.js --platform=browser
echo "Processor minifed succesfully"
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ export function controllerChange(channel, controllerNumber, controllerValue, for
channelObject.midiControllers[actualCCNum] = (channelObject.midiControllers[actualCCNum] & 0x3F80) | (controllerValue & 0x7F);
channelObject.voices.forEach(v => computeModulators(v, channelObject.midiControllers, 1, actualCCNum));
}
switch (controllerNumber) {
switch (controllerNumber)
{
case midiControllers.allNotesOff:
this.stopAll(channel);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import { absCentsToHz, timecentsToSeconds } from '../worklet_utilities/unit_conv
import { getLFOValue } from '../worklet_utilities/lfo.js'
import { customControllers } from '../worklet_utilities/worklet_processor_channel.js'
import { WorkletModulationEnvelope } from '../worklet_utilities/modulation_envelope.js'
import { getSampleLinear, getSampleNearest, interpolationTypes } from '../worklet_utilities/wavetable_oscillator.js'
import {
getSampleLinear,
getSampleNearest,
interpolationTypes,
} from '../worklet_utilities/wavetable_oscillator.js'
import { panVoice } from '../worklet_utilities/stereo_panner.js'
import { WorkletLowpassFilter } from '../worklet_utilities/lowpass_filter.js'
import { MIN_NOTE_LENGTH } from '../main_processor.js'
Expand Down Expand Up @@ -149,13 +153,16 @@ export function renderVoice(
const bufferOut = new Float32Array(outputLeft.length);

// wavetable oscillator
if(this.interpolationType === interpolationTypes.linear)
switch(this.interpolationType)
{
getSampleLinear(voice, bufferOut);
}
else
{
getSampleNearest(voice, bufferOut);
case interpolationTypes.linear:
default:
getSampleLinear(voice, bufferOut);
break;

case interpolationTypes.nearestNeighbor:
getSampleNearest(voice, bufferOut);
break;
}

// lowpass filter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
*/
export const interpolationTypes = {
linear: 0,
nearestNeighbor: 1
nearestNeighbor: 1,
fourthOrder: 2,
}


Expand Down Expand Up @@ -51,13 +52,6 @@ export function getSampleLinear(voice, outputBuffer)
const lower = sampleData[floor];
outputBuffer[i] = (lower + (upper - lower) * fraction);

// commented code because it's probably gonna come handy... (it did like 6 times already :/)
// if(isNaN(outputBuffer[i]))
// {
// console.error(voice, upper, lower, floor, ceil, cur)
// throw "NAN ALERT";
// }

cur += voice.sample.playbackStep * voice.currentTuningCalculated;
}
}
Expand Down
7 changes: 1 addition & 6 deletions src/website/js/settings_ui/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,7 @@ class SpessaSynthSettings
{
if(this.musicMode.visible === false)
{
try
{
await document.body.requestFullscreen();
}
catch (e) {}
await new Promise(r => setTimeout(r,500));
this.hideTopPart();
}
this.musicMode.setVisibility(!this.musicMode.visible, document.getElementById("keyboard_canvas_wrapper"));
this.renderer.renderBool = !this.musicMode.visible;
Expand Down
2 changes: 1 addition & 1 deletion src/website/js/utils/patch_names.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export const midiPatchNames = [
"Seashore",
"Bird Tweet",
"Telephone Ring",
"Helicopter",
"Attack Helicopter",
"Applause",
"Gunshot"
];
4 changes: 2 additions & 2 deletions src/website/minified/demo_main.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/website/minified/local_main.min.js

Large diffs are not rendered by default.

8 changes: 3 additions & 5 deletions src/website/minify_website.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
#!/bin/bash
cd "$(dirname "$0")"
cd "$(dirname "$0")" || exit

cd ../spessasynth_lib/synthetizer/worklet_system
cd ../spessasynth_lib/synthetizer/worklet_system || exit
chmod +x minify_processor.sh
./minify_processor.sh

cd ../../../website

ls
cd ../../../website || exit

esbuild ./js/main/local_main.js --bundle --minify --format=esm --outfile=minified/local_main.min.js --platform=browser
esbuild ./js/main/demo_main.js --bundle --minify --format=esm --outfile=minified/demo_main.min.js --platform=browser
Expand Down

0 comments on commit 2413cd3

Please sign in to comment.