コード例 #1
0
ファイル: AcmDriver.cs プロジェクト: EnergonV/BestCS
 /// <summary>
 /// Gets all the supported formats for a given format tag
 /// </summary>
 /// <param name="formatTag">Format tag</param>
 /// <returns>Supported formats</returns>
 public IEnumerable<AcmFormat> GetFormats(AcmFormatTag formatTag)
 {
     if (driverHandle == IntPtr.Zero)
     {
         throw new InvalidOperationException("Driver must be opened first");
     }
     tempFormatsList = new List<AcmFormat>();
     var formatDetails = new AcmFormatDetails();
     formatDetails.structSize = Marshal.SizeOf(formatDetails);
     // need to make sure we have enough space for a waveFormat. formatTag.FormatSize isn't reliable, 
     // and some codecs MaxFormatSize isn't either
     formatDetails.waveFormatByteSize = 1024;
     formatDetails.waveFormatPointer = Marshal.AllocHGlobal(formatDetails.waveFormatByteSize);
     formatDetails.formatTag = (int)formatTag.FormatTag; // (int)WaveFormatEncoding.Unknown
     var result = AcmInterop.acmFormatEnum(driverHandle, 
         ref formatDetails, AcmFormatEnumCallback, IntPtr.Zero, 
         AcmFormatEnumFlags.None);
     Marshal.FreeHGlobal(formatDetails.waveFormatPointer);
     MmException.Try(result,"acmFormatEnum");
     return tempFormatsList;
 }
コード例 #2
0
ファイル: AcmDriver.cs プロジェクト: EnergonV/BestCS
 private bool AcmFormatEnumCallback(IntPtr hAcmDriverId, ref AcmFormatDetails formatDetails, IntPtr dwInstance, AcmDriverDetailsSupportFlags flags)
 {
     tempFormatsList.Add(new AcmFormat(formatDetails));
     return true;
 }
コード例 #3
0
ファイル: AcmFormat.cs プロジェクト: EnergonV/BestCS
 internal AcmFormat(AcmFormatDetails formatDetails)
 {
     this.formatDetails = formatDetails;
     waveFormat = WaveFormat.MarshalFromPtr(formatDetails.waveFormatPointer);
 }