diff --git a/app/components/Platine.vue b/app/components/Platine.vue index 4390fb1..6800aa8 100644 --- a/app/components/Platine.vue +++ b/app/components/Platine.vue @@ -6,10 +6,13 @@ normal + -
{{ currentSpeed }}
+
{{ (currentSpeed).toFixed(2) }}
+ + + + + + + + + \ No newline at end of file diff --git a/app/pages/card/[slug].vue b/app/pages/card/[slug].vue index 874525d..24e31d3 100644 --- a/app/pages/card/[slug].vue +++ b/app/pages/card/[slug].vue @@ -1,15 +1,13 @@ + \ No newline at end of file diff --git a/app/pages/index.vue b/app/pages/index.vue index f37a6bb..60fb04b 100644 --- a/app/pages/index.vue +++ b/app/pages/index.vue @@ -1,95 +1,58 @@ - \ No newline at end of file + diff --git a/app/pages/random.vue b/app/pages/random.vue new file mode 100644 index 0000000..7ecdabd --- /dev/null +++ b/app/pages/random.vue @@ -0,0 +1,23 @@ + + + \ No newline at end of file diff --git a/app/utils/platine/disc.ts b/app/utils/platine/disc.ts index 8a2f427..b09261c 100644 --- a/app/utils/platine/disc.ts +++ b/app/utils/platine/disc.ts @@ -77,7 +77,7 @@ class Disc { private _inertiaFriction: number = 1 // Coefficient de frottement pour l'inertie (plus proche de 1 = plus long) private _lastDragVelocity: number = 0 // Dernière vitesse de drag private _lastDragTime: number = 0 // Dernier temps de drag - private _inertiaAmplification: number = 45 // Facteur d'amplification de l'inertie + private _inertiaAmplification: number = 25 // Facteur d'amplification de l'inertie private _previousDuration: number = 0 // Pour suivre les changements de durée public isReversed: boolean = false @@ -131,7 +131,7 @@ class Disc { this._draggingSpeeds = limit(this._draggingSpeeds, 10) this._playbackSpeed = average(this._draggingSpeeds) - this._playbackSpeed = clamp(this._playbackSpeed, -4, 4) + // this._playbackSpeed = clamp(this._playbackSpeed, -4, 4) } get secondsPlayed() { @@ -354,11 +354,11 @@ class Disc { this._inertiaVelocity = 0 this._isInertiaActive = false this._playbackSpeed = 0 - this._basePlaybackSpeed = 0 + this._basePlaybackSpeed = 1 this.el.style.transform = 'rotate(0rad)' - this.callbacks.onStop() - this._isPoweredOn = false - this.stop() + // this.callbacks.onStop() + // this._isPoweredOn = false + // this.stop() return 0 } // Arrêt à la fin (angle >= _maxAngle) diff --git a/app/utils/platine/sampler.ts b/app/utils/platine/sampler.ts index 9fe67b0..cc78b2c 100644 --- a/app/utils/platine/sampler.ts +++ b/app/utils/platine/sampler.ts @@ -132,6 +132,24 @@ class Sampler { unmute() { this.gainNode.gain.value = 1 } + + /** + * Définit le taux de lecture (vitesse de lecture) + * @param rate Taux de lecture (1.0 = vitesse normale, 0.5 = moitié de vitesse, 2.0 = double vitesse, etc.) + */ + setPlaybackRate(rate: number) { + if (!this.audioSource) return + + const currentTime = this.audioContext.currentTime + this.audioSource.playbackRate.cancelScheduledValues(currentTime) + this.audioSource.playbackRate.linearRampToValueAtTime( + Math.max(0.001, Math.abs(rate)), // Éviter les valeurs négatives ou nulles + currentTime + 0.05 // Petit délai pour éviter les clics + ) + + // Mettre à jour la vitesse actuelle + this.currentSpeed = rate + } } export default Sampler diff --git a/tailwind.config.js b/tailwind.config.js index 09a18ee..faa8397 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -42,8 +42,8 @@ module.exports = { '.debug': { position: 'fixed', 'z-index': '1000', - top: '16px', - right: '16px', + bottom: '16px', + right: '25%', background: '#9CA3AF', 'border-radius': '16px', padding: '16px'