|
|
|
|
@ -1,5 +1,6 @@ |
|
|
|
|
import { useState, useEffect, useRef } from "react"; |
|
|
|
|
import {Howl, Howler} from 'howler'; |
|
|
|
|
import { invoke } from "@tauri-apps/api/core"; |
|
|
|
|
import "./App.css"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -29,6 +30,17 @@ function App() { |
|
|
|
|
const refCue = useRef(null); |
|
|
|
|
const refNextCue = useRef(null); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function sendOsc(addr, message){ |
|
|
|
|
|
|
|
|
|
invoke('send_osc_message', { |
|
|
|
|
key: addr, |
|
|
|
|
message, |
|
|
|
|
host:'0.0.0.0:0', |
|
|
|
|
target:'192.168.234.255:8000', |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
function onfade(e){ |
|
|
|
|
console.log('onfade', e); |
|
|
|
|
|
|
|
|
|
@ -37,6 +49,11 @@ function App() { |
|
|
|
|
refNextCue.current = null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(refAudioBg.current.volume() === 0) { |
|
|
|
|
refAudioBg.current.stop(); |
|
|
|
|
// refAudioBg.current = null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
function onAnounceFade(e){ |
|
|
|
|
console.log('onAnounceFade', e); |
|
|
|
|
@ -116,6 +133,12 @@ function App() { |
|
|
|
|
console.warn('Unknown cue type:', type); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(props.clientCue){ |
|
|
|
|
sendOsc('/playcue', props.clientCue); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
function stop() { |
|
|
|
|
console.log('Stop all audio'); |
|
|
|
|
@ -125,6 +148,9 @@ function App() { |
|
|
|
|
if(refAudioAnnounce.current) { |
|
|
|
|
refAudioAnnounce.current.fade(1,0, fadeDuration*1000); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
sendOsc('/stopcue',''); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
function secondToTime(seconds) { |
|
|
|
|
const minutes = Math.floor(seconds / 60); |
|
|
|
|
@ -203,7 +229,7 @@ function App() { |
|
|
|
|
<th>Type</th> |
|
|
|
|
<th>Auto</th> |
|
|
|
|
<th>Audio / Due</th> |
|
|
|
|
|
|
|
|
|
<th>clientCue</th> |
|
|
|
|
</tr> |
|
|
|
|
</thead> |
|
|
|
|
<tbody> |
|
|
|
|
@ -226,7 +252,7 @@ function App() { |
|
|
|
|
<td>{EmojiType[type]}</td> |
|
|
|
|
<td>{auto ? '⤵️' : ''}</td> |
|
|
|
|
<td>{audioFile || props.duration} {props.callback && `<${props.callback}>`}</td> |
|
|
|
|
|
|
|
|
|
<td className={`${props.clientCue&& 'bg-green-300 rounded-full text-center font-[900]'}`}>{props.clientCue || ''}</td> |
|
|
|
|
</tr> |
|
|
|
|
))} |
|
|
|
|
</tbody> |
|
|
|
|
|