Aldebaran documentation
|
C++ Libraries
|
index
libalaudio
2.4.3.28-r2
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
alaudio
alsoundextractor.h
Go to the documentation of this file.
1
7
#pragma once
8
#ifndef _LIBALAUDIO_ALAUDIO_ALSOUNDEXTRACTOR_H_
9
#define _LIBALAUDIO_ALAUDIO_ALSOUNDEXTRACTOR_H_
10
11
#include <
alextractor/alextractor.h
>
12
#include <alvalue/alvalue.h>
13
#include <boost/shared_ptr.hpp>
14
#include <string>
15
#include <vector>
16
#include <qi/log.hpp>
17
#include <qi/macro.hpp>
18
19
typedef
signed
short
AL_SOUND_FORMAT
;
// ASSUME: sound data are in 16 bits
20
21
// deprecated
22
// usable and practical logging system
23
24
#define DESACTIVATE_ALL_DEV_INFO // define me to desactivate all debug or trace info (should be defined on public release version)
25
26
#ifndef DESACTIVATE_ALL_DEV_INFO
27
# define AL_SOUND_EXTRACTOR_DEBUG_PRINTF(...) if ( getDebugMode() ) { printf(__VA_ARGS__); }
28
# define AL_SOUND_EXTRACTOR_DEBUG_LOG(onestr) if ( getDebugMode() ) { fLoggerProxy->debug( getName(), std::string( onestr ) ); }
29
# define AL_SOUND_EXTRACTOR_INFO_LOG(onestr) if ( getDebugMode() ) { fLoggerProxy->info( getName(), std::string( onestr ) ); }
30
# define AL_SOUND_EXTRACTOR_ERROR_LOG(onestr) if ( getDebugMode() ) { fLoggerProxy->error( getName(), std::string( onestr ) ); }
31
#else
32
# define AL_SOUND_EXTRACTOR_DEBUG_PRINTF(...)
/* onestr */
33
# define AL_SOUND_EXTRACTOR_DEBUG_LOG(onestr)
/* onestr */
34
# define AL_SOUND_EXTRACTOR_INFO_LOG(onestr)
/* onestr */
35
# define AL_SOUND_EXTRACTOR_ERROR_LOG(onestr)
/* onestr */
36
#endif
37
38
namespace
AL
39
{
40
class
ALProxy;
41
class
ALBroker;
42
43
enum
AUDIOCHANNELTYPE
44
{
45
ALLCHANNELS
= 0,
46
LEFTCHANNEL
= 1,
47
RIGHTCHANNEL
= 2,
48
FRONTCHANNEL
= 3,
49
REARCHANNEL
= 4,
50
FIRSTCHANNEL
=
LEFTCHANNEL
,
51
SECONDCHANNEL
=
RIGHTCHANNEL
,
52
THIRDCHANNEL
=
FRONTCHANNEL
,
53
FOURTHCHANNEL
=
REARCHANNEL
54
};
55
56
class
ALSoundExtractor
:
public
ALExtractor
57
{
58
public
:
59
ALSoundExtractor
( boost::shared_ptr<AL::ALBroker> pBroker, std::string pName );
60
61
virtual
~ALSoundExtractor
();
62
63
virtual
std::string
version
(
void
) {
return
""
;}
64
virtual
void
startDetection
(
void
);
65
virtual
void
stopDetection
(
void
);
66
72
QI_API_DEPRECATED
void
setDebugMode
(
const
bool
&pbSetOrUnset =
true
)
73
{
74
qiLogWarning(
"audio.alsoundextractor"
,
"The call to setDebugMode() is "
75
"now deprectated. This functionnality is now handled by qi/log"
);
76
fbDebugMode
= pbSetOrUnset;
77
}
78
83
QI_API_DEPRECATED
inline
bool
getDebugMode
(
void
)
84
{
85
qiLogWarning(
"audio.alsoundextractor"
,
"The call to getDebugMode() is "
86
"now deprectated. This functionnality is now handled by qi/log"
);
87
return
fbDebugMode
;
88
}
89
90
91
virtual
void
process
(
const
int
& nbOfChannels,
92
const
int
& nbrOfSamplesByChannel,
93
const
AL_SOUND_FORMAT
* buffer,
94
const
ALValue & timestamp);
95
96
97
QI_API_DEPRECATED
virtual
void
processSound
(
const
int
nbOfChannels,
98
const
int
nbrOfSamplesByChannel,
99
const
AL_SOUND_FORMAT
* buffer);
100
101
QI_API_DEPRECATED
virtual
void
processSoundRemote
(
const
int
& nbOfChannels,
102
const
int
& nbrOfSamplesByChannel,
103
const
ALValue & buffer);
104
105
private
:
106
void
processRemote(
const
int
& nbOfChannels,
107
const
int
& nbrOfSamplesByChannel,
108
const
ALValue & timestamp,
109
const
ALValue & buffer);
110
111
void
xStartDetection(
const
int
pPeriod,
112
const
float
pPrecision)
113
{
114
startDetection
();
115
}
116
117
virtual
void
xUpdateParameters(
const
int
pPeriod,
118
const
float
pPrecision){}
119
120
void
xStopDetection(
void
)
121
{
122
stopDetection
();
123
}
124
125
virtual
std::vector<std::string> getOutputNames();
126
127
protected
:
128
129
bool
fIsRunning
;
130
bool
fbDebugMode
;
131
boost::shared_ptr<ALProxy>
audioDevice
;
132
ALValue
fNullTimestamp
;
133
};
134
135
}
136
137
#endif
AL_SOUND_FORMAT
signed short AL_SOUND_FORMAT
Definition:
alsoundextractor.h:19
alextractor.h
AL::ALSoundExtractor::processSound
virtual QI_API_DEPRECATED void processSound(const int nbOfChannels, const int nbrOfSamplesByChannel, const AL_SOUND_FORMAT *buffer)
Definition:
alsoundextractor.cpp:118
AL::ALSoundExtractor::~ALSoundExtractor
virtual ~ALSoundExtractor()
Definition:
alsoundextractor.cpp:70
AL::THIRDCHANNEL
Definition:
alsoundextractor.h:52
AL::ALLCHANNELS
Definition:
alsoundextractor.h:45
AL::ALSoundExtractor::fIsRunning
bool fIsRunning
Definition:
alsoundextractor.h:129
AL::FIRSTCHANNEL
Definition:
alsoundextractor.h:50
AL::ALSoundExtractor
Definition:
alsoundextractor.h:56
AL::ALSoundExtractor::startDetection
virtual void startDetection(void)
Definition:
alsoundextractor.cpp:75
AL::ALSoundExtractor::getDebugMode
QI_API_DEPRECATED bool getDebugMode(void)
Definition:
alsoundextractor.h:83
AL::REARCHANNEL
Definition:
alsoundextractor.h:49
AL::ALSoundExtractor::ALSoundExtractor
ALSoundExtractor(boost::shared_ptr< AL::ALBroker > pBroker, std::string pName)
Definition:
alsoundextractor.cpp:16
AL::ALSoundExtractor::fNullTimestamp
ALValue fNullTimestamp
Definition:
alsoundextractor.h:132
AL::ALSoundExtractor::setDebugMode
QI_API_DEPRECATED void setDebugMode(const bool &pbSetOrUnset=true)
Definition:
alsoundextractor.h:72
AL::AUDIOCHANNELTYPE
AUDIOCHANNELTYPE
Definition:
alsoundextractor.h:43
AL::ALSoundExtractor::fbDebugMode
bool fbDebugMode
Definition:
alsoundextractor.h:130
AL::ALSoundExtractor::process
virtual void process(const int &nbOfChannels, const int &nbrOfSamplesByChannel, const AL_SOUND_FORMAT *buffer, const ALValue ×tamp)
Definition:
alsoundextractor.cpp:106
AL::ALSoundExtractor::audioDevice
boost::shared_ptr< ALProxy > audioDevice
Definition:
alsoundextractor.h:131
AL::SECONDCHANNEL
Definition:
alsoundextractor.h:51
AL::FRONTCHANNEL
Definition:
alsoundextractor.h:48
AL::ALSoundExtractor::stopDetection
virtual void stopDetection(void)
Definition:
alsoundextractor.cpp:96
AL::ALSoundExtractor::processSoundRemote
virtual QI_API_DEPRECATED void processSoundRemote(const int &nbOfChannels, const int &nbrOfSamplesByChannel, const ALValue &buffer)
Definition:
alsoundextractor.cpp:124
AL::LEFTCHANNEL
Definition:
alsoundextractor.h:46
AL::RIGHTCHANNEL
Definition:
alsoundextractor.h:47
AL::FOURTHCHANNEL
Definition:
alsoundextractor.h:53
AL::ALExtractor
AL::ALSoundExtractor::version
virtual std::string version(void)
Definition:
alsoundextractor.h:63
Copyright Aldebaran Robotics