Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
c81ec6f2
Commit
c81ec6f2
authored
Jul 09, 2019
by
Saracen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Exposes capture methods to AudioServer, variable renames for consistency,
added documentation.
parent
e6230a36
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
146 additions
and
72 deletions
+146
-72
AudioServer.xml
doc/classes/AudioServer.xml
+41
-2
audio_driver_coreaudio.cpp
drivers/coreaudio/audio_driver_coreaudio.cpp
+7
-7
audio_driver_pulseaudio.cpp
drivers/pulseaudio/audio_driver_pulseaudio.cpp
+10
-10
audio_driver_wasapi.cpp
drivers/wasapi/audio_driver_wasapi.cpp
+5
-5
audio_driver_opensl.cpp
platform/android/audio_driver_opensl.cpp
+3
-3
audio_stream.cpp
servers/audio/audio_stream.cpp
+21
-21
audio_stream.h
servers/audio/audio_stream.h
+1
-1
audio_server.cpp
servers/audio_server.cpp
+43
-15
audio_server.h
servers/audio_server.h
+15
-8
No files found.
doc/classes/AudioServer.xml
View file @
c81ec6f2
...
...
@@ -42,6 +42,7 @@
<return
type=
"Array"
>
</return>
<description>
Returns the names of all audio input devices detected on the system.
</description>
</method>
<method
name=
"capture_set_device"
>
...
...
@@ -52,6 +53,20 @@
<description>
</description>
</method>
<method
name=
"capture_start"
>
<return
type=
"int"
enum=
"Error"
>
</return>
<description>
Attempts to start recording from the audio driver's capture device. On success, the return value is [constant OK].
</description>
</method>
<method
name=
"capture_stop"
>
<return
type=
"int"
enum=
"Error"
>
</return>
<description>
Attempts to stop recording from the audio driver's capture device. On success, the return value is [constant OK].
</description>
</method>
<method
name=
"generate_bus_layout"
qualifiers=
"const"
>
<return
type=
"AudioBusLayout"
>
</return>
...
...
@@ -158,11 +173,32 @@
Returns the volume of the bus at index [code]bus_idx[/code] in dB.
</description>
</method>
<method
name=
"get_capture_buffer"
>
<return
type=
"PoolIntArray"
>
</return>
<description>
Returns an [PoolIntArray] containing audio frames from the capture device.
</description>
</method>
<method
name=
"get_capture_position"
>
<return
type=
"int"
>
</return>
<description>
Returns the write position of the capture device buffer.
</description>
</method>
<method
name=
"get_capture_size"
>
<return
type=
"int"
>
</return>
<description>
Returns the size of the capture device buffer.
</description>
</method>
<method
name=
"get_device_list"
>
<return
type=
"Array"
>
</return>
<description>
Returns the names of all audio devices detected on the system.
Returns the names of all audio
output
devices detected on the system.
</description>
</method>
<method
name=
"get_mix_rate"
qualifiers=
"const"
>
...
...
@@ -388,7 +424,10 @@
Number of available audio buses.
</member>
<member
name=
"device"
type=
"String"
setter=
"set_device"
getter=
"get_device"
default=
""Default""
>
Name of the current device (see [method get_device_list]).
Name of the current device for audio output (see [method get_device_list]).
</member>
<member
name=
"capture_device"
type=
"String"
setter=
"capture_set_device"
getter=
"capture_get_device"
default=
""Default""
>
Name of the current device for audio input (see [method capture_get_device_list]).
</member>
<member
name=
"global_rate_scale"
type=
"float"
setter=
"set_global_rate_scale"
getter=
"get_global_rate_scale"
default=
"1.0"
>
Scales the rate at which audio is played (i.e. setting it to [code]0.5[/code] will make the audio be played twice as fast).
...
...
drivers/coreaudio/audio_driver_coreaudio.cpp
View file @
c81ec6f2
...
...
@@ -233,11 +233,11 @@ OSStatus AudioDriverCoreAudio::input_callback(void *inRefCon,
if
(
result
==
noErr
)
{
for
(
int
i
=
0
;
i
<
inNumberFrames
*
ad
->
capture_channels
;
i
++
)
{
int32_t
sample
=
ad
->
input_buf
[
i
]
<<
16
;
ad
->
input
_buffer_write
(
sample
);
ad
->
capture
_buffer_write
(
sample
);
if
(
ad
->
capture_channels
==
1
)
{
// In case
input
device is single channel convert it to Stereo
ad
->
input
_buffer_write
(
sample
);
// In case
capture
device is single channel convert it to Stereo
ad
->
capture
_buffer_write
(
sample
);
}
}
}
else
{
...
...
@@ -487,7 +487,7 @@ void AudioDriverCoreAudio::capture_finish() {
Error
AudioDriverCoreAudio
::
capture_start
()
{
input
_buffer_init
(
buffer_frames
);
capture
_buffer_init
(
buffer_frames
);
OSStatus
result
=
AudioOutputUnitStart
(
input_unit
);
if
(
result
!=
noErr
)
{
...
...
@@ -642,9 +642,9 @@ void AudioDriverCoreAudio::_set_device(const String &device, bool capture) {
ERR_FAIL_COND
(
result
!=
noErr
);
if
(
capture
)
{
// Reset audio
input
to keep synchronisation.
input
_position
=
0
;
input
_size
=
0
;
// Reset audio
capture
to keep synchronisation.
capture
_position
=
0
;
capture
_size
=
0
;
}
}
}
...
...
drivers/pulseaudio/audio_driver_pulseaudio.cpp
View file @
c81ec6f2
...
...
@@ -227,8 +227,8 @@ Error AudioDriverPulseAudio::init_device() {
samples_out
.
resize
(
pa_buffer_size
);
// Reset audio input to keep synchronisation.
input
_position
=
0
;
input
_size
=
0
;
capture
_position
=
0
;
capture
_size
=
0
;
return
OK
;
}
...
...
@@ -460,7 +460,7 @@ void AudioDriverPulseAudio::thread_func(void *p_udata) {
size_t
bytes
=
pa_stream_readable_size
(
ad
->
pa_rec_str
);
if
(
bytes
>
0
)
{
const
void
*
ptr
=
NULL
;
size_t
maxbytes
=
ad
->
input
_buffer
.
size
()
*
sizeof
(
int16_t
);
size_t
maxbytes
=
ad
->
capture
_buffer
.
size
()
*
sizeof
(
int16_t
);
bytes
=
MIN
(
bytes
,
maxbytes
);
ret
=
pa_stream_peek
(
ad
->
pa_rec_str
,
&
ptr
,
&
bytes
);
...
...
@@ -470,11 +470,11 @@ void AudioDriverPulseAudio::thread_func(void *p_udata) {
int16_t
*
srcptr
=
(
int16_t
*
)
ptr
;
for
(
size_t
i
=
bytes
>>
1
;
i
>
0
;
i
--
)
{
int32_t
sample
=
int32_t
(
*
srcptr
++
)
<<
16
;
ad
->
input
_buffer_write
(
sample
);
ad
->
capture
_buffer_write
(
sample
);
if
(
ad
->
pa_rec_map
.
channels
==
1
)
{
// In case
input
device is single channel convert it to Stereo
ad
->
input
_buffer_write
(
sample
);
// In case
capture
device is single channel convert it to Stereo
ad
->
capture
_buffer_write
(
sample
);
}
}
...
...
@@ -661,7 +661,7 @@ Error AudioDriverPulseAudio::capture_init_device() {
break
;
default
:
WARN_PRINTS
(
"PulseAudio: Unsupported number of
input
channels: "
+
itos
(
pa_rec_map
.
channels
));
WARN_PRINTS
(
"PulseAudio: Unsupported number of
capture
channels: "
+
itos
(
pa_rec_map
.
channels
));
pa_channel_map_init_stereo
(
&
pa_rec_map
);
break
;
}
...
...
@@ -693,10 +693,10 @@ Error AudioDriverPulseAudio::capture_init_device() {
ERR_FAIL_V
(
ERR_CANT_OPEN
);
}
input
_buffer_init
(
input_buffer_frames
);
capture
_buffer_init
(
input_buffer_frames
);
print_verbose
(
"PulseAudio: detected "
+
itos
(
pa_rec_map
.
channels
)
+
"
input
channels"
);
print_verbose
(
"PulseAudio:
input
buffer frames: "
+
itos
(
input_buffer_frames
)
+
" calculated latency: "
+
itos
(
input_buffer_frames
*
1000
/
mix_rate
)
+
"ms"
);
print_verbose
(
"PulseAudio: detected "
+
itos
(
pa_rec_map
.
channels
)
+
"
capture
channels"
);
print_verbose
(
"PulseAudio:
capture
buffer frames: "
+
itos
(
input_buffer_frames
)
+
" calculated latency: "
+
itos
(
input_buffer_frames
*
1000
/
mix_rate
)
+
"ms"
);
return
OK
;
}
...
...
drivers/wasapi/audio_driver_wasapi.cpp
View file @
c81ec6f2
...
...
@@ -343,8 +343,8 @@ Error AudioDriverWASAPI::init_render_device(bool reinit) {
// Sample rate is independent of channels (ref: https://stackoverflow.com/questions/11048825/audio-sample-frequency-rely-on-channels)
samples_in
.
resize
(
buffer_frames
*
channels
);
input
_position
=
0
;
input
_size
=
0
;
capture
_position
=
0
;
capture
_size
=
0
;
print_verbose
(
"WASAPI: detected "
+
itos
(
channels
)
+
" channels"
);
print_verbose
(
"WASAPI: audio buffer frames: "
+
itos
(
buffer_frames
)
+
" calculated latency: "
+
itos
(
buffer_frames
*
1000
/
mix_rate
)
+
"ms"
);
...
...
@@ -363,7 +363,7 @@ Error AudioDriverWASAPI::init_capture_device(bool reinit) {
HRESULT
hr
=
audio_input
.
audio_client
->
GetBufferSize
(
&
max_frames
);
ERR_FAIL_COND_V
(
hr
!=
S_OK
,
ERR_CANT_OPEN
);
input
_buffer_init
(
max_frames
);
capture
_buffer_init
(
max_frames
);
return
OK
;
}
...
...
@@ -716,8 +716,8 @@ void AudioDriverWASAPI::thread_func(void *p_udata) {
}
}
ad
->
input
_buffer_write
(
l
);
ad
->
input
_buffer_write
(
r
);
ad
->
capture
_buffer_write
(
l
);
ad
->
capture
_buffer_write
(
r
);
}
read_frames
+=
num_frames_available
;
...
...
platform/android/audio_driver_opensl.cpp
View file @
c81ec6f2
...
...
@@ -215,8 +215,8 @@ void AudioDriverOpenSL::_record_buffer_callback(SLAndroidSimpleBufferQueueItf qu
for
(
int
i
=
0
;
i
<
rec_buffer
.
size
();
i
++
)
{
int32_t
sample
=
rec_buffer
[
i
]
<<
16
;
input
_buffer_write
(
sample
);
input
_buffer_write
(
sample
);
// call twice to convert to Stereo
capture
_buffer_write
(
sample
);
capture
_buffer_write
(
sample
);
// call twice to convert to Stereo
}
SLresult
res
=
(
*
recordBufferQueueItf
)
->
Enqueue
(
recordBufferQueueItf
,
rec_buffer
.
ptrw
(),
rec_buffer
.
size
()
*
sizeof
(
int16_t
));
...
...
@@ -287,7 +287,7 @@ Error AudioDriverOpenSL::capture_init_device() {
const
int
rec_buffer_frames
=
2048
;
rec_buffer
.
resize
(
rec_buffer_frames
);
input
_buffer_init
(
rec_buffer_frames
);
capture
_buffer_init
(
rec_buffer_frames
);
res
=
(
*
recordBufferQueueItf
)
->
Enqueue
(
recordBufferQueueItf
,
rec_buffer
.
ptrw
(),
rec_buffer
.
size
()
*
sizeof
(
int16_t
));
ERR_FAIL_COND_V
(
res
!=
SL_RESULT_SUCCESS
,
ERR_CANT_OPEN
);
...
...
servers/audio/audio_stream.cpp
View file @
c81ec6f2
...
...
@@ -134,31 +134,31 @@ AudioStreamMicrophone::AudioStreamMicrophone() {
void
AudioStreamPlaybackMicrophone
::
_mix_internal
(
AudioFrame
*
p_buffer
,
int
p_frames
)
{
Audio
Dri
ver
::
get_singleton
()
->
lock
();
Audio
Ser
ver
::
get_singleton
()
->
lock
();
Vector
<
int32_t
>
buf
=
AudioDriver
::
get_singleton
()
->
get_input
_buffer
();
unsigned
int
input_size
=
AudioDriver
::
get_singleton
()
->
get_input
_size
();
int
mix_rate
=
Audio
Dri
ver
::
get_singleton
()
->
get_mix_rate
();
unsigned
int
playback_delay
=
MIN
(((
50
*
mix_rate
)
/
1000
)
*
2
,
buf
.
size
()
>>
1
);
PoolVector
<
int32_t
>
capture_buffer
=
AudioServer
::
get_singleton
()
->
get_capture
_buffer
();
unsigned
int
capture_size
=
AudioServer
::
get_singleton
()
->
get_capture
_size
();
int
mix_rate
=
Audio
Ser
ver
::
get_singleton
()
->
get_mix_rate
();
unsigned
int
playback_delay
=
MIN
(((
50
*
mix_rate
)
/
1000
)
*
2
,
capture_buffer
.
size
()
>>
1
);
#ifdef DEBUG_ENABLED
unsigned
int
input_position
=
AudioDriver
::
get_singleton
()
->
get_input
_position
();
unsigned
int
capture_position
=
AudioServer
::
get_singleton
()
->
get_capture
_position
();
#endif
if
(
playback_delay
>
input
_size
)
{
if
(
playback_delay
>
capture
_size
)
{
for
(
int
i
=
0
;
i
<
p_frames
;
i
++
)
{
p_buffer
[
i
]
=
AudioFrame
(
0.0
f
,
0.0
f
);
}
input
_ofs
=
0
;
capture
_ofs
=
0
;
}
else
{
for
(
int
i
=
0
;
i
<
p_frames
;
i
++
)
{
if
(
input_size
>
input_ofs
&&
(
int
)
input_ofs
<
buf
.
size
())
{
float
l
=
(
buf
[
input
_ofs
++
]
>>
16
)
/
32768.
f
;
if
((
int
)
input_ofs
>=
buf
.
size
())
{
input
_ofs
=
0
;
if
(
capture_size
>
capture_ofs
&&
(
int
)
capture_ofs
<
capture_buffer
.
size
())
{
float
l
=
(
capture_buffer
[
capture
_ofs
++
]
>>
16
)
/
32768.
f
;
if
((
int
)
capture_ofs
>=
capture_buffer
.
size
())
{
capture
_ofs
=
0
;
}
float
r
=
(
buf
[
input
_ofs
++
]
>>
16
)
/
32768.
f
;
if
((
int
)
input_ofs
>=
buf
.
size
())
{
input
_ofs
=
0
;
float
r
=
(
capture_buffer
[
capture
_ofs
++
]
>>
16
)
/
32768.
f
;
if
((
int
)
capture_ofs
>=
capture_buffer
.
size
())
{
capture
_ofs
=
0
;
}
p_buffer
[
i
]
=
AudioFrame
(
l
,
r
);
...
...
@@ -169,12 +169,12 @@ void AudioStreamPlaybackMicrophone::_mix_internal(AudioFrame *p_buffer, int p_fr
}
#ifdef DEBUG_ENABLED
if
(
input_ofs
>
input_position
&&
(
int
)(
input_ofs
-
input
_position
)
<
(
p_frames
*
2
))
{
print_verbose
(
String
(
get_class_name
())
+
" buffer underrun:
input_position="
+
itos
(
input_position
)
+
" input_ofs="
+
itos
(
input_ofs
)
+
" input_size="
+
itos
(
input
_size
));
if
(
capture_ofs
>
capture_position
&&
(
int
)(
capture_ofs
-
capture
_position
)
<
(
p_frames
*
2
))
{
print_verbose
(
String
(
get_class_name
())
+
" buffer underrun:
capture_position="
+
itos
(
capture_position
)
+
" capture_ofs="
+
itos
(
capture_ofs
)
+
" capture_size="
+
itos
(
capture
_size
));
}
#endif
Audio
Dri
ver
::
get_singleton
()
->
unlock
();
Audio
Ser
ver
::
get_singleton
()
->
unlock
();
}
void
AudioStreamPlaybackMicrophone
::
mix
(
AudioFrame
*
p_buffer
,
float
p_rate_scale
,
int
p_frames
)
{
...
...
@@ -196,9 +196,9 @@ void AudioStreamPlaybackMicrophone::start(float p_from_pos) {
return
;
}
input
_ofs
=
0
;
capture
_ofs
=
0
;
if
(
Audio
Dri
ver
::
get_singleton
()
->
capture_start
()
==
OK
)
{
if
(
Audio
Ser
ver
::
get_singleton
()
->
capture_start
()
==
OK
)
{
active
=
true
;
_begin_resample
();
}
...
...
@@ -206,7 +206,7 @@ void AudioStreamPlaybackMicrophone::start(float p_from_pos) {
void
AudioStreamPlaybackMicrophone
::
stop
()
{
if
(
active
)
{
Audio
Dri
ver
::
get_singleton
()
->
capture_stop
();
Audio
Ser
ver
::
get_singleton
()
->
capture_stop
();
active
=
false
;
}
}
...
...
servers/audio/audio_stream.h
View file @
c81ec6f2
...
...
@@ -123,7 +123,7 @@ class AudioStreamPlaybackMicrophone : public AudioStreamPlaybackResampled {
friend
class
AudioStreamMicrophone
;
bool
active
;
unsigned
int
input
_ofs
;
unsigned
int
capture
_ofs
;
Ref
<
AudioStreamMicrophone
>
microphone
;
...
...
servers/audio_server.cpp
View file @
c81ec6f2
...
...
@@ -85,26 +85,26 @@ double AudioDriver::get_time_to_next_mix() const {
return
mix_buffer
-
total
;
}
void
AudioDriver
::
input
_buffer_init
(
int
driver_buffer_frames
)
{
void
AudioDriver
::
capture
_buffer_init
(
int
driver_buffer_frames
)
{
const
int
input
_buffer_channels
=
2
;
input_buffer
.
resize
(
driver_buffer_frames
*
input
_buffer_channels
*
4
);
input
_position
=
0
;
input
_size
=
0
;
const
int
capture
_buffer_channels
=
2
;
capture_buffer
.
resize
(
driver_buffer_frames
*
capture
_buffer_channels
*
4
);
capture
_position
=
0
;
capture
_size
=
0
;
}
void
AudioDriver
::
input
_buffer_write
(
int32_t
sample
)
{
void
AudioDriver
::
capture
_buffer_write
(
int32_t
sample
)
{
if
((
int
)
input_position
<
input
_buffer
.
size
())
{
input_buffer
.
write
[
input
_position
++
]
=
sample
;
if
((
int
)
input_position
>=
input
_buffer
.
size
())
{
input
_position
=
0
;
if
((
int
)
capture_position
<
capture
_buffer
.
size
())
{
capture_buffer
.
write
()[
capture
_position
++
]
=
sample
;
if
((
int
)
capture_position
>=
capture
_buffer
.
size
())
{
capture
_position
=
0
;
}
if
((
int
)
input_size
<
input
_buffer
.
size
())
{
input
_size
++
;
if
((
int
)
capture_size
<
capture
_buffer
.
size
())
{
capture
_size
++
;
}
}
else
{
WARN_PRINTS
(
"
input_buffer_write: Invalid input_position="
+
itos
(
input_position
)
+
" input_buffer.size()="
+
itos
(
input
_buffer
.
size
()));
WARN_PRINTS
(
"
capture_buffer_write: Invalid capture_position="
+
itos
(
capture_position
)
+
" capture_buffer.size()="
+
itos
(
capture
_buffer
.
size
()));
}
}
...
...
@@ -154,8 +154,8 @@ AudioDriver::AudioDriver() {
_last_mix_time
=
0
;
_last_mix_frames
=
0
;
input
_position
=
0
;
input
_size
=
0
;
capture
_position
=
0
;
capture
_size
=
0
;
#ifdef DEBUG_ENABLED
prof_time
=
0
;
...
...
@@ -1302,6 +1302,14 @@ void AudioServer::set_device(String device) {
AudioDriver
::
get_singleton
()
->
set_device
(
device
);
}
Error
AudioServer
::
capture_start
()
{
return
AudioDriver
::
get_singleton
()
->
capture_start
();
}
Error
AudioServer
::
capture_stop
()
{
return
AudioDriver
::
get_singleton
()
->
capture_stop
();
}
Array
AudioServer
::
capture_get_device_list
()
{
return
AudioDriver
::
get_singleton
()
->
capture_get_device_list
();
...
...
@@ -1317,6 +1325,18 @@ void AudioServer::capture_set_device(const String &p_name) {
AudioDriver
::
get_singleton
()
->
capture_set_device
(
p_name
);
}
PoolVector
<
int32_t
>
AudioServer
::
get_capture_buffer
()
{
return
AudioDriver
::
get_singleton
()
->
get_capture_buffer
();
}
unsigned
int
AudioServer
::
get_capture_position
()
{
return
AudioDriver
::
get_singleton
()
->
get_capture_position
();
}
unsigned
int
AudioServer
::
get_capture_size
()
{
return
AudioDriver
::
get_singleton
()
->
get_capture_size
();
}
void
AudioServer
::
_bind_methods
()
{
ClassDB
::
bind_method
(
D_METHOD
(
"set_bus_count"
,
"amount"
),
&
AudioServer
::
set_bus_count
);
...
...
@@ -1377,15 +1397,23 @@ void AudioServer::_bind_methods() {
ClassDB
::
bind_method
(
D_METHOD
(
"get_time_since_last_mix"
),
&
AudioServer
::
get_time_since_last_mix
);
ClassDB
::
bind_method
(
D_METHOD
(
"get_output_latency"
),
&
AudioServer
::
get_output_latency
);
ClassDB
::
bind_method
(
D_METHOD
(
"capture_start"
),
&
AudioServer
::
capture_start
);
ClassDB
::
bind_method
(
D_METHOD
(
"capture_stop"
),
&
AudioServer
::
capture_stop
);
ClassDB
::
bind_method
(
D_METHOD
(
"capture_get_device_list"
),
&
AudioServer
::
capture_get_device_list
);
ClassDB
::
bind_method
(
D_METHOD
(
"capture_get_device"
),
&
AudioServer
::
capture_get_device
);
ClassDB
::
bind_method
(
D_METHOD
(
"capture_set_device"
,
"name"
),
&
AudioServer
::
capture_set_device
);
ClassDB
::
bind_method
(
D_METHOD
(
"get_capture_buffer"
),
&
AudioServer
::
get_capture_buffer
);
ClassDB
::
bind_method
(
D_METHOD
(
"get_capture_position"
),
&
AudioServer
::
get_capture_position
);
ClassDB
::
bind_method
(
D_METHOD
(
"get_capture_size"
),
&
AudioServer
::
get_capture_size
);
ClassDB
::
bind_method
(
D_METHOD
(
"set_bus_layout"
,
"bus_layout"
),
&
AudioServer
::
set_bus_layout
);
ClassDB
::
bind_method
(
D_METHOD
(
"generate_bus_layout"
),
&
AudioServer
::
generate_bus_layout
);
ADD_PROPERTY
(
PropertyInfo
(
Variant
::
INT
,
"bus_count"
),
"set_bus_count"
,
"get_bus_count"
);
ADD_PROPERTY
(
PropertyInfo
(
Variant
::
STRING
,
"device"
),
"set_device"
,
"get_device"
);
ADD_PROPERTY
(
PropertyInfo
(
Variant
::
STRING
,
"capture_device"
),
"capture_set_device"
,
"capture_get_device"
);
ADD_PROPERTY
(
PropertyInfo
(
Variant
::
REAL
,
"global_rate_scale"
),
"set_global_rate_scale"
,
"get_global_rate_scale"
);
ADD_SIGNAL
(
MethodInfo
(
"bus_layout_changed"
));
...
...
servers/audio_server.h
View file @
c81ec6f2
...
...
@@ -53,14 +53,14 @@ class AudioDriver {
#endif
protected
:
Vector
<
int32_t
>
input
_buffer
;
unsigned
int
input
_position
;
unsigned
int
input
_size
;
PoolVector
<
int32_t
>
capture
_buffer
;
unsigned
int
capture
_position
;
unsigned
int
capture
_size
;
void
audio_server_process
(
int
p_frames
,
int32_t
*
p_buffer
,
bool
p_update_mix_time
=
true
);
void
update_mix_time
(
int
p_frames
);
void
input
_buffer_init
(
int
driver_buffer_frames
);
void
input
_buffer_write
(
int32_t
sample
);
void
capture
_buffer_init
(
int
driver_buffer_frames
);
void
capture
_buffer_write
(
int32_t
sample
);
#ifdef DEBUG_ENABLED
_FORCE_INLINE_
void
start_counting_ticks
()
{
prof_ticks
=
OS
::
get_singleton
()
->
get_ticks_usec
();
}
...
...
@@ -111,9 +111,9 @@ public:
SpeakerMode
get_speaker_mode_by_total_channels
(
int
p_channels
)
const
;
int
get_total_channels_by_speaker_mode
(
SpeakerMode
)
const
;
Vector
<
int32_t
>
get_input_buffer
()
{
return
input
_buffer
;
}
unsigned
int
get_
input_position
()
{
return
input
_position
;
}
unsigned
int
get_
input_size
()
{
return
input
_size
;
}
PoolVector
<
int32_t
>
get_capture_buffer
()
{
return
capture
_buffer
;
}
unsigned
int
get_
capture_position
()
{
return
capture
_position
;
}
unsigned
int
get_
capture_size
()
{
return
capture
_size
;
}
#ifdef DEBUG_ENABLED
uint64_t
get_profiling_time
()
const
{
return
prof_time
;
}
...
...
@@ -384,10 +384,17 @@ public:
String
get_device
();
void
set_device
(
String
device
);
Error
capture_start
();
Error
capture_stop
();
Array
capture_get_device_list
();
String
capture_get_device
();
void
capture_set_device
(
const
String
&
p_name
);
PoolVector
<
int32_t
>
get_capture_buffer
();
unsigned
int
get_capture_position
();
unsigned
int
get_capture_size
();
AudioServer
();
virtual
~
AudioServer
();
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment