예제 #1
0
void AsScene3011Symbol::stopSymbolSound() {
	if (_isNoisy) {
		stopSound(1);
	} else {
		stopSound(0);
	}
}
void LeprechaunSound::update(const GameTime& gameTime)
{
	SoundComponent::update(gameTime);

	LeprechaunController& leprechaun = getController();
	setEmitter(leprechaun.getPosition(), leprechaun.getForward(), Vector3::up);

	if (leprechaun.isBeginKick() || leprechaun.isBeginCaneAnimation() || leprechaun.isBeginHatAnimation())
		play3DSound("hey");

	if (leprechaun.isBeginCaneHit() || leprechaun.isBeginFly() || leprechaun.isBeginStoneHit())
		play3DSound("punch");

	if (!leprechaun.isLocal())
		return;

	if (leprechaun.hasUsedItem())
	{
		stopSound("yes hahaha");
		playSound("yes hahaha");
		//play3DSound("yes hahaha");
	}

	if (leprechaun.hasCollectedItem())
	{
		stopSound("door slamming");
		playSound("door slamming");
		//play3DSound("door slamming");
	}
}
AmbientSoundsManager::~AmbientSoundsManager()
{
    for(int i = 0; i < NR_OF_THUNDER_SOUNDS; i++)
    {
        stopSound(m_thunderSounds[i]);
        deactivateSound(m_thunderSounds[i]);
    }
    for(int i = 0; i < NR_OF_SCREAM_SOUNDS; i++)
    {
        stopSound(m_screamSounds[i]);
        deactivateSound(m_screamSounds[i]);
    }
}
예제 #4
0
static void blendFinish()
{
	Entity *e;

	self->thinkTime--;

	if (self->thinkTime <= 0)
	{
		self->health = 0;

		stopSound(self->mental);

		playSoundToMap("sound/item/ping", -1, self->x, self->y, 0);

		e = addPermanentItem(self->requires, self->x + self->w / 2, self->y + self->h / 2);

		e->x -= e->w / 2;

		e->dirY = ITEM_JUMP_HEIGHT;

		self->action = &entityWait;

		setEntityAnimation(self, "ATTACK_1");
	}
}
예제 #5
0
	int Soloud::play(AudioSource &aSound, float aVolume, float aPan, int aPaused, int aBus)
	{
		if (aSound.mFlags & AudioSource::SINGLE_INSTANCE)
		{
			// Only one instance allowed, stop others
			stopSound(aSound);
		}

		if (mLockMutexFunc) mLockMutexFunc(mMutex);
		int ch = findFreeVoice();
		if (ch < 0) 
		{
			if (mUnlockMutexFunc) mUnlockMutexFunc(mMutex);
			return -1;
		}
		if (!aSound.mAudioSourceID)
		{
			aSound.mAudioSourceID = mAudioSourceID;
			mAudioSourceID++;
			aSound.mSoloud = this;
		}
		mVoice[ch] = aSound.createInstance();
		mVoice[ch]->mAudioSourceID = aSound.mAudioSourceID;
		mVoice[ch]->mBusHandle = aBus;
		mVoice[ch]->init(mPlayIndex, aSound.mBaseSamplerate, aSound.mChannels, aSound.mFlags);

		mPlayIndex++;

		if (aPaused)
		{
			mVoice[ch]->mFlags |= AudioSourceInstance::PAUSED;
		}

		setVoicePan(ch, aPan);
		setVoiceVolume(ch, aVolume);
		setVoiceRelativePlaySpeed(ch, 1);

		int i;
		for (i = 0; i < FILTERS_PER_STREAM; i++)
		{
			if (aSound.mFilter[i])
			{
				mVoice[ch]->mFilter[i] = aSound.mFilter[i]->createInstance();
			}
		}

		int scratchneeded = SAMPLE_GRANULARITY * mVoice[ch]->mChannels;

		mVoice[ch]->mResampleData[0]->mBuffer = new float[scratchneeded];
		mVoice[ch]->mResampleData[1]->mBuffer = new float[scratchneeded];

		// First buffer will be overwritten anyway; the second may be referenced by resampler
		memset(mVoice[ch]->mResampleData[0]->mBuffer, 0, sizeof(float) * scratchneeded);
		memset(mVoice[ch]->mResampleData[1]->mBuffer, 0, sizeof(float) * scratchneeded);

		if (mUnlockMutexFunc) mUnlockMutexFunc(mMutex);

		int handle = getHandleFromVoice(ch);
		return handle;
	}	
