WE CAN HEAR THE AUDIO!!!! but uhh rendering to a file is cooked lmao

This commit is contained in:
2026-01-15 05:51:52 +11:00
parent 827f39afcc
commit 6350de7899
9 changed files with 151 additions and 48 deletions

View File

@@ -54,6 +54,14 @@ class Channel(VerticalGroup):
self.solo = solo
self.pan = pan
self.volume = volume
def on_checkbox_changed(self, event: Checkbox.Changed):
if event.checkbox.id == "mute":
self.muted = event.value
self.app.query_one("#timeline").query_one()
elif event.checkbox.id == "solo":
self.solo = event.value
def on_slider_changed(self, event: Slider.Changed):
if event.slider.id == "volume":

View File

@@ -2,6 +2,8 @@ from textual.containers import Horizontal
from textual.app import ComposeResult
from textual.widgets import Button, Input, Static
import sounddevice as sd
class ProjectSettings(Horizontal):
DEFAULT_CSS = """
@@ -37,6 +39,10 @@ class ProjectSettings(Horizontal):
def __init__(self):
super().__init__()
self.border_title = "Project"
def on_button_pressed(self, event: Button.Pressed):
if event.button.id == "play-button":
sd.play(self.app.project.render())
def compose(self) -> ComposeResult:
yield Button("", tooltip="Play song", flat=True, id="play-button", variant="success") # icon becomes "⏸" when song is playing

View File

@@ -14,17 +14,27 @@ class TimelineRow(Horizontal):
background: $surface-lighten-1;
height: 8;
margin-bottom: 1;
width: 100;
&.-muted {
background: $error 25%;
}
&.-solo {
background: $warning 25%;
}
}
"""
class Timeline(Vertical):
DEFAULT_CSS = """
Timeline {
overflow-x: auto;
#rows {
hatch: "-" $surface-lighten-1;
padding: 0 0;
overflow-x: auto;
.beat-line {
color: $surface-lighten-1;
@@ -58,6 +68,9 @@ class Timeline(Vertical):
def calc_bar_offset(self):
self.bar_offset = self.app.project.bpm / 8 * (0.03333333333 / self.app.zoom_level)
for row in self.query(TimelineRow):
row.styles.width = self.bar_offset * self.app.project.song_length
@on(events.MouseScrollDown)
async def mouse_scroll_down(self, event: events.MouseScrollDown):
self.app.zoom_level += (self.app.scroll_sensitivity_x / 200)
@@ -93,18 +106,17 @@ class Timeline(Vertical):
with VerticalScroll(id="rows"):
for channel in self.app.project.channels:
with TimelineRow():
with TimelineRow() as row:
row.styles.width = self.bar_offset * self.app.project.song_length
for chunk in channel.chunks:
if chunk.chunk_type == ChunkType.CHUNK:
yield Chunk(chunk_name=chunk.name, bar_pos=chunk.position)
elif chunk.chunk_type == ChunkType.AUDIO:
yield AudioChunk(chunk.audio_data, chunk.sample_rate, chunk.name, chunk.position)
for i in range(1, 17):
for i in range(1, self.app.project.song_length):
bar = None
if i % 4 == 0:
bar = Rule.vertical(classes="bar-line", line_style="double")