~noskcaj/ubuntu/saucy/sflphone/merge-1.2.3-2

« back to all changes in this revision

Viewing changes to daemon/src/audio/sound/tone.cpp

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2012-05-19 21:46:37 UTC
  • mfrom: (1.1.7)
  • Revision ID: package-import@ubuntu.com-20120519214637-la8rbrford5kj6m3
Tags: 1.1.0-1
* New upstream release 
  - Fixes "FTBFS with libccrtp-dev/2.0.2 from experimental" (Closes: #663282)
* NEW Maintainer: Debian VoIP Team - Thanks Francois for your work.
  - (Closes: #665789: O: sflphone -- SIP and IAX2 compatible VoIP phone)
* Added Build-Depends: libdbus-c++-bin
* Add gcc47-fixes.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
 * YM: 2006-11-15: changes unsigned int to std::string::size_type, thanks to Pierre Pomes (AMD64 compilation)
36
36
 */
37
37
#include "tone.h"
 
38
#include "logger.h"
 
39
#include "sfl_types.h"
38
40
#include <cmath>
39
41
#include <cassert>
40
42
#include <cstdlib>
41
43
#include <cstring>
 
44
#include <vector>
42
45
 
43
46
Tone::Tone(const std::string& definition, unsigned int sampleRate) :
44
47
    sampleRate_(sampleRate), xhigher_(0.0), xlower_(0.0)
55
58
 
56
59
    size_ = 0;
57
60
 
58
 
    SFLDataFormat* buffer = new SFLDataFormat[SIZEBUF]; //1kb
59
 
    SFLDataFormat* bufferPos = buffer;
 
61
    std::vector<SFLDataFormat> buffer(SIZEBUF); // 1kb
 
62
    SFLDataFormat* bufferPos = &(*buffer.begin());
60
63
 
61
64
    // Number of format sections
62
65
    std::string::size_type posStart = 0; // position of precedent comma
123
126
    assert(!buffer_);
124
127
    buffer_ = new SFLDataFormat[size_];
125
128
 
126
 
    memcpy(buffer_, buffer, size_ * sizeof(SFLDataFormat)); // copy char, not SFLDataFormat.
127
 
 
128
 
    delete [] buffer;
 
129
    memcpy(buffer_, &(*buffer.begin()), size_ * sizeof(SFLDataFormat)); // copy char, not SFLDataFormat.
129
130
}
130
131
 
131
132
void
139
140
}
140
141
 
141
142
double
142
 
Tone::interpolate(double x)
 
143
Tone::interpolate(double x) const
143
144
{
144
145
    int xi_0 = x;
145
146
    int xi_1 = xi_0 + 1;