void vrpn_Sound_Server_Miles::playSound(vrpn_SoundID id, vrpn_int32 repeat, vrpn_SoundDef soundDef) { if (provider != 0) { fprintf(stderr,"Playing sound: %d\n",id); // update last sound played record LastSoundId = id; changeSoundStatus(id, soundDef); AIL_set_3D_sample_loop_count(getSample(id), repeat); //if not playing, play //if playing already modify parameters in p for pose, //vel, etc but ignore loop count switch(AIL_3D_sample_status(getSample(id))) { case SMP_DONE: case SMP_STOPPED: { AIL_start_3D_sample(getSample(id)); break; } case SMP_PLAYING: { //it's already playing. //new repeat info is ignored. new pose and velocity info was set above break; } default: { /*It shouldn't occur that one of the above cases isn't triggered. If error messages back to the client are ever implemented, one should be keyed here*/ break; } } } else fprintf(stderr,"No provider has been set prior to playSound\n"); }
// // Return the current sample status // U32 Status() { return ( flag3D ? AIL_3D_sample_status(handle3D) : AIL_sample_status(handle2D) ); }
void vrpn_Sound_Server_Miles::unloadAllSounds() //clears out samples { for(vrpn_int32 i = 0; i < H_Cur; i++) { if (samples[i] == NULL) continue; S32 status = AIL_3D_sample_status(samples[i]); if(status == SMP_DONE || status == SMP_STOPPED) //if handle is loaded and not playing, unload { AIL_release_3D_sample_handle(samples[i]); } if(status == SMP_PLAYING) //if handle is playing, stop then unload { AIL_stop_3D_sample(samples[i]); AIL_release_3D_sample_handle(samples[i]); } } H_Cur = 0; }