example.cpp

来自「一个96K的3D游戏源码」· C++ 代码 · 共 45 行

CPP
45
字号
#include <windows.h>
#include <conio.h>

#include "tf_main.h"

using namespace Tunefish;

#include "song.h"
#include "instruments.h"
#include "effects.h"


int main()
{
   printf("Tunefish 0.9.3\n");

   // synth...
   Tunefish::Song  *song  = new Tunefish::Song((unsigned char *)notes, (double *)instruments);
   Tunefish::Synth *synth = new Tunefish::Synth(song, (double *)effects);

   if (!synth)
      return 0;

   synth->play(1.0f, false);

   bool more = true;
   while (synth->process(&more) && !_kbhit()) 
   { 
#ifdef _WIN32
      Sleep(10);
#else
      sleep(1);
#endif
   }


   synth->stop();

   delete synth;
   delete song;

   return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?