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: .


cmSyncRecd : Generate time-alignment data between an audio and MIDI file. See cmDspSyncRecd_t.

enum
{
  kOkSyRC,
  kFileFailSyRC,
  kAudioFileFailSyRC,
  kInvalidOpSyRC
};

typedef cmHandle_t cmSyncRecdH_t;
typedef cmRC_t     cmSyRC_t;
extern cmSyncRecdH_t cmSyncRecdNullHandle;

cmSyRC_t cmSyncRecdCreate(  cmCtx_t* ctx, cmSyncRecdH_t* hp, const cmChar_t* srFn, const cmChar_t* audioFn, double srate, unsigned chCnt, unsigned bits );
cmSyRC_t cmSyncRecdOpen(    cmCtx_t* ctx, cmSyncRecdH_t* hp, const cmChar_t* srFn );
cmSyRC_t cmSyncRecdFinal(   cmSyncRecdH_t* hp );
bool     cmSyncRecdIsValid( cmSyncRecdH_t h );

cmSyRC_t cmSyncRecdMidiWrite(  cmSyncRecdH_t h, const cmTimeSpec_t* timestamp, unsigned status, unsigned d0, unsigned d1 );
cmSyRC_t cmSyncRecdAudioWrite( cmSyncRecdH_t h, const cmTimeSpec_t* timestamp, unsigned smpIdx, const cmSample_t* ch[], unsigned chCnt, unsigned frmCnt );


cmSyRC_t cmSyncRecdTest( cmCtx_t* ctx );