OSDN Git Service

#35379 PrivateFontのIDisposableで_fontfamiryも解放するようにした
[dtxmaniaxg-verk/dtxmaniaxg-verk-git.git] / FDK17プロジェクト / コード / 03.サウンド / Cmp3.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4 using System.Runtime.InteropServices;
5 using System.IO;
6 using System.Diagnostics;
7 using System.Threading;
8
9
10 namespace FDK
11 {
12         public unsafe class Cmp3 : SoundDecoder
13         {
14 //              static byte[] FOURCC = Encoding.ASCII.GetBytes( "SggO" );       // OggS の little endian
15
16
17                 #region [ SoundDecoder.dll インポート(mpr 関連)]
18                 //-----------------
19                 [DllImport( "SoundDecoder.dll" )]
20                 private static extern void mp3Close( int nHandle );
21                 [DllImport( "SoundDecoder.dll" )]
22                 private static extern int mp3Decode( int nHandle, IntPtr pDest, uint szDestSize, int bLoop );
23                 [DllImport( "SoundDecoder.dll" )]
24                 private static extern int mp3GetFormat( int nHandle, ref CWin32.WAVEFORMATEX wfx );
25                 [DllImport( "SoundDecoder.dll" )]
26                 private static extern uint mp3GetTotalPCMSize( int nHandle );
27                 [DllImport( "SoundDecoder.dll" )]
28                 private static extern int mp3Open( string fileName );
29                 [DllImport( "SoundDecoder.dll" )]
30                 private static extern int mp3Seek( int nHandle, uint dwPosition );
31                 //-----------------
32                 #endregion
33
34
35                 public override int Open( string filename )
36                 {
37                         return mp3Open( filename );
38                 }
39                 public override int GetFormat( int nHandle, ref CWin32.WAVEFORMATEX wfx )
40                 {
41                         return mp3GetFormat( nHandle, ref wfx );
42                 }
43                 public override uint GetTotalPCMSize( int nHandle )
44                 {
45                         return mp3GetTotalPCMSize( nHandle );
46                 }
47                 public override int Seek( int nHandle, uint dwPosition )
48                 {
49                         return mp3Seek( nHandle, dwPosition );
50                 }
51                 public override int Decode( int nHandle, IntPtr pDest, uint szDestSize, int bLoop )
52                 {
53                         return mp3Decode( nHandle, pDest, szDestSize, bLoop );
54                 }
55
56                 public override void Close( int nHandle )
57                 {
58                         mp3Close( nHandle );
59                 }
60
61         }
62 }