Example #1
0
void AudioBody::pause (void)
{
    if (destroyed) THROW_DEAD(className);
    // presumably does nothing if the track is not playing
    alSourcePause(alSourceLeft);
    alSourcePause(alSourceRight);
}
Example #2
0
void OGMPlayer::Pause()
{
    if (isStreamMode_)
    {
        if (isRunning()) { alSourcePause(source_); }
    }
    else { alSourcePause(source_); }
}
Example #3
0
void OpenALRenderer::pause()
{
    if (isPlaying())
    {
        alSourcePause(m_AudioSource);
    }
}
Example #4
0
AUD_NAMESPACE_BEGIN

/******************************************************************************/
/*********************** OpenALHandle Handle Code *************************/
/******************************************************************************/

bool OpenALDevice::OpenALHandle::pause(bool keep)
{
	if(m_status)
	{
		std::lock_guard<ILockable> lock(*m_device);

		if(m_status == STATUS_PLAYING)
		{
			for(auto it = m_device->m_playingSounds.begin(); it != m_device->m_playingSounds.end(); it++)
			{
				if(it->get() == this)
				{
					std::shared_ptr<OpenALHandle> This = *it;

					m_device->m_playingSounds.erase(it);
					m_device->m_pausedSounds.push_back(This);

					alSourcePause(m_source);

					m_status = keep ? STATUS_STOPPED : STATUS_PAUSED;

					return true;
				}
			}
		}
	}

	return false;
}
Example #5
0
void
AudioManager::Player::Pause()
{
    boost::recursive_mutex::scoped_lock lock( *m_UpdateMutex );

    alSourcePause( m_Source );
}
//Pause a source
bool SoundManager::PauseSource(unsigned int source)
{
	if (source >= 0 && (unsigned int)source<mSources.size() && mSources[source].reserved)
	{
		ALint state;
		
		alGetSourcei(mSources[source].source,AL_SOURCE_STATE, &state);
		if (state == AL_PLAYING)
		{
			alSourcePause(mSources[source].source);
		}
		else if (state == AL_PAUSED)
		{
			alSourcePlay(mSources[source].source);
		}		

		//Check errors
		ALenum error(alGetError());
		if(error != AL_NO_ERROR)
		{
			SingletonLogMgr::Instance()->AddNewLine("SoundManager::PauseSource","Failure while pausing/playing source (" + GetALErrorString(error,false) + ")",LOGEXCEPTION);
		}

		return true;
	}
	else
	{
			SingletonLogMgr::Instance()->AddNewLine("SoundManager::PauseSource(","Can't pause source. Invalid source " + source,LOGEXCEPTION);
		return false;
	}
}
//Pause sound playing
void SoundManager::Pause()
{
	ALint state;
	SourcesVector::iterator it;
	mPause = !mPause;
	//LOOP - For each source registerd
	for( it = mSources.begin(); it != mSources.end(); ++it )
	{
		alGetSourcei( (*it).source, AL_SOURCE_STATE, &state);
		if (state == AL_PLAYING && mPause)
		{
			alSourcePause((*it).source);
		}
		else if (state == AL_PAUSED && !mPause)
		{
			alSourcePlay((*it).source);
		}
	}//LOOP END

	//Check errors
	ALenum error(alGetError());
	if(error != AL_NO_ERROR)
	{
		SingletonLogMgr::Instance()->AddNewLine("SoundManager::Pause","Failure while pausing/playing source (" + GetALErrorString(error,false) + ")",LOGEXCEPTION);
	}
}
Example #8
0
void plDSoundBuffer::Pause()
{
    if (!source)
        return;
    alSourcePause(source);
    alGetError();
}
Example #9
0
    //-----------------------------------------------------------------------------
    void MusicStream::_pause(float aFadeOut)
    {
        if (mMusic != 0)
        {
            ALenum srcState;

            // Checks whether the source is playing before pausing it
            alGetSourcei(mMusicSrc,AL_SOURCE_STATE,&srcState);
            mAudioMan->_alErrorCheck("MusicStream::_pause()",
                    "Failed getting music source state");

            if (srcState == AL_PLAYING)
            {
                float fadeOut = Math::clamp(aFadeOut,0.0f,1.0f);
                if (fadeOut == 0.0f) {
                    alSourcePause(mMusicSrc);
                    mAudioMan->_alErrorCheck("MusicStream::_pause()",
                            "Failed pausing music source");
                } else {
                    mState   = MSS_PAUSING;
                    mFadeSpd = fadeOut;
                    mFade    = MF_FADE_OUT;
                }
            }
        }
    }
Example #10
0
 void OpenALChannel::suspend()
 {
    if (mUseStream)
    {
       if (mStream)
       {
          mStream->suspend();
          mWasPlaying = true;
       }
       else
       {
          mWasPlaying = false;
       }
    }
    else 
    {
       ALint state;
       alGetSourcei(mSourceID, AL_SOURCE_STATE, &state);
       
       if (state == AL_PLAYING)
       {
          alSourcePause(mSourceID);
          mWasPlaying = true;
          return;
       }
       
       mWasPlaying = false;
    }
 }
Example #11
0
void OpenALSound::Pause()
{
	_wasPlaying = false;
	if ( _isActive ) {
		alSourcePause( _sourceId );
	}
}
Example #12
0
	/*
	==================
	Sound::Pause
	==================
	*/
	bool Sound::Pause() {
		if (IsPlaying()) {
			alSourcePause(source);
			return true;
		}
		return false;
	}
Example #13
0
void CALL HGE_Impl::Channel_Pause(HCHANNEL chn)
{
	if(hOpenAL)
	{
		alSourcePause((ALuint) chn);
	}
}
Example #14
0
AL_API signed char OPENAL_SetPaused(int channel, signed char paused)
{
    if (!initialized) return false;

    if (channel == OPENAL_ALL)
    {
        for (int i = 0; i < num_channels; i++)
            OPENAL_SetPaused(i, paused);
        return true;
    }

    if ((channel < 0) || (channel >= num_channels)) return false;

    ALint state = 0;
    if (channels[channel].startpaused)
        state = AL_PAUSED;
    else
        alGetSourceiv(channels[channel].sid, AL_SOURCE_STATE, &state);

    if ((paused) && (state == AL_PLAYING))
        alSourcePause(channels[channel].sid);
    else if ((!paused) && (state == AL_PAUSED))
    {
        alSourcePlay(channels[channel].sid);
        channels[channel].startpaused = false;
    }
    return true;
}
Example #15
0
//*
// =======================================================================================================================
// =======================================================================================================================
//
void sound_PauseSample( AUDIO_SAMPLE *psSample )
{
#ifndef WZ_NOSOUND
	alSourcePause( psSample->iSample );
	sound_GetError();
#endif
}
Example #16
0
		void
		pause( const string &id )
		{
			OpenALData *data = m_buffers[ id ];
			BK_ASSERT( data != NULL, "nothing with the given id " << id << " could be found!" );
			alSourcePause( data->m_source );
		}
Example #17
0
			void ALSound::Pause(){
				if(GetState() == AL_PAUSED){
					Play();
					return;
				}
				alSourcePause(m_uiSource);
			}
Example #18
0
void Play()
{
	// 播放
	alSourcePlay(Source);
	/*printf("Press Enter To Stop Sound\n");
	getchar();
	alSourceStop(Source);*/
	ALubyte c = ' ';
	printf("Press Enter h To Pause \np To Begin\ns To Stop Sound\n ");
	while (c != 'q')
	{
		c = getchar();

		switch (c)
		{
			// Pressing 'p' will begin playing the sample.  
		case 'p': alSourcePlay(Source); break;

			// Pressing 's' will stop the sample from playing.  
		case 's': alSourceStop(Source); break;

			// Pressing 'h' will pause (hold) the sample.  
		case 'h': alSourcePause(Source); break;
		};
	}
}
Example #19
0
//=================================================================================================
void Sounds::pause()
{
  if (!file)
    return;

  alSourcePause( source );
}
Example #20
0
void OpenALBackend::Pause()
{
	AUDIT(alIsSource(m_source));

	alSourcePause(m_source);
	checkForAlError("Pause->alSourcePause");
}
//----------------------------------------------------------------------------------
//
//----------------------------------------------------------------------------------
void SoundVoice::Pause( bool pause )
{
	if (pause) {
		alSourcePause(m_source);
	} else {
		alSourcePlay(m_source);
	}
}
Example #22
0
void Source::pauseAtomic()
{
	if (valid)
	{
		alSourcePause(source);
		paused = true;
	}
}
Example #23
0
void OpenALSound::OnPause()
{
	if (!IsFinished())
	{
		alSourcePause(source);
		check_openal_error();
	}
}
void SimpleAudioEngine::pauseEffect(unsigned int nSoundId)
{
    ALint state;
    alGetSourcei(nSoundId, AL_SOURCE_STATE, &state);
    if (state == AL_PLAYING)
        alSourcePause(nSoundId);
    checkALError("pauseEffect:alSourcePause");
}
Example #25
0
void audio_output::pause()
{
    alSourcePause(_source);
    if (alGetError() != AL_NO_ERROR)
    {
        throw exc(_("Cannot pause OpenAL source playback."));
    }
}
Example #26
0
void Sound::Impl::PauseMusic() {
    if (!m_initialized)
        return;

    if (alcGetCurrentContext()) {
        alSourcePause(m_sources[0]);
    }
}
void CCAudioPlayer::pause() {
	if(!m_paused && m_playing) {
		if(m_source != 0) {
			alSourcePause(m_source);
			m_paused = true;
		}
	}
}
Example #28
0
	void SimpleAudioEngine::pauseBackgroundMusic()
	{
		ALint state;
		alGetSourcei(s_backgroundSource, AL_SOURCE_STATE, &state);
		if (state == AL_PLAYING)
			alSourcePause(s_backgroundSource);
		checkALError("pauseBackgroundMusic");
	}
Example #29
0
/*/////////////////////////////////////////////////////////////////*/
void OgreOggStreamSound::_pauseImpl() {
  if(mSource == AL_NONE) return;

  alSourcePause(mSource);

  // Notify listener
  if(mSoundListener) mSoundListener->soundPaused(this);
}
Example #30
0
void AudioSource::pause()
{
  alSourcePause(m_sourceID);

#if NORI_DEBUG
  checkAL("Failed to pause source");
#endif
}