本文整理汇总了C++中Tone::play方法的典型用法代码示例。如果您正苦于以下问题:C++ Tone::play方法的具体用法?C++ Tone::play怎么用?C++ Tone::play使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tone
的用法示例。
在下文中一共展示了Tone::play方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: playSection
void playSection(int notes[],int bassNote,int repeat,int length){ // play notes
for(int j=0;j<repeat;j++){
if(bassNote != 13){
tone2.play(bass[bassNote],(length - 1 * 300)); // TODO: calculate how long to play bass
}
for(int i=0;i<=length-1;i++){
tone1.play(notes[i]);
delay(300);
tone1.stop();
}
tone2.stop();
}
}
示例2: task
void SoundTask::task() {
while(true) {
Tone tone;
if(xQueueReceive(_tones, &tone, portMAX_DELAY) == pdTRUE) {
tone.play();
}
}
}
示例3: beep
//*********************************************************************************************************
void beep()
{
#ifdef _USE_ARDUINO_TONE
tone(SPEAKER_PIN2, NOTE_C8, 200);
#else
// beep after reset;
noiseMaker.play(NOTE_C8, 200);
#endif
}
示例4: loop
void loop(){
buttonState = digitalRead(buttonPin);
if (buttonState == LOW){
for(i = 0; i < 7; i = i + 1){
mytone.play(songTones[i], 1000);
delay(1000);
}
}
else { //HERE I GO AGAIN RECORD MODE
mytone.stop(); //silence
for(i = 0; i < 7; i = i + 1){
int inVar = analogRead(0); //read the varible resistor for a value
// map the input to a frequency range between 200 and 2000 Hz
int note = map(inVar, 0, 1023, 220, 2000);
songTones[i] = note; //set value
mytone.play(note, 1000);//play value, duration small
// mytone.stop(); //silence
delay(1000);
}
//end tone?
}//end if/else
}//endloop
示例5: loop
void loop() {
note_raw = analogRead(NOTE_PIN);
beat_raw = analogRead(BEAT_PIN);
// note = dist2note[distance(note_raw)];
// if (beat_raw > BEAT_TH) {
// if (note != last_note) {
// last_note = note;
// tn.play(notes[note]);
// }
// } else {
// tn.stop()
// }
for (int i = 0; i < 89; i++) {
tn.play(all_notes[i]);
if (DELAY) {
delay(DELAY);
}
}
}
示例6: loop
void loop() {
for (int i; i < 12; i++) {
tone.play(note[i]);
delay(1000);
}
}