Revisión | f90298436bd07bcc70e8cea33ac46614122dbebd (tree) |
---|---|
Tiempo | 2023-10-16 23:29:43 |
Autor | Adam Kaminski <kaminskiadam9@gmai...> |
Commiter | Adam Kaminski |
Fixed the +voicerecord button not working properly in Linux.
@@ -262,6 +262,7 @@ | ||
262 | 262 | bIsInitialized( false ), |
263 | 263 | bIsActive( false ), |
264 | 264 | bIsTesting( false ), |
265 | + bIsRecordButtonPressed( false ), | |
265 | 266 | TransmissionType( TRANSMISSIONTYPE_OFF ) |
266 | 267 | { |
267 | 268 | proximityInfo.SysChannel = nullptr; |
@@ -412,6 +413,7 @@ | ||
412 | 413 | |
413 | 414 | bIsInitialized = false; |
414 | 415 | bIsTesting = false; |
416 | + bIsRecordButtonPressed = false; | |
415 | 417 | Printf( "VoIP controller shutting down.\n" ); |
416 | 418 | } |
417 | 419 |
@@ -538,23 +540,34 @@ | ||
538 | 540 | |
539 | 541 | // [AK] Check the status of the "voicerecord" button. If the button's been |
540 | 542 | // pressed, start transmitting, or it's been released stop transmitting. |
541 | - if (( Button_VoiceRecord.bWentUp ) && ( TransmissionType == TRANSMISSIONTYPE_BUTTON )) | |
542 | - { | |
543 | - StopTransmission( ); | |
544 | - } | |
545 | - else if (( Button_VoiceRecord.bWentDown ) && ( snd_recordvoiceactivity == false )) | |
543 | + if ( Button_VoiceRecord.bDown == false ) | |
546 | 544 | { |
547 | - if ( IsVoiceChatAllowed( )) | |
548 | - StartTransmission( TRANSMISSIONTYPE_BUTTON, true ); | |
549 | - // [AK] We can't transmit if we're watching a demo. | |
550 | - else if ( CLIENTDEMO_IsPlaying( )) | |
551 | - Printf( "Voice chat can't be used during demo playback.\n" ); | |
552 | - // ...or if we're in an offline game. | |
553 | - else if (( NETWORK_GetState( ) == NETSTATE_SINGLE ) || ( NETWORK_GetState( ) == NETSTATE_SINGLE_MULTIPLAYER )) | |
554 | - Printf( "Voice chat can't be used in a singleplayer game.\n" ); | |
555 | - // ...or if the server has disabled voice chatting. | |
556 | - else if ( sv_allowvoicechat == VOICECHAT_OFF ) | |
557 | - Printf( "Voice chat has been disabled by the server.\n" ); | |
545 | + if ( bIsRecordButtonPressed ) | |
546 | + { | |
547 | + bIsRecordButtonPressed = false; | |
548 | + | |
549 | + if ( TransmissionType == TRANSMISSIONTYPE_BUTTON ) | |
550 | + StopTransmission( ); | |
551 | + } | |
552 | + } | |
553 | + else if ( bIsRecordButtonPressed == false ) | |
554 | + { | |
555 | + bIsRecordButtonPressed = true; | |
556 | + | |
557 | + if ( snd_recordvoiceactivity == false ) | |
558 | + { | |
559 | + if ( IsVoiceChatAllowed( )) | |
560 | + StartTransmission( TRANSMISSIONTYPE_BUTTON, true ); | |
561 | + // [AK] We can't transmit if we're watching a demo. | |
562 | + else if ( CLIENTDEMO_IsPlaying( )) | |
563 | + Printf( "Voice chat can't be used during demo playback.\n" ); | |
564 | + // ...or if we're in an offline game. | |
565 | + else if (( NETWORK_GetState( ) == NETSTATE_SINGLE ) || ( NETWORK_GetState( ) == NETSTATE_SINGLE_MULTIPLAYER )) | |
566 | + Printf( "Voice chat can't be used in a singleplayer game.\n" ); | |
567 | + // ...or if the server has disabled voice chatting. | |
568 | + else if ( sv_allowvoicechat == VOICECHAT_OFF ) | |
569 | + Printf( "Voice chat has been disabled by the server.\n" ); | |
570 | + } | |
558 | 571 | } |
559 | 572 | |
560 | 573 | if (( bIsActive == false ) && ( bIsTesting == false )) |
@@ -229,6 +229,7 @@ | ||
229 | 229 | bool bIsInitialized; |
230 | 230 | bool bIsActive; |
231 | 231 | bool bIsTesting; |
232 | + bool bIsRecordButtonPressed; | |
232 | 233 | TRANSMISSIONTYPE_e TransmissionType; |
233 | 234 | |
234 | 235 | // [AK] This is needed for saving the arrays of encoded audio frames while |