当前位置: 首页>>代码示例>>C++>>正文


C++ Tone类代码示例

本文整理汇总了C++中Tone的典型用法代码示例。如果您正苦于以下问题:C++ Tone类的具体用法?C++ Tone怎么用?C++ Tone使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Tone类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: while

void SoundTask::task() {
    while(true) {
        Tone tone;
        if(xQueueReceive(_tones, &tone, portMAX_DELAY) == pdTRUE) {
            tone.play();
        }
    }
}
开发者ID:Embedder74,项目名称:Mk2-Firmware,代码行数:8,代码来源:SoundTask.cpp

示例2: set

	void set(std::string a, Tone b, Tone c, Tone d)
	{
		Tone zero;
		zero.set("x", 0.00);

		name = a;
		tone1 = b;
		tone2 = c;
		tone3 = d;
		tone4 = zero;

	}
开发者ID:laurensvr,项目名称:TI3A-AI,代码行数:12,代码来源:Sound1.cpp

示例3: needsEffectRender

	bool needsEffectRender(bool flashing)
	{
		bool rectEffective = !rect->isEmpty();
		bool colorToneEffective = color->hasEffect() || tone->hasEffect() || flashing;

		return (rectEffective && colorToneEffective && isOnScreen);
	}
开发者ID:Alex223124,项目名称:mkxp,代码行数:7,代码来源:viewport.cpp

示例4: in

void rawGenerator::in(Tone a)
{
	double x = 0, y = 0, z = 0;

	const double increment1 = (a.getFrequency() / SAMPLE_RATE);

	cout << "Creating a mix of: " << a.getFrequency() << endl;
	cout << "Creating a mix of: " << increment1 << endl;
	cout << "Samples:     " << SAMPLES << endl;
	cout << "Sample rate: " << SAMPLE_RATE << endl;

	for (unsigned i = 0; i < SAMPLES; i++)
	{
		waveOut[i] = (sin(x * TWO_PI)) * AMPLITUDE;
		x += increment1;
	}
}
开发者ID:laurensvr,项目名称:TI3A-AI,代码行数:17,代码来源:Sound1.cpp

示例5: 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
开发者ID:jpfinley,项目名称:jpf-mfa-sva-ixd-arduino,代码行数:23,代码来源:synth.cpp

示例6: redrawBaseTex

	void redrawBaseTex()
	{
		if (nullOrDisposed(windowskin))
			return;

		if (base.tex.tex == TEX::ID(0))
			return;

		FBO::bind(base.tex.fbo);

		/* Clear texture */
		glState.clearColor.pushSet(Vec4());
		FBO::clear();
		glState.clearColor.pop();

		glState.viewport.pushSet(IntRect(0, 0, base.tex.width, base.tex.height));
		glState.blend.pushSet(false);

		ShaderBase *shader;

		if (backOpacity < 255 || tone->hasEffect())
		{
			PlaneShader &planeShader = shState->shaders().plane;
			planeShader.bind();

			planeShader.setColor(Vec4());
			planeShader.setFlash(Vec4());
			planeShader.setTone(tone->norm);
			planeShader.setOpacity(backOpacity.norm);

			shader = &planeShader;
		}
		else
		{
			shader = &shState->shaders().simple;
			shader->bind();
		}

		windowskin->bindTex(*shader);
		TEX::setSmooth(true);

		shader->setTranslation(Vec2i());
		shader->applyViewportProj();

		/* Draw stretched layer */
		base.vert.draw(0, 1);

		glState.blend.set(true);
		glState.blendMode.pushSet(BlendKeepDestAlpha);

		/* Draw tiled layer */
		base.vert.draw(1, base.bgTileQuads);

		glState.blendMode.set(BlendNormal);

		/* If we used plane shader before, switch to simple */
		if (shader != &shState->shaders().simple)
		{
			shader = &shState->shaders().simple;
			shader->bind();
			shader->setTranslation(Vec2i());
			shader->applyViewportProj();
			windowskin->bindTex(*shader);
		}

		base.vert.draw(1+base.bgTileQuads, base.borderQuads);

		TEX::setSmooth(false);

		glState.blendMode.pop();
		glState.blend.pop();
		glState.viewport.pop();
	}
开发者ID:Alex223124,项目名称:mkxp,代码行数:73,代码来源:windowvx.cpp

示例7: setup

void setup(void)
{
  tone1.begin(13);
  tone2.begin(12);
  
  pinMode(2, INPUT);
  pinMode(3, INPUT);
  Serial.begin(9600);
}
开发者ID:weaknetlabs,项目名称:friday-13th-nes-music,代码行数:9,代码来源:f13th-nes-theme.c

示例8: audio_callback

void audio_callback(void* udata, Uint8* instream, int len)
{
    Sint16* stream = (Sint16*)instream;
    Sint16* p = stream;

    while (len > 0) {
        *p++ = int(3000 * TONE.fetch_left());
        *p++ = int(3000 * TONE.fetch_right());

        len -= 4;
    }

    TONE.sanitize();
}
开发者ID:codders,项目名称:soylent,代码行数:14,代码来源:main.cpp

示例9: 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(); 
  }  
}
开发者ID:weaknetlabs,项目名称:friday-13th-nes-music,代码行数:14,代码来源:f13th-nes-theme.c

示例10: beep

//*********************************************************************************************************
void beep()
{
#ifdef _USE_ARDUINO_TONE
	tone(SPEAKER_PIN2, NOTE_C8, 200);
#else
	// beep after reset;
	noiseMaker.play(NOTE_C8, 200);
#endif
}
开发者ID:the-kenny,项目名称:WiserClock,代码行数:10,代码来源:Sound.cpp

示例11: setupSpeaker

//*********************************************************************************************************
void setupSpeaker()
{
	// REM: should exploit the 2 sound levels, by driving both speaker pins;
	pinMode(SPEAKER_PIN1, OUTPUT);
	digitalWrite(SPEAKER_PIN1, LOW);

	pinMode(SPEAKER_PIN2, OUTPUT);

#ifndef _USE_ARDUINO_TONE
	noiseMaker.begin(SPEAKER_PIN2);
#endif
}
开发者ID:the-kenny,项目名称:WiserClock,代码行数:13,代码来源:Sound.cpp

示例12: 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);
        }
    }
}
开发者ID:bmiro,项目名称:theramic,代码行数:21,代码来源:all_octaves.cpp

示例13: setup

void setup() {                
    Serial.begin(9600);
    init_note_distances();
    tn.begin(11);
}
开发者ID:bmiro,项目名称:theramic,代码行数:5,代码来源:all_octaves.cpp

示例14: setup

void setup() {                
    Serial.begin(9600);
    tone.begin(12);
}
开发者ID:bmiro,项目名称:theramic,代码行数:4,代码来源:audio_output.c

示例15: loop

void loop() {
    for (int i; i < 12; i++) {
        tone.play(note[i]);
        delay(1000);
    }
}
开发者ID:bmiro,项目名称:theramic,代码行数:6,代码来源:audio_output.c


注:本文中的Tone类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。