File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -19,16 +19,32 @@ namespace audio_tools {
19
19
* @copyright GPLv3
20
20
*
21
21
*/
22
- class AnalogAudioArduino : public BaseStream {
22
+ class AnalogAudioArduino : public AudioStream {
23
23
public:
24
24
AnalogAudioArduino () = default ;
25
25
26
26
// / provides the default configuration
27
- AnalogConfigStd defaultConfig (){
27
+ AnalogConfigStd defaultConfig () {
28
28
AnalogConfigStd def;
29
29
return def;
30
30
}
31
31
32
+ void setAudioInfo (AudioInfo info) override {
33
+ TRACEI ();
34
+ if (config.sample_rate != info.sample_rate ||
35
+ config.channels != info.channels ||
36
+ config.bits_per_sample != info.bits_per_sample ) {
37
+ config.sample_rate = info.sample_rate ;
38
+ config.bits_per_sample = info.bits_per_sample ;
39
+ config.channels = info.channels ;
40
+ config.logInfo ();
41
+ setupTimer ();
42
+ }
43
+ }
44
+
45
+ // / Reopen with last config
46
+ bool begin () override { return begin (config); }
47
+
32
48
bool begin (AnalogConfigStd cfg) {
33
49
TRACED ();
34
50
config = cfg;
@@ -48,7 +64,7 @@ class AnalogAudioArduino : public BaseStream {
48
64
return setupTimer ();
49
65
}
50
66
51
- void end () { timer.end (); }
67
+ void end () override { timer.end (); }
52
68
53
69
int available () override {
54
70
if (config.rx_tx_mode == TX_MODE) return 0 ;
You can’t perform that action at this time.
0 commit comments