summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2024-06-03 21:05:14 +1000
committerquou <quou@disroot.org>2024-06-03 21:05:22 +1000
commit6589107006fd4fc06bdb7d02cb4b1eef45395458 (patch)
treeaf196448b28aa4a1ec612e2c1b1578465c203c12 /main.c
parent62b4a3ededd237f4b4850d91c052585e2f687499 (diff)
Basic audio playback with pulseaudio.
Diffstat (limited to 'main.c')
-rw-r--r--main.c12
1 files changed, 11 insertions, 1 deletions
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;
}