mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-01-26 22:37:13 -05:00
Separate template/callback code from method code.
...for more small reductions in code size.
This commit is contained in:
parent
cd3a5afdb1
commit
6d3cdb9bbf
@ -58,3 +58,13 @@ bool AudioStatsCollector::update_stats(const size_t sample_count, const size_t s
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AudioStatsCollector::feed(const buffer_s16_t& src) {
|
||||||
|
consume_audio_buffer(src);
|
||||||
|
|
||||||
|
return update_stats(src.count, src.sampling_rate);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AudioStatsCollector::mute(const size_t sample_count, const size_t sampling_rate) {
|
||||||
|
return update_stats(sample_count, sampling_rate);
|
||||||
|
}
|
||||||
|
@ -32,16 +32,14 @@ class AudioStatsCollector {
|
|||||||
public:
|
public:
|
||||||
template<typename Callback>
|
template<typename Callback>
|
||||||
void feed(const buffer_s16_t& src, Callback callback) {
|
void feed(const buffer_s16_t& src, Callback callback) {
|
||||||
consume_audio_buffer(src);
|
if( feed(src) ) {
|
||||||
|
|
||||||
if( update_stats(src.count, src.sampling_rate) ) {
|
|
||||||
callback(statistics);
|
callback(statistics);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Callback>
|
template<typename Callback>
|
||||||
void mute(const size_t sample_count, const size_t sampling_rate, Callback callback) {
|
void mute(const size_t sample_count, const size_t sampling_rate, Callback callback) {
|
||||||
if( update_stats(sample_count, sampling_rate) ) {
|
if( mute(sample_count, sampling_rate) ) {
|
||||||
callback(statistics);
|
callback(statistics);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -57,6 +55,9 @@ private:
|
|||||||
void consume_audio_buffer(const buffer_s16_t& src);
|
void consume_audio_buffer(const buffer_s16_t& src);
|
||||||
|
|
||||||
bool update_stats(const size_t sample_count, const size_t sampling_rate);
|
bool update_stats(const size_t sample_count, const size_t sampling_rate);
|
||||||
|
|
||||||
|
bool feed(const buffer_s16_t& src);
|
||||||
|
bool mute(const size_t sample_count, const size_t sampling_rate);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif/*__AUDIO_STATS_COLLECTOR_H__*/
|
#endif/*__AUDIO_STATS_COLLECTOR_H__*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user