@@ -40,7 +40,7 @@ namespace audio_tools {
40
40
virtual Stream* nextStream (int offset) = 0;
41
41
42
42
// / Returns next audio stream
43
- virtual Stream* selectStream (int station ) {
43
+ virtual Stream* selectStream (int index ) {
44
44
LOGE (" Not Supported!" );
45
45
return nullptr ;
46
46
}
@@ -80,6 +80,12 @@ namespace audio_tools {
80
80
return nextStreamCallback == nullptr ? nullptr : nextStreamCallback ();
81
81
}
82
82
83
+ // / Returns next audio stream
84
+ virtual Stream* selectStream (int index) {
85
+ return indexStreamCallback == nullptr ? nullptr : indexStreamCallback (index);
86
+ }
87
+
88
+
83
89
void setCallbackOnStart (void (*callback)()) {
84
90
onStartCallback = callback;
85
91
}
@@ -88,9 +94,14 @@ namespace audio_tools {
88
94
nextStreamCallback = callback;
89
95
}
90
96
97
+ void setCallbackSelectStream (Stream* (*callback)(int idx)) {
98
+ indexStreamCallback = callback;
99
+ }
100
+
91
101
protected:
92
102
void (*onStartCallback)() = nullptr ;
93
103
Stream* (*nextStreamCallback)() = nullptr ;
104
+ Stream* (*indexStreamCallback)(int index) = nullptr ;
94
105
95
106
};
96
107
@@ -140,6 +151,14 @@ namespace audio_tools {
140
151
return file ? &file : nullptr ;
141
152
}
142
153
154
+ virtual Stream* selectStream (int index) {
155
+ file.close ();
156
+ file = getFile (start_path, index);
157
+ file.getName (file_name, MAX_FILE_LEN);
158
+ LOGI (" -> nextStream: '%s'" , file_name);
159
+ return file ? &file : nullptr ;
160
+ }
161
+
143
162
// / Defines the regex filter criteria for selecting files. E.g. ".*Bob Dylan.*"
144
163
void setFileFilter (const char * filter) {
145
164
file_name_pattern = filter;
0 commit comments