add textAudioInput component
This commit is contained in:
parent
24e2453e7c
commit
6d20af467e
8 changed files with 22 additions and 16 deletions
|
|
@ -7,7 +7,7 @@
|
||||||
@click="emittMessage"
|
@click="emittMessage"
|
||||||
>
|
>
|
||||||
<MessageVisualizer />
|
<MessageVisualizer />
|
||||||
<InputVisualizer />
|
<TextAudioInput />
|
||||||
</svg>
|
</svg>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -17,7 +17,7 @@ import Messages from "./mockMessages";
|
||||||
|
|
||||||
// child components
|
// child components
|
||||||
import MessageVisualizer from "./messageVisualizer/index.vue";
|
import MessageVisualizer from "./messageVisualizer/index.vue";
|
||||||
import InputVisualizer from "@/components/inputVisualizer/index.vue";
|
import TextAudioInput from "@/components/taInput/index.vue";
|
||||||
|
|
||||||
// event emitter
|
// event emitter
|
||||||
import { Mitt } from "@/types/mitt/index";
|
import { Mitt } from "@/types/mitt/index";
|
||||||
|
|
@ -25,7 +25,7 @@ import { Mitt } from "@/types/mitt/index";
|
||||||
import { defineComponent, ref, inject } from "vue";
|
import { defineComponent, ref, inject } from "vue";
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "Messenger",
|
name: "Messenger",
|
||||||
components: { MessageVisualizer, InputVisualizer },
|
components: { MessageVisualizer, TextAudioInput },
|
||||||
setup() {
|
setup() {
|
||||||
const messages = Messages;
|
const messages = Messages;
|
||||||
const count = ref(0);
|
const count = ref(0);
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,13 @@
|
||||||
fill="#b9b9b9"
|
fill="#b9b9b9"
|
||||||
/>
|
/>
|
||||||
<svg>
|
<svg>
|
||||||
<g rx="20" id="Group_125" data-name="Group 125" v-for="(path, index) in paths">
|
<g
|
||||||
|
rx="20"
|
||||||
|
id="Group_125"
|
||||||
|
data-name="Group 125"
|
||||||
|
v-for="(path, index) in paths"
|
||||||
|
:key="path.identifier"
|
||||||
|
>
|
||||||
<path
|
<path
|
||||||
:key="index"
|
:key="index"
|
||||||
id="path"
|
id="path"
|
||||||
|
|
@ -47,7 +53,6 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
setup(props) {
|
setup(props) {
|
||||||
const emitter: any = inject("mitt");
|
const emitter: any = inject("mitt");
|
||||||
function audioSend() {}
|
|
||||||
|
|
||||||
const center = computed(() => {
|
const center = computed(() => {
|
||||||
if (props.bubbleWidth) {
|
if (props.bubbleWidth) {
|
||||||
|
|
@ -9,7 +9,7 @@ interface AudioPath {
|
||||||
color: string;
|
color: string;
|
||||||
draw: boolean;
|
draw: boolean;
|
||||||
}
|
}
|
||||||
export default function useStreamVisualizer(draw: Ref<boolean>) {
|
export default function useAudioVisualizer(draw: Ref<boolean>) {
|
||||||
const audioContext = new AudioContext();
|
const audioContext = new AudioContext();
|
||||||
const analyzer = audioContext.createAnalyser();
|
const analyzer = audioContext.createAnalyser();
|
||||||
analyzer.fftSize = 128;
|
analyzer.fftSize = 128;
|
||||||
|
|
@ -5,14 +5,14 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
// input child components
|
// input child components
|
||||||
import TextInput from "./visualizerDetails/text.vue";
|
import TextInput from "./textDetails/text.vue";
|
||||||
import AudioStream from "./visualizerDetails/audio.vue";
|
import AudioStream from "./audioDetails/audio.vue";
|
||||||
|
|
||||||
import useInputVisualizer from "./visualizer";
|
import useInputController from "./inputController";
|
||||||
|
|
||||||
import { defineComponent } from "vue";
|
import { defineComponent } from "vue";
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "InputVisualizer",
|
name: "TextAudioInput",
|
||||||
components: { TextInput, AudioStream },
|
components: { TextInput, AudioStream },
|
||||||
setup() {
|
setup() {
|
||||||
// get text input
|
// get text input
|
||||||
|
|
@ -27,7 +27,7 @@ export default defineComponent({
|
||||||
textInputXoffset,
|
textInputXoffset,
|
||||||
audioBubbleWidth,
|
audioBubbleWidth,
|
||||||
paths,
|
paths,
|
||||||
} = useInputVisualizer();
|
} = useInputController();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
input,
|
input,
|
||||||
|
|
@ -4,18 +4,19 @@ import useKeyDownHandler from "@/composables/keyDownHandler/useKeyDownHandler";
|
||||||
|
|
||||||
import useMediaStream from "@/utils/mediaStream/useMediaStream";
|
import useMediaStream from "@/utils/mediaStream/useMediaStream";
|
||||||
|
|
||||||
import useStreamVisualizer from './visualizerDetails/audioVisualizer';
|
import useAudioVisualizer from './audioDetails/audioVisualizer';
|
||||||
|
|
||||||
import useTextVisualizer from './visualizerDetails/textVisualizer';
|
import useTextVisualizer from './textDetails/textVisualizer';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Input visualizer
|
* Controls which input to visualize
|
||||||
* Will visualize text input by default as user types or
|
* Will visualize text input by default as user types or
|
||||||
* if user holds space bar down, input audio stream
|
* if user holds space bar down, input audio stream
|
||||||
* will be visualized & recorded
|
* will be visualized & recorded
|
||||||
*/
|
*/
|
||||||
// NOTE: input params should probably be input and MediaStream
|
// NOTE: input params should probably be input and MediaStream
|
||||||
export default function useInputVisualizer() {
|
// TODO: visualize audio stream from nodeJS background process
|
||||||
|
export default function useInputController() {
|
||||||
const visualizeStream = ref(false);
|
const visualizeStream = ref(false);
|
||||||
const paths = ref([]);
|
const paths = ref([]);
|
||||||
const audioBubbleWidth = ref(10);
|
const audioBubbleWidth = ref(10);
|
||||||
|
|
@ -23,7 +24,7 @@ export default function useInputVisualizer() {
|
||||||
|
|
||||||
const { keyDownHandler, input } = useKeyDownHandler();
|
const { keyDownHandler, input } = useKeyDownHandler();
|
||||||
const { textInputXoffset, renderTextInput } = useTextVisualizer(input);
|
const { textInputXoffset, renderTextInput } = useTextVisualizer(input);
|
||||||
const { visualizeStreamAsPaths, expandBubble } = useStreamVisualizer(visualizeStream);
|
const { visualizeStreamAsPaths, expandBubble } = useAudioVisualizer(visualizeStream);
|
||||||
|
|
||||||
// stops stream recording on space key up
|
// stops stream recording on space key up
|
||||||
function keyupHandler(e: any) {
|
function keyupHandler(e: any) {
|
||||||
Loading…
Reference in a new issue