bool ModChannelMgr::joinChannel(const std::string &channel, session_t peer_id) { if (!channelRegistered(channel)) registerChannel(channel); return m_registered_channels[channel]->registerConsumer(peer_id); }
SoundID AudioPlayer::playSound( ResID id , float volume , bool beLoop ) { SoundRes* res = getSound( id ); if ( res == NULL ) return ERROR_SOUND_ID; FMOD_CHANNEL* channel; FMOD_System_PlaySound( mFmodSys , FMOD_CHANNEL_FREE , res->sound , false , &channel ); FMOD_Channel_SetVolume( channel , volume * res->volume * mSoundVolume ); FMOD_Channel_SetCallback( channel ,ChannelCallBack ); if ( beLoop ) FMOD_Channel_SetMode( channel ,FMOD_LOOP_NORMAL ); return registerChannel( channel ); }
void DevicePacker::registerChannels(PackPredicate predicate, ExtraDataManager& manager, const std::string& pvName, bool& needUpload, cudaStream_t stream) { for (const auto& name_desc : manager.getSortedChannels()) { auto desc = name_desc.second; if (!predicate(name_desc)) continue; int sz = desc->container->datatype_size(); if (sz % sizeof(int) != 0) die("Size of extra data per particle should be divisible by 4 bytes (PV '%s', data entry '%s')", pvName.c_str(), name_desc.first.c_str()); if ( sz % sizeof(float4) && (desc->shiftTypeSize == 4 || desc->shiftTypeSize == 8) ) die("Size of extra data per particle should be divisible by 16 bytes" "when shifting is required (PV '%s', data entry '%s')", pvName.c_str(), name_desc.first.c_str()); registerChannel(manager, sz, reinterpret_cast<char*>(desc->container->genericDevPtr()), desc->shiftTypeSize, needUpload, stream); } }