|
|
|
@ -69,6 +69,7 @@ export function FreeFlow(){ |
|
|
|
const refContainer=useRef(); |
|
|
|
const refContainer=useRef(); |
|
|
|
|
|
|
|
|
|
|
|
const refCurrentCue= useRef(null); |
|
|
|
const refCurrentCue= useRef(null); |
|
|
|
|
|
|
|
const refData=useRef(data); |
|
|
|
|
|
|
|
|
|
|
|
const { history, status, reset, sendMessage, setStatus, audioOutput, setAudioOutput, stop:stopChat, |
|
|
|
const { history, status, reset, sendMessage, setStatus, audioOutput, setAudioOutput, stop:stopChat, |
|
|
|
audioUrl }=useChat(); |
|
|
|
audioUrl }=useChat(); |
|
|
|
@ -95,15 +96,18 @@ export function FreeFlow(){ |
|
|
|
console.log('onOsc', payload); |
|
|
|
console.log('onOsc', payload); |
|
|
|
const address=payload.addr; |
|
|
|
const address=payload.addr; |
|
|
|
const message=payload.args[0]; |
|
|
|
const message=payload.args[0]; |
|
|
|
|
|
|
|
const params=message.split('#'); |
|
|
|
|
|
|
|
|
|
|
|
switch(address){ |
|
|
|
switch(address){ |
|
|
|
case '/playcue': |
|
|
|
case OSC_ADDRESS.PLAY_CUE: |
|
|
|
// playCue(cuelist.find(c => c.id === message)); |
|
|
|
if(params[0]=='all' || params[0]==refData.current?.id) |
|
|
|
setNextCue(()=>message); |
|
|
|
setNextCue(()=>params[1]); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case '/stopcue': |
|
|
|
case OSC_ADDRESS.STOP_CUE: |
|
|
|
onStop(); |
|
|
|
if(params[0]=='all' || params[0]==refData.current?.id) |
|
|
|
|
|
|
|
onStop(); |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Handle OSC messages here |
|
|
|
// Handle OSC messages here |
|
|
|
@ -299,7 +303,7 @@ export function FreeFlow(){ |
|
|
|
sendOsc(OSC_ADDRESS.COUNTDOWN, '0'); // Reset countdown for non-chat cues |
|
|
|
sendOsc(OSC_ADDRESS.COUNTDOWN, '0'); // Reset countdown for non-chat cues |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
sendOscStatus(`${data.id}#playcue#${cue.id}`); |
|
|
|
sendOscStatus(OSC_ADDRESS.CLIENT_STATUS,`${data.id}#playcue#${cue.id}`); |
|
|
|
|
|
|
|
|
|
|
|
console.log('~~~~ clear pause timer'); |
|
|
|
console.log('~~~~ clear pause timer'); |
|
|
|
if(refPauseTimer.current) clearTimeout(refPauseTimer.current); |
|
|
|
if(refPauseTimer.current) clearTimeout(refPauseTimer.current); |
|
|
|
@ -356,7 +360,7 @@ export function FreeFlow(){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
resetTranscript(); // Reset transcript after cue ends |
|
|
|
resetTranscript(); // Reset transcript after cue ends |
|
|
|
sendOscStatus(`${data.id}#endcue#${cue.id}`); |
|
|
|
sendOscStatus(OSC_ADDRESS.CLIENT_STATUS, `${data.id}#endcue#${cue.id}`); |
|
|
|
|
|
|
|
|
|
|
|
if(cue.auto) { |
|
|
|
if(cue.auto) { |
|
|
|
playCue(cuelist.find(c => c.id === cue.nextcue)); |
|
|
|
playCue(cuelist.find(c => c.id === cue.nextcue)); |
|
|
|
@ -541,6 +545,8 @@ export function FreeFlow(){ |
|
|
|
if(refPauseTimer.current) clearTimeout(refPauseTimer.current); |
|
|
|
if(refPauseTimer.current) clearTimeout(refPauseTimer.current); |
|
|
|
refSpeechPaused.current=false; |
|
|
|
refSpeechPaused.current=false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sendOscStatus(OSC_ADDRESS.CLIENT_INPUT, `${data.id}#${transcript}`); // Send current input via OSC |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
},[transcript]); |
|
|
|
},[transcript]); |
|
|
|
@ -634,13 +640,14 @@ export function FreeFlow(){ |
|
|
|
<div className="bg-gray-100 text-4xl font-bold mb-4 flex justify-center items-center"> |
|
|
|
<div className="bg-gray-100 text-4xl font-bold mb-4 flex justify-center items-center"> |
|
|
|
{refCurrentCue.current?.name} |
|
|
|
{refCurrentCue.current?.name} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<Countdown ref={refTimer} /> |
|
|
|
<Countdown ref={refTimer} clientId={data.id}/> |
|
|
|
<button className="!bg-red-300" onClick={onStop}>Stop</button> |
|
|
|
<button className="!bg-red-300" onClick={onStop}>Stop</button> |
|
|
|
|
|
|
|
|
|
|
|
{/* <button onClick={saveImage}>Save image</button> */} |
|
|
|
{/* <button onClick={saveImage}>Save image</button> */} |
|
|
|
<NumPad onSend={onNumpad} |
|
|
|
<NumPad onSend={onNumpad} |
|
|
|
disabled={currentCue?.callback !== 'numpad'} |
|
|
|
disabled={currentCue?.callback !== 'numpad'} |
|
|
|
type={currentCue?.numpad_type} |
|
|
|
type={currentCue?.numpad_type} |
|
|
|
|
|
|
|
clientId={data.id} |
|
|
|
/> |
|
|
|
/> |
|
|
|
<Light ref={refLight} /> |
|
|
|
<Light ref={refLight} /> |
|
|
|
<VoiceAnalysis/> |
|
|
|
<VoiceAnalysis/> |
|
|
|
|