/* * S_PlaySample */ void S_PlaySample(const vec3_t org, int ent_num, s_sample_t *sample, int atten) { s_channel_t *ch; int i; if (!s_env.initialized) return; if (!sample) return; if (sample->name[0] == '*') sample = S_LoadModelSample(&cl.entities[ent_num].current, sample->name); if (!sample->chunk) return; if ((i = S_AllocChannel()) == -1) return; ch = &s_env.channels[i]; if (org) { // positioned sound VectorCopy(org, ch->org); ch->ent_num = -1; } else // entity sound ch->ent_num = ent_num; ch->atten = atten; ch->sample = sample; S_SpatializeChannel(ch); Mix_PlayChannel(i, ch->sample->chunk, 0); }
/** * @brief Precaches all of the sexed sounds for a given player model. */ void S_LoadClientSounds(const char *model) { GSList *sounds = NULL; const GList *key = s_media_state.keys; while (key) { s_media_t *media = g_hash_table_lookup(s_media_state.media, key->data); key = key->next; if (media && media->name[0] == '*') { sounds = g_slist_prepend(sounds, media); } } for (GSList *sound = sounds; sound; sound = sound->next) { const s_media_t *media = (const s_media_t *) sound->data; S_LoadModelSample(model, media->name); } g_slist_free(sounds); }