PTLib
Version 2.14.3
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
portaudio.h
Go to the documentation of this file.
1
/*
2
* portaudio.h
3
*
4
* PortAudio sound driver
5
*
6
* Portable Windows Library
7
*
8
* Copyright (C) 2013 Post Increment
9
*
10
* The contents of this file are subject to the Mozilla Public License
11
* Version 1.0 (the "License"); you may not use this file except in
12
* compliance with the License. You may obtain a copy of the License at
13
* http://www.mozilla.org/MPL/
14
*
15
* Software distributed under the License is distributed on an "AS IS"
16
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17
* the License for the specific language governing rights and limitations
18
* under the License.
19
*
20
* The Original Code is Portable Windows Library.
21
*
22
* The Initial Developer of the Original Code is Post Increment
23
*
24
* Contributor(s): ______________________________________.
25
*
26
* $Revision: 28885 $
27
* $Author: csoutheren $
28
* $Date: 2013-01-14 18:38:08 +1100 (Mon, 14 Jan 2013) $
29
*/
30
31
33
// PSound
34
35
#ifndef _PSOUND_PORTAUDIO
36
#define _PSOUND_PORTAUDIO
37
38
#include <
portaudio.h
>
39
40
#ifdef P_PORTMIXER
41
#include <portmixer.h>
42
#endif
43
44
class
PSoundChannelPortAudio
:
public
PSoundChannel
45
{
46
public
:
47
PSoundChannelPortAudio
();
48
~PSoundChannelPortAudio
();
49
static
PStringArray
GetDeviceNames
(PSoundChannel::Directions = Player);
50
bool
Open
(
const
Params
& params);
51
bool
Setup
();
52
bool
Close
();
53
bool
IsOpen
()
const
;
54
bool
Write
(
const
void
* buf, PINDEX len);
55
bool
Read
(
void
* buf, PINDEX len);
56
bool
SetFormat
(
unsigned
numChannels,
57
unsigned
sampleRate,
58
unsigned
bitsPerSample);
59
unsigned
GetChannels
()
const
;
60
unsigned
GetSampleRate
()
const
;
61
unsigned
GetSampleSize
()
const
;
62
bool
SetBuffers
(PINDEX size, PINDEX count);
63
bool
GetBuffers
(PINDEX & size, PINDEX & count);
64
bool
PlaySound
(
const
PSound
& sound,
bool
wait);
65
bool
PlayFile
(
const
PFilePath
& filename,
bool
wait);
66
bool
HasPlayCompleted
();
67
bool
WaitForPlayCompletion
();
68
bool
RecordSound
(
PSound
& sound);
69
bool
RecordFile
(
const
PFilePath
& filename);
70
bool
StartRecording
();
71
bool
IsRecordBufferFull
();
72
bool
AreAllRecordBuffersFull
();
73
bool
WaitForRecordBufferFull
();
74
bool
WaitForAllRecordBuffersFull
();
75
bool
Abort
();
76
bool
SetVolume
(
unsigned
newVal);
77
bool
GetVolume
(
unsigned
&devVol);
78
bool
SetMute
(
bool
mute);
79
bool
GetMute
(
bool
& mute);
80
81
public
:
82
static
PMutex
&
GetInitMutex
();
83
static
bool
Initialise
();
84
85
bool
OpenStream
(
unsigned
numChannels,
unsigned
sampleRate,
unsigned
bitsPerSample);
86
87
bool
StartStream
();
88
bool
StopStream
();
89
90
// Overrides from class PChannel
91
virtual
PString
GetName
()
const
;
92
// Return the name of the channel.
93
94
PString
GetErrorText
(
ErrorGroup
group =
NumErrorGroups
)
const
;
95
// Get a text form of the last error encountered.
96
97
protected
:
98
PMutex
m_mutex
;
99
int
m_channels
;
100
int
m_sampleRate
;
101
int
m_bitsPerSample
;
102
int
m_bytesPerSample
;
103
int
m_sampleFormat
;
104
105
const
PaDeviceInfo *
m_deviceInfo
;
106
int
m_deviceId
;
107
PString
m_deviceName
;
108
bool
m_started
;
109
bool
m_mute
;
110
unsigned
char
*
m_muteBuffer
;
111
PINDEX
m_muteBufferSize
;
112
113
PaStream *
m_stream
;
114
PaStreamParameters
m_streamParms
;
115
116
#ifdef P_PORTMIXER
117
PxMixer * m_mixer;
118
#endif
119
int
m_volume
;
120
121
int
m_playBufferSize
;
122
int
m_playBufferCount
;
123
};
124
125
126
#endif
127
128
// End Of File ///////////////////////////////////////////////////////////////
include
ptclib
portaudio.h
Generated on Fri Oct 10 2014 21:15:13 for PTLib by
1.8.3.1