예제 #6
0
static void riftWait()
{
	self->thinkTime--;

	if (self->thinkTime <= 0)
	{
		stopSound(self->health);

		self->action = &riftClose;

		self->thinkTime = 20;
	}

	else
	{
		if (collision(self->x - self->mental, self->y - self->mental, self->mental * 2, self->mental * 2, player.x, player.y, player.w, player.h) == 1)
		{
			setCustomAction(&player, &attract, 5, 0, (player.x < (self->x + self->w / 2) ? 2 : -2));
		}

		if (prand() % 3 == 0)
		{
			addRiftEnergy(self->x + self->w / 2, self->y + self->h / 2);
		}
	}
}
예제 #7
0
파일: mixer.cpp 프로젝트: vanfanel/rawgl
	void stopAll() {
		for (int i = 0; i < 4; ++i) {
			stopSound(i);
		}
		stopMusic();
		stopSfxMusic();
	}
예제 #8
0
static void burn()
{
	self->action = &burn;

	setEntityAnimation(self, "JUMP");

	self->thinkTime--;

	if (self->thinkTime <= 0)
	{
		if (self->startY == -1)
		{
			stopSound(self->startX);
		}

		self->frameSpeed = -1;

		setEntityAnimation(self, "WALK");

		self->thinkTime = self->maxThinkTime;

		self->animationCallback = &entityWait;

		self->action = &burnWait;
	}
}
예제 #9
0
bool CSuccUBus::LeaveViewMsg(CLeaveViewMsg *msg) {
	petDisplayMessage(2, BLANK);
	if (_initialStartFrame >= 0)
		loadFrame(_initialStartFrame);
	else if (!_signalFlag && _onStartFrame >= 0)
		loadFrame(_onStartFrame);

	petClear();
	if (_soundHandle != -1) {
		stopSound(_soundHandle, 1);
		_soundHandle = -1;
	}

	if (_isOn) {
		_isOn = false;
		if (_offStartFrame >= 0)
			playSound("z#27.wav", 100);

		if (_signalFlag)
			setVisible(false);
	}

	performAction(true, findView());
	CSUBTransition transMsg;
	transMsg.execute(this);

	return true;
}
예제 #10
0
파일: object.cpp 프로젝트: ehalls/xoreos
void Object::playSound(const Common::UString &sound, bool pitchVariance) {
	stopSound();
	if (sound.empty())
		return;

	_sound = ::Engines::playSound(sound, Sound::kSoundTypeVoice, false, 1.0f, pitchVariance);
}
예제 #11
0
파일: chaos.c 프로젝트: polluks/edgar
static void riftWait()
{
	int x, y;

	self->thinkTime--;

	if (self->thinkTime <= 0 || self->head->health <= 0)
	{
		stopSound(self->health);

		self->action = &riftClose;

		self->thinkTime = 20;
	}

	else
	{
		x = self->x + self->w / 2;
		y = self->y + self->h / 2;

		if (collision(x - self->speed, y - self->speed, self->speed * 2, self->speed * 2, player.x, player.y, player.w, player.h) == 1)
		{
			setCustomAction(&player, &attract, 5, 0, (player.x < (self->x + self->w / 2) ? player.speed - 0.25 : -(player.speed - 0.25)));
		}

		if (prand() % 3 == 0)
		{
			addRiftEnergy(self->x + self->w / 2, self->y + self->h / 2);
		}
	}

	checkToMap(self);
}
예제 #12
0
파일: atarisnd.c 프로젝트: Bremma/pinmame
static void playSound(void) {
    if (Machine->gamedrv->flags & GAME_NO_SOUND)
        return;

    if (atarilocals.sound & 0x02) { // noise on
        int i;
        for (i=0; i < sizeof(noiseWave); i++)
            noiseWave[i] = (UINT8)(rand() % 256);
        stopNoise();
        mixer_set_volume(atarilocals.noisechannel, atarilocals.volume*4);
        mixer_play_sample(atarilocals.noisechannel, (signed char *)noiseWave, sizeof(noiseWave),
                          ATARI_SNDFREQ / (16-atarilocals.frequency) * (1 << atarilocals.octave), 1);
    }
    if (atarilocals.sound & 0x01) { // wave on
        stopSound();
        mixer_set_volume(atarilocals.channel, atarilocals.volume*4);
        if (atarilocals.waveform < 4)
            mixer_play_sample(atarilocals.channel, (signed char *)squareWave, sizeof(squareWave),
                              2 * ATARI_SNDFREQ / (16-atarilocals.frequency) * (1 << atarilocals.octave), 1);
        else if (atarilocals.waveform < 8)
            mixer_play_sample(atarilocals.channel, (signed char *)triangleWave, sizeof(triangleWave),
                              2 * ATARI_SNDFREQ / (16-atarilocals.frequency) * (1 << atarilocals.octave), 1);
        else if (atarilocals.waveform < 12)
            mixer_play_sample(atarilocals.channel, (signed char *)sineWave, sizeof(sineWave),
                              2 * ATARI_SNDFREQ / (16-atarilocals.frequency) * (1 << atarilocals.octave), 1);
        else
            mixer_play_sample(atarilocals.channel, (signed char *)sawtoothWave, sizeof(sawtoothWave),
                              2 * ATARI_SNDFREQ / (16-atarilocals.frequency) * (1 << atarilocals.octave), 1);
    }
}
예제 #13
0
static void flameWait()
{
	if (self->face == RIGHT)
	{
		self->x = self->head->x + self->head->w;

		self->y = self->head->y + (self->head->mental == 1 ? self->head->offsetY : self->head->offsetX);
	}

	else
	{
		self->x = self->head->x - self->w;

		self->y = self->head->y + (self->head->mental == 0 ? self->head->offsetY : self->head->offsetX);
	}

	self->startX--;

	if (self->startX <= 0)
	{
		self->startX = 0;
	}

	self->thinkTime--;

	if (self->thinkTime <= 0 || self->head->health <= 0)
	{
		stopSound(self->endY);

		self->inUse = FALSE;
	}
}
예제 #14
0
파일: sorceror_2.c 프로젝트: revcozmo/edgar
static void disintegrationSpellAttack()
{
	Entity *temp;

	self->thinkTime--;

	if (self->thinkTime <= 0)
	{
		self->head->mental = 0;

		self->inUse = FALSE;

		if (self->mental == 2)
		{
			/* Gib the player */

			temp = self;

			self = &player;

			freeEntityList(playerGib());

			self = temp;
		}

		stopSound(BOSS_CHANNEL);
	}

	self->endX = player.x + player.w / 2;
	self->endY = player.y + player.h / 2;

	self->x = self->endX;
	self->y = self->endY;
}
예제 #15
0
bool CSuccUBus::LeaveViewMsg(CLeaveViewMsg *msg) {
    petDisplayMessage(2, BLANK);
    if (_startFrame8 >= 0)
        loadFrame(_startFrame8);
    else if (!_field15C && _startFrame9 >= 0)
        loadFrame(_startFrame9);

    petClear();
    if (_soundHandle != -1) {
        stopSound(_soundHandle, 1);
        _soundHandle = -1;
    }

    if (_enabled) {
        _enabled = false;
        if (_startFrame10 >= 0)
            playSound("z#27.wav", 100);

        if (_field15C)
            setVisible(false);
    }

    performAction(true, findView());
    CSUBTransition transMsg;
    transMsg.execute(this);

    return true;
}
예제 #16
0
	void doFades(float dtime)
	{
		m_fade_delay += dtime;

		if (m_fade_delay < 0.1f)
			return;

		float chkGain = 0;
		for (std::unordered_map<int, FadeState>::iterator i = m_sounds_fading.begin();
				i != m_sounds_fading.end();) {
			if (i->second.step < 0.f)
				chkGain = -(i->second.current_gain);
			else
				chkGain = i->second.current_gain;

			if (chkGain < i->second.target_gain) {
				i->second.current_gain += (i->second.step * m_fade_delay);
				i->second.current_gain = rangelim(i->second.current_gain, 0, 1);

				updateSoundGain(i->first, i->second.current_gain);
				++i;
			} else {
				if (i->second.target_gain <= 0.f)
					stopSound(i->first);

				m_sounds_fading.erase(i++);
			}
		}
		m_fade_delay = 0;
	}
