Commit b4bc7ab8 authored by Tristan Matthews's avatar Tristan Matthews

* #29632: audiobuffer: make buffer size an explicit parameter

parent 6ad0780e
......@@ -42,7 +42,7 @@ class AudioBuffer {
/**
* Default constructor.
*/
AudioBuffer(size_t sample_num = 0, unsigned channel_num = 1, int sample_rate = 8000);
AudioBuffer(size_t sample_num, unsigned channel_num = 1, int sample_rate = 8000);
/**
* Construtor from existing interleaved data (copied into the buffer).
......
......@@ -46,7 +46,7 @@
AudioLoop::AudioLoop(unsigned int sampleRate) : buffer_(0), pos_(0)
{
buffer_ = new AudioBuffer;
buffer_ = new AudioBuffer(0);
buffer_->setSampleRate(sampleRate);
}
......
......@@ -100,7 +100,7 @@ AudioRtpRecord::AudioRtpRecord() :
, decoderPayloadType_(0)
, hasDynamicPayloadType_(false)
, decData_(DEC_BUFFER_SIZE) // std::tr1::arrays will be 0-initialized
, resampledData_()
, resampledData_(0)
, encodedData_()
, converterEncode_(0)
, converterDecode_(0)
......
......@@ -80,7 +80,7 @@ PulseLayer::PulseLayer(AudioPreference &pref)
, ringtone_(0)
, sinkList_()
, sourceList_()
, mic_buffer_()
, mic_buffer_(0)
, context_(0)
, mainloop_(pa_threaded_mainloop_new())
, enumeratingSinks_(false)
......
......@@ -48,7 +48,7 @@ Tone::Tone(const std::string& definition, unsigned int sampleRate) :
{
fillWavetable();
delete buffer_;
buffer_ = new AudioBuffer();
buffer_ = new AudioBuffer(0);
buffer_->setSampleRate(sampleRate);
genBuffer(definition); // allocate memory with definition parameter
}
......
......@@ -42,7 +42,7 @@ void AudioBufferTest::testAudioBufferConstructors()
SFLAudioSample test_samples1[] = {};
SFLAudioSample test_samples2[] = {10, 11, 12, 13, 14, 15, 16, 17};
AudioBuffer empty_buf;
AudioBuffer empty_buf(0);
CPPUNIT_ASSERT(empty_buf.samples() == 0);
CPPUNIT_ASSERT(empty_buf.channels() == 1);
CPPUNIT_ASSERT(empty_buf.getChannel(0)->size() == 0);
......@@ -84,7 +84,7 @@ void AudioBufferTest::testAudioBufferMix()
test_buf1.setChannelNum(2, true);
CPPUNIT_ASSERT((*test_buf1.getChannel(1))[0] == test_samples1[0]);
AudioBuffer test_buf2;
AudioBuffer test_buf2(0);
test_buf2.deinterleave(test_samples2, 3, 3);
CPPUNIT_ASSERT((*test_buf2.getChannel(0))[2] == test_samples2[6]);
CPPUNIT_ASSERT((*test_buf2.getChannel(1))[1] == test_samples2[4]);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment