This commit is contained in:
Nishi 2025-11-24 22:57:16 +09:00
commit 1e2eed03de
Signed by: nishi
GPG key ID: 27EF69B208EB9343
3 changed files with 24 additions and 11 deletions

View file

@ -15,6 +15,7 @@ MwWidget mainsep;
MwWidget eltime, seekbar, rmtime;
MwWidget tree, list;
MwLLPixmap pxalbum, pxskipback, pxplay, pxpause, pxstop, pxskipfwd, pxrepeat, pxshuffle;
MwLLPixmap pxoptical;
unsigned char* pxalbumdata;
static void resize(MwWidget handle, void* user, void* client) {
@ -116,21 +117,21 @@ static void resize(MwWidget handle, void* user, void* client) {
MwVaApply(eltime,
MwNx, 5,
MwNy, y + 5 + 32 + 10,
MwNwidth, MwTextWidth(window, "00:00"), /* please, never put 1 hour music */
MwNwidth, MwTextWidth(window, "000:00"),
MwNheight, 16,
NULL);
MwVaApply(seekbar,
MwNx, 5 + MwTextWidth(window, "00:00") + 5,
MwNx, 5 + MwTextWidth(window, "000:00") + 5,
MwNy, y + 5 + 32 + 10,
MwNwidth, ww - (5 + MwTextWidth(window, "00:00") + 5) * 2,
MwNwidth, ww - (5 + MwTextWidth(window, "000:00") + 5) * 2,
MwNheight, 16,
NULL);
MwVaApply(rmtime,
MwNx, ww - 5 - MwTextWidth(window, "00:00"),
MwNx, ww - 5 - MwTextWidth(window, "000:00"),
MwNy, y + 5 + 32 + 10,
MwNwidth, MwTextWidth(window, "00:00"),
MwNwidth, MwTextWidth(window, "000:00"),
MwNheight, 16,
NULL);
@ -156,7 +157,7 @@ int main() {
MwLibraryInit();
window = MwVaCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT, MwDEFAULT, 640, 400,
window = MwVaCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT, MwDEFAULT, 600, 400,
MwNtitle, "mauplay",
NULL);
menu = MwCreateWidget(MwMenuClass, "menu", window, 0, 0, 0, 0);
@ -202,7 +203,7 @@ int main() {
NULL);
eltime = MwVaCreateWidget(MwLabelClass, "eltime", window, 0, 0, 0, 0,
MwNalignment, MwALIGNMENT_END,
MwNtext, "0:00",
MwNtext, "000:00",
NULL);
seekbar = MwVaCreateWidget(MwScrollBarClass, "seekbar", window, 0, 0, 0, 0,
MwNorientation, MwHORIZONTAL,
@ -211,7 +212,7 @@ int main() {
NULL);
rmtime = MwVaCreateWidget(MwLabelClass, "rmtime", window, 0, 0, 0, 0,
MwNalignment, MwALIGNMENT_END,
MwNtext, "0:00",
MwNtext, "000:00",
NULL);
tree = MwCreateWidget(MwTreeViewClass, "tree", window, 0, 0, 0, 0);
list = MwVaCreateWidget(MwListBoxClass, "list", window, 0, 0, 0, 0,
@ -234,6 +235,8 @@ int main() {
pxrepeat = MwLoadXPM(window, repeat_xpm);
pxshuffle = MwLoadXPM(window, shuffle_xpm);
pxoptical = MwLoadImage(window, ICON128DIR "/optical.png");
MwSetVoid(album, MwNpixmap, pxalbum);
MwSetVoid(bskipback, MwNpixmap, pxskipback);
@ -251,7 +254,6 @@ int main() {
ui_init();
db_add("test2.mp3");
db_scan();
audio_init();

View file

@ -44,6 +44,7 @@ extern MwWidget eltime, seekbar, rmtime;
extern MwWidget tree, list;
extern unsigned char* pxalbumdata;
extern MwLLPixmap pxalbum;
extern MwLLPixmap pxoptical;
/* db.c */
extern numkv_t* db_musics;

View file

@ -102,6 +102,7 @@ static void tree_activate(MwWidget handle, void* user, void* client) {
int index = MwListBoxPacketInsert(p, -1);
sprintf(buf, "%d", i + 1);
MwListBoxPacketSetIcon(p, index, pxoptical);
MwListBoxPacketSet(p, index, 0, buf);
MwListBoxPacketSet(p, index, 1, db_musics[ind].title);
MwListBoxPacketSet(p, index, 2, db_musics[ind].artist);
@ -118,6 +119,7 @@ static void tree_activate(MwWidget handle, void* user, void* client) {
int index = MwListBoxPacketInsert(p, -1);
sprintf(buf, "%d", i + 1);
MwListBoxPacketSetIcon(p, index, pxoptical);
MwListBoxPacketSet(p, index, 0, buf);
MwListBoxPacketSet(p, index, 1, db_musics[i].title);
MwListBoxPacketSet(p, index, 2, db_musics[i].artist);
@ -189,6 +191,10 @@ static void tree_activate(MwWidget handle, void* user, void* client) {
static void list_activate(MwWidget handle, void* user, void* client) {
if(ui_last == play_queue) {
pthread_mutex_lock(&audio_mutex);
if(queue_seek != -1) {
queue[queue_seek].frames = 0;
MDESoundSeek(queue[queue_seek].sound, 0);
}
queue_seek = (*(int*)client) - 1;
queue[queue_seek].frames = 0;
MDESoundSeek(queue[queue_seek].sound, 0);
@ -225,12 +231,16 @@ static void window_tick(MwWidget handle, void* user, void* client) {
}
}
free(data);
} else {
memset(((MwLLCommonPixmap)pxalbum)->raw, 0, ALBUMWIDTH * ALBUMWIDTH * 4);
}
MwLLPixmapUpdate(pxalbum);
MwForceRender(album);
free(img);
} else {
memset(((MwLLCommonPixmap)pxalbum)->raw, 0, ALBUMWIDTH * ALBUMWIDTH * 4);
}
MwLLPixmapUpdate(pxalbum);
MwForceRender(album);
if(ui_last == play_queue) {
pthread_mutex_unlock(&audio_mutex);