struct pluto_crypto_req_cont *new_pcrc( crypto_req_cont_func fn, const char *name, struct state *st, struct msg_digest *md) { struct pluto_crypto_req_cont *r = alloc_thing(struct pluto_crypto_req_cont, name); r->pcrc_func = fn; r->pcrc_serialno = st->st_serialno; r->pcrc_md = md; r->pcrc_name = name; r->pcrc_replacing = SOS_NOBODY; passert(md == NULL || md->st == st); passert(st->st_suspended_md == NULL); /* * There is almost always a non-NULL md. * Exception: main_inI2_outR2_tail initiates DH calculation * in parallel with normal processing that needs the md exclusively. */ if (md != NULL) set_suspended(st, md); return r; }
/** * \brief Checks whether the game has just been suspended or resumed * and notifies the map elements when this is the case. * * This function is called at each cycle while this map is active, * but you may want to call it more often in specific situations if you cannot wait. */ void Map::check_suspended() { bool game_suspended = game->is_suspended(); if (suspended != game_suspended) { set_suspended(game_suspended); } }
/** * \brief Starts this state. * * This function is called automatically when this state becomes the active * state of the hero. * The initializations should be done here rather than in the constructor. * * \param previous_state The previous state or NULL if this is the first state * (for information). */ void Hero::State::start(State* previous_state) { set_suspended(hero.is_suspended()); // Notify Lua. if (hero.is_on_map()) { get_lua_context().hero_on_state_changed(hero, get_name()); } }
/** * \brief Sets whether this timer should be suspended when the map is suspended. * \param suspended_with_map true to suspend this timer with the map. */ void Timer::set_suspended_with_map(bool suspended_with_map) { if (suspended_with_map != this->suspended_with_map) { this->suspended_with_map = suspended_with_map; if (is_suspended() && !suspended_with_map) { set_suspended(false); } } }
/** * \brief Starts this state. * * This function is called automatically when this state becomes the active * state of the entity. * The initializations should be done here rather than in the constructor. * * \param previous_state The previous state or nullptr if this is the first state * (for information). */ void Entity::State::start(const State* /* previous_state */) { set_suspended(entity.is_suspended()); #if 0 // Notify Lua. if (entity.is_on_map()) { get_lua_context().entity_on_state_changed(entity, get_name()); } #endif }
/** * \brief This function is be called repeatedly by the game. * * Most of the time, there is nothing to update in this class. * The only elements updated here are some dynamic things * such as equipment-related animations or dialogs. */ void Equipment::update() { Game* game = savegame.get_game(); if (game == nullptr) { // nothing dynamic when there is no game return; } // check if the game is suspended bool game_suspended = game->is_suspended(); if (suspended != game_suspended) { set_suspended(game_suspended); } // update the item scripts for (const auto& kvp: items) { EquipmentItem& item = *kvp.second; item.update(); } }
/** * \brief This function is be called repeatedly by the game. * * Most of the time, there is nothing to update in this class. * The only elements updated here are some dynamic things * such as equipment-related animations or dialogs. */ void Equipment::update() { Game* game = savegame.get_game(); if (game == NULL) { // nothing dynamic when there is no game return; } // check if the game is suspended bool game_suspended = game->is_suspended(); if (suspended != game_suspended) { set_suspended(game_suspended); } // update the item scripts std::map<std::string, EquipmentItem*>::const_iterator it; for (it = items.begin(); it != items.end(); it++) { it->second->update(); } }
int main(int argc, char **argv) { int ch, np, ret, Xflag = 0; pcap_handler phandler = dump_packet; const char *errstr = NULL; char *pidf = NULL; ret = 0; closefrom(STDERR_FILENO + 1); while ((ch = getopt(argc, argv, "Dxd:f:i:p:s:")) != -1) { switch (ch) { case 'D': Debug = 1; break; case 'd': delay = strtonum(optarg, 5, 60*60, &errstr); if (errstr) usage(); break; case 'f': filename = optarg; break; case 'i': interface = optarg; break; case 'p': pidf = optarg; break; case 's': snaplen = strtonum(optarg, 0, PFLOGD_MAXSNAPLEN, &errstr); if (snaplen <= 0) snaplen = DEF_SNAPLEN; if (errstr) snaplen = PFLOGD_MAXSNAPLEN; break; case 'x': Xflag++; break; default: usage(); } } log_debug = Debug; argc -= optind; argv += optind; /* does interface exist */ if (!if_exists(interface)) { warn("Failed to initialize: %s", interface); logmsg(LOG_ERR, "Failed to initialize: %s", interface); logmsg(LOG_ERR, "Exiting, init failure"); exit(1); } if (!Debug) { openlog("pflogd", LOG_PID | LOG_CONS, LOG_DAEMON); if (daemon(0, 0)) { logmsg(LOG_WARNING, "Failed to become daemon: %s", strerror(errno)); } pidfile(pidf); } tzset(); (void)umask(S_IRWXG | S_IRWXO); /* filter will be used by the privileged process */ if (argc) { filter = copy_argv(argv); if (filter == NULL) logmsg(LOG_NOTICE, "Failed to form filter expression"); } /* initialize pcap before dropping privileges */ if (init_pcap()) { logmsg(LOG_ERR, "Exiting, init failure"); exit(1); } /* Privilege separation begins here */ if (priv_init()) { logmsg(LOG_ERR, "unable to privsep"); exit(1); } setproctitle("[initializing]"); /* Process is now unprivileged and inside a chroot */ signal(SIGTERM, sig_close); signal(SIGINT, sig_close); signal(SIGQUIT, sig_close); signal(SIGALRM, sig_alrm); signal(SIGUSR1, sig_usr1); signal(SIGHUP, sig_hup); alarm(delay); buffer = malloc(PFLOGD_BUFSIZE); if (buffer == NULL) { logmsg(LOG_WARNING, "Failed to allocate output buffer"); phandler = dump_packet_nobuf; } else { bufleft = buflen = PFLOGD_BUFSIZE; bufpos = buffer; bufpkt = 0; } if (reset_dump(Xflag) < 0) { if (Xflag) return (1); logmsg(LOG_ERR, "Logging suspended: open error"); set_suspended(1); } else if (Xflag) return (0); while (1) { np = pcap_dispatch(hpcap, PCAP_NUM_PKTS, phandler, (u_char *)dpcap); if (np < 0) { if (!if_exists(interface) == -1) { logmsg(LOG_NOTICE, "interface %s went away", interface); ret = -1; break; } logmsg(LOG_NOTICE, "%s", pcap_geterr(hpcap)); } if (gotsig_close) break; if (gotsig_hup) { if (reset_dump(0)) { logmsg(LOG_ERR, "Logging suspended: open error"); set_suspended(1); } gotsig_hup = 0; } if (gotsig_alrm) { if (dpcap) flush_buffer(dpcap); else gotsig_hup = 1; gotsig_alrm = 0; alarm(delay); } if (gotsig_usr1) { log_pcap_stats(); gotsig_usr1 = 0; } } logmsg(LOG_NOTICE, "Exiting"); if (dpcap) { flush_buffer(dpcap); fclose(dpcap); } purge_buffer(); log_pcap_stats(); pcap_close(hpcap); if (!Debug) closelog(); return (ret); }
/* dump a packet directly to the stream, which is unbuffered */ void dump_packet_nobuf(u_char *user, const struct pcap_pkthdr *h, const u_char *sp) { FILE *f = (FILE *)user; #ifdef __FreeBSD__ struct pcap_sf_pkthdr sh; #endif if (suspended) { packets_dropped++; return; } #ifdef __FreeBSD__ sh.ts.tv_sec = (bpf_int32)h->ts.tv_sec; sh.ts.tv_usec = (bpf_int32)h->ts.tv_usec; sh.caplen = h->caplen; sh.len = h->len; if (fwrite((char *)&sh, sizeof(sh), 1, f) != 1) { #else if (fwrite((char *)h, sizeof(*h), 1, f) != 1) { #endif off_t pos = ftello(f); /* try to undo header to prevent corruption */ #ifdef __FreeBSD__ if (pos < sizeof(sh) || ftruncate(fileno(f), pos - sizeof(sh))) { #else if (pos < sizeof(*h) || ftruncate(fileno(f), pos - sizeof(*h))) { #endif logmsg(LOG_ERR, "Write failed, corrupted logfile!"); set_suspended(1); gotsig_close = 1; return; } goto error; } if (fwrite((char *)sp, h->caplen, 1, f) != 1) goto error; return; error: set_suspended(1); packets_dropped ++; logmsg(LOG_ERR, "Logging suspended: fwrite: %s", strerror(errno)); } int flush_buffer(FILE *f) { off_t offset; int len = bufpos - buffer; if (len <= 0) return (0); offset = ftello(f); if (offset == (off_t)-1) { set_suspended(1); logmsg(LOG_ERR, "Logging suspended: ftello: %s", strerror(errno)); return (1); } if (fwrite(buffer, len, 1, f) != 1) { set_suspended(1); logmsg(LOG_ERR, "Logging suspended: fwrite: %s", strerror(errno)); ftruncate(fileno(f), offset); return (1); } set_suspended(0); bufpos = buffer; bufleft = buflen; bufpkt = 0; return (0); } void purge_buffer(void) { packets_dropped += bufpkt; set_suspended(0); bufpos = buffer; bufleft = buflen; bufpkt = 0; }
/* * tries to (re)open log file, nomove flag is used with -x switch * returns 0: success, 1: retry (log moved), -1: error */ int try_reset_dump(int nomove) { struct pcap_file_header hdr; struct stat st; int fd; FILE *fp; if (hpcap == NULL) return (-1); if (dpcap) { flush_buffer(dpcap); fclose(dpcap); dpcap = NULL; } /* * Basically reimplement pcap_dump_open() because it truncates * files and duplicates headers and such. */ fd = priv_open_log(); if (fd < 0) return (-1); fp = fdopen(fd, "a+"); if (fp == NULL) { logmsg(LOG_ERR, "Error: %s: %s", filename, strerror(errno)); close(fd); return (-1); } if (fstat(fileno(fp), &st) == -1) { logmsg(LOG_ERR, "Error: %s: %s", filename, strerror(errno)); fclose(fp); return (-1); } /* set FILE unbuffered, we do our own buffering */ if (setvbuf(fp, NULL, _IONBF, 0)) { logmsg(LOG_ERR, "Failed to set output buffers"); fclose(fp); return (-1); } #define TCPDUMP_MAGIC 0xa1b2c3d4 if (st.st_size == 0) { if (snaplen != cur_snaplen) { logmsg(LOG_NOTICE, "Using snaplen %d", snaplen); if (set_snaplen(snaplen)) logmsg(LOG_WARNING, "Failed, using old settings"); } hdr.magic = TCPDUMP_MAGIC; hdr.version_major = PCAP_VERSION_MAJOR; hdr.version_minor = PCAP_VERSION_MINOR; hdr.thiszone = hpcap->tzoff; hdr.snaplen = hpcap->snapshot; hdr.sigfigs = 0; hdr.linktype = hpcap->linktype; if (fwrite((char *)&hdr, sizeof(hdr), 1, fp) != 1) { fclose(fp); return (-1); } } else if (scan_dump(fp, st.st_size)) { fclose(fp); if (nomove || priv_move_log()) { logmsg(LOG_ERR, "Invalid/incompatible log file, move it away"); return (-1); } return (1); } dpcap = fp; set_suspended(0); flush_buffer(fp); return (0); }
/** * @brief Starts this state. * * This function is called automatically when this state becomes the active state of the hero. * The initializations should be done here rather than in the constructor. * * @param previous_state the previous state or NULL if this is the first state (for information) */ void Hero::State::start(State *previous_state) { set_suspended(hero.is_suspended()); }
static stf_status aggr_inI1_outR1_common(struct msg_digest *md, int authtype) { /* With Aggressive Mode, we get an ID payload in this, the first * message, so we can use it to index the preshared-secrets * when the IP address would not be meaningful (i.e. Road * Warrior). So our first task is to unravel the ID payload. */ struct state *st; struct payload_digest *const sa_pd = md->chain[ISAKMP_NEXT_SA]; struct connection *c = find_host_connection(&md->iface->ip_addr, md->iface->port, &md->sender, md->sender_port, LEMPTY); #if 0 if (c == NULL && md->iface->ike_float) { c = find_host_connection(&md->iface->addr, pluto_nat_port, &md->sender, md->sender_port, LEMPTY); } #endif if (c == NULL) { /* see if a wildcarded connection can be found */ pb_stream pre_sa_pbs = sa_pd->pbs; lset_t policy = preparse_isakmp_sa_body(&pre_sa_pbs) | POLICY_AGGRESSIVE; c = find_host_connection(&md->iface->ip_addr, pluto_port, (ip_address*)NULL, md->sender_port, policy); if (c == NULL || (c->policy & POLICY_AGGRESSIVE) == 0) { ipstr_buf b; loglog(RC_LOG_SERIOUS, "initial Aggressive Mode message from %s" " but no (wildcard) connection has been configured%s%s", ipstr(&md->sender, &b), (policy != LEMPTY) ? " with policy=" : "", (policy != LEMPTY) ? bitnamesof(sa_policy_bit_names, policy) : ""); /* XXX notification is in order! */ return STF_IGNORE; } /* Create a temporary connection that is a copy of this one. * His ID isn't declared yet. */ c = rw_instantiate(c, &md->sender, NULL, NULL); } /* Set up state */ cur_state = md->st = st = new_state(); /* (caller will reset cur_state) */ st->st_connection = c; st->st_remoteaddr = md->sender; st->st_remoteport = md->sender_port; st->st_localaddr = md->iface->ip_addr; st->st_localport = md->iface->port; st->st_interface = md->iface; change_state(st, STATE_AGGR_R1); /* until we have clue who this is, then be conservative about allocating * them any crypto bandwidth */ st->st_import = pcim_stranger_crypto; st->st_policy |= POLICY_AGGRESSIVE; st->st_oakley.auth = authtype; if (!ikev1_decode_peer_id(md, FALSE, TRUE)) { char buf[IDTOA_BUF]; ipstr_buf b; (void) idtoa(&st->st_connection->spd.that.id, buf, sizeof(buf)); loglog(RC_LOG_SERIOUS, "initial Aggressive Mode packet claiming to be from %s" " on %s but no connection has been authorized", buf, ipstr(&md->sender, &b)); /* XXX notification is in order! */ return STF_FAIL + INVALID_ID_INFORMATION; } c = st->st_connection; extra_debugging(c); st->st_try = 0; /* Not our job to try again from start */ st->st_policy = c->policy & ~POLICY_IPSEC_MASK; /* only as accurate as connection */ memcpy(st->st_icookie, md->hdr.isa_icookie, COOKIE_SIZE); get_cookie(FALSE, st->st_rcookie, COOKIE_SIZE, &md->sender); insert_state(st); /* needs cookies, connection, and msgid (0) */ st->st_doi = ISAKMP_DOI_IPSEC; st->st_situation = SIT_IDENTITY_ONLY; /* We only support this */ { ipstr_buf b; libreswan_log("responding to Aggressive Mode, state #%lu, connection \"%s\" from %s", st->st_serialno, st->st_connection->name, ipstr(&c->spd.that.host_addr, &b)); } merge_quirks(st, md); set_nat_traversal(st, md); /* save initiator SA for HASH */ clonereplacechunk(st->st_p1isa, sa_pd->pbs.start, pbs_room(&sa_pd->pbs), "sa in aggr_inI1_outR1()"); /* * parse_isakmp_sa picks the right group, which we need to know * before we do any calculations. We will call it again to have it * emit the winning SA into the output. */ /* SA body in */ { pb_stream sabs = sa_pd->pbs; RETURN_STF_FAILURE(parse_isakmp_sa_body(&sabs, &sa_pd->payload.sa, NULL, FALSE, st)); } /* KE in */ RETURN_STF_FAILURE(accept_KE(&st->st_gi, "Gi", st->st_oakley.group, &md->chain[ISAKMP_NEXT_KE]->pbs)); /* Ni in */ RETURN_STF_FAILURE(accept_v1_nonce(md, &st->st_ni, "Ni")); { struct ke_continuation *ke = alloc_thing( struct ke_continuation, "outI2 KE"); ke->ke_md = md; set_suspended(st, md); if (!st->st_sec_in_use) { /* need to calculate KE and Nonce */ pcrc_init(&ke->ke_pcrc, aggr_inI1_outR1_continue1); return build_ke(&ke->ke_pcrc, st, st->st_oakley.group, st->st_import); } else { /* KE and Nonce calculated */ ke->ke_pcrc.pcrc_serialno = st->st_serialno; /* transitional */ return aggr_inI1_outR1_tail(&ke->ke_pcrc, NULL); } } }
/* * for aggressive mode, this is sub-optimal, since we should have * had the crypto helper actually do everything, but we need to do * some additional work to set that all up, so this is fine for now. * */ static void aggr_inI1_outR1_continue1(struct pluto_crypto_req_cont *pcrc, struct pluto_crypto_req *r, err_t ugh) { struct ke_continuation *ke = (struct ke_continuation *)pcrc; struct msg_digest *md = ke->ke_md; struct state *const st = md->st; stf_status e; DBG(DBG_CONTROLMORE, DBG_log("aggr inI1_outR1: calculated ke+nonce, calculating DH")); if (st == NULL) { loglog(RC_LOG_SERIOUS, "%s: Request was disconnected from state", __FUNCTION__); release_any_md(&ke->ke_md); return; } /* XXX should check out ugh */ passert(ugh == NULL); passert(cur_state == NULL); passert(st != NULL); passert(st->st_suspended_md == ke->ke_md); unset_suspended(st); /* no longer connected or suspended */ set_cur_state(st); DBG(DBG_CONTROLMORE, DBG_log("#%lu %s:%u st->st_calculating = FALSE;", st->st_serialno, __FUNCTION__, __LINE__)); st->st_calculating = FALSE; /* unpack first calculation */ unpack_KE(st, r, &st->st_gr); /* unpack nonce too */ unpack_nonce(&st->st_nr, r); /* NOTE: the "r" reply will get freed by our caller */ /* set up second calculation */ { struct dh_continuation *dh = alloc_thing( struct dh_continuation, "aggr outR1 DH"); dh->dh_md = md; set_suspended(st, md); dh->dh_pcrc.pcrc_serialno = st->st_serialno; /* transitional */ pcrc_init(&dh->dh_pcrc, aggr_inI1_outR1_continue2); e = start_dh_secretiv(&dh->dh_pcrc, st, st->st_import, O_RESPONDER, st->st_oakley.group->group); if (e != STF_SUSPEND) { if (dh->dh_md != NULL) { complete_v1_state_transition(&dh->dh_md, e); release_any_md(&dh->dh_md); } } reset_cur_state(); } }
void CHighLife::sf2_import(const File& file) { // enter critical section set_suspended (1); fluid_defsfont_t* sfont = new_fluid_defsfont (); fluid_defsfont_load (sfont, (const char*) file.getFullPathName ()); fluid_defsfont_load_sampledata (sfont); fluid_defpreset_t* preset = sfont->preset; int p = 0; do { int const c_prg = user_program + p; if (! preset) break; if (c_prg >= NUM_PROGRAMS) break; printf ("start preset %s \n", preset->name); // get program pointer and initialize it HIGHLIFE_PROGRAM* pprg = &highlife_program[c_prg]; tool_init_program (pprg); // zone pointer holder HIGHLIFE_ZONE* pz = NULL; strncpy (pprg->name, preset->name, 32); fluid_preset_zone_t* zone = preset->zone; if (zone) { printf ("start instrument \n"); // start instrument fluid_inst_t* inst = zone->inst; if (inst) { // start zones fluid_inst_zone_t* realzone = inst->zone; int count = 0; do { printf ("zone %d \n", count++); fluid_sample_t* sample = realzone->sample; pz = tool_alloc_zone (pprg); pz->lo_input_range.midi_key = realzone->keylo; pz->hi_input_range.midi_key = realzone->keyhi; pz->lo_input_range.midi_vel = realzone->vello; pz->hi_input_range.midi_vel = realzone->velhi; pz->midi_trigger = 0; // attack phase pz->midi_root_key = sample->origpitch; // original root key note pz->midi_fine_tune = 0; // where in sf2 ? pz->midi_coarse_tune = 0; // where in sf2 ? pz->midi_keycents = sample->pitchadj; // in cents pz->mp_gain = 0; // 0 decibels pz->mp_pan = 0; // center strncpy (pz->name, realzone->name, MAX_PATH); // set generators if (realzone->gen [GEN_VOLENVATTACK].flags & GEN_SET) { pz->amp_env_att.value = realzone->gen [GEN_VOLENVATTACK].val; DBG ("GEN_VOLENVATTACK: " + String (realzone->gen [GEN_VOLENVATTACK].val)); } if (realzone->gen [GEN_VOLENVDECAY].flags & GEN_SET) { pz->amp_env_dec.value = realzone->gen [GEN_VOLENVDECAY].val; DBG ("GEN_VOLENVDECAY: " + String (realzone->gen [GEN_VOLENVDECAY].val)); } if (realzone->gen [GEN_VOLENVSUSTAIN].flags & GEN_SET) { pz->amp_env_sus.value = realzone->gen [GEN_VOLENVSUSTAIN].val; DBG ("GEN_VOLENVSUSTAIN: " + String (realzone->gen [GEN_VOLENVSUSTAIN].val)); } if (realzone->gen [GEN_VOLENVRELEASE].flags & GEN_SET) { pz->amp_env_rel.value = realzone->gen [GEN_VOLENVRELEASE].val + 12000.0f / 20000.0f; DBG ("GEN_VOLENVRELEASE: " + String (pz->amp_env_rel.value)); } if (realzone->gen [GEN_FILTERFC].flags & GEN_SET) { pz->flt_type = 1; pz->flt_cut_frq.value = realzone->gen [GEN_FILTERFC].val; DBG ("GEN_FILTERFC: " + String (realzone->gen [GEN_FILTERFC].val)); } if (realzone->gen [GEN_FILTERQ].flags & GEN_SET) { pz->flt_type = 1; pz->flt_res_amt.value = realzone->gen [GEN_FILTERQ].val; DBG ("GEN_FILTERQ: " + String (realzone->gen [GEN_FILTERQ].val)); } if (realzone->gen [GEN_CHORUSSEND].flags & GEN_SET) { pz->efx_chr_lev.value = 1.0f; DBG ("GEN_CHORUSSEND: " + String (realzone->gen [GEN_CHORUSSEND].val)); } if (realzone->gen [GEN_REVERBSEND].flags & GEN_SET) { pz->efx_rev_lev.value = 1.0f; DBG ("GEN_REVERBSEND: " + String (realzone->gen [GEN_REVERBSEND].val)); } /* pz->flt_kbd_trk = ?; pz->flt_vel_trk = ?; pz->efx_del_lev = ?; pz->mod_lfo_syn = ?; pz->mod_lfo_phs = ?; pz->mod_lfo_rat = ?; pz->mod_lfo_amp = ?; pz->mod_lfo_cut = ?; pz->mod_lfo_res = ?; pz->mod_lfo_pit = ?; pz->mod_env_att = ?; pz->mod_env_dec = ?; pz->mod_env_sus = ?; pz->mod_env_rel = ?; pz->mod_env_cut = ?; pz->mod_env_pit = ?; */ /* GEN_MODLFOTOPITCH, GEN_VIBLFOTOPITCH, GEN_MODENVTOPITCH, GEN_MODLFOTOFILTERFC, GEN_MODENVTOFILTERFC, GEN_MODLFOTOVOL, GEN_PAN, GEN_MODLFODELAY, GEN_MODLFOFREQ, GEN_VIBLFODELAY, GEN_VIBLFOFREQ, GEN_MODENVDELAY, GEN_MODENVATTACK, GEN_MODENVHOLD, GEN_MODENVDECAY, GEN_MODENVSUSTAIN, GEN_MODENVRELEASE, GEN_KEYTOMODENVHOLD, GEN_KEYTOMODENVDECAY, GEN_KEYTOVOLENVHOLD, GEN_KEYTOVOLENVDECAY, GEN_KEYRANGE, GEN_VELRANGE, GEN_KEYNUM, GEN_VELOCITY, GEN_ATTENUATION, GEN_COARSETUNE, GEN_FINETUNE, GEN_SAMPLEID, GEN_SAMPLEMODE, GEN_SCALETUNE, GEN_OVERRIDEROOTKEY, */ /* */ const int num_samples = sample->end - sample->start; const int loopstart = sample->loopstart - sample->start; const int loopend = sample->loopend - sample->start; // override loop points if (loopstart > 0 && loopend > 0) { pz->loop_mode = 0; // 1; // forward pz->loop_start = loopstart; pz->loop_end = loopend; } // copy over sample data (could be optimized) if (num_samples > 0) { tool_alloc_wave (pz, 1, num_samples); /* fluid_defsfont_load_sampledata_into (sfont, sample->start, num_samples, pz->ppwavedata, 0, num_samples, WAVE_PAD); */ const float scale = 1.0f / 32768.0f; for (int s = 0; s < num_samples; s++) { pz->ppwavedata[0][s + WAVE_PAD] = float (sample->data[sample->start + s]) * scale; } } } while ((realzone = realzone->next) != 0); // end zones } // end instrument } ++p; } while ((preset = preset->next) != 0); delete_fluid_defsfont (sfont); // sample editor should adapt user_sed_adapt=1; user_sed_zone=0; // enter critical section set_suspended (0); }
/** * \brief Notifies this timer that the current map is being suspended or resumed. * \param suspended true if the map is suspended, false if it is resumed. */ void Timer::notify_map_suspended(bool suspended) { if (suspended_with_map || !suspended) { set_suspended(suspended); } }
/** * \brief Sets whether this sprite should keep playing its animation when the game is suspended. * * This will ignore subsequent calls to set_suspended(). * * \param ignore_suspend true to make the sprite continue its animation even * when the game is suspended */ void Sprite::set_ignore_suspend(bool ignore_suspend) { set_suspended(false); this->ignore_suspend = ignore_suspend; }