- Instead of adjusted len, buffer read() / write() returns exception in case of length mismatch
git-svn-id: http://moon:8086/svn/software/trunk/libsrc/cpp@1026 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
@@ -154,7 +154,7 @@ void test()
|
|||||||
size_t k=0;
|
size_t k=0;
|
||||||
size_t n=0;
|
size_t n=0;
|
||||||
size_t remain = iq_in.size();
|
size_t remain = iq_in.size();
|
||||||
const size_t BLOCKSIZE=1024;
|
const size_t BLOCKSIZE=2048;
|
||||||
|
|
||||||
// Create input buffer for Farrow Block
|
// Create input buffer for Farrow Block
|
||||||
auto farrow_buf_in = new Buffer<ComplexScalar>(BLOCKSIZE);
|
auto farrow_buf_in = new Buffer<ComplexScalar>(BLOCKSIZE);
|
||||||
@@ -171,10 +171,8 @@ void test()
|
|||||||
// @2 x symbolrate
|
// @2 x symbolrate
|
||||||
|
|
||||||
// Matched filtering and interpolation
|
// Matched filtering and interpolation
|
||||||
size_t size = std::min(BLOCKSIZE, remain);
|
size_t size = std::min(farrow_buf_in->free(), remain);
|
||||||
size_t numFed = farrow_buf_in->write(&iq_in.data()[n], size);
|
farrow_buf_in->write(&iq_in.data()[n], size);
|
||||||
n += numFed;
|
|
||||||
remain -= numFed;
|
|
||||||
|
|
||||||
farrow.process();
|
farrow.process();
|
||||||
while(farrow_buf_out->len())
|
while(farrow_buf_out->len())
|
||||||
@@ -186,6 +184,8 @@ void test()
|
|||||||
iq_out[k++] = farrow_buf_out->readAt(0);
|
iq_out[k++] = farrow_buf_out->readAt(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
remain -= size;
|
||||||
|
n += size;
|
||||||
}
|
}
|
||||||
wavSave("out.wav", header, iq_out);
|
wavSave("out.wav", header, iq_out);
|
||||||
cout << "End of program" << endl;
|
cout << "End of program" << endl;
|
||||||
|
|||||||
Reference in New Issue
Block a user