* [Multimedia] Code cleaning of AudioIO.
Channel = channel;
SampleType = sampleType;
- AudioIOUtil.ThrowIfError(
- AudioInput.Create(SampleRate, (int)Channel, (int)SampleType, out _handle));
+ AudioInput.Create(SampleRate, (int)Channel, (int)SampleType, out _handle)
+ .ThrowIfFailed("Failed to create audio capture instance.");
RegisterStateChangedCallback();
}
new AudioIOStateChangedEventArgs((AudioIOState)previous, _state, byPolicy));
};
- AudioIOUtil.ThrowIfError(
- AudioInput.SetStateChangedCallback(_handle, _stateChangedCallback, IntPtr.Zero));
+ AudioInput.SetStateChangedCallback(_handle, _stateChangedCallback, IntPtr.Zero)
+ .ThrowIfFailed("Failed to set state changed callback.");
}
#region Dispose support
{
ValidateNotDisposed();
- AudioIOUtil.ThrowIfError(AudioInput.GetBufferSize(_handle, out var size));
+ AudioInput.GetBufferSize(_handle, out var size)
+ .ThrowIfFailed("Failed to get buffer size.");
+
return size;
}
{
ValidateState(AudioIOState.Idle);
- AudioIOUtil.ThrowIfError(AudioInput.Prepare(_handle),
- "Failed to prepare the AudioCapture");
+ AudioInput.Prepare(_handle).ThrowIfFailed("Failed to prepare the AudioCapture");
}
/// <summary>
{
ValidateState(AudioIOState.Running, AudioIOState.Paused);
- AudioIOUtil.ThrowIfError(AudioInput.Unprepare(_handle),
- "Failed to unprepare the AudioCapture");
+ AudioInput.Unprepare(_handle).ThrowIfFailed("Failed to unprepare the AudioCapture");
}
/// <summary>
}
ValidateState(AudioIOState.Running);
- AudioIOUtil.ThrowIfError(AudioInput.Pause(_handle));
+ AudioInput.Pause(_handle).ThrowIfFailed("Failed to pause.");
}
/// <summary>
/// Resumes buffering audio data from the device.
}
ValidateState(AudioIOState.Paused);
- AudioIOUtil.ThrowIfError(AudioInput.Resume(_handle));
+ AudioInput.Resume(_handle).ThrowIfFailed("Failed to resume.");
}
/// <summary>
{
ValidateState(AudioIOState.Running, AudioIOState.Paused);
- int ret = AudioInput.Flush(_handle);
-
- MultimediaDebug.AssertNoError(ret);
+ var ret = AudioInput.Flush(_handle);
+ MultimediaDebug.AssertNoError((int)ret);
}
/// <summary>
ValidateNotDisposed();
- AudioIOUtil.ThrowIfError(AudioInput.SetStreamInfo(_handle, streamPolicy.Handle));
+ AudioInput.SetStreamInfo(_handle, streamPolicy.Handle)
+ .ThrowIfFailed("Failed to apply stream policy.");
}
}
byte[] buffer = new byte[count];
- AudioIOUtil.ThrowIfError(AudioInput.Read(_handle, buffer, count),
- "Failed to read");
+ AudioInput.Read(_handle, buffer, count).ThrowIfFailed("Failed to read.");
return buffer;
}
{
_streamCallback = (IntPtr handle, uint length, IntPtr _) => { OnInputDataAvailable(handle, length); };
- AudioIOUtil.ThrowIfError(
- AudioInput.SetStreamCallback(_handle, _streamCallback, IntPtr.Zero),
- $"Failed to initialize a { nameof(AsyncAudioCapture) }");
+ AudioInput.SetStreamCallback(_handle, _streamCallback, IntPtr.Zero)
+ .ThrowIfFailed("Failed to create instance.");
}
private AudioStreamCallback _streamCallback;
return;
}
- IntPtr ptr = IntPtr.Zero;
try
{
- AudioIOUtil.ThrowIfError(AudioInput.Peek(_handle, out ptr, ref length));
+ AudioInput.Peek(_handle, out IntPtr ptr, ref length).ThrowIfFailed("Failed to peek.");
byte[] buffer = new byte[length];
Marshal.Copy(ptr, buffer, 0, (int)length);
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Tizen.Multimedia
+{
+ /// <summary>
+ /// Specifies the audio channels.
+ /// </summary>
+ /// <seealso cref="AudioCapture"/>
+ /// <seealso cref="AsyncAudioCapture"/>
+ /// <seealso cref="AudioPlayback"/>
+ /// <since_tizen> 3 </since_tizen>
+ public enum AudioChannel
+ {
+ /// <summary>
+ /// Mono.
+ /// </summary>
+ Mono = 0x80,
+ /// <summary>
+ /// Stereo.
+ /// </summary>
+ Stereo
+ }
+}
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an AS IS BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-using Tizen.Internals.Errors;
-
-namespace Tizen.Multimedia
-{
- /// <summary>
- /// Specifies the audio channels.
- /// </summary>
- /// <seealso cref="AudioCapture"/>
- /// <seealso cref="AsyncAudioCapture"/>
- /// <seealso cref="AudioPlayback"/>
- /// <since_tizen> 3 </since_tizen>
- public enum AudioChannel
- {
- /// <summary>
- /// Mono.
- /// </summary>
- Mono = 0x80,
- /// <summary>
- /// Stereo.
- /// </summary>
- Stereo
- }
-
- internal enum AudioIOError
- {
- None = ErrorCode.None,
- OutOfMemory = ErrorCode.OutOfMemory,
- InvalidParameter = ErrorCode.InvalidParameter,
- InvalidOperation = ErrorCode.InvalidOperation,
- PermissionDenied = ErrorCode.PermissionDenied, //Device open error by security
- NotSupported = ErrorCode.NotSupported, //Not supported
- DevicePolicyRestriction = (-2147483648 / 2) + 4,
- DeviceNotOpened = -0x01900000 | 0x01,
- DeviceNotClosed = -0x01900000 | 0x02,
- InvalidBuffer = -0x01900000 | 0x03,
- SoundPolicy = -0x01900000 | 0x04,
- InvalidState = -0x01900000 | 0x05,
- NotSupportedType = -0x01900000 | 0x06,
- }
-
- /// <summary>
- /// Specifies the states for the <see cref="AudioPlayback"/>, <see cref="AudioCapture"/>, and <see cref="AsyncAudioCapture"/>.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public enum AudioIOState
- {
- /// <summary>
- /// Not prepared.
- /// </summary>
- Idle = 0,
-
- /// <summary>
- /// The stream is running.
- /// </summary>
- Running = 1,
-
- /// <summary>
- /// The stream is paused.
- /// </summary>
- Paused = 2
- }
-
- /// <summary>
- /// Specifies the audio sample types.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public enum AudioSampleType
- {
- /// <summary>
- /// Unsigned 8-bit audio samples.
- /// </summary>
- U8 = 0x70,
- /// <summary>
- /// Signed 16-bit audio samples.
- /// </summary>
- S16Le,
- /// <summary>
- /// Signed 24-bit audio samples.
- /// </summary>
- /// <since_tizen> 5 </since_tizen>
- S24Le,
- /// <summary>
- /// Signed 24-bit (packed in 32-bit) audio samples.
- /// </summary>
- /// <since_tizen> 5 </since_tizen>
- S24LePacked
- }
-}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using Tizen.Internals.Errors;
+
+namespace Tizen.Multimedia
+{
+ internal enum AudioIOError
+ {
+ None = ErrorCode.None,
+ OutOfMemory = ErrorCode.OutOfMemory,
+ InvalidParameter = ErrorCode.InvalidParameter,
+ InvalidOperation = ErrorCode.InvalidOperation,
+ PermissionDenied = ErrorCode.PermissionDenied, //Device open error by security
+ NotSupported = ErrorCode.NotSupported, //Not supported
+ DevicePolicyRestriction = (-2147483648 / 2) + 4,
+ DeviceNotOpened = -0x01900000 | 0x01,
+ DeviceNotClosed = -0x01900000 | 0x02,
+ InvalidBuffer = -0x01900000 | 0x03,
+ SoundPolicy = -0x01900000 | 0x04,
+ InvalidState = -0x01900000 | 0x05,
+ NotSupportedType = -0x01900000 | 0x06,
+ }
+
+ internal static class AudioIOErrorCodeExtensions
+ {
+ internal static void ThrowIfFailed(this AudioIOError errorCode, string message)
+ {
+ if (errorCode == AudioIOError.None || !Enum.IsDefined(typeof(AudioIOError), errorCode))
+ {
+ return;
+ }
+
+ string errorMessage = $"{ (message ?? "Operation failed") } : { errorCode.ToString() }.";
+
+ switch(errorCode)
+ {
+ case AudioIOError.OutOfMemory:
+ case AudioIOError.InvalidParameter:
+ throw new ArgumentException(errorMessage);
+
+ case AudioIOError.DevicePolicyRestriction:
+ case AudioIOError.PermissionDenied:
+ throw new UnauthorizedAccessException(errorMessage);
+
+ case AudioIOError.SoundPolicy:
+ throw new AudioPolicyException(errorMessage);
+
+ case AudioIOError.NotSupported:
+ case AudioIOError.NotSupportedType:
+ throw new NotSupportedException(errorMessage);
+
+ case AudioIOError.DeviceNotOpened:
+ case AudioIOError.DeviceNotClosed:
+ case AudioIOError.InvalidBuffer:
+ case AudioIOError.InvalidOperation:
+ case AudioIOError.InvalidState:
+ throw new InvalidOperationException(errorMessage);
+
+ default:
+ throw new InvalidOperationException($"{message} : Unknown error({errorCode.ToString()}).");
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Tizen.Multimedia
+{
+ /// <summary>
+ /// Specifies the states for the <see cref="AudioPlayback"/>, <see cref="AudioCapture"/>, and <see cref="AsyncAudioCapture"/>.
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ public enum AudioIOState
+ {
+ /// <summary>
+ /// Not prepared.
+ /// </summary>
+ Idle = 0,
+
+ /// <summary>
+ /// The stream is running.
+ /// </summary>
+ Running = 1,
+
+ /// <summary>
+ /// The stream is paused.
+ /// </summary>
+ Paused = 2
+ }
+}
{
internal static class AudioIOUtil
{
- internal static void ThrowIfError(int errorCode, string msg = null)
- {
- if (errorCode >= 0)
- {
- Log.Info(nameof(AudioIOUtil), "No error.");
- return;
- }
-
- AudioIOError code = (AudioIOError)errorCode;
-
- msg = $"{(msg == null ? "" : msg + " : ")}{ code }";
-
- switch (code)
- {
- case AudioIOError.OutOfMemory:
- throw new OutOfMemoryException();
-
- case AudioIOError.InvalidParameter:
- throw new ArgumentException(msg);
-
- case AudioIOError.DevicePolicyRestriction:
- case AudioIOError.PermissionDenied:
- throw new UnauthorizedAccessException(msg);
-
- case AudioIOError.SoundPolicy:
- throw new AudioPolicyException(msg);
-
- case AudioIOError.NotSupportedType:
- case AudioIOError.NotSupported:
- throw new NotSupportedException(msg);
-
- case AudioIOError.DeviceNotOpened:
- case AudioIOError.DeviceNotClosed:
- case AudioIOError.InvalidBuffer:
- case AudioIOError.InvalidOperation:
- case AudioIOError.InvalidState:
- default:
- throw new InvalidOperationException(msg);
- }
- }
-
internal static void ValidateState(AudioIOState curState, params AudioIOState[] desiredStates)
{
Debug.Assert(desiredStates.Length > 0);
BufferAvailable?.Invoke(this, new AudioPlaybackBufferAvailableEventArgs((int)bytes));
};
- AudioIOUtil.ThrowIfError(
- AudioOutput.SetStreamChangedCallback(_handle, _streamCallback, IntPtr.Zero),
- $"Failed to create {nameof(AudioPlayback)}");
+ AudioOutput.SetStreamChangedCallback(_handle, _streamCallback, IntPtr.Zero)
+ .ThrowIfFailed("Failed to set stream changed callback.");
}
/// <summary>
new AudioIOStateChangedEventArgs((AudioIOState)previous, _state, byPolicy));
};
- AudioIOUtil.ThrowIfError(
- AudioOutput.SetStateChangedCallback(_handle, _stateChangedCallback, IntPtr.Zero),
- $"Failed to create {nameof(AudioPlayback)}");
+ AudioOutput.SetStateChangedCallback(_handle, _stateChangedCallback, IntPtr.Zero)
+ .ThrowIfFailed("Failed to set state changed callback.");
}
#endregion
Channel = channel;
SampleType = sampleType;
- AudioIOUtil.ThrowIfError(
- AudioOutput.Create(SampleRate, (int)Channel, (int)SampleType, out _handle),
- $"Failed to create {nameof(AudioPlayback)}");
+ AudioOutput.Create(SampleRate, (int)Channel, (int)SampleType, out _handle)
+ .ThrowIfFailed("Failed to create instance.");
RegisterStreamCallback();
RegisterStateChangedCallback();
{
ValidateNotDisposed();
- int audioType = 0;
- int ret = AudioOutput.GetSoundType(_handle, out audioType);
- MultimediaDebug.AssertNoError(ret);
+ var ret = AudioOutput.GetSoundType(_handle, out int audioType);
+ MultimediaDebug.AssertNoError((int)ret);
return (AudioStreamType)audioType;
}
/// <since_tizen> 3 </since_tizen>
public int GetBufferSize()
{
- AudioIOUtil.ThrowIfError(AudioOutput.GetBufferSize(_handle, out var size));
+ AudioOutput.GetBufferSize(_handle, out var size)
+ .ThrowIfFailed("Failed to get buffer size.");
+
return size;
}
{
ValidateState(AudioIOState.Running, AudioIOState.Paused);
- int ret = AudioOutput.Drain(_handle);
-
- MultimediaDebug.AssertNoError(ret);
+ var ret = AudioOutput.Drain(_handle);
+ MultimediaDebug.AssertNoError((int)ret);
}
/// <summary>
throw new ArgumentException("buffer has no data.(the Length is zero.)", nameof(buffer));
}
- int ret = AudioOutput.Write(_handle, buffer, (uint)buffer.Length);
+ var ret = AudioOutput.Write(_handle, buffer, (uint)buffer.Length);
+ ret.ThrowIfFailed("Failed to write buffer.");
- AudioIOUtil.ThrowIfError(ret, "Failed to write buffer");
-
- return ret;
+ return (int)ret;
}
/// <summary>
{
ValidateState(AudioIOState.Idle);
- AudioIOUtil.ThrowIfError(AudioOutput.Prepare(_handle),
- $"Failed to prepare the {nameof(AudioPlayback)}");
+ AudioOutput.Prepare(_handle).ThrowIfFailed("Failed to prepare.");
}
/// <summary>
{
ValidateState(AudioIOState.Running, AudioIOState.Paused);
- AudioIOUtil.ThrowIfError(AudioOutput.Unprepare(_handle),
- $"Failed to unprepare the {nameof(AudioPlayback)}");
+ AudioOutput.Unprepare(_handle).ThrowIfFailed("Failed to unprepare");
}
/// <summary>
}
ValidateState(AudioIOState.Running);
- AudioIOUtil.ThrowIfError(AudioOutput.Pause(_handle));
+ AudioOutput.Pause(_handle).ThrowIfFailed("Failed to pause.");
}
/// <summary>
}
ValidateState(AudioIOState.Paused);
- AudioIOUtil.ThrowIfError(AudioOutput.Resume(_handle));
+ AudioOutput.Resume(_handle).ThrowIfFailed("Failed to resume.");
}
/// <summary>
{
ValidateState(AudioIOState.Running, AudioIOState.Paused);
- int ret = AudioOutput.Flush(_handle);
-
- MultimediaDebug.AssertNoError(ret);
+ var ret = AudioOutput.Flush(_handle);
+ MultimediaDebug.AssertNoError((int)ret);
}
/// <summary>
ValidateNotDisposed();
- AudioIOUtil.ThrowIfError(AudioOutput.SetStreamInfo(_handle, streamPolicy.Handle));
+ AudioOutput.SetStreamInfo(_handle, streamPolicy.Handle)
+ .ThrowIfFailed("Failed to apply stream policy.");
}
}
}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Tizen.Multimedia
+{
+ /// <summary>
+ /// Specifies the audio sample types.
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ public enum AudioSampleType
+ {
+ /// <summary>
+ /// Unsigned 8-bit audio samples.
+ /// </summary>
+ U8 = 0x70,
+ /// <summary>
+ /// Signed 16-bit audio samples.
+ /// </summary>
+ S16Le,
+ /// <summary>
+ /// Signed 24-bit audio samples.
+ /// </summary>
+ /// <since_tizen> 5 </since_tizen>
+ S24Le,
+ /// <summary>
+ /// Signed 24-bit (packed in 32-bit) audio samples.
+ /// </summary>
+ /// <since_tizen> 5 </since_tizen>
+ S24LePacked
+ }
+}
internal static partial class AudioInput
{
[DllImport(Libraries.AudioIO, EntryPoint = "audio_in_set_state_changed_cb")]
- internal static extern int SetStateChangedCallback(IntPtr handle, AudioStateChangedCallback callback, IntPtr user_data);
+ internal static extern AudioIOError SetStateChangedCallback(IntPtr handle, AudioStateChangedCallback callback, IntPtr user_data);
[DllImport(Libraries.AudioIO, EntryPoint = "audio_in_set_stream_cb")]
- internal static extern int SetStreamCallback(IntPtr handle, AudioStreamCallback callback, IntPtr user_data);
+ internal static extern AudioIOError SetStreamCallback(IntPtr handle, AudioStreamCallback callback, IntPtr user_data);
[DllImport(Libraries.AudioIO, EntryPoint = "audio_in_create")]
- internal static extern int Create(int sampleRate, int channel, int type, out IntPtr handle);
+ internal static extern AudioIOError Create(int sampleRate, int channel, int type, out IntPtr handle);
[DllImport(Libraries.AudioIO, EntryPoint = "audio_in_destroy")]
- internal static extern int Destroy(IntPtr handle);
+ internal static extern AudioIOError Destroy(IntPtr handle);
[DllImport(Libraries.AudioIO, EntryPoint = "audio_in_set_sound_stream_info")]
- internal static extern int SetStreamInfo(IntPtr handle, AudioStreamPolicyHandle streamInfoHandle);
+ internal static extern AudioIOError SetStreamInfo(IntPtr handle, AudioStreamPolicyHandle streamInfoHandle);
[DllImport(Libraries.AudioIO, EntryPoint = "audio_in_prepare")]
- internal static extern int Prepare(IntPtr handle);
+ internal static extern AudioIOError Prepare(IntPtr handle);
[DllImport(Libraries.AudioIO, EntryPoint = "audio_in_unprepare")]
- internal static extern int Unprepare(IntPtr handle);
+ internal static extern AudioIOError Unprepare(IntPtr handle);
[DllImport(Libraries.AudioIO, EntryPoint = "audio_in_pause")]
- internal static extern int Pause(IntPtr handle);
+ internal static extern AudioIOError Pause(IntPtr handle);
[DllImport(Libraries.AudioIO, EntryPoint = "audio_in_resume")]
- internal static extern int Resume(IntPtr handle);
+ internal static extern AudioIOError Resume(IntPtr handle);
[DllImport(Libraries.AudioIO, EntryPoint = "audio_in_flush")]
- internal static extern int Flush(IntPtr handle);
+ internal static extern AudioIOError Flush(IntPtr handle);
[DllImport(Libraries.AudioIO, EntryPoint = "audio_in_read")]
- internal static extern int Read(IntPtr handle, byte[] buffer, int length);
+ internal static extern AudioIOError Read(IntPtr handle, byte[] buffer, int length);
[DllImport(Libraries.AudioIO, EntryPoint = "audio_in_get_buffer_size")]
- internal static extern int GetBufferSize(IntPtr handle, out int size);
+ internal static extern AudioIOError GetBufferSize(IntPtr handle, out int size);
[DllImport(Libraries.AudioIO, EntryPoint = "audio_in_get_sample_rate")]
- internal static extern int GetSampleRate(IntPtr handle, out int sampleRate);
+ internal static extern AudioIOError GetSampleRate(IntPtr handle, out int sampleRate);
[DllImport(Libraries.AudioIO, EntryPoint = "audio_in_get_channel")]
- internal static extern int GetChannel(IntPtr handle, out int channel);
+ internal static extern AudioIOError GetChannel(IntPtr handle, out int channel);
[DllImport(Libraries.AudioIO, EntryPoint = "audio_in_get_sample_type")]
- internal static extern int GetSampleType(IntPtr handle, out int sampleType);
+ internal static extern AudioIOError GetSampleType(IntPtr handle, out int sampleType);
[DllImport(Libraries.AudioIO, EntryPoint = "audio_in_peek")]
- internal static extern int Peek(IntPtr handle, out IntPtr buffer, ref uint length);
+ internal static extern AudioIOError Peek(IntPtr handle, out IntPtr buffer, ref uint length);
[DllImport(Libraries.AudioIO, EntryPoint = "audio_in_drop")]
- internal static extern int Drop(IntPtr handle);
+ internal static extern AudioIOError Drop(IntPtr handle);
}
internal static partial class AudioOutput
{
[DllImport(Libraries.AudioIO, EntryPoint = "audio_out_set_state_changed_cb")]
- internal static extern int SetStateChangedCallback(IntPtr handle, AudioStateChangedCallback callback, IntPtr user_data);
+ internal static extern AudioIOError SetStateChangedCallback(IntPtr handle, AudioStateChangedCallback callback, IntPtr user_data);
[DllImport(Libraries.AudioIO, EntryPoint = "audio_out_set_stream_cb")]
- internal static extern int SetStreamChangedCallback(IntPtr handle, AudioStreamCallback callback, IntPtr user_data);
+ internal static extern AudioIOError SetStreamChangedCallback(IntPtr handle, AudioStreamCallback callback, IntPtr user_data);
[DllImport(Libraries.AudioIO, EntryPoint = "audio_out_create_new")]
- internal static extern int Create(int sampleRate, int channel, int type, out IntPtr handle);
+ internal static extern AudioIOError Create(int sampleRate, int channel, int type, out IntPtr handle);
[DllImport(Libraries.AudioIO, EntryPoint = "audio_out_destroy")]
- internal static extern int Destroy(IntPtr handle);
+ internal static extern AudioIOError Destroy(IntPtr handle);
[DllImport(Libraries.AudioIO, EntryPoint = "audio_out_drain")]
- internal static extern int Drain(IntPtr handle);
+ internal static extern AudioIOError Drain(IntPtr handle);
[DllImport(Libraries.AudioIO, EntryPoint = "audio_out_flush")]
- internal static extern int Flush(IntPtr handle);
+ internal static extern AudioIOError Flush(IntPtr handle);
[DllImport(Libraries.AudioIO, EntryPoint = "audio_out_get_buffer_size")]
- internal static extern int GetBufferSize(IntPtr handle, out int size);
+ internal static extern AudioIOError GetBufferSize(IntPtr handle, out int size);
[DllImport(Libraries.AudioIO, EntryPoint = "audio_out_get_channel")]
- internal static extern int GetChannel(IntPtr handle, out int channel);
+ internal static extern AudioIOError GetChannel(IntPtr handle, out int channel);
[DllImport(Libraries.AudioIO, EntryPoint = "audio_out_get_sample_rate")]
- internal static extern int GetSampleRate(IntPtr handle, out int sampleRate);
+ internal static extern AudioIOError GetSampleRate(IntPtr handle, out int sampleRate);
[DllImport(Libraries.AudioIO, EntryPoint = "audio_out_get_sample_type")]
- internal static extern int GetSampleType(IntPtr handle, out int sampleType);
+ internal static extern AudioIOError GetSampleType(IntPtr handle, out int sampleType);
[DllImport(Libraries.AudioIO, EntryPoint = "audio_out_get_sound_type")]
- internal static extern int GetSoundType(IntPtr handle, out int soundType);
+ internal static extern AudioIOError GetSoundType(IntPtr handle, out int soundType);
[DllImport(Libraries.AudioIO, EntryPoint = "audio_out_pause")]
- internal static extern int Pause(IntPtr handle);
+ internal static extern AudioIOError Pause(IntPtr handle);
[DllImport(Libraries.AudioIO, EntryPoint = "audio_out_prepare")]
- internal static extern int Prepare(IntPtr handle);
+ internal static extern AudioIOError Prepare(IntPtr handle);
[DllImport(Libraries.AudioIO, EntryPoint = "audio_out_resume")]
- internal static extern int Resume(IntPtr handle);
+ internal static extern AudioIOError Resume(IntPtr handle);
[DllImport(Libraries.AudioIO, EntryPoint = "audio_out_set_sound_stream_info")]
- internal static extern int SetStreamInfo(IntPtr handle, AudioStreamPolicyHandle streamInfoHandle);
+ internal static extern AudioIOError SetStreamInfo(IntPtr handle, AudioStreamPolicyHandle streamInfoHandle);
[DllImport(Libraries.AudioIO, EntryPoint = "audio_out_unprepare")]
- internal static extern int Unprepare(IntPtr handle);
+ internal static extern AudioIOError Unprepare(IntPtr handle);
[DllImport(Libraries.AudioIO, EntryPoint = "audio_out_write")]
- internal static extern int Write(IntPtr handle, byte[] buffer, uint length);
+ internal static extern AudioIOError Write(IntPtr handle, byte[] buffer, uint length);
}
}
}