本文整理汇总了C++中string::CharPointerType::length方法的典型用法代码示例。如果您正苦于以下问题:C++ CharPointerType::length方法的具体用法?C++ CharPointerType::length怎么用?C++ CharPointerType::length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类string::CharPointerType
的用法示例。
在下文中一共展示了CharPointerType::length方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: calcParams
void Ambix_directional_loudnessAudioProcessor::calcParams()
{
if (!_initialized)
{
sph_h.Init(AMBI_ORDER);
const String t_design_txt (t_design::des_3_240_21_txt);
// std::cout << t_design_txt << std::endl;
String::CharPointerType lineChar = t_design_txt.getCharPointer();
int n = 0; // how many characters been read
int numsamples = 0;
int i = 0;
int curr_n = 0;
int max_n = lineChar.length();
while (curr_n < max_n) { // check how many coordinates we have
double value;
sscanf(lineChar, "%lf\n%n", &value, &n);
lineChar += n;
curr_n += n;
numsamples++;
} // end parse numbers
numsamples = numsamples/3; // xyz
Carth_coord.resize(numsamples,3); // positions in cartesian coordinates
curr_n = 0;
lineChar = t_design_txt.getCharPointer();
// parse line for numbers again and copy to carth coordinate matrix
while (i < numsamples) {
double x,y,z;
sscanf(lineChar, "%lf%lf%lf%n", &x, &y, &z, &n);
Carth_coord(i,0) = x;
Carth_coord(i,1) = y;
Carth_coord(i,2) = z;
lineChar += n;
curr_n += n;
i++;
} // end parse numbers
// std::cout << "Coordinate size: " << Carth_coord.rows() << " x " << Carth_coord.cols() << std::endl;
// std::cout << Carth_coord << std::endl;
Sph_coord.resize(numsamples,2); // positions in spherical coordinates
Sh_matrix.setZero(numsamples,AMBI_CHANNELS);
for (int i=0; i < numsamples; i++)
{
Eigen::VectorXd Ymn(AMBI_CHANNELS); // Ymn result
Sph_coord(i,0) = atan2(Carth_coord(i,1),Carth_coord(i,0)); // azimuth
Sph_coord(i,1) = atan2(Carth_coord(i,2),sqrt(Carth_coord(i,0)*Carth_coord(i,0) + Carth_coord(i,1)*Carth_coord(i,1))); // elevation
sph_h.Calc(Sph_coord(i,0),Sph_coord(i,1)); // phi theta
sph_h.Get(Ymn);
// std::cout << "Size: " << Ymn.size() << ": " << Ymn << std::endl;
//Sh_matrix.row(i) = Ymn;
Sh_matrix.block(i,0,1,AMBI_CHANNELS) = Ymn.transpose();
// std::cout << "Size: " << Sh_matrix.block(i,0,1,in_ambi_channels).size() << ": " << Sh_matrix.block(i,0,1,in_ambi_channels) << std::endl;
}
// Sh_matrix_inv.setZero();
//Sh_matrix_inv = (Sh_matrix.transpose()*Sh_matrix).inverse()*Sh_matrix.transpose(); // not working for dynamic input order
// if input order is different a better solving has to be used for the inverse:
Sh_matrix_inv = (Sh_matrix.transpose()*Sh_matrix).colPivHouseholderQr().inverse()*Sh_matrix.transpose();
// std::cout << "Size: " << Sh_matrix_inv.rows() << " x " << Sh_matrix_inv.cols() << std::endl;
// std::cout << Sh_matrix_inv << std::endl;
_initialized = true;
}
if (_param_changed)
{
// convert parameters to values for the filter
// ArrayIntParam _shape = shape;
ArrayParam _width = width * (float)M_PI; // 0...pi
ArrayParam _height = height * (float)M_PI;
ArrayParam _gain;
//.........这里部分代码省略.........
示例2: calcParams
void Ambix_vmicAudioProcessor::calcParams()
{
if (!_initialized)
{
sph_h.Init(AMBI_ORDER);
const String t_design_txt (t_design::des_3_240_21_txt);
// std::cout << t_design_txt << std::endl;
String::CharPointerType lineChar = t_design_txt.getCharPointer();
int n = 0; // how many characters been read
int numsamples = 0;
int i = 0;
int curr_n = 0;
int max_n = lineChar.length();
while (curr_n < max_n) { // check how many coordinates we have
double value;
sscanf(lineChar, "%lf\n%n", &value, &n);
lineChar += n;
curr_n += n;
numsamples++;
} // end parse numbers
numsamples = numsamples/3; // xyz
Carth_coord.resize(numsamples,3); // positions in cartesian coordinates
curr_n = 0;
lineChar = t_design_txt.getCharPointer();
// parse line for numbers again and copy to carth coordinate matrix
while (i < numsamples) {
double x,y,z;
sscanf(lineChar, "%lf%lf%lf%n", &x, &y, &z, &n);
Carth_coord(i,0) = x;
Carth_coord(i,1) = y;
Carth_coord(i,2) = z;
lineChar += n;
curr_n += n;
i++;
} // end parse numbers
// std::cout << "Coordinate size: " << Carth_coord.rows() << " x " << Carth_coord.cols() << std::endl;
// std::cout << Carth_coord << std::endl;
Sph_coord.resize(numsamples,2); // positions in spherical coordinates
Sh_matrix.setZero(numsamples,AMBI_CHANNELS);
for (int i=0; i < numsamples; i++)
{
Eigen::VectorXd Ymn(AMBI_CHANNELS); // Ymn result
Sph_coord(i,0) = atan2(Carth_coord(i,1),Carth_coord(i,0)); // azimuth
Sph_coord(i,1) = atan2(Carth_coord(i,2),sqrt(Carth_coord(i,0)*Carth_coord(i,0) + Carth_coord(i,1)*Carth_coord(i,1))); // elevation
sph_h.Calc(Sph_coord(i,0),Sph_coord(i,1)); // phi theta
sph_h.Get(Ymn);
Sh_matrix.block(i,0,1,AMBI_CHANNELS) = Ymn.transpose();
}
_initialized = true;
}
if (_param_changed)
{
// convert parameters to values for the filter
// ArrayIntParam _shape = shape;
ArrayParam _width = width * (float)M_PI; // 0...pi
ArrayParam _height = height * (float)M_PI;
ArrayParam _gain;
for (int i=0; i < gain.rows();i++)
{
_gain(i) = ParamToRMS(gain(i));
}
SphCoordParam _center_sph = (center_sph - 0.5f)*2.f*M_PI;
// std::cout << _center_sph << std::endl;
CarthCoordParam _center_carth;
//.........这里部分代码省略.........
示例3: calcParams
void Ambix_warpAudioProcessor::calcParams()
{
if (!_initialized)
{
sph_h_in.Init(in_order);
const String t_design_txt (t_design::des_3_240_21_txt);
// std::cout << t_design_txt << std::endl;
String::CharPointerType lineChar = t_design_txt.getCharPointer();
int n = 0; // how many characters been read
int numsamples = 0;
int i = 0;
int curr_n = 0;
int max_n = lineChar.length();
while (curr_n < max_n) { // check how many coordinates we have
double value;
sscanf(lineChar, "%lf\n%n", &value, &n);
lineChar += n;
curr_n += n;
numsamples++;
} // end parse numbers
numsamples = numsamples/3; // xyz
Carth_coord.resize(numsamples,3); // positions in cartesian coordinates
curr_n = 0;
lineChar = t_design_txt.getCharPointer();
// parse line for numbers again and copy to carth coordinate matrix
while (i < numsamples) {
double x,y,z;
sscanf(lineChar, "%lf%lf%lf%n", &x, &y, &z, &n);
Carth_coord(i,0) = x;
Carth_coord(i,1) = y;
Carth_coord(i,2) = z;
lineChar += n;
curr_n += n;
i++;
} // end parse numbers
// std::cout << "Coordinate size: " << Carth_coord.rows() << " x " << Carth_coord.cols() << std::endl;
// std::cout << Carth_coord << std::endl;
Sph_coord.resize(numsamples,2); // positions in spherical coordinates
Eigen::MatrixXd Sh_matrix;
Sh_matrix.setZero(numsamples,AMBI_CHANNELS);
int in_ambi_channels = (in_order+1)*(in_order+1);
for (int i=0; i < numsamples; i++)
{
Eigen::VectorXd Ymn(in_ambi_channels); // Ymn result
Sph_coord(i,0) = atan2(Carth_coord(i,1),Carth_coord(i,0)); // azimuth
Sph_coord(i,1) = atan2(Carth_coord(i,2),sqrt(Carth_coord(i,0)*Carth_coord(i,0) + Carth_coord(i,1)*Carth_coord(i,1))); // elevation
sph_h_in.Calc(Sph_coord(i,0),Sph_coord(i,1)); // phi theta
sph_h_in.Get(Ymn);
// std::cout << "Ymn Size: " << Ymn.size() << std::endl;
// std::cout << "Sh_matrix Size: " << Sh_matrix.size() << std::endl;
//Sh_matrix.row(i) = Ymn;
Sh_matrix.block(i,0,1,in_ambi_channels) = Ymn.transpose();
// std::cout << "Size: " << Sh_matrix.block(i,0,1,in_ambi_channels).size() << ": " << Sh_matrix.block(i,0,1,in_ambi_channels) << std::endl;
}
// Sh_matrix_inv.setZero();
//Sh_matrix_inv = (Sh_matrix.transpose()*Sh_matrix).inverse()*Sh_matrix.transpose(); // not working for dynamic input order
// if input order is different a better solving has to be used for the inverse:
Sh_matrix_inv = (Sh_matrix.transpose()*Sh_matrix).colPivHouseholderQr().inverse()*Sh_matrix.transpose();
// std::cout << "Size Sh_matrix: " << Sh_matrix.rows() << " x " << Sh_matrix.cols() << std::endl;
// std::cout << "Size Inverse: " << Sh_matrix_inv.rows() << " x " << Sh_matrix_inv.cols() << std::endl;
// std::cout << Sh_matrix_inv << std::endl;
_initialized = true;
}
if ( (phi_param != _phi_param) ||
(floor(phi_curve_param+0.5f) != floor(_phi_curve_param+0.5f)) ||
(theta_param != _theta_param) ||
(floor(theta_curve_param+0.5f) != floor(_theta_curve_param+0.5f)) ||
(in_order != _in_order) ||
//.........这里部分代码省略.........