Skip to content

Reading row events while playing #8

Description

@sphaero

First of all my compliments for this player. It works really great!!!

I'm using this player to play mod files while also using the row events to trigger stuff. I.e. I'm using it in demos.

However I feel it must be easier to do. I'm calculating the time and buffer size it takes for a single row to process:

2500/this->modctx.bpm)*this->modctx.song.speed

I then read the current data and send it out with osc:

    note *cur_note = modctx.patterndata[state->cur_pattern] + (state->cur_pattern_pos * 4);

    // acquire values, see http://www.aes.id.au/modformat.html for details
    muint sample = (cur_note->sampperiod & 0xF0) | (cur_note->sampeffect >> 4);
    muint period = ((cur_note->sampperiod & 0xF) << 8) | cur_note->period;
    muint effect = ((cur_note->sampeffect & 0xF) << 8) | cur_note->effect;
    muchar effect_op = cur_note->sampeffect & 0xF;
    muchar effect_param = cur_note->effect;
    char effect_param_hex[3];
    sprintf(effect_param_hex, "%02X", effect_param);
    //muchar effect_param_l = effect_param & 0x0F;
    //muchar effect_param_h = effect_param >> 4;

    zosc_t *oscm = zosc_create("/patternevent", "iiiiics",
                                      state->cur_pattern_table_pos, // song pos
                                      state->cur_pattern,           // pattern nr
                                      state->cur_pattern_pos,       // pattern row
                                      period,   // note
                                      sample,
                                      HEXCHAR[effect_op],
                                      effect_param_hex
                                     );

This is also done for the other channels.

However I run into the situation that sometimes rows are skipped somehow. Perhaps because of a jump in the song or by other means.

I was wondering if anybody had thoughts or hints about how to accomplish this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions