summaryrefslogtreecommitdiffhomepage
path: root/PCM.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'PCM.cpp')
-rw-r--r--PCM.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/PCM.cpp b/PCM.cpp
index 8c0e01f..5e90b97 100644
--- a/PCM.cpp
+++ b/PCM.cpp
@@ -1,6 +1,8 @@
#include "PCM.h"
-PCM::PCM(): m_phase(1000000)
+PCM::PCM(Config& config):
+ m_config(config),
+ m_phase(1000000)
{
// prepare the sample
std::string data_s = Reichwein::File::getFile("media/click.s16le");
@@ -80,16 +82,24 @@ void PCM::generate()
{
int i;
- for (i = 0; i < nframes; i++) {
- if (m_phase < 0 || m_phase >= m_data.size())
- {
+ if (m_config.get_output() == 0) {
+ for (i = 0; i < nframes; i++) {
buffer[i] = 0;
}
- else
- {
- buffer[i] = m_data[m_phase];
+ m_phase += nframes;
+ } else {
+
+ for (i = 0; i < nframes; i++) {
+ if (m_phase < 0 || m_phase >= m_data.size())
+ {
+ buffer[i] = 0;
+ }
+ else
+ {
+ buffer[i] = m_data[m_phase];
+ }
+ m_phase++;
}
- m_phase++;
}
}