Skip to content
Snippets Groups Projects
Commit a2691090 authored by yanmorin's avatar yanmorin
Browse files

Fixes for check inside global ringtones directory if the preference don't have a path
Remove warning inside request.h
Add two constants for directory seperator inside user_cfg
parent ef60a5cb
No related branches found
No related tags found
No related merge requests found
......@@ -39,7 +39,7 @@ int AMPLITUDE = 32767;
///////////////////////////////////////////////////////////////////////////////
ToneThread::ToneThread (int16 *buf, int size) : ost::Thread () {
this->buffer = buf;
this->size = size;
this->_size = size;
// channels is 2 (global.h)
this->buf_ctrl_vol = new int16[size*CHANNELS];
}
......@@ -60,13 +60,13 @@ ToneThread::run (void) {
bool started = false;
// How long do 'size' samples play ?
unsigned int play_time = (size * 1000) / SAMPLING_RATE - 10;
unsigned int play_time = (_size * 1000) / SAMPLING_RATE - 10;
ManagerImpl& manager = Manager::instance();
manager.getAudioDriver()->flushMain();
// this loop can be outside the stream, since we put the volume inside the ringbuffer
for (int j = 0; j < size; j++) {
for (int j = 0; j < _size; j++) {
k = j<<1; // channels is 2 (global.h)
// split in two
buf_ctrl_vol[k] = buf_ctrl_vol[k+1] = buffer[j];
......@@ -81,8 +81,8 @@ ToneThread::run (void) {
// int16 are the buf_ctrl_vol
// unsigned char are the sample_ptr inside ringbuffer
int size_in_char = size * 2 * (sizeof(int16)/sizeof(unsigned char));
_debug(" size : %d\t size_in_char : %d\n", size, size_in_char);
int size_in_char = _size * 2 * (sizeof(int16)/sizeof(unsigned char));
_debug(" size : %d\t size_in_char : %d\n", _size, size_in_char);
while (!testCancel()) {
manager.getAudioDriver()->putMain(buf_ctrl_vol, size_in_char);
......
......@@ -56,9 +56,9 @@ public:
virtual void run ();
private:
int16* buffer;
int16* buf_ctrl_vol;
int size;
int16* buffer;
int16* buf_ctrl_vol;
int _size;
};
///////////////////////////////////////////////////////////////////////////////
......
......@@ -41,8 +41,8 @@ public:
Request(const std::string &sequenceId, const TokenList& argList) : _sequenceId(sequenceId), _argList(argList) {}
virtual ~Request() {}
virtual ResponseMessage execute() = 0;
ResponseMessage message(const std::string &code, const std::string &message) {
ResponseMessage response(code, _sequenceId, message);
ResponseMessage message(const std::string &code, const std::string &aMessage) {
ResponseMessage response(code, _sequenceId, aMessage);
return response;
}
ResponseMessage message(const std::string &code, TokenList& arg) {
......
......@@ -449,10 +449,9 @@ ManagerImpl::registerVoIPLink (void)
int returnValue = 0;
if ( !useStun() ) {
if (_voIPLinkVector.at(DFT_VOIP_LINK)->setRegister() >= 0) {
returnValue = true;
returnValue = 1;
_registerState = REGISTERED;
} else {
_debug("ManagerImpl::registerVoIPLink: Registration failed\n");
_registerState = FAILED;
}
} else {
......@@ -890,7 +889,13 @@ ManagerImpl::ringtone()
if (isDriverLoaded()) {
_toneMutex.enterMutex();
_toneType = ZT_TONE_FILE;
int play = _tone->playRingtone(getConfigString(AUDIO, RING_CHOICE).c_str());
std::string ringchoice = getConfigString(AUDIO, RING_CHOICE);
// if there is no / inside the path
if ( ringchoice.find(DIR_SEPARATOR_CH) == std::string::npos ) {
// check inside global share directory
ringchoice = std::string(PROGSHAREDIR) + DIR_SEPARATOR_STR + RINGDIR + DIR_SEPARATOR_STR + ringchoice;
}
int play = _tone->playRingtone(ringchoice.c_str());
_toneMutex.leaveMutex();
if (play!=1) {
ringback();
......@@ -997,7 +1002,7 @@ ManagerImpl::generateNewCallId (void)
*/
int
ManagerImpl::createSettingsPath (void) {
_path = std::string(HOMEDIR) + "/." + PROGDIR;
_path = std::string(HOMEDIR) + DIR_SEPARATOR_STR + "." + PROGDIR;
if (mkdir (_path.data(), 0755) != 0) {
// If directory creation failed
......@@ -1008,7 +1013,7 @@ ManagerImpl::createSettingsPath (void) {
}
// Load user's configuration
_path = _path + "/" + PROGNAME + "rc";
_path = _path + DIR_SEPARATOR_STR + PROGNAME + "rc";
return _config.populateFromFile(_path);
}
......@@ -1379,11 +1384,11 @@ ManagerImpl::getConfigList(const std::string& sequenceId, const std::string& nam
}
returnValue = true;
} else if (name=="ringtones") {
std::string path = std::string(PROGSHAREDIR) + "/" + RINGDIR;
std::string path = std::string(PROGSHAREDIR) + DIR_SEPARATOR_STR + RINGDIR;
int nbFile = 0;
returnValue = getDirListing(sequenceId, path, &nbFile);
path = std::string(HOMEDIR) + "/." + PROGDIR + "/" + RINGDIR;
path = std::string(HOMEDIR) + DIR_SEPARATOR_STR + "." + PROGDIR + DIR_SEPARATOR_STR + RINGDIR;
getDirListing(sequenceId, path, &nbFile);
} else if (name=="audiodevice") {
returnValue = getAudioDeviceList(sequenceId);
......@@ -1455,7 +1460,7 @@ ManagerImpl::getDirListing(const std::string& sequenceId, const std::string& pat
std::string filePathName;
while ( (cFileName=dir++) != NULL ) {
fileName = cFileName;
filePathName = path + "/" + cFileName;
filePathName = path + DIR_SEPARATOR_STR + cFileName;
if (fileName.length() && fileName[0]!='.' && !ost::isDir(filePathName.c_str())) {
tk.clear();
std::ostringstream str;
......
......@@ -21,13 +21,15 @@
#ifndef __USER_CFG_H__
#define __USER_CFG_H__
#define GUI_QT
#include <stdlib.h>
// Home directory
#define HOMEDIR (getenv ("HOME"))
// TODO: change for a \ in Windows Environment
#define DIR_SEPARATOR_CH '/'
#define DIR_SEPARATOR_STR "/"
// Main menu
#define SIGNALISATION "VoIPLink"
#define AUDIO "Audio"
......@@ -64,11 +66,6 @@
// speakers and volume 0 to 100
#define VOLUME_SPKR "Volume.speakers"
#define VOLUME_MICRO "Volume.micro"
#define VOLUME_SPKR_X "Volume.speakers_x"
#define VOLUME_SPKR_Y "Volume.speakers_y"
#define VOLUME_MICRO_X "Volume.micro_x"
#define VOLUME_MICRO_Y "Volume.micro_y"
#define SKIN_CHOICE "Themes.skinChoice"
#define CONFIRM_QUIT "Options.confirmQuit"
#define ZONE_TONE "Options.zoneToneChoice"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment