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

Sebastian Vater cdgs.basty at googlemail.com
Thu Jul 15 14:32:02 CEST 2010


Vitor Sessak a écrit :
> On 07/13/2010 10:01 PM, Sebastian Vater wrote:
>>
>> Can be moved to AVSequencerPlayerGlobals but would make some of the
>> playback code requiring more accesses, but I will fix this!

Fixed.

>
> Ok, but does the player need to know this value or it could just fail
> if the song use more recursion depth than the player support?

Yes, of course has to know the maximum values, otherwise it would not
know if it writes to uninitialized memory. In case of overflow the last
stack element is simply overwritten...

>
>>>>      /** Stack size, i.e. maximum recursion depth of the pattern loop
>>>>         command, which defaults to 1 to imitate most trackers.  */
>>>>      uint16_t loop_stack_size;
>>>> #define AVSEQ_SONG_PATTERN_LOOP_STACK   1
>>>
>>> Again, is this specified in the file?
>>
>> This is, however, is the standard (and even only possible value) for all
>> non-TuComposer trackers, no trackers otherwise allow nesting of the
>> pattern loop command.
>
> same.

Fixed.

>>>
>>>>      /** Initial MED style SPD speed (defaults to 33 as in
>>>>         OctaMED Soundstudio).  */
>>>>      uint16_t spd_speed;
>>>> #define AVSEQ_SONG_SPD_SPEED    33
>>>>
>>>>      /** Initial number of rows per beat (defaults to 4 rows are a
>>>> beat).  */
>>>>      uint16_t bpm_tempo;
>>>> #define AVSEQ_SONG_BPM_TEMPO    4
>>>>
>>>>      /** Initial beats per minute speed (defaults to 50 Hz =>  125
>>>> BpM).  */
>>>>      uint16_t bpm_speed;
>>>> #define AVSEQ_SONG_BPM_SPEED    125
>>>
>>>>      /** Minimum and lower limit of number of frames per row
>>>>         (defaults to 1).  */
>>>>      uint16_t frames_min;
>>>> #define AVSEQ_SONG_FRAMES_MIN   1
>>>
>>> Again, does this limit depend of the file format or is read directly
>>> from the file?
>>
>> Frames (=tempo) 0 is allocated for mark song end, which does not make
>> sense as a start tempo in sub-songs, which would mean that the whole
>> sub-song would initialized with song end at the very beginning.
>>
>> Allowing tempo 0 is like division by zero, it does not make sense,
>> because otherwise infinite rows and tracks would be processed in just
>> one tick.

Fixed.

>
> Yes, so why is this a variable not a define? What happens with the
> player if a file specifies frames_min == 2 and this field is
> erroneously initialized frames_min == 1?
>
>>>
>>>>      /** Maximum and upper limit of number of frames per row
>>>>         (defaults to 255).  */
>>>>      uint16_t frames_max;
>>>> #define AVSEQ_SONG_FRAMES_MAX   255
>>>>
>>>>      /** Minimum and lower limit of MED style SPD timing values
>>>>         (defaults to 1).  */
>>>>      uint16_t spd_min;
>>>> #define AVSEQ_SONG_SPD_MIN  1
>>>>
>>>>      /** Maximum and upper limit of MED style SPD timing values
>>>>         (defaults to 255).  */
>>>>      uint16_t spd_max;
>>>> #define AVSEQ_SONG_SPD_MAX  255
>>>>
>>>>      /** Minimum and lower limit of rows per beat timing values
>>>>         (defaults to 1).  */
>>>>      uint16_t bpm_tempo_min;
>>>> #define AVSEQ_SONG_BPM_TEMPO_MIN    1
>>>>
>>>>      /** Maximum and upper limit of rows per beat timing values
>>>>         (defaults to 255).  */
>>>>      uint16_t bpm_tempo_max;
>>>> #define AVSEQ_SONG_BPM_TEMPO_MAX    255
>>>>
>>>>      /** Minimum and lower limit of beats per minute timing values
>>>>         (defaults to 1).  */
>>>>      uint16_t bpm_speed_min;
>>>> #define AVSEQ_SONG_BPM_SPEED_MIN    1
>>>>
>>>>      /** Maximum and upper limit of beats per minute timing values
>>>>         (defaults to 255).  */
>>>>      uint16_t bpm_speed_max;
>>>> #define AVSEQ_SONG_BPM_SPEED_MAX    255
>>>
>>> Same for those.
>>
>> Would overflow multiply in playback time calculation for larger
>> values...and also does not make sense, see track effects, they all set
>> 8-bit values only, if we would allow a higher speed here, we could never
>> change the speed values which are larger than 255.
>
> same.

Fixed.

>
>>>
>>>>      /** Global volume of this sub-song. All other volume related
>>>>         commands are scaled by this (defaults to 255 = no
>>>> scaling).  */
>>>>      uint8_t global_volume;
>>>> #define AVSEQ_SONG_VOLUME   255
>>>>
>>>>      /** Global sub-volume of this sub-song. This is basically
>>>>         volume divided by 256, but the sub-volume doesn't account
>>>>         into actual mixer output (defaults to 0).  */
>>>>      uint8_t global_sub_volume;
>>>> #define AVSEQ_SONG_SUB_VOLUME   0
>>>>
>>>>      /** Global panning of this sub-song. All other panning related
>>>>         commands are scaled by this stereo separation factor
>>>>         (defaults to 0 which means full stereo separation).  */
>>>>      uint8_t global_panning;
>>>> #define AVSEQ_SONG_PANNING  0
>>>>
>>>>      /** Global sub-panning of this sub-song. This is basically
>>>>         panning divided by 256, but the sub-panning doesn't account
>>>>         into actual mixer output (defaults to 0).  */
>>>>      uint8_t global_sub_panning;
>>>> #define AVSEQ_SONG_SUB_PANNING  0
>>>
>>> Again, a file can specify those, no? Or they are parameters for the
>>> player?
>>
>> Yes, although TuComposer itself is the only one now who does support
>> this, after extending from 8-bit to 16-bit I have had to find an usage
>> for the lower 8-bits of the data word of track effects, these allow
>> setting it.
>>
>> But remember again, all stuff in
>> module.h/song.h/order.h/track.h/instr.h/sample.h/synth.h is supposed to
>> be changed by editors, too. Only player.h is mostly read-only for
>> external applications.
>
> I don't understand this point. What can an editor do that cannot be
> read from a file? In which struct should I set the player parameters
> that are independent of the song (i.e, some global volume to scale the
> song global volume, or if the player should output floats or s16le or
> s32le)? It does not belongs to the BSS anyway...

The player initializes his internal structures from them. There are
default values for each sub-song, which are used at start of playback.

-- 

Best regards,
                   :-) Basty/CDGS (-:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: song.h_20100715.patch
Type: text/x-diff
Size: 9494 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-soc/attachments/20100715/c48da8e0/attachment.patch>


More information about the FFmpeg-soc mailing list