Home Download Musics Developers
API Sources Tools File Format Technicals

sc68 files
[file68 library documentation.]


Detailed Description

Provides various functions for sc68 file manipulation.


Files

file  file68.h
 sc68 file header.


Data Structures

struct  chunk68_t
 SC68 file chunk header. More...

union  hwflags68_t
 Hardware and features flags. More...

struct  music68_t
 SC68 music (track) structure. More...

struct  disk68_t
 SC68 music disk structure. More...


Features flag definitions for music68_t.

#define SC68_YM   1
 YM-2149 actif.

#define SC68_STE   2
 STE sound actif.

#define SC68_AMIGA   4
 AMIGA sound actif.

#define SC68_STECHOICE   8
 Optionnal STF/STE (not tested).


SC68 file chunk definitions.

#define CH68_CHUNK   "SC"
 Chunk identifier.

#define CH68_BASE   "68"
 Start of file.

#define CH68_FNAME   "FN"
 File name.

#define CH68_DEFAULT   "DF"
 Default music.

#define CH68_MUSIC   "MU"
 Music section start.

#define CH68_MNAME   "MN"
 Music name.

#define CH68_ANAME   "AN"
 Author name.

#define CH68_CNAME   "CN"
 Composer name.

#define CH68_D0   "D0"
 D0 value.

#define CH68_AT   "AT"
 Load address.

#define CH68_TIME   "TI"
 length in seconds

#define CH68_FRAME   "FR"
 length in frames

#define CH68_FRQ   "FQ"
 Main replay frequency in Hz.

#define CH68_LOOP   "LP"
 Number of loop.

#define CH68_TYP   "TY"
 Not standard st file.

#define CH68_IMG   "IM"
 Picture.

#define CH68_REPLAY   "RE"
 External replay.

#define CH68_MDATA   "DA"
 Music data.

#define CH68_EOF   "EF"
 End of file.


File verify functions.

int SC68file_verify (istream_t *is)
 Verify SC68 file from stream.

int SC68file_verify_file (const char *fname)
 Verify SC68 file.

int SC68file_verify_mem (const void *buffer, int len)
 Verify SC68 file mapped into memory buffer.

int SC68file_diskname (istream_t *is, char *dest, int max)
 Get SC68 disk name.

int SC68file_is_our_file (const char *url, const char *exts, int *is_remote)
 Check if an URL is a standard sc68 one.


File load functions.

disk68_tSC68file_load (istream_t *is)
 Load SC68 file from stream.

disk68_tSC68file_load_file (const char *fname)
 Load SC68 file.

disk68_tSC68file_load_mem (const void *buffer, int len)
 Load SC68 file mapped into memory buffer.


File save functions.

int SC68file_save (istream_t *os, const disk68_t *mb, int gzip)
 Save SC68 disk into stream.

int SC68file_save_file (const char *fname, const disk68_t *mb, int gzip)
 Save SC68 disk into file.

int SC68file_save_mem (const char *buffer, int len, const disk68_t *mb, int gzip)
 Save SC68 disk into memory buffer.


Defines

#define SC68_IDSTR   "SC68 Music-file / (c) (BeN)jamin Gerard / SasHipA-Dev "
 SC68 file identification string definition.

#define SC68_IDSTR_V2   {'S','C','6','8', 0,2,255,0xa9, 0xDF,0xEB,0xD1,0}
 SC68 file identification string definition V2.

#define SC68_NOFILENAME   "???"
 SC68 unknown filename or author.

#define SC68_LOADADDR   0x8000
 Default load address in 68K memory.

#define SC68_MAX_TRACK   99
 Maximum track per disk (display rules).


Variables

const char SC68file_idstr []
 SC68 file identifier string.

const char SC68file_idstr_v2 [12]
 SC68 file identifier string V2.


Define Documentation

#define SC68_IDSTR   "SC68 Music-file / (c) (BeN)jamin Gerard / SasHipA-Dev "
 

SC68 file identification string definition.

See also:
SC68file_idstr

#define SC68_IDSTR_V2   {'S','C','6','8', 0,2,255,0xa9, 0xDF,0xEB,0xD1,0}
 

