plugin v1.0.1
Deploy / Deploy (push) Successful in 1m15s Details

This commit is contained in:
JotaChina 2025-11-23 14:36:24 -03:00
parent f80643b28b
commit 9d279d6bda
2 changed files with 400 additions and 415 deletions

View File

@ -1,7 +1,4 @@
/* =============================================== */
/* MMPCreator - Folha de Estilos Principal */
/* =============================================== */
:root {
--bg-body: #2d3035;
--bg-toolbar: #3b3f45;

View File

@ -70,16 +70,12 @@
</style>
</head>
<body>
<div class="studio-wrapper">
<aside class="sample-browser">
<div class="browser-header">Navegador de Samples</div>
<div class="browser-content" id="browser-content"></div>
</aside>
<button id="sidebar-toggle"><i class="fa-solid fa-caret-left"></i></button>
<div class="app-container">
<header class="global-toolbar">
<div class="control-group">
@ -322,7 +318,6 @@
</div>
<div id="track-container"></div>
</div>
<div class="piano-roll-editor" id="piano-roll-editor" style="display: none;">
<div class="editor-header">
<span>Piano Roll - <span id="piano-roll-instrument-name">Instrumento 1</span></span>
@ -355,8 +350,7 @@
<canvas id="piano-grid-canvas"></canvas>
</div>
</div>
</div>
</div>
<div class="audio-editor">
<div class="editor-header">
<span>Editor de Amostras de Áudio</span>
@ -489,7 +483,6 @@
</div>
</main>
</div>
</div>
<input
type="file"
id="mmp-file-input"
@ -536,18 +529,13 @@
// Variáveis de Controle
let currentTrackId = null;
// --- Configurações ---
const CONSTANTS = {
NOTE_HEIGHT: 20,
KEY_WIDTH: 60,
BEAT_WIDTH: 40, // Largura visual de 1 batida (Quarter Note)
TOTAL_KEYS: 84,
START_NOTE: 24,
// --- CORREÇÃO DE ESCALA ---
// O LMMS usa 192 ticks por batida (Quarter Note).
// Se nossa batida tem 40px de largura, a relação é:
TICKS_PER_PIXEL: 192 / 40 // = 4.8
BEAT_WIDTH: 40,
TOTAL_KEYS: 84, // 7 oitavas
START_NOTE: 24, // C1
TICKS_PER_PIXEL: 0 // Calculado dinamicamente
};
const pianoRollEditor = document.getElementById('piano-roll-editor');
@ -585,20 +573,20 @@
function resizeCanvas() {
const totalHeight = CONSTANTS.TOTAL_KEYS * CONSTANTS.NOTE_HEIGHT;
// Calcula a largura total baseada nos compassos definidos no input
const barsCount = parseInt(document.getElementById('bars-input')?.value || 1);
// 1 Compasso = 4 Batidas. Largura = Batidas * Largura da Batida
const totalWidth = (barsCount * 4) * CONSTANTS.BEAT_WIDTH;
// 64 compassos * 192 ticks / (ticks por beat) * largura... simplificando:
// Vamos fixar uma largura grande por enquanto
const totalWidth = 3000;
keysCanvas.width = CONSTANTS.KEY_WIDTH;
keysCanvas.height = totalHeight;
gridCanvas.width = totalWidth; // Ajusta largura ao tamanho real da música
gridCanvas.width = totalWidth;
gridCanvas.height = totalHeight;
// REMOVA ESTA LINHA ANTIGA:
// CONSTANTS.TICKS_PER_PIXEL = 48 / CONSTANTS.BEAT_WIDTH;
// Importante: Sincronizar a conversão de Pixel <-> Tick
// 1 Beat = 48 ticks (em 16th) ou 192 ticks por bar?
// No seu file.js: ticksPerStep = 12 (1/16).
// Então BEAT_WIDTH (40px) = 4 steps = 48 ticks.
CONSTANTS.TICKS_PER_PIXEL = 48 / CONSTANTS.BEAT_WIDTH;
drawKeys();
drawGrid();