From 6589107006fd4fc06bdb7d02cb4b1eef45395458 Mon Sep 17 00:00:00 2001 From: quou Date: Mon, 3 Jun 2024 21:05:14 +1000 Subject: Basic audio playback with pulseaudio. --- main.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'main.c') diff --git a/main.c b/main.c index c350331..94f78b5 100644 --- a/main.c +++ b/main.c @@ -5,6 +5,7 @@ #include "memory.h" Library lib; +Player pl; int libtab_msg( UIElement *el, @@ -12,9 +13,9 @@ int libtab_msg( int di, void *dp ) { + Song* song; if (msg == UI_MSG_TABLE_GET_ITEM) { UITableGetItem *m = (UITableGetItem*)dp; - Song* song; song = &lib.songs[lib.indices[m->index]]; m->isSelected = 0; switch (m->column) { @@ -48,6 +49,15 @@ int libtab_msg( ); default: return 0; } + } else if (msg == UI_MSG_LEFT_UP) { + int hit = UITableHitTest( + (UITable*)el, + el->window->cursorX, + el->window->cursorY + ); + song = &lib.songs[lib.indices[hit]]; + init_player(&pl); + play_song(&pl, song); } return 0; } -- cgit v1.2.3-54-g00ecf