[DEV] set it basic work again with RIVER

This commit is contained in:
Edouard DUPIN 2015-02-13 21:06:55 +01:00
parent af355c4051
commit 23467923b4
9 changed files with 88 additions and 89 deletions

View File

@ -13,30 +13,31 @@
#include <ewolsa/decWav.h>
#include <ewolsa/decOgg.h>
static void* threadCallback2(void *_ptr) {
ewolsa::LoadedFile* decodeFile = (ewolsa::LoadedFile*)_ptr;
static void threadCallback2(void* _userData) {
etk::log::setThreadName("ewolSA decoder");
ewolsa::LoadedFile* decodeFile = reinterpret_cast<ewolsa::LoadedFile*>(_userData);
decodeFile->decode();
return NULL;
}
void ewolsa::LoadedFile::decode() {
m_data = ewolsa::ogg::loadAudioFile(m_file, m_nbChanRequested, m_nbSamples);
m_data = ewolsa::ogg::loadAudioFile(m_file, m_nbChanRequested);
m_nbSamples = m_data.size();
}
ewolsa::LoadedFile::LoadedFile(const std::string& _fileName, int8_t _nbChanRequested) :
m_thread(nullptr),
m_file(_fileName),
m_nbSamples(0),
m_nbChanRequested(_nbChanRequested),
m_requestedTime(1),
m_data(NULL){
m_thread = NULL;
m_requestedTime(1){
std::string tmpName = etk::tolower(m_file);
// select the corect Loader :
if (etk::end_with(tmpName, ".wav") == true) {
m_data = ewolsa::wav::loadAudioFile(m_file, m_nbChanRequested, m_nbSamples);
m_data = ewolsa::wav::loadAudioFile(m_file, m_nbChanRequested);
m_nbSamples = m_data.size();
} else if (etk::end_with(tmpName, ".ogg") == true) {
EWOLSA_DEBUG("create thread");
pthread_create(&m_thread2, NULL, &threadCallback2, this);
m_thread = new std::thread(&threadCallback2, this);
EWOLSA_DEBUG("done 1");
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
EWOLSA_DEBUG("done 2");
@ -45,7 +46,7 @@ ewolsa::LoadedFile::LoadedFile(const std::string& _fileName, int8_t _nbChanReque
return;
}
/*
if (m_data == NULL) {
if (m_data == nullptr) {
// write an error ...
EWOLSA_ERROR("Can not open file : " << _fileName);
}
@ -54,10 +55,8 @@ ewolsa::LoadedFile::LoadedFile(const std::string& _fileName, int8_t _nbChanReque
ewolsa::LoadedFile::~LoadedFile() {
// TODO : wait end of thread...
if (m_data != NULL) {
delete[] m_data;
m_data = NULL;
if (m_thread != nullptr) {
delete m_thread;
}
}

View File

@ -18,7 +18,6 @@ namespace ewolsa {
class LoadedFile {
private:
std::thread* m_thread;
pthread_t m_thread2;
public:
LoadedFile(const std::string& _fileName, int8_t _nbChanRequested=1);
~LoadedFile();
@ -26,7 +25,7 @@ namespace ewolsa {
int32_t m_nbSamples;
int32_t m_nbChanRequested;
int32_t m_requestedTime;
int16_t* m_data;
std::vector<int16_t> m_data;
public:
const std::string& getName() {
return m_file;

View File

@ -48,8 +48,7 @@ static long localTellFunc(void *datasource) {
return file->fileTell();
}
int16_t* ewolsa::ogg::loadAudioFile(const std::string& _filename, int8_t _nbChan, int32_t& _nbSampleOut) {
_nbSampleOut = 0;
std::vector<int16_t> ewolsa::ogg::loadAudioFile(const std::string& _filename, int8_t _nbChan) {
OggVorbis_File vf;
int32_t eof=0;
int32_t current_section;
@ -64,23 +63,23 @@ int16_t* ewolsa::ogg::loadAudioFile(const std::string& _filename, int8_t _nbChan
//EWOLSA_DEBUG("open file (OGG) \"" << fileAccess << "\"");
if (false == fileAccess->exist()) {
//EWOLSA_ERROR("File Does not exist : \"" << fileAccess << "\"");
return NULL;
return std::vector<int16_t>();
}
int32_t fileSize = fileAccess->fileSize();
if (0 == fileSize) {
//EWOLSA_ERROR("This file is empty : \"" << fileAccess << "\"");
return NULL;
return std::vector<int16_t>();
}
if (false == fileAccess->fileOpenRead()) {
//EWOLSA_ERROR("Can not open the file : \"" << fileAccess << "\"");
return NULL;
return std::vector<int16_t>();
}
if (ov_open_callbacks(&(*fileAccess), &vf, NULL, 0, tmpCallback) < 0) {
if (ov_open_callbacks(&(*fileAccess), &vf, nullptr, 0, tmpCallback) < 0) {
//EWOLSA_ERROR("Input does not appear to be an Ogg bitstream.");
return NULL;
return std::vector<int16_t>();
}
vorbis_info *vi=ov_info(&vf,-1);
_nbSampleOut = ov_pcm_total(&vf,-1) / vi->channels;
int32_t nbSampleOut = ov_pcm_total(&vf,-1) / vi->channels;
/*
{
char **ptr=ov_comment(&vf,-1)->user_comments;
@ -94,11 +93,8 @@ int16_t* ewolsa::ogg::loadAudioFile(const std::string& _filename, int8_t _nbChan
EWOLSA_DEBUG("time: " << ((float)_nbSampleOut/(float)vi->rate)/60.0);
}
*/
int16_t* outputData = new int16_t[_nbSampleOut*_nbChan*sizeof(int16_t)];
if (NULL == outputData) {
//EWOLSA_ERROR("Allocation ERROR try to allocate " << (int32_t)(_nbSampleOut*_nbChan*sizeof(int16_t) ) << "bytes");
return NULL;
}
std::vector<int16_t> outputData;
outputData.resize(nbSampleOut*_nbChan, 0);
int32_t pos = 0;
char pcmout[4096];
while(!eof){
@ -110,11 +106,11 @@ int16_t* ewolsa::ogg::loadAudioFile(const std::string& _filename, int8_t _nbChan
if(ret==OV_EBADLINK){
//EWOLSA_ERROR("Corrupt bitstream section! Exiting.");
// TODO : Remove pointer data ...
return NULL;
return std::vector<int16_t>();
}
} else {
int16_t* pointerIn = (int16_t*)pcmout;
int16_t* pointerOut = outputData+pos;
int16_t* pointerOut = &outputData[0]+pos;
if (_nbChan == vi->channels) {
memcpy(pointerOut, pointerIn, ret);
pos += ret/2;

View File

@ -13,7 +13,7 @@
namespace ewolsa {
namespace ogg {
int16_t* loadAudioFile(const std::string& _filename, int8_t _nbChan, int32_t& _nbSampleOut);
std::vector<int16_t> loadAudioFile(const std::string& _filename, int8_t _nbChan);
}
};

View File

@ -59,8 +59,7 @@ typedef struct {
#define COMPR_G721 (64)
#define COMPR_MPEG (80)
int16_t* ewolsa::wav::loadAudioFile(const std::string& _filename, int8_t _nbChan, int32_t& _nbSampleOut) {
_nbSampleOut = 0;
std::vector<int16_t> ewolsa::wav::loadAudioFile(const std::string& _filename, int8_t _nbChan) {
waveHeader myHeader;
memset(&myHeader, 0, sizeof(waveHeader));
etk::FSNode fileAccess(_filename);
@ -69,28 +68,28 @@ int16_t* ewolsa::wav::loadAudioFile(const std::string& _filename, int8_t _nbChan
if (false == fileAccess.exist()) {
EWOLSA_ERROR("File Does not exist : \"" << fileAccess << "\"");
return NULL;
return std::vector<int16_t>();
}
int32_t fileSize = fileAccess.fileSize();
if (0 == fileSize) {
EWOLSA_ERROR("This file is empty : \"" << fileAccess << "\"");
return NULL;
return std::vector<int16_t>();
}
if (false == fileAccess.fileOpenRead()) {
EWOLSA_ERROR("Can not open the file : \"" << fileAccess << "\"");
return NULL;
return std::vector<int16_t>();
}
// try to find endienness :
if (fileSize < (int64_t)sizeof(waveHeader)) {
EWOLSA_ERROR("File : \"" << fileAccess << "\" == > has not enouth data inside might be minumum of " << (int32_t)(sizeof(waveHeader)));
return NULL;
return std::vector<int16_t>();
}
// ----------------------------------------------
// read the header :
// ----------------------------------------------
if (fileAccess.fileRead(&myHeader.riffTag, 1, 4)!=4) {
EWOLSA_ERROR("Can not 4 element in the file : \"" << fileAccess << "\"");
return NULL;
return std::vector<int16_t>();
}
bool littleEndien = false;
if( myHeader.riffTag[0] == 'R'
@ -102,55 +101,55 @@ int16_t* ewolsa::wav::loadAudioFile(const std::string& _filename, int8_t _nbChan
}
} else {
EWOLSA_ERROR("file: \"" << fileAccess << "\" Does not start with \"RIF\" " );
return NULL;
return std::vector<int16_t>();
}
// get the data size :
unsigned char tmpData[32];
if (fileAccess.fileRead(tmpData, 1, 4)!=4) {
EWOLSA_ERROR("Can not 4 element in the file : \"" << fileAccess << "\"");
return NULL;
return std::vector<int16_t>();
}
myHeader.size = CONVERT_UINT32(littleEndien, tmpData);
// get the data size :
if (fileAccess.fileRead(&myHeader.waveTag, 1, 4)!=4) {
EWOLSA_ERROR("Can not 4 element in the file : \"" << fileAccess << "\"");
return NULL;
return std::vector<int16_t>();
}
if( myHeader.waveTag[0] != 'W'
|| myHeader.waveTag[1] != 'A'
|| myHeader.waveTag[2] != 'V'
|| myHeader.waveTag[3] != 'E' ) {
EWOLSA_ERROR("file: \"" << fileAccess << "\" This is not a wave file " << myHeader.waveTag[0] << myHeader.waveTag[1] << myHeader.waveTag[2] << myHeader.waveTag[3] );
return NULL;
return std::vector<int16_t>();
}
// get the data size :
if (fileAccess.fileRead(&myHeader.fmtTag, 1, 4)!=4) {
EWOLSA_ERROR("Can not 4 element in the file : \"" << fileAccess << "\"");
return NULL;
return std::vector<int16_t>();
}
if( myHeader.fmtTag[0] != 'f'
|| myHeader.fmtTag[1] != 'm'
|| myHeader.fmtTag[2] != 't'
|| myHeader.fmtTag[3] != ' ' ) {
EWOLSA_ERROR("file: \"" << fileAccess << "\" header error ..." << myHeader.fmtTag[0] << myHeader.fmtTag[1] << myHeader.fmtTag[2] << myHeader.fmtTag[3]);
return NULL;
return std::vector<int16_t>();
}
// get the data size :
if (fileAccess.fileRead(tmpData, 1, 4)!=4) {
EWOLSA_ERROR("Can not 4 element in the file : \"" << fileAccess << "\"");
return NULL;
return std::vector<int16_t>();
}
myHeader.waveFormatSize = CONVERT_UINT32(littleEndien, tmpData);
if (myHeader.waveFormatSize != 16) {
EWOLSA_ERROR("file : \"" << fileAccess << "\" == > header error ...");
return NULL;
return std::vector<int16_t>();
}
if (fileAccess.fileRead(tmpData, 1, 16)!=16) {
EWOLSA_ERROR("Can not 16 element in the file : \"" << fileAccess << "\"");
return NULL;
return std::vector<int16_t>();
}
unsigned char * tmppp = tmpData;
myHeader.waveFormat.type = CONVERT_UINT16(littleEndien, tmppp);
@ -174,19 +173,19 @@ int16_t* ewolsa::wav::loadAudioFile(const std::string& _filename, int8_t _nbChan
// get the data size :
if (fileAccess.fileRead(&myHeader.dataTag, 1, 4)!=4) {
EWOLSA_ERROR("Can not 4 element in the file : \"" << fileAccess << "\"");
return NULL;
return std::vector<int16_t>();
}
if( myHeader.dataTag[0] != 'd'
|| myHeader.dataTag[1] != 'a'
|| myHeader.dataTag[2] != 't'
|| myHeader.dataTag[3] != 'a' ) {
EWOLSA_ERROR("file: \"" << fileAccess << "\" header error ..." << myHeader.dataTag[0] << myHeader.dataTag[1] << myHeader.dataTag[2] << myHeader.dataTag[3]);
return NULL;
return std::vector<int16_t>();
}
// get the data size :
if (fileAccess.fileRead(tmpData, 1, 4)!=4) {
EWOLSA_ERROR("Can not 4 element in the file : \"" << fileAccess << "\"");
return NULL;
return std::vector<int16_t>();
}
myHeader.dataSize = CONVERT_UINT32(littleEndien, tmpData);
@ -197,33 +196,30 @@ int16_t* ewolsa::wav::loadAudioFile(const std::string& _filename, int8_t _nbChan
//Parse the data and transform it if needed ...
if (COMPR_PCM != myHeader.waveFormat.type) {
EWOLSA_ERROR("File : \"" << fileAccess << "\" == > support only PCM compression ...");
return NULL;
return std::vector<int16_t>();
}
if (myHeader.waveFormat.channelCount == 0 || myHeader.waveFormat.channelCount>2) {
EWOLSA_ERROR("File : \"" << fileAccess << "\" == > support only mono or stereo ..." << myHeader.waveFormat.channelCount);
return NULL;
return std::vector<int16_t>();
}
if ( ! ( myHeader.waveFormat.bitsPerSample == 16
|| myHeader.waveFormat.bitsPerSample == 24
|| myHeader.waveFormat.bitsPerSample == 32 ) ) {
EWOLSA_ERROR("File : \"" << fileAccess << "\" == > not supported bit/sample ..." << myHeader.waveFormat.bitsPerSample);
return NULL;
return std::vector<int16_t>();
}
if( ! ( 44100 == myHeader.waveFormat.samplesPerSec
|| 48000 == myHeader.waveFormat.samplesPerSec) ) {
EWOLSA_ERROR("File : \"" << fileAccess << "\" == > not supported frequency " << myHeader.waveFormat.samplesPerSec << " != 48000");
return NULL;
return std::vector<int16_t>();
}
EWOLSA_DEBUG(" dataSize : " << myHeader.dataSize);
//int32_t globalDataSize = myHeader.dataSize;
int32_t nbSample = (myHeader.dataSize/((myHeader.waveFormat.bitsPerSample/8)*myHeader.waveFormat.channelCount));
int32_t outputSize = _nbChan*nbSample;
int16_t * outputData = new int16_t[outputSize*sizeof(int16_t)];
if (NULL == outputData) {
EWOLSA_ERROR("Allocation ERROR try to allocate " << (int32_t)(outputSize*sizeof(int16_t) ) << "bytes");
return NULL;
}
int16_t * tmpOut = outputData;
std::vector<int16_t> outputData;
outputData.resize(outputSize, 0);
int16_t * tmpOut = &outputData[0];
for( int32_t iii=0; iii<nbSample; iii++) {
int32_t left;
int32_t right;
@ -232,14 +228,14 @@ int16_t* ewolsa::wav::loadAudioFile(const std::string& _filename, int8_t _nbChan
if (myHeader.waveFormat.channelCount == 1) {
if (fileAccess.fileRead(audioSample, 1, 2)!=2) {
EWOLSA_ERROR("Read Error at position : " << iii);
return NULL;
return std::vector<int16_t>();
}
left = ((int32_t)((int16_t)CONVERT_INT16(littleEndien, audioSample))) << 16;
right = left;
} else {
if (fileAccess.fileRead(audioSample, 1, 4)!=4) {
EWOLSA_ERROR("Read Error at position : " << iii);
return NULL;
return std::vector<int16_t>();
}
left = (int32_t)((int16_t)CONVERT_INT16(littleEndien, audioSample)) << 16;
right = (int32_t)((int16_t)CONVERT_INT16(littleEndien, audioSample+2)) << 16;
@ -248,14 +244,14 @@ int16_t* ewolsa::wav::loadAudioFile(const std::string& _filename, int8_t _nbChan
if (myHeader.waveFormat.channelCount == 1) {
if (fileAccess.fileRead(audioSample, 1, 3)!=3) {
EWOLSA_ERROR("Read Error at position : " << iii);
return NULL;
return std::vector<int16_t>();
}
left = CONVERT_INT24(littleEndien, audioSample);
right = left;
} else {
if (fileAccess.fileRead(audioSample, 1, 6)!=6) {
EWOLSA_ERROR("Read Error at position : " << iii);
return NULL;
return std::vector<int16_t>();
}
left = CONVERT_INT24(littleEndien, audioSample);
right = CONVERT_INT24(littleEndien, audioSample+3);
@ -264,14 +260,14 @@ int16_t* ewolsa::wav::loadAudioFile(const std::string& _filename, int8_t _nbChan
if (myHeader.waveFormat.channelCount == 1) {
if (fileAccess.fileRead(audioSample, 1, 4)!=4) {
EWOLSA_ERROR("Read Error at position : " << iii);
return NULL;
return std::vector<int16_t>();
}
left = CONVERT_INT32(littleEndien, audioSample);
right = left;
} else {
if (fileAccess.fileRead(audioSample, 1, 8)!=8) {
EWOLSA_ERROR("Read Error at position : " << iii);
return NULL;
return std::vector<int16_t>();
}
left = CONVERT_INT32(littleEndien, audioSample);
right = CONVERT_INT32(littleEndien, audioSample+4);
@ -286,7 +282,6 @@ int16_t* ewolsa::wav::loadAudioFile(const std::string& _filename, int8_t _nbChan
}
// close the file:
fileAccess.fileClose();
_nbSampleOut = nbSample;
return outputData;
}

View File

@ -13,7 +13,7 @@
namespace ewolsa {
namespace wav {
int16_t* loadAudioFile(const std::string& _filename, int8_t _nbChan, int32_t& _nbSampleOut);
std::vector<int16_t> loadAudioFile(const std::string& _filename, int8_t _nbChan);
}
};

View File

@ -50,7 +50,7 @@ class RequestPlay {
if (true == m_freeSlot) {
return;
}
if (m_effect->m_data == NULL) {
if (m_effect->m_data.size() == 0) {
m_freeSlot = true;
return;
}
@ -93,7 +93,7 @@ void ewolsa::effects::unInit() {
int32_t ewolsa::effects::add(const std::string& _file) {
for (size_t iii=0; iii<ListEffects.size(); iii++) {
if (ListEffects[iii] == NULL) {
if (ListEffects[iii] == nullptr) {
continue;
}
if (ListEffects[iii]->m_file == _file) {
@ -103,7 +103,7 @@ int32_t ewolsa::effects::add(const std::string& _file) {
}
// effect does not exist ... create a new one ...
ewolsa::LoadedFile * tmpEffect = new ewolsa::LoadedFile(_file);
if (NULL == tmpEffect) {
if (nullptr == tmpEffect) {
EWOLSA_ERROR("Error to load the effects : \"" << _file << "\"");
return -1;
}
@ -117,7 +117,7 @@ void ewolsa::effects::rm(int32_t _effectId) {
EWOLSA_ERROR("Wrong effect ID : " << _effectId << " != [0.." << ListEffects.size()-1 << "] == > can not remove it ...");
return;
}
if (ListEffects[_effectId] == NULL) {
if (ListEffects[_effectId] == nullptr) {
EWOLSA_ERROR("effect ID : " << _effectId << " == > has already been removed");
return;
}
@ -137,7 +137,7 @@ void ewolsa::effects::play(int32_t _effectId, float _xxx, float _yyy) {
EWOLSA_ERROR("Wrong effect ID : " << _effectId << " != [0.." << ListEffects.size()-1 << "] == > can not play it ...");
return;
}
if (ListEffects[_effectId] == NULL) {
if (ListEffects[_effectId] == nullptr) {
EWOLSA_ERROR("effect ID : " << _effectId << " == > has been removed");
return;
}
@ -150,7 +150,7 @@ void ewolsa::effects::play(int32_t _effectId, float _xxx, float _yyy) {
}
}
RequestPlay* newPlay = new RequestPlay(ListEffects[_effectId]);
if (NULL == newPlay) {
if (nullptr == newPlay) {
EWOLSA_CRITICAL("Allocation error of a playing element : " << _effectId);
return;
}
@ -197,7 +197,7 @@ void ewolsa::effects::muteSet(bool _newMute) {
void ewolsa::effects::getData(int16_t* _bufferInterlace, int32_t _nbSample, int32_t _nbChannels) {
for (size_t iii = 0; iii < ListEffectsPlaying.size(); ++iii) {
if (ListEffectsPlaying[iii]!= NULL) {
if (ListEffectsPlaying[iii]!= nullptr) {
ListEffectsPlaying[iii]->play(_bufferInterlace, _nbSample, _nbChannels);
}
}

View File

@ -31,6 +31,10 @@ class OutputInterface {
audio::format_int16,
"speaker",
"ewolsa::basicOutput");
if (m_interface == nullptr) {
EWOLSA_ERROR("can not allocate output interface ... ");
return;
}
// set callback mode ...
m_interface->setOutputCallback(1024,
std::bind(&OutputInterface::onDataNeeded,
@ -43,6 +47,9 @@ class OutputInterface {
m_interface->start();
}
~OutputInterface() {
if (m_interface == nullptr) {
return;
}
m_interface->stop();
m_interface.reset();
m_manager.reset();
@ -58,7 +65,7 @@ class OutputInterface {
// call music
ewolsa::music::getData(static_cast<int16_t*>(_data), _nbChunk, _map.size());
// call Effects
ewolsa::effects::getData(static_cast<int16_t*>(_data), _nbChunk, _map.size());
//ewolsa::effects::getData(static_cast<int16_t*>(_data), _nbChunk, _map.size());
}
};
std::shared_ptr<OutputInterface> g_ioInterface;

View File

@ -34,11 +34,11 @@ void ewolsa::music::init() {
musicNextRead = -1;
musicPositionReading = 0;
for (size_t iii=0; iii<musicListRead.size(); ++iii) {
if (musicListRead[iii] == NULL) {
if (musicListRead[iii] == nullptr) {
continue;
}
delete musicListRead[iii];
musicListRead[iii] = NULL;
musicListRead[iii] = nullptr;
}
musicListRead.clear();
}
@ -51,11 +51,11 @@ void ewolsa::music::unInit() {
musicNextRead = -1;
musicPositionReading = 0;
for (size_t iii=0; iii<musicListRead.size(); ++iii) {
if (musicListRead[iii] == NULL) {
if (musicListRead[iii] == nullptr) {
continue;
}
delete musicListRead[iii];
musicListRead[iii] = NULL;
musicListRead[iii] = nullptr;
}
musicListRead.clear();
}
@ -71,7 +71,7 @@ void ewolsa::music::fading(int32_t _timeMs) {
void ewolsa::music::preLoad(const std::string& _file) {
// check if music already existed ...
for (size_t iii=0; iii<musicListRead.size(); ++iii) {
if (musicListRead[iii] == NULL) {
if (musicListRead[iii] == nullptr) {
continue;
}
if (musicListRead[iii]->getName() == _file) {
@ -79,9 +79,9 @@ void ewolsa::music::preLoad(const std::string& _file) {
}
}
ewolsa::LoadedFile* tmp = new ewolsa::LoadedFile(_file, 2);
if (tmp != NULL) {
if (tmp != nullptr) {
/*
if (tmp->m_data == NULL) {
if (tmp->m_data == nullptr) {
EWOLSA_ERROR("Music has no data ... : " << _file);
delete(tmp);
return;
@ -101,7 +101,7 @@ bool ewolsa::music::play(const std::string& _file) {
int32_t idMusic = -1;
// check if music already existed ...
for (size_t iii=0; iii<musicListRead.size(); ++iii) {
if (musicListRead[iii] == NULL) {
if (musicListRead[iii] == nullptr) {
continue;
}
if (musicListRead[iii]->getName() == _file) {
@ -182,23 +182,26 @@ void ewolsa::music::getData(int16_t * _bufferInterlace, int32_t _nbSample, int32
return;
}
if ( musicCurrentRead >= musicListRead.size()
|| musicListRead[musicCurrentRead] == NULL) {
|| musicListRead[musicCurrentRead] == nullptr) {
musicCurrentRead = -1;
musicPositionReading = 0;
EWOLSA_ERROR("request read an unexisting audio track ... : " << musicCurrentRead << "/" << musicListRead.size());
return;
}
if (musicListRead[musicCurrentRead]->m_data == NULL) {
if (musicListRead[musicCurrentRead]->m_data.size() == 0) {
return;
}
int32_t processTimeMax = std::min(_nbSample*_nbChannels, musicListRead[musicCurrentRead]->m_nbSamples - musicPositionReading);
processTimeMax = std::max(0, processTimeMax);
int16_t * pointer = _bufferInterlace;
int16_t * newData = &musicListRead[musicCurrentRead]->m_data[musicPositionReading];
//EWOLSA_DEBUG("AUDIO : Play slot... nb sample : " << processTimeMax << " playTime=" <<m_playTime << " nbCannels=" << nbChannels);
EWOLSA_DEBUG("AUDIO : Play slot... nb sample : " << processTimeMax << " nbCannels=" << _nbChannels << " chunkRequest=" << _nbSample);
for (int32_t iii=0; iii<processTimeMax; iii++) {
int32_t tmppp = *pointer + ((((int32_t)*newData)*musicVolumeApply)>>16);
/*
int32_t tmppp = ((int32_t)*pointer) + ((((int32_t)*newData)*musicVolumeApply)>>16);
*pointer = std::avg(-32767, tmppp, 32766);
*/
*pointer = *newData;
//EWOLSA_DEBUG("AUDIO : element : " << *pointer);
pointer++;
newData++;