@@ -221,9 +221,11 @@ static OSStatus BlackHole_Initialize(AudioServerPlugInDriverRef inDriver, AudioS
221
221
// calculate the host ticks per frame
222
222
struct mach_timebase_info theTimeBaseInfo ;
223
223
mach_timebase_info (& theTimeBaseInfo );
224
- Float64 theHostClockFrequency = theTimeBaseInfo .numer / theTimeBaseInfo .denom ;
224
+ Float64 theHostClockFrequency = ( Float64 ) theTimeBaseInfo .denom / ( Float64 ) theTimeBaseInfo .numer ;
225
225
theHostClockFrequency *= 1000000000.0 ;
226
226
gDevice_HostTicksPerFrame = theHostClockFrequency / gDevice_SampleRate ;
227
+
228
+ // DebugMsg("BlackHole theTimeBaseInfo.numer: %u \t theTimeBaseInfo.denom: %u", theTimeBaseInfo.numer, theTimeBaseInfo.denom);
227
229
228
230
Done :
229
231
return theAnswer ;
@@ -346,12 +348,14 @@ static OSStatus BlackHole_PerformDeviceConfigurationChange(AudioServerPlugInDriv
346
348
// recalculate the state that depends on the sample rate
347
349
struct mach_timebase_info theTimeBaseInfo ;
348
350
mach_timebase_info (& theTimeBaseInfo );
349
- Float64 theHostClockFrequency = theTimeBaseInfo .numer / theTimeBaseInfo .denom ;
351
+ Float64 theHostClockFrequency = ( Float64 ) theTimeBaseInfo .numer / ( Float64 ) theTimeBaseInfo .denom ;
350
352
theHostClockFrequency *= 1000000000.0 ;
351
353
gDevice_HostTicksPerFrame = theHostClockFrequency / gDevice_SampleRate ;
352
354
353
355
// unlock the state mutex
354
356
pthread_mutex_unlock (& gPlugIn_StateMutex );
357
+
358
+ // DebugMsg("BlackHole theTimeBaseInfo.numer: %u \t theTimeBaseInfo.denom: %u", theTimeBaseInfo.numer, theTimeBaseInfo.denom);
355
359
356
360
Done :
357
361
return theAnswer ;
@@ -3789,6 +3793,8 @@ static OSStatus BlackHole_GetZeroTimeStamp(AudioServerPlugInDriverRef inDriver,
3789
3793
* outSampleTime = gDevice_NumberTimeStamps * kDevice_RingBufferSize ;
3790
3794
* outHostTime = gDevice_AnchorHostTime + (((Float64 )gDevice_NumberTimeStamps ) * theHostTicksPerRingBuffer );
3791
3795
* outSeed = 1 ;
3796
+
3797
+ // DebugMsg("SampleTime: %f \t HostTime: %llu", *outSampleTime, *outHostTime);
3792
3798
3793
3799
// unlock the state lock
3794
3800
pthread_mutex_unlock (& gDevice_IOMutex );
@@ -3894,6 +3900,10 @@ static OSStatus BlackHole_DoIOOperation(AudioServerPlugInDriverRef inDriver, Aud
3894
3900
// write to the ioMainBuffer
3895
3901
buffer [frame * NUMBER_OF_CHANNELS + channel ] = ringBuffer [((mSampleTime + frame )%kDevice_RingBufferSize )* NUMBER_OF_CHANNELS + channel ];
3896
3902
}
3903
+ else
3904
+ {
3905
+ buffer [frame * NUMBER_OF_CHANNELS + channel ] = 0 ;
3906
+ }
3897
3907
3898
3908
// clear ring buffer after 8192 samples.
3899
3909
ringBuffer [((mSampleTime + frame - 8192 )%kDevice_RingBufferSize )* NUMBER_OF_CHANNELS + channel ] = 0 ;
@@ -3919,6 +3929,10 @@ static OSStatus BlackHole_DoIOOperation(AudioServerPlugInDriverRef inDriver, Aud
3919
3929
// write to internal ring buffer
3920
3930
ringBuffer [((mSampleTime + frame )%kDevice_RingBufferSize )* NUMBER_OF_CHANNELS + channel ] += buffer [frame * NUMBER_OF_CHANNELS + channel ] * gVolume_Output_Master_Value ;
3921
3931
}
3932
+ else
3933
+ {
3934
+ buffer [frame * NUMBER_OF_CHANNELS + channel ] = 0 ;
3935
+ }
3922
3936
3923
3937
// clear ring buffer after 8192 samples.
3924
3938
ringBuffer [((mSampleTime + frame - 8192 )%kDevice_RingBufferSize )* NUMBER_OF_CHANNELS + channel ] = 0 ;
0 commit comments