MCPcopy Create free account
hub / github.com/Monogatari/Monogatari / parseEffects

Method parseEffects

src/actions/Play.ts:270–300  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

268 }
269
270 parseEffects(): Record<string, any> {
271 const availableEffects = AudioPlayer.effects();
272
273 const effects: Record<string, any> = {};
274
275 for (const config of availableEffects) {
276 const index = this.props.indexOf(config.id);
277
278 if (index === -1) {
279 continue;
280 }
281
282 const params: Record<string, any> = {};
283
284 // Parse parameters based on the effect's parameter list
285 for (let i = 0; i < config.params.length; i++) {
286 const paramName = config.params[i];
287 const paramValue = this.props[index + 1 + i];
288
289 if (paramValue !== undefined) {
290 // Try to parse as number first, fallback to string
291 const numValue = parseFloat(paramValue);
292 params[paramName] = isNaN(numValue) ? paramValue : numValue;
293 }
294 }
295
296 effects[config.id] = params;
297 }
298
299 return effects;
300 }
301
302 override async willApply(): Promise<void> {
303 if (this.player || this.mediaKey) {

Callers 1

createAudioPlayerMethod · 0.95

Calls 1

effectsMethod · 0.80

Tested by

no test coverage detected