Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/aomusicplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ QString AOMusicPlayer::playStream(QString song, int streamId, bool loopEnabled,
return "[ERROR] Invalid Channel";
}

bool isLooping = loopEnabled && !(effectFlags & NO_REPEAT);

quint32 flags = BASS_STREAM_AUTOFREE;
if (loopEnabled)
if (isLooping)
{
flags |= BASS_SAMPLE_LOOP;
}
Expand Down Expand Up @@ -64,7 +66,7 @@ QString AOMusicPlayer::playStream(QString song, int streamId, bool loopEnabled,
m_loop_end[streamId] = 0;

QString d_path = f_path + ".txt";
if (loopEnabled && file_exists(d_path)) // Contains loop/etc. information file
if (isLooping && file_exists(d_path)) // Contains loop/etc. information file
{
QStringList lines = ao_app->read_file(d_path).split("\n");
bool seconds_mode = false;
Expand Down Expand Up @@ -164,8 +166,8 @@ QString AOMusicPlayer::playStream(QString song, int streamId, bool loopEnabled,

BASS_ChannelSetSync(newstream, BASS_SYNC_DEV_FAIL, 0, ao_app->BASSreset, 0);

this->setStreamLooping(loopEnabled, streamId); // Have to do this here due to any
// crossfading-related changes, etc.
this->setStreamLooping(isLooping, streamId); // Have to do this here due to any
// crossfading-related changes, etc.

bool is_stop = (song == "~stop.mp3");
QString p_song_clear = QUrl(song).fileName();
Expand Down
17 changes: 17 additions & 0 deletions src/courtroom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5858,6 +5858,11 @@ void Courtroom::on_music_list_context_menu_requested(const QPoint &pos)
menu->actions().constLast()->setChecked(music_flags & SYNC_POS);
connect(menu->actions().constLast(), &QAction::toggled, this, &Courtroom::music_synchronize);

menu->addAction(new QAction(tr("No Repeat"), this));
menu->actions().constLast()->setCheckable(true);
menu->actions().constLast()->setChecked(music_flags & NO_REPEAT);
connect(menu->actions().constLast(), &QAction::toggled, this, &Courtroom::music_no_repeat);

menu->addSeparator();
menu->addAction(QString("Open base music folder"), this, [=] {
QString p_path = get_base_path() + "sounds/music/";
Expand Down Expand Up @@ -5927,6 +5932,18 @@ void Courtroom::music_synchronize(bool toggle)
}
}

void Courtroom::music_no_repeat(bool toggle)
{
if (toggle)
{
music_flags |= NO_REPEAT;
}
else
{
music_flags &= ~NO_REPEAT;
}
}

void Courtroom::music_random()
{
QList<QTreeWidgetItem *> clist;
Expand Down
1 change: 1 addition & 0 deletions src/courtroom.h
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,7 @@ private Q_SLOTS:
void music_fade_out(bool toggle);
void music_fade_in(bool toggle);
void music_synchronize(bool toggle);
void music_no_repeat(bool toggle);
void music_random();
void music_list_expand_all();
void music_list_collapse_all();
Expand Down
3 changes: 2 additions & 1 deletion src/datatypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ enum MUSIC_EFFECT
{
FADE_IN = 1,
FADE_OUT = 2,
SYNC_POS = 4
SYNC_POS = 4,
NO_REPEAT = 8
};

enum RESIZE_MODE
Expand Down
Loading