/** SGX

The   sss    gggg x   x   
     s      g      x x    Engine
      sss   g  gg   x
         s  g   g  x x          Copyright 1995-2008.
     ssss    gggg x   x         Steven Goodwin. All Rights Reserved.
    
This version has been released under the GNU Public License v2.0.

Please see the license files for details.

File: src/drivers/wintel32/audio/fmod/fmoddevicechannel.cpp

*/

#include "sgx/core/core.hpp"
#include "sgx/audio/audio.hpp"

#include "drivers/wintel32/audio/fmod.hpp"

void 
CFMODDeviceChannel::pause()
{
	FMOD_Channel_SetPaused(m_pChannel, TRUE);
}

void 
CFMODDeviceChannel::resume()
{
	FMOD_Channel_SetPaused(m_pChannel, FALSE);
}

void 
CFMODDeviceChannel::stop()
{
	FMOD_Channel_Stop(m_pChannel);
}

tBOOL	
CFMODDeviceChannel::hasFinished() {
	FMOD_BOOL playing;
	FMOD_Channel_IsPlaying(m_pChannel, &playing);
	return !playing;
}

tBOOL 
CFMODDeviceChannel::refreshChannel(CMixOutput *pMix)
{
	FMOD_Channel_SetVolume(m_pChannel, pMix->m_fVolume);
	FMOD_Channel_SetPan(m_pChannel, pMix->m_fPan);
	return !hasFinished();
}
