Exemple #1
0
 private unsafe Result CreateQuery(IntPtr devicePointer, QueryType queryType, IntPtr **queryInterface)
 {
     throw new NotSupportedException("Can't write interop, and this function doesn't seem necessary.");
     try
     {
         this.Log.LogMethodSignatureTypesAndValues(devicePointer, queryType, "ref");
         this.GetOrCreateDevice(devicePointer);
         if (**queryInterface == IntPtr.Zero)
         {
             return(Result.Ok);
         }
         else
         {
             this.Queries.Add(new Query(**queryInterface));
             //queryInterface = this.Queries.Last().NativePointer;
             return(Result.Ok);
         }
     }
     catch (SharpDXException ex)
     {
         Log.Warn(ex);
         return(ex.ResultCode);
     }
     catch (Exception ex)
     {
         this.Log.Fatal(ex);
         return(Result.UnexpectedFailure);
     }
 }
        /// <summary>
        /// Creates a new streaming inference state.
        /// </summary>
        public unsafe DeepSpeechStream CreateStream()
        {
            IntPtr **streamingStatePointer = null;
            var      resultCode            = NativeImp.DS_CreateStream(_modelStatePP, ref streamingStatePointer);

            EvaluateResultCode(resultCode);
            return(new DeepSpeechStream(streamingStatePointer));
        }
Exemple #3
0
        /// <summary>
        /// Creates a new streaming inference state.
        /// </summary>
        public unsafe MozillaVoiceSttStream CreateStream()
        {
            IntPtr **streamingStatePointer = null;
            var      resultCode            = NativeImp.STT_CreateStream(_modelStatePP, ref streamingStatePointer);

            EvaluateResultCode(resultCode);
            return(new MozillaVoiceSttStream(streamingStatePointer));
        }
Exemple #4
0
        /// <summary>
        /// This is the bootstrapping entry point. It's labeled private but is actually invoked from the native
        /// code to poke the address of the FnGetter callback into the address encoded in the string parameter.
        /// This odd way of doing things is because the most convenient way to call an initial managed method
        /// imposes the signature of Func{string, int}, which doesn't allow us to return a function adress.
        /// </summary>
        private static unsafe int GetFnGetterCallback(string addr)
        {
            if (FnGetter == null)
            {
                Interlocked.CompareExchange(ref FnGetter, (NativeFnGetter)GetFn, null);
            }
            long     a  = long.Parse(addr);
            IntPtr * p  = null;
            IntPtr **pp = &p;

            *(long *)pp = a;
            *p = Marshal.GetFunctionPointerForDelegate(FnGetter);
            return(1);
        }
Exemple #5
0
 internal unsafe static extern int DS_GetModelSampleRate(IntPtr **aCtx);
 /// <summary>
 /// Initializes a new instance of <see cref="MozillaVoiceSttStream"/>.
 /// </summary>
 /// <param name="streamingStatePP">Native pointer of the native stream.</param>
 public unsafe MozillaVoiceSttStream(IntPtr **streamingStatePP)
 {
     _streamingStatePp = streamingStatePP;
 }
Exemple #7
0
 internal static unsafe extern IntPtr DS_FinishStreamWithMetadata(IntPtr **aSctx);
Exemple #8
0
 internal static unsafe extern IntPtr DS_IntermediateDecode(IntPtr **aSctx);
Exemple #9
0
 internal static unsafe extern void DS_FreeStream(IntPtr **aSctx);
Exemple #10
0
 internal static unsafe extern void DS_FreeModel(IntPtr **aCtx);
Exemple #11
0
 internal static unsafe extern ErrorCodes DS_SetScorerAlphaBeta(IntPtr **aCtx,
                                                                float aAlpha,
                                                                float aBeta);
 public static extern IntPtr GetDeviceList(Context ctx, IntPtr **list);
Exemple #13
0
 internal static unsafe extern int RoParseTypeName(
     HSTRING typename,
     uint *typenamePartsLength,
     IntPtr **typenameParts);
