x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

UE-62389 - Mic stop capturing audio at 2nd load of app

I made simple class that capture voice input from mic and I build it for android .

when the app run for first time, the capturing working fine after passing record permission and I can see data voice data output, however, once I close the app and open it again, the Capturing state set to OK but I see no data at all .

If I disabled the mic permssion manually and restarted the app, it works fine once again, close it and open it , problem happen again .

Whats wrong ?!

Here is also the CPP file // Fill out your copyright notice in the Description page of Project Settings.

 #include "SoundCapture.h"
 #include "OnlineSubsystemUtils.h"
 
 
 
 // Sets default values
 ASoundCapture::ASoundCapture()
 {
      // Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
     PrimaryActorTick.bCanEverTick = true;
 }
 
 void ASoundCapture::EndPlay(const EEndPlayReason::Type EndPlayReason)
 {
     Super::EndPlay(EndPlayReason);    
     isCapture = false;    
 }
 
 void ASoundCapture::FinishDestroy()
 {
     isCapture = false;
     if (VoiceCapture.IsValid())
     {            
         VoiceCapture->Stop();
         VoiceCapture->Shutdown();
     }        
     Super::FinishDestroy();        
 }  
 
 void ASoundCapture::StartCaptureVoice()
 {        
     VoiceCapture = /*FVoiceModule::CreateVoiceCapture("", 512, 32);*/      FVoiceModule::Get().CreateVoiceCapture();
     
     VoiceCapture->Start();
     isCapture = true;
 }
 
 // Called when the game starts or when spawned
 void ASoundCapture::BeginPlay()
 {
     Super::BeginPlay();
     UE_LOG(LogTemp, Warning, TEXT("Custom player controller initialized"));
     isCapture = false;    
 }
 
 // Called every frame
 void ASoundCapture::Tick(float DeltaTime)
 {
     Super::Tick(DeltaTime);
 
     if (isCapture)
     {
         VoiceCaptureBytesAvailable = 0;
         CaptureState = VoiceCapture->GetCaptureState(VoiceCaptureBytesAvailable);
 
         UE_LOG(LogTemp, Warning, TEXT("Bytes available: %d\nCapture state: %s"), VoiceCaptureBytesAvailable, EVoiceCaptureState::ToString(CaptureState));
         GEngine->AddOnScreenDebugMessage(-1, 0.1f, FColor::Yellow, EVoiceCaptureState::ToString(CaptureState));
         VoiceCaptureBuffer.Reset();
 
         if (CaptureState == EVoiceCaptureState::Ok && VoiceCaptureBytesAvailable > 0)
         {    
             VoiceCaptureTotalSquared = 0;
             VoiceCaptureBuffer.SetNumUninitialized(VoiceCaptureBytesAvailable);
 
             VoiceCapture->GetVoiceData(VoiceCaptureBuffer.GetData(), VoiceCaptureBytesAvailable, VoiceCaptureReadBytes);
 
             for (uint32 i = 0; i < (VoiceCaptureReadBytes / 2); i++)
             {
                 VoiceCaptureSample = (VoiceCaptureBuffer[i * 2 + 1] << 8) | VoiceCaptureBuffer[i * 2];
                 VoiceCaptureTotalSquared += ((float)VoiceCaptureSample * (float)VoiceCaptureSample);
             }
 
             VoiceCaptureMeanSquare = (2 * (VoiceCaptureTotalSquared / VoiceCaptureBuffer.Num()));
             VoiceCaptureRms = FMath::Sqrt(VoiceCaptureMeanSquare);
             VoiceCaptureFinalVolume = ((VoiceCaptureRms / 32768.0) * 200.f);
             VeryCleanString = FString::SanitizeFloat(VoiceCaptureFinalVolume);
             //VoiceCaptureVolume = VoiceCaptureFinalVolume;
 
             GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Yellow, VeryCleanString);
         }
     }    
 }
 
 

I've checked with monitor.bat , log at first time has no errors, but when I start the app once again i get this strange error E/AudioRecord(24604): start() status -38

Android 6 used .

Here is the full LOG FullLog

Product Version: UE 4.20
Tags:
full-log.txt (167.8 kB)
more ▼

asked Jul 29 '18 at 06:28 PM in Bug Reports

avatar image

Omar Vector
435 16 16 29

avatar image Omar Vector Jul 29 '18 at 06:59 PM

I made sure that I stopped and shutdown the IVoiceCapture on EndPlay() to release the resource , but it seems not , cuz I've checked on stackoverflow that this issue happened when I dont release the recordDriver on exit . Here is the link https://stackoverflow.com/questions/20460892/audiorecord-start-status-38

avatar image Omar Vector Jul 30 '18 at 09:03 AM

Up , I think its a bug .

avatar image Jeff A ♦♦ STAFF Jul 30 '18 at 11:37 AM

Hello,

We've recently made a switch to a new bug reporting method using a more structured form. Please visit the link below for more details and report the issue using the new Bug Submission Form. Feel free to continue to use this thread for community discussion around the issue.

https://epicsupport.force.com/unrealengine/s/

Thanks

avatar image Omar Vector Jul 30 '18 at 11:41 AM

I will once I'm home, but can at least we get some attention from developer staff if possible?

Thanks:)

avatar image Omar Vector Jul 30 '18 at 10:47 PM

I've did bug report, however I forgot to include the Log , but I shared link of this thread with them . could u please if possible link the log file that I already attached in this thread to case number : Case # 00024739

as I know its critical to be included in the bug report . and I dont want to make a duplicate one just to include the log file

Thanks

avatar image Omar Vector Jul 31 '18 at 08:57 PM

UP until death:D

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

there is a bug reported finally submitted . https://issues.unrealengine.com/issue/UE-62389

Hope everyone vote for it to fix as soon

more ▼

answered Aug 01 '18 at 07:38 PM

avatar image

Omar Vector
435 16 16 29

avatar image Omar Vector Sep 02 '18 at 10:04 AM

Does anyone could find a fast solution?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question