Skip to content

Commit 9a394ba

Browse files
committed
cleanup
1 parent 4ea1260 commit 9a394ba

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/AudioLibs/AudioSTK.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,19 @@ class STKGenerator : public SoundGenerator<T> {
7676
template <class StkCls>
7777
class STKStream : public GeneratedSoundStream<int16_t> {
7878
public:
79-
STKStream() {
80-
GeneratedSoundStream<int16_t>::setInput(generator);
81-
};
79+
STKStream() = default;
8280

8381
STKStream(StkCls &instrument){
8482
generator.setInput(instrument);
8583
GeneratedSoundStream<int16_t>::setInput(generator);
8684
}
8785
void setInput(StkCls &instrument){
8886
generator.setInput(instrument);
87+
GeneratedSoundStream<int16_t>::setInput(generator);
8988
}
9089
void setInput(StkCls *instrument){
9190
generator.setInput(*instrument);
91+
GeneratedSoundStream<int16_t>::setInput(generator);
9292
}
9393

9494
AudioBaseInfo defaultConfig() {

src/AudioTools/AudioStreams.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,10 @@ class GeneratedSoundStream : public AudioStreamX {
532532
/// start the processing
533533
bool begin() override {
534534
LOGD(LOG_METHOD);
535+
if (generator_ptr==nullptr){
536+
LOGE(source_not_defined_error);
537+
return false;
538+
}
535539
generator_ptr->begin();
536540
if (audioBaseInfoDependent != nullptr)
537541
audioBaseInfoDependent->setAudioInfo(generator_ptr->audioInfo());
@@ -543,7 +547,7 @@ class GeneratedSoundStream : public AudioStreamX {
543547
bool begin(AudioBaseInfo cfg) {
544548
LOGD(LOG_METHOD);
545549
if (generator_ptr==nullptr){
546-
LOGE("Source not defined");
550+
LOGE(source_not_defined_error);
547551
return false;
548552
}
549553
generator_ptr->begin(cfg);
@@ -558,6 +562,7 @@ class GeneratedSoundStream : public AudioStreamX {
558562
LOGD(LOG_METHOD);
559563
generator_ptr->end();
560564
active = false;
565+
const char* source_not_defined_error = "Source not defined";
561566
}
562567

563568
virtual void setNotifyAudioChange(AudioBaseInfoDependent &bi) override {

0 commit comments

Comments
 (0)