Lines Matching refs:ctx
46 static struct pipeline *prepare_pipeline(struct cras_dsp_context *ctx) in prepare_pipeline() argument
49 const char *purpose = ctx->purpose; in prepare_pipeline()
54 pipeline = cras_dsp_pipeline_create(ini, &ctx->env, purpose); in prepare_pipeline()
68 if (cras_dsp_pipeline_instantiate(pipeline, ctx->sample_rate) != 0) { in prepare_pipeline()
73 if (cras_dsp_pipeline_get_sample_rate(pipeline) != ctx->sample_rate) { in prepare_pipeline()
76 ctx->sample_rate); in prepare_pipeline()
89 void cras_dsp_set_variable(struct cras_dsp_context *ctx, const char *key, in cras_dsp_set_variable() argument
92 cras_expr_env_set_variable_string(&ctx->env, key, value); in cras_dsp_set_variable()
95 void cras_dsp_load_pipeline(struct cras_dsp_context *ctx) in cras_dsp_load_pipeline() argument
99 pipeline = prepare_pipeline(ctx); in cras_dsp_load_pipeline()
101 old_pipeline = ctx->pipeline; in cras_dsp_load_pipeline()
102 ctx->pipeline = pipeline; in cras_dsp_load_pipeline()
111 struct cras_dsp_context *ctx; in cras_dsp_reload_ini() local
117 DL_FOREACH(context_list, ctx) { in cras_dsp_reload_ini()
118 cras_dsp_load_pipeline(ctx); in cras_dsp_reload_ini()
144 struct cras_dsp_context *ctx = calloc(1, sizeof(*ctx)); in cras_dsp_context_new() local
146 initialize_environment(&ctx->env); in cras_dsp_context_new()
147 ctx->sample_rate = sample_rate; in cras_dsp_context_new()
148 ctx->purpose = strdup(purpose); in cras_dsp_context_new()
150 DL_APPEND(context_list, ctx); in cras_dsp_context_new()
151 return ctx; in cras_dsp_context_new()
154 void cras_dsp_context_free(struct cras_dsp_context *ctx) in cras_dsp_context_free() argument
156 DL_DELETE(context_list, ctx); in cras_dsp_context_free()
158 if (ctx->pipeline) { in cras_dsp_context_free()
159 cras_dsp_pipeline_free(ctx->pipeline); in cras_dsp_context_free()
160 ctx->pipeline = NULL; in cras_dsp_context_free()
162 cras_expr_env_free(&ctx->env); in cras_dsp_context_free()
163 free((char *)ctx->purpose); in cras_dsp_context_free()
164 free(ctx); in cras_dsp_context_free()
167 struct pipeline *cras_dsp_get_pipeline(struct cras_dsp_context *ctx) in cras_dsp_get_pipeline() argument
169 return ctx->pipeline; in cras_dsp_get_pipeline()
172 void cras_dsp_put_pipeline(struct cras_dsp_context *ctx) in cras_dsp_put_pipeline() argument
176 unsigned int cras_dsp_num_output_channels(const struct cras_dsp_context *ctx) in cras_dsp_num_output_channels() argument
178 return cras_dsp_pipeline_get_num_output_channels(ctx->pipeline); in cras_dsp_num_output_channels()
181 unsigned int cras_dsp_num_input_channels(const struct cras_dsp_context *ctx) in cras_dsp_num_input_channels() argument
183 return cras_dsp_pipeline_get_num_input_channels(ctx->pipeline); in cras_dsp_num_input_channels()