int LPCINST::init(double p[], int n_args) { int rval; #ifdef MAXMSP LPCprofile(); #endif if (outputchans != 1) return die(name(), "Output file must have 1 channel only\n"); GetDataSet(&_dataSet); if (_dataSet == NULL) return die(name(), "No open dataset!\n"); _dataSet->ref(); _nPoles = _dataSet->getNPoles(); rval = localInit(p, n_args); if (rval == DONT_SCHEDULE) return die(name(), "LocalInit failed."); // Finish the initialization for (int i=0; i<_nPoles*2; i++) _past[i] = 0; /* nSamps() returns the number of sample frames that will be written to output (dur * SR). */ return nSamps(); }
StackWithBonuses::StackWithBonuses(const HypotheticBattle * Owner, const CStack * Stack) : battle::CUnitState(), origBearer(Stack), owner(Owner), type(Stack->unitType()), baseAmount(Stack->unitBaseAmount()), id(Stack->unitId()), side(Stack->unitSide()), player(Stack->unitOwner()), slot(Stack->unitSlot()) { localInit(Owner); battle::CUnitState::operator=(*Stack); }
StackWithBonuses::StackWithBonuses(const HypotheticBattle * Owner, const battle::UnitInfo & info) : battle::CUnitState(), origBearer(nullptr), owner(Owner), baseAmount(info.count), id(info.id), side(info.side), slot(SlotID::SUMMONED_SLOT_PLACEHOLDER) { type = info.type.toCreature(); origBearer = type; player = Owner->getSidePlayer(side); localInit(Owner); position = info.position; summoned = info.summoned; }
/** \fn audioDeviceThreaded \brief destructor */ uint8_t audioDeviceThreaded::init(uint32_t channel, uint32_t fq ,CHANNEL_TYPE *channelMapping) { // Allocate buffer memcpy(incomingMapping,channelMapping,sizeof(CHANNEL_TYPE)*MAX_CHANNELS); _channels=channel; _frequency=fq; sizeOf10ms=(_channels*_frequency*2)/100; sizeOf10ms&=~15; // make sure it is a multiple of 16 silence=new uint8_t[sizeOf10ms]; memset(silence,0,sizeOf10ms); audioBuffer=new uint8_t[ADM_THREAD_BUFFER_SIZE]; rdIndex=wrIndex=0; CHANGE_STATE(AUDIO_DEVICE_STOPPED); // if(!localInit()) return 0; // Spawn CHANGE_STATE(AUDIO_DEVICE_STARTED); ADM_assert(!pthread_create(&myThread,NULL,bouncer,this)); return 1; }
TripleBufferIFileStream::TripleBufferIFileStream() : basic_ifstream<char>(),m_buffer_size(DEFAULT_BUFFER_SIZE) { localInit(); }
TripleBufferIFileStream::TripleBufferIFileStream(const std::string& __s, ios_base::openmode __mode,size_t bs) : basic_ifstream<char>(__s.c_str(), __mode),m_buffer_size(bs) { localInit(); }
int MBASE::init(double p[], int n_args) { int flag, UseMikes; float outskip, inskip, abs_factor, dummy; double R, T, dist; outskip = p[0]; inskip = p[1]; m_dur = p[2]; if (m_dur < 0) /* "dur" represents timend */ m_dur = -m_dur - inskip; if (rtsetinput(inskip, this) == -1) { // no input return(DONT_SCHEDULE); } insamps = (int)(m_dur * SR); inamp = p[3]; if (inamp < 0) { m_paths = 1; // Dont process secondary paths inamp = -inamp; } /* Get results of Minc setup calls (space, mikes_on, mikes_off, matrix) */ if (get_setup_params(Dimensions, &m_attenParams, &dummy, &abs_factor, &UseMikes, &MikeAngle, &MikePatternFactor) == -1) { return die(name(), "You must call setup routine `space' first."); } // call inst-specific init code if (localInit(p, n_args) == DONT_SCHEDULE) return die(name(), "localInit failed."); if (m_inchan >= inputChannels()) return die(name(), "You asked for channel %d of a %d-channel input file.", m_inchan, inputChannels()); if (inputChannels() == 1) m_inchan = 0; if (outputChannels() != 4) return die(name(), "Output must be 4-channel (2 signal, 2 reverb feed)."); /* (perform some initialization that used to be in space.c) */ int meanLength = MFP_samps(SR, Dimensions); // mean delay length for reverb get_lengths(meanLength); /* sets up delay lengths */ set_gains(); /* sets gains for filters */ set_walls(abs_factor); /* sets wall filts for move routine */ /* flag for use of ear filters */ m_binaural = (!UseMikes && m_dist < 0.8 && m_dist != 0.0); amparray = floc(1); if (amparray) { int amplen = fsize(1); tableset(SR, m_dur, amplen, amptabs); /* controls input dur only */ } /* determine extra run time for this routine before calling rtsetoutput() */ double reflectionDur = 0.0; finishInit(&reflectionDur); m_branch = 0; if (rtsetoutput(outskip, m_dur + reflectionDur, this) == -1) return DONT_SCHEDULE; DBG1(printf("nsamps = %d\n", nSamps())); return nSamps(); }
int BASE::init(double p[], int n_args) { int UseMikes; float outskip, inskip, abs_factor, rvb_time; outskip = p[0]; inskip = p[1]; m_dur = p[2]; if (m_dur < 0) /* "dur" represents timend */ m_dur = -m_dur - inskip; if (rtsetinput(inskip, this) == -1) { // no input return(DONT_SCHEDULE); } insamps = (int)(m_dur * SR); inamp = p[3]; double Matrix[12][12]; /* Get results of Minc setup calls (space, mikes_on, mikes_off, matrix) */ if (get_setup_params(Dimensions, Matrix, &abs_factor, &rvb_time, &UseMikes, &MikeAngle, &MikePatternFactor) == -1) { return die(name(), "You must call setup routine `space' first."); } // call inst-specific init code if (localInit(p, n_args) == DONT_SCHEDULE) { return die(name(), "localInit failed."); } if (m_inchan >= inputChannels()) { return die(name(), "You asked for channel %d of a %d-channel input file.", m_inchan, inputChannels()); } if (inputChannels() == 1) m_inchan = 0; if (outputChannels() != 2) { return die(name(), "Output must be stereo."); } wire_matrix(Matrix); /* (perform some initialization that used to be in space.c) */ int meanLength = MFP_samps(SR, Dimensions); // mean delay length for reverb get_lengths(meanLength); /* sets up delay lengths */ set_gains(rvb_time); /* sets gains for filters */ set_walls(abs_factor); /* sets wall filts for move routine */ set_allpass(); set_random(); /* sets up random variation of delays */ /* flag for use of ear filters */ m_binaural = (!UseMikes && m_dist < 0.8 && m_dist != 0.0); amparray = floc(1); if (amparray) { int amplen = fsize(1); tableset(SR, m_dur, amplen, amptabs); /* controls input dur only */ } else rtcmix_advise(name(), "Setting phrase curve to all 1's."); /* determine extra run time for this routine before calling rtsetoutput() */ double ringdur = 0.0; finishInit(rvb_time, &ringdur); m_branch = 0; if (rtsetoutput(outskip, m_dur + ringdur, this) == -1) return DONT_SCHEDULE; DBG1(printf("nsamps = %d\n", nSamps())); return nSamps(); }