2 using System.Collections.Generic;
4 using System.Runtime.InteropServices;
6 using System.Diagnostics;
7 using System.Threading;
12 public unsafe class Cogg : SoundDecoder
14 static byte[] FOURCC = Encoding.ASCII.GetBytes( "SggO" ); // OggS の little endian
17 #region [ SoundDecoder.dll インポート(ogg 関連)]
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 );
35 public override int Open( string filename )
37 return oggOpen( filename );
39 public override int GetFormat( int nHandle, ref CWin32.WAVEFORMATEX wfx )
41 return oggGetFormat( nHandle, ref wfx );
43 public override uint GetTotalPCMSize( int nHandle )
45 return oggGetTotalPCMSize( nHandle );
47 public override int Seek( int nHandle, uint dwPosition )
49 return oggSeek( nHandle, dwPosition );
51 public override int Decode( int nHandle, IntPtr pDest, uint szDestSize, int bLoop )
53 return oggDecode( nHandle, pDest, szDestSize, bLoop );
56 public override void Close( int nHandle )