Skip to content

Commit 0166244

Browse files
committed
fix: buffer running out (i think...) ???
1 parent 3d13f3f commit 0166244

2 files changed

Lines changed: 20 additions & 5 deletions

File tree

‎player/src/main.rs‎

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,6 @@ impl Connection {
229229
} else {
230230
p.resume()
231231
}
232-
} else if !p.is_ready() && wants_play && p.is_started() {
233-
tx.send(AudioStatus::DoneBuffering).unwrap();
234232
}
235233
}
236234
});
@@ -619,9 +617,24 @@ async fn main() -> std::io::Result<()> {
619617
dbg!(evt);
620618
}
621619
},
622-
UIEvent::BtnPlay => {}
620+
UIEvent::BtnPlay => {
621+
// play button behaviour:
622+
// if stopped and queue is empty, ask for file
623+
// if stopped and queue has songs, tell it to play
624+
// if already playing, do nothing
625+
626+
}
623627
UIEvent::BtnStop => {
624628
ui_tx.send(UIEvent::Stop).unwrap();
629+
}
630+
UIEvent::BtnPause => {
631+
632+
}
633+
UIEvent::BtnNext => {
634+
635+
}
636+
UIEvent::BtnPrev => {
637+
625638
}
626639
UIEvent::BtnQueue => {
627640
queue_gui.main_win.show();
@@ -653,6 +666,8 @@ pub enum UIEvent {
653666
BtnPlay, // bleh
654667
BtnStop,
655668
BtnPause,
669+
BtnNext,
670+
BtnPrev,
656671
BtnQueue,
657672
Update(UIUpdateEvent),
658673
Play(PathBuf),

‎player/src/transmit.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ impl TransmitThread {
359359
// SO we need to send a frame at least every 20ms.
360360
// i think.................
361361
// LOL OK it's two frames idk why maybe because it's stereo interleaved??????
362-
let interval = tokio::time::interval(tokio::time::Duration::from_millis(200));
362+
let interval = tokio::time::interval(tokio::time::Duration::from_millis(100));
363363

364364
TransmitThread {
365365
rx,
@@ -414,7 +414,7 @@ impl TransmitThread {
414414
fn handle_tick(&mut self) {
415415
// TODO: only run the timer when we need it?
416416
if let Some(t) = self.audio_reader.as_mut() {
417-
for _ in 0..20 {
417+
for _ in 0..10 {
418418
// if ran out in the middle of this "tick" of 20 frames
419419
if t.finished() {
420420
break;

0 commit comments

Comments
 (0)