//-------------------------------------------------------------- ofxGranularSynth::ofxGranularSynth(string path){ mDuration = 3000; mBlank = 200; mPosition = 0; mOverlap = 50; mVolume = 0.9f; loadWave(path); }
RenderController::RenderController(MainWindow *mainWindow, QObject *parent): QObject(parent) { this->mainWindow = mainWindow; light = new DirectionalLight; arcBall = new ArcBall(500); wireframe = false; lightRotation = false; this->display = new GLDisplay(); mainWindow->setGLDisplay(display); { // esta ordem deve ser mantida display->updateGL(); scene = new Scene3D(mainWindow); connect(display, SIGNAL(drawModel()), this, SLOT(drawModel())); connect(display, SIGNAL(lightSetup()), this, SLOT(lightSetup())); } connect(display, SIGNAL(mouseLefthFinish(QPoint,QPoint)), this, SLOT(mouseLefthFinish(QPoint,QPoint))); connect(display, SIGNAL(mouseLeftMove(QPoint,QPoint)), this, SLOT(mouseLeftMove(QPoint,QPoint))); connect(display, SIGNAL(mouseCancel()), this, SLOT(mouseCancel())); connect(mainWindow, SIGNAL(loadWave(QString)), this, SLOT(loadWave(QString))); connect(mainWindow, SIGNAL(saveWave(QString)), this, SLOT(saveWave(QString))); connect(mainWindow->actionClose, SIGNAL(triggered()), this, SLOT(closeScene())); connect(mainWindow->actionWireFrame, SIGNAL(triggered()), this, SLOT(wireFrameToggle())); connect(&timer, SIGNAL(timeout()), this, SLOT(timeOut())); timer.start(30); mainWindow->showMaximized(); }
bool GameWorldScene::init(){ if ( !CCLayer::init()) { return false; } wave = 0; loadGameWorld(); loadTowerPosition(); loadWayPoinst(); loadWave(); setTouchEnabled( true ); return true; }
WaveSystem::WaveSystem(entityx::EventManager &events) : events_(events), waves_(loadWave("resource/waves.json")), timer_(waves_[0][0].getDelay()), startNextWave_(true), signalBegin_(true), destroyedCreepsAmount_(0), currentWave_(0), wavesCreepsAmount_(), totalWaves_(waves_.size()) { for(auto& wave : waves_) { int spawnedCreepsAmount = 0; for(auto& spawn : wave) spawnedCreepsAmount += spawn.getQuantity(); wavesCreepsAmount_.push_back(spawnedCreepsAmount); } }
AudioPlayer::AudioPlayer(const char *_waveFile, const int FFTwindowSize) { waveFile = _waveFile; // Create a audio context device = alcOpenDevice(NULL); context = alcCreateContext(device, NULL); alcMakeContextCurrent(context); // Create a audio listener alListener3f(AL_POSITION, 0, 0, 0); alListener3f(AL_VELOCITY, 0, 0, 0); alListener3f(AL_ORIENTATION, 0, 0, -1); // Create a audio source alGenSources(1, &source); // Setup properties of audio source alSourcef(source, AL_PITCH, 1); alSourcef(source, AL_GAIN, 1); alSource3f(source, AL_POSITION, 0, 0, 0); alSource3f(source, AL_VELOCITY, 0, 0, 0); alSourcei(source, AL_LOOPING, AL_FALSE); // Create a audio buffer alGenBuffers(1, &buffer); // No WAVE file is loaded isLoaded = false; // Setup FFTW N = FFTwindowSize; fftIn = new double[N]; fftOut = new fftw_complex[ getNumberFrequencies() ]; fftPlan = fftw_plan_dft_r2c_1d(N, fftIn, fftOut, FFTW_ESTIMATE); loadWave(); }