Version avec 56 boutons

This commit is contained in:
2026-03-26 23:46:43 +01:00
parent aa7bba900b
commit 8155a4dcef
2 changed files with 127 additions and 73 deletions

View File

@@ -2,83 +2,133 @@
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Soundboard Pro - Expert Edition</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Soundboard Pro Studio - 1080p</title>
<style>
:root { --bg: #0f0f0f; --panel-bg: #1e1e1e; --accent: #ffb703; --text: #eee; }
body { background: var(--bg); color: var(--text); margin: 0; font-family: sans-serif; overflow: hidden; }
:root {
--bg: #050505;
--panel-bg: #151515;
--accent: #00f2ff; /* Cyan néon pour le 1080p */
--danger: #ff004c;
--text: #ffffff;
}
header { height: 50px; background: #222; display: flex; align-items: center; padding: 0 15px; justify-content: space-between; border-bottom: 2px solid #333; }
.grid { display: grid; grid-template-columns: repeat(5, 1fr); grid-template-rows: repeat(6, 1fr); gap: 5px; height: calc(100vh - 50px); padding: 5px; box-sizing: border-box; }
.btn { background: #2a2a2a; border: 1px solid #444; border-radius: 8px; display: flex; align-items: center; justify-content: center; position: relative; font-size: 0.7rem; text-align: center; }
.btn.active { border-color: var(--accent); color: var(--accent); }
.btn.playing { background: #e63946; color: white; box-shadow: 0 0 10px #e63946; }
.btn.has-loop::after { content: "∞"; position: absolute; top: 2px; right: 5px; font-size: 12px; color: var(--accent); }
body {
background: var(--bg);
color: var(--text);
margin: 0;
font-family: 'Segoe UI', Roboto, sans-serif;
overflow: hidden;
height: 100vh;
}
/* Overlay / Panneau d'édition */
/* Header Studio */
header {
height: 80px;
background: linear-gradient(180deg, #222 0%, #111 100%);
display: flex;
align-items: center;
padding: 0 30px;
justify-content: space-between;
border-bottom: 3px solid #333;
box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
/* Grille Full HD (8 colonnes x 8 lignes = 64 boutons) */
.grid {
display: grid;
grid-template-columns: repeat(8, 1fr);
grid-template-rows: repeat(8, 1fr);
gap: 10px;
height: calc(100vh - 80px);
padding: 15px;
box-sizing: border-box;
}
.btn {
background: #1a1a1a;
border: 1px solid #333;
border-radius: 6px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
position: relative;
font-size: 0.9rem;
font-weight: 500;
transition: all 0.1s ease;
cursor: pointer;
box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
}
.btn:hover { background: #222; border-color: #555; }
.btn.active { border-color: #444; color: #aaa; }
.btn.playing {
background: var(--danger);
color: white;
box-shadow: 0 0 20px var(--danger), inset 0 0 15px rgba(0,0,0,0.3);
border-color: white;
transform: scale(0.98);
}
.btn-num { position: absolute; top: 5px; left: 8px; font-size: 0.7rem; color: #555; }
.loop-tag { position: absolute; bottom: 5px; right: 8px; font-size: 14px; color: var(--accent); opacity: 0; }
.btn.has-loop .loop-tag { opacity: 1; }
/* Modale d'édition centrée (Style Desktop) */
#editOverlay {
position: fixed; top: 0; left: 0; width: 100%; height: 100%;
background: rgba(0,0,0,0.8); display: none; z-index: 100;
align-items: flex-end;
background: rgba(0,0,0,0.9); display: none; z-index: 100;
justify-content: center; align-items: center;
}
#editPanel {
background: var(--panel-bg); width: 100%; padding: 20px;
border-radius: 20px 20px 0 0; box-sizing: border-box;
transform: translateY(100%); transition: transform 0.3s ease;
background: var(--panel-bg); width: 500px; padding: 40px;
border-radius: 15px; border: 2px solid var(--accent);
box-shadow: 0 0 50px rgba(0,242,255,0.2);
}
#editOverlay.show { display: flex; }
#editOverlay.show #editPanel { transform: translateY(0); }
.form-group { margin-bottom: 15px; }
label { display: block; margin-bottom: 5px; color: #888; font-size: 0.9rem; }
input[type="text"], input[type="range"] { width: 100%; padding: 10px; background: #333; border: 1px solid #444; color: white; border-radius: 5px; box-sizing: border-box; }
.actions { display: flex; gap: 10px; margin-top: 20px; }
.actions button { flex: 1; padding: 15px; border: none; border-radius: 8px; font-weight: bold; cursor: pointer; }
input[type="text"], input[type="range"] {
width: 100%; padding: 12px; margin: 10px 0; background: #000;
border: 1px solid #444; color: white; border-radius: 4px;
}
.actions { display: flex; gap: 15px; margin-top: 30px; }
.actions button { flex: 1; padding: 15px; border-radius: 5px; font-weight: bold; border: none; cursor: pointer; }
.btn-save { background: var(--accent); color: black; }
.btn-cancel { background: #444; color: white; }
.btn-file { background: #219ebc; color: white; margin-bottom: 10px; width: 100%; }
.btn-cancel { background: #333; color: white; }
body.edit-mode .btn { border: 1px dashed var(--accent); }
body.edit-mode .btn { border: 1px dashed var(--accent); cursor: crosshair; }
.stop-all { background: var(--danger); color: white; border: none; padding: 12px 25px; border-radius: 4px; font-weight: bold; cursor: pointer; }
</style>
</head>
<body>
<header>
<div id="status">MODE LECTURE</div>
<button onclick="toggleEditMode()" id="toggleBtn" style="padding: 5px 15px;">ÉDITER</button>
<button class="stop-all" onclick="stopAll()">🛑 STOP ALL</button>
<button onclick="toggleEditMode()" id="toggleBtn" style="padding: 12px 30px; border-radius: 4px; font-weight: bold;">MODE ÉDITION</button>
</header>
<div class="grid" id="board"></div>
<div id="editOverlay" onclick="closeEditIfOutside(event)">
<div id="editPanel" onclick="event.stopPropagation()">
<h3 id="editTitle" style="margin-top:0">Paramètres du bouton</h3>
<div id="editOverlay">
<div id="editPanel">
<h2 id="editTitle" style="margin-top:0; color:var(--accent)">Configuration Bouton</h2>
<label>Nom de l'échantillon</label>
<input type="text" id="inputName">
<div class="form-group">
<label>Nom du bouton</label>
<input type="text" id="inputName" placeholder="Entrez un nom...">
<button onclick="document.getElementById('fileInput').click()" style="width:100%; padding:15px; margin:15px 0; background:#333; color:white; border:1px solid #555; border-radius:4px;">📁 CHARGER LE FICHIER AUDIO</button>
<center><small id="fileNameLabel" style="color:#777"></small></center>
<div style="margin-top:20px;">
<input type="checkbox" id="inputLoop"> <label>Activer la boucle infinie</label>
</div>
<div class="form-group">
<button class="btn-file" onclick="document.getElementById('fileInput').click()">📁 CHOISIR UN FICHIER SON</button>
<small id="fileNameLabel" style="color:#666; display:block"></small>
</div>
<div class="form-group" style="display:flex; align-items:center; gap:10px;">
<input type="checkbox" id="inputLoop" style="width:20px; height:20px;">
<label for="inputLoop" style="margin:0">Activer la boucle (Loop)</label>
</div>
<div class="form-group">
<label>Volume</label>
<input type="range" id="inputVolume" min="0" max="1" step="0.1" value="1">
</div>
<label style="margin-top:20px; display:block">Volume (Gain)</label>
<input type="range" id="inputVolume" min="0" max="1" step="0.01" value="1">
<div class="actions">
<button class="btn-cancel" onclick="closeEdit()">ANNULER</button>
<button class="btn-save" onclick="saveSettings()">ENREGISTRER</button>
<button class="btn-save" onclick="saveSettings()">APPLIQUER</button>
</div>
</div>
</div>
@@ -90,8 +140,8 @@
let editingIndex = null;
let tempFileData = null;
// Données des boutons
let btnData = JSON.parse(localStorage.getItem('sb_pro_data')) || Array(30).fill(null).map((_, i) => ({
// Données pour 64 boutons (Grille 8x8)
let btnData = JSON.parse(localStorage.getItem('sb_studio_data')) || Array(64).fill(null).map((_, i) => ({
id: i, name: "", file: null, loop: false, volume: 1
}));
@@ -104,7 +154,9 @@
const div = document.createElement('div');
div.className = `btn ${data.file ? 'active' : ''} ${data.loop ? 'has-loop' : ''}`;
div.id = `btn-${i}`;
div.innerHTML = `<span>${data.name || (i+1)}</span>`;
div.innerHTML = `<span class="btn-num">${i+1}</span>
<span style="padding:10px">${data.name || "-"}</span>
<span class="loop-tag">∞</span>`;
div.onclick = () => handleBtnClick(i);
board.appendChild(div);
});
@@ -113,19 +165,16 @@
function toggleEditMode() {
isEditMode = !isEditMode;
document.body.classList.toggle('edit-mode', isEditMode);
document.getElementById('status').innerText = isEditMode ? "MODE ÉDITION" : "MODE LECTURE";
document.getElementById('toggleBtn').innerText = isEditMode ? "QUITTER" : "ÉDITER";
document.getElementById('toggleBtn').innerText = isEditMode ? "QUITTER L'ÉDITION" : "MODE ÉDITION";
document.getElementById('toggleBtn').style.background = isEditMode ? "var(--accent)" : "#444";
document.getElementById('toggleBtn').style.color = isEditMode ? "black" : "white";
}
function handleBtnClick(i) {
if (isEditMode) {
openEdit(i);
} else {
playSound(i);
}
if (isEditMode) openEdit(i);
else playSound(i);
}
// --- LOGIQUE LECTURE ---
function playSound(i) {
const data = btnData[i];
if (!data.file) return;
@@ -144,7 +193,13 @@
}
}
// --- LOGIQUE ÉDITION ---
function stopAll() {
Object.keys(players).forEach(key => {
players[key].pause(); players[key].currentTime = 0;
document.getElementById(`btn-${key}`).classList.remove('playing');
});
}
function openEdit(i) {
editingIndex = i;
const data = btnData[i];
@@ -152,10 +207,9 @@
document.getElementById('inputName').value = data.name;
document.getElementById('inputLoop').checked = data.loop;
document.getElementById('inputVolume').value = data.volume || 1;
document.getElementById('fileNameLabel').innerText = data.file ? "Fichier chargé" : "Aucun fichier";
document.getElementById('fileNameLabel').innerText = data.file ? "Audio présent" : "Audio vide";
tempFileData = data.file;
document.getElementById('editOverlay').classList.add('show');
document.getElementById('editOverlay').style.display = 'flex';
}
document.getElementById('fileInput').onchange = (e) => {
@@ -164,7 +218,7 @@
const reader = new FileReader();
reader.onload = (ev) => {
tempFileData = ev.target.result;
document.getElementById('fileNameLabel').innerText = "Nouveau fichier : " + file.name;
document.getElementById('fileNameLabel').innerText = "Fichier : " + file.name;
};
reader.readAsDataURL(file);
}
@@ -175,16 +229,13 @@
btnData[editingIndex].loop = document.getElementById('inputLoop').checked;
btnData[editingIndex].volume = parseFloat(document.getElementById('inputVolume').value);
btnData[editingIndex].file = tempFileData;
localStorage.setItem('sb_pro_data', JSON.stringify(btnData));
if (players[editingIndex]) delete players[editingIndex]; // Reset audio pour appliquer changements
localStorage.setItem('sb_studio_data', JSON.stringify(btnData));
if (players[editingIndex]) delete players[editingIndex];
closeEdit();
init();
}
function closeEdit() { document.getElementById('editOverlay').classList.remove('show'); }
function closeEditIfOutside(e) { if(e.target.id === 'editOverlay') closeEdit(); }
function closeEdit() { document.getElementById('editOverlay').style.display = 'none'; }
init();
</script>
</body>

3
public/readme.md Normal file
View File

@@ -0,0 +1,3 @@
Vous pouvez trouver des sons sur https://boardsounds.com/fr