Exemple #14
0
 public extern static unsafe int clEnqueueWriteImage(IntPtr command_queue, IntPtr image, bool blocking_write, IntPtr **origin, IntPtr **region, IntPtr input_row_pitch, IntPtr input_slice_pitch, IntPtr ptr, uint num_events_in_wait_list, IntPtr *event_wait_list, IntPtr * @event);
Exemple #15
0
 public extern static unsafe System.IntPtr clEnqueueMapImage(IntPtr command_queue, IntPtr image, bool blocking_map, uint map_flags, IntPtr **origin, IntPtr **region, IntPtr *image_row_pitch, IntPtr *image_slice_pitch, uint num_events_in_wait_list, IntPtr *event_wait_list, IntPtr * @event, out int errcode_ret);
Exemple #16
0
 public extern static unsafe int clEnqueueCopyImageToBuffer(IntPtr command_queue, IntPtr src_image, IntPtr dst_buffer, IntPtr **src_origin, IntPtr **region, IntPtr dst_offset, uint num_events_in_wait_list, IntPtr *event_wait_list, IntPtr * @event);
 public unsafe void Dispose() => _streamingStatePp = null;
Exemple #18
0
 internal static unsafe extern ErrorCodes DS_EnableExternalScorer(IntPtr **aCtx,
                                                                  string aScorerPath);
Exemple #19
0
 internal static unsafe extern ErrorCodes DS_DisableExternalScorer(IntPtr **aCtx);
Exemple #20
0
 internal static unsafe extern ErrorCodes DS_EnableDecoderWithLM(IntPtr **aCtx,
                                                                 string aLMPath,
                                                                 string aTriePath,
                                                                 float aLMAlpha,
                                                                 float aLMBeta);
Exemple #21
0
 internal static unsafe extern IntPtr DS_SpeechToTextWithMetadata(IntPtr **aCtx,
                                                                  short[] aBuffer,
                                                                  uint aBufferSize);
 public abstract unsafe Result GetMemoryAndroidHardwareBuffer([Count(Count = 0)] Device device, [Count(Count = 0), Flow(FlowDirection.In)] MemoryGetAndroidHardwareBufferInfoANDROID *pInfo, [Count(Count = 0), Flow(FlowDirection.Out)] IntPtr **pBuffer);
Exemple #23
0
 internal static unsafe extern ErrorCodes DS_CreateStream(IntPtr **aCtx,
                                                          ref IntPtr **retval);
Exemple #24
0
 internal unsafe static extern uint DS_GetModelBeamWidth(IntPtr **aCtx);
Exemple #25
0
 internal static unsafe extern void DS_FeedAudioContent(IntPtr **aSctx,
                                                        short[] aBuffer,
                                                        uint aBufferSize);
Exemple #26
0
 internal extern static unsafe ErrorCode EnqueueCopyBufferToImage(IntPtr command_queue, IntPtr src_buffer, IntPtr dst_image, IntPtr src_offset, IntPtr **dst_origin, IntPtr **region, uint num_events_in_wait_list, IntPtr[] event_wait_list, IntPtr * @event);
Exemple #27
0
 internal static unsafe extern IntPtr DS_FinishStream(IntPtr **aSctx);
Exemple #28
0
 internal unsafe static extern ErrorCodes DS_CreateModel(string aModelPath,
                                                         uint aBeamWidth,
                                                         ref IntPtr **pint);
Exemple #29
0
 internal unsafe static extern ErrorCodes DS_SetModelBeamWidth(IntPtr **aCtx,
                                                               uint aBeamWidth);
Exemple #30
0
 internal extern static unsafe ErrorCode EnqueueReadImage(IntPtr command_queue, IntPtr image, bool blocking_read, IntPtr **origin, IntPtr **region, IntPtr row_pitch, IntPtr slice_pitch, IntPtr ptr, uint num_events_in_wait_list, IntPtr[] event_wait_list, IntPtr * @event);