55
66namespace Fmod5Sharp . FmodVorbis ;
77
8- public class FmodVorbisData
8+ internal class FmodVorbisData
99{
10- public byte [ ] headerBytes { get ; set ; }
11- public int seekBit { get ; set ; }
10+ [ JsonPropertyName ( "headerBytes" ) ]
11+ public byte [ ] HeaderBytes { get ; set ; }
12+
13+ [ JsonPropertyName ( "seekBit" ) ]
14+ public int SeekBit { get ; set ; }
15+
16+ [ JsonConstructor ]
17+ public FmodVorbisData ( byte [ ] headerBytes , int seekBit )
18+ {
19+ HeaderBytes = headerBytes ;
20+ SeekBit = seekBit ;
21+ }
1222
13- [ JsonIgnore ] public byte [ ] blockFlags { get ; private set ; } = Array . Empty < byte > ( ) ;
23+ [ JsonIgnore ] public byte [ ] BlockFlags { get ; private set ; } = Array . Empty < byte > ( ) ;
1424
1525 private bool _initialized ;
1626
@@ -21,7 +31,7 @@ internal void InitBlockFlags()
2131
2232 _initialized = true ;
2333
24- var bitStream = new BitStream ( headerBytes ) ;
34+ var bitStream = new BitStream ( HeaderBytes ) ;
2535
2636 if ( bitStream . ReadByte ( ) != 5 ) //packing type 5 == books
2737 return ;
@@ -30,13 +40,13 @@ internal void InitBlockFlags()
3040 return ;
3141
3242 //Whole bytes, bit remainder
33- bitStream . Seek ( seekBit / 8 , seekBit % 8 ) ;
43+ bitStream . Seek ( SeekBit / 8 , SeekBit % 8 ) ;
3444
3545 //Read 6 bits and add one
3646 var numModes = bitStream . ReadByte ( 6 ) + 1 ;
3747
3848 //Read the first bit of each mode and skip the rest of the mode data. These are our flags.
39- blockFlags = Enumerable . Range ( 0 , numModes ) . Select ( _ =>
49+ BlockFlags = Enumerable . Range ( 0 , numModes ) . Select ( _ =>
4050 {
4151 var flag = ( byte ) bitStream . ReadBit ( ) ;
4252
@@ -58,10 +68,10 @@ public int GetPacketBlockSize(byte[] packetBytes)
5868
5969 var mode = 0 ;
6070
61- if ( blockFlags . Length > 0 )
62- mode = bitStream . ReadByte ( blockFlags . Length - 1 ) ;
71+ if ( BlockFlags . Length > 0 )
72+ mode = bitStream . ReadByte ( BlockFlags . Length - 1 ) ;
6373
64- if ( blockFlags [ mode ] == 1 )
74+ if ( BlockFlags [ mode ] == 1 )
6575 return 2048 ;
6676
6777 return 256 ;
0 commit comments