[FFmpeg-soc] [soc] libavsequencer [PATCH 02/08] Sub-song public API header file.

Vitor Sessak vitor1001 at gmail.com
Sat Jul 10 18:46:39 CEST 2010


On 07/07/2010 10:46 PM, Sebastian Vater wrote:
>
> diff --git a/libavsequencer/song.h b/libavsequencer/song.h

[...]

> +    /** Integer indexed tree root of track data used by this sub-song
> +       with AVTreeNode->elem being a AVSequencerTrack.  */
> +    AVTreeNode *track_list;
> +
> +    /** Stack pointer for the GoSub command. This stores the
> +       return values of the order data and track row for
> +       recursive calls.  */
> +    uint16_t *gosub_stack;
> +
> +    /** Stack pointer for the pattern loop command. This stores
> +        the loop start and loop count for recursive loops.  */
> +    uint16_t *loop_stack;
> +

This struct mixes variables needed to play a sample and variables needed 
to describe the sample. This is bad for readability (besides being 
incompatible with the design as I see it).

> +    /** Compatibility flags for playback. There are rare cases
> +       where effect handling can not be mapped into internal
> +       playback engine and have to be handled specially. For
> +       each sub-song which needs this, this will define new
> +       flags which tag the player to handle it to that special
> +       way.  */
> +    int8_t compat_flags;
> +#define AVSEQ_SONG_COMPAT_FLAG_SYNC             0x01 ///< Tracks are synchronous (linked together, pattern based)
> +#define AVSEQ_SONG_COMPAT_FLAG_GLOBAL_LOOP      0x02 ///< Global pattern loop memory
> +#define AVSEQ_SONG_COMPAT_FLAG_AMIGA_LIMITS     0x04 ///< Enforce AMIGA sound hardware limits (portamento)
> +#define AVSEQ_SONG_COMPAT_FLAG_OLD_VOLUMES      0x08 ///< All volume related commands range from 0-64 instead of 0-255
> +#define AVSEQ_SONG_COMPAT_FLAG_GLOBAL_NEW_ONLY  0x10 ///< Global volume/panning changes affect new notes only (S3M)


enum AVSeqCompatFlags {
     AVSEQ_SONG_COMPAT_FLAG_SYNC        = 0x01;
     AVSEQ_SONG_COMPAT_FLAG_GLOBAL_LOOP = 0x02;
...
};


and in the struct:

enum AVSeqCompatFlags flags;

Same elsewhere.

> +    /** Song playback flags. Some sequencers use a totally
> +       different timing scheme which has to be taken care
> +       specially in the internal playback engine. Also
> +       sequencers differ in how they handle slides.  */
> +    int8_t flags;
> +#define AVSEQ_SONG_FLAG_LINEAR_FREQ_TABLE   0x01 ///< Use linear instead of Amiga frequency table
> +#define AVSEQ_SONG_FLAG_SPD                 0x02 ///< Use SPD (OctaMED style) timing instead of BpM
> +#define AVSEQ_SONG_FLAG_MONO                0x04 ///< Use mono instead of stereo output
> +#define AVSEQ_SONG_FLAG_SURROUND            0x08 ///< Initial global surround instead of stereo panning
> +
> +    /** Maximum number of host channels, as edited in the track view.
> +       to be allocated and usable for order list (defaults to 16).  */
> +    uint16_t channels;
> +#define AVSEQ_SONG_CHANNELS     16
> +#define AVSEQ_SONG_CHANNELS_MIN 1
> +#define AVSEQ_SONG_CHANNELS_MAX 256
> +
> +    /** Initial number of frames per row, i.e. sequencer tempo
> +       (defaults to 6 as in most tracker formats).  */
> +    uint16_t frames;
> +#define AVSEQ_SONG_FRAMES   6

#define AVSEQ_SONG_FRAMES_DEFAULT   6

But I suspect it is better to replace all this defines by a function 
ff_sequencer_fill_defaults()...

-Vitor


More information about the FFmpeg-soc mailing list