Skip to content

Commit 96e81b6

Browse files
fix the stuff jules and codex broke xD
1 parent 94596df commit 96e81b6

File tree

10 files changed

+4336
-369
lines changed

10 files changed

+4336
-369
lines changed

frontend/bun.lock

Lines changed: 485 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package-lock.json

Lines changed: 3792 additions & 358 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/src/components/MainContent.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@ const focusedElement = ref(null)
180180
const audioControls = ref(null)
181181
182182
function onVolumeChange(val) {
183-
localVolume.value = val
184183
emits('handleVolumeChange', { target: { value: val } })
185184
}
186185
function handleGenerateSpeech() {

frontend/src/composables/useAudioContext.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,13 @@ export function useAudioContext() {
2020
}
2121

2222
function setVolume(volume) {
23+
console.log('useAudioContext setVolume - input volume:', volume)
2324
if (gainNode.value) {
25+
console.log('useAudioContext setVolume - gainNode exists, setting gain value')
2426
gainNode.value.gain.value = volume
27+
console.log('useAudioContext setVolume - gainNode.gain.value after:', gainNode.value.gain.value)
28+
} else {
29+
console.log('useAudioContext setVolume - gainNode is null/undefined')
2530
}
2631
}
2732

frontend/src/composables/usePlayback.js

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
11
import { ref } from 'vue'
2+
import { storeToRefs } from 'pinia'
23
import { useTTSStore } from '../stores/ttsStore'
34

45
export function usePlayback(audioContext, gainNode) {
56
const ttsStore = useTTSStore()
67
const {
78
volume,
8-
setVolumeAndApply,
99
isPlaying,
1010
currentSource,
1111
playbackProgress,
12-
currentTime,
12+
currentTime
13+
} = storeToRefs(ttsStore)
14+
const {
15+
setVolumeAndApply,
1316
setIsPlaying,
1417
setCurrentSource,
1518
setPlaybackProgress,
1619
setCurrentTime
1720
} = ttsStore
21+
22+
console.log('currentSource from ttsStore in usePlayback:', currentSource);
23+
console.log('typeof currentSource from ttsStore:', typeof currentSource);
1824
const startTime = ref(0)
1925
const pausedTime = ref(0)
2026
const totalDuration = ref(0)
@@ -116,10 +122,20 @@ export function usePlayback(audioContext, gainNode) {
116122

117123
function handleVolumeChange(event, setVolume) {
118124
const newVol = parseInt(event.target.value)
125+
console.log('handleVolumeChange - raw value:', event.target.value)
126+
console.log('handleVolumeChange - parsed newVol:', newVol)
127+
console.log('handleVolumeChange - current volume.value before:', volume.value)
119128
setVolumeAndApply(newVol, setVolume)
120-
event.target.style.setProperty('--volume-percentage', `${volume.value}%`)
129+
console.log('handleVolumeChange - current volume.value after:', volume.value)
130+
// Only set CSS property if the target has a style object (real DOM element)
131+
if (event.target.style && event.target.style.setProperty) {
132+
event.target.style.setProperty('--volume-percentage', `${volume.value}%`)
133+
}
121134
}
122135

136+
console.log('About to return from usePlayback. currentSource is:', currentSource);
137+
console.log('typeof currentSource before return:', typeof currentSource);
138+
123139
return {
124140
isPlaying,
125141
currentSource,

frontend/src/composables/useTTS.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ export function useTTS() {
5252
togglePlayback
5353
} = usePlayback(audioContext, gainNode)
5454

55+
console.log('currentSource in useTTS setup:', currentSource);
56+
5557
// Audio chunks management
5658
const { chunkCache, currentChunkIndex, fetchAudioChunk, fetchNextChunks, resetChunks } = useAudioChunks(audioContext)
5759

@@ -64,6 +66,8 @@ export function useTTS() {
6466

6567
// Single speaker generation
6668
async function generateSpeech(text, voice) {
69+
console.log('currentSource at start of generateSpeech:', currentSource);
70+
6771
if (!text.trim()) {
6872
progressMessage.value = 'Please enter some text'
6973
return
@@ -97,6 +101,9 @@ export function useTTS() {
97101
// make sure we start in streaming mode for new generations:
98102
streamingMode = true
99103

104+
console.log('About to check currentSource.value. currentSource is:', currentSource);
105+
console.log('typeof currentSource:', typeof currentSource);
106+
100107
if (currentSource.value) {
101108
currentSource.value.onended = null
102109
currentSource.value.stop()
@@ -132,6 +139,8 @@ export function useTTS() {
132139
await playNextChunk(text, voice)
133140
} catch (error) {
134141
console.error('Error during speech generation:', error)
142+
console.log('currentSource IN CATCH BLOCK:', currentSource);
143+
console.log('typeof currentSource IN CATCH BLOCK:', typeof currentSource);
135144
progressMessage.value = `Error: ${error.message}`
136145
isGenerating.value = false
137146
setIsPlaying(false)
@@ -315,9 +324,9 @@ export function useTTS() {
315324
}
316325

317326
function setSyncedVolume(newVolumeValue) {
318-
// newVolumeValue is expected to be 0-100 from UI controls
319-
// setVolumeAndApply from the store will handle calling applyVolumeToAudioContext
320-
setVolumeAndApply(newVolumeValue, applyVolumeToAudioContext);
327+
// newVolumeValue is already normalized (0-1) from usePlayback
328+
// Just apply it directly to the audio context
329+
applyVolumeToAudioContext(newVolumeValue);
321330
}
322331

323332
// When the user clicks play/pause we switch out of streaming mode.

frontend/src/stores/ttsStore.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ export const useTTSStore = defineStore('tts', () => {
1111
// Playback state
1212
const isPlaying = ref(false)
1313
const currentSource = ref(null)
14+
console.log('currentSource created in ttsStore:', currentSource);
15+
console.log('typeof currentSource in ttsStore:', typeof currentSource);
1416
const playbackProgress = ref(0)
1517
const currentTime = ref(0)
1618

@@ -58,9 +60,14 @@ export const useTTSStore = defineStore('tts', () => {
5860
}
5961

6062
function setVolumeAndApply(val, applyFn) {
63+
console.log('setVolumeAndApply - input val:', val)
64+
console.log('setVolumeAndApply - volume.value before:', volume.value)
6165
volume.value = val
66+
console.log('setVolumeAndApply - volume.value after:', volume.value)
6267
if (typeof applyFn === 'function') {
63-
applyFn(val / 100)
68+
const normalizedVal = val / 100
69+
console.log('setVolumeAndApply - calling applyFn with normalized value:', normalizedVal)
70+
applyFn(normalizedVal)
6471
}
6572
}
6673

@@ -72,6 +79,8 @@ export const useTTSStore = defineStore('tts', () => {
7279
}
7380
}
7481

82+
console.log('About to return from ttsStore. currentSource is:', currentSource);
83+
7584
return {
7685
volume,
7786
isGenerating,

package-lock.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/backend/api/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
@app.options("/{path:path}")
4848
async def preflight_handler(path: str):
4949
"""Handle CORS preflight checks for any endpoint."""
50-
return JSONResponse(status_code=200)
50+
return JSONResponse(status_code=200, content={})
5151

5252
# Pydantic models for request validation
5353
class TTSRequest(BaseModel):

src/frontend/package-lock.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)