18
18
19
19
namespace audio_tools {
20
20
21
- AudioLogger &log_a2dp = AudioLogger::instance();
22
-
23
21
/* *
24
22
* @brief Covnerts the data from T src[][2] to a Channels array
25
23
* @author Phil Schatzmann
@@ -62,7 +60,7 @@ int32_t a2dp_stream_source_sound_data(Channels* data, int32_t len) {
62
60
size_t result_len_bytes = a2dp_buffer.readArray ((uint8_t *)data, len*sizeof (Channels));
63
61
// result is in number of frames
64
62
result_len = result_len_bytes / sizeof (Channels);
65
- ESP_LOGI (AUDIO_TAG, " a2dp_stream_source_sound_data %d -> %d" , len ,result_len);
63
+ ESP_LOGI ( " a2dp_stream_source_sound_data %d -> %d" , len ,result_len);
66
64
// allow some other task
67
65
yield ();
68
66
return result_len;
@@ -72,7 +70,7 @@ int32_t a2dp_stream_source_sound_data(Channels* data, int32_t len) {
72
70
void a2dp_stream_sink_sound_data (const uint8_t * data, uint32_t len) {
73
71
if (is_a2dp_setup){
74
72
uint32_t result_len = a2dp_buffer.writeArray (data, len);
75
- ESP_LOGI (AUDIO_TAG, " a2dp_stream_sink_sound_data %d -> %d" , len, result_len);
73
+ ESP_LOGI ( " a2dp_stream_sink_sound_data %d -> %d" , len, result_len);
76
74
// allow some other task
77
75
yield ();
78
76
}
@@ -125,26 +123,26 @@ class A2DPStream : public Stream {
125
123
126
124
switch (mode){
127
125
case TX_MODE:
128
- log_a2dp. info (" Starting a2dp_source..." );
126
+ LOGI (" Starting a2dp_source..." );
129
127
source (); // allocate object
130
128
a2dp_source->start (name, a2dp_stream_source_sound_data);
131
129
while (!a2dp_source->isConnected ()){
132
130
yield ();
133
131
}
134
- log_a2dp. info (" a2dp_source is connected..." );
132
+ LOGI (" a2dp_source is connected..." );
135
133
// is_a2dp_setup done in callback
136
134
// is_a2dp_setup = true;
137
135
break ;
138
136
139
137
case RX_MODE:
140
- log_a2dp. info (" Starting a2dp_sink..." );
138
+ LOGI (" Starting a2dp_sink..." );
141
139
sink (); // allocate object
142
140
a2dp_sink->set_stream_reader (&a2dp_stream_sink_sound_data, false );
143
141
a2dp_sink->start (name);
144
142
while (!a2dp_sink->isConnected ()){
145
143
yield ();
146
144
}
147
- log_a2dp. info (" a2dp_sink is connected..." );
145
+ LOGI (" a2dp_sink is connected..." );
148
146
is_a2dp_setup = true ;
149
147
break ;
150
148
}
@@ -172,9 +170,9 @@ class A2DPStream : public Stream {
172
170
size_t result = 0 ;
173
171
if (is_a2dp_setup){
174
172
result = a2dp_buffer.writeArray (data,len);
175
- ESP_LOGI (AUDIO_TAG, " write %d->%d" , len,result);
173
+ ESP_LOGI ( " write %d->%d" , len,result);
176
174
} else {
177
- ESP_LOGW (AUDIO_TAG, " write failed because !is_a2dp_setup" );
175
+ ESP_LOGW ( " write failed because !is_a2dp_setup" );
178
176
}
179
177
return result;
180
178
}
@@ -195,21 +193,21 @@ class A2DPStream : public Stream {
195
193
size_t result = 0 ;
196
194
if (is_a2dp_setup){
197
195
result = a2dp_buffer.readArray (data, len);
198
- ESP_LOGI (AUDIO_TAG, " read %d->%d" , len,result);
196
+ ESP_LOGI ( " read %d->%d" , len,result);
199
197
} else {
200
- ESP_LOGW (AUDIO_TAG, " readBytes failed because !is_a2dp_setup" );
198
+ ESP_LOGW ( " readBytes failed because !is_a2dp_setup" );
201
199
}
202
200
return result;
203
201
}
204
202
205
203
// not supported
206
204
virtual int read () {
207
- ESP_LOGE (AUDIO_TAG, " read() not supported" );
205
+ ESP_LOGE ( " read() not supported" );
208
206
return -1 ;
209
207
}
210
208
// not supported
211
209
virtual int peek () {
212
- ESP_LOGE (AUDIO_TAG, " peek() not supported" );
210
+ ESP_LOGE ( " peek() not supported" );
213
211
return -1 ;
214
212
}
215
213
@@ -228,7 +226,7 @@ class A2DPStream : public Stream {
228
226
char * name = nullptr ;
229
227
230
228
A2DPStream () {
231
- log_a2dp. info (" A2DPStream" );
229
+ LOGI (" A2DPStream" );
232
230
}
233
231
234
232
};
0 commit comments