本文整理汇总了C++中Music::display方法的典型用法代码示例。如果您正苦于以下问题:C++ Music::display方法的具体用法?C++ Music::display怎么用?C++ Music::display使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Music
的用法示例。
在下文中一共展示了Music::display方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char** argv)
{
char buffer[256];
const char music_file_name[] = "music_score.dat";
// const char pitch_data_file_name[] = "pitch_data.dat";
const char pitch_samples_file_name[] = "pitch_samples_freq_(a3-c4-d4#-f4#)";
std::vector<double> pitchSamples;
DataReader music_reader(music_file_name);
DataReader pitch_sample_reader(pitch_samples_file_name);
music_reader.read(buffer);
cout<<endl;
pitch_sample_reader.read(buffer);
cout<<endl;
// cin.get();
//
//check to see that the file was opened correctly:
std::ifstream ifile(pitch_samples_file_name, std::ios::in);
if (!ifile.is_open()) {
std::cerr << "There was a problem opening the input file!\n";
exit(1);//exit or do additional error checking
}
double num = 0.0;
//keep storing values from the text file so long as data exists:
while (ifile >> num) {
pitchSamples.push_back(num);
}
//verify that the scores were stored correctly:
#if 0
PitchWindow pw;
pitch_idx_t idx = -1;
PitchDictionary pd;
for (unsigned int i = 0; i < pitchSamples.size(); ++i) {
std::cout << pitchSamples[i] << std::endl;
idx = testPitchNode(pitchSamples[i]);
cout<<"detected pitch: "<<pd.indexToPitchName(pw.insert(idx))<<endl;
}
#endif
MusicDetector md;
md.initiaize();
md.registerMusicNoteListener(musicListener);
md.startDetection(5);
for (unsigned int i = 0; i < pitchSamples.size(); ++i)
{
md.insert(pitchSamples[i]);
}
md.stopDetection();
gMusic.display();
return 0;
}