Skip to content

Join pcm_map_t and memorypcm_preset_t #503

@bwhitman

Description

@bwhitman

From dan:

The current get_preset_for_preset_number returns the memorypcm_preset_t by value (i.e., 28 bytes on the stack or something). The modified code returns a pointer to struct, which is cool, except when the preset is built-in, not memorypcm, we have to expand the pcm_map_t of the built-in sample to the full memorypcm struct, which we're now going to return as a pointer. So this code has a static alloc hidden in the middle which is pulls out, fills in, and returns the address of, if you're looking at a "rom" built-in structure. This probably works, but the client gets a pointer to a structure which is really kinda temporary, valid until the next time get_preset_for_preset_number needs to use it.

Instead, we should probably have a single pcm descriptor which is used for both memorypcm and built-in presets i.e. we make pcm_map_t the same as memorypcm_preset_t. This will involve some kind of run-time setup so the current offset value can be added to the base of the pcm[] array set up in pcm_samples_* to get an actual pointer to a memory location. Maybe write this up as an issue so we can come back and clean it up in the future?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions