mirror of
https://github.com/GuijiAI/duix.ai.git
synced 2026-03-12 17:51:43 +08:00
update
This commit is contained in:
@@ -53,6 +53,8 @@
|
||||
|
||||
@property (nonatomic, assign) int audioIndex;
|
||||
|
||||
@property (nonatomic, assign) uint64_t sessid;
|
||||
|
||||
@property (nonatomic, copy) void (^imageBlock)(UIImage *image);
|
||||
@property (nonatomic, copy) void (^pixerBlock)(CVPixelBufferRef cvPixelBuffer);
|
||||
@property (nonatomic, copy) void (^uint8Block)(UInt8*mat_uint8,UInt8*maskMat_uint8 ,UInt8*bfgMat_uint8,UInt8*bbgMat_unit8,int width ,int height);
|
||||
|
||||
@@ -23,7 +23,7 @@ static DigitalHumanDriven *manager = nil;
|
||||
// dhunet_s *gjunet;
|
||||
|
||||
dhduix_s * gjduix_s;
|
||||
uint64_t sessid;
|
||||
|
||||
// int pcmsize;
|
||||
// int bnfsize;
|
||||
// char* bnf;
|
||||
@@ -75,7 +75,7 @@ static DigitalHumanDriven *manager = nil;
|
||||
{
|
||||
[self toStopAudioReadyTimer];
|
||||
|
||||
sessid = dhduix_newsession(gjduix_s);
|
||||
self.sessid = dhduix_newsession(gjduix_s);
|
||||
// NSLog(@"sessid:%llu",sessid);
|
||||
|
||||
__weak typeof(self)weakSelf = self;
|
||||
@@ -91,7 +91,7 @@ static DigitalHumanDriven *manager = nil;
|
||||
{
|
||||
__weak typeof(self)weakSelf = self;
|
||||
dispatch_async(weakSelf.playAuidoQueue, ^{
|
||||
weakSelf.isAudioReady = dhduix_readycnt(self->gjduix_s,self->sessid);
|
||||
weakSelf.isAudioReady = dhduix_readycnt(self->gjduix_s,weakSelf.sessid);
|
||||
// NSLog(@"isAudioReady:%d",self.isAudioReady);
|
||||
if(weakSelf.isAudioReady>0)
|
||||
{
|
||||
@@ -189,7 +189,7 @@ static DigitalHumanDriven *manager = nil;
|
||||
|
||||
|
||||
|
||||
rst = dhduix_simpinx(self->gjduix_s,sessid,mat.udata(),mat.width(),mat.height(),boxs,maskMat.udata(),bfgMat.udata(),index);
|
||||
rst = dhduix_simpinx(self->gjduix_s,self.sessid,mat.udata(),mat.width(),mat.height(),boxs,maskMat.udata(),bfgMat.udata(),index);
|
||||
|
||||
isLip=YES;
|
||||
|
||||
@@ -301,7 +301,7 @@ static DigitalHumanDriven *manager = nil;
|
||||
if (![GJLAudioPlayer manager].isMute&&index>0&&[GJLAudioPlayer manager].isPlayMutePcm==NO) {
|
||||
|
||||
|
||||
rst = dhduix_simpinx(self->gjduix_s,sessid,mat.udata(),mat.width(),mat.height(),boxs,NULL,NULL,index);
|
||||
rst = dhduix_simpinx(self->gjduix_s,self.sessid,mat.udata(),mat.width(),mat.height(),boxs,NULL,NULL,index);
|
||||
isLip=YES;
|
||||
// NSLog(@"isAudioReady:%d,index:%d,rst:%d",self.isAudioReady,index,rst);
|
||||
// double time2=[[NSDate date] timeIntervalSince1970];
|
||||
@@ -377,10 +377,10 @@ static DigitalHumanDriven *manager = nil;
|
||||
-(void)wavPCM:(uint8_t*)pcm size:(int)size
|
||||
{
|
||||
// NSLog(@"wavPCM:%d",size);
|
||||
if(sessid>0&&size>0)
|
||||
if(self.sessid>0&&size>0)
|
||||
{
|
||||
|
||||
uint64_t rst = dhduix_pushpcm(gjduix_s, sessid, (char*)pcm, size, 0);
|
||||
uint64_t rst = dhduix_pushpcm(gjduix_s, self.sessid, (char*)pcm, size, 0);
|
||||
|
||||
|
||||
|
||||
@@ -389,18 +389,18 @@ static DigitalHumanDriven *manager = nil;
|
||||
}
|
||||
-(void)finishSession
|
||||
{
|
||||
if(sessid>0)
|
||||
if(self.sessid>0)
|
||||
{
|
||||
dhduix_finsession(gjduix_s, sessid);
|
||||
dhduix_finsession(gjduix_s, self.sessid);
|
||||
}
|
||||
|
||||
}
|
||||
//finishSession 结束后调用续上continueSession
|
||||
-(void)continueSession
|
||||
{
|
||||
if(sessid>0)
|
||||
if(self.sessid>0)
|
||||
{
|
||||
dhduix_consession(gjduix_s, sessid);
|
||||
dhduix_consession(gjduix_s, self.sessid);
|
||||
}
|
||||
}
|
||||
- (void)free
|
||||
|
||||
@@ -326,6 +326,10 @@ std::vector<int16_t> resample_pcm(const std::vector<int16_t>& input, size_t new_
|
||||
{
|
||||
return;
|
||||
}
|
||||
if([DigitalHumanDriven manager].sessid<=0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int dataLength =(int) [audioData length];
|
||||
|
||||
// 动态分配uint8_t数组
|
||||
@@ -350,7 +354,10 @@ std::vector<int16_t> resample_pcm(const std::vector<int16_t>& input, size_t new_
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if([DigitalHumanDriven manager].sessid<=0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
// dispatch_semaphore_wait(self.semaphore, DISPATCH_TIME_FOREVER);
|
||||
[[DigitalHumanDriven manager] wavPCM:pcm size:size];
|
||||
NSData *data = [NSData dataWithBytes:pcm length:size];
|
||||
|
||||
@@ -740,7 +740,7 @@ static GJLDigitalManager * manager = nil;
|
||||
// [self.audi]
|
||||
|
||||
// [self cancelAudioPlay];
|
||||
[GJLAudioPlayer manager].isPlaying=NO;
|
||||
// [GJLAudioPlayer manager].isPlaying=NO;
|
||||
if(self.audioPlayEnd)
|
||||
{
|
||||
self.audioPlayEnd();
|
||||
@@ -1373,6 +1373,7 @@ static GJLDigitalManager * manager = nil;
|
||||
-(void)clearAudioBuffer
|
||||
{
|
||||
// self.audioIndex=0;
|
||||
[DigitalHumanDriven manager].sessid=0;
|
||||
[DigitalHumanDriven manager].audioIndex=0;
|
||||
[[GJLAudioPlayer manager] clearAudioBuffer];
|
||||
// [self toMute:YES];
|
||||
|
||||
Reference in New Issue
Block a user