import 'dart:ffi'; // 引入 FFI 库
import '../tmg_audio_ctrl.dart';
import '../tmg_type.dart';
import '../bindings/tmg_audio_ctrl_bindings.dart' as TMGAudioCtrlBindings;

class TMGAudioCtrlImpl extends ITMGAudioCtrl {
  late final _instance;
  TMGAudioCtrlImpl() {
    _instance = new TMGAudioCtrlBindings.TMGAudioCtrlBindings();
  }

  @override
  int EnableMic(bool enable) {
    return _instance.EnableMic(enable);
  }

  @override
  int GetMicState() {
    return _instance.GetMicState();
  }

  @override
  int EnableSpeaker(bool enable) {
    return _instance.EnableSpeaker(enable);
  }

  @override
  int GetSpeakerState() {
    return _instance.GetSpeakerState();
  }

  @override
  int EnableAudioCaptureDevice(bool enable) {
    return _instance.EnableAudioCaptureDevice(enable);
  }

  @override
  bool IsAudioCaptureDeviceEnabled() {
    return _instance.IsAudioCaptureDeviceEnabled();
  }

  @override
  int EnableAudioPlayDevice(bool enable) {
    return _instance.EnableAudioPlayDevice(enable);
  }

  @override
  bool IsAudioPlayDeviceEnabled() {
    return _instance.IsAudioPlayDeviceEnabled();
  }

  @override
  int EnableAudioSend(bool enable) {
    return _instance.EnableAudioSend(enable);
  }

  @override
  bool IsAudioSendEnabled() {
    return _instance.IsAudioSendEnabled();
  }

  @override
  int EnableAudioRecv(bool enable) {
    return _instance.EnableAudioRecv(enable);
  }

  @override
  bool IsAudioRecvEnabled() {
    return _instance.IsAudioRecvEnabled();
  }

  @override
  int SetMicVolume(int volume) {
    return _instance.SetMicVolume(volume);
  }

  @override
  int GetMicVolume() {
    return _instance.GetMicVolume();
  }

  @override
  int SetSpeakerVolume(int volume) {
    return _instance.SetSpeakerVolume(volume);
  }

  @override
  int GetSpeakerVolume() {
    return _instance.GetSpeakerVolume();
  }

  @override
  int SetSpeakerVolumeByUserID(String userID, int volume) {
    return _instance.SetSpeakerVolumeByUserID(userID, volume);
  }

  @override
  int GetSpeakerVolumeByUserID(String userID) {
    return _instance.GetSpeakerVolumeByUserID(userID);
  }

  @override
  int EnableLoopBack(bool enable) {
    return _instance.EnableLoopBack(enable);
  }

  @override
  int SetLoopBackVolume(int volume) {
    return _instance.SetLoopBackVolume(volume);
  }

  @override
  int AddAudioBlackList(String userID) {
    return _instance.AddAudioBlackList(userID);
  }

  @override
  int RemoveAudioBlackList(String userID) {
    return _instance.RemoveAudioBlackList(userID);
  }

  @override
  bool IsUserIDInAudioBlackList(String userID) {
    return _instance.IsUserIDInAudioBlackList(userID);
  }

  @override
  int EnableSpatializer(bool enable) {
    return _instance.EnableSpatializer(enable);
  }

  @override
  bool IsEnableSpatializer() {
    return _instance.IsEnableSpatializer();
  }

  @override
  int TrackingVolume(double interval) {
    return _instance.TrackingVolume(interval);
  }

  @override
  int StopTrackingVolume() {
    return _instance.StopTrackingVolume();
  }

  @override
  int GetMicLevel() {
    return _instance.GetMicLevel();
  }

  @override
  int GetSpeakerLevel() {
    return _instance.GetSpeakerLevel();
  }

  @override
  int GetSendStreamLevel() {
    return _instance.GetSendStreamLevel();
  }

  @override
  int GetRecvStreamLevel(String userID) {
    return _instance.GetRecvStreamLevel(userID);
  }
}
