WIP starbook demo
This commit is contained in:
@@ -105,6 +105,26 @@ class Sampler {
|
||||
this.audioSource.stop()
|
||||
}
|
||||
|
||||
/**
|
||||
* Inverse la direction de lecture
|
||||
* @returns La nouvelle direction (true = inversé, false = normal)
|
||||
*/
|
||||
reverse(secondsPlayed: number = 0): boolean {
|
||||
if (!this.audioBuffer) return false
|
||||
|
||||
// Inverser la direction
|
||||
this.isReversed = !this.isReversed
|
||||
|
||||
// Si on a une position, on relance la lecture à cette position
|
||||
if (secondsPlayed > 0) {
|
||||
// S'assurer que la position est dans les limites
|
||||
const safePosition = Math.max(0, Math.min(secondsPlayed, this.duration))
|
||||
this.play(safePosition)
|
||||
}
|
||||
|
||||
return this.isReversed
|
||||
}
|
||||
|
||||
mute() {
|
||||
this.gainNode.gain.value = 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user