static YSE::DSP::wavetable & getTable() {
   static YSE::DSP::wavetable  table;
   if (!tableReady) {
     table.createTriangle(8, 1024);
     tableReady = true;
   }
   return table;
 }
int main() {
  YSE::System().init();

  // create a Triangle wavetable with 8 harmonics, 1024 samples long
  wavetable.createTriangle(2, 1024);

  // the sound will play this buffer (looping)
  sound.create(wavetable, nullptr, true).play();

  std::cout << "In this demo a small wavetable is created and played as a loop." << std::endl;
  std::cout << "(Press e to exit.)" << std::endl;

  while (true) {
    if (_kbhit()) {
      char ch = _getch();
      switch (ch) {
      

      case 'e': goto exit;
      }
    }
    YSE::System().sleep(100);
    YSE::System().update();
  }


exit:
  YSE::System().close();
  return 0;
}