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


cmAudLabelFile : Read and write Audacity label files.

enum
{
  kOkAlfRC = cmOkRC,
  kLHeapFailAlfRC,
  kFileFailAlfRC,
  kSyntaxErrAlfRC,
  kAlfFileFailPuRC
};

typedef cmRC_t     cmAlfRC_t;
typedef cmHandle_t cmAlfH_t;

extern cmAlfH_t cmAlfNullHandle;

typedef struct
{
  cmReal_t        begSecs;
  cmReal_t        endSecs;
  const cmChar_t* label;
} cmAlfLabel_t;

cmAlfRC_t cmAudLabelFileAlloc(     cmCtx_t* ctx, cmAlfH_t* hp );
cmAlfRC_t cmAudLabelFileAllocOpen( cmCtx_t* ctx, cmAlfH_t* hp, const cmChar_t* fn );
cmAlfRC_t cmAudLabelFileFree(    cmAlfH_t* hp );

bool      cmAudLabelFileIsValid( cmAlfH_t h );

cmAlfRC_t cmAudLabelFileOpen(    cmAlfH_t h, const cmChar_t* fn );

cmAlfRC_t cmAudLabelFileInsert(  cmAlfH_t h, cmReal_t begSecs, cmReal_t endSecs, const cmChar_t* label );

unsigned cmAudLabelFileCount(    cmAlfH_t h );
const cmAlfLabel_t* cmAudLabelFileLabel( cmAlfH_t h, unsigned idx );

cmAlfRC_t cmAudLabelFileWrite( cmAlfH_t h, const cmChar_t* fn );

void cmAudLabelFileTest( cmCtx_t* ctx );