예제 #17
0
파일: sound.cpp 프로젝트: letup/scummvm
/**
 * Start playing a sound resource. The logic here is that when the sound is
 * finished we set the given flag to be true. This way the condition can be
 * detected by the game. On the other hand, if the game wishes to start
 * playing a new sound before the current one is finished, we also let it
 * do that.
 * @param resnum  the sound resource number
 * @param flag    the flag that is wished to be set true when finished
 */
void SoundMgr::startSound(int resnum, int flag) {
	debugC(3, kDebugLevelSound, "startSound(resnum = %d, flag = %d)", resnum, flag);

	if (_vm->_game.sounds[resnum] == NULL) // Is this needed at all?
		return;

	stopSound();

	AgiSoundEmuType type = (AgiSoundEmuType)_vm->_game.sounds[resnum]->type();
	if (type != AGI_SOUND_SAMPLE && type != AGI_SOUND_MIDI && type != AGI_SOUND_4CHN)
		return;
	debugC(3, kDebugLevelSound, "    type = %d", type);

	_vm->_game.sounds[resnum]->play();
	_playingSound = resnum;
	_soundGen->play(resnum);

	// Reset the flag
	_endflag = flag;

	if (_vm->getVersion() < 0x2000) {
		_vm->_game.vars[_endflag] = 0;
	} else {
		_vm->setFlag(_endflag, false);
	}
}
예제 #18
0
bool CEnterSecClassState::StatusChangeMsg(CStatusChangeMsg *msg) {
	stopSound(_soundHandle);

	if (msg->_newStatus == _mode || (_mode == 2 && msg->_newStatus == 3)) {
		if (_mode == 2) {
			_soundHandle = queueSound("b#36.wav", _soundHandle);
		} else {
			_soundHandle = queueSound("b#31.wav", _soundHandle);
		}
		if (msg->_newStatus == 3)
			msg->_newStatus = 2;
	} else {
		changeView("SecClassLittleLift.Node 1.N");
		if (msg->_newStatus == 1) {
			_soundHandle = queueSound("b#32.wav", _soundHandle);
		} else if (msg->_newStatus == 2) {
			_soundHandle = queueSound("b#25.wav", _soundHandle);
		} else if (msg->_newStatus == 3) {
			_soundHandle = queueSound("b#33.wav", _soundHandle);
			msg->_newStatus = 2;
		}
	}

	if (msg->_newStatus != 3) {
		if (msg->_newStatus == 2 && _mode == 1)
			playMovie(0, 10, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE);
		else if (msg->_newStatus == 1)
			playMovie(11, 21, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE);
	}

	_cursorId = msg->_newStatus == 2 ? CURSOR_MOVE_FORWARD : CURSOR_INVALID;
	_mode = msg->_newStatus;
	return true;
}
예제 #19
0
int main(){
	int i = 0;
	PLL_Init();
	SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | 
	SYSCTL_XTAL_8MHZ); // 50 MHz 
	DisableInterrupts();
	SYSCTL_RCGC1_R |= SYSCTL_RCGC1_TIMER0;// activate timer0
	SYSCTL_RCGC2_R |= SYSCTL_RCGC2_GPIOF+SYSCTL_RCGC2_GPIOG; // activate ports F and G
	Output_Init(); 
	SysTick_InitSeconds(1);
	PolledButtons_Init();
	EnableInterrupts();
	displayMode = 0;
	ringAlarms = 0;
	timeMode = 0;
		
	while(1){
		if (ringAlarms && !soundPlaying && (alarmActive || timeMode == 4))	{
			playSound();
		}
		else if ((ringAlarms==0 || !alarmActive) && soundPlaying) {
			stopSound();
		}
		if(displayMode==0) {
			displayClock();
		}
		else if(displayMode==1){
			displaySet();
		}
	}
}
예제 #20
0
파일: sound.cpp 프로젝트: St0rmcrow/scummvm
void SoundMgr::startSound(int resnum, int flag) {
	AgiSoundEmuType type;

	if (_vm->_game.sounds[resnum] != NULL && _vm->_game.sounds[resnum]->isPlaying())
		return;

	stopSound();

	if (_vm->_game.sounds[resnum] == NULL) // Is this needed at all?
		return;

	type = (AgiSoundEmuType)_vm->_game.sounds[resnum]->type();

	if (type != AGI_SOUND_SAMPLE && type != AGI_SOUND_MIDI && type != AGI_SOUND_4CHN)
		return;

	_vm->_game.sounds[resnum]->play();
	_playingSound = resnum;

	debugC(3, kDebugLevelSound, "startSound(resnum = %d, flag = %d) type = %d", resnum, flag, type);

	_soundGen->play(resnum);

	_endflag = flag;

	// Nat Budin reports that the flag should be reset when sound starts
	_vm->setflag(_endflag, false);
}
예제 #21
0
파일: azriel.c 프로젝트: LibreGames/edgar
static void scytheMove()
{
	if (self->face == LEFT)
	{
		if (self->dirX < 0 && self->x <= self->targetX)
		{
			self->dirX *= -1;
		}

		else if (self->dirX > 0 && self->x >= self->startX)
		{
			self->head->thinkTime = 0;

			if (self->head->mental == 0)
			{
				self->action = &scytheWait;
				self->touch = NULL;
			}

			stopSound(self->endX);
		}
	}

	else
	{
		if (self->dirX > 0 && self->x >= self->targetX)
		{
			self->dirX *= -1;
		}

		else if (self->dirX < 0 && self->x <= self->startX)
		{
			self->head->thinkTime = 0;

			if (self->head->mental == 0)
			{
				self->action = &scytheWait;
				self->touch = NULL;
			}

			stopSound(self->endX);
		}
	}

	checkToMap(self);
}
예제 #22
0
파일: mixer.cpp 프로젝트: vanfanel/rawgl
	void playSound(uint8_t channel, int volume, Mix_Chunk *chunk, int loops = 0) {
		stopSound(channel);
		if (chunk) {
			Mix_PlayChannel(channel, chunk, loops);
		}
		setChannelVolume(channel, volume);
		_sounds[channel] = chunk;
	}
예제 #23
0
void ReminderSettings::playSound() {
	qDebug( "ReminderSettings::playSound" );

	// stop the previous sound to play another (or the same from beginning)
	stopSound();
	m_sound = Phonon::createPlayer( Phonon::MusicCategory, Phonon::MediaSource( ui.soundPathEdit->text() ) );
	m_sound->play();
}
예제 #24
0
WLAudio::~WLAudio()
{
    musicOff();
    stopSound();
    free(m_digiList);

    delete m_soundServer;
}
예제 #25
0
파일: azriel.c 프로젝트: LibreGames/edgar
static void beamDisappearFinish()
{
	self->head->mental = 0;

	self->inUse = FALSE;

	stopSound(self->targetX);
}
예제 #26
0
파일: Sound.cpp 프로젝트: zephyrz4/pongGame
bool Sound::loadSound( char *filename  ) {

  stopSound();

  sound = Mix_LoadWAV(filename);

  return true ;


}
예제 #27
0
void Sound::playSoundSegment(uint32 start, uint32 end) {
	if (!isSoundLoaded())
		return;

	stopSound();

	Audio::AudioStream *subStream = new Audio::SubSeekableAudioStream(_stream, Audio::Timestamp(0, start, 600), Audio::Timestamp(0, end, 600), DisposeAfterUse::NO);

	g_system->getMixer()->playStream(Audio::Mixer::kPlainSoundType, &_handle, subStream, -1, _volume, 0, DisposeAfterUse::YES);
}
예제 #28
0
파일: sound.cpp 프로젝트: djkimgo/scummvm
void Sound::playLoadedSound(int bufNum, WaitType waitType) {
	if (IS_SERRATED_SCALPEL) {
		if (_mixer->isSoundHandleActive(_scalpelEffectsHandle) && (_curPriority > _vm->_scene->_sounds[bufNum]._priority))
			return;

		stopSound();
	}

	playSound(_vm->_scene->_sounds[bufNum]._name, waitType, _vm->_scene->_sounds[bufNum]._priority);
}
예제 #29
0
파일: acllib.c 프로젝트: Gnnng/LaserTank
void playSound(int sid,int repeat)
{
	char cmdStr[32];
	stopSound(sid);
	if(repeat)
		sprintf(cmdStr,"play S%d from 0 repeat",sid);
	else
		sprintf(cmdStr,"play S%d from 0",sid);
	mciSendStringA(cmdStr,NULL,0,NULL);
}
예제 #30
0
int16 ScriptFunctions::sfClearScreen(int16 argc, int16 *argv) {
	if (_vm->_screen->isScreenLocked())
		return 0;
	if (_vm->_autoStopSound) {
		stopSound();
		_vm->_autoStopSound = false;
	}
	_vm->_screen->clearScreen();
	return 0;
}