forked from 0ad/0ad
#added sound cone functionality for possible doplar effects, added ability to check if a sound is currently playing.
refs #138 added snd_set_cone and is_playing to snd_mgr. This was SVN commit r4762.
This commit is contained in:
parent
0b150ee311
commit
edab93934e
@ -2257,6 +2257,34 @@ LibError snd_set_cone(Handle hvs, const float cone_inner, const float cone_outer
|
||||
return INFO::OK;
|
||||
}
|
||||
|
||||
/** --TODO: Test to ensure this works (not currently necessary for intensity)
|
||||
* find out if a sound is still playing
|
||||
*
|
||||
* @param hvs - handle to the snd to check
|
||||
* @return bool true if playing
|
||||
|
||||
**/
|
||||
bool is_playing(Handle hvs)
|
||||
{
|
||||
VSrc * vs = H_USER_DATA(hvs, VSrc);
|
||||
|
||||
int temp3;
|
||||
if(vs != 0) // if 0, then sound has played and finished or is otherwise not loaded.
|
||||
{
|
||||
//H_DEREF(hvs, VSrc, vs);
|
||||
|
||||
temp3 = vs->al_src;
|
||||
if(temp3) // if non-zero the sound is still playing
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
/*if(H_USER_DATA(hvs, VSrc) != 0)
|
||||
return true;
|
||||
else
|
||||
return false;*/
|
||||
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
@ -343,7 +343,7 @@ extern LibError snd_disable(bool disabled);
|
||||
extern LibError snd_update(const float* pos, const float* dir, const float* up);
|
||||
|
||||
|
||||
/**
|
||||
/** added by GF
|
||||
* set sound cone information
|
||||
*
|
||||
* cone_inner and cone_outer should be in the range 0.0 - 360.0,
|
||||
@ -356,6 +356,16 @@ extern LibError snd_update(const float* pos, const float* dir, const float* up);
|
||||
**/
|
||||
extern LibError snd_set_cone(Handle hvs, const float cone_inner, const float cone_outer, const float cone_gain);
|
||||
|
||||
/** added by GF
|
||||
* find out if a sound is still playing
|
||||
*
|
||||
* @param hvs - handle to the snd to check
|
||||
* @return bool true if playing
|
||||
|
||||
**/
|
||||
extern bool is_playing(Handle hvs);
|
||||
|
||||
|
||||
/**
|
||||
* free all resources and shut down the sound system.
|
||||
* call before h_mgr_shutdown.
|
||||
|
Loading…
Reference in New Issue
Block a user