Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions components/PatternDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const isSinglePassCompositeShader = (shaderFile: string) => {

const isCircularLayoutShader = (shaderFile: string) => {
// v0.39 and v0.40 are NOT circular (they're horizontal). v0.38 IS circular. v0.45 IS circular. v0.46 IS circular.
return shaderFile.includes('v0.25') || shaderFile.includes('v0.26') || shaderFile.includes('v0.35') || shaderFile.includes('v0.37') || shaderFile.includes('v0.38') || shaderFile.includes('v0.45') || shaderFile.includes('v0.46') || shaderFile.includes('v0.47') || shaderFile.includes('v0.48') || shaderFile.includes('v0.49') || shaderFile.includes('v0.50');
return shaderFile.includes('v0.25') || shaderFile.includes('v0.26') || shaderFile.includes('v0.35') || shaderFile.includes('v0.37') || shaderFile.includes('v0.38') || shaderFile.includes('v0.42') || shaderFile.includes('v0.45') || shaderFile.includes('v0.46') || shaderFile.includes('v0.47') || shaderFile.includes('v0.48') || shaderFile.includes('v0.49') || shaderFile.includes('v0.50');
};

const shouldUseBackgroundPass = (shaderFile: string) => {
Expand Down Expand Up @@ -1318,7 +1318,7 @@ export const PatternDisplay: React.FC<PatternDisplayProps> = ({

deviceRef.current = device; contextRef.current = context; uniformBufferRef.current = uniformBuffer;

const isHighPrec = shaderFile.includes('v0.36') || shaderFile.includes('v0.37') || shaderFile.includes('v0.38') || shaderFile.includes('v0.39') || shaderFile.includes('v0.40') || shaderFile.includes('v0.43') || shaderFile.includes('v0.44') || shaderFile.includes('v0.45') || shaderFile.includes('v0.46') || shaderFile.includes('v0.47') || shaderFile.includes('v0.48') || shaderFile.includes('v0.49') || shaderFile.includes('v0.50');
const isHighPrec = shaderFile.includes('v0.36') || shaderFile.includes('v0.37') || shaderFile.includes('v0.38') || shaderFile.includes('v0.39') || shaderFile.includes('v0.40') || shaderFile.includes('v0.42') || shaderFile.includes('v0.43') || shaderFile.includes('v0.44') || shaderFile.includes('v0.45') || shaderFile.includes('v0.46') || shaderFile.includes('v0.47') || shaderFile.includes('v0.48') || shaderFile.includes('v0.49') || shaderFile.includes('v0.50');
const packFunc = isHighPrec ? packPatternMatrixHighPrecision : packPatternMatrix;
cellsBufferRef.current = createBufferWithData(device, packFunc(matrix, padTopChannel), GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST);

Expand Down Expand Up @@ -1409,7 +1409,7 @@ export const PatternDisplay: React.FC<PatternDisplayProps> = ({
console.log(`[PatternDisplay] Updating cells buffer: matrix=${matrix ? 'yes' : 'null'}, rows=${matrix?.numRows}, channels=${matrix?.numChannels}`);

if (cellsBufferRef.current) cellsBufferRef.current.destroy();
const isHighPrec = shaderFile.includes('v0.36') || shaderFile.includes('v0.37') || shaderFile.includes('v0.38') || shaderFile.includes('v0.39') || shaderFile.includes('v0.40') || shaderFile.includes('v0.43') || shaderFile.includes('v0.44') || shaderFile.includes('v0.45') || shaderFile.includes('v0.46') || shaderFile.includes('v0.47') || shaderFile.includes('v0.48') || shaderFile.includes('v0.49') || shaderFile.includes('v0.50');
const isHighPrec = shaderFile.includes('v0.36') || shaderFile.includes('v0.37') || shaderFile.includes('v0.38') || shaderFile.includes('v0.39') || shaderFile.includes('v0.40') || shaderFile.includes('v0.42') || shaderFile.includes('v0.43') || shaderFile.includes('v0.44') || shaderFile.includes('v0.45') || shaderFile.includes('v0.46') || shaderFile.includes('v0.47') || shaderFile.includes('v0.48') || shaderFile.includes('v0.49') || shaderFile.includes('v0.50');
const packFunc = isHighPrec ? packPatternMatrixHighPrecision : packPatternMatrix;
const packedData = packFunc(matrix, padTopChannel);

Expand Down
16 changes: 13 additions & 3 deletions public/shaders/patternv0.38.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -238,15 +238,18 @@ fn fs(in: VertexOut) -> @location(0) vec4<f32> {
let effCmd = (in.packedB >> 8) & 255u;
let effVal = in.packedB & 255u;

let hasNote = (note > 0u);
// OpenMPT numeric encoding: 1-120 = regular notes, 121 = OFF, 122 = CUT, 123 = FADE
let hasNote = (note > 0u) && (note <= 120u);
let isNoteOff = (note == 121u);
let isNoteCut = (note == 122u) || (note == 123u);
let hasExpression = (volCmd > 0u) || (effCmd > 0u);
let ch = channels[in.channel];
let isMuted = (ch.isMuted == 1u);

let topUV = btnUV - vec2(0.5, 0.16);
let topSize = vec2(0.20, 0.20);
let isDataPresent = hasExpression && !isMuted;
let topColorBase = vec3(0.0, 0.9, 1.0);
let topColorBase = vec3(1.0, 0.65, 0.10); // amber = volume/expression indicator
let topColor = topColorBase * select(0.0, 1.5 + bloom, isDataPresent);
let topLed = drawChromeIndicator(topUV, topSize, topColor, isDataPresent, aa);
finalColor = mix(finalColor, topLed.rgb, topLed.a);
Expand All @@ -257,7 +260,14 @@ fn fs(in: VertexOut) -> @location(0) vec4<f32> {
var noteColor = vec3(0.2);
var lightAmount = 0.0;

if (hasNote) {
// Note-off / note-cut: show as dim red/orange main indicator
if (isNoteOff) {
noteColor = vec3(0.45, 0.05, 0.05);
lightAmount = 0.6;
} else if (isNoteCut) {
noteColor = vec3(0.60, 0.20, 0.02);
lightAmount = 0.5;
} else if (hasNote) {
let pitchHue = pitchClassFromIndex(note);
let baseColor = neonPalette(pitchHue);
let instBand = inst & 15u;
Expand Down
Loading
Loading