diff --git a/devices/common/dbdma.cpp b/devices/common/dbdma.cpp index 08452c2..e42c2c2 100644 --- a/devices/common/dbdma.cpp +++ b/devices/common/dbdma.cpp @@ -429,7 +429,16 @@ int DMAChannel::push_data(const char* src_ptr, int len) { return 0; } -bool DMAChannel::is_active() { +bool DMAChannel::is_out_active() { + if (this->ch_stat & CH_STAT_DEAD || !(this->ch_stat & CH_STAT_ACTIVE)) { + return false; + } + else { + return true; + } +} + +bool DMAChannel::is_in_active() { if (this->ch_stat & CH_STAT_DEAD || !(this->ch_stat & CH_STAT_ACTIVE)) { return false; } diff --git a/devices/common/dbdma.h b/devices/common/dbdma.h index df2f5a3..81ab3c0 100644 --- a/devices/common/dbdma.h +++ b/devices/common/dbdma.h @@ -92,7 +92,8 @@ public: uint32_t reg_read(uint32_t offset, int size); void reg_write(uint32_t offset, uint32_t value, int size); - bool is_active(); + bool is_out_active(); + bool is_in_active(); DmaPullResult pull_data(uint32_t req_len, uint32_t *avail_len, uint8_t **p_data); int push_data(const char* src_ptr, int len); diff --git a/devices/common/dmacore.h b/devices/common/dmacore.h index 77c0e9b..b180338 100644 --- a/devices/common/dmacore.h +++ b/devices/common/dmacore.h @@ -35,7 +35,7 @@ class DmaOutChannel { public: DmaOutChannel(std::string name) { this->name = name; }; - virtual bool is_active() { return true; }; + virtual bool is_out_active() { return true; }; virtual DmaPullResult pull_data(uint32_t req_len, uint32_t *avail_len, uint8_t **p_data) = 0; @@ -49,7 +49,9 @@ class DmaInChannel { public: DmaInChannel(std::string name) { this->name = name; }; - virtual int push_data(const char* src_ptr, int len) = 0; + virtual bool is_in_active() { return true; }; + virtual int push_data(const char* src_ptr, int len) = 0; + std::string get_name(void) { return this->name; }; private: diff --git a/devices/sound/soundserver_cubeb.cpp b/devices/sound/soundserver_cubeb.cpp index ea06279..e461133 100644 --- a/devices/sound/soundserver_cubeb.cpp +++ b/devices/sound/soundserver_cubeb.cpp @@ -108,7 +108,7 @@ long sound_out_callback(cubeb_stream *stream, void *user_data, long frames, out_frames; DmaOutChannel *dma_ch = static_cast(user_data); /* C API baby! */ - if (!dma_ch->is_active()) { + if (!dma_ch->is_out_active()) { return 0; }