OSDN Git Service

DTXManiaソリューション、DTXManiaプロジェクト、DTXCreatorプロジェクト、FDKプロジェクトについて英語化。
[dtxmania/dtxmania.git] / FDK / コード / 03.サウンド / Cogg.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 Cogg : SoundDecoder
13         {
14                 static byte[] FOURCC = Encoding.ASCII.GetBytes( "SggO" );       // OggS の little endian
15
16
17                 #region [ SoundDecoder.dll インポート(ogg 関連)]
18                 //-----------------
19                 [DllImport( "SoundDecoder.dll" )]
20                 private static extern void oggClose( int nHandle );
21                 [DllImport( "SoundDecoder.dll" )]
22                 private static extern int oggDecode( int nHandle, IntPtr pDest, uint szDestSize, int bLoop );
23                 [DllImport( "SoundDecoder.dll" )]
24                 private static extern int oggGetFormat( int nHandle, ref CWin32.WAVEFORMATEX wfx );
25                 [DllImport( "SoundDecoder.dll" )]
26                 private static extern uint oggGetTotalPCMSize( int nHandle );
27                 [DllImport( "SoundDecoder.dll" )]
28                 private static extern int oggOpen( string fileName );
29                 [DllImport( "SoundDecoder.dll" )]
30                 private static extern int oggSeek( int nHandle, uint dwPosition );
31                 //-----------------
32                 #endregion
33
34
35                 public override int Open( string filename )
36                 {
37                         return oggOpen( filename );
38                 }
39                 public override int GetFormat( int nHandle, ref CWin32.WAVEFORMATEX wfx )
40                 {
41                         return oggGetFormat( nHandle, ref wfx );
42                 }
43                 public override uint GetTotalPCMSize( int nHandle )
44                 {
45                         return oggGetTotalPCMSize( nHandle );
46                 }
47                 public override int Seek( int nHandle, uint dwPosition )
48                 {
49                         return oggSeek( nHandle, dwPosition );
50                 }
51                 public override int Decode( int nHandle, IntPtr pDest, uint szDestSize, int bLoop )
52                 {
53                         return oggDecode( nHandle, pDest, szDestSize, bLoop );
54                 }
55
56                 public override void Close( int nHandle )
57                 {
58                         oggClose( nHandle );
59                 }
60
61         }
62 }