Skip to content

Commit

Permalink
Fix mic controller callbacks not called + Refactor code
Browse files Browse the repository at this point in the history
  • Loading branch information
SaifAqqad committed Jul 1, 2023
1 parent a50b34b commit 523f7d3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/MicMute.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ switchProfile(p_name:=""){
auraSyncEnabled:= 1
}
mic_actions.Push(MicrophoneAction.Create(action))
util_log("[Main] Registered " action.Type " action")
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/MicrophoneController.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ Class MicrophoneController {

; Force microphone mute state
if(this.force_current_state && this.state != callback.Muted)
return this.setMuteStateVA(this.state, micName)
this.setMuteStateVA(this.state, micName)
else
this.state:= callback.Muted
} else {
Expand All @@ -198,9 +198,9 @@ Class MicrophoneController {
hotkeyId:= this.state? this.muteHotkeyId : this.unmuteHotkeyId
; check if the current controller is the first registered for the current hotkey
if(this.shouldCallFeedback && hotkeyId == 1){
this.shouldCallFeedback:=0
this.feedback_callback.Call(this)
}
this.shouldCallFeedback:=0
}
Critical, Off
}
Expand Down Expand Up @@ -286,10 +286,10 @@ Class MicrophoneController {
if(this.isMicrophoneArray){
this.va_callback:= Object()
for _i, mic in this.microphone {
this.va_callback[mic]:= VA_CreateAudioEndpointCallback(ObjBindMethod(this, "onUpdateState", mic), this.getMicId(mic))
this.va_callback[mic]:= VA_CreateAudioEndpointCallback(ObjBindMethod(this, "onUpdateState", mic), mic)
}
}else{
this.va_callback:= VA_CreateAudioEndpointCallback(ObjBindMethod(this, "onUpdateState", this.microphone), this.getMicId(this.microphone))
this.va_callback:= VA_CreateAudioEndpointCallback(ObjBindMethod(this, "onUpdateState", this.microphone), this.microphone)
}
}

Expand Down

0 comments on commit 523f7d3

Please sign in to comment.