view intercom/cirbuf.h @ 4:26cd8f1ef0b1

import spandsp-0.0.6pre17
author Peter Meerwald <pmeerw@cosy.sbg.ac.at>
date Fri, 25 Jun 2010 15:50:58 +0200
parents c6c5a16ce2f2
children
line wrap: on
line source

/* cirbuf.h
 *
 * Copyright (C) DFS Deutsche Flugsicherung (2004, 2005). 
 * All Rights Reserved.
 *
 * Circular Buffers
 *
 * Version 0.2
 */
#ifndef _CIRBUF_H

// must be multiple of FRAGSIZE and FRAMESIZE
#define CIRBUFSIZE	(WIDEB*2*80*8*2)  

/* circular buffer for FRAGSIZE to FRAMESIZE conversion with 
 * overrun/underrun */
class CIRBUF {
  char buf[CIRBUFSIZE];         // must be multiple of FRAGSIZE and FRAMESIZE
  int in;
  int out;
  int len;

public:
   CIRBUF();
  void init();
  int push(char *from, int size);
  int pop(char *to, int size);
  int getlen() {
    return len;
  }
};

#define _CIRBUF_H
#endif

Repositories maintained by Peter Meerwald, pmeerw@pmeerw.net.