summaryrefslogtreecommitdiffstats
path: root/mpeglib/lib/util/audio/dspWrapper.h
blob: f323096d2cfdb9ebde3f767a06a5b3599f1ecf46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
  a wrapper for the audioDevice.
  Copyright (C) 1998  Martin Vogt

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU Library General Public License as published by
  the Free Software Foundation.

  For more information look at the file COPYRIGHT in this package

 */



#ifndef _DSPWRAPPER_H
#define _DSPWRAPPER_H

class AudioFrame;
class PCMFrame;
class FloatFrame;
#include <kdemacros.h>

/**
   This class wraps the platform specific /dev/dsp implementation.
   The only unusal thing is, that it supports each order of
   init/open.
   i) you can first init the device and the open
   ii) you can first open the device and the init it
   The implementation takes care that the calls are forwarded
   in the right order to the /dev/dsp implementation.
   (means: before the init it, we need to open it)
   But a caller can do it in both orders.
*/

class KDE_EXPORT DSPWrapper  {

  int lopenDevice;
  int lopenMixer;
  PCMFrame* currentFormat;


 public:
  DSPWrapper();
  ~DSPWrapper();
  
  int openDevice();
  int closeDevice();
  int isOpenDevice();

  int openMixer();
  int closeMixer();
  int isOpenMixer();

  int getAudioBufferSize();
  void setVolume(float leftPercent,float rightPercent);

  int audioSetup(int stereo,int sampleSize,int lSigned,
		 int lBigEndian,int freq);
  int audioSetup(AudioFrame* audioFrame);
  
  int audioPlay(char *buffer, int size);  
  int audioPlay(PCMFrame* pcmFrame);
  int audioPlay(FloatFrame* floatFrame);
  void audioFlush();

  int isEqual(int samplesize,int speed,int stereo,int lSigned,int lBigEndian);
  int write(char* buf,int len);
  void print();
};

#endif