/usr/include/ptlib/unix/ptlib/beaudio.h is in libpt-dev 2.10.10~dfsg-4.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | /*
* beaudio.h
*
* BeOS Sound driver class definitions.
*
* Portable Windows Library
*
* Copyright (c) 1993-1998 Equivalence Pty. Ltd.
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Portable Windows Library.
*
* The Initial Developer of the Original Code is Equivalence Pty. Ltd.
*
* Portions are Copyright (C) 1993 Free Software Foundation, Inc.
* All Rights Reserved.
*
* Contributor(s):
* Yuri Kiryanov, ykiryanov at users.sourceforge.net
* Bits by Jac Goudsmit
*
* $Revision: 21788 $
* $Author: rjongbloed $
* $Date: 2008-12-11 23:42:13 -0600 (Thu, 11 Dec 2008) $
*/
#include <ptlib.h>
#include <ptlib/dynalink.h>
#include <ptlib/sound.h>
#include <ptlib/socket.h>
#include <ptlib/plugin.h>
// Storage kit
#include <storage/Directory.h>
#include <storage/Entry.h>
#include <storage/File.h>
// Media kit
#include <media/MediaDefs.h>
#include <media/MediaFormats.h>
#include <media/MediaFile.h>
#include <media/MediaTrack.h>
#include <media/SoundPlayer.h>
#include <media/PlaySound.h>
// Kernel kit
#include <kernel/OS.h>
// Beep kit :-)
#include <support/Beep.h>
#include "resampler.h"
#ifdef B_ZETA_VERSION
#define MEDIA_KIT_UPDATE
#endif
#ifdef MEDIA_KIT_UPDATE
#include <media/MediaRecorder.h>
#else
#include "beaudio/MediaRecorder.h"
#endif
////////////////////////////////////////////////////////////////////////////////
// PSoundChannelBeOS declaration
class CircularBuffer;
class PSoundChannelBeOS: public PSoundChannel
{
public:
PSoundChannelBeOS();
void Construct();
PSoundChannelBeOS(const PString &device,
PSoundChannel::Directions dir,
unsigned numChannels,
unsigned sampleRate,
unsigned bitsPerSample);
~PSoundChannelBeOS();
static PStringArray GetDeviceNames(PSoundChannel::Directions = Player);
static PString GetDefaultDevice(PSoundChannel::Directions);
PBoolean Open(
const PString & device,
Directions dir,
unsigned numChannels,
unsigned sampleRate,
unsigned bitsPerSample
);
PBoolean Setup();
PBoolean Close();
PBoolean IsOpen() const;
PBoolean Write(const void * buf, PINDEX len);
PBoolean Read(void * buf, PINDEX len);
PBoolean SetFormat(unsigned numChannels,
unsigned sampleRate,
unsigned bitsPerSample);
unsigned GetChannels() const;
unsigned GetSampleRate() const;
unsigned GetSampleSize() const;
PBoolean SetBuffers(PINDEX size, PINDEX count);
PBoolean GetBuffers(PINDEX & size, PINDEX & count);
PBoolean PlaySound(const PSound & sound, PBoolean wait);
PBoolean PlayFile(const PFilePath & filename, PBoolean wait);
PBoolean HasPlayCompleted();
PBoolean WaitForPlayCompletion();
PBoolean RecordSound(PSound & sound);
PBoolean RecordFile(const PFilePath & filename);
PBoolean StartRecording();
PBoolean IsRecordBufferFull();
PBoolean AreAllRecordBuffersFull();
PBoolean WaitForRecordBufferFull();
PBoolean WaitForAllRecordBuffersFull();
PBoolean Abort();
PBoolean SetVolume(unsigned newVal);
PBoolean GetVolume(unsigned &devVol);
public:
// Overrides from class PChannel
virtual PString GetName() const { return deviceName; }
// Return the name of the channel.
protected:
PString deviceName;
Directions direction;
private:
// Only one of the following pointers can be non-NULL at a time.
BMediaRecorder *mRecorder;
BSoundPlayer *mPlayer;
// Raw media format specifier used for sound player.
// It also stores the parameters (number of channels, sample rate etc) so
// no need to store them separately here.
// For the recorder, a media_format struct is created temporarily with
// the data from this raw format spec.
media_raw_audio_format mFormat;
// The class holds a circular buffer whose size is set with SetBuffers.
// We only need one buffer for BeOS. The number of buffers that was set
// is only kept for reference.
friend class CircularBuffer;
CircularBuffer *mBuffer; // The internal buffer
PINDEX mNumBuffers; // for reference only!
// Just some helpers so that the Open function doesn't get too big
PBoolean OpenPlayer(void);
PBoolean OpenRecorder(const PString &dev);
// internal buffer setting function so we can disable the SetBuffers
// function for debug purposes
// size is the total size, threshold is the fill/drain threshold on
// the buffer
PBoolean InternalSetBuffers(PINDEX size, PINDEX threshold);
// Input resampler
Resampler *mResampler;
};
|