VAG Encode Library for PC is the library of routines required to generate VAG file, which is the sound format for PlayStation. It is provided in the form of Dynamic Link Library (DLL) for Win32.
The package to be distrubuted is composed of the following directories.
library - Library itself (.dll, .lib, .h) sample - bin Execute Form of Sample Code (A2V_Win) - source Source for Sample Code (Project for VisualC++ 5.0) doc - eng English documents - jp Japanese documents
Encoding is performed in units of 1 block consisting of 28 samples of 16-bit data (56 bytes). Loop information is added not to VAG header but to waveform data itself.
Encoding is executed according to the following procedure using the group of functions explained in the next section.
- Specify the mode with EncVagInit(), and initialize the encode routine.
- Call EncVag() in units of 28 samples, and make compression conversion.
- Repeat (2) above.
- Pad the last block with 0, and call EncVag(). In case of one-shot waveform, however, call EncVagFin().
Encode routine itself does not output VAG header etc. In making data as VAG file, first write the VAG header of 30H starting with 'VAGp' or 'pGAV' and the waveform start block of 16 bytes (all the data is 0), and then write the waveform data (output of EncVag()). In case of one-shot waveform (loop-free waveform), it is
necessary to add waveform end block at the end.
VAG header ('VAGp' ... ) 30H (48 bytes) Waveform Start Block (all 0) 10H (16 bytes) Waveform Data Arbitrary Waveform End Block (Only for one-shot waveform) 10H (16 bytes)
Omission of waveform end block addition may result in malfunction when SPU interrupt is used. For the waveform with loop as explained above, however, waveform end block is unnecesary.
This function initializes the encode routine. When encoding waveform data, it is necessary to make a call at first.
Conversion mode "conv_mode" is set by selecting one from "Stndard", "High Band", "Low Band" and "4bit Straight".
- Standard
- High Band (Effective in waveform with many high-frequency elements)
- Low Band (Effective in waveform with many low-frequency elements)
- 4bit Straight (Linear conversion from 16 bits to 4 bits)
____________________________________________________________
Apply compression conversion to the data of 28 samples (56 bytes), which has been specified in Array x, and then store the data in Array y of 16 bytes. Array y consists of 8 short words.
Set block_attribute to one of the following (1) to (5) as loop setting
- Loop-free waveform (one shot)
- Loop-free waveform and waveform end block
- Waveform with loop and loop start block
- Waveform with loop (Not start/end block)
- Waveform with loop and waveform end block
____________________________________________________________
When compression conversion is applied to one-shot (loop-free) waveform, it is necessary to call this function and add waveform end block at the end. Array y consists of 8 short words.
A2V_Win is a simple sample application, which uses the VAG Encode Library for PC. This application reads 16-bit non-compressed aiff file and converts it to VAG.
It has been confirmed that A2V_Win runs in Windows95 and WindowsNT 4.0 environments.
All the source code of A2V_Win is included in the sample/source directory. The attached project is for Visual C++ 5.0.
The project refers to encvag.h and encvag.lib in the library directory with a relative path. When the configuration of the directory is changed, set the paths for the include and library files correctly in "Project Setting" menu.
To execute A2V_Win, encvag.dll in the library directory is required. Copy it to the current directory or Windows system directory.↑TOP
When A2V_Win is activated, the following window appears. Specify the aiff file (source) in the "Input file" box and the converted file name in the "Output file" box. The aiff file to be specified has to be 16-bit data in non-compressed form.
When the "Convert" button is pressed, the conversion from aiff to VAG is implemented.
![]()