Beispiel #1
0
void PlaySound(Int type) {
  SndCommandType          sndCmd;

  if ( GetFlag( flag_NoSound ) ) return;

  sndCmd.cmd = sndCmdFreqDurationAmp;
  //sndCmd.param2 = 70;
  sndCmd.param2 = 100;
  sndCmd.param3 = SoundAmp;

  /* FREQ:
   *     261.62  C (middle)
   *     293.63  D
   *     349.22  E
   *     391.99  G
   *     440     A
   *     493.88  B
   */

  switch( type ) {
  case SND_ERASE_CUBE:
    sndCmd.param2 = 1;
    sndCmd.param1 = 261.62;
    SndDoCmd( 0, &sndCmd, 0/*noWait*/ );
    break;
  case SND_DRAW_CUBE:
    sndCmd.param2 = 1;
    sndCmd.param1 = 493.88;
    SndDoCmd( 0, &sndCmd, 0/*noWait*/ );
    break;
  default:
    sndCmd.param1 = 440;
    SndDoCmd( 0, &sndCmd, 0/*noWait*/ );
    break;
  }
            

}
Beispiel #2
0
void playFreq(SndCmdIDType cmd, int freq, int time, int amp)
{
   SndCommandType soundCmd;
  
   //soundCmd.cmd=sndCmdFreqDurationAmp; // blocking

   // non-blocking!  better to use this and key press start sound, key up ends it.
   soundCmd.cmd=cmd; // sndCmdFrqOn; 

   soundCmd.param1 = freq; /*freq in hz */
   soundCmd.param2 = time; /*max dur in ms */
   soundCmd.param3 = amp; /*amp 0 - sndMaxAmp */

   SndDoCmd(NULL, &soundCmd, 0/*nowait*/);

      //} else {
      // if sound off delay useful for playback
      //if (cmd == sndCmdFreqDurationAmp) // force delay
      //   SysTaskDelay((time * SysTicksPerSecond())/1000);
      //}
}
Beispiel #3
0
/* SoundLevelType: slOn, slOff
   gameSoundLevel found in SystemPreferencesType
 */
void do_feep(Long frq, UInt dur)
{
  SystemPreferencesChoice allgamesound;

  if (!my_prefs.sound) return;

#ifdef I_AM_OS_2
  allgamesound = prefGameSoundLevel;
#else
  allgamesound = prefGameSoundLevelV20;
#endif

  if (PrefGetPreference(allgamesound) != slOff) {
    /* click: 200, 9
       confirmation: 500, 70  */
    SndCommandType sndCmd;
    sndCmd.cmd = sndCmdFreqDurationAmp; /* "play a sound" */
    sndCmd.param1 = frq; /* frequency in Hz */
    sndCmd.param2 = dur; /* duration in milliseconds */
    sndCmd.param3 = sndDefaultAmp; /* amplitude (0 to sndMaxAmp) */
    SndDoCmd(0, &sndCmd, true);
  }
}
Beispiel #4
0
void stopFreq()
{
   SndCommandType soundCmd;
   soundCmd.cmd=sndCmdQuiet;
   SndDoCmd(NULL, &soundCmd, 0/*nowait*/);
}