/// Provides the ability to directly manage the system audio input devices.
/// </summary>
/// <privilege>http://tizen.org/privilege/recorder</privilege>
+ /// <feature>http://tizen.org/feature/microphone</feature>
/// <since_tizen> 3 </since_tizen>
public abstract class AudioCaptureBase : IDisposable
{
public AudioSampleType SampleType { get; }
/// <summary>
+ /// Gets or sets the volume of the audio input data stream.
+ /// </summary>
+ /// <value>
+ /// The default value is 1.0.<br/>
+ /// The valid range is greater than or equal to 0.0 and less than or equal to 2.0.<br/>
+ /// Note that if the value is less than 0.0, it will be set 0.0 and if the value is greater than 2.0, it will be set 2.0.
+ /// </value>
+ /// <remarks>
+ /// If the value is less than 1.0, the loudness of recorded data will be decreased.<br/>
+ /// If the value is greater than 1.0, the loudness of recorded data will be increased.<br/>
+ /// Note that the volume can be clipped if the value is greater than 1.0 and the loudness of original recorded data is high enough.
+ /// </remarks>
+ /// <exception cref="ObjectDisposedException">The AudioCapture has already been disposed.</exception>
+ /// <since_tizen> 8 </since_tizen>
+ public double Volume
+ {
+ get
+ {
+ ValidateNotDisposed();
+
+ var ret = AudioInput.GetVolume(_handle, out double volume);
+ MultimediaDebug.AssertNoError((int)ret);
+
+ return volume;
+ }
+ set
+ {
+ ValidateNotDisposed();
+
+ var ret = AudioInput.SetVolume(_handle, Math.Min(Math.Max(value, 0.0), 2.0));
+ MultimediaDebug.AssertNoError((int)ret);
+ }
+ }
+
+ /// <summary>
/// Gets the size allocated for the audio input buffer.
/// </summary>
+ /// <returns>The buffer size of audio data captured.</returns>
/// <exception cref="ObjectDisposedException">The AudioCaptureBase has already been disposed of.</exception>
/// <since_tizen> 3 </since_tizen>
public int GetBufferSize()
/// Provides the ability to record audio from system audio input devices in a synchronous way.
/// </summary>
/// <privilege>http://tizen.org/privilege/recorder</privilege>
+ /// <feature>http://tizen.org/feature/microphone</feature>
/// <since_tizen> 3 </since_tizen>
public class AudioCapture : AudioCaptureBase
{
/// Provides the ability to record audio from system audio input devices in an asynchronous way.
/// </summary>
/// <privilege>http://tizen.org/privilege/recorder</privilege>
+ /// <feature>http://tizen.org/feature/microphone</feature>
/// <since_tizen> 3 </since_tizen>
public class AsyncAudioCapture : AudioCaptureBase
{
[DllImport(Libraries.AudioIO, EntryPoint = "audio_in_read")]
internal static extern AudioIOError Read(IntPtr handle, byte[] buffer, int length);
+ [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_peek")]
+ internal static extern AudioIOError Peek(IntPtr handle, out IntPtr buffer, ref uint length);
+
+ [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_drop")]
+ internal static extern AudioIOError Drop(IntPtr handle);
+
[DllImport(Libraries.AudioIO, EntryPoint = "audio_in_get_buffer_size")]
internal static extern AudioIOError GetBufferSize(IntPtr handle, out int size);
[DllImport(Libraries.AudioIO, EntryPoint = "audio_in_get_sample_type")]
internal static extern AudioIOError GetSampleType(IntPtr handle, out int sampleType);
- [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_peek")]
- internal static extern AudioIOError Peek(IntPtr handle, out IntPtr buffer, ref uint length);
+ [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_get_volume")]
+ internal static extern AudioIOError GetVolume(IntPtr handle, out double volume);
- [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_drop")]
- internal static extern AudioIOError Drop(IntPtr handle);
+ [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_set_volume")]
+ internal static extern AudioIOError SetVolume(IntPtr handle, double volume);
}
internal static partial class AudioOutput
{