fix: sometimes wouldnt start the first time
This commit is contained in:
parent
2efbb68627
commit
72b963fb21
2 changed files with 13 additions and 5 deletions
|
|
@ -68,12 +68,20 @@ function useCycle(props: UseCycleProps) {
|
|||
Tone.getTransport().start('+0.1');
|
||||
};
|
||||
const stop = () => {
|
||||
console.log('stop');
|
||||
setStarted(false);
|
||||
Tone.getTransport().pause();
|
||||
setStarted(false);
|
||||
};
|
||||
const toggle = () => (started ? stop() : start());
|
||||
return { start, stop, setStarted, onEvent, started, toggle, query, activeCycle };
|
||||
return {
|
||||
start,
|
||||
stop,
|
||||
onEvent,
|
||||
started,
|
||||
setStarted,
|
||||
toggle,
|
||||
query,
|
||||
activeCycle,
|
||||
};
|
||||
}
|
||||
|
||||
export default useCycle;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue