Exemple #1
0
void MoviePlayer::play() {
	if (_vm->getBitFlag(40)) {
		_vm->setBitFlag(42, false);
		startSound();
		return;
	}

	_leftButtonDown = false;
	_rightButtonDown = false;
	_skipMovie = false;

	_vm->_mixer->stopAll();

	_ticks = _vm->_system->getMillis();

	startSound();

	playVideo();
	stopVideo();

	_vm->o_killAnimate();

	if (_vm->getBitFlag(41)) {
		_vm->fillBackFromFront();
	} else {
		uint8 palette[768];
		memset(palette, 0, sizeof(palette));
		_vm->clearSurfaces();
		_vm->_system->getPaletteManager()->setPalette(palette, 0, 256);
	}

	_vm->fillBackGroundFromBack();
	_vm->_fastFadeOutFlag = true;
}
Exemple #2
0
void Player_AD::saveLoadWithSerializer(Serializer *ser) {
	Common::StackLock lock(_mutex);

	if (ser->getVersion() < VER(95)) {
		IMuse *dummyImuse = IMuse::create(_vm->_system, NULL, NULL);
		dummyImuse->save_or_load(ser, _vm, false);
		delete dummyImuse;
		return;
	}

	if (ser->getVersion() >= VER(96)) {
		int32 res[4] = {
			_soundPlaying, _sfx[0].resource, _sfx[1].resource, _sfx[2].resource
		};

		// The first thing we save is a list of sound resources being played
		// at the moment.
		ser->saveLoadArrayOf(res, 4, sizeof(res[0]), sleInt32);

		// If we are loading start the music again at this point.
		if (ser->isLoading()) {
			if (res[0] != -1) {
				startSound(res[0]);
			}
		}

		uint32 musicOffset = _curOffset;

		static const SaveLoadEntry musicData[] = {
			MKLINE(Player_AD, _engineMusicTimer, sleInt32, VER(96)),
			MKLINE(Player_AD, _musicTimer, sleUint32, VER(96)),
			MKLINE(Player_AD, _internalMusicTimer, sleUint32, VER(96)),
			MKLINE(Player_AD, _curOffset, sleUint32, VER(96)),
			MKLINE(Player_AD, _nextEventTimer, sleUint32, VER(96)),
			MKEND()
		};

		ser->saveLoadEntries(this, musicData);

		// We seek back to the old music position.
		if (ser->isLoading()) {
			SWAP(musicOffset, _curOffset);
			musicSeekTo(musicOffset);
		}

		// Finally start up the SFX. This makes sure that they are not
		// accidently stopped while seeking to the old music position.
		if (ser->isLoading()) {
			for (int i = 1; i < ARRAYSIZE(res); ++i) {
				if (res[i] != -1) {
					startSound(res[i]);
				}
			}
		}
	}
}
Exemple #3
0
void Player_AD::saveLoadWithSerializer(Common::Serializer &s) {
	Common::StackLock lock(_mutex);

	if (s.getVersion() < VER(95)) {
		IMuse *dummyImuse = IMuse::create(_vm->_system, NULL, NULL);
		dummyImuse->saveLoadIMuse(s, _vm, false);
		delete dummyImuse;
		return;
	}

	if (s.getVersion() >= VER(96)) {
		int32 res[4] = {
			_musicResource, _sfx[0].resource, _sfx[1].resource, _sfx[2].resource
		};

		// The first thing we save is a list of sound resources being played
		// at the moment.
		s.syncArray(res, 4, Common::Serializer::Sint32LE);

		// If we are loading start the music again at this point.
		if (s.isLoading()) {
			if (res[0] != -1) {
				startSound(res[0]);
			}
		}

		uint32 musicOffset = _curOffset;

		s.syncAsSint32LE(_engineMusicTimer, VER(96));
		s.syncAsUint32LE(_musicTimer, VER(96));
		s.syncAsUint32LE(_internalMusicTimer, VER(96));
		s.syncAsUint32LE(_curOffset, VER(96));
		s.syncAsUint32LE(_nextEventTimer, VER(96));

		// We seek back to the old music position.
		if (s.isLoading()) {
			SWAP(musicOffset, _curOffset);
			musicSeekTo(musicOffset);
		}

		// Finally start up the SFX. This makes sure that they are not
		// accidently stopped while seeking to the old music position.
		if (s.isLoading()) {
			for (int i = 1; i < ARRAYSIZE(res); ++i) {
				if (res[i] != -1) {
					startSound(res[i]);
				}
			}
		}
	}
}
Exemple #4
0
//---------------------------------------------------------------------------------
void VblankHandler(void) {
//---------------------------------------------------------------------------------

    u32 i;
    uint8 ct[sizeof(IPC->time.curtime)];

    //sound code  :)
    TransferSound *snd = IPC->soundData;
    IPC->soundData = 0;

    rtcGetTime((uint8 *)ct);
    BCDToInteger((uint8 *)&(ct[1]), 7);

    for(i=0; i<sizeof(ct); i++) {
        IPC->time.curtime[i] = ct[i];
    }

    if (0 != snd) {

        for (i=0; i<snd->count; i++) {
            s32 chan = getFreeSoundChannel();

            if (chan >= 0) {
                startSound(snd->data[i].rate, snd->data[i].data, snd->data[i].len, chan, snd->data[i].vol, snd->data[i].pan, snd->data[i].format);
            }
        }
    }
    Wifi_Update(); // update wireless in vblank
}
Exemple #5
0
void ds_playsound_on_channel(void *data, int length, int samplerate, int channel, int vol, int panning)
{
//	ARM7_PRINTF("using channel %d\n", channel);
	
	if (channel != -1)
		startSound(samplerate, data, length, channel, vol, panning, 1, false);
}
static void list_eos_callback(void *list, ALuint source)
{
	soundList *s = (soundList *) list;

	int a = s->cacheIndex;
	alDeleteSources(1, &source);
	if(alGetError() != AL_NO_ERROR)
	{
		debugOut( "Failed to delete OpenAL source!\n");
	}
	soundCache[a].playingOnSource = 0;
	soundCache[a].playing = false;
	soundCache[a].looping = false;
	s-> cacheIndex = false;
	if (SilenceIKillYou) {
		while (s = deleteSoundFromList(s));
	} else {
		if (s->next) {
			if (s->next == s) {
				int v = defSoundVol;
				defSoundVol = soundCache[a].vol;
				startSound (s->sound, true);
				defSoundVol = v;
				while (s = deleteSoundFromList(s));
				return;
			}
			s->next->vol = soundCache[a].vol;
			playSoundList(s->next);
		} else {
			while (s = deleteSoundFromList(s));
		}
	}
}
Exemple #7
0
void Application::run(void)
	{
	/* Install callbacks with the tool manager: */
	ToolManager* toolManager=getToolManager();
	toolManager->getToolCreationCallbacks().add(this,&Application::toolCreationCallback);
	toolManager->getToolDestructionCallbacks().add(this,&Application::toolDestructionCallback);
	
	/* Install Vrui callbacks: */
	setFrameFunction(frameWrapper,this);
	setDisplayFunction(displayWrapper,this);
	setSoundFunction(soundWrapper,this);
	
	/* Start the display: */
	startDisplay(0,0);
	
	/* Start the sound renderer if requested: */
	if(useSound)
		startSound(initSoundWrapper,this);
	
	/* Run the Vrui main loop: */
	mainLoop();
	
	/* Uninstall tool manager callbacks: */
	toolManager->getToolCreationCallbacks().remove(this,&Application::toolCreationCallback);
	toolManager->getToolDestructionCallbacks().remove(this,&Application::toolDestructionCallback);
	}
Exemple #8
0
extern "C" void ds_playsound(void *data, int length, int samplerate)
{
	s32 channel = getFreeSoundChannel();
//	ARM7_PRINTF("using channel %d\n", channel);
	
	if (channel != -1)
		startSound(samplerate, data, length, channel, 127, 64, 0, false);
}
	static void update(){ //update method pattern
		if(head_ == tail_) return;
		
		RessourceId resource = loadSound(pending_[head_].id);
		int channel = findOpenChannel();
		if(channel == -1) return;
		startSound(resource, channel, pending_[head_].volume);

		head_ = (head_ +1) % MAX_PENDING;
	}
Exemple #10
0
void loadSounds (FILE * fp) {
	for (int i = 0; i < MAX_SAMPLES; i ++) freeSound (i);

	while (fgetc (fp)) {
		int fileLoaded = get2bytes (fp);
		defSoundVol = get2bytes (fp);
		startSound (fileLoaded, 1);
	}

	defSoundVol = get2bytes (fp);
	defVol = get2bytes (fp);
}
void GUISoundManager::playBackgroundMusic() {
	if (play == false) {
		if (enabled && backgroundTitle >= 0 && (unsigned)backgroundTitle<backgroundSounds.size()) {
			bool playing = false;
			GameEvent isPlaying(GameEvent::E_GET_SOUND_ISPLAYING, &GameEventData(&playing), 0x0);
			GameEngine::sendEvent(backgroundSounds[backgroundTitle], &isPlaying);
			if (!playing)
			{	
				GameEvent startSound(GameEvent::E_PLAY_SOUND, 0x0, 0x0);
				GameEngine::sendEvent(backgroundSounds[backgroundTitle], &startSound);
				play = true;
			}
		}
	}

}
Exemple #12
0
void renderScene(void)
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glLoadIdentity();
	glEnable(GL_TEXTURE_2D);

	if(gamestate == 1) //launch menu
	{
		gluLookAt( x, 1.0f, z,
			x+lx, 1.0f, z+lz,
			0.0f, 1.0f, 0.0f);
		startSound("trooper.wav", 100);
		glTranslatef(1.0f, 2.0f, 0.0f);
		gluLookAt( x, 1.0f, z,
			x+lx, 1.0f, z+lz,
			0.0f, 1.0f, 0.0f);

		glBindTexture( GL_TEXTURE_2D, introTexture );

		glBegin( GL_QUADS );

		glTexCoord2f(0, 1);
		glVertex2f(-10,-5.0);
		glTexCoord2f(1, 1);
		glVertex2f(10,-5.0);
		glTexCoord2f(1, 0);
		glVertex2f(10.0, 5.0);
		glTexCoord2f(0, 0);
		glVertex2f(-10.0, 5.0);

		glEnd();
	}

	else //Render game
	{
		for(int i = 0; i < renderObjects.size(); i++)
		{
			renderObjects[i]->Render();
		}
	}
	glutSwapBuffers();
}
Exemple #13
0
/*this function checks temperature for the thermostat values according*/
inline void checkTemperature(){
	if ( (thermostatSettings.isActive) && (workMode != 1) ){
		if ( (currentTemp > thermostatSettings.maximalTemp) || (currentTemp < thermostatSettings.minimalTemp) ){
			LED_PORT |= (1 << LED_ERROR_IO);
			LED_PORT &= ~(1 << LED_OK_IO);
			
			workMode = 2;
			
			startSound();
			return;
		}
		
		LED_PORT |= (1 << LED_OK_IO);
		LED_PORT &= ~(1 << LED_ERROR_IO);
		return;
	}
	
	LED_PORT &= ~(1 << LED_ERROR_IO);
	LED_PORT &= ~(1 << LED_OK_IO);
	stopSound();
}
Exemple #14
0
extern "C" int ds_playsound_looping(void *data, int length, int samplerate, int *channels, int num_channels)
{
	/*for (int count = 0; count < num_channels; count++)
	{
		s32 channel = getFreeSoundChannel();
		
		if (channel == -1)
			return 0;
		
		channels[count] = channel;
	}*/
	
	channels[0] = 15;
		
//	ARM7_PRINTF("using channel %d\n", channel);
	
	for (int count = 0; count < num_channels; count++)
		startSound(samplerate, data, length, channels[count], 127, 64, 0, true);
	
	return num_channels;
}
//---------------------------------------------------------------------------------
void VblankHandler(void) {
//---------------------------------------------------------------------------------

	u32 i;


	//sound code  :)
	TransferSound *snd = IPC->soundData;
	IPC->soundData = 0;

	if (0 != snd) {

		for (i=0; i<snd->count; i++) {
			s32 chan = getFreeSoundChannel();

			if (chan >= 0) {
				startSound(snd->data[i].rate, snd->data[i].data, snd->data[i].len, chan, snd->data[i].vol, snd->data[i].pan, snd->data[i].format);
			}
		}
	}

	CommandProcessCommands();
}         
Exemple #16
0
void MoviePlayerDXA::nextFrame() {
	if (_bgSoundStream && _vm->_mixer->isSoundHandleActive(_bgSound) && needsUpdate()) {
		copyFrameToBuffer(_vm->getBackBuf(), 465, 222, _vm->_screenWidth);
		return;
	}

	if (_vm->_interactiveVideo == TYPE_LOOPING && endOfVideo()) {
		rewind();
		startSound();
	}

	if (!endOfVideo()) {
		if (_vm->_interactiveVideo == TYPE_OMNITV) {
			copyFrameToBuffer(_vm->getBackBuf(), 465, 222, _vm->_screenWidth);
		} else if (_vm->_interactiveVideo == TYPE_LOOPING) {
			copyFrameToBuffer(_vm->getBackBuf(), (_vm->_screenWidth - getWidth()) / 2, (_vm->_screenHeight - getHeight()) / 2, _vm->_screenWidth);
		}
	} else if (_vm->_interactiveVideo == TYPE_OMNITV) {
		close();
		_vm->_interactiveVideo = 0;
		_vm->_variableArray[254] = 6747;
	}
}
        void SoundEmitter::handleSourceState()
        {
          bool should_be_active = isActive() ;

          if (!m_reader && should_be_active)
          {
            InformationMessage("Sound", "SoundEmitter::initSound real") ;
            m_reader = getManager()->createReader(getSoundFileName(),
                                                  isEvent(),
                                                  m_posInFile,
                                                  m_posInBuffer) ;

            alSourcei(getSource(),AL_SOURCE_RELATIVE,AL_FALSE) ;
          }

          if (should_be_active)
          {
            ALint state;
            alGetSourcei(getSource(),AL_SOURCE_STATE,&state) ;
            if (state == AL_STOPPED || state == AL_INITIAL)
            {
              startSound(m_viewpoint) ;
            }
          }

          if (m_reader && !should_be_active)
          {
            ALint state;
            alGetSourcei(getSource(),AL_SOURCE_STATE,&state) ;
            if (state == AL_PLAYING)
            {
              stopSound() ;
              m_reader = NULL ;
            }
          }
        }
Exemple #18
0
void Imuse::startVoice(const char *soundName, int volume, int pan) {
    if (gDebugLevel == DEBUG_IMUSE || gDebugLevel == DEBUG_ALL)
        printf("Imuse::startVoice(): SoundName %s, vol:%d, pan:%d\n", soundName, volume, pan);
    startSound(soundName, IMUSE_VOLGRP_VOICE, 0, volume, pan, 127, NULL);
}
int main(void)
{
	system("mode con lines=25 cols=80");	//콘솔 창 크기 초기화

	UserInfo *userInfo = NULL;
	FILE *readFile = NULL;
	FILE *writeFile = NULL;
	int input = 1, menu = 1, choice;
	int *ptr = &menu;
	char *menu_num[MENU_NUM];

	puts("\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t        =  시작하는 중  = \n\n\n\n\n\n\n\n\n\n\n");

	userInfo = setUserInfo(userInfo, readFile);	//구조체 배열에 파일 데이터 저장
	if (userInfo == (UserInfo*)-1) return 0;	//오류 났을 경우 바로 종료

	startSound();	//로딩 완료 효과음

	printMainSub(menu, menu_num);	//메인 메뉴 구성

	while(1) {
		printMain(menu, menu_num);	//메인 화면 출력
		
		input = getch();	//입력
		
		if (input == ARROW_BUFFER)	//방향키는 입력 시 아스키확장 값이 먼저 들어온 후 값이 들어옴
			input = getch();	//그래서 이 경우 버퍼를 한번 비우도록 하였음

		switch (input)
		{
		case UP_ARROW_KEY:	//상 방향키
			if (menu > 1) menu--;
			moveSound();
			break;
		case DOWN_ARROW_KEY:	//하 방향키
			if (menu < 6) menu++;
			moveSound();
			break;
		case ENTER_KEY:		//enter키
			inSound();
			switch (menu)
			{
			case 1:	//출력
				printList(userInfo);
				break;
			case 2:	//등록
				addUser(userInfo);
				break;
			case 3:	//삭제
				searchMain(userInfo, _DELETE, "삭제", "Delete");
				break;
			case 4:	//수정
				searchMain(userInfo, MODIFY, "수정", "Modify");
				break;
			case 5:	//검색
				searchMain(userInfo, SEARCH, "검색", "Search");
				break;
			case 6:	//저장
				saveInfo(userInfo, writeFile);
				break;

			} //switch(menu) out
			break;
		case ESC_KEY:		//esc키
			inSound();
			choice = closeProgram();

			if (choice == SAVE)
				choice = saveInfo(userInfo, writeFile);

			if (choice == SAVE || choice == EXIT){
				printClose();

				free(userInfo);

				closeSound();
				printClose_sub();
				return 0;
			}
			else break;
		default:
			warningMessage(input - '0', 6, ptr);
			break;
		} //switch(input) out
	}

	free(userInfo);
	return 0;
}
void IMuseDigital::startMusicWithOtherPos(const char *soundName, int soundId, int hookId, int volume, Track *otherTrack) {
	debug(5, "startMusicWithOtherPos(%s, soundId:%d, hookId:%d, oldSoundId:%d)", soundName, soundId, hookId, otherTrack->soundId);
	startSound(soundId, soundName, IMUSE_BUNDLE, IMUSE_VOLGRP_MUSIC, NULL, hookId, volume, 126, otherTrack);
}
void IMuseDigital::startSfx(int soundId, int priority) {
	debug(5, "startSfx(%d)", soundId);
	startSound(soundId, "", IMUSE_RESOURCE, IMUSE_VOLGRP_SFX, NULL, 0, 127, priority, NULL);
}
void IMuseDigital::startMusic(int soundId, int volume) {
	debug(5, "startMusicResource(%d)", soundId);
	startSound(soundId, "", IMUSE_RESOURCE, IMUSE_VOLGRP_MUSIC, NULL, 0, volume, 126, NULL);
}
void IMuseDigital::startMusic(const char *soundName, int soundId, int hookId, int volume) {
	debug(5, "startMusicBundle(%s, soundId:%d, hookId:%d)", soundName, soundId, hookId);
	startSound(soundId, soundName, IMUSE_BUNDLE, IMUSE_VOLGRP_MUSIC, NULL, hookId, volume, 126, NULL);
}
void IMuseDigital::startVoice(int soundId, Audio::AudioStream *input) {
	debug(5, "startVoiceStream(%d)", soundId);
	startSound(soundId, "", 0, IMUSE_VOLGRP_VOICE, input, 0, 127, 127, NULL);
}
void IMuseDigital::startVoice(int soundId, const char *soundName) {
	debug(5, "startVoiceBundle(%s, %d)", soundName, soundId);
	startSound(soundId, soundName, IMUSE_BUNDLE, IMUSE_VOLGRP_VOICE, NULL, 0, 127, 127, NULL);
}
void CDemo::loadSceneData()
{
	// load quake level

	video::IVideoDriver* driver = device->getVideoDriver();
	scene::ISceneManager* sm = device->getSceneManager();

	// Quake3 Shader controls Z-Writing
	sm->getParameters()->setAttribute(scene::ALLOW_ZWRITE_ON_TRANSPARENT, true);

	quakeLevelMesh = (scene::IQ3LevelMesh*) sm->getMesh("maps/20kdm2.bsp");

	if (quakeLevelMesh)
	{
		u32 i;

		//move all quake level meshes (non-realtime)
		core::matrix4 m;
		m.setTranslation(core::vector3df(-1300,-70,-1249));

		for ( i = 0; i != scene::quake3::E_Q3_MESH_SIZE; ++i )
			sm->getMeshManipulator()->transform(quakeLevelMesh->getMesh(i), m);

		quakeLevelNode = sm->addOctreeSceneNode<video::S3DVertex2TCoords>(
				quakeLevelMesh->getMesh( scene::quake3::E_Q3_MESH_GEOMETRY));
		if (quakeLevelNode)
		{
			//quakeLevelNode->setPosition(core::vector3df(-1300,-70,-1249));
			quakeLevelNode->setVisible(true);

			// create map triangle selector
			mapSelector = sm->createOctreeTriangleSelector(quakeLevelMesh->getMesh(0),
				quakeLevelNode, 128);

			// if not using shader and no gamma it's better to use more lighting, because
			// quake3 level are usually dark
			quakeLevelNode->setMaterialType ( video::EMT_LIGHTMAP_M4 );

			// set additive blending if wanted
			if (additive)
				quakeLevelNode->setMaterialType(video::EMT_LIGHTMAP_ADD);
		}

		// the additional mesh can be quite huge and is unoptimized
		scene::IMesh * additional_mesh = quakeLevelMesh->getMesh ( scene::quake3::E_Q3_MESH_ITEMS );

		for ( i = 0; i!= additional_mesh->getMeshBufferCount (); ++i )
		{
			scene::IMeshBuffer *meshBuffer = additional_mesh->getMeshBuffer ( i );
			const video::SMaterial &material = meshBuffer->getMaterial();

			//! The ShaderIndex is stored in the material parameter
			s32 shaderIndex = (s32) material.MaterialTypeParam2;

			// the meshbuffer can be rendered without additional support, or it has no shader
			const scene::quake3::IShader *shader = quakeLevelMesh->getShader ( shaderIndex );
			if ( 0 == shader )
			{
				continue;
			}
			// Now add the MeshBuffer(s) with the current Shader to the Manager
			sm->addQuake3SceneNode ( meshBuffer, shader );
		}
	}

	// load sydney model and create 2 instances

	scene::IAnimatedMesh* mesh = 0;
	mesh = sm->getMesh("../../media/sydney.md2");
	if (mesh)
	{
		model1 = sm->addAnimatedMeshSceneNode(mesh);
		if (model1)
		{
			model1->setMaterialTexture(0, driver->getTexture("../../media/spheremap.jpg"));
			model1->setPosition(core::vector3df(100,40,-80));
			model1->setScale(core::vector3df(2,2,2));
			model1->setMD2Animation(scene::EMAT_STAND);
			model1->setMaterialFlag(video::EMF_LIGHTING, false);
			model1->setMaterialFlag(video::EMF_NORMALIZE_NORMALS, true);
			model1->setMaterialType(video::EMT_SPHERE_MAP);
			model1->addShadowVolumeSceneNode();
		}

		model2 = sm->addAnimatedMeshSceneNode(mesh);
		if (model2)
		{
			model2->setPosition(core::vector3df(180,15,-60));
			model2->setScale(core::vector3df(2,2,2));
			model2->setMD2Animation(scene::EMAT_RUN);
			model2->setMaterialTexture(0, device->getVideoDriver()->getTexture("../../media/sydney.bmp"));
			model2->setMaterialFlag(video::EMF_LIGHTING, true);
			model2->setMaterialFlag(video::EMF_NORMALIZE_NORMALS, true);
			model2->addShadowVolumeSceneNode();
		}
	}

	scene::ISceneNodeAnimator* anim = 0;

	// create sky box
	driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, false);
	skyboxNode = sm->addSkyBoxSceneNode(
		driver->getTexture("../../media/irrlicht2_up.jpg"),
		driver->getTexture("../../media/irrlicht2_dn.jpg"),
		driver->getTexture("../../media/irrlicht2_lf.jpg"),
		driver->getTexture("../../media/irrlicht2_rt.jpg"),
		driver->getTexture("../../media/irrlicht2_ft.jpg"),
		driver->getTexture("../../media/irrlicht2_bk.jpg"));
	driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, true);

	// create walk-between-portals animation

	core::vector3df waypoint[2];
	waypoint[0].set(-150,40,100);
	waypoint[1].set(350,40,100);

	if (model2)
	{
		anim = device->getSceneManager()->createFlyStraightAnimator(
			waypoint[0], waypoint[1], 2000, true);
		model2->addAnimator(anim);
		anim->drop();
	}

	// create animation for portals;

	core::array<video::ITexture*> textures;
	for (s32 g=1; g<8; ++g)
	{
		core::stringc tmp("../../media/portal");
		tmp += g;
		tmp += ".bmp";
		video::ITexture* t = driver->getTexture( tmp );
		textures.push_back(t);
	}

	anim = sm->createTextureAnimator(textures, 100);

	// create portals

	scene::IBillboardSceneNode* bill = 0;

	for (int r=0; r<2; ++r)
	{
		bill = sm->addBillboardSceneNode(0, core::dimension2d<f32>(100,100),
			waypoint[r]+ core::vector3df(0,20,0));
		bill->setMaterialFlag(video::EMF_LIGHTING, false);
		bill->setMaterialTexture(0, driver->getTexture("../../media/portal1.bmp"));
		bill->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);
		bill->addAnimator(anim);
	}

	anim->drop();

	// create cirlce flying dynamic light with transparent billboard attached

	scene::ILightSceneNode* light = 0;

	light = sm->addLightSceneNode(0,
		core::vector3df(0,0,0),	video::SColorf(1.0f, 1.0f, 1.f, 1.0f), 500.f);

	anim = sm->createFlyCircleAnimator(
		core::vector3df(100,150,80), 80.0f, 0.0005f);

	light->addAnimator(anim);
	anim->drop();

	bill = device->getSceneManager()->addBillboardSceneNode(
		light, core::dimension2d<f32>(40,40));
	bill->setMaterialFlag(video::EMF_LIGHTING, false);
	bill->setMaterialTexture(0, driver->getTexture("../../media/particlewhite.bmp"));
	bill->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);

	// create meta triangle selector with all triangles selectors in it.
	metaSelector = sm->createMetaTriangleSelector();
	metaSelector->addTriangleSelector(mapSelector);

	// create camp fire

	campFire = sm->addParticleSystemSceneNode(false);
	campFire->setPosition(core::vector3df(100,120,600));
	campFire->setScale(core::vector3df(2,2,2));

	scene::IParticleEmitter* em = campFire->createBoxEmitter(
		core::aabbox3d<f32>(-7,0,-7,7,1,7),
		core::vector3df(0.0f,0.06f,0.0f),
		80,100, video::SColor(1,255,255,255),video::SColor(1,255,255,255), 800,2000);

	em->setMinStartSize(core::dimension2d<f32>(20.0f, 10.0f));
	em->setMaxStartSize(core::dimension2d<f32>(20.0f, 10.0f));
	campFire->setEmitter(em);
	em->drop();

	scene::IParticleAffector* paf = campFire->createFadeOutParticleAffector();
	campFire->addAffector(paf);
	paf->drop();

	campFire->setMaterialFlag(video::EMF_LIGHTING, false);
	campFire->setMaterialFlag(video::EMF_ZWRITE_ENABLE, false);
	campFire->setMaterialTexture(0, driver->getTexture("../../media/fireball.bmp"));
	campFire->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);

	// load music

	#ifdef USE_IRRKLANG
	if (music)
		startIrrKlang();
	#endif
	#ifdef USE_SDL_MIXER
	if (music)
		startSound();
	#endif
}
void snd::restartSound()
{
	stopSound();
	setPlayPoint(0.0);
	startSound();
}
Exemple #28
0
void Imuse::startMusicWithOtherPos(const char *soundName, int hookId, int volume, int pan, Track *otherTrack) {
    if (gDebugLevel == DEBUG_IMUSE || gDebugLevel == DEBUG_ALL)
        printf("Imuse::startMusicWithOtherPos(): SoundName %s, hookId:%d, vol:%d, pan:%d\n", soundName, hookId, volume, pan);
    startSound(soundName, IMUSE_VOLGRP_MUSIC, hookId, volume, pan, 126, otherTrack);
}
Exemple #29
0
void Imuse::startSfx(const char *soundName, int priority) {
    if (gDebugLevel == DEBUG_IMUSE || gDebugLevel == DEBUG_ALL)
        printf("Imuse::startSfx(): SoundName %s, priority:%d\n", soundName, priority);
    startSound(soundName, IMUSE_VOLGRP_SFX, 0, 127, 0, priority, NULL);
}
void slideShowEngine::start()
{
int x,y;

QPixmap pix;
QModelIndex index;
QVariant val;
node itemNode;
//QPropertyAnimation *enterAnimation,*displayAnimation,*exitAnimation;
Pixmap *item;
effect e;
//QParallelAnimationGroup *parallelAnim;
//QSequentialAnimationGroup *seqAnim;


    if(state()==Paused)
        resume();

    if(state()==Running)
        return;


    //QList <QGraphicsView *> views=m_scene->views();
    //m_size=views.at(0)->size();
    //int s=views.size();

    m_frame_number=0;
    m_scene->clear();    
    m_scene->setSceneRect(0.0,0.0,qreal(m_size.width()),qreal(m_size.height()));
    m_currentSlideIndex=0;
    index=m_sequence->index(m_currentSlideIndex);
    if(index.isValid())
    {
        m_currentState=Running;
        m_currentStep=EnterAnimation;
        //m_totalCurrentTime=0;
        //m_stepCurrentTime=0;

        val=index.data(Qt::UserRole);
        itemNode=val.value<node>();

        if(m_exportToMovie)
        {
            pix.load(itemNode.nodePath());
        }
        else
        {
            pix=itemNode.nodePixmap();
        }

        m_currentNode=itemNode;
        if(pix.width()>m_size.width() || pix.height()>m_size.height())
            pix=pix.scaled(m_size,Qt::KeepAspectRatio,Qt::SmoothTransformation);

        item = new Pixmap(pix);
        if(m_exportToMovie)
            item->setTransformationMode(Qt::SmoothTransformation);
        m_PixmapList.append(item); // serve questa lista?
        if(m_size.width()>pix.width())
        {
            x=(m_size.width()-pix.width())/2;
        }
        else
        {
            x=0;
        }


        if(m_size.height()>pix.height())
        {
            y=(m_size.height()-pix.height())/2;
        }
        else
        {
            y=0;
        }

        item->setPos(qreal(x), qreal(y));
        item->setZValue(qreal(m_sequence->rowCount()-m_currentSlideIndex));
        m_scene->addItem(item);
        applyAnimation();
        //m_timerId=startTimer(TIMER_ANIMATION);
    }



    m_totalCurrentTime=0;
    m_stepCurrentTime=0;

    /*int width=m_sequence->movieResolution().width();
    int height=m_sequence->movieResolution().height();
    int bitrate=m_sequence->movieBitRate();*/
    int frameRate=m_sequence->movieFrameRate();
    //int gop = 20;

    if(m_exportToMovie)
    {
        //encoder.createFile(m_movieName,width,height,bitrate,gop,frameRate);
        QEventLoop evt;
        int frames=0;

        while(m_currentState!=Finished && m_currentState!=Stopped)
        {
           m_currentState=runEngine();
           if(m_currentState==Running)
            emit refresh(m_totalCurrentTime);
           evt.processEvents();


           if(m_currentState==Running)
           {
               //int elapsed=m_timerAnimation.elapsed();
               //qDebug() << elapsed;
               int period=1000/frameRate;
               m_totalCurrentTime+=period;
               m_stepCurrentTime+=period;
               m_timerAnimation.start();
           }
           frames++;

        }
        qDebug() << "frames:" << frames;
        endOfSlideShow();

     }
    else
    {
        startSound();
        m_timerId=startTimer(25); // TIMER_ANIMATION
        m_timerAnimation.start();        
    }

    //State state=Running;
    //m_timerAnimation.start();
    //m_totalTime.start();       
    //qDebug("Time elapsed: %d ms", t.elapsed());
}