本文整理汇总了C++中Tone::stop方法的典型用法代码示例。如果您正苦于以下问题:C++ Tone::stop方法的具体用法?C++ Tone::stop怎么用?C++ Tone::stop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tone
的用法示例。
在下文中一共展示了Tone::stop方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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