Skip to content

Commit c923036

Browse files
committed
begin and end
1 parent 4005fa6 commit c923036

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/AudioTools/AudioPlayer.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ namespace audio_tools {
419419
}
420420

421421
/// (Re)Starts the playing of the music (from the beginning)
422-
virtual bool begin(bool isActive = true) {
422+
virtual bool begin(int station = 1, bool isActive = true) {
423423
LOGD(LOG_METHOD);
424424
bool result = false;
425425

@@ -428,8 +428,7 @@ namespace audio_tools {
428428
p_source->begin();
429429
meta_out.begin();
430430

431-
// get first streem
432-
p_input_stream = p_source->nextStream(1);
431+
p_input_stream = p_source->selectStream(station);
433432
if (p_input_stream != nullptr) {
434433
if (meta_active) {
435434
copier.setCallbackOnWrite(decodeMetaData, this);
@@ -561,6 +560,9 @@ namespace audio_tools {
561560

562561
/// start next stream
563562
virtual bool startNextStream() {
563+
end();
564+
p_out_decoding->begin();
565+
p_source->begin();
564566
p_input_stream = p_source->nextStream(+1);
565567
if (p_input_stream != nullptr) {
566568
LOGD("open next stream");
@@ -571,6 +573,9 @@ namespace audio_tools {
571573
}
572574
/// start selected stream
573575
virtual bool startSelectedStream(int station) {
576+
end();
577+
p_out_decoding->begin();
578+
p_source->begin();
574579
p_input_stream = p_source->selectStream(station);
575580
if (p_input_stream != nullptr) {
576581
LOGD("open selected stream");

0 commit comments

Comments
 (0)