Michael Niedermayer a écrit : > On Wed, Jul 07, 2010 at 10:49:34PM +0200, Sebastian Vater wrote: > > [...] > >> + /** 0x01: KILL vX+YYYY >> + Stops and frees current channel, most likely to be used in NNA >> + handling code. vX+YYYY is the number of ticks to wait before >> + the channel actually will be killed. Synth code instruction >> + processing continues as normally until the wait counter has >> + been reached. Please note that even with YYYY set to zero, all >> + instructions executing in the same tick as the KILL instruction >> + will continue do so. If you don't want this, just place a STOP >> + instruction straight afterwards. */ >> +#define AVSEQ_SYNTH_CODE_INSTRUCTION_KILL 0x01 >> + >> + /** 0x02: WAIT vX+YYYY >> + Waits the given amount in ticks specified by vX+YYYY before >> + continue processing of synth code instructions. */ >> +#define AVSEQ_SYNTH_CODE_INSTRUCTION_WAIT 0x02 >> + >> + /** 0x03: WAITVOL vX+YYYY >> + Waits until the volume handling code has reached the line >> + specified by vX+YYYY. The delay can be until song end if >> + the volume code never reaches the specified line. */ >> +#define AVSEQ_SYNTH_CODE_INSTRUCTION_WAITVOL 0x03 >> + >> + /** 0x04: WAITPAN vX+YYYY >> + Waits until the panning handling code has reached the line >> + specified by vX+YYYY. The delay can be until song end if >> + the panning code never reaches the specified line. */ >> +#define AVSEQ_SYNTH_CODE_INSTRUCTION_WAITPAN 0x04 >> + >> + /** 0x05: WAITSLD vX+YYYY >> + Waits until the slide handling code has reached the line >> + specified by vX+YYYY. The delay can be until song end if >> + the slide code never reaches the specified line. */ >> +#define AVSEQ_SYNTH_CODE_INSTRUCTION_WAITSLD 0x05 >> + >> + /** 0x06: WAITSPC vX+YYYY >> + Waits until the special handling code has reached the line >> + specified by vX+YYYY. The delay can be until song end if >> + the special code never reaches the specified line. */ >> +#define AVSEQ_SYNTH_CODE_INSTRUCTION_WAITSPC 0x06 >> + >> + /** 0x07: JUMP vX+YYYY >> + Jumps to the target line number within the same synth >> + code specified by vX+YYYY. */ >> +#define AVSEQ_SYNTH_CODE_INSTRUCTION_JUMP 0x07 >> + >> + /** 0x08: JUMPEQ vX+YYYY >> + Jumps to the target line number within the same synth >> + code specified by vX+YYYY if the zero flag of the >> + condition variable is set otherwise do nothing. */ >> +#define AVSEQ_SYNTH_CODE_INSTRUCTION_JUMPEQ 0x08 >> + >> + /** 0x09: JUMPNE vX+YYYY >> + Jumps to the target line number within the same synth >> + code specified by vX+YYYY if the zero flag of the >> + condition variable is cleared otherwise do nothing. */ >> +#define AVSEQ_SYNTH_CODE_INSTRUCTION_JUMPNE 0x09 >> + >> + /** 0x0A: JUMPPL vX+YYYY >> + Jumps to the target line number within the same synth >> + code specified by vX+YYYY if the negative flag of the >> + condition variable is cleared otherwise do nothing. */ >> +#define AVSEQ_SYNTH_CODE_INSTRUCTION_JUMPPL 0x0A >> + >> + /** 0x0B: JUMPMI vX+YYYY >> + Jumps to the target line number within the same synth >> + code specified by vX+YYYY if the negative flag of the >> + condition variable is set otherwise do nothing. */ >> +#define AVSEQ_SYNTH_CODE_INSTRUCTION_JUMPMI 0x0B >> + >> + /** 0x0C: JUMPLT vX+YYYY >> + Jumps to the target line number within the same synth >> + code specified by vX+YYYY if either the negative or >> + the overflow flag of the condition variable are set, >> + like a signed less than comparision, otherwise will >> + do nothing. */ >> +#define AVSEQ_SYNTH_CODE_INSTRUCTION_JUMPLT 0x0C >> + >> > > that all looks like it should use a enum >
Will do this in the following days, changing this will require huge changes in player.c > > [...] > >> + /** Initial status of volume variable condition status register. */ >> + uint16_t vol_cond_var; >> +#define AVSEQ_SYNTH_VOL_COND_VAR_CARRY 0x01 ///< Carry (C) bit for >> volume condition variable >> +#define AVSEQ_SYNTH_VOL_COND_VAR_OVERFLOW 0x02 ///< Overflow (V) bit for >> volume condition variable >> +#define AVSEQ_SYNTH_VOL_COND_VAR_ZERO 0x04 ///< Zero (Z) bit for >> volume condition variable >> +#define AVSEQ_SYNTH_VOL_COND_VAR_NEGATIVE 0x08 ///< Negative (N) bit for >> volume condition variable >> +#define AVSEQ_SYNTH_VOL_COND_VAR_EXTEND 0x10 ///< Extend (X) bit for >> volume condition variable >> + >> + /** Initial status of panning variable condition status register. */ >> + uint16_t pan_cond_var; >> +#define AVSEQ_SYNTH_PAN_COND_VAR_CARRY 0x01 ///< Carry (C) bit for >> panning condition variable >> +#define AVSEQ_SYNTH_PAN_COND_VAR_OVERFLOW 0x02 ///< Overflow (V) bit for >> panning condition variable >> +#define AVSEQ_SYNTH_PAN_COND_VAR_ZERO 0x04 ///< Zero (Z) bit for >> panning condition variable >> +#define AVSEQ_SYNTH_PAN_COND_VAR_NEGATIVE 0x08 ///< Negative (N) bit for >> panning condition variable >> +#define AVSEQ_SYNTH_PAN_COND_VAR_EXTEND 0x10 ///< Extend (X) bit for >> panning condition variable >> + >> + /** Initial status of slide variable condition status register. */ >> + uint16_t slide_cond_var; >> +#define AVSEQ_SYNTH_SLD_COND_VAR_CARRY 0x01 ///< Carry (C) bit for >> slide condition variable >> +#define AVSEQ_SYNTH_SLD_COND_VAR_OVERFLOW 0x02 ///< Overflow (V) bit for >> slide condition variable >> +#define AVSEQ_SYNTH_SLD_COND_VAR_ZERO 0x04 ///< Zero (Z) bit for slide >> condition variable >> +#define AVSEQ_SYNTH_SLD_COND_VAR_NEGATIVE 0x08 ///< Negative (N) bit for >> slide condition variable >> +#define AVSEQ_SYNTH_SLD_COND_VAR_EXTEND 0x10 ///< Extend (X) bit for >> slide condition variable >> + >> + /** Initial status of special variable condition status register. */ >> + uint16_t special_cond_var; >> +#define AVSEQ_SYNTH_SPC_COND_VAR_CARRY 0x01 ///< Carry (C) bit for >> special condition variable >> +#define AVSEQ_SYNTH_SPC_COND_VAR_OVERFLOW 0x02 ///< Overflow (V) bit for >> special condition variable >> +#define AVSEQ_SYNTH_SPC_COND_VAR_ZERO 0x04 ///< Zero (Z) bit for >> special condition variable >> +#define AVSEQ_SYNTH_SPC_COND_VAR_NEGATIVE 0x08 ///< Negative (N) bit for >> special condition variable >> +#define AVSEQ_SYNTH_SPC_COND_VAR_EXTEND 0x10 ///< Extend (X) bit for >> special condition variable >> > > these defines are repeated, i guess that could be avoided > the same seems true for other flags in this file > Fixed. > also there are a huge number of large headers, is all this needed as public > interface between file reading - playing - editing - writing? > Yes, of course. A tracker should give possibility to edit all fields which change module data. Please note that the synth sound assembler was planned from me for end-users also, so they can fully customize their synthesized sounds. -- Best regards, :-) Basty/CDGS (-:
diff --git a/libavsequencer/synth.h b/libavsequencer/synth.h index c5925a8..95d4699 100755 --- a/libavsequencer/synth.h +++ b/libavsequencer/synth.h @@ -22,8 +22,7 @@ #ifndef AVSEQUENCER_SYNTH_H #define AVSEQUENCER_SYNTH_H -#include "libavsequencer/instr.h" -#include "libavutil/tree.h" +#include "libavformat/avformat.h" /** * Synth table. Used for both assembling and disassembling. @@ -41,7 +40,7 @@ typedef struct AVSequencerSynthTable { uint8_t code; /** Input and output flags for this synth code instruction. */ - int8_t flags; + uint8_t flags; #define AVSEQ_SYNTH_TABLE_SRC 0x01 ///< Source parameter required #define AVSEQ_SYNTH_TABLE_SRC_LINE 0x02 ///< Source parameter is a line number #define AVSEQ_SYNTH_TABLE_SRC_NO_V0 0x04 ///< Don't display source variable if v0 @@ -63,7 +62,7 @@ typedef struct AVSequencerSynthWave { /** Metadata information: Original waveform file name, waveform * name, artist and comment. */ - AVSequencerMetadata *metadata; + AVMetadata *metadata; /** Pointer to raw waveform data, must be padded for perfect perfomance gain when accessing sample data. @@ -89,13 +88,9 @@ typedef struct AVSequencerSynthWave { non-looping waveforms or allow switching between 8-bit and 16-bit waveforms which have to be taken care specially in the internal playback engine. */ - int16_t flags; + uint16_t flags; #define AVSEQ_SYNTH_WAVE_FLAGS_NOLOOP 0x0080 ///< Don't loop the waveform #define AVSEQ_SYNTH_WAVE_FLAGS_8BIT 0x8000 ///< 8-bit waveform instead of a 16-bit one, the GETxxxW instructions return 8-bit values in the upper 8-bits of the 16-bit result - - /** This is just a data field where the user solely - decides, what the usage (if any) will be. */ - uint8_t *user_data; } AVSequencerSynthWave; /** @@ -1210,12 +1205,8 @@ typedef struct AVSequencerSynthSymbolTable { /** Special symbol flags for this symbol. These flags contains stuff like if the symbol is currently disabled or enabled so it can be turned off without deleting it. */ - int8_t flags; + uint8_t flags; #define AVSEQ_SYNTH_SYMBOL_TABLE_FLAGS_UNUSED 0x80 ///< Symbol is currently disabled, i.e. not evaluated - - /** This is just a data field where the user solely - decides, what the usage (if any) will be. */ - uint8_t *user_data; } AVSequencerSynthSymbolTable; /** @@ -1228,17 +1219,15 @@ typedef struct AVSequencerSynthSymbolTable { typedef struct AVSequencerSynth { /** Metadata information: Original synth file name, synth name, * artist and comment. */ - AVSequencerMetadata *metadata; + AVMetadata *metadata; - /** Integer indexed tree root of attached waveforms used by - this synth sound with AVTreeNode->elem of type - AVSequencerSynthWave. */ - AVTreeNode *waveform_list; + /** Array of pointers containing attached waveform used by this + synth sound. */ + AVSequencerSynthWave **waveform_list; - /** Integer indexed tree root of named symbols used by - this synth sound code with AVTreeNode->elem of type - AVSequencerSynthSymbolTable. */ - AVTreeNode *symbol_list; + /** Array of pointers containing named symbols used by this + synth sound code. */ + AVSequencerSynthSymbolTable **symbol_list; /** AVSequencerSynthCode pointer to synth sound code structure. */ AVSequencerSynthCode *code; @@ -1249,121 +1238,51 @@ typedef struct AVSequencerSynth { #define AVSEQ_SYNTH_WAVEFORMS 1 #define AVSEQ_SYNTH_WAVEFORMS_MAX 65535 + /** Number of named symbols used by this synth sound code. */ + uint16_t symbols; + /** Number of instructions (lines) in the synth sound execution code (defaults to one line). */ uint16_t size; #define AVSEQ_SYNTH_SIZE 1 - /** Entry position (line number) of volume handling code. */ - uint16_t volume_pos; - - /** Entry position (line number) of panning handling code. */ - uint16_t panning_pos; - - /** Entry position (line number) of slide handling code. */ - uint16_t slide_pos; - - /** Entry position (line number) of special handling code. */ - uint16_t special_pos; - - /** Entry position (line number) of sustain volume handling - code. This will position jump the code to the target - line number of a key off note is pressed. */ - uint16_t volume_sus_pos; - - /** Entry position (line number) of sustain panning handling - code. This will position jump the code to the target - line number of a key off note is pressed. */ - uint16_t panning_sus_pos; - - /** Entry position (line number) of sustain slide handling - code. This will position jump the code to the target - line number of a key off note is pressed. */ - uint16_t slide_sus_pos; - - /** Entry position (line number) of sustain special handling - code. This will position jump the code to the target - line number of a key off note is pressed. */ - uint16_t special_sus_pos; - - /** Entry position (line number) of volume handling code when - NNA has been triggered. This allows a complete custom new - note action to be defined. */ - uint16_t vol_nna_pos; - - /** Entry position (line number) of panning handling code when - NNA has been triggered. This allows a complete custom new - note action to be defined. */ - uint16_t pan_nna_pos; - - /** Entry position (line number) of slide handling code when - NNA has been triggered. This allows a complete custom new - note action to be defined. */ - uint16_t slide_nna_pos; - - /** Entry position (line number) of special handling code when - NNA has been triggered. This allows a complete custom new - note action to be defined. */ - uint16_t special_nna_pos; - - /** Entry position (line number) of volume handling code when - DNA has been triggered. This allows a complete custom - duplicate note action to be defined. */ - uint16_t vol_dna_pos; - - /** Entry position (line number) of panning handling code when - DNA has been triggered. This allows a complete custom - duplicate note action to be defined. */ - uint16_t pan_dna_pos; - - /** Entry position (line number) of slide handling code when - DNA has been triggered. This allows a complete custom - duplicate note action to be defined. */ - uint16_t slide_dna_pos; - - /** Entry position (line number) of special handling code when - DNA has been triggered. This allows a complete custom - duplicate note action to be defined. */ - uint16_t special_dna_pos; + /** Entry position (line number) of volume [0], panning [1], slide + [2] and special [3] handling code. */ + uint16_t entry_pos[4]; + + /** Sustain entry position (line number) of volume [0], panning + [1], slide [2] and special [3] handling code. This will + position jump the code to the target line number of a key off + note is pressed. */ + uint16_t sustain_pos[4]; + + /** Entry position (line number) of volume [0], panning [1], slide + [2] and special [3] handling code when NNA has been triggered. + This allows a complete custom new note action to be + defined. */ + uint16_t nna_pos[4]; + + /** Entry position (line number) of volume [0], panning [1], slide + [2] and special [3] handling code when DNA has been triggered. + This allows a complete custom duplicate note action to be + defined. */ + uint16_t dna_pos[4]; /** Contents of the 16 variable registers (v0-v15). */ uint16_t variable[16]; - /** Initial status of volume variable condition status register. */ - uint16_t vol_cond_var; -#define AVSEQ_SYNTH_VOL_COND_VAR_CARRY 0x01 ///< Carry (C) bit for volume condition variable -#define AVSEQ_SYNTH_VOL_COND_VAR_OVERFLOW 0x02 ///< Overflow (V) bit for volume condition variable -#define AVSEQ_SYNTH_VOL_COND_VAR_ZERO 0x04 ///< Zero (Z) bit for volume condition variable -#define AVSEQ_SYNTH_VOL_COND_VAR_NEGATIVE 0x08 ///< Negative (N) bit for volume condition variable -#define AVSEQ_SYNTH_VOL_COND_VAR_EXTEND 0x10 ///< Extend (X) bit for volume condition variable - - /** Initial status of panning variable condition status register. */ - uint16_t pan_cond_var; -#define AVSEQ_SYNTH_PAN_COND_VAR_CARRY 0x01 ///< Carry (C) bit for panning condition variable -#define AVSEQ_SYNTH_PAN_COND_VAR_OVERFLOW 0x02 ///< Overflow (V) bit for panning condition variable -#define AVSEQ_SYNTH_PAN_COND_VAR_ZERO 0x04 ///< Zero (Z) bit for panning condition variable -#define AVSEQ_SYNTH_PAN_COND_VAR_NEGATIVE 0x08 ///< Negative (N) bit for panning condition variable -#define AVSEQ_SYNTH_PAN_COND_VAR_EXTEND 0x10 ///< Extend (X) bit for panning condition variable - - /** Initial status of slide variable condition status register. */ - uint16_t slide_cond_var; -#define AVSEQ_SYNTH_SLD_COND_VAR_CARRY 0x01 ///< Carry (C) bit for slide condition variable -#define AVSEQ_SYNTH_SLD_COND_VAR_OVERFLOW 0x02 ///< Overflow (V) bit for slide condition variable -#define AVSEQ_SYNTH_SLD_COND_VAR_ZERO 0x04 ///< Zero (Z) bit for slide condition variable -#define AVSEQ_SYNTH_SLD_COND_VAR_NEGATIVE 0x08 ///< Negative (N) bit for slide condition variable -#define AVSEQ_SYNTH_SLD_COND_VAR_EXTEND 0x10 ///< Extend (X) bit for slide condition variable - - /** Initial status of special variable condition status register. */ - uint16_t special_cond_var; -#define AVSEQ_SYNTH_SPC_COND_VAR_CARRY 0x01 ///< Carry (C) bit for special condition variable -#define AVSEQ_SYNTH_SPC_COND_VAR_OVERFLOW 0x02 ///< Overflow (V) bit for special condition variable -#define AVSEQ_SYNTH_SPC_COND_VAR_ZERO 0x04 ///< Zero (Z) bit for special condition variable -#define AVSEQ_SYNTH_SPC_COND_VAR_NEGATIVE 0x08 ///< Negative (N) bit for special condition variable -#define AVSEQ_SYNTH_SPC_COND_VAR_EXTEND 0x10 ///< Extend (X) bit for special condition variable + /** Initial status of volume [0], panning [1], slide [2] and + special [3] variable condition status register. */ + uint16_t cond_var[4]; +#define AVSEQ_SYNTH_COND_VAR_CARRY 0x01 ///< Carry (C) bit for condition variable +#define AVSEQ_SYNTH_COND_VAR_OVERFLOW 0x02 ///< Overflow (V) bit for condition variable +#define AVSEQ_SYNTH_COND_VAR_ZERO 0x04 ///< Zero (Z) bit for condition variable +#define AVSEQ_SYNTH_COND_VAR_NEGATIVE 0x08 ///< Negative (N) bit for condition variable +#define AVSEQ_SYNTH_COND_VAR_EXTEND 0x10 ///< Extend (X) bit for condition variable /** Use NNA trigger entry fields. This will run custom synth sound code execution on a new note action trigger. */ - int8_t use_nna_flags; + uint8_t use_nna_flags; #define AVSEQ_SYNTH_USE_NNA_FLAGS_VOLUME_NNA 0x01 ///< Use NNA trigger entry field for volume #define AVSEQ_SYNTH_USE_NNA_FLAGS_PANNING_NNA 0x02 ///< Use NNA trigger entry field for panning #define AVSEQ_SYNTH_USE_NNA_FLAGS_SLIDE_NNA 0x04 ///< Use NNA trigger entry field for slide @@ -1375,7 +1294,7 @@ typedef struct AVSequencerSynth { /** Use sustain entry position fields. This will run custom synth sound code execution on a note off trigger. */ - int8_t use_sustain_flags; + uint8_t use_sustain_flags; #define AVSEQ_SYNTH_USE_SUSTAIN_FLAGS_VOLUME 0x01 ///< Use sustain entry position field for volume #define AVSEQ_SYNTH_USE_SUSTAIN_FLAGS_PANNING 0x02 ///< Use sustain entry position field for panning #define AVSEQ_SYNTH_USE_SUSTAIN_FLAGS_SLIDE 0x04 ///< Use sustain entry position field for slide @@ -1412,20 +1331,16 @@ typedef struct AVSequencerSynth { values), e.g. bit 5 set will keep variable 5 (v5). */ int16_t var_keep_mask; - /** 64-bit integer indexed unique key tree root of unknown data - fields for input file reading with AVTreeNode->elem being - unsigned 8-bit integer data. Some formats are chunk based + /** Array of pointers containing every unknown data field where + the last element is indicated by a NULL pointer reference. The + first 64-bit of the unknown data contains an unique identifier + for this chunk and the second 64-bit data is actual unsigned + length of the following raw data. Some formats are chunk based and can store information, which can't be handled by some - other, in case of a transition the unknown data is kept as - is. Some programs write editor settings for synth sounds in - chunks, which won't get lost then. The first 8 bytes of this - data is an unsigned 64-bit integer length in bytes of - the unknown data. */ - AVTreeNode *unknown_data; - - /** This is just a data field where the user solely - decides, what the usage (if any) will be. */ - uint8_t *user_data; + other, in case of a transition the unknown data is kept as is. + Some programs write editor settings for synth sounds in those + chunks, which then won't get lost in that case. */ + uint8_t **unknown_data; } AVSequencerSynth; #endif /* AVSEQUENCER_SYNTH_H */
_______________________________________________ FFmpeg-soc mailing list FFmpeg-soc@mplayerhq.hu https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-soc