mirror of
https://github.com/crskycode/GARbro.git
synced 2026-07-08 01:30:18 +08:00
(TmrHiroAudio): use RawPcmInput.
This commit is contained in:
@@ -54,7 +54,17 @@ namespace GameRes.Formats.TmrHiro
|
|||||||
int length = ReadInt32 (file);
|
int length = ReadInt32 (file);
|
||||||
if (length != file.Length - 9)
|
if (length != file.Length - 9)
|
||||||
return null;
|
return null;
|
||||||
return new RawInput (file, length);
|
var format = new WaveFormat
|
||||||
|
{
|
||||||
|
FormatTag = 1,
|
||||||
|
Channels = 2,
|
||||||
|
SamplesPerSecond = 44100,
|
||||||
|
BitsPerSample = 16,
|
||||||
|
BlockAlign = 4,
|
||||||
|
AverageBytesPerSecond = 44100*4,
|
||||||
|
};
|
||||||
|
var pcm = new StreamRegion (file, 9, length);
|
||||||
|
return new RawPcmInput (pcm, format);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int ReadInt32 (Stream file)
|
private static int ReadInt32 (Stream file)
|
||||||
@@ -66,53 +76,4 @@ namespace GameRes.Formats.TmrHiro
|
|||||||
return dword;
|
return dword;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class RawInput : SoundInput
|
|
||||||
{
|
|
||||||
public override string SourceFormat { get { return "raw"; } }
|
|
||||||
|
|
||||||
public override int SourceBitrate
|
|
||||||
{
|
|
||||||
get { return (int)Format.AverageBytesPerSecond * 8; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public RawInput (Stream file, int data_length) : base (new StreamRegion (file, 9, data_length))
|
|
||||||
{
|
|
||||||
this.Format = new WaveFormat
|
|
||||||
{
|
|
||||||
FormatTag = 1,
|
|
||||||
Channels = 2,
|
|
||||||
SamplesPerSecond = 44100,
|
|
||||||
BitsPerSample = 16,
|
|
||||||
BlockAlign = 4,
|
|
||||||
AverageBytesPerSecond = 44100*4,
|
|
||||||
};
|
|
||||||
this.PcmSize = data_length;
|
|
||||||
}
|
|
||||||
|
|
||||||
#region IO.Stream methods
|
|
||||||
public override long Position
|
|
||||||
{
|
|
||||||
get { return Source.Position; }
|
|
||||||
set { Source.Position = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool CanSeek { get { return Source.CanSeek; } }
|
|
||||||
|
|
||||||
public override long Seek (long offset, SeekOrigin origin)
|
|
||||||
{
|
|
||||||
return Source.Seek (offset, origin);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override int Read (byte[] buffer, int offset, int count)
|
|
||||||
{
|
|
||||||
return Source.Read (buffer, offset, count);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override int ReadByte ()
|
|
||||||
{
|
|
||||||
return Source.ReadByte();
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user