/
avsequencer.h
1534 lines (1401 loc) · 63.6 KB
/
avsequencer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* AVSequencer main header file which connects to AVFormat and AVCodec
* Copyright (c) 2010 Sebastian Vater <cdgs.basty@googlemail.com>
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVSEQUENCER_AVSEQUENCER_H
#define AVSEQUENCER_AVSEQUENCER_H
#define LIBAVSEQUENCER_VERSION_MAJOR 0
#define LIBAVSEQUENCER_VERSION_MINOR 0
#define LIBAVSEQUENCER_VERSION_MICRO 0
#define LIBAVSEQUENCER_VERSION_INT AV_VERSION_INT(LIBAVSEQUENCER_VERSION_MAJOR, \
LIBAVSEQUENCER_VERSION_MINOR, \
LIBAVSEQUENCER_VERSION_MICRO)
#define LIBAVSEQUENCER_VERSION AV_VERSION(LIBAVSEQUENCER_VERSION_MAJOR, \
LIBAVSEQUENCER_VERSION_MINOR, \
LIBAVSEQUENCER_VERSION_MICRO)
#define LIBAVSEQUENCER_BUILD LIBAVSEQUENCER_VERSION_INT
#define LIBAVSEQUENCER_IDENT "Lavsequencer" AV_STRINGIFY(LIBAVSEQUENCER_VERSION)
/**
* Return LIBAVSEQUENCER_VERSION_INT constant.
*/
unsigned avsequencer_version(void);
/**
* Return the libavsequencer build-time configuration.
*/
const char *avsequencer_configuration(void);
/**
* Return the libavsequencer license.
*/
const char *avsequencer_license(void);
#include "libavutil/log.h"
#include "libavformat/avformat.h"
#include "libavcodec/avcodec.h"
#include "libavsequencer/mixer.h"
#include "libavsequencer/module.h"
#include "libavsequencer/song.h"
/**
* Sequencer context structure which is the very root of the
* sequencer. It manages all modules currently in memory, controls
* the playback stuff and declares some customizable lookup tables
* for very strange sound formats. Also all registered mixing engines
* are stored in this structure.
* New fields can be added to the end with minor version bumps.
* Removal, reordering and changes to existing fields require a major
* version bump.
*/
typedef struct AVSequencerContext {
/**
* information on struct for av_log
* - set by avseq_alloc_context
*/
const AVClass *av_class;
/** Associated decoder packet for this sequencer context. */
AVPacket *pkt;
/** AVSequencerPlayerGlobals pointer to global channel data. */
struct AVSequencerPlayerGlobals *player_globals;
/** AVSequencerPlayerHostChannel pointer to host channel data. */
struct AVSequencerPlayerHostChannel *player_host_channel;
/** AVSequencerPlayerChannel pointer to virtual channel data. */
struct AVSequencerPlayerChannel *player_channel;
/** AVSequencerPlayerHook pointer to callback hook. */
struct AVSequencerPlayerHook *player_hook;
/** Current module used by current playback handler or NULL if
no module is currently being processed. */
AVSequencerModule *player_module;
/** Current sub-song used by current playback handler or NULL
if no sub-song is currently being processed. */
AVSequencerSong *player_song;
/** Current mixing engine used by current playback handler
or NULL if there is no module and sub-song being processed. */
AVMixerData *player_mixer_data;
/** Pointer to sine table for very fast sine calculation. Value
is sin(x)*32767 with one element being one degree or NULL to
use the internal one. */
int16_t *sine_lut;
/** Pointer to linear frequency table for non-Amiga slide modes.
Value is 65536*2^(x/3072) or NULL to use the internal one. */
uint16_t *linear_frequency_lut;
/** Pointer to note calculation frequency table. Value is
65536*2^(x/12) or NULL to use the internal one. */
uint32_t *frequency_lut;
/** Pointer to old SoundTracker tempo definition table or NULL to
use the internal one. */
uint32_t *old_st_lut;
/** Pointer to playback handler effects table which contains all the
definition for effect commands like arpeggio, vibrato, slides or
NULL to use the internal one. */
void *effects_lut;
/** Pointer to synth code instruction table which contains all the
names and specific flags for each instruction or NULL to use the
internal one. */
AVSequencerSynthTable *synth_code_lut;
/** Pointer to synth sound code execution table or NULL to use the
internal one. */
void *synth_code_exec_lut;
/** Array of pointers containing every module which is registered
and ready for access to the sequencer. */
AVSequencerModule **module_list;
/** Total amount of modules registered to the sequencer. */
uint16_t modules;
/** Array of pointers containing every mixing engine instance
which is registered and ready for access to the sequencer. */
AVMixerData **mixer_data_list;
/** Total amount of mixer instances registered to the
sequencer. */
uint16_t mixers;
/** Current randomization seed value for a very fast randomize
function used by volume, panning and pitch swing or envelopes
featuring randomized data instead of waveforms. */
uint32_t seed;
/** Executes one tick of the playback handler. */
int (*playback_handler)(AVMixerData *mixer_data);
} AVSequencerContext;
/** Registers all mixers to the AVSequencer.
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
void avsequencer_register_all(void);
/** Registers a mixer to the AVSequencer.
*
* @param mixctx the AVMixerContext to register
* @return >= 0 on success, a negative error code otherwise
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
int avseq_mixer_register(AVMixerContext *mixctx);
/** Gets a mixer by its name.
*
* @param name the name of the mixer to get
* @return pointer to mixer context on success, NULL otherwise
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
AVMixerContext *avseq_mixer_get_by_name(const char *name);
/** Gets the pointer to the next mixer context array.
*
* @param mixctx the AVMixerContext array of the next mixer to get
* @return pointer to next mixer context array on success, NULL otherwise
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
AVMixerContext **avseq_mixer_next(AVMixerContext **mixctx);
/** Uninitializes all the mixers registered to the AVSequencer.
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
void avsequencer_uninit(void);
/**
* Opens and registers a new AVSequencer context.
*
* @param mixctx the AVMixerContext to use as an initial mixer or NULL for none
* @param args The string of parameters to use when initializing the mixer.
* The format and meaning of this string varies by mixer.
* @param opaque The xtra non-string data needed by the mixer. The meaning
* of this parameter varies by mixer.
* @return pointer to registered AVSequencerContext, NULL otherwise
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
AVSequencerContext *avsequencer_open(AVMixerContext *mixctx,
const char *args, void *opaque);
/** Recursively destroys the AVSequencerContext and frees all memory.
*
* @param avctx the AVSequencerContext to be destroyed recursively
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
void avsequencer_destroy(AVSequencerContext *avctx);
/**
* Opens and initializes a new AVSequencer mixer context.
*
* @param mixctx the AVMixerContext to initialize
* @param args The string of parameters to use when initializing the mixer.
* The format and meaning of this string varies by mixer.
* @param opaque The xtra non-string data needed by the mixer. The meaning
* of this parameter varies by mixer.
* @return pointer to the new mixer data used for mixing, NULL otherwise
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
AVMixerData *avseq_mixer_init(AVSequencerContext *const avctx,
AVMixerContext *const mixctx,
const char *args, void *opaque);
/**
* Closes and uninitializes an AVSequencer mixer data container.
*
* @param avctx the AVSequencerContext to uninitialize the mixer from
* @param mixer_data the AVMixerData to uninitialize
* @return >= 0 on success, a negative error code otherwise
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
int avseq_mixer_uninit(AVSequencerContext *const avctx,
AVMixerData *const mixer_data);
/**
* Sets and transfers a new mixing rate and number of output
* channels to the mixing engine.
*
* @param mixer_data the AVMixerData to set the new mixing rate and
* number of output channels of
* @param mix_rate the new mixing rate in Hz to use for mixing
* @param channels the new number of output channels to use for mixing
* @return the mixing rate in Hz which actually has been set
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
uint32_t avseq_mixer_set_rate(AVMixerData *const mixer_data,
const uint32_t mix_rate,
const uint32_t channels);
/**
* Sets and transfers a new tempo for the playback handler to the
* mixing engine.
*
* @param mixer_data the AVMixerData to set the new tempo
* @param tempo the new tempo in AV_TIME_BASE fractional seconds to use
* for mixing
* @return the tempo in AV_TIME_BASE fractional seconds which actually has been set
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
uint32_t avseq_mixer_set_tempo(AVMixerData *const mixer_data,
const uint32_t tempo);
/**
* Sets and transfers a new volume boost, left and right volume and
* number of channels to the mixing engine.
*
* @param mixer_data the AVMixerData to set the volume and channels
* @param amplify the new volume boost where a value of 65536 (=0x10000)
* indicates 100%
* @param left_volume the new left volume where a value of 65536 (=0x10000)
* indicates 100%
* @param right_volume the new volume boost where a value of 65536 (=0x10000)
* indicates 100%
* @param channels the new number of channels to be used for mixing
* @return the number of channels which actually have been set
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
uint32_t avseq_mixer_set_volume(AVMixerData *const mixer_data,
const uint32_t amplify,
const uint32_t left_volume,
const uint32_t right_volume,
const uint32_t channels);
/**
* Gets and transfers a channel data block from the internal mixing
* engine to the AVSequencer.
*
* @param mixer_data the AVMixerData to get the channel data block from
* @param mixer_channel the AVMixerChannel to be received from the
* internal mixing engine
* @param channel the number of channel to be received
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
void avseq_mixer_get_channel(const AVMixerData *const mixer_data,
AVMixerChannel *const mixer_channel,
const uint32_t channel);
/**
* Sets and transfers a channel data block from the AVSequencer to the
* internal mixing engine.
*
* @param mixer_data the AVMixerData to set the channel data block of
* @param mixer_channel the AVMixerChannel to be stored into the internal
* mixing engine
* @param channel the number of channel to be stored
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
void avseq_mixer_set_channel(AVMixerData *const mixer_data,
const AVMixerChannel *const mixer_channel,
const uint32_t channel);
/**
* Resets a channel data block from the AVSequencer by setting the
* mixer internal default values.
*
* @param mixer_data the AVMixerData to reset the channel data block of
* @param channel the number of channel to reset
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
void avseq_mixer_reset_channel(AVMixerData *const mixer_data,
const uint32_t channel);
/**
* Gets and transfers a channel data block from the internal mixing
* engine to the AVSequencer by receiving current and next sample
* data at once.
*
* @param mixer_data the AVMixerData to get the channel data block from
* @param mixer_channel_current the current AVMixerChannel to be
* received from the internal mixing engine
* @param mixer_channel_next the next AVMixerChannel to be received
* from the internal mixing engine
* @param channel the number of channel to be received
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
void avseq_mixer_get_both_channels(const AVMixerData *const mixer_data,
AVMixerChannel *const mixer_channel_current,
AVMixerChannel *const mixer_channel_next,
const uint32_t channel);
/**
* Sets and transfers a channel data block from the AVSequencer to the
* internal mixing engine by setting current and next sample data at
* once and reset all internal mixer variables (i.e. temporarily stored
* filter and interpolation values).
*
* @param mixer_data the AVMixerData to set the channel data block of
* @param mixer_channel_current the current AVMixerChannel to be stored
* into the internal mixing engine
* @param mixer_channel_next the next AVMixerChannel to be stored into
* the internal mixing engine
* @param channel the number of channel to be stored
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
void avseq_mixer_set_both_channels(AVMixerData *const mixer_data,
const AVMixerChannel *const mixer_channel_current,
const AVMixerChannel *const mixer_channel_next,
const uint32_t channel);
/**
* Fills the output mixing buffer by calculating all the input channel samples.
*
* @param mixer_data the AVMixerData to do the actual mixing step
* @param buf the target buffer to mix the output data to
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
void avseq_mixer_do_mix(AVMixerData *const mixer_data, int32_t *buf);
/**
* Fills the output mixing buffer by calculating all the input channel samples
* by allowing parallelization through specifying a channel range to be
* calculated by one thread.
*
* @param mixer_data the AVMixerData to do the actual mixing step
* @param buf the target buffer to mix the output data to
* @param first_channel the first channel to be mixed into the output
* buffer
* @param last_channel the last channel to be mixed into the output
* buffer
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
void avseq_mixer_do_mix_parallel(AVMixerData *const mixer_data,
int32_t *buf,
const uint32_t first_channel,
const uint32_t last_channel);
/**
* Creates a new uninitialized empty module.
*
* @return pointer to freshly allocated AVSequencerModule, NULL if allocation failed
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
AVSequencerModule *avseq_module_create(void);
/**
* Destroys a module by freeing its occupied memory.
*
* @param module the AVSequencerModule to be destroyed
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
void avseq_module_destroy(AVSequencerModule *module);
/**
* Opens and registers a module to the AVSequencer.
*
* @param avctx the AVSequencerContext to store the opened module into
* @param module the AVSequencerModule which has been opened to be registered
* @return >= 0 on success, a negative error code otherwise
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
int avseq_module_open(AVSequencerContext *avctx, AVSequencerModule *module);
/**
* Closes and unregisters module from the AVSequencer.
*
* @param avctx the AVSequencerContext to remove the module reference
* @param module the AVSequencerModule which has been opened to be unregistered
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
void avseq_module_close(AVSequencerContext *avctx, AVSequencerModule *module);
/**
* Changes module virtual channels to new number of channels specified.
*
* @param avctx the AVSequencerContext to update the number of virtual
* channels for playback
* @param module the AVSequencerModule to set the new number of virtual channels to
* @param channels the new amount of virtual channels to use
* @return >= 0 on success, a negative error code otherwise
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
int avseq_module_set_channels(AVSequencerContext *avctx, AVSequencerModule *module,
uint32_t channels);
/**
* Initializes the playback structures for playing back a sub-song in a module.
*
* @param avctx the AVSequencerContext to be initialized for playback
* @param mixctx the AVMixerContext to be initialized for playback
* @param module the AVSequencerModule to be initialized for playback
* @param song the AVSequencerSong to be initialized for playback
* @param args The string of parameters to use when initializing the mixer.
* The format and meaning of this string varies by mixer.
* @param opaque The xtra non-string data needed by the mixer. The meaning
* of this parameter varies by mixer.
* @param mode the playback mode to use, 0 is one-shoot playback and 1 is looping
* @return >= 0 on success, a negative error code otherwise
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
int avseq_module_play(AVSequencerContext *avctx, AVMixerContext *mixctx,
AVSequencerModule *module, AVSequencerSong *song,
const char *args, void *opaque, uint32_t mode);
/**
* Uninitializes the playback structures of sub-song of a module playback.
*
* @param avctx the AVSequencerContext to be uninitialized for playback
* @param mode the uninitialize mode to use, 0 is mixer only (pause) and 1 is all (stop)
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
void avseq_module_stop(AVSequencerContext *avctx, uint32_t mode);
/**
* Creates a new uninitialized empty sub-song.
*
* @return pointer to freshly allocated AVSequencerSong, NULL if allocation failed
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
AVSequencerSong *avseq_song_create(void);
/**
* Destroys a sub-song by freeing its occupied memory.
*
* @param song the AVSequencerSong to be destroyed
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
void avseq_song_destroy(AVSequencerSong *song);
/**
* Opens and registers a new sub-song to a module.
*
* @param module the AVSequencerModule to register the new sub-song to
* @param song the AVSequencerSong structure to initialize
* @return >= 0 on success, a negative error code otherwise
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
int avseq_song_open(AVSequencerModule *module, AVSequencerSong *song);
/**
* Closes and unregisters a sub-song from a module.
*
* @param module the AVSequencerModule to remove the sub-song reference
* @param song the AVSequencerSong which has been opened to be unregistered
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
void avseq_song_close(AVSequencerModule *module, AVSequencerSong *song);
/**
* Calculates the speed of a sub-song and fills the player globals structure.
*
* @param avctx the AVSequencerContext to fill the player globals structure of
* @param song the AVSequencerSong structure to calculate the speed of
* @return relative tempo value in AV_TIME_BASE fractional seconds, 0 on error
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
uint32_t avseq_song_calc_speed(AVSequencerContext *avctx, AVSequencerSong *song);
/**
* Resets a sub-song to start playback from very beginning and fills the player
* globals and host channel structures.
*
* @param avctx the AVSequencerContext to fill the player globals and host channel
* structure of
* @param song the AVSequencerSong structure to reset to playback from beginning
* @return >= 0 on success, a negative error code otherwise
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
int avseq_song_reset(AVSequencerContext *avctx, AVSequencerSong *song);
/**
* Changes sub-song channels to new number of channels specified.
*
* @param avctx the AVSequencerContext to update the number of
* channels for playback
* @param song the AVSequencerSong to set the new number of channels to
* @param channels the new amount of channels to use
* @return >= 0 on success, a negative error code otherwise
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
int avseq_song_set_channels(AVSequencerContext *avctx, AVSequencerSong *song,
uint32_t channels);
/**
* Sets the sub-song GoSub and pattern loop command stack size to a
* new stack size.
*
* @param avctx the AVSequencerContext to update the stack size
* pointers for playback
* @param song the AVSequencerSong to set the new GoSub and pattern
* loop command stack size to
* @param gosub_stack the new size of the GoSub command stack
* @param loop_stack the new size of the pattern loop command stack
* @return >= 0 on success, a negative error code otherwise
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
int avseq_song_set_stack(AVSequencerContext *avctx, AVSequencerSong *song,
uint32_t gosub_stack, uint32_t loop_stack);
/**
* Opens and registers a new order list to a sub-song.
*
* @param song the AVSequencerSong structure to store the initialized order list
* @return >= 0 on success, a negative error code otherwise
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
int avseq_order_open(AVSequencerSong *song);
/**
* Closes and unregisters an array of order data from the order list
* of a sub-song.
*
* @param song the AVSequencerSong of which the order list's data has
* been opened to be unregistered
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
void avseq_order_close(AVSequencerSong *song);
/**
* Creates a new uninitialized empty order list data entry.
*
* @return pointer to freshly allocated AVSequencerOrderData, NULL if allocation failed
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
AVSequencerOrderData *avseq_order_data_create(void);
/**
* Destroys an order data entry by freeing its occupied memory.
*
* @param track the AVSequencerOrderData to be destroyed
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
void avseq_order_data_destroy(AVSequencerOrderData *order_data);
/**
* Opens and registers a new order list data entry to an order list.
*
* @param order_list the AVSequencerOrderList to register the order list data entry to
* @param order_data the AVSequencerOrderData structure to initialize
* @return >= 0 on success, a negative error code otherwise
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
int avseq_order_data_open(AVSequencerOrderList *order_list, AVSequencerOrderData *order_data);
/**
* Closes and unregisters an order list data entry from from a order list channel.
*
* @param song the AVSequencerSong to remove the order list data entry references
* @param order_list the AVSequencerOrderList to remove the order list data entry reference
* @param order_data the AVSequencerOrderData which has been opened to be unregistered
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
void avseq_order_data_close(AVSequencerSong *song, AVSequencerOrderList *order_list,
AVSequencerOrderData *order_data);
/**
* Gets the address of the order data entry represented by an integer value.
*
* @param song the AVSequencerSong to get the order data entry address from
* @param channel the order list channel number of which to get the order data entry
* @param order the order data entry number to get the AVSequencerOrderData structure of
* @return pointer to order data entry address, NULL if order data entry number not found
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
AVSequencerOrderData *avseq_order_get_address(AVSequencerSong *song, uint32_t channel, uint32_t order);
/**
* Creates a new uninitialized empty track.
*
* @return pointer to freshly allocated AVSequencerTrack, NULL if allocation failed
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
AVSequencerTrack *avseq_track_create(void);
/**
* Destroys a track by freeing its occupied memory.
*
* @param track the AVSequencerTrack to be destroyed
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
void avseq_track_destroy(AVSequencerTrack *track);
/**
* Opens and registers a new track to a sub-song.
*
* @param song the AVSequencerSong structure to add the new track to
* @param track the AVSequencerTrack to be added to the sub-song
* @return >= 0 on success, a negative error code otherwise
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
int avseq_track_open(AVSequencerSong *song, AVSequencerTrack *track);
/**
* Closes and unregisters a track from a sub-song.
*
* @param song the AVSequencerSong to remove the track reference
* @param track the AVSequencerTrack which has been opened to be unregistered
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
void avseq_track_close(AVSequencerSong *song, AVSequencerTrack *track);
/**
* Opens and registers a new array of track data to a track.
*
* @param track the AVSequencerTrack structure to store the initialized track data
* @param rows the number of rows to use for the initialized track data
* @return >= 0 on success, a negative error code otherwise
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
int avseq_track_data_open(AVSequencerTrack *track, uint32_t rows);
/**
* Closes and unregisters an array of track data from a track.
*
* @param track the AVSequencerTrack of which the track data has been
* opened to be unregistered
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
void avseq_track_data_close(AVSequencerTrack *track);
/**
* Creates a new uninitialized empty track effect.
*
* @return pointer to freshly allocated AVSequencerTrackEffect, NULL if allocation failed
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
AVSequencerTrackEffect *avseq_track_effect_create(void);
/**
* Destroys a track effect by freeing its occupied memory.
*
* @param track the AVSequencerTrackEffect to be destroyed
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
void avseq_track_effect_destroy(AVSequencerTrackEffect *effect);
/**
* Opens and registers a new track data effect to track data.
*
* @param track the AVSequencerTrack structure to add the new track data effect to
* @param data the AVSequencerTrackRow structure to add the new track data effect to
* @param effect the AVSequencerTrackEffect to be added to the track data
* @return >= 0 on success, a negative error code otherwise
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
int avseq_track_effect_open(AVSequencerTrack *track, AVSequencerTrackRow *data, AVSequencerTrackEffect *effect);
/**
* Closes and unregisters a track effect from a row of track data.
*
* @param track_data the AVSequencerTrackRow to remove the track effect reference
* @param effect the AVSequencerTrackEffect which has been opened to be unregistered
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
void avseq_track_effect_close(AVSequencerTrackRow *track_data, AVSequencerTrackEffect *effect);
/**
* Gets the address of the track represented by an integer value.
*
* @param song the AVSequencerSong structure to get the track address from
* @param track the track number to get the AVSequencerTrack structure of
* @return pointer to track address, NULL if track number not found
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
AVSequencerTrack *avseq_track_get_address(AVSequencerSong *song, uint32_t track);
/**
* Unpacks a compressed AVSequencerTrack by using a track contents based algorithm.
*
* @param track the AVSequencerTrack where the track to be unpacked belongs to
* @param buf the byte buffer containing the packed track stream
* @param len the size of the byte buffer containing the packed track stream
* @return >= 0 on success, a negative error code otherwise
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
int avseq_track_unpack(AVSequencerTrack *track, const uint8_t *buf, uint32_t len);
/**
* Creates a new uninitialized empty instrument.
*
* @return pointer to freshly allocated AVSequencerInstrument, NULL if allocation failed
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
AVSequencerInstrument *avseq_instrument_create(void);
/**
* Destroys an instrument by freeing its occupied memory.
*
* @param instrument the AVSequencerInstrument to be destroyed
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
void avseq_instrument_destroy(AVSequencerInstrument *instrument);
/**
* Opens and registers a new instrument to a module.
*
* @param module the AVSequencerModule structure to add the new instrument to
* @param instrument the AVSequencerInstrument to be added to the module
* @param samples the number of empty samples to be added to the instrument
* @return >= 0 on success, a negative error code otherwise
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
int avseq_instrument_open(AVSequencerModule *module, AVSequencerInstrument *instrument,
uint32_t samples);
/**
* Closes and unregisters an instrument from a module.
*
* @param module the AVSequencerModule to remove the instrument reference
* @param instrument the AVSequencerInstrument which has been opened to be unregistered
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
void avseq_instrument_close(AVSequencerModule *module, AVSequencerInstrument *instrument);
/**
* Creates a new uninitialized empty envelope.
*
* @return pointer to freshly allocated AVSequencerEnvelope, NULL if allocation failed
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
AVSequencerEnvelope *avseq_envelope_create(void);
/**
* Destroys an envelope by freeing its occupied memory.
*
* @param envelope the AVSequencerEnvelope to be destroyed
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
void avseq_envelope_destroy(AVSequencerEnvelope *envelope);
/**
* Opens and registers a new envelope to a module.
*
* @param avctx the AVSequencerContext to add the new envelope to
* @param module the AVSequencerModule structure to add the new envelope to
* @param envelope the AVSequencerEnvelope to be added to the module
* @param points the number of data points to be used in the envelope data
* @param type the type of envelope data to initialize: 0 = create uninitialized envelope,
* @param type 1 = create empty envelope,
* 2 = create sine envelope,
* 3 = create cosine envelope,
* 4 = create ramp envelope,
* 5 = create triangle envelope,
* 6 = create square envelope,
* 7 = create sawtooth envelope
* @param scale the scale factor for the envelope data
* @param y_offset the y offset value to add as absolute value to the envelope data
* @param nodes the number of dragable nodes with linear connection between data points
* @return >= 0 on success, a negative error code otherwise
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/
int avseq_envelope_open(AVSequencerContext *avctx, AVSequencerModule *module,
AVSequencerEnvelope *envelope, uint32_t points,
uint32_t type, uint32_t scale,
uint32_t y_offset, uint32_t nodes);
/**
* Closes and unregisters an envelope from a module.
*
* @param module the AVSequencerModule to remove the envelope reference
* @param envelope the AVSequencerEnvelope which has been opened to be unregistered
*
* @note This is part of the new sequencer API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
* ABI compatibility yet!
*/