From 3e462e4b8a5f1ccb712b8f7af722899ea404e1ce Mon Sep 17 00:00:00 2001 From: LTVA1 <87536432+LTVA1@users.noreply.github.com> Date: Sat, 16 Sep 2023 11:59:39 +0300 Subject: [PATCH] v0.10.0-alpha3 --- klystron | 2 +- src/action.c | 5 +++++ src/export.c | 14 +++++++------- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/klystron b/klystron index fde34916..5b209661 160000 --- a/klystron +++ b/klystron @@ -1 +1 @@ -Subproject commit fde34916d5deb28e409da2956535429a698abc12 +Subproject commit 5b209661081de5ad7d6d034645cd115b36b9599d diff --git a/src/action.c b/src/action.c index 983ed1f2..fc54641b 100644 --- a/src/action.c +++ b/src/action.c @@ -268,6 +268,8 @@ void play_one_row(void *unused1, void *unused2, void *unused3) mused.flags2 |= ((mused.song.flags & MUS_NO_REPEAT) ? NO_REPEAT_COPY : 0); mused.song.flags |= MUS_NO_REPEAT; + mused.mus.flags |= MUS_ENGINE_PLAY_ONE_STEP; + debug("Playing one row"); play(MAKEPTR(1), 0, 0); @@ -297,6 +299,7 @@ void stop(void *unused1, void *unused2, void *unused3) } mused.flags &= ~(SONG_PLAYING | LOOP_POSITION); + mused.mus.flags &= ~MUS_ENGINE_PLAY_ONE_STEP; } @@ -831,6 +834,7 @@ void export_wav_action(void *a, void *b, void *c) char def[1000]; mused.song.flags |= MUS_NO_REPEAT; //wasn't there + mused.mus.flags &= ~MUS_ENGINE_PLAY_ONE_STEP; if (strlen(mused.previous_song_filename) == 0) { @@ -896,6 +900,7 @@ void export_hires_wav_action(void *a, void*b, void*c) char def[1000]; mused.song.flags |= MUS_NO_REPEAT; //wasn't there + mused.mus.flags &= ~MUS_ENGINE_PLAY_ONE_STEP; if (strlen(mused.previous_song_filename) == 0) { diff --git a/src/export.c b/src/export.c index dae3be9f..1374b795 100644 --- a/src/export.c +++ b/src/export.c @@ -1,5 +1,5 @@ /* -Copyright (c) 2009-2010 Tero Lindeman (kometbomb) +Copyright (c) 2009-2010 Tero Lindeman (kometbomb) Copyright (c) 2021-2023 Georgy Saraykin (LTVA1 a.k.a. LTVA) and contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation @@ -114,13 +114,13 @@ bool export_wav(MusSong *song, CydWavetableEntry * entry, FILE *f, int channel) if (song->song_length != 0) { - int percentage = (mus->song_position + (channel == -1 ? 0 : (channel * song->song_length))) * 100 / (song->song_length * (channel == -1 ? 1 : song->num_channels)); + SDL_Rect area = {domain->screen_w / 2 - 140, domain->screen_h / 2 - 24, 280, 48}; + int percentage = (mus->song_position + (channel == -1 ? 0 : (channel * song->song_length))) * (area.w - (8 + 2) * 2) / (song->song_length * (channel == -1 ? 1 : song->num_channels)); if (percentage > last_percentage) { last_percentage = percentage; - SDL_Rect area = {domain->screen_w / 2 - 140, domain->screen_h / 2 - 24, 280, 48}; bevel(domain, &area, mused.slider_bevel, BEV_MENU); adjust_rect(&area, 8); @@ -131,7 +131,7 @@ bool export_wav(MusSong *song, CydWavetableEntry * entry, FILE *f, int channel) adjust_rect(&area, 2); int t = area.w; - area.w = area.w * percentage / 100; + area.w = area.w * percentage / area.w; gfx_rect(domain, &area, colors[COLOR_PROGRESS_BAR]); @@ -257,13 +257,13 @@ bool export_wav_hires(MusSong *song, CydWavetableEntry * entry, FILE *f, int cha if (song->song_length != 0) { - int percentage = (mus->song_position + (channel == -1 ? 0 : (channel * song->song_length))) * 100 / (song->song_length * (channel == -1 ? 1 : song->num_channels)); + SDL_Rect area = {domain->screen_w / 2 - 140, domain->screen_h / 2 - 24, 280, 48}; + int percentage = (mus->song_position + (channel == -1 ? 0 : (channel * song->song_length))) * (area.w - (8 + 2) * 2) / (song->song_length * (channel == -1 ? 1 : song->num_channels)); if (percentage > last_percentage) { last_percentage = percentage; - SDL_Rect area = {domain->screen_w / 2 - 140, domain->screen_h / 2 - 24, 280, 48}; bevel(domain, &area, mused.slider_bevel, BEV_MENU); adjust_rect(&area, 8); @@ -274,7 +274,7 @@ bool export_wav_hires(MusSong *song, CydWavetableEntry * entry, FILE *f, int cha adjust_rect(&area, 2); int t = area.w; - area.w = area.w * percentage / 100; + area.w = area.w * percentage / area.w; gfx_rect(domain, &area, colors[COLOR_PROGRESS_BAR]);