Copyright (C) Kevin Larke 2009-2020

This file is part of libcm.

libcm is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

libcm is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

See the GNU General Public License distributed with the libcm package or look here: .


cmScoreMatchGraphic : Implements the functionality of cmMidiScoreFollowMain().

enum
{
  kOkSmgRC = cmOkRC,
  kFileSmgRC,
  kScoreFailSmgRC,
  kMidiFileFailSmgRC,
  kOpFailSmgRC,
  kMatchFailSmgRC
};

typedef cmRC_t     cmSmgRC_t;
typedef cmHandle_t cmSmgH_t;

extern cmSmgH_t cmSmgNullHandle;

cmSmgRC_t cmScoreMatchGraphicAlloc( cmCtx_t* ctx, cmSmgH_t* hp, const cmChar_t* scoreFn, const cmChar_t* midiFn );
cmSmgRC_t cmScoreMatchGraphicFree( cmSmgH_t* hp );
bool      cmScoreMatchGraphicIsValid( cmSmgH_t h );
cmSmgRC_t cmScoreMatchGraphicInsertMidi( cmSmgH_t h, unsigned midiUid, unsigned midiPitch, unsigned midiVel, unsigned csvScoreEventId );
cmSmgRC_t cmScoreMatchGraphicWrite( cmSmgH_t h, const cmChar_t* fn );

// Generate a set of markers for use in a cmTimeLine file which forms a marked area
// beginning at each bar line and ends at the end of the file.
cmSmgRC_t cmScoreMatchGraphicGenTimeLineBars( cmSmgH_t h, const cmChar_t* fn, unsigned srate );

// Update the MIDI file velocity values and insert pedal events
// from from score into MIDI file and then write the updated MIDI
// file to 'newMidiFn'.
cmSmgRC_t cmScoreMatchGraphicUpdateMidiFromScore( cmCtx_t* ctx, cmSmgH_t h, const cmChar_t* newMidiFn );