SC68 file identification string definition V2.

Introduce this new indentitification string for SC68 file format V2. Aim to defeat some webserver text mode auto-detect but it does not work as I have expected.

See also:
SC68file_idstr_v2.


Function Documentation

int SC68file_verify istream_t is  ) 
 

Verify SC68 file from stream.

The SC68file_verify() function opens, reads and closes given file to determine if it is a valid SC68 file. This function only checks for a valid file header, and does not perform any consistent error checking.

Parameters:
is input stream to verify
Returns:
error-code
Return values:
0 success, seems to be a valid SC68 file
<0 failure, file error or invalid SC68 file
See also:
SC68file_load()

SC68file_save()

SC68file_diskname()

int SC68file_verify_file const char *  fname  ) 
 

Verify SC68 file.

Parameters:
fname path to file to verify.

int SC68file_verify_mem const void *  buffer,
int  len
 

Verify SC68 file mapped into memory buffer.

Parameters:
buffer buffer address
len buffer length

int SC68file_diskname istream_t is,
char *  dest,
int  max
 

Get SC68 disk name.

The SC68file_diskname() function opens, reads and closes given file to determine if it is a valid SC68 file. In the same time it tries to retrieve the stored disk name into the dest buffer with a maximum length of max bytes. If the name overflows, the last byte of the dest buffer will be non zero.

Parameters:
is input stream
dest disk name destination buffer
max number of bytes of dest buffer
Returns:
error-code
Return values:
0 success, found a disk-name
<0 failure, file error, invalid SC68 file or disk-name not found
See also:
SC68file_load()

SC68file_save()

SC68file_diskname()

Deprecated:
This function needs to be rewrite.

int SC68file_is_our_file const char *  url,
const char *  exts,
int *  is_remote
 

Check if an URL is a standard sc68 one.

Parameters:
url URL to check
exts extension list. (0 is default: ".sc68\0.sndh\0.snd\0").
is_remote fill with 0/1 if respectevely URL is a local/remote file. May be 0.

disk68_t* SC68file_load istream_t is  ) 
 

Load SC68 file from stream.

The SC68file_load() function allocates memory and loads an SC68 file. The function performs all necessary initializations in the returned disk68_t structure. A single buffer has been allocated including disk68_t structure followed by music data. It is user charge to free memory by calling SC68_free() function.

Parameters:
is input stream
Returns:
pointer to allocated disk68_t disk structure
Return values:
0 failure
See also:
SC68file_verify()

SC68file_save()

disk68_t* SC68file_load_file const char *  fname  ) 
 

Load SC68 file.

Parameters:
fname path to file to load.

disk68_t* SC68file_load_mem const void *  buffer,
int  len
 

Load SC68 file mapped into memory buffer.

Parameters:
buffer buffer address
len buffer length

int SC68file_save istream_t os,
const disk68_t mb,
int  gzip
 

Save SC68 disk into stream.

Parameters:
os output stream (must be seekable)
mb pointer to SC68 disk to save
gzip gzip compression level [0:no-gzip, 1..9 or -1]
Returns:
error-code
Return values:
0 success
<0 failure
See also:
SC68file_load()

SC68file_verify()

SC68file_diskname()

int SC68file_save_file const char *  fname,
const disk68_t mb,
int  gzip
 

Save SC68 disk into file.

Parameters:
fname filename.
mb pointer to SC68 disk to save
gzip gzip compression level [0:no-gzip, 1..9 or -1]

int SC68file_save_mem const char *  buffer,
int  len,
const disk68_t mb,
int  gzip
 

Save SC68 disk into memory buffer.

Parameters:
buffer destination buffer.
len size of destination buffer.
mb pointer to SC68 disk to save
gzip gzip compression level [0:no-gzip, 1..9 or -1]


Variable Documentation

const char SC68file_idstr[]
 

SC68 file identifier string.

See also:
SC68_IDSTR

const char SC68file_idstr_v2[12]
 

SC68 file identifier string V2.

See also:
SC68_IDSTR_V2