Esempio n. 1
0
INT UserModuleInit(USER_MODULE *module)
{
    ASSERT(module != NULL);
    TRACE("module=%p", module);

    // Initialize module
    module->tszModuleName = MODULE_NAME;
    module->DeInitialize  = UserFinalize;
    module->Create        = UserCreate;
    module->Rename        = UserRename;
    module->Delete        = UserDelete;
    module->Lock          = UserLock;
    module->Unlock        = UserUnlock;
    module->Open          = UserOpen;
    module->Write         = UserWrite;
    module->Close         = UserClose;

    // Initialize database
    if (!DbInit(module->GetProc)) {
        TRACE("Unable to initialize module.");
        return UM_ERROR;
    }

    userModule = module;
    return UM_SUCCESS;
}
Esempio n. 2
0
INT GroupModuleInit(GROUP_MODULE *module)
{
    ASSERT(module != NULL);
    TRACE("module=%p", module);

    // Initialize module
    module->tszModuleName = MODULE_NAME;
    module->DeInitialize  = GroupFinalize;
    module->Create        = GroupCreate;
    module->Rename        = GroupRename;
    module->Delete        = GroupDelete;
    module->Lock          = GroupLock;
    module->Unlock        = GroupUnlock;
    module->Open          = GroupOpen;
    module->Write         = GroupWrite;
    module->Close         = GroupClose;

    // Initialize database
    if (!DbInit(module->GetProc)) {
        TRACE("Unable to initialize module.");
        return GM_ERROR;
    }

    groupModule = module;
    return GM_SUCCESS;
}
static int Open( vlc_object_t *p_this )
{
    filter_t *p_filter = (filter_t*)p_this;
    vlc_object_t *p_aout = p_filter->p_parent;
    float f_sample_rate = p_filter->fmt_in.audio.i_rate;
    float f_num;

    /* Initialize the filter parameter structure */
    filter_sys_t *p_sys = p_filter->p_sys = (filter_sys_t *)calloc( 1, sizeof(*p_sys) );			// sunqueen modify
    if( !p_sys )
    {
        return VLC_ENOMEM;
    }

    /* Initialize the attack lookup table */
    p_sys->pf_as[0] = 1.0f;
    for( int i = 1; i < A_TBL; i++ )
    {
        p_sys->pf_as[i] = expf( -1.0f / ( f_sample_rate * i / A_TBL ) );
    }

    /* Calculate the RMS and lookahead sizes from the sample rate */
    f_num = 0.01f * f_sample_rate;
    p_sys->rms.i_count = Round( Clamp( 0.5f * f_num, 1.0f, RMS_BUF_SIZE ) );
    p_sys->la.i_count = Round( Clamp( f_num, 1.0f, LOOKAHEAD_SIZE ) );

    /* Initialize decibel lookup tables */
    DbInit( p_sys );

    /* Restore the last saved settings */
    p_sys->f_rms_peak    = var_CreateGetFloat( p_aout, "compressor-rms-peak" );
    p_sys->f_attack      = var_CreateGetFloat( p_aout, "compressor-attack" );
    p_sys->f_release     = var_CreateGetFloat( p_aout, "compressor-release" );
    p_sys->f_threshold   = var_CreateGetFloat( p_aout, "compressor-threshold" );
    p_sys->f_ratio       = var_CreateGetFloat( p_aout, "compressor-ratio" );
    p_sys->f_knee        = var_CreateGetFloat( p_aout, "compressor-knee" );
    p_sys->f_makeup_gain =
           var_CreateGetFloat( p_aout, "compressor-makeup-gain" );

    /* Initialize the mutex */
    vlc_mutex_init( &p_sys->lock );

    /* Add our own callbacks */
    var_AddCallback( p_aout, "compressor-rms-peak", RMSPeakCallback, p_sys );
    var_AddCallback( p_aout, "compressor-attack", AttackCallback, p_sys );
    var_AddCallback( p_aout, "compressor-release", ReleaseCallback, p_sys );
    var_AddCallback( p_aout, "compressor-threshold", ThresholdCallback, p_sys );
    var_AddCallback( p_aout, "compressor-ratio", RatioCallback, p_sys );
    var_AddCallback( p_aout, "compressor-knee", KneeCallback, p_sys );
    var_AddCallback( p_aout, "compressor-makeup-gain", MakeupGainCallback, p_sys );

    /* Set the filter function */
    p_filter->fmt_in.audio.i_format = VLC_CODEC_FL32;
    p_filter->fmt_out.audio = p_filter->fmt_in.audio;
    p_filter->pf_audio_filter = DoWork;

    /* At this stage, we are ready! */
    msg_Dbg( p_filter, "compressor successfully initialized" );
    return VLC_SUCCESS;
}
Esempio n. 4
0
static rc_t Run(const CmdLine* args)
{
    rc_t rc = 0;

    Db db;
    SpotIterator it;

    assert(args);

    if (!SpotIteratorFileExists(args->file)) {
        rc = RC(rcExe, rcFile, rcOpening, rcFile, rcNotFound);
        PLOGERR(klogErr,
            (klogErr, rc, "Cannot find '$(path)'", "path=%s", args->file));
    }
    else if (!SpotIteratorFileExists(args->table)) {
        rc = RC(rcExe, rcTable, rcOpening, rcTable, rcNotFound);
        PLOGERR(klogErr,
            (klogErr, rc, "Cannot find '$(path)'", "path=%s", args->table));
    }

    {
        rc_t rc2 = DbInit(rc, args, &db);
        if (rc == 0)
        {   rc = rc2; }
    }

    if (rc == 0) {
        rc = SpotIteratorInit(args->file, &db, &it);
    }

    if (rc == 0) {
        rc = Work(&db, &it);
    }

    if (rc == 0) {
        PLOGMSG(klogInfo, (klogInfo,
            "Success: redacted $(redacted) spots out of $(all)",
            "redacted=%d,all=%d", db.redactedSpots, db.nSpots));
    }

    {
        rc_t rc2 = SpotIteratorDestroy(&it);
        if (rc == 0)
        {   rc = rc2; }
    }

    {
        rc_t rc2 = DbDestroy(&db);
        if (rc == 0)
        {   rc = rc2; }
    }

    return rc;
}
Esempio n. 5
0
void Init(char *langs, char *dialects, int anamorph)
{
  Starting = 1;
  GenOnAssert = 1;
  LexEntryOff = 0;
  SaveTime = 1;
    /* SaveTime = 1: no spell correction hashing or phrase derivation,
     *               saves memory.
     * SaveTime = 0: uses more time and memory.
     */
  qallocInit();
  DbgInit();
  DbgSet(DBGALL, DBGBAD);
  DbgSetStdoutLevel(DBGOK);
  NoticePrint(stderr);
  NoticePrint(Log);
  EnvInit();
  StringInit();
  RandomInit();
  GridInit();
  ObjInit();
  ObjListInit();
  DbInit();
  ContextInit();
  TsInit();
  TsRangeInit();
  LexEntryInit();
  Lex_WordForm2Init();
  MorphInit(anamorph);
  WordFormInit();
  InferenceInit();
  ReportInit();
  CommentaryInit();
  TranslateInit();
  LearnInit();
  StopAtInit();
  TT_HTML_Init();
  StdDiscourse = DiscourseCreate(langs, dialects);
  DiscourseSetLang(StdDiscourse, F_ENGLISH);
  Starting = 0;
}