You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
(1) |
Apr
(1) |
May
|
Jun
(1) |
Jul
|
Aug
(10) |
Sep
|
Oct
|
Nov
|
Dec
(3) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(1) |
Feb
(2) |
Mar
(3) |
Apr
(2) |
May
(10) |
Jun
(2) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
(3) |
Dec
|
2008 |
Jan
(6) |
Feb
(4) |
Mar
(5) |
Apr
(2) |
May
(1) |
Jun
(1) |
Jul
(4) |
Aug
(6) |
Sep
(2) |
Oct
(9) |
Nov
(1) |
Dec
(4) |
2009 |
Jan
(9) |
Feb
(2) |
Mar
(2) |
Apr
(2) |
May
(6) |
Jun
(18) |
Jul
(33) |
Aug
(39) |
Sep
(33) |
Oct
(24) |
Nov
(23) |
Dec
(22) |
2010 |
Jan
(29) |
Feb
(32) |
Mar
(51) |
Apr
(17) |
May
(31) |
Jun
(21) |
Jul
(32) |
Aug
(28) |
Sep
(35) |
Oct
(27) |
Nov
(11) |
Dec
(13) |
2011 |
Jan
(14) |
Feb
(13) |
Mar
(27) |
Apr
(27) |
May
(28) |
Jun
(20) |
Jul
(43) |
Aug
(52) |
Sep
(66) |
Oct
(61) |
Nov
(11) |
Dec
(8) |
2012 |
Jan
(20) |
Feb
(30) |
Mar
(38) |
Apr
(21) |
May
(33) |
Jun
(21) |
Jul
(25) |
Aug
(9) |
Sep
(24) |
Oct
(42) |
Nov
(27) |
Dec
(41) |
2013 |
Jan
(20) |
Feb
(35) |
Mar
(156) |
Apr
(298) |
May
(258) |
Jun
(201) |
Jul
(105) |
Aug
(60) |
Sep
(193) |
Oct
(245) |
Nov
(280) |
Dec
(194) |
2014 |
Jan
(63) |
Feb
(202) |
Mar
(200) |
Apr
(23) |
May
(53) |
Jun
(105) |
Jul
(18) |
Aug
(26) |
Sep
(110) |
Oct
(187) |
Nov
(97) |
Dec
(74) |
2015 |
Jan
(45) |
Feb
(55) |
Mar
(116) |
Apr
(116) |
May
(193) |
Jun
(164) |
Jul
(50) |
Aug
(111) |
Sep
(98) |
Oct
(71) |
Nov
(103) |
Dec
(63) |
2016 |
Jan
(33) |
Feb
(101) |
Mar
(182) |
Apr
(139) |
May
(140) |
Jun
(103) |
Jul
(165) |
Aug
(286) |
Sep
(208) |
Oct
(127) |
Nov
(97) |
Dec
(54) |
2017 |
Jan
(64) |
Feb
(335) |
Mar
(202) |
Apr
(212) |
May
(139) |
Jun
(127) |
Jul
(294) |
Aug
(154) |
Sep
(170) |
Oct
(152) |
Nov
(156) |
Dec
(62) |
2018 |
Jan
(168) |
Feb
(237) |
Mar
(196) |
Apr
(174) |
May
(174) |
Jun
(161) |
Jul
(127) |
Aug
(88) |
Sep
(149) |
Oct
(66) |
Nov
(52) |
Dec
(135) |
2019 |
Jan
(146) |
Feb
(126) |
Mar
(104) |
Apr
(58) |
May
(60) |
Jun
(28) |
Jul
(197) |
Aug
(129) |
Sep
(141) |
Oct
(148) |
Nov
(63) |
Dec
(100) |
2020 |
Jan
(74) |
Feb
(37) |
Mar
(59) |
Apr
(154) |
May
(194) |
Jun
(133) |
Jul
(313) |
Aug
(197) |
Sep
(49) |
Oct
(162) |
Nov
(143) |
Dec
(57) |
2021 |
Jan
(120) |
Feb
(107) |
Mar
(314) |
Apr
(157) |
May
(524) |
Jun
(169) |
Jul
(72) |
Aug
(133) |
Sep
(135) |
Oct
(146) |
Nov
(198) |
Dec
(325) |
2022 |
Jan
(409) |
Feb
(249) |
Mar
(138) |
Apr
(95) |
May
(102) |
Jun
(221) |
Jul
(66) |
Aug
(120) |
Sep
(192) |
Oct
(131) |
Nov
(53) |
Dec
(171) |
2023 |
Jan
(357) |
Feb
(82) |
Mar
(168) |
Apr
(218) |
May
(196) |
Jun
(86) |
Jul
(115) |
Aug
(49) |
Sep
(190) |
Oct
(102) |
Nov
(45) |
Dec
(76) |
2024 |
Jan
(86) |
Feb
(50) |
Mar
(324) |
Apr
(209) |
May
(197) |
Jun
(232) |
Jul
(194) |
Aug
(247) |
Sep
(219) |
Oct
(266) |
Nov
(328) |
Dec
(304) |
2025 |
Jan
(191) |
Feb
(115) |
Mar
(137) |
Apr
(32) |
May
(126) |
Jun
(403) |
Jul
(213) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <sv...@op...> - 2024-10-26 12:53:27
|
Author: manx Date: Sat Oct 26 14:53:21 2024 New Revision: 21943 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21943 Log: [Doc] libopenmpt: Update changelog. Modified: branches/OpenMPT-1.30/libopenmpt/dox/changelog.md Modified: branches/OpenMPT-1.30/libopenmpt/dox/changelog.md ============================================================================== --- branches/OpenMPT-1.30/libopenmpt/dox/changelog.md Sat Oct 26 14:52:56 2024 (r21942) +++ branches/OpenMPT-1.30/libopenmpt/dox/changelog.md Sat Oct 26 14:53:21 2024 (r21943) @@ -11,6 +11,8 @@ * OKT: The last sample slot was never loaded. * PTM: Halve offset command strength for 16-bit samples. + * mpg123: Update to v1.32.8-dev+r5433 (2024-10-24). + ### libopenmpt 0.6.19 (2024-09-22) * [**Sec**] Possible out-of-bounds read with malformed IT / MPTM / XM files |
From: <sv...@op...> - 2024-10-26 12:53:10
|
Author: manx Date: Sat Oct 26 14:52:56 2024 New Revision: 21942 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21942 Log: Merged revision(s) 21914 from trunk/OpenMPT: [Var] mpg123: Update to 1.32.8-dev+r5433 (2024-10-24). ........ Added: branches/OpenMPT-1.30/include/mpg123/src/libmpg123/aarch64_defs.h - copied unchanged from r21914, trunk/OpenMPT/include/mpg123/src/libmpg123/aarch64_defs.h Modified: branches/OpenMPT-1.30/ (props changed) branches/OpenMPT-1.30/include/mpg123/AUTHORS branches/OpenMPT-1.30/include/mpg123/OpenMPT.txt branches/OpenMPT-1.30/include/mpg123/src/libmpg123/check_neon.S branches/OpenMPT-1.30/include/mpg123/src/libmpg123/dct36_neon64.S branches/OpenMPT-1.30/include/mpg123/src/libmpg123/dct64_neon64_float.S branches/OpenMPT-1.30/include/mpg123/src/libmpg123/frame.c branches/OpenMPT-1.30/include/mpg123/src/libmpg123/frame.h branches/OpenMPT-1.30/include/mpg123/src/libmpg123/layer1.c branches/OpenMPT-1.30/include/mpg123/src/libmpg123/layer2.c branches/OpenMPT-1.30/include/mpg123/src/libmpg123/layer3.c branches/OpenMPT-1.30/include/mpg123/src/libmpg123/libmpg123.c branches/OpenMPT-1.30/include/mpg123/src/libmpg123/parse.c branches/OpenMPT-1.30/include/mpg123/src/libmpg123/synth_neon64_accurate.S branches/OpenMPT-1.30/include/mpg123/src/libmpg123/synth_neon64_float.S branches/OpenMPT-1.30/include/mpg123/src/libmpg123/synth_neon64_s32.S branches/OpenMPT-1.30/include/mpg123/src/libmpg123/synth_stereo_neon64_accurate.S branches/OpenMPT-1.30/include/mpg123/src/libmpg123/synth_stereo_neon64_float.S branches/OpenMPT-1.30/include/mpg123/src/libmpg123/synth_stereo_neon64_s32.S branches/OpenMPT-1.30/include/mpg123/src/version.h Modified: branches/OpenMPT-1.30/include/mpg123/AUTHORS ============================================================================== --- branches/OpenMPT-1.30/include/mpg123/AUTHORS Sat Oct 26 14:52:31 2024 (r21941) +++ branches/OpenMPT-1.30/include/mpg123/AUTHORS Sat Oct 26 14:52:56 2024 (r21942) @@ -30,6 +30,7 @@ Contributions/ideas Thomas Orgis era (includes backports from mhipp trunk): +Bill Roberts <bil...@ar...>: PAC/BTI for aarch64 Dave Yeo <dav...@gm...>: continued OS/2 fixing madebr and manx: github mirror and CI Vitaly Kirsanov <kro...@gm...>: ports/cmake (optional CMake build) Modified: branches/OpenMPT-1.30/include/mpg123/OpenMPT.txt ============================================================================== --- branches/OpenMPT-1.30/include/mpg123/OpenMPT.txt Sat Oct 26 14:52:31 2024 (r21941) +++ branches/OpenMPT-1.30/include/mpg123/OpenMPT.txt Sat Oct 26 14:52:56 2024 (r21942) @@ -1,4 +1,4 @@ -libmpg123 library version 1.32.7 (2024-08-07). +libmpg123 library version 1.32.8-dev+r5433 (2024-10-24). The following changes have been made: * `ports/makefile/config.h` has been added for plain `Makefile` builds. * `ports/MSVC++/config.h` has been added for MSVC builds. Copied: branches/OpenMPT-1.30/include/mpg123/src/libmpg123/aarch64_defs.h (from r21914, trunk/OpenMPT/include/mpg123/src/libmpg123/aarch64_defs.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ branches/OpenMPT-1.30/include/mpg123/src/libmpg123/aarch64_defs.h Sat Oct 26 14:52:56 2024 (r21942, copy of r21914, trunk/OpenMPT/include/mpg123/src/libmpg123/aarch64_defs.h) @@ -0,0 +1,52 @@ +/* SPDX-License-Identifier: LGPL-2.1 + * + * aarch64_defs.h: Support macros for the aarch64 architectural features + */ + +#ifndef SRC_LIBMPG123_AARCH64_DEFS_H_ +#define SRC_LIBMPG123_AARCH64_DEFS_H_ + +/* + * Guard this header so arm assembly files can just include it without the need + * to if-def each instance. + */ +#ifdef __aarch64__ + +/* + * References: + * - https://developer.arm.com/documentation/101028/0012/5--Feature-test-macros + * - https://github.com/ARM-software/abi-aa/blob/main/aaelf64/aaelf64.rst + */ + +#if defined(__ARM_FEATURE_BTI_DEFAULT) && __ARM_FEATURE_BTI_DEFAULT == 1 + #define GNU_PROPERTY_AARCH64_BTI 1 /* bit 0 GNU Notes is for BTI support */ +#else + #define GNU_PROPERTY_AARCH64_BTI 0 +#endif + +#if defined(__ARM_FEATURE_PAC_DEFAULT) + #define GNU_PROPERTY_AARCH64_POINTER_AUTH 2 /* bit 1 GNU Notes is for PAC support */ +#else + #define GNU_PROPERTY_AARCH64_POINTER_AUTH 0 +#endif + +/* Add the BTI support to GNU Notes section */ +#if defined(__ASSEMBLER__) && defined(__ELF__) +#if GNU_PROPERTY_AARCH64_BTI != 0 || GNU_PROPERTY_AARCH64_POINTER_AUTH != 0 + .pushsection .note.gnu.property, "a"; /* Start a new allocatable section */ + .balign 8; /* align it on a byte boundry */ + .long 4; /* size of "GNU\0" */ + .long 0x10; /* size of descriptor */ + .long 0x5; /* NT_GNU_PROPERTY_TYPE_0 */ + .asciz "GNU"; + .long 0xc0000000; /* GNU_PROPERTY_AARCH64_FEATURE_1_AND */ + .long 4; /* Four bytes of data */ + .long (GNU_PROPERTY_AARCH64_BTI|GNU_PROPERTY_AARCH64_POINTER_AUTH); /* BTI or PAC is enabled */ + .long 0; /* padding for 8 byte alignment */ + .popsection; /* end the section */ +#endif /* GNU Notes additions */ +#endif /* if __ASSEMBLER__ and __ELF__ */ + +#endif /* __arch64__ */ + +#endif /* SRC_LIBMPG123_AARCH64_DEFS_H_ */ Modified: branches/OpenMPT-1.30/include/mpg123/src/libmpg123/check_neon.S ============================================================================== --- branches/OpenMPT-1.30/include/mpg123/src/libmpg123/check_neon.S Sat Oct 26 14:52:31 2024 (r21941) +++ branches/OpenMPT-1.30/include/mpg123/src/libmpg123/check_neon.S Sat Oct 26 14:52:56 2024 (r21942) @@ -6,6 +6,7 @@ initially written by Taihei Momma */ +#include "aarch64_defs.h" #include "mangle.h" #ifndef __aarch64__ Modified: branches/OpenMPT-1.30/include/mpg123/src/libmpg123/dct36_neon64.S ============================================================================== --- branches/OpenMPT-1.30/include/mpg123/src/libmpg123/dct36_neon64.S Sat Oct 26 14:52:31 2024 (r21941) +++ branches/OpenMPT-1.30/include/mpg123/src/libmpg123/dct36_neon64.S Sat Oct 26 14:52:56 2024 (r21942) @@ -6,6 +6,7 @@ initially written by Taihei Monma */ +#include "aarch64_defs.h" #include "mangle.h" #ifndef __APPLE__ Modified: branches/OpenMPT-1.30/include/mpg123/src/libmpg123/dct64_neon64_float.S ============================================================================== --- branches/OpenMPT-1.30/include/mpg123/src/libmpg123/dct64_neon64_float.S Sat Oct 26 14:52:31 2024 (r21941) +++ branches/OpenMPT-1.30/include/mpg123/src/libmpg123/dct64_neon64_float.S Sat Oct 26 14:52:56 2024 (r21942) @@ -6,6 +6,7 @@ initially written by Taihei Monma */ +#include "aarch64_defs.h" #include "mangle.h" #ifndef __APPLE__ Modified: branches/OpenMPT-1.30/include/mpg123/src/libmpg123/frame.c ============================================================================== --- branches/OpenMPT-1.30/include/mpg123/src/libmpg123/frame.c Sat Oct 26 14:52:31 2024 (r21941) +++ branches/OpenMPT-1.30/include/mpg123/src/libmpg123/frame.c Sat Oct 26 14:52:56 2024 (r21942) @@ -511,6 +511,7 @@ { frame_icy_reset(fr); INT123_open_bad(fr); + memset(&(fr->hdr), 0, sizeof(fr->hdr)); fr->to_decode = FALSE; fr->to_ignore = FALSE; fr->metaflags = 0; @@ -524,15 +525,12 @@ fr->clip = 0; fr->oldhead = 0; fr->firsthead = 0; - fr->lay = 0; fr->vbr = MPG123_CBR; fr->abr_rate = 0; fr->track_frames = 0; fr->track_samples = -1; - fr->framesize=0; fr->mean_frames = 0; fr->mean_framesize = 0; - fr->freesize = 0; fr->lastscale = -1; fr->rva.level[0] = -1; fr->rva.level[1] = -1; @@ -567,8 +565,7 @@ fr->icy.next = 0; #endif fr->halfphase = 0; /* here or indeed only on first-time init? */ - fr->error_protection = 0; - fr->freeformat_framesize = fr->p.freeformat_framesize; + fr->hdr.freeformat_framesize = fr->p.freeformat_framesize; fr->enc_delay = -1; fr->enc_padding = -1; memset(fr->id3buf, 0, sizeof(fr->id3buf)); @@ -627,7 +624,7 @@ if(header != NULL) *header = mh->oldhead; if(bodydata != NULL) *bodydata = mh->bsbuf; - if(bodybytes != NULL) *bodybytes = mh->framesize; + if(bodybytes != NULL) *bodybytes = mh->hdr.framesize; return MPG123_OK; } @@ -900,9 +897,9 @@ { int64_t preshift = fr->p.preframes; /* Layer 3 _really_ needs at least one frame before. */ - if(fr->lay==3 && preshift < 1) preshift = 1; + if(fr->hdr.lay==3 && preshift < 1) preshift = 1; /* Layer 1 & 2 reall do not need more than 2. */ - if(fr->lay!=3 && preshift > 2) preshift = 2; + if(fr->hdr.lay!=3 && preshift > 2) preshift = 2; return fr->firstframe - preshift; } @@ -949,7 +946,7 @@ void INT123_frame_skip(mpg123_handle *fr) { #ifndef NO_LAYER3 - if(fr->lay == 3) INT123_set_pointer(fr, 1, 512); + if(fr->hdr.lay == 3) INT123_set_pointer(fr, 1, 512); #endif } Modified: branches/OpenMPT-1.30/include/mpg123/src/libmpg123/frame.h ============================================================================== --- branches/OpenMPT-1.30/include/mpg123/src/libmpg123/frame.h Sat Oct 26 14:52:31 2024 (r21941) +++ branches/OpenMPT-1.30/include/mpg123/src/libmpg123/frame.h Sat Oct 26 14:52:56 2024 (r21942) @@ -96,6 +96,33 @@ ,FRAME_DECODER_LIVE = 0x8 /**< 1000 Decoder can be used. */ }; +// separate frame header structure for safe decoding of headers without +// modifying the main frame struct before we are sure that we can read a +// frame into it +struct frame_header +{ + int lay; + // lots of flags that could share storage, should reform that + int lsf; /* 0: MPEG 1.0; 1: MPEG 2.0/2.5 -- both used as bool and array index! */ + int mpeg25; + int error_protection; + int bitrate_index; + int sampling_frequency; + int padding; + int extension; + int mode; + int mode_ext; + int copyright; + int original; + int emphasis; + // Even 16 bit int is enough for MAXFRAMESIZE + int framesize; /* computed framesize */ + int freeformat; + int freeformat_framesize; + // Derived from header and checked against the above. + int ssize; +}; + /* There is a lot to condense here... many ints can be merged as flags; though the main space is still consumed by buffers. */ struct mpg123_handle_struct { @@ -197,26 +224,12 @@ int single; int II_sblimit; int down_sample_sblimit; - int lsf; /* 0: MPEG 1.0; 1: MPEG 2.0/2.5 -- both used as bool and array index! */ /* Many flags in disguise as integers... wasting bytes. */ - int mpeg25; int down_sample; int header_change; - int lay; + struct frame_header hdr; long spf; /* cached count of samples per frame */ int (*do_layer)(mpg123_handle *); - int error_protection; - int bitrate_index; - int sampling_frequency; - int padding; - int extension; - int mode; - int mode_ext; - int copyright; - int original; - int emphasis; - int framesize; /* computed framesize */ - int freesize; /* free format frame size */ enum mpg123_vbr vbr; /* 1 if variable bitrate was detected */ int64_t num; /* frame offset ... */ int64_t input_offset; /* byte offset of this frame in input stream */ @@ -225,8 +238,6 @@ int state_flags; char silent_resync; /* Do not complain for the next n resyncs. */ unsigned char* xing_toc; /* The seek TOC from Xing header. */ - int freeformat; - long freeformat_framesize; /* bitstream info; bsi */ int bitindex; @@ -253,7 +264,6 @@ double mean_framesize; int64_t mean_frames; int fsizeold; - int ssize; unsigned int bitreservoir; unsigned char bsspace[2][MAXFRAMESIZE+512+4]; /* MAXFRAMESIZE */ unsigned char *bsbuf; Modified: branches/OpenMPT-1.30/include/mpg123/src/libmpg123/layer1.c ============================================================================== --- branches/OpenMPT-1.30/include/mpg123/src/libmpg123/layer1.c Sat Oct 26 14:52:31 2024 (r21941) +++ branches/OpenMPT-1.30/include/mpg123/src/libmpg123/layer1.c Sat Oct 26 14:52:56 2024 (r21942) @@ -217,7 +217,7 @@ real (*fraction)[SBLIMIT] = fr->layer1.fraction; /* fraction[2][SBLIMIT] */ int single = fr->single; - fr->jsbound = (fr->mode == MPG_MD_JOINT_STEREO) ? (fr->mode_ext<<2)+4 : 32; + fr->jsbound = (fr->hdr.mode == MPG_MD_JOINT_STEREO) ? (fr->hdr.mode_ext<<2)+4 : 32; if(stereo == 1 || single == SINGLE_MIX) /* I don't see mixing handled here */ single = SINGLE_LEFT; Modified: branches/OpenMPT-1.30/include/mpg123/src/libmpg123/layer2.c ============================================================================== --- branches/OpenMPT-1.30/include/mpg123/src/libmpg123/layer2.c Sat Oct 26 14:52:31 2024 (r21941) +++ branches/OpenMPT-1.30/include/mpg123/src/libmpg123/layer2.c Sat Oct 26 14:52:56 2024 (r21942) @@ -313,10 +313,10 @@ const struct al_table *tables[5] = { alloc_0, alloc_1, alloc_2, alloc_3 , alloc_4 }; const int sblims[5] = { 27 , 30 , 8, 12 , 30 }; - if(fr->sampling_frequency >= 3) /* Or equivalent: (fr->lsf == 1) */ + if(fr->hdr.sampling_frequency >= 3) /* Or equivalent: (fr->lsf == 1) */ table = 4; else - table = translate[fr->sampling_frequency][2-fr->stereo][fr->bitrate_index]; + table = translate[fr->hdr.sampling_frequency][2-fr->stereo][fr->hdr.bitrate_index]; sblim = sblims[table]; fr->alloc = tables[table]; @@ -337,7 +337,7 @@ int single = fr->single; II_select_table(fr); - fr->jsbound = (fr->mode == MPG_MD_JOINT_STEREO) ? (fr->mode_ext<<2)+4 : fr->II_sblimit; + fr->jsbound = (fr->hdr.mode == MPG_MD_JOINT_STEREO) ? (fr->hdr.mode_ext<<2)+4 : fr->II_sblimit; if(fr->jsbound > fr->II_sblimit) { Modified: branches/OpenMPT-1.30/include/mpg123/src/libmpg123/layer3.c ============================================================================== --- branches/OpenMPT-1.30/include/mpg123/src/libmpg123/layer3.c Sat Oct 26 14:52:31 2024 (r21941) +++ branches/OpenMPT-1.30/include/mpg123/src/libmpg123/layer3.c Sat Oct 26 14:52:56 2024 (r21942) @@ -135,16 +135,16 @@ int powdiff = (single == SINGLE_MIX) ? 4 : 0; const int tabs[2][5] = { { 2,9,5,3,4 } , { 1,8,1,2,9 } }; - const int *tab = tabs[fr->lsf]; + const int *tab = tabs[fr->hdr.lsf]; { /* First ensure we got enough bits available. */ unsigned int needbits = 0; needbits += tab[1]; /* main_data_begin */ needbits += stereo == 1 ? tab[2] : tab[3]; /* private */ - if(!fr->lsf) + if(!fr->hdr.lsf) needbits += stereo*4; /* scfsi */ /* For each granule for each channel ... */ - needbits += tab[0]*stereo*(29+tab[4]+1+22+(!fr->lsf?1:0)+2); + needbits += tab[0]*stereo*(29+tab[4]+1+22+(!fr->hdr.lsf?1:0)+2); if(fr->bits_avail < needbits) \ { if(NOQUIET) @@ -162,7 +162,7 @@ /* overwrite main_data_begin for the really available bit reservoir */ backbits(fr, tab[1]); - if(fr->lsf == 0) + if(fr->hdr.lsf == 0) { fr->wordpointer[0] = (unsigned char) (fr->bitreservoir >> 1); fr->wordpointer[1] = (unsigned char) ((fr->bitreservoir & 1) << 7); @@ -171,7 +171,7 @@ /* zero "side-info" data for a silence-frame without touching audio data used as bit reservoir for following frame */ - memset(fr->wordpointer+2, 0, fr->ssize-2); + memset(fr->wordpointer+2, 0, fr->hdr.ssize-2); /* reread the new bit reservoir offset */ si->main_data_begin = getbits(fr, tab[1]); @@ -179,11 +179,11 @@ /* Keep track of the available data bytes for the bit reservoir. CRC is included in ssize already. */ - fr->bitreservoir = fr->bitreservoir + fr->framesize - fr->ssize; + fr->bitreservoir = fr->bitreservoir + fr->hdr.framesize - fr->hdr.ssize; /* Limit the reservoir to the max for MPEG 1.0 or 2.x . */ - if(fr->bitreservoir > (unsigned int) (fr->lsf == 0 ? 511 : 255)) - fr->bitreservoir = (fr->lsf == 0 ? 511 : 255); + if(fr->bitreservoir > (unsigned int) (fr->hdr.lsf == 0 ? 511 : 255)) + fr->bitreservoir = (fr->hdr.lsf == 0 ? 511 : 255); /* Now back into less commented territory. It's code. It works. */ @@ -192,7 +192,7 @@ else si->private_bits = getbits(fr, tab[3]); - if(!fr->lsf) for(ch=0; ch<stereo; ch++) + if(!fr->hdr.lsf) for(ch=0; ch<stereo; ch++) { si->ch[ch].gr[0].scfsi = -1; si->ch[ch].gr[1].scfsi = getbits(fr, 4); @@ -257,14 +257,14 @@ } /* region_count/start parameters are implicit in this case. */ - if( (!fr->lsf || (gr_info->block_type == 2)) && !fr->mpeg25) + if( (!fr->hdr.lsf || (gr_info->block_type == 2)) && !fr->hdr.mpeg25) { gr_info->region1start = 36>>1; gr_info->region2start = 576>>1; } else { - if(fr->mpeg25) + if(fr->hdr.mpeg25) { int r0c,r1c; if((gr_info->block_type == 2) && (!gr_info->mixed_block_flag) ) r0c = 5; @@ -299,7 +299,7 @@ gr_info->block_type = 0; gr_info->mixed_block_flag = 0; } - if(!fr->lsf) gr_info->preflag = get1bit(fr); + if(!fr->hdr.lsf) gr_info->preflag = get1bit(fr); gr_info->scalefac_scale = get1bit(fr); gr_info->count1table_select = get1bit(fr); @@ -1824,7 +1824,7 @@ int stereo = fr->stereo; int single = fr->single; int ms_stereo,i_stereo; - int sfreq = fr->sampling_frequency; + int sfreq = fr->hdr.sampling_frequency; int stereo1,granules; if(stereo == 1) @@ -1837,14 +1837,14 @@ else stereo1 = 2; - if(fr->mode == MPG_MD_JOINT_STEREO) + if(fr->hdr.mode == MPG_MD_JOINT_STEREO) { - ms_stereo = (fr->mode_ext & 0x2)>>1; - i_stereo = fr->mode_ext & 0x1; + ms_stereo = (fr->hdr.mode_ext & 0x2)>>1; + i_stereo = fr->hdr.mode_ext & 0x1; } else ms_stereo = i_stereo = 0; - granules = fr->lsf ? 1 : 2; + granules = fr->hdr.lsf ? 1 : 2; /* quick hack to keep the music playing */ /* after having seen this nasty test file... */ @@ -1859,7 +1859,7 @@ if(fr->pinfo) { fr->pinfo->maindata = sideinfo.main_data_begin; - fr->pinfo->padding = fr->padding; + fr->pinfo->padding = fr->hdr.padding; } #endif for(gr=0;gr<granules;gr++) @@ -1880,7 +1880,7 @@ , gr_info->part2_3_length, fr->bits_avail ); return clip; } - if(fr->lsf) + if(fr->hdr.lsf) part2bits = III_get_scale_factors_2(fr, scalefacs[0],gr_info,0); else part2bits = III_get_scale_factors_1(fr, scalefacs[0],gr_info,0,gr); @@ -1920,7 +1920,7 @@ { struct gr_info_s *gr_info = &(sideinfo.ch[1].gr[gr]); long part2bits; - if(fr->lsf) + if(fr->hdr.lsf) part2bits = III_get_scale_factors_2(fr, scalefacs[1],gr_info,i_stereo); else part2bits = III_get_scale_factors_1(fr, scalefacs[1],gr_info,1,gr); @@ -1970,7 +1970,7 @@ } } - if(i_stereo) III_i_stereo(hybridIn,scalefacs[1],gr_info,sfreq,ms_stereo,fr->lsf); + if(i_stereo) III_i_stereo(hybridIn,scalefacs[1],gr_info,sfreq,ms_stereo,fr->hdr.lsf); if(ms_stereo || i_stereo || (single == SINGLE_MIX) ) { Modified: branches/OpenMPT-1.30/include/mpg123/src/libmpg123/libmpg123.c ============================================================================== --- branches/OpenMPT-1.30/include/mpg123/src/libmpg123/libmpg123.c Sat Oct 26 14:52:31 2024 (r21941) +++ branches/OpenMPT-1.30/include/mpg123/src/libmpg123/libmpg123.c Sat Oct 26 14:52:56 2024 (r21942) @@ -457,7 +457,7 @@ theval = mh->enc_padding; break; case MPG123_DEC_DELAY: - theval = mh->lay == 3 ? GAPLESS_DELAY : -1; + theval = mh->hdr.lay == 3 ? GAPLESS_DELAY : -1; break; default: mh->err = MPG123_BAD_KEY; @@ -1241,10 +1241,10 @@ b = init_track(mh); \ if(b < 0) return b; \ \ - mi->version = mh->mpeg25 ? MPG123_2_5 : (mh->lsf ? MPG123_2_0 : MPG123_1_0); \ - mi->layer = mh->lay; \ + mi->version = mh->hdr.mpeg25 ? MPG123_2_5 : (mh->hdr.lsf ? MPG123_2_0 : MPG123_1_0); \ + mi->layer = mh->hdr.lay; \ mi->rate = INT123_frame_freq(mh); \ - switch(mh->mode) \ + switch(mh->hdr.mode) \ { \ case 0: mi->mode = MPG123_M_STEREO; break; \ case 1: mi->mode = MPG123_M_JOINT; break; \ @@ -1252,14 +1252,14 @@ case 3: mi->mode = MPG123_M_MONO; break; \ default: mi->mode = 0; /* Nothing good to do here. */ \ } \ - mi->mode_ext = mh->mode_ext; \ - mi->framesize = mh->framesize+4; /* Include header. */ \ + mi->mode_ext = mh->hdr.mode_ext; \ + mi->framesize = mh->hdr.framesize+4; /* Include header. */ \ mi->flags = 0; \ - if(mh->error_protection) mi->flags |= MPG123_CRC; \ - if(mh->copyright) mi->flags |= MPG123_COPYRIGHT; \ - if(mh->extension) mi->flags |= MPG123_PRIVATE; \ - if(mh->original) mi->flags |= MPG123_ORIGINAL; \ - mi->emphasis = mh->emphasis; \ + if(mh->hdr.error_protection) mi->flags |= MPG123_CRC; \ + if(mh->hdr.copyright) mi->flags |= MPG123_COPYRIGHT; \ + if(mh->hdr.extension) mi->flags |= MPG123_PRIVATE; \ + if(mh->hdr.original) mi->flags |= MPG123_ORIGINAL; \ + mi->emphasis = mh->hdr.emphasis; \ mi->bitrate = INT123_frame_bitrate(mh); \ mi->abr_rate = mh->abr_rate; \ mi->vbr = mh->vbr; \ Modified: branches/OpenMPT-1.30/include/mpg123/src/libmpg123/parse.c ============================================================================== --- branches/OpenMPT-1.30/include/mpg123/src/libmpg123/parse.c Sat Oct 26 14:52:31 2024 (r21941) +++ branches/OpenMPT-1.30/include/mpg123/src/libmpg123/parse.c Sat Oct 26 14:52:56 2024 (r21942) @@ -63,9 +63,10 @@ static const long freqs[9] = { 44100, 48000, 32000, 22050, 24000, 16000 , 11025 , 12000 , 8000 }; -static int decode_header(mpg123_handle *fr,unsigned long newhead, int *freeformat_count); -static int skip_junk(mpg123_handle *fr, unsigned long *newheadp, long *headcount); -static int do_readahead(mpg123_handle *fr, unsigned long newhead); +static int decode_header(mpg123_handle *fr, struct frame_header *hdr, unsigned long newhead, int *freeformat_count); +static void apply_header(mpg123_handle *fr, struct frame_header *hdr); +static int skip_junk(mpg123_handle *fr, unsigned long *newheadp, long *headcount, struct frame_header *nhdr); +static int do_readahead(mpg123_handle *fr, struct frame_header *nhdr, unsigned long newhead); static int wetwork(mpg123_handle *fr, unsigned long *newheadp); /* These two are to be replaced by one function that gives all the frame parameters (for outsiders).*/ @@ -73,12 +74,12 @@ int INT123_frame_bitrate(mpg123_handle *fr) { - return tabsel_123[fr->lsf][fr->lay-1][fr->bitrate_index]; + return tabsel_123[fr->hdr.lsf][fr->hdr.lay-1][fr->hdr.bitrate_index]; } long INT123_frame_freq(mpg123_handle *fr) { - return freqs[fr->sampling_frequency]; + return freqs[fr->hdr.sampling_frequency]; } /* compiler is smart enought to inline this one or should I really do it as macro...? */ @@ -141,8 +142,8 @@ Mono 17 9 */ int lame_offset = (fr->stereo == 2) - ? (fr->lsf ? 17 : 32) - : (fr->lsf ? 9 : 17); + ? (fr->hdr.lsf ? 17 : 32) + : (fr->hdr.lsf ? 9 : 17); if(fr->p.flags & MPG123_IGNORE_INFOFRAME) goto check_lame_tag_no; @@ -154,7 +155,7 @@ for the actual data, have to check if each byte of information is present. But: 4 B Info/Xing + 4 B flags is bare minimum. */ - if(fr->framesize < lame_offset+8) goto check_lame_tag_no; + if(fr->hdr.framesize < lame_offset+8) goto check_lame_tag_no; /* only search for tag when all zero before it (apart from checksum) */ for(i=2; i < lame_offset; ++i) if(fr->bsbuf[i] != 0) goto check_lame_tag_no; @@ -190,7 +191,7 @@ /* From now on, I have to carefully check if the announced data is actually there! I'm always returning 'yes', though. */ - #define check_bytes_left(n) if(fr->framesize < lame_offset+n) \ + #define check_bytes_left(n) if(fr->hdr.framesize < lame_offset+n) \ goto check_lame_tag_yes if(xing_flags & 1) /* total bitstream frames */ { @@ -443,10 +444,10 @@ static void halfspeed_prepare(mpg123_handle *fr) { /* save for repetition */ - if(fr->p.halfspeed && fr->lay == 3) + if(fr->p.halfspeed && fr->hdr.lay == 3) { debug("halfspeed - reusing old bsbuf "); - memcpy (fr->ssave, fr->bsbuf, fr->ssize); + memcpy (fr->ssave, fr->bsbuf, fr->hdr.ssize); } } @@ -462,8 +463,8 @@ fr->to_decode = fr->to_ignore = TRUE; --fr->halfphase; INT123_set_pointer(fr, 0, 0); - if(fr->lay == 3) memcpy (fr->bsbuf, fr->ssave, fr->ssize); - if(fr->error_protection) fr->crc = getbits(fr, 16); /* skip crc */ + if(fr->hdr.lay == 3) memcpy (fr->bsbuf, fr->ssave, fr->hdr.ssize); + if(fr->hdr.error_protection) fr->crc = getbits(fr, 16); /* skip crc */ return 1; } else @@ -496,10 +497,11 @@ /* TODO: rework this thing */ int freeformat_count = 0; unsigned long newhead; + // Start with current frame header state as copy for roll-back ability. + struct frame_header nhdr = fr->hdr; int64_t framepos; int ret; /* stuff that needs resetting if complete frame reading fails */ - int oldsize = fr->framesize; int oldphase = fr->halfphase; /* The counter for the search-first-header loop. @@ -507,11 +509,12 @@ when repeatedly headers are found that do not have valid followup headers. */ long headcount = 0; - fr->fsizeold=fr->framesize; /* for Layer3 */ + fr->fsizeold=fr->hdr.framesize; /* for Layer3 */ if(halfspeed_do(fr) == 1) return 1; /* From now on, old frame data is tainted by parsing attempts. */ + // Handling premature effects of decode_header now, more decoupling would be welcome. fr->to_decode = fr->to_ignore = FALSE; if( fr->p.flags & MPG123_NO_FRANKENSTEIN && @@ -540,13 +543,13 @@ #ifdef SKIP_JUNK if(!fr->firsthead && !head_check(newhead)) { - ret = skip_junk(fr, &newhead, &headcount); + ret = skip_junk(fr, &newhead, &headcount, &nhdr); JUMP_CONCLUSION(ret); } #endif ret = head_check(newhead); - if(ret) ret = decode_header(fr, newhead, &freeformat_count); + if(ret) ret = decode_header(fr, &nhdr, newhead, &freeformat_count); JUMP_CONCLUSION(ret); /* That only continues for ret == PARSE_BAD or PARSE_GOOD. */ if(ret == PARSE_BAD) @@ -561,7 +564,7 @@ { ret = fr->p.flags & MPG123_NO_READAHEAD ? PARSE_GOOD - : do_readahead(fr, newhead); + : do_readahead(fr, &nhdr, newhead); /* readahead can fail mit NEED_MORE, in which case we must also make the just read header available again for next go */ if(ret < 0) fr->rd->back_bytes(fr, 4); JUMP_CONCLUSION(ret); @@ -585,8 +588,8 @@ { unsigned char *newbuf = fr->bsspace[fr->bsnum]+512; /* read main data into memory */ - debug2("read frame body of %i at %"PRIi64, fr->framesize, framepos+4); - if((ret=fr->rd->read_frame_body(fr,newbuf,fr->framesize))<0) + debug2("read frame body of %i at %"PRIi64, nhdr.framesize, framepos+4); + if((ret=fr->rd->read_frame_body(fr,newbuf,nhdr.framesize))<0) { /* if failed: flip back */ debug1("%s", ret == MPG123_NEED_MORE ? "need more" : "read error"); @@ -597,6 +600,10 @@ } fr->bsnum = (fr->bsnum + 1) & 1; + // We read the frame body, time to apply the matching header. + // Even if erroring out later, the header state needs to match the body. + apply_header(fr, &nhdr); + if(!fr->firsthead) { fr->firsthead = newhead; /* _now_ it's time to store it... the first real header */ @@ -608,7 +615,7 @@ fr->audio_start = framepos; /* Only check for LAME tag at beginning of whole stream ... when there indeed is one in between, it's the user's problem. */ - if(fr->lay == 3 && check_lame_tag(fr) == 1) + if(fr->hdr.lay == 3 && check_lame_tag(fr) == 1) { /* ...in practice, Xing/LAME tags are layer 3 only. */ if(fr->rd->forget != NULL) fr->rd->forget(fr); @@ -624,6 +631,8 @@ INT123_set_pointer(fr, 0, 0); + // No use of nhdr from here on. It is fr->hdr now! + /* Question: How bad does the floating point value get with repeated recomputation? Also, considering that we can play the file or parts of many times. */ if(++fr->mean_frames != 0) @@ -631,7 +640,7 @@ fr->mean_framesize = ((fr->mean_frames-1)*fr->mean_framesize+INT123_compute_bpf(fr)) / fr->mean_frames ; } ++fr->num; /* 0 for first frame! */ - debug4("Frame %"PRIi64" %08lx %i, next filepos=%"PRIi64, fr->num, newhead, fr->framesize, fr->rd->tell(fr)); + debug4("Frame %"PRIi64" %08lx %i, next filepos=%"PRIi64, fr->num, newhead, fr->hdr.framesize, fr->rd->tell(fr)); if(!(fr->state_flags & FRAME_FRANKENSTEIN) && ( (fr->track_frames > 0 && fr->num >= fr->track_frames) #ifdef GAPLESS @@ -665,7 +674,7 @@ if(fr->rd->forget != NULL) fr->rd->forget(fr); fr->to_decode = fr->to_ignore = TRUE; - if(fr->error_protection) fr->crc = getbits(fr, 16); /* skip crc */ + if(fr->hdr.error_protection) fr->crc = getbits(fr, 16); /* skip crc */ /* Let's check for header change after deciding that the new one is good @@ -712,7 +721,6 @@ fr->silent_resync = 0; if(fr->err == MPG123_OK) fr->err = MPG123_ERR_READER; - fr->framesize = oldsize; fr->halfphase = oldphase; /* That return code might be inherited from some feeder action, or reader error. */ return ret; @@ -726,9 +734,9 @@ * <0: error codes, possibly from feeder buffer (NEED_MORE) * PARSE_BAD: cannot get the framesize for some reason and shall silentry try the next possible header (if this is no free format stream after all...) */ -static int guess_freeformat_framesize(mpg123_handle *fr, unsigned long oldhead) +static int guess_freeformat_framesize(mpg123_handle *fr, unsigned long oldhead, int *framesize) { - long i; + int i; int ret; unsigned long head; if(!(fr->rdat.flags & (READER_SEEKABLE|READER_BUFFERED))) @@ -749,7 +757,7 @@ if((head & HDR_SAMEMASK) == (oldhead & HDR_SAMEMASK)) { fr->rd->back_bytes(fr,i+1); - fr->framesize = i-3; + *framesize = i-3; return PARSE_GOOD; /* Success! */ } } @@ -766,8 +774,13 @@ * 0: no valid header * <0: some error * You are required to do a head_check() before calling! + * + * This now only operates on a frame header struct, not the full frame structure. + * The scope is limited to parsing header information and determining the size of + * the frame body to read. Everything else belongs into a later stage of applying + * header information to the main decoder frame structure. */ -static int decode_header(mpg123_handle *fr,unsigned long newhead, int *freeformat_count) +static int decode_header(mpg123_handle *fr, struct frame_header *fh, unsigned long newhead, int *freeformat_count) { #ifdef DEBUG /* Do not waste cycles checking the header twice all the time. */ if(!head_check(newhead)) @@ -778,43 +791,42 @@ /* For some reason, the layer and sampling freq settings used to be wrapped in a weird conditional including MPG123_NO_RESYNC. What was I thinking? This information has to be consistent. */ - fr->lay = 4 - HDR_LAYER_VAL(newhead); + fh->lay = 4 - HDR_LAYER_VAL(newhead); if(HDR_VERSION_VAL(newhead) & 0x2) { - fr->lsf = (HDR_VERSION_VAL(newhead) & 0x1) ? 0 : 1; - fr->mpeg25 = 0; - fr->sampling_frequency = HDR_SAMPLERATE_VAL(newhead) + (fr->lsf*3); + fh->lsf = (HDR_VERSION_VAL(newhead) & 0x1) ? 0 : 1; + fh->mpeg25 = 0; + fh->sampling_frequency = HDR_SAMPLERATE_VAL(newhead) + (fh->lsf*3); } else { - fr->lsf = 1; - fr->mpeg25 = 1; - fr->sampling_frequency = 6 + HDR_SAMPLERATE_VAL(newhead); + fh->lsf = 1; + fh->mpeg25 = 1; + fh->sampling_frequency = 6 + HDR_SAMPLERATE_VAL(newhead); } #ifdef DEBUG /* seen a file where this varies (old lame tag without crc, track with crc) */ - if((HDR_CRC_VAL(newhead)^0x1) != fr->error_protection) debug("changed crc bit!"); + if((HDR_CRC_VAL(newhead)^0x1) != fh->error_protection) debug("changed crc bit!"); #endif - fr->error_protection = HDR_CRC_VAL(newhead)^0x1; - fr->bitrate_index = HDR_BITRATE_VAL(newhead); - fr->padding = HDR_PADDING_VAL(newhead); - fr->extension = HDR_PRIVATE_VAL(newhead); - fr->mode = HDR_CHANNEL_VAL(newhead); - fr->mode_ext = HDR_CHANEX_VAL(newhead); - fr->copyright = HDR_COPYRIGHT_VAL(newhead); - fr->original = HDR_ORIGINAL_VAL(newhead); - fr->emphasis = HDR_EMPHASIS_VAL(newhead); - fr->freeformat = !(newhead & HDR_BITRATE); + fh->error_protection = HDR_CRC_VAL(newhead)^0x1; + fh->bitrate_index = HDR_BITRATE_VAL(newhead); + fh->padding = HDR_PADDING_VAL(newhead); + fh->extension = HDR_PRIVATE_VAL(newhead); + fh->mode = HDR_CHANNEL_VAL(newhead); + fh->mode_ext = HDR_CHANEX_VAL(newhead); + fh->copyright = HDR_COPYRIGHT_VAL(newhead); + fh->original = HDR_ORIGINAL_VAL(newhead); + fh->emphasis = HDR_EMPHASIS_VAL(newhead); + fh->freeformat = !(newhead & HDR_BITRATE); - fr->stereo = (fr->mode == MPG_MD_MONO) ? 1 : 2; /* we can't use tabsel_123 for freeformat, so trying to guess framesize... */ - if(fr->freeformat) + if(fh->freeformat) { /* when we first encounter the frame with freeformat, guess framesize */ - if(fr->freeformat_framesize < 0) + if(fh->freeformat_framesize < 0) { int ret; if(fr->p.flags & MPG123_NO_READAHEAD) @@ -829,12 +841,12 @@ if(VERBOSE3) error("You fooled me too often. Refusing to guess free format frame size _again_."); return PARSE_BAD; } - ret = guess_freeformat_framesize(fr, newhead); + ret = guess_freeformat_framesize(fr, newhead, &(fh->framesize)); if(ret == PARSE_GOOD) { - fr->freeformat_framesize = fr->framesize - fr->padding; + fh->freeformat_framesize = fh->framesize - fh->padding; if(VERBOSE2) - fprintf(stderr, "Note: free format frame size %li\n", fr->freeformat_framesize); + fprintf(stderr, "Note: free format frame size %i\n", fh->freeformat_framesize); } else { @@ -849,112 +861,140 @@ /* freeformat should be CBR, so the same framesize can be used at the 2nd reading or later */ else { - fr->framesize = fr->freeformat_framesize + fr->padding; + fh->framesize = fh->freeformat_framesize + fh->padding; } } - - switch(fr->lay) + switch(fh->lay) { #ifndef NO_LAYER1 case 1: - fr->spf = 384; - fr->do_layer = INT123_do_layer1; - if(!fr->freeformat) + if(!fh->freeformat) { - long fs = (long) tabsel_123[fr->lsf][0][fr->bitrate_index] * 12000; - fs /= freqs[fr->sampling_frequency]; - fs = ((fs+fr->padding)<<2)-4; - fr->framesize = (int)fs; + long fs = (long) tabsel_123[fh->lsf][0][fh->bitrate_index] * 12000; + fs /= freqs[fh->sampling_frequency]; + fs = ((fs+fh->padding)<<2)-4; + fh->framesize = (int)fs; } break; #endif #ifndef NO_LAYER2 case 2: - fr->spf = 1152; - fr->do_layer = INT123_do_layer2; - if(!fr->freeformat) + if(!fh->freeformat) { - debug2("bitrate index: %i (%i)", fr->bitrate_index, tabsel_123[fr->lsf][1][fr->bitrate_index] ); - long fs = (long) tabsel_123[fr->lsf][1][fr->bitrate_index] * 144000; - fs /= freqs[fr->sampling_frequency]; - fs += fr->padding - 4; - fr->framesize = (int)fs; + debug2("bitrate index: %i (%i)", fh->bitrate_index, tabsel_123[fh->lsf][1][fh->bitrate_index] ); + long fs = (long) tabsel_123[fh->lsf][1][fh->bitrate_index] * 144000; + fs /= freqs[fh->sampling_frequency]; + fs += fh->padding - 4; + fh->framesize = (int)fs; } break; #endif #ifndef NO_LAYER3 case 3: - fr->spf = fr->lsf ? 576 : 1152; /* MPEG 2.5 implies LSF.*/ - fr->do_layer = INT123_do_layer3; - if(fr->lsf) - fr->ssize = (fr->stereo == 1) ? 9 : 17; + if(fh->lsf) + fh->ssize = (fh->mode == MPG_MD_MONO) ? 9 : 17; else - fr->ssize = (fr->stereo == 1) ? 17 : 32; + fh->ssize = (fh->mode == MPG_MD_MONO) ? 17 : 32; - if(fr->error_protection) - fr->ssize += 2; + if(fh->error_protection) + fh->ssize += 2; - if(!fr->freeformat) + if(!fh->freeformat) { - long fs = (long) tabsel_123[fr->lsf][2][fr->bitrate_index] * 144000; - fs /= freqs[fr->sampling_frequency]<<(fr->lsf); - fs += fr->padding - 4; - fr->framesize = fs; + long fs = (long) tabsel_123[fh->lsf][2][fh->bitrate_index] * 144000; + fs /= freqs[fh->sampling_frequency]<<(fh->lsf); + fs += fh->padding - 4; + fh->framesize = fs; } - if(fr->framesize < fr->ssize) + if(fh->framesize < fh->ssize) { if(NOQUIET) error2( "Frame smaller than mandatory side info (%i < %i)!" - , fr->framesize, fr->ssize ); + , fh->framesize, fh->ssize ); return PARSE_BAD; } break; #endif default: - if(NOQUIET) error1("Layer type %i not supported in this build!", fr->lay); + if(NOQUIET) error1("Layer type %i not supported in this build!", fh->lay); return PARSE_BAD; } - if (fr->framesize > MAXFRAMESIZE) + if (fh->framesize > MAXFRAMESIZE) { - if(NOQUIET) error1("Frame size too big: %d", fr->framesize+4-fr->padding); + if(NOQUIET) error1("Frame size too big: %d", fh->framesize+4-fh->padding); return PARSE_BAD; } return PARSE_GOOD; } +// Apply decoded header structure to frame struct, including +// main decoder function pointer. +static void apply_header(mpg123_handle *fr, struct frame_header *hdr) +{ + // copy the whole struct, do some postprocessing + fr->hdr = *hdr; + fr->stereo = (fr->hdr.mode == MPG_MD_MONO) ? 1 : 2; + switch(fr->hdr.lay) + { +#ifndef NO_LAYER1 + case 1: + fr->spf = 384; + fr->do_layer = INT123_do_layer1; + break; +#endif +#ifndef NO_LAYER2 + case 2: + fr->spf = 1152; + fr->do_layer = INT123_do_layer2; + break; +#endif +#ifndef NO_LAYER3 + case 3: + fr->spf = fr->hdr.lsf ? 576 : 1152; /* MPEG 2.5 implies LSF.*/ + fr->do_layer = INT123_do_layer3; +#endif + break; + default: + // No error checking/message here, been done in decode_header(). + fr->spf = 0; + fr->do_layer = NULL; + } +} + + /* Prepare for bit reading. Two stages: 0. Layers 1 and 2, side info for layer 3 1. Second call for possible bit reservoir for layer 3 part 2,3. This overwrites side info needed for stage 0. Continuing to read bits after layer 3 side info shall fail unless - INT123_set_pointer() is called to refresh things. + INT123_set_pointer() is called to refresh things. */ void INT123_set_pointer(mpg123_handle *fr, int part2, long backstep) { fr->bitindex = 0; - if(fr->lay == 3) + if(fr->hdr.lay == 3) { if(part2) { - fr->wordpointer = fr->bsbuf + fr->ssize - backstep; + fr->wordpointer = fr->bsbuf + fr->hdr.ssize - backstep; if(backstep) memcpy( fr->wordpointer, fr->bsbufold+fr->fsizeold-backstep , backstep ); - fr->bits_avail = (long)(fr->framesize - fr->ssize + backstep)*8; + fr->bits_avail = (long)(fr->hdr.framesize - fr->hdr.ssize + backstep)*8; } else { fr->wordpointer = fr->bsbuf; - fr->bits_avail = fr->ssize*8; + fr->bits_avail = fr->hdr.ssize*8; } } else { fr->wordpointer = fr->bsbuf; - fr->bits_avail = fr->framesize*8; + fr->bits_avail = fr->hdr.framesize*8; } } @@ -962,7 +1002,7 @@ double INT123_compute_bpf(mpg123_handle *fr) { - return (fr->framesize > 0) ? fr->framesize + 4.0 : 1.0; + return (fr->hdr.framesize > 0) ? fr->hdr.framesize + 4.0 : 1.0; } int attribute_align_arg mpg123_spf(mpg123_handle *mh) @@ -978,8 +1018,8 @@ double tpf; if(fr == NULL || !fr->firsthead) return MPG123_ERR; - tpf = (double) bs[fr->lay]; - tpf /= freqs[fr->sampling_frequency] << (fr->lsf); + tpf = (double) bs[fr->hdr.lay]; + tpf /= freqs[fr->hdr.sampling_frequency] << (fr->hdr.lsf); return tpf; } @@ -1046,7 +1086,7 @@ } /* first attempt of read ahead check to find the real first header; cannot believe what junk is out there! */ -static int do_readahead(mpg123_handle *fr, unsigned long newhead) +static int do_readahead(mpg123_handle *fr, struct frame_header *nhdr, unsigned long newhead) { unsigned long nexthead = 0; int hd = 0; @@ -1058,9 +1098,9 @@ start = fr->rd->tell(fr); - debug2("doing ahead check with BPF %d at %"PRIi64, fr->framesize+4, start); + debug2("doing ahead check with BPF %d at %"PRIi64, nhdr->framesize+4, start); /* step framesize bytes forward and read next possible header*/ - if((oret=fr->rd->skip_bytes(fr, fr->framesize))<0) + if((oret=fr->rd->skip_bytes(fr, nhdr->framesize))<0) { if(oret==READER_ERROR && NOQUIET) error("cannot seek!"); @@ -1195,7 +1235,7 @@ } /* watch out for junk/tags on beginning of stream by invalid header */ -static int skip_junk(mpg123_handle *fr, unsigned long *newheadp, long *headcount) +static int skip_junk(mpg123_handle *fr, unsigned long *newheadp, long *headcount, struct frame_header *nhdr) { int ret; int freeformat_count = 0; @@ -1251,7 +1291,7 @@ if(++forgetcount > FORGET_INTERVAL) forgetcount = 0; if((ret=forget_head_shift(fr, &newhead, !forgetcount))<=0) return ret; - if(head_check(newhead) && (ret=decode_header(fr, newhead, &freeformat_count))) break; + if(head_check(newhead) && (ret=decode_header(fr, nhdr, newhead, &freeformat_count))) break; } while(1); if(ret<0) return ret; Modified: branches/OpenMPT-1.30/include/mpg123/src/libmpg123/synth_neon64_accurate.S ============================================================================== --- branches/OpenMPT-1.30/include/mpg123/src/libmpg123/synth_neon64_accurate.S Sat Oct 26 14:52:31 2024 (r21941) +++ branches/OpenMPT-1.30/include/mpg123/src/libmpg123/synth_neon64_accurate.S Sat Oct 26 14:52:56 2024 (r21942) @@ -6,6 +6,7 @@ initially written by Taihei Monma */ +#include "aarch64_defs.h" #include "mangle.h" #ifndef __APPLE__ Modified: branches/OpenMPT-1.30/include/mpg123/src/libmpg123/synth_neon64_float.S ============================================================================== --- branches/OpenMPT-1.30/include/mpg123/src/libmpg123/synth_neon64_float.S Sat Oct 26 14:52:31 2024 (r21941) +++ branches/OpenMPT-1.30/include/mpg123/src/libmpg123/synth_neon64_float.S Sat Oct 26 14:52:56 2024 (r21942) @@ -6,6 +6,7 @@ initially written by Taihei Monma */ +#include "aarch64_defs.h" #include "mangle.h" #ifndef __APPLE__ Modified: branches/OpenMPT-1.30/include/mpg123/src/libmpg123/synth_neon64_s32.S ============================================================================== --- branches/OpenMPT-1.30/include/mpg123/src/libmpg123/synth_neon64_s32.S Sat Oct 26 14:52:31 2024 (r21941) +++ branches/OpenMPT-1.30/include/mpg123/src/libmpg123/synth_neon64_s32.S Sat Oct 26 14:52:56 2024 (r21942) @@ -6,6 +6,7 @@ initially written by Taihei Monma */ +#include "aarch64_defs.h" #include "mangle.h" #ifndef __APPLE__ Modified: branches/OpenMPT-1.30/include/mpg123/src/libmpg123/synth_stereo_neon64_accurate.S ============================================================================== --- branches/OpenMPT-1.30/include/mpg123/src/libmpg123/synth_stereo_neon64_accurate.S Sat Oct 26 14:52:31 2024 (r21941) +++ branches/OpenMPT-1.30/include/mpg123/src/libmpg123/synth_stereo_neon64_accurate.S Sat Oct 26 14:52:56 2024 (r21942) @@ -6,6 +6,7 @@ initially written by Taihei Monma */ +#include "aarch64_defs.h" #include "mangle.h" #ifndef __APPLE__ Modified: branches/OpenMPT-1.30/include/mpg123/src/libmpg123/synth_stereo_neon64_float.S ============================================================================== --- branches/OpenMPT-1.30/include/mpg123/src/libmpg123/synth_stereo_neon64_float.S Sat Oct 26 14:52:31 2024 (r21941) +++ branches/OpenMPT-1.30/include/mpg123/src/libmpg123/synth_stereo_neon64_float.S Sat Oct 26 14:52:56 2024 (r21942) @@ -6,6 +6,7 @@ initially written by Taihei Monma */ +#include "aarch64_defs.h" #include "mangle.h" #ifndef __APPLE__ Modified: branches/OpenMPT-1.30/include/mpg123/src/libmpg123/synth_stereo_neon64_s32.S ============================================================================== --- branches/OpenMPT-1.30/include/mpg123/src/libmpg123/synth_stereo_neon64_s32.S Sat Oct 26 14:52:31 2024 (r21941) +++ branches/OpenMPT-1.30/include/mpg123/src/libmpg123/synth_stereo_neon64_s32.S Sat Oct 26 14:52:56 2024 (r21942) @@ -6,6 +6,7 @@ initially written by Taihei Monma */ +#include "aarch64_defs.h" #include "mangle.h" #ifndef __APPLE__ Modified: branches/OpenMPT-1.30/include/mpg123/src/version.h ============================================================================== --- branches/OpenMPT-1.30/include/mpg123/src/version.h Sat Oct 26 14:52:31 2024 (r21941) +++ branches/OpenMPT-1.30/include/mpg123/src/version.h Sat Oct 26 14:52:56 2024 (r21942) @@ -16,10 +16,10 @@ // only single spaces as separator to ease parsing by build scripts #define MPG123_MAJOR 1 #define MPG123_MINOR 32 -#define MPG123_PATCH 7 +#define MPG123_PATCH 8 // Don't get too wild with that to avoid confusing m4. No brackets. // Also, it should fit well into a sane file name for the tarball. -#define MPG123_SUFFIX "" +#define MPG123_SUFFIX "-dev" #define MPG123_VERSION_CAT_REALLY(a, b, c) #a "." #b "." #c #define MPG123_VERSION_CAT(a, b, c) MPG123_VERSION_CAT_REALLY(a, b, c) |
From: <sv...@op...> - 2024-10-26 12:52:38
|
Author: manx Date: Sat Oct 26 14:52:31 2024 New Revision: 21941 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21941 Log: [Doc] libopenmpt: Update changelog. Modified: branches/OpenMPT-1.31/doc/libopenmpt/changelog.md Modified: branches/OpenMPT-1.31/doc/libopenmpt/changelog.md ============================================================================== --- branches/OpenMPT-1.31/doc/libopenmpt/changelog.md Sat Oct 26 14:51:14 2024 (r21940) +++ branches/OpenMPT-1.31/doc/libopenmpt/changelog.md Sat Oct 26 14:52:31 2024 (r21941) @@ -32,6 +32,8 @@ * OKT: The last sample slot was never loaded. * PTM: Halve offset command strength for 16-bit samples. + * mpg123: Update to v1.32.8-dev+r5433 (2024-10-24). + ### libopenmpt 0.7.10 (2024-09-22) * [**Change**] FST was added to the list of supported file extension. AMP uses |
From: <sv...@op...> - 2024-10-26 12:51:23
|
Author: manx Date: Sat Oct 26 14:51:14 2024 New Revision: 21940 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21940 Log: Merged revision(s) 21914 from trunk/OpenMPT: [Var] mpg123: Update to 1.32.8-dev+r5433 (2024-10-24). ........ Added: branches/OpenMPT-1.31/include/mpg123/src/libmpg123/aarch64_defs.h - copied unchanged from r21914, trunk/OpenMPT/include/mpg123/src/libmpg123/aarch64_defs.h Modified: branches/OpenMPT-1.31/ (props changed) branches/OpenMPT-1.31/include/mpg123/AUTHORS branches/OpenMPT-1.31/include/mpg123/OpenMPT.txt branches/OpenMPT-1.31/include/mpg123/src/libmpg123/check_neon.S branches/OpenMPT-1.31/include/mpg123/src/libmpg123/dct36_neon64.S branches/OpenMPT-1.31/include/mpg123/src/libmpg123/dct64_neon64_float.S branches/OpenMPT-1.31/include/mpg123/src/libmpg123/frame.c branches/OpenMPT-1.31/include/mpg123/src/libmpg123/frame.h branches/OpenMPT-1.31/include/mpg123/src/libmpg123/layer1.c branches/OpenMPT-1.31/include/mpg123/src/libmpg123/layer2.c branches/OpenMPT-1.31/include/mpg123/src/libmpg123/layer3.c branches/OpenMPT-1.31/include/mpg123/src/libmpg123/libmpg123.c branches/OpenMPT-1.31/include/mpg123/src/libmpg123/parse.c branches/OpenMPT-1.31/include/mpg123/src/libmpg123/synth_neon64_accurate.S branches/OpenMPT-1.31/include/mpg123/src/libmpg123/synth_neon64_float.S branches/OpenMPT-1.31/include/mpg123/src/libmpg123/synth_neon64_s32.S branches/OpenMPT-1.31/include/mpg123/src/libmpg123/synth_stereo_neon64_accurate.S branches/OpenMPT-1.31/include/mpg123/src/libmpg123/synth_stereo_neon64_float.S branches/OpenMPT-1.31/include/mpg123/src/libmpg123/synth_stereo_neon64_s32.S branches/OpenMPT-1.31/include/mpg123/src/version.h Modified: branches/OpenMPT-1.31/include/mpg123/AUTHORS ============================================================================== --- branches/OpenMPT-1.31/include/mpg123/AUTHORS Sat Oct 26 14:03:49 2024 (r21939) +++ branches/OpenMPT-1.31/include/mpg123/AUTHORS Sat Oct 26 14:51:14 2024 (r21940) @@ -30,6 +30,7 @@ Contributions/ideas Thomas Orgis era (includes backports from mhipp trunk): +Bill Roberts <bil...@ar...>: PAC/BTI for aarch64 Dave Yeo <dav...@gm...>: continued OS/2 fixing madebr and manx: github mirror and CI Vitaly Kirsanov <kro...@gm...>: ports/cmake (optional CMake build) Modified: branches/OpenMPT-1.31/include/mpg123/OpenMPT.txt ============================================================================== --- branches/OpenMPT-1.31/include/mpg123/OpenMPT.txt Sat Oct 26 14:03:49 2024 (r21939) +++ branches/OpenMPT-1.31/include/mpg123/OpenMPT.txt Sat Oct 26 14:51:14 2024 (r21940) @@ -1,4 +1,4 @@ -libmpg123 library version 1.32.7 (2024-08-07). +libmpg123 library version 1.32.8-dev+r5433 (2024-10-24). The following changes have been made: * `ports/makefile/config.h` has been added for plain `Makefile` builds. * `ports/MSVC++/config.h` has been added for MSVC builds. Copied: branches/OpenMPT-1.31/include/mpg123/src/libmpg123/aarch64_defs.h (from r21914, trunk/OpenMPT/include/mpg123/src/libmpg123/aarch64_defs.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ branches/OpenMPT-1.31/include/mpg123/src/libmpg123/aarch64_defs.h Sat Oct 26 14:51:14 2024 (r21940, copy of r21914, trunk/OpenMPT/include/mpg123/src/libmpg123/aarch64_defs.h) @@ -0,0 +1,52 @@ +/* SPDX-License-Identifier: LGPL-2.1 + * + * aarch64_defs.h: Support macros for the aarch64 architectural features + */ + +#ifndef SRC_LIBMPG123_AARCH64_DEFS_H_ +#define SRC_LIBMPG123_AARCH64_DEFS_H_ + +/* + * Guard this header so arm assembly files can just include it without the need + * to if-def each instance. + */ +#ifdef __aarch64__ + +/* + * References: + * - https://developer.arm.com/documentation/101028/0012/5--Feature-test-macros + * - https://github.com/ARM-software/abi-aa/blob/main/aaelf64/aaelf64.rst + */ + +#if defined(__ARM_FEATURE_BTI_DEFAULT) && __ARM_FEATURE_BTI_DEFAULT == 1 + #define GNU_PROPERTY_AARCH64_BTI 1 /* bit 0 GNU Notes is for BTI support */ +#else + #define GNU_PROPERTY_AARCH64_BTI 0 +#endif + +#if defined(__ARM_FEATURE_PAC_DEFAULT) + #define GNU_PROPERTY_AARCH64_POINTER_AUTH 2 /* bit 1 GNU Notes is for PAC support */ +#else + #define GNU_PROPERTY_AARCH64_POINTER_AUTH 0 +#endif + +/* Add the BTI support to GNU Notes section */ +#if defined(__ASSEMBLER__) && defined(__ELF__) +#if GNU_PROPERTY_AARCH64_BTI != 0 || GNU_PROPERTY_AARCH64_POINTER_AUTH != 0 + .pushsection .note.gnu.property, "a"; /* Start a new allocatable section */ + .balign 8; /* align it on a byte boundry */ + .long 4; /* size of "GNU\0" */ + .long 0x10; /* size of descriptor */ + .long 0x5; /* NT_GNU_PROPERTY_TYPE_0 */ + .asciz "GNU"; + .long 0xc0000000; /* GNU_PROPERTY_AARCH64_FEATURE_1_AND */ + .long 4; /* Four bytes of data */ + .long (GNU_PROPERTY_AARCH64_BTI|GNU_PROPERTY_AARCH64_POINTER_AUTH); /* BTI or PAC is enabled */ + .long 0; /* padding for 8 byte alignment */ + .popsection; /* end the section */ +#endif /* GNU Notes additions */ +#endif /* if __ASSEMBLER__ and __ELF__ */ + +#endif /* __arch64__ */ + +#endif /* SRC_LIBMPG123_AARCH64_DEFS_H_ */ Modified: branches/OpenMPT-1.31/include/mpg123/src/libmpg123/check_neon.S ============================================================================== --- branches/OpenMPT-1.31/include/mpg123/src/libmpg123/check_neon.S Sat Oct 26 14:03:49 2024 (r21939) +++ branches/OpenMPT-1.31/include/mpg123/src/libmpg123/check_neon.S Sat Oct 26 14:51:14 2024 (r21940) @@ -6,6 +6,7 @@ initially written by Taihei Momma */ +#include "aarch64_defs.h" #include "mangle.h" #ifndef __aarch64__ Modified: branches/OpenMPT-1.31/include/mpg123/src/libmpg123/dct36_neon64.S ============================================================================== --- branches/OpenMPT-1.31/include/mpg123/src/libmpg123/dct36_neon64.S Sat Oct 26 14:03:49 2024 (r21939) +++ branches/OpenMPT-1.31/include/mpg123/src/libmpg123/dct36_neon64.S Sat Oct 26 14:51:14 2024 (r21940) @@ -6,6 +6,7 @@ initially written by Taihei Monma */ +#include "aarch64_defs.h" #include "mangle.h" #ifndef __APPLE__ Modified: branches/OpenMPT-1.31/include/mpg123/src/libmpg123/dct64_neon64_float.S ============================================================================== --- branches/OpenMPT-1.31/include/mpg123/src/libmpg123/dct64_neon64_float.S Sat Oct 26 14:03:49 2024 (r21939) +++ branches/OpenMPT-1.31/include/mpg123/src/libmpg123/dct64_neon64_float.S Sat Oct 26 14:51:14 2024 (r21940) @@ -6,6 +6,7 @@ initially written by Taihei Monma */ +#include "aarch64_defs.h" #include "mangle.h" #ifndef __APPLE__ Modified: branches/OpenMPT-1.31/include/mpg123/src/libmpg123/frame.c ============================================================================== --- branches/OpenMPT-1.31/include/mpg123/src/libmpg123/frame.c Sat Oct 26 14:03:49 2024 (r21939) +++ branches/OpenMPT-1.31/include/mpg123/src/libmpg123/frame.c Sat Oct 26 14:51:14 2024 (r21940) @@ -511,6 +511,7 @@ { frame_icy_reset(fr); INT123_open_bad(fr); + memset(&(fr->hdr), 0, sizeof(fr->hdr)); fr->to_decode = FALSE; fr->to_ignore = FALSE; fr->metaflags = 0; @@ -524,15 +525,12 @@ fr->clip = 0; fr->oldhead = 0; fr->firsthead = 0; - fr->lay = 0; fr->vbr = MPG123_CBR; fr->abr_rate = 0; fr->track_frames = 0; fr->track_samples = -1; - fr->framesize=0; fr->mean_frames = 0; fr->mean_framesize = 0; - fr->freesize = 0; fr->lastscale = -1; fr->rva.level[0] = -1; fr->rva.level[1] = -1; @@ -567,8 +565,7 @@ fr->icy.next = 0; #endif fr->halfphase = 0; /* here or indeed only on first-time init? */ - fr->error_protection = 0; - fr->freeformat_framesize = fr->p.freeformat_framesize; + fr->hdr.freeformat_framesize = fr->p.freeformat_framesize; fr->enc_delay = -1; fr->enc_padding = -1; memset(fr->id3buf, 0, sizeof(fr->id3buf)); @@ -627,7 +624,7 @@ if(header != NULL) *header = mh->oldhead; if(bodydata != NULL) *bodydata = mh->bsbuf; - if(bodybytes != NULL) *bodybytes = mh->framesize; + if(bodybytes != NULL) *bodybytes = mh->hdr.framesize; return MPG123_OK; } @@ -900,9 +897,9 @@ { int64_t preshift = fr->p.preframes; /* Layer 3 _really_ needs at least one frame before. */ - if(fr->lay==3 && preshift < 1) preshift = 1; + if(fr->hdr.lay==3 && preshift < 1) preshift = 1; /* Layer 1 & 2 reall do not need more than 2. */ - if(fr->lay!=3 && preshift > 2) preshift = 2; + if(fr->hdr.lay!=3 && preshift > 2) preshift = 2; return fr->firstframe - preshift; } @@ -949,7 +946,7 @@ void INT123_frame_skip(mpg123_handle *fr) { #ifndef NO_LAYER3 - if(fr->lay == 3) INT123_set_pointer(fr, 1, 512); + if(fr->hdr.lay == 3) INT123_set_pointer(fr, 1, 512); #endif } Modified: branches/OpenMPT-1.31/include/mpg123/src/libmpg123/frame.h ============================================================================== --- branches/OpenMPT-1.31/include/mpg123/src/libmpg123/frame.h Sat Oct 26 14:03:49 2024 (r21939) +++ branches/OpenMPT-1.31/include/mpg123/src/libmpg123/frame.h Sat Oct 26 14:51:14 2024 (r21940) @@ -96,6 +96,33 @@ ,FRAME_DECODER_LIVE = 0x8 /**< 1000 Decoder can be used. */ }; +// separate frame header structure for safe decoding of headers without +// modifying the main frame struct before we are sure that we can read a +// frame into it +struct frame_header +{ + int lay; + // lots of flags that could share storage, should reform that + int lsf; /* 0: MPEG 1.0; 1: MPEG 2.0/2.5 -- both used as bool and array index! */ + int mpeg25; + int error_protection; + int bitrate_index; + int sampling_frequency; + int padding; + int extension; + int mode; + int mode_ext; + int copyright; + int original; + int emphasis; + // Even 16 bit int is enough for MAXFRAMESIZE + int framesize; /* computed framesize */ + int freeformat; + int freeformat_framesize; + // Derived from header and checked against the above. + int ssize; +}; + /* There is a lot to condense here... many ints can be merged as flags; though the main space is still consumed by buffers. */ struct mpg123_handle_struct { @@ -197,26 +224,12 @@ int single; int II_sblimit; int down_sample_sblimit; - int lsf; /* 0: MPEG 1.0; 1: MPEG 2.0/2.5 -- both used as bool and array index! */ /* Many flags in disguise as integers... wasting bytes. */ - int mpeg25; int down_sample; int header_change; - int lay; + struct frame_header hdr; long spf; /* cached count of samples per frame */ int (*do_layer)(mpg123_handle *); - int error_protection; - int bitrate_index; - int sampling_frequency; - int padding; - int extension; - int mode; - int mode_ext; - int copyright; - int original; - int emphasis; - int framesize; /* computed framesize */ - int freesize; /* free format frame size */ enum mpg123_vbr vbr; /* 1 if variable bitrate was detected */ int64_t num; /* frame offset ... */ int64_t input_offset; /* byte offset of this frame in input stream */ @@ -225,8 +238,6 @@ int state_flags; char silent_resync; /* Do not complain for the next n resyncs. */ unsigned char* xing_toc; /* The seek TOC from Xing header. */ - int freeformat; - long freeformat_framesize; /* bitstream info; bsi */ int bitindex; @@ -253,7 +264,6 @@ double mean_framesize; int64_t mean_frames; int fsizeold; - int ssize; unsigned int bitreservoir; unsigned char bsspace[2][MAXFRAMESIZE+512+4]; /* MAXFRAMESIZE */ unsigned char *bsbuf; Modified: branches/OpenMPT-1.31/include/mpg123/src/libmpg123/layer1.c ============================================================================== --- branches/OpenMPT-1.31/include/mpg123/src/libmpg123/layer1.c Sat Oct 26 14:03:49 2024 (r21939) +++ branches/OpenMPT-1.31/include/mpg123/src/libmpg123/layer1.c Sat Oct 26 14:51:14 2024 (r21940) @@ -217,7 +217,7 @@ real (*fraction)[SBLIMIT] = fr->layer1.fraction; /* fraction[2][SBLIMIT] */ int single = fr->single; - fr->jsbound = (fr->mode == MPG_MD_JOINT_STEREO) ? (fr->mode_ext<<2)+4 : 32; + fr->jsbound = (fr->hdr.mode == MPG_MD_JOINT_STEREO) ? (fr->hdr.mode_ext<<2)+4 : 32; if(stereo == 1 || single == SINGLE_MIX) /* I don't see mixing handled here */ single = SINGLE_LEFT; Modified: branches/OpenMPT-1.31/include/mpg123/src/libmpg123/layer2.c ============================================================================== --- branches/OpenMPT-1.31/include/mpg123/src/libmpg123/layer2.c Sat Oct 26 14:03:49 2024 (r21939) +++ branches/OpenMPT-1.31/include/mpg123/src/libmpg123/layer2.c Sat Oct 26 14:51:14 2024 (r21940) @@ -313,10 +313,10 @@ const struct al_table *tables[5] = { alloc_0, alloc_1, alloc_2, alloc_3 , alloc_4 }; const int sblims[5] = { 27 , 30 , 8, 12 , 30 }; - if(fr->sampling_frequency >= 3) /* Or equivalent: (fr->lsf == 1) */ + if(fr->hdr.sampling_frequency >= 3) /* Or equivalent: (fr->lsf == 1) */ table = 4; else - table = translate[fr->sampling_frequency][2-fr->stereo][fr->bitrate_index]; + table = translate[fr->hdr.sampling_frequency][2-fr->stereo][fr->hdr.bitrate_index]; sblim = sblims[table]; fr->alloc = tables[table]; @@ -337,7 +337,7 @@ int single = fr->single; II_select_table(fr); - fr->jsbound = (fr->mode == MPG_MD_JOINT_STEREO) ? (fr->mode_ext<<2)+4 : fr->II_sblimit; + fr->jsbound = (fr->hdr.mode == MPG_MD_JOINT_STEREO) ? (fr->hdr.mode_ext<<2)+4 : fr->II_sblimit; if(fr->jsbound > fr->II_sblimit) { Modified: branches/OpenMPT-1.31/include/mpg123/src/libmpg123/layer3.c ============================================================================== --- branches/OpenMPT-1.31/include/mpg123/src/libmpg123/layer3.c Sat Oct 26 14:03:49 2024 (r21939) +++ branches/OpenMPT-1.31/include/mpg123/src/libmpg123/layer3.c Sat Oct 26 14:51:14 2024 (r21940) @@ -135,16 +135,16 @@ int powdiff = (single == SINGLE_MIX) ? 4 : 0; const int tabs[2][5] = { { 2,9,5,3,4 } , { 1,8,1,2,9 } }; - const int *tab = tabs[fr->lsf]; + const int *tab = tabs[fr->hdr.lsf]; { /* First ensure we got enough bits available. */ unsigned int needbits = 0; needbits += tab[1]; /* main_data_begin */ needbits += stereo == 1 ? tab[2] : tab[3]; /* private */ - if(!fr->lsf) + if(!fr->hdr.lsf) needbits += stereo*4; /* scfsi */ /* For each granule for each channel ... */ - needbits += tab[0]*stereo*(29+tab[4]+1+22+(!fr->lsf?1:0)+2); + needbits += tab[0]*stereo*(29+tab[4]+1+22+(!fr->hdr.lsf?1:0)+2); if(fr->bits_avail < needbits) \ { if(NOQUIET) @@ -162,7 +162,7 @@ /* overwrite main_data_begin for the really available bit reservoir */ backbits(fr, tab[1]); - if(fr->lsf == 0) + if(fr->hdr.lsf == 0) { fr->wordpointer[0] = (unsigned char) (fr->bitreservoir >> 1); fr->wordpointer[1] = (unsigned char) ((fr->bitreservoir & 1) << 7); @@ -171,7 +171,7 @@ /* zero "side-info" data for a silence-frame without touching audio data used as bit reservoir for following frame */ - memset(fr->wordpointer+2, 0, fr->ssize-2); + memset(fr->wordpointer+2, 0, fr->hdr.ssize-2); /* reread the new bit reservoir offset */ si->main_data_begin = getbits(fr, tab[1]); @@ -179,11 +179,11 @@ /* Keep track of the available data bytes for the bit reservoir. CRC is included in ssize already. */ - fr->bitreservoir = fr->bitreservoir + fr->framesize - fr->ssize; + fr->bitreservoir = fr->bitreservoir + fr->hdr.framesize - fr->hdr.ssize; /* Limit the reservoir to the max for MPEG 1.0 or 2.x . */ - if(fr->bitreservoir > (unsigned int) (fr->lsf == 0 ? 511 : 255)) - fr->bitreservoir = (fr->lsf == 0 ? 511 : 255); + if(fr->bitreservoir > (unsigned int) (fr->hdr.lsf == 0 ? 511 : 255)) + fr->bitreservoir = (fr->hdr.lsf == 0 ? 511 : 255); /* Now back into less commented territory. It's code. It works. */ @@ -192,7 +192,7 @@ else si->private_bits = getbits(fr, tab[3]); - if(!fr->lsf) for(ch=0; ch<stereo; ch++) + if(!fr->hdr.lsf) for(ch=0; ch<stereo; ch++) { si->ch[ch].gr[0].scfsi = -1; si->ch[ch].gr[1].scfsi = getbits(fr, 4); @@ -257,14 +257,14 @@ } /* region_count/start parameters are implicit in this case. */ - if( (!fr->lsf || (gr_info->block_type == 2)) && !fr->mpeg25) + if( (!fr->hdr.lsf || (gr_info->block_type == 2)) && !fr->hdr.mpeg25) { gr_info->region1start = 36>>1; gr_info->region2start = 576>>1; } else { - if(fr->mpeg25) + if(fr->hdr.mpeg25) { int r0c,r1c; if((gr_info->block_type == 2) && (!gr_info->mixed_block_flag) ) r0c = 5; @@ -299,7 +299,7 @@ gr_info->block_type = 0; gr_info->mixed_block_flag = 0; } - if(!fr->lsf) gr_info->preflag = get1bit(fr); + if(!fr->hdr.lsf) gr_info->preflag = get1bit(fr); gr_info->scalefac_scale = get1bit(fr); gr_info->count1table_select = get1bit(fr); @@ -1824,7 +1824,7 @@ int stereo = fr->stereo; int single = fr->single; int ms_stereo,i_stereo; - int sfreq = fr->sampling_frequency; + int sfreq = fr->hdr.sampling_frequency; int stereo1,granules; if(stereo == 1) @@ -1837,14 +1837,14 @@ else stereo1 = 2; - if(fr->mode == MPG_MD_JOINT_STEREO) + if(fr->hdr.mode == MPG_MD_JOINT_STEREO) { - ms_stereo = (fr->mode_ext & 0x2)>>1; - i_stereo = fr->mode_ext & 0x1; + ms_stereo = (fr->hdr.mode_ext & 0x2)>>1; + i_stereo = fr->hdr.mode_ext & 0x1; } else ms_stereo = i_stereo = 0; - granules = fr->lsf ? 1 : 2; + granules = fr->hdr.lsf ? 1 : 2; /* quick hack to keep the music playing */ /* after having seen this nasty test file... */ @@ -1859,7 +1859,7 @@ if(fr->pinfo) { fr->pinfo->maindata = sideinfo.main_data_begin; - fr->pinfo->padding = fr->padding; + fr->pinfo->padding = fr->hdr.padding; } #endif for(gr=0;gr<granules;gr++) @@ -1880,7 +1880,7 @@ , gr_info->part2_3_length, fr->bits_avail ); return clip; } - if(fr->lsf) + if(fr->hdr.lsf) part2bits = III_get_scale_factors_2(fr, scalefacs[0],gr_info,0); else part2bits = III_get_scale_factors_1(fr, scalefacs[0],gr_info,0,gr); @@ -1920,7 +1920,7 @@ { struct gr_info_s *gr_info = &(sideinfo.ch[1].gr[gr]); long part2bits; - if(fr->lsf) + if(fr->hdr.lsf) part2bits = III_get_scale_factors_2(fr, scalefacs[1],gr_info,i_stereo); else part2bits = III_get_scale_factors_1(fr, scalefacs[1],gr_info,1,gr); @@ -1970,7 +1970,7 @@ } } - if(i_stereo) III_i_stereo(hybridIn,scalefacs[1],gr_info,sfreq,ms_stereo,fr->lsf); + if(i_stereo) III_i_stereo(hybridIn,scalefacs[1],gr_info,sfreq,ms_stereo,fr->hdr.lsf); if(ms_stereo || i_stereo || (single == SINGLE_MIX) ) { Modified: branches/OpenMPT-1.31/include/mpg123/src/libmpg123/libmpg123.c ============================================================================== --- branches/OpenMPT-1.31/include/mpg123/src/libmpg123/libmpg123.c Sat Oct 26 14:03:49 2024 (r21939) +++ branches/OpenMPT-1.31/include/mpg123/src/libmpg123/libmpg123.c Sat Oct 26 14:51:14 2024 (r21940) @@ -457,7 +457,7 @@ theval = mh->enc_padding; break; case MPG123_DEC_DELAY: - theval = mh->lay == 3 ? GAPLESS_DELAY : -1; + theval = mh->hdr.lay == 3 ? GAPLESS_DELAY : -1; break; default: mh->err = MPG123_BAD_KEY; @@ -1241,10 +1241,10 @@ b = init_track(mh); \ if(b < 0) return b; \ \ - mi->version = mh->mpeg25 ? MPG123_2_5 : (mh->lsf ? MPG123_2_0 : MPG123_1_0); \ - mi->layer = mh->lay; \ + mi->version = mh->hdr.mpeg25 ? MPG123_2_5 : (mh->hdr.lsf ? MPG123_2_0 : MPG123_1_0); \ + mi->layer = mh->hdr.lay; \ mi->rate = INT123_frame_freq(mh); \ - switch(mh->mode) \ + switch(mh->hdr.mode) \ { \ case 0: mi->mode = MPG123_M_STEREO; break; \ case 1: mi->mode = MPG123_M_JOINT; break; \ @@ -1252,14 +1252,14 @@ case 3: mi->mode = MPG123_M_MONO; break; \ default: mi->mode = 0; /* Nothing good to do here. */ \ } \ - mi->mode_ext = mh->mode_ext; \ - mi->framesize = mh->framesize+4; /* Include header. */ \ + mi->mode_ext = mh->hdr.mode_ext; \ + mi->framesize = mh->hdr.framesize+4; /* Include header. */ \ mi->flags = 0; \ - if(mh->error_protection) mi->flags |= MPG123_CRC; \ - if(mh->copyright) mi->flags |= MPG123_COPYRIGHT; \ - if(mh->extension) mi->flags |= MPG123_PRIVATE; \ - if(mh->original) mi->flags |= MPG123_ORIGINAL; \ - mi->emphasis = mh->emphasis; \ + if(mh->hdr.error_protection) mi->flags |= MPG123_CRC; \ + if(mh->hdr.copyright) mi->flags |= MPG123_COPYRIGHT; \ + if(mh->hdr.extension) mi->flags |= MPG123_PRIVATE; \ + if(mh->hdr.original) mi->flags |= MPG123_ORIGINAL; \ + mi->emphasis = mh->hdr.emphasis; \ mi->bitrate = INT123_frame_bitrate(mh); \ mi->abr_rate = mh->abr_rate; \ mi->vbr = mh->vbr; \ Modified: branches/OpenMPT-1.31/include/mpg123/src/libmpg123/parse.c ============================================================================== --- branches/OpenMPT-1.31/include/mpg123/src/libmpg123/parse.c Sat Oct 26 14:03:49 2024 (r21939) +++ branches/OpenMPT-1.31/include/mpg123/src/libmpg123/parse.c Sat Oct 26 14:51:14 2024 (r21940) @@ -63,9 +63,10 @@ static const long freqs[9] = { 44100, 48000, 32000, 22050, 24000, 16000 , 11025 , 12000 , 8000 }; -static int decode_header(mpg123_handle *fr,unsigned long newhead, int *freeformat_count); -static int skip_junk(mpg123_handle *fr, unsigned long *newheadp, long *headcount); -static int do_readahead(mpg123_handle *fr, unsigned long newhead); +static int decode_header(mpg123_handle *fr, struct frame_header *hdr, unsigned long newhead, int *freeformat_count); +static void apply_header(mpg123_handle *fr, struct frame_header *hdr); +static int skip_junk(mpg123_handle *fr, unsigned long *newheadp, long *headcount, struct frame_header *nhdr); +static int do_readahead(mpg123_handle *fr, struct frame_header *nhdr, unsigned long newhead); static int wetwork(mpg123_handle *fr, unsigned long *newheadp); /* These two are to be replaced by one function that gives all the frame parameters (for outsiders).*/ @@ -73,12 +74,12 @@ int INT123_frame_bitrate(mpg123_handle *fr) { - return tabsel_123[fr->lsf][fr->lay-1][fr->bitrate_index]; + return tabsel_123[fr->hdr.lsf][fr->hdr.lay-1][fr->hdr.bitrate_index]; } long INT123_frame_freq(mpg123_handle *fr) { - return freqs[fr->sampling_frequency]; + return freqs[fr->hdr.sampling_frequency]; } /* compiler is smart enought to inline this one or should I really do it as macro...? */ @@ -141,8 +142,8 @@ Mono 17 9 */ int lame_offset = (fr->stereo == 2) - ? (fr->lsf ? 17 : 32) - : (fr->lsf ? 9 : 17); + ? (fr->hdr.lsf ? 17 : 32) + : (fr->hdr.lsf ? 9 : 17); if(fr->p.flags & MPG123_IGNORE_INFOFRAME) goto check_lame_tag_no; @@ -154,7 +155,7 @@ for the actual data, have to check if each byte of information is present. But: 4 B Info/Xing + 4 B flags is bare minimum. */ - if(fr->framesize < lame_offset+8) goto check_lame_tag_no; + if(fr->hdr.framesize < lame_offset+8) goto check_lame_tag_no; /* only search for tag when all zero before it (apart from checksum) */ for(i=2; i < lame_offset; ++i) if(fr->bsbuf[i] != 0) goto check_lame_tag_no; @@ -190,7 +191,7 @@ /* From now on, I have to carefully check if the announced data is actually there! I'm always returning 'yes', though. */ - #define check_bytes_left(n) if(fr->framesize < lame_offset+n) \ + #define check_bytes_left(n) if(fr->hdr.framesize < lame_offset+n) \ goto check_lame_tag_yes if(xing_flags & 1) /* total bitstream frames */ { @@ -443,10 +444,10 @@ static void halfspeed_prepare(mpg123_handle *fr) { /* save for repetition */ - if(fr->p.halfspeed && fr->lay == 3) + if(fr->p.halfspeed && fr->hdr.lay == 3) { debug("halfspeed - reusing old bsbuf "); - memcpy (fr->ssave, fr->bsbuf, fr->ssize); + memcpy (fr->ssave, fr->bsbuf, fr->hdr.ssize); } } @@ -462,8 +463,8 @@ fr->to_decode = fr->to_ignore = TRUE; --fr->halfphase; INT123_set_pointer(fr, 0, 0); - if(fr->lay == 3) memcpy (fr->bsbuf, fr->ssave, fr->ssize); - if(fr->error_protection) fr->crc = getbits(fr, 16); /* skip crc */ + if(fr->hdr.lay == 3) memcpy (fr->bsbuf, fr->ssave, fr->hdr.ssize); + if(fr->hdr.error_protection) fr->crc = getbits(fr, 16); /* skip crc */ return 1; } else @@ -496,10 +497,11 @@ /* TODO: rework this thing */ int freeformat_count = 0; unsigned long newhead; + // Start with current frame header state as copy for roll-back ability. + struct frame_header nhdr = fr->hdr; int64_t framepos; int ret; /* stuff that needs resetting if complete frame reading fails */ - int oldsize = fr->framesize; int oldphase = fr->halfphase; /* The counter for the search-first-header loop. @@ -507,11 +509,12 @@ when repeatedly headers are found that do not have valid followup headers. */ long headcount = 0; - fr->fsizeold=fr->framesize; /* for Layer3 */ + fr->fsizeold=fr->hdr.framesize; /* for Layer3 */ if(halfspeed_do(fr) == 1) return 1; /* From now on, old frame data is tainted by parsing attempts. */ + // Handling premature effects of decode_header now, more decoupling would be welcome. fr->to_decode = fr->to_ignore = FALSE; if( fr->p.flags & MPG123_NO_FRANKENSTEIN && @@ -540,13 +543,13 @@ #ifdef SKIP_JUNK if(!fr->firsthead && !head_check(newhead)) { - ret = skip_junk(fr, &newhead, &headcount); + ret = skip_junk(fr, &newhead, &headcount, &nhdr); JUMP_CONCLUSION(ret); } #endif ret = head_check(newhead); - if(ret) ret = decode_header(fr, newhead, &freeformat_count); + if(ret) ret = decode_header(fr, &nhdr, newhead, &freeformat_count); JUMP_CONCLUSION(ret); /* That only continues for ret == PARSE_BAD or PARSE_GOOD. */ if(ret == PARSE_BAD) @@ -561,7 +564,7 @@ { ret = fr->p.flags & MPG123_NO_READAHEAD ? PARSE_GOOD - : do_readahead(fr, newhead); + : do_readahead(fr, &nhdr, newhead); /* readahead can fail mit NEED_MORE, in which case we must also make the just read header available again for next go */ if(ret < 0) fr->rd->back_bytes(fr, 4); JUMP_CONCLUSION(ret); @@ -585,8 +588,8 @@ { unsigned char *newbuf = fr->bsspace[fr->bsnum]+512; /* read main data into memory */ - debug2("read frame body of %i at %"PRIi64, fr->framesize, framepos+4); - if((ret=fr->rd->read_frame_body(fr,newbuf,fr->framesize))<0) + debug2("read frame body of %i at %"PRIi64, nhdr.framesize, framepos+4); + if((ret=fr->rd->read_frame_body(fr,newbuf,nhdr.framesize))<0) { /* if failed: flip back */ debug1("%s", ret == MPG123_NEED_MORE ? "need more" : "read error"); @@ -597,6 +600,10 @@ } fr->bsnum = (fr->bsnum + 1) & 1; + // We read the frame body, time to apply the matching header. + // Even if erroring out later, the header state needs to match the body. + apply_header(fr, &nhdr); + if(!fr->firsthead) { fr->firsthead = newhead; /* _now_ it's time to store it... the first real header */ @@ -608,7 +615,7 @@ fr->audio_start = framepos; /* Only check for LAME tag at beginning of whole stream ... when there indeed is one in between, it's the user's problem. */ - if(fr->lay == 3 && check_lame_tag(fr) == 1) + if(fr->hdr.lay == 3 && check_lame_tag(fr) == 1) { /* ...in practice, Xing/LAME tags are layer 3 only. */ if(fr->rd->forget != NULL) fr->rd->forget(fr); @@ -624,6 +631,8 @@ INT123_set_pointer(fr, 0, 0); + // No use of nhdr from here on. It is fr->hdr now! + /* Question: How bad does the floating point value get with repeated recomputation? Also, considering that we can play the file or parts of many times. */ if(++fr->mean_frames != 0) @@ -631,7 +640,7 @@ fr->mean_framesize = ((fr->mean_frames-1)*fr->mean_framesize+INT123_compute_bpf(fr)) / fr->mean_frames ; } ++fr->num; /* 0 for first frame! */ - debug4("Frame %"PRIi64" %08lx %i, next filepos=%"PRIi64, fr->num, newhead, fr->framesize, fr->rd->tell(fr)); + debug4("Frame %"PRIi64" %08lx %i, next filepos=%"PRIi64, fr->num, newhead, fr->hdr.framesize, fr->rd->tell(fr)); if(!(fr->state_flags & FRAME_FRANKENSTEIN) && ( (fr->track_frames > 0 && fr->num >= fr->track_frames) #ifdef GAPLESS @@ -665,7 +674,7 @@ if(fr->rd->forget != NULL) fr->rd->forget(fr); fr->to_decode = fr->to_ignore = TRUE; - if(fr->error_protection) fr->crc = getbits(fr, 16); /* skip crc */ + if(fr->hdr.error_protection) fr->crc = getbits(fr, 16); /* skip crc */ /* Let's check for header change after deciding that the new one is good @@ -712,7 +721,6 @@ fr->silent_resync = 0; if(fr->err == MPG123_OK) fr->err = MPG123_ERR_READER; - fr->framesize = oldsize; fr->halfphase = oldphase; /* That return code might be inherited from some feeder action, or reader error. */ return ret; @@ -726,9 +734,9 @@ * <0: error codes, possibly from feeder buffer (NEED_MORE) * PARSE_BAD: cannot get the framesize for some reason and shall silentry try the next possible header (if this is no free format stream after all...) */ -static int guess_freeformat_framesize(mpg123_handle *fr, unsigned long oldhead) +static int guess_freeformat_framesize(mpg123_handle *fr, unsigned long oldhead, int *framesize) { - long i; + int i; int ret; unsigned long head; if(!(fr->rdat.flags & (READER_SEEKABLE|READER_BUFFERED))) @@ -749,7 +757,7 @@ if((head & HDR_SAMEMASK) == (oldhead & HDR_SAMEMASK)) { fr->rd->back_bytes(fr,i+1); - fr->framesize = i-3; + *framesize = i-3; return PARSE_GOOD; /* Success! */ } } @@ -766,8 +774,13 @@ * 0: no valid header * <0: some error * You are required to do a head_check() before calling! + * + * This now only operates on a frame header struct, not the full frame structure. + * The scope is limited to parsing header information and determining the size of + * the frame body to read. Everything else belongs into a later stage of applying + * header information to the main decoder frame structure. */ -static int decode_header(mpg123_handle *fr,unsigned long newhead, int *freeformat_count) +static int decode_header(mpg123_handle *fr, struct frame_header *fh, unsigned long newhead, int *freeformat_count) { #ifdef DEBUG /* Do not waste cycles checking the header twice all the time. */ if(!head_check(newhead)) @@ -778,43 +791,42 @@ /* For some reason, the layer and sampling freq settings used to be wrapped in a weird conditional including MPG123_NO_RESYNC. What was I thinking? This information has to be consistent. */ - fr->lay = 4 - HDR_LAYER_VAL(newhead); + fh->lay = 4 - HDR_LAYER_VAL(newhead); if(HDR_VERSION_VAL(newhead) & 0x2) { - fr->lsf = (HDR_VERSION_VAL(newhead) & 0x1) ? 0 : 1; - fr->mpeg25 = 0; - fr->sampling_frequency = HDR_SAMPLERATE_VAL(newhead) + (fr->lsf*3); + fh->lsf = (HDR_VERSION_VAL(newhead) & 0x1) ? 0 : 1; + fh->mpeg25 = 0; + fh->sampling_frequency = HDR_SAMPLERATE_VAL(newhead) + (fh->lsf*3); } else { - fr->lsf = 1; - fr->mpeg25 = 1; - fr->sampling_frequency = 6 + HDR_SAMPLERATE_VAL(newhead); + fh->lsf = 1; + fh->mpeg25 = 1; + fh->sampling_frequency = 6 + HDR_SAMPLERATE_VAL(newhead); } #ifdef DEBUG /* seen a file where this varies (old lame tag without crc, track with crc) */ - if((HDR_CRC_VAL(newhead)^0x1) != fr->error_protection) debug("changed crc bit!"); + if((HDR_CRC_VAL(newhead)^0x1) != fh->error_protection) debug("changed crc bit!"); #endif - fr->error_protection = HDR_CRC_VAL(newhead)^0x1; - fr->bitrate_index = HDR_BITRATE_VAL(newhead); - fr->padding = HDR_PADDING_VAL(newhead); - fr->extension = HDR_PRIVATE_VAL(newhead); - fr->mode = HDR_CHANNEL_VAL(newhead); - fr->mode_ext = HDR_CHANEX_VAL(newhead); - fr->copyright = HDR_COPYRIGHT_VAL(newhead); - fr->original = HDR_ORIGINAL_VAL(newhead); - fr->emphasis = HDR_EMPHASIS_VAL(newhead); - fr->freeformat = !(newhead & HDR_BITRATE); + fh->error_protection = HDR_CRC_VAL(newhead)^0x1; + fh->bitrate_index = HDR_BITRATE_VAL(newhead); + fh->padding = HDR_PADDING_VAL(newhead); + fh->extension = HDR_PRIVATE_VAL(newhead); + fh->mode = HDR_CHANNEL_VAL(newhead); + fh->mode_ext = HDR_CHANEX_VAL(newhead); + fh->copyright = HDR_COPYRIGHT_VAL(newhead); + fh->original = HDR_ORIGINAL_VAL(newhead); + fh->emphasis = HDR_EMPHASIS_VAL(newhead); + fh->freeformat = !(newhead & HDR_BITRATE); - fr->stereo = (fr->mode == MPG_MD_MONO) ? 1 : 2; /* we can't use tabsel_123 for freeformat, so trying to guess framesize... */ - if(fr->freeformat) + if(fh->freeformat) { /* when we first encounter the frame with freeformat, guess framesize */ - if(fr->freeformat_framesize < 0) + if(fh->freeformat_framesize < 0) { int ret; if(fr->p.flags & MPG123_NO_READAHEAD) @@ -829,12 +841,12 @@ if(VERBOSE3) error("You fooled me too often. Refusing to guess free format frame size _again_."); return PARSE_BAD; } - ret = guess_freeformat_framesize(fr, newhead); + ret = guess_freeformat_framesize(fr, newhead, &(fh->framesize)); if(ret == PARSE_GOOD) { - fr->freeformat_framesize = fr->framesize - fr->padding; + fh->freeformat_framesize = fh->framesize - fh->padding; if(VERBOSE2) - fprintf(stderr, "Note: free format frame size %li\n", fr->freeformat_framesize); + fprintf(stderr, "Note: free format frame size %i\n", fh->freeformat_framesize); } else { @@ -849,112 +861,140 @@ /* freeformat should be CBR, so the same framesize can be used at the 2nd reading or later */ else { - fr->framesize = fr->freeformat_framesize + fr->padding; + fh->framesize = fh->freeformat_framesize + fh->padding; } } - - switch(fr->lay) + switch(fh->lay) { #ifndef NO_LAYER1 case 1: - fr->spf = 384; - fr->do_layer = INT123_do_layer1; - if(!fr->freeformat) + if(!fh->freeformat) { - long fs = (long) tabsel_123[fr->lsf][0][fr->bitrate_index] * 12000; - fs /= freqs[fr->sampling_frequency]; - fs = ((fs+fr->padding)<<2)-4; - fr->framesize = (int)fs; + long fs = (long) tabsel_123[fh->lsf][0][fh->bitrate_index] * 12000; + fs /= freqs[fh->sampling_frequency]; + fs = ((fs+fh->padding)<<2)-4; + fh->framesize = (int)fs; } break; #endif #ifndef NO_LAYER2 case 2: - fr->spf = 1152; - fr->do_layer = INT123_do_layer2; - if(!fr->freeformat) + if(!fh->freeformat) { - debug2("bitrate index: %i (%i)", fr->bitrate_index, tabsel_123[fr->lsf][1][fr->bitrate_index] ); - long fs = (long) tabsel_123[fr->lsf][1][fr->bitrate_index] * 144000; - fs /= freqs[fr->sampling_frequency]; - fs += fr->padding - 4; - fr->framesize = (int)fs; + debug2("bitrate index: %i (%i)", fh->bitrate_index, tabsel_123[fh->lsf][1][fh->bitrate_index] ); + long fs = (long) tabsel_123[fh->lsf][1][fh->bitrate_index] * 144000; + fs /= freqs[fh->sampling_frequency]; + fs += fh->padding - 4; + fh->framesize = (int)fs; } break; #endif #ifndef NO_LAYER3 case 3: - fr->spf = fr->lsf ? 576 : 1152; /* MPEG 2.5 implies LSF.*/ - fr->do_layer = INT123_do_layer3; - if(fr->lsf) - fr->ssize = (fr->stereo == 1) ? 9 : 17; + if(fh->lsf) + fh->ssize = (fh->mode == MPG_MD_MONO) ? 9 : 17; else - fr->ssize = (fr->stereo == 1) ? 17 : 32; + fh->ssize = (fh->mode == MPG_MD_MONO) ? 17 : 32; - if(fr->error_protection) - fr->ssize += 2; + if(fh->error_protection) + fh->ssize += 2; - if(!fr->freeformat) + if(!fh->freeformat) { - long fs = (long) tabsel_123[fr->lsf][2][fr->bitrate_index] * 144000; - fs /= freqs[fr->sampling_frequency]<<(fr->lsf); - fs += fr->padding - 4; - fr->framesize = fs; + long fs = (long) tabsel_123[fh->lsf][2][fh->bitrate_index] * 144000; + fs /= freqs[fh->sampling_frequency]<<(fh->lsf); + fs += fh->padding - 4; + fh->framesize = fs; } - if(fr->framesize < fr->ssize) + if(fh->framesize < fh->ssize) { if(NOQUIET) error2( "Frame smaller than mandatory side info (%i < %i)!" - , fr->framesize, fr->ssize ); + , fh->framesize, fh->ssize ); return PARSE_BAD; } break; #endif default: - if(NOQUIET) error1("Layer type %i not supported in this build!", fr->lay); + if(NOQUIET) error1("Layer type %i not supported in this build!", fh->lay); return PARSE_BAD; } - if (fr->framesize > MAXFRAMESIZE) + if (fh->framesize > MAXFRAMESIZE) { - if(NOQUIET) error1("Frame size too big: %d", fr->framesize+4-fr->padding); + if(NOQUIET) error1("Frame size too big: %d", fh->framesize+4-fh->padding); return PARSE_BAD; } return PARSE_GOOD; } +// Apply decoded header structure to frame struct, including +// main decoder function pointer. +static void apply_header(mpg123_handle *fr, struct frame_header *hdr) +{ + // copy the whole struct, do some postprocessing + fr->hdr = *hdr; + fr->stereo = (fr->hdr.mode == MPG_MD_MONO) ? 1 : 2; + switch(fr->hdr.lay) + { +#ifndef NO_LAYER1 + case 1: + fr->spf = 384; + fr->do_layer = INT123_do_layer1; + break; +#endif +#ifndef NO_LAYER2 + case 2: + fr->spf = 1152; + fr->do_layer = INT123_do_layer2; + break; +#endif +#ifndef NO_LAYER3 + case 3: + fr->spf = fr->hdr.lsf ? 576 : 1152; /* MPEG 2.5 implies LSF.*/ + fr->do_layer = INT123_do_layer3; +#endif + break; + default: + // No error checking/message here, been done in decode_header(). + fr->spf = 0; + fr->do_layer = NULL; + } +} + + /* Prepare for bit reading. Two stages: 0. Layers 1 and 2, side info for layer 3 1. Second call for possible bit reservoir for layer 3 part 2,3. This overwrites side info needed for stage 0. Continuing to read bits after layer 3 side info shall fail unless - INT123_set_pointer() is called to refresh things. + INT123_set_pointer() is called to refresh things. */ void INT123_set_pointer(mpg123_handle *fr, int part2, long backstep) { fr->bitindex = 0; - if(fr->lay == 3) + if(fr->hdr.lay == 3) { if(part2) { - fr->wordpointer = fr->bsbuf + fr->ssize - backstep; + fr->wordpointer = fr->bsbuf + fr->hdr.ssize - backstep; if(backstep) memcpy( fr->wordpointer, fr->bsbufold+fr->fsizeold-backstep , backstep ); - fr->bits_avail = (long)(fr->framesize - fr->ssize + backstep)*8; + fr->bits_avail = (long)(fr->hdr.framesize - fr->hdr.ssize + backstep)*8; } else { fr->wordpointer = fr->bsbuf; - fr->bits_avail = fr->ssize*8; + fr->bits_avail = fr->hdr.ssize*8; } } else { fr->wordpointer = fr->bsbuf; - fr->bits_avail = fr->framesize*8; + fr->bits_avail = fr->hdr.framesize*8; } } @@ -962,7 +1002,7 @@ double INT123_compute_bpf(mpg123_handle *fr) { - return (fr->framesize > 0) ? fr->framesize + 4.0 : 1.0; + return (fr->hdr.framesize > 0) ? fr->hdr.framesize + 4.0 : 1.0; } int attribute_align_arg mpg123_spf(mpg123_handle *mh) @@ -978,8 +1018,8 @@ double tpf; if(fr == NULL || !fr->firsthead) return MPG123_ERR; - tpf = (double) bs[fr->lay]; - tpf /= freqs[fr->sampling_frequency] << (fr->lsf); + tpf = (double) bs[fr->hdr.lay]; + tpf /= freqs[fr->hdr.sampling_frequency] << (fr->hdr.lsf); return tpf; } @@ -1046,7 +1086,7 @@ } /* first attempt of read ahead check to find the real first header; cannot believe what junk is out there! */ -static int do_readahead(mpg123_handle *fr, unsigned long newhead) +static int do_readahead(mpg123_handle *fr, struct frame_header *nhdr, unsigned long newhead) { unsigned long nexthead = 0; int hd = 0; @@ -1058,9 +1098,9 @@ start = fr->rd->tell(fr); - debug2("doing ahead check with BPF %d at %"PRIi64, fr->framesize+4, start); + debug2("doing ahead check with BPF %d at %"PRIi64, nhdr->framesize+4, start); /* step framesize bytes forward and read next possible header*/ - if((oret=fr->rd->skip_bytes(fr, fr->framesize))<0) + if((oret=fr->rd->skip_bytes(fr, nhdr->framesize))<0) { if(oret==READER_ERROR && NOQUIET) error("cannot seek!"); @@ -1195,7 +1235,7 @@ } /* watch out for junk/tags on beginning of stream by invalid header */ -static int skip_junk(mpg123_handle *fr, unsigned long *newheadp, long *headcount) +static int skip_junk(mpg123_handle *fr, unsigned long *newheadp, long *headcount, struct frame_header *nhdr) { int ret; int freeformat_count = 0; @@ -1251,7 +1291,7 @@ if(++forgetcount > FORGET_INTERVAL) forgetcount = 0; if((ret=forget_head_shift(fr, &newhead, !forgetcount))<=0) return ret; - if(head_check(newhead) && (ret=decode_header(fr, newhead, &freeformat_count))) break; + if(head_check(newhead) && (ret=decode_header(fr, nhdr, newhead, &freeformat_count))) break; } while(1); if(ret<0) return ret; Modified: branches/OpenMPT-1.31/include/mpg123/src/libmpg123/synth_neon64_accurate.S ============================================================================== --- branches/OpenMPT-1.31/include/mpg123/src/libmpg123/synth_neon64_accurate.S Sat Oct 26 14:03:49 2024 (r21939) +++ branches/OpenMPT-1.31/include/mpg123/src/libmpg123/synth_neon64_accurate.S Sat Oct 26 14:51:14 2024 (r21940) @@ -6,6 +6,7 @@ initially written by Taihei Monma */ +#include "aarch64_defs.h" #include "mangle.h" #ifndef __APPLE__ Modified: branches/OpenMPT-1.31/include/mpg123/src/libmpg123/synth_neon64_float.S ============================================================================== --- branches/OpenMPT-1.31/include/mpg123/src/libmpg123/synth_neon64_float.S Sat Oct 26 14:03:49 2024 (r21939) +++ branches/OpenMPT-1.31/include/mpg123/src/libmpg123/synth_neon64_float.S Sat Oct 26 14:51:14 2024 (r21940) @@ -6,6 +6,7 @@ initially written by Taihei Monma */ +#include "aarch64_defs.h" #include "mangle.h" #ifndef __APPLE__ Modified: branches/OpenMPT-1.31/include/mpg123/src/libmpg123/synth_neon64_s32.S ============================================================================== --- branches/OpenMPT-1.31/include/mpg123/src/libmpg123/synth_neon64_s32.S Sat Oct 26 14:03:49 2024 (r21939) +++ branches/OpenMPT-1.31/include/mpg123/src/libmpg123/synth_neon64_s32.S Sat Oct 26 14:51:14 2024 (r21940) @@ -6,6 +6,7 @@ initially written by Taihei Monma */ +#include "aarch64_defs.h" #include "mangle.h" #ifndef __APPLE__ Modified: branches/OpenMPT-1.31/include/mpg123/src/libmpg123/synth_stereo_neon64_accurate.S ============================================================================== --- branches/OpenMPT-1.31/include/mpg123/src/libmpg123/synth_stereo_neon64_accurate.S Sat Oct 26 14:03:49 2024 (r21939) +++ branches/OpenMPT-1.31/include/mpg123/src/libmpg123/synth_stereo_neon64_accurate.S Sat Oct 26 14:51:14 2024 (r21940) @@ -6,6 +6,7 @@ initially written by Taihei Monma */ +#include "aarch64_defs.h" #include "mangle.h" #ifndef __APPLE__ Modified: branches/OpenMPT-1.31/include/mpg123/src/libmpg123/synth_stereo_neon64_float.S ============================================================================== --- branches/OpenMPT-1.31/include/mpg123/src/libmpg123/synth_stereo_neon64_float.S Sat Oct 26 14:03:49 2024 (r21939) +++ branches/OpenMPT-1.31/include/mpg123/src/libmpg123/synth_stereo_neon64_float.S Sat Oct 26 14:51:14 2024 (r21940) @@ -6,6 +6,7 @@ initially written by Taihei Monma */ +#include "aarch64_defs.h" #include "mangle.h" #ifndef __APPLE__ Modified: branches/OpenMPT-1.31/include/mpg123/src/libmpg123/synth_stereo_neon64_s32.S ============================================================================== --- branches/OpenMPT-1.31/include/mpg123/src/libmpg123/synth_stereo_neon64_s32.S Sat Oct 26 14:03:49 2024 (r21939) +++ branches/OpenMPT-1.31/include/mpg123/src/libmpg123/synth_stereo_neon64_s32.S Sat Oct 26 14:51:14 2024 (r21940) @@ -6,6 +6,7 @@ initially written by Taihei Monma */ +#include "aarch64_defs.h" #include "mangle.h" #ifndef __APPLE__ Modified: branches/OpenMPT-1.31/include/mpg123/src/version.h ============================================================================== --- branches/OpenMPT-1.31/include/mpg123/src/version.h Sat Oct 26 14:03:49 2024 (r21939) +++ branches/OpenMPT-1.31/include/mpg123/src/version.h Sat Oct 26 14:51:14 2024 (r21940) @@ -16,10 +16,10 @@ // only single spaces as separator to ease parsing by build scripts #define MPG123_MAJOR 1 #define MPG123_MINOR 32 -#define MPG123_PATCH 7 +#define MPG123_PATCH 8 // Don't get too wild with that to avoid confusing m4. No brackets. // Also, it should fit well into a sane file name for the tarball. -#define MPG123_SUFFIX "" +#define MPG123_SUFFIX "-dev" #define MPG123_VERSION_CAT_REALLY(a, b, c) #a "." #b "." #c #define MPG123_VERSION_CAT(a, b, c) MPG123_VERSION_CAT_REALLY(a, b, c) |
From: <sv...@op...> - 2024-10-26 12:03:56
|
Author: sagamusix Date: Sat Oct 26 14:03:49 2024 New Revision: 21939 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21939 Log: [Doc] libopenmpt: Update changelog. Modified: branches/OpenMPT-1.28/libopenmpt/dox/changelog.md Modified: branches/OpenMPT-1.28/libopenmpt/dox/changelog.md ============================================================================== --- branches/OpenMPT-1.28/libopenmpt/dox/changelog.md Sat Oct 26 14:03:38 2024 (r21938) +++ branches/OpenMPT-1.28/libopenmpt/dox/changelog.md Sat Oct 26 14:03:49 2024 (r21939) @@ -7,6 +7,10 @@ ### libopenmpt 0.4.46-pre + * OKT: Disable loop on type "B" samples if they're used on a mixed channel. + * OKT: The last sample slot was never loaded. + * PTM: Halve offset command strength for 16-bit samples. + ### libopenmpt 0.4.45 (2024-09-22) * Fixed inconsistency in length calculation and actual playback length with |
From: <sv...@op...> - 2024-10-26 12:03:50
|
Author: sagamusix Date: Sat Oct 26 14:03:38 2024 New Revision: 21938 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21938 Log: [Doc] libopenmpt: Update changelog. Modified: branches/OpenMPT-1.29/libopenmpt/dox/changelog.md Modified: branches/OpenMPT-1.29/libopenmpt/dox/changelog.md ============================================================================== --- branches/OpenMPT-1.29/libopenmpt/dox/changelog.md Sat Oct 26 14:03:32 2024 (r21937) +++ branches/OpenMPT-1.29/libopenmpt/dox/changelog.md Sat Oct 26 14:03:38 2024 (r21938) @@ -7,6 +7,10 @@ ### libopenmpt 0.5.34-pre + * OKT: Disable loop on type "B" samples if they're used on a mixed channel. + * OKT: The last sample slot was never loaded. + * PTM: Halve offset command strength for 16-bit samples. + ### libopenmpt 0.5.33 (2024-09-22) * Fixed inconsistency in length calculation and actual playback length with |
From: <sv...@op...> - 2024-10-26 12:03:44
|
Author: sagamusix Date: Sat Oct 26 14:03:32 2024 New Revision: 21937 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21937 Log: [Doc] libopenmpt: Update changelog. Modified: branches/OpenMPT-1.30/libopenmpt/dox/changelog.md Modified: branches/OpenMPT-1.30/libopenmpt/dox/changelog.md ============================================================================== --- branches/OpenMPT-1.30/libopenmpt/dox/changelog.md Sat Oct 26 14:03:22 2024 (r21936) +++ branches/OpenMPT-1.30/libopenmpt/dox/changelog.md Sat Oct 26 14:03:32 2024 (r21937) @@ -7,6 +7,10 @@ ### libopenmpt 0.6.20-pre + * OKT: Disable loop on type "B" samples if they're used on a mixed channel. + * OKT: The last sample slot was never loaded. + * PTM: Halve offset command strength for 16-bit samples. + ### libopenmpt 0.6.19 (2024-09-22) * [**Sec**] Possible out-of-bounds read with malformed IT / MPTM / XM files |
From: <sv...@op...> - 2024-10-26 12:03:35
|
Author: sagamusix Date: Sat Oct 26 14:03:22 2024 New Revision: 21936 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21936 Log: [Doc] libopenmpt: Update changelog. Modified: branches/OpenMPT-1.31/doc/libopenmpt/changelog.md Modified: branches/OpenMPT-1.31/doc/libopenmpt/changelog.md ============================================================================== --- branches/OpenMPT-1.31/doc/libopenmpt/changelog.md Sat Oct 26 14:00:53 2024 (r21935) +++ branches/OpenMPT-1.31/doc/libopenmpt/changelog.md Sat Oct 26 14:03:22 2024 (r21936) @@ -11,6 +11,27 @@ `CPPFLAGS` directly. This caused build settings to get lost when the user overwrote these flags. + * IT: Don't import SAx High Offset command for IT 1.xx modules. This feature + was added in Impulse Tracker 2.00. + * IT: Limit Vxx parameter to V80 for files made with old Schism Tracker + versions. + * IT / S3M: Impulse Tracker 2.14 patch version information was incorrect. + * S3M: O00 effects are no longer ignored if the tracker version in the file + header indicates Scream Tracker 3.00 / 3.01, but the file was clearly saved + with another tool (e.g. UNMO3). + * S3M: As files made with Scream Tracker 3.20 and 3.21 cannot be told apart, + both versions are now listed in the tracker metadata. + * ULT: Try to preserve global commands if there's e.g. both a speed and tempo + command in the same cell. + * STM: Improved tracker identification metadata. + * SymMOD: When running out of Zxx macros, try to find the closest macro to use + instead. + * SymMOD: Ignore unknown hunks instead of rejecting entire file, as that's + what Symphonie does as well. + * OKT: Disable loop on type "B" samples if they're used on a mixed channel. + * OKT: The last sample slot was never loaded. + * PTM: Halve offset command strength for 16-bit samples. + ### libopenmpt 0.7.10 (2024-09-22) * [**Change**] FST was added to the list of supported file extension. AMP uses |
From: <sv...@op...> - 2024-10-26 12:01:07
|
Author: manx Date: Sat Oct 26 14:00:53 2024 New Revision: 21935 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21935 Log: Merged revision(s) 21924 from trunk/OpenMPT: [Mod] build: CI: Cirrus-CI: macOS: Update XCode to 15.4. ........ Modified: branches/OpenMPT-1.31/ (props changed) branches/OpenMPT-1.31/.cirrus.yml Modified: branches/OpenMPT-1.31/.cirrus.yml ============================================================================== --- branches/OpenMPT-1.31/.cirrus.yml Sat Oct 26 14:00:30 2024 (r21934) +++ branches/OpenMPT-1.31/.cirrus.yml Sat Oct 26 14:00:53 2024 (r21935) @@ -9,7 +9,7 @@ task: name: macos14-xcode15 macos_instance: - image: ghcr.io/cirruslabs/macos-sonoma-xcode:15.3 + image: ghcr.io/cirruslabs/macos-sonoma-xcode:15.4 install_script: brew update && brew install p7zip help2man doxygen autoconf-archive mpg123 libogg libvorbis portaudio flac libsndfile sdl2 build_script: make -j$(sysctl -n hw.ncpu) STRICT=1 FORCE_DEPS=1 test_script: make -j$(sysctl -n hw.ncpu) STRICT=1 FORCE_DEPS=1 check |
From: <sv...@op...> - 2024-10-26 12:00:37
|
Author: manx Date: Sat Oct 26 14:00:30 2024 New Revision: 21934 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21934 Log: Merged revision(s) 21923 from trunk/OpenMPT: [Mod] build: CI: Cirrus-CI: FreeBSD: Update to 14.1. ........ Modified: branches/OpenMPT-1.31/ (props changed) branches/OpenMPT-1.31/.cirrus.yml Modified: branches/OpenMPT-1.31/.cirrus.yml ============================================================================== --- branches/OpenMPT-1.31/.cirrus.yml Sat Oct 26 14:00:01 2024 (r21933) +++ branches/OpenMPT-1.31/.cirrus.yml Sat Oct 26 14:00:30 2024 (r21934) @@ -1,7 +1,7 @@ task: - name: freebsd-14-0 + name: freebsd-14-1 freebsd_instance: - image_family: freebsd-14-0 + image_family: freebsd-14-1 install_script: pkg install -y subversion p5-XML-XPath git mawk gmake pkgconf autoconf autoconf-archive automake libtool doxygen help2man mpg123 libogg libvorbis flac libsndfile pulseaudio portaudio sdl2 build_script: gmake -j$(sysctl -n hw.ncpu) STRICT=1 VERBOSE=1 AUTO_DEPS=1 test_script: gmake -j$(sysctl -n hw.ncpu) STRICT=1 VERBOSE=1 AUTO_DEPS=1 check |
From: <sv...@op...> - 2024-10-26 12:00:10
|
Author: manx Date: Sat Oct 26 14:00:01 2024 New Revision: 21933 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21933 Log: Merged revision(s) 21928 from branches/OpenMPT-1.30: [Mod] build: CI: Cirrus-CI: FreeBSD: Update to 13.4. ........ Modified: branches/OpenMPT-1.28/ (props changed) branches/OpenMPT-1.28/.cirrus.yml Modified: branches/OpenMPT-1.28/.cirrus.yml ============================================================================== --- branches/OpenMPT-1.28/.cirrus.yml Sat Oct 26 13:59:35 2024 (r21932) +++ branches/OpenMPT-1.28/.cirrus.yml Sat Oct 26 14:00:01 2024 (r21933) @@ -1,7 +1,7 @@ task: - name: freebsd-13-3 + name: freebsd-13-4 freebsd_instance: - image_family: freebsd-13-3 + image_family: freebsd-13-4 install_script: pkg install -y subversion p5-XML-XPath git mawk gmake pkgconf autoconf autoconf-archive automake libtool doxygen help2man mpg123 libogg libvorbis flac libsndfile pulseaudio portaudio sdl2 build_script: gmake -j$(sysctl -n hw.ncpu) STRICT=1 VERBOSE=1 AUTO_DEPS=1 test_script: gmake -j$(sysctl -n hw.ncpu) STRICT=1 VERBOSE=1 AUTO_DEPS=1 check |
From: <sv...@op...> - 2024-10-26 11:59:42
|
Author: manx Date: Sat Oct 26 13:59:35 2024 New Revision: 21932 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21932 Log: Merged revision(s) 21925 from branches/OpenMPT-1.30: [Mod] build: CI: Cirrus-CI: macOS: Update to macOS 14 and XCode to 15.2. ........ Modified: branches/OpenMPT-1.28/ (props changed) branches/OpenMPT-1.28/.cirrus.yml Modified: branches/OpenMPT-1.28/.cirrus.yml ============================================================================== --- branches/OpenMPT-1.28/.cirrus.yml Sat Oct 26 13:59:08 2024 (r21931) +++ branches/OpenMPT-1.28/.cirrus.yml Sat Oct 26 13:59:35 2024 (r21932) @@ -7,9 +7,9 @@ test_script: gmake -j$(sysctl -n hw.ncpu) STRICT=1 VERBOSE=1 AUTO_DEPS=1 check task: - name: macos13-xcode14 + name: macos14-xcode15 macos_instance: - image: ghcr.io/cirruslabs/macos-ventura-xcode:14.3.1 + image: ghcr.io/cirruslabs/macos-sonoma-xcode:15.2 install_script: brew update && brew install p7zip help2man doxygen autoconf-archive mpg123 libogg libvorbis portaudio flac libsndfile sdl2 build_script: make -j$(sysctl -n hw.ncpu) STRICT=1 FORCE_DEPS=1 NO_PULSEAUDIO=1 test_script: make -j$(sysctl -n hw.ncpu) STRICT=1 FORCE_DEPS=1 NO_PULSEAUDIO=1 check |
From: <sv...@op...> - 2024-10-26 11:59:20
|
Author: manx Date: Sat Oct 26 13:59:08 2024 New Revision: 21931 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21931 Log: Merged revision(s) 21925 from branches/OpenMPT-1.30: [Mod] build: CI: Cirrus-CI: macOS: Update to macOS 14 and XCode to 15.2. ........ Modified: branches/OpenMPT-1.29/ (props changed) branches/OpenMPT-1.29/.cirrus.yml Modified: branches/OpenMPT-1.29/.cirrus.yml ============================================================================== --- branches/OpenMPT-1.29/.cirrus.yml Sat Oct 26 13:58:47 2024 (r21930) +++ branches/OpenMPT-1.29/.cirrus.yml Sat Oct 26 13:59:08 2024 (r21931) @@ -7,9 +7,9 @@ test_script: gmake -j$(sysctl -n hw.ncpu) STRICT=1 VERBOSE=1 AUTO_DEPS=1 check task: - name: macos13-xcode14 + name: macos14-xcode15 macos_instance: - image: ghcr.io/cirruslabs/macos-ventura-xcode:14.3.1 + image: ghcr.io/cirruslabs/macos-sonoma-xcode:15.2 install_script: brew update && brew install p7zip help2man doxygen autoconf-archive mpg123 libogg libvorbis portaudio flac libsndfile sdl2 build_script: make -j$(sysctl -n hw.ncpu) STRICT=1 FORCE_DEPS=1 NO_PULSEAUDIO=1 test_script: make -j$(sysctl -n hw.ncpu) STRICT=1 FORCE_DEPS=1 NO_PULSEAUDIO=1 check |
From: <sv...@op...> - 2024-10-26 11:58:59
|
Author: manx Date: Sat Oct 26 13:58:47 2024 New Revision: 21930 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21930 Log: Merged revision(s) 21928 from branches/OpenMPT-1.30: [Mod] build: CI: Cirrus-CI: FreeBSD: Update to 13.4. ........ Modified: branches/OpenMPT-1.29/ (props changed) branches/OpenMPT-1.29/.cirrus.yml Modified: branches/OpenMPT-1.29/.cirrus.yml ============================================================================== --- branches/OpenMPT-1.29/.cirrus.yml Sat Oct 26 13:57:46 2024 (r21929) +++ branches/OpenMPT-1.29/.cirrus.yml Sat Oct 26 13:58:47 2024 (r21930) @@ -1,7 +1,7 @@ task: - name: freebsd-13-3 + name: freebsd-13-4 freebsd_instance: - image_family: freebsd-13-3 + image_family: freebsd-13-4 install_script: pkg install -y subversion p5-XML-XPath git mawk gmake pkgconf autoconf autoconf-archive automake libtool doxygen help2man mpg123 libogg libvorbis flac libsndfile pulseaudio portaudio sdl2 build_script: gmake -j$(sysctl -n hw.ncpu) STRICT=1 VERBOSE=1 AUTO_DEPS=1 test_script: gmake -j$(sysctl -n hw.ncpu) STRICT=1 VERBOSE=1 AUTO_DEPS=1 check |
From: <sv...@op...> - 2024-10-26 11:57:58
|
Author: sagamusix Date: Sat Oct 26 13:57:46 2024 New Revision: 21929 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21929 Log: Merged revision(s) 21686 from trunk/OpenMPT: [Fix] PTM: Polytracker is another one of those trackers where offset command strength is halved by using 16-bit samples... fixes leveled.ptm (https://www.un4seen.com/forum/?topic=15448.msg143764#msg143764). ........ Modified: branches/OpenMPT-1.28/ (props changed) branches/OpenMPT-1.28/soundlib/Load_ptm.cpp branches/OpenMPT-1.28/soundlib/Snd_fx.cpp Modified: branches/OpenMPT-1.28/soundlib/Load_ptm.cpp ============================================================================== --- branches/OpenMPT-1.28/soundlib/Load_ptm.cpp Sat Oct 26 13:57:04 2024 (r21928) +++ branches/OpenMPT-1.28/soundlib/Load_ptm.cpp Sat Oct 26 13:57:46 2024 (r21929) @@ -272,6 +272,15 @@ case CMD_GLOBALVOLUME: m.param = std::min(m.param, uint8(0x40)) * 2u; break; +#ifdef MODPLUG_TRACKER + case CMD_OFFSET: + case CMD_REVERSEOFFSET: + if(m.instr && m.instr <= GetNumSamples() && Samples[m.instr].uFlags[CHN_16BIT]) + m.param /= 2; + break; +#endif // MODPLUG_TRACKER + default: + break; } } if(b & 0x80) Modified: branches/OpenMPT-1.28/soundlib/Snd_fx.cpp ============================================================================== --- branches/OpenMPT-1.28/soundlib/Snd_fx.cpp Sat Oct 26 13:57:04 2024 (r21928) +++ branches/OpenMPT-1.28/soundlib/Snd_fx.cpp Sat Oct 26 13:57:46 2024 (r21929) @@ -5327,9 +5327,9 @@ param = (param - chn.nLoopStart) % (chn.nLoopEnd - chn.nLoopStart) + chn.nLoopStart; } - if(GetType() == MOD_TYPE_MDL && chn.dwFlags[CHN_16BIT]) + if((GetType() & (MOD_TYPE_MDL | MOD_TYPE_PTM)) && chn.dwFlags[CHN_16BIT]) { - // Digitrakker really uses byte offsets, not sample offsets. WTF! + // Digitrakker and Polytracker use byte offsets, not sample offsets. param /= 2u; } @@ -5401,8 +5401,11 @@ { chn.dwFlags.set(CHN_PINGPONGFLAG); chn.dwFlags.reset(CHN_LOOP); - chn.nLength = chn.pModSample->nLength; // If there was a loop, extend sample to whole length. - chn.position.Set((chn.nLength - 1) - std::min<SmpLength>(SmpLength(param) << 8, chn.nLength - 1), 0); + chn.nLength = chn.pModSample->nLength; // If there was a loop, extend sample to whole length. + SmpLength offset = param << 8; + if(GetType() == MOD_TYPE_PTM && chn.dwFlags[CHN_16BIT]) + offset /= 2; + chn.position.Set((chn.nLength - 1) - std::min(offset, chn.nLength - SmpLength(1)), 0); } } |
From: <sv...@op...> - 2024-10-26 11:57:18
|
Author: manx Date: Sat Oct 26 13:57:04 2024 New Revision: 21928 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21928 Log: [Mod] build: CI: Cirrus-CI: FreeBSD: Update to 13.4. Modified: branches/OpenMPT-1.30/.cirrus.yml Modified: branches/OpenMPT-1.30/.cirrus.yml ============================================================================== --- branches/OpenMPT-1.30/.cirrus.yml Sat Oct 26 13:56:09 2024 (r21927) +++ branches/OpenMPT-1.30/.cirrus.yml Sat Oct 26 13:57:04 2024 (r21928) @@ -1,7 +1,7 @@ task: - name: freebsd-13-3 + name: freebsd-13-4 freebsd_instance: - image_family: freebsd-13-3 + image_family: freebsd-13-4 install_script: pkg install -y subversion p5-XML-XPath git mawk gmake pkgconf autoconf autoconf-archive automake libtool doxygen help2man mpg123 libogg libvorbis flac libsndfile pulseaudio portaudio sdl2 build_script: gmake -j$(sysctl -n hw.ncpu) STRICT=1 VERBOSE=1 AUTO_DEPS=1 test_script: gmake -j$(sysctl -n hw.ncpu) STRICT=1 VERBOSE=1 AUTO_DEPS=1 check |
From: <sv...@op...> - 2024-10-26 11:56:21
|
Author: sagamusix Date: Sat Oct 26 13:56:09 2024 New Revision: 21927 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21927 Log: Merged revision(s) 21686 from trunk/OpenMPT: [Fix] PTM: Polytracker is another one of those trackers where offset command strength is halved by using 16-bit samples... fixes leveled.ptm (https://www.un4seen.com/forum/?topic=15448.msg143764#msg143764). ........ Modified: branches/OpenMPT-1.29/ (props changed) branches/OpenMPT-1.29/soundlib/Load_ptm.cpp branches/OpenMPT-1.29/soundlib/Snd_fx.cpp Modified: branches/OpenMPT-1.29/soundlib/Load_ptm.cpp ============================================================================== --- branches/OpenMPT-1.29/soundlib/Load_ptm.cpp Sat Oct 26 13:55:24 2024 (r21926) +++ branches/OpenMPT-1.29/soundlib/Load_ptm.cpp Sat Oct 26 13:56:09 2024 (r21927) @@ -274,6 +274,15 @@ case CMD_GLOBALVOLUME: m.param = std::min(m.param, uint8(0x40)) * 2u; break; +#ifdef MODPLUG_TRACKER + case CMD_OFFSET: + case CMD_REVERSEOFFSET: + if(m.instr && m.instr <= GetNumSamples() && Samples[m.instr].uFlags[CHN_16BIT]) + m.param /= 2; + break; +#endif // MODPLUG_TRACKER + default: + break; } } if(b & 0x80) Modified: branches/OpenMPT-1.29/soundlib/Snd_fx.cpp ============================================================================== --- branches/OpenMPT-1.29/soundlib/Snd_fx.cpp Sat Oct 26 13:55:24 2024 (r21926) +++ branches/OpenMPT-1.29/soundlib/Snd_fx.cpp Sat Oct 26 13:56:09 2024 (r21927) @@ -5449,9 +5449,9 @@ param = (param - chn.nLoopStart) % (chn.nLoopEnd - chn.nLoopStart) + chn.nLoopStart; } - if(GetType() == MOD_TYPE_MDL && chn.dwFlags[CHN_16BIT]) + if((GetType() & (MOD_TYPE_MDL | MOD_TYPE_PTM)) && chn.dwFlags[CHN_16BIT]) { - // Digitrakker really uses byte offsets, not sample offsets. WTF! + // Digitrakker and Polytracker use byte offsets, not sample offsets. param /= 2u; } @@ -5525,7 +5525,10 @@ chn.dwFlags.set(CHN_PINGPONGFLAG); chn.dwFlags.reset(CHN_LOOP); chn.nLength = chn.pModSample->nLength; // If there was a loop, extend sample to whole length. - chn.position.Set((chn.nLength - 1) - std::min(SmpLength(param) << 8, chn.nLength - SmpLength(1)), 0); + SmpLength offset = param << 8; + if(GetType() == MOD_TYPE_PTM && chn.dwFlags[CHN_16BIT]) + offset /= 2; + chn.position.Set((chn.nLength - 1) - std::min(offset, chn.nLength - SmpLength(1)), 0); } } |
From: <sv...@op...> - 2024-10-26 11:55:32
|
Author: sagamusix Date: Sat Oct 26 13:55:24 2024 New Revision: 21926 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21926 Log: Merged revision(s) 21686 from trunk/OpenMPT: [Fix] PTM: Polytracker is another one of those trackers where offset command strength is halved by using 16-bit samples... fixes leveled.ptm (https://www.un4seen.com/forum/?topic=15448.msg143764#msg143764). ........ Modified: branches/OpenMPT-1.30/ (props changed) branches/OpenMPT-1.30/soundlib/Load_ptm.cpp branches/OpenMPT-1.30/soundlib/Snd_fx.cpp Modified: branches/OpenMPT-1.30/soundlib/Load_ptm.cpp ============================================================================== --- branches/OpenMPT-1.30/soundlib/Load_ptm.cpp Sat Oct 26 13:51:32 2024 (r21925) +++ branches/OpenMPT-1.30/soundlib/Load_ptm.cpp Sat Oct 26 13:55:24 2024 (r21926) @@ -274,6 +274,15 @@ case CMD_GLOBALVOLUME: m.param = std::min(m.param, uint8(0x40)) * 2u; break; +#ifdef MODPLUG_TRACKER + case CMD_OFFSET: + case CMD_REVERSEOFFSET: + if(m.instr && m.instr <= GetNumSamples() && Samples[m.instr].uFlags[CHN_16BIT]) + m.param /= 2; + break; +#endif // MODPLUG_TRACKER + default: + break; } } if(b & 0x80) Modified: branches/OpenMPT-1.30/soundlib/Snd_fx.cpp ============================================================================== --- branches/OpenMPT-1.30/soundlib/Snd_fx.cpp Sat Oct 26 13:51:32 2024 (r21925) +++ branches/OpenMPT-1.30/soundlib/Snd_fx.cpp Sat Oct 26 13:55:24 2024 (r21926) @@ -5297,9 +5297,9 @@ param = (param - chn.nLoopStart) % (chn.nLoopEnd - chn.nLoopStart) + chn.nLoopStart; } - if(GetType() == MOD_TYPE_MDL && chn.dwFlags[CHN_16BIT]) + if((GetType() & (MOD_TYPE_MDL | MOD_TYPE_PTM)) && chn.dwFlags[CHN_16BIT]) { - // Digitrakker really uses byte offsets, not sample offsets. WTF! + // Digitrakker and Polytracker use byte offsets, not sample offsets. param /= 2u; } @@ -5372,7 +5372,10 @@ chn.dwFlags.set(CHN_PINGPONGFLAG); chn.dwFlags.reset(CHN_LOOP); chn.nLength = chn.pModSample->nLength; // If there was a loop, extend sample to whole length. - chn.position.Set((chn.nLength - 1) - std::min(SmpLength(param) << 8, chn.nLength - SmpLength(1)), 0); + SmpLength offset = param << 8; + if(GetType() == MOD_TYPE_PTM && chn.dwFlags[CHN_16BIT]) + offset /= 2; + chn.position.Set((chn.nLength - 1) - std::min(offset, chn.nLength - SmpLength(1)), 0); } } |
From: <sv...@op...> - 2024-10-26 11:51:38
|
Author: manx Date: Sat Oct 26 13:51:32 2024 New Revision: 21925 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21925 Log: [Mod] build: CI: Cirrus-CI: macOS: Update to macOS 14 and XCode to 15.2. Modified: branches/OpenMPT-1.30/.cirrus.yml Modified: branches/OpenMPT-1.30/.cirrus.yml ============================================================================== --- branches/OpenMPT-1.30/.cirrus.yml Sat Oct 26 13:45:56 2024 (r21924) +++ branches/OpenMPT-1.30/.cirrus.yml Sat Oct 26 13:51:32 2024 (r21925) @@ -7,9 +7,9 @@ test_script: gmake -j$(sysctl -n hw.ncpu) STRICT=1 VERBOSE=1 AUTO_DEPS=1 check task: - name: macos13-xcode14 + name: macos14-xcode15 macos_instance: - image: ghcr.io/cirruslabs/macos-ventura-xcode:14.3.1 + image: ghcr.io/cirruslabs/macos-sonoma-xcode:15.2 install_script: brew update && brew install p7zip help2man doxygen autoconf-archive mpg123 libogg libvorbis portaudio flac libsndfile sdl2 build_script: make -j$(sysctl -n hw.ncpu) STRICT=1 FORCE_DEPS=1 test_script: make -j$(sysctl -n hw.ncpu) STRICT=1 FORCE_DEPS=1 check |
From: <sv...@op...> - 2024-10-26 11:46:05
|
Author: manx Date: Sat Oct 26 13:45:56 2024 New Revision: 21924 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21924 Log: [Mod] build: CI: Cirrus-CI: macOS: Update XCode to 15.4. Modified: trunk/OpenMPT/.cirrus.yml Modified: trunk/OpenMPT/.cirrus.yml ============================================================================== --- trunk/OpenMPT/.cirrus.yml Sat Oct 26 13:44:18 2024 (r21923) +++ trunk/OpenMPT/.cirrus.yml Sat Oct 26 13:45:56 2024 (r21924) @@ -9,7 +9,7 @@ task: name: macos14-xcode15 macos_instance: - image: ghcr.io/cirruslabs/macos-sonoma-xcode:15.3 + image: ghcr.io/cirruslabs/macos-sonoma-xcode:15.4 install_script: brew update && brew install p7zip help2man doxygen autoconf-archive mpg123 libogg libvorbis portaudio flac libsndfile sdl2 build_script: make -j$(sysctl -n hw.ncpu) STRICT=1 FORCE_DEPS=1 test_script: make -j$(sysctl -n hw.ncpu) STRICT=1 FORCE_DEPS=1 check |
From: <sv...@op...> - 2024-10-26 11:44:25
|
Author: manx Date: Sat Oct 26 13:44:18 2024 New Revision: 21923 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21923 Log: [Mod] build: CI: Cirrus-CI: FreeBSD: Update to 14.1. Modified: trunk/OpenMPT/.cirrus.yml Modified: trunk/OpenMPT/.cirrus.yml ============================================================================== --- trunk/OpenMPT/.cirrus.yml Sat Oct 26 13:27:42 2024 (r21922) +++ trunk/OpenMPT/.cirrus.yml Sat Oct 26 13:44:18 2024 (r21923) @@ -1,7 +1,7 @@ task: - name: freebsd-14-0 + name: freebsd-14-1 freebsd_instance: - image_family: freebsd-14-0 + image_family: freebsd-14-1 install_script: pkg install -y subversion p5-XML-XPath git mawk gmake pkgconf autoconf autoconf-archive automake libtool doxygen help2man mpg123 libogg libvorbis flac libsndfile pulseaudio portaudio sdl2 build_script: gmake -j$(sysctl -n hw.ncpu) STRICT=1 VERBOSE=1 AUTO_DEPS=1 test_script: gmake -j$(sysctl -n hw.ncpu) STRICT=1 VERBOSE=1 AUTO_DEPS=1 check |
From: <sv...@op...> - 2024-10-26 11:27:54
|
Author: sagamusix Date: Sat Oct 26 13:27:42 2024 New Revision: 21922 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21922 Log: Merged revision(s) 21899 from trunk/OpenMPT: [Fix] Compile fix for old Clang. ........ Modified: branches/OpenMPT-1.31/ (props changed) branches/OpenMPT-1.31/soundlib/Load_it.cpp Modified: branches/OpenMPT-1.31/soundlib/Load_it.cpp ============================================================================== --- branches/OpenMPT-1.31/soundlib/Load_it.cpp Sat Oct 26 13:17:58 2024 (r21921) +++ branches/OpenMPT-1.31/soundlib/Load_it.cpp Sat Oct 26 13:27:42 2024 (r21922) @@ -352,7 +352,7 @@ } else if(cwtv >= 0x0215 && cwtv <= 0x0217) { const mpt::uchar *versions[] = {UL_("1-2"), UL_("3"), UL_("4-5")}; - version = MPT_UFORMAT("Impulse Tracker 2.14p{}")(versions[cwtv - 0x0215]); + version = MPT_UFORMAT("Impulse Tracker 2.14p{}")(mpt::ustring_view(versions[cwtv - 0x0215])); } else { version = MPT_UFORMAT("Impulse Tracker {}.{}")((cwtv & 0x0F00) >> 8, mpt::ufmt::hex0<2>((cwtv & 0xFF))); |
From: <sv...@op...> - 2024-10-26 11:18:10
|
Author: sagamusix Date: Sat Oct 26 13:17:58 2024 New Revision: 21921 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21921 Log: Merged revision(s) 21898 from trunk/OpenMPT: [Fix] IT/S3M: Properly identify IT2.14 patch versions (tx cs127). ........ Modified: branches/OpenMPT-1.31/ (props changed) branches/OpenMPT-1.31/soundlib/Load_it.cpp branches/OpenMPT-1.31/soundlib/Load_s3m.cpp branches/OpenMPT-1.31/soundlib/Sndfile.h Modified: branches/OpenMPT-1.31/soundlib/Load_it.cpp ============================================================================== --- branches/OpenMPT-1.31/soundlib/Load_it.cpp Sat Oct 26 13:15:55 2024 (r21920) +++ branches/OpenMPT-1.31/soundlib/Load_it.cpp Sat Oct 26 13:17:58 2024 (r21921) @@ -341,6 +341,26 @@ } +// Get version of Impulse Tracker that was used to create an IT/S3M file. +mpt::ustring CSoundFile::GetImpulseTrackerVersion(uint16 cwtv, uint16 cmwt) +{ + mpt::ustring version; + cwtv &= 0xFFF; + if(cmwt > 0x0214) + { + version = UL_("Impulse Tracker 2.15"); + } else if(cwtv >= 0x0215 && cwtv <= 0x0217) + { + const mpt::uchar *versions[] = {UL_("1-2"), UL_("3"), UL_("4-5")}; + version = MPT_UFORMAT("Impulse Tracker 2.14p{}")(versions[cwtv - 0x0215]); + } else + { + version = MPT_UFORMAT("Impulse Tracker {}.{}")((cwtv & 0x0F00) >> 8, mpt::ufmt::hex0<2>((cwtv & 0xFF))); + } + return version; +} + + // Get version of Schism Tracker that was used to create an IT/S3M file. mpt::ustring CSoundFile::GetSchismTrackerVersion(uint16 cwtv, uint32 reserved) { @@ -1239,19 +1259,7 @@ madeWithTracker = U_("Unknown"); } else if(fileHeader.cmwt < 0x0300 && madeWithTracker.empty()) { - if(fileHeader.cmwt > 0x0214) - { - madeWithTracker = U_("Impulse Tracker 2.15"); - } else if(fileHeader.cwtv > 0x0214) - { - // Patched update of IT 2.14 (0x0215 - 0x0217 == p1 - p3) - // p4 (as found on modland) adds the ITVSOUND driver, but doesn't seem to change - // anything as far as file saving is concerned. - madeWithTracker = MPT_UFORMAT("Impulse Tracker 2.14p{}")(fileHeader.cwtv - 0x0214); - } else - { - madeWithTracker = MPT_UFORMAT("Impulse Tracker {}.{}")((fileHeader.cwtv & 0x0F00) >> 8, mpt::ufmt::hex0<2>((fileHeader.cwtv & 0xFF))); - } + madeWithTracker = GetImpulseTrackerVersion(fileHeader.cwtv, fileHeader.cmwt); if(m_FileHistory.empty() && fileHeader.reserved != 0) { // Starting from version 2.07, IT stores the total edit time of a module in the "reserved" field Modified: branches/OpenMPT-1.31/soundlib/Load_s3m.cpp ============================================================================== --- branches/OpenMPT-1.31/soundlib/Load_s3m.cpp Sat Oct 26 13:15:55 2024 (r21920) +++ branches/OpenMPT-1.31/soundlib/Load_s3m.cpp Sat Oct 26 13:17:58 2024 (r21921) @@ -304,17 +304,11 @@ nonCompatTracker = true; break; case S3MFileHeader::trkImpulseTracker: - if(fileHeader.cwtv <= S3MFileHeader::trkIT2_14) - { - madeWithTracker = UL_("Impulse Tracker"); - formatTrackerStr = true; - } else if(fileHeader.cwtv == S3MFileHeader::trkIT1_old) - { + if(fileHeader.cwtv == S3MFileHeader::trkIT1_old) madeWithTracker = UL_("Impulse Tracker 1.03"); // Could also be 1.02, maybe? I don't have that one - } else - { - madeWithTracker = MPT_UFORMAT("Impulse Tracker 2.14p{}")(fileHeader.cwtv - S3MFileHeader::trkIT2_14); - } + else + madeWithTracker = GetImpulseTrackerVersion(fileHeader.cwtv, 0); + if(fileHeader.cwtv >= S3MFileHeader::trkIT2_07 && fileHeader.reserved3 != 0) { // Starting from version 2.07, IT stores the total edit time of a module in the "reserved" field Modified: branches/OpenMPT-1.31/soundlib/Sndfile.h ============================================================================== --- branches/OpenMPT-1.31/soundlib/Sndfile.h Sat Oct 26 13:15:55 2024 (r21920) +++ branches/OpenMPT-1.31/soundlib/Sndfile.h Sat Oct 26 13:17:58 2024 (r21921) @@ -978,6 +978,7 @@ bool LoadExtendedSongProperties(FileReader &file, bool ignoreChannelCount, bool* pInterpretMptMade = nullptr); void LoadMPTMProperties(FileReader &file, uint16 cwtv); + static mpt::ustring GetImpulseTrackerVersion(uint16 cwtv, uint16 cmwt); static mpt::ustring GetSchismTrackerVersion(uint16 cwtv, uint32 reserved); // Reads extended instrument properties(XM/IT/MPTM). |
From: <sv...@op...> - 2024-10-26 11:16:06
|
Author: sagamusix Date: Sat Oct 26 13:15:55 2024 New Revision: 21920 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21920 Log: Merged revision(s) 21910, 21919 from trunk/OpenMPT: [Ref] More GetNumSamples(), less m_nSamples. ........ [Imp] Pattern tab: Don't create undo steps when entering effect data into the pattern doesn't actually result in any change. ........ Modified: branches/OpenMPT-1.31/ (props changed) branches/OpenMPT-1.31/mptrack/CleanupSong.cpp branches/OpenMPT-1.31/mptrack/Ctrl_ins.cpp branches/OpenMPT-1.31/mptrack/Ctrl_pat.cpp branches/OpenMPT-1.31/mptrack/SampleGenerator.cpp branches/OpenMPT-1.31/mptrack/View_pat.cpp branches/OpenMPT-1.31/mptrack/mod2midi.cpp Modified: branches/OpenMPT-1.31/mptrack/CleanupSong.cpp ============================================================================== --- branches/OpenMPT-1.31/mptrack/CleanupSong.cpp Sat Oct 26 12:09:23 2024 (r21919) +++ branches/OpenMPT-1.31/mptrack/CleanupSong.cpp Sat Oct 26 13:15:55 2024 (r21920) @@ -779,7 +779,7 @@ return false; } - for(SAMPLEINDEX smp = 1; smp <= sndFile.m_nSamples; smp++) + for(SAMPLEINDEX smp = 1; smp <= sndFile.GetNumSamples(); smp++) { ModSample &sample = sndFile.GetSample(smp); Modified: branches/OpenMPT-1.31/mptrack/Ctrl_ins.cpp ============================================================================== --- branches/OpenMPT-1.31/mptrack/Ctrl_ins.cpp Sat Oct 26 12:09:23 2024 (r21919) +++ branches/OpenMPT-1.31/mptrack/Ctrl_ins.cpp Sat Oct 26 13:15:55 2024 (r21920) @@ -682,11 +682,11 @@ if (c != ' ') { n = (10 * pIns->Keyboard[m_nNote] + (c - '0')) % 10000; - if ((n >= MAX_SAMPLES) || ((sndFile.m_nSamples < 1000) && (n >= 1000))) + if ((n >= MAX_SAMPLES) || ((sndFile.GetNumSamples() < 1000) && (n >= 1000))) n = (n % 1000); - if ((n >= MAX_SAMPLES) || ((sndFile.m_nSamples < 100) && (n >= 100))) + if ((n >= MAX_SAMPLES) || ((sndFile.GetNumSamples() < 100) && (n >= 100))) n = (n % 100); - else if ((n > 31) && (sndFile.m_nSamples < 32) && (n % 10)) + else if ((n > 31) && (sndFile.GetNumSamples() < 32) && (n % 10)) n = (n % 10); } Modified: branches/OpenMPT-1.31/mptrack/Ctrl_pat.cpp ============================================================================== --- branches/OpenMPT-1.31/mptrack/Ctrl_pat.cpp Sat Oct 26 12:09:23 2024 (r21919) +++ branches/OpenMPT-1.31/mptrack/Ctrl_pat.cpp Sat Oct 26 13:15:55 2024 (r21920) @@ -686,7 +686,7 @@ if(n >= 0) { n = static_cast<int>(m_CbnInstrument.GetItemData(n)); - int nmax = (m_sndFile.m_nInstruments) ? m_sndFile.m_nInstruments : m_sndFile.m_nSamples; + int nmax = m_sndFile.GetNumInstruments() ? m_sndFile.GetNumInstruments() : m_sndFile.GetNumSamples(); if((n >= 0) && (n <= nmax) && (n != (int)m_nInstrument)) { m_nInstrument = static_cast<INSTRUMENTINDEX>(n); Modified: branches/OpenMPT-1.31/mptrack/SampleGenerator.cpp ============================================================================== --- branches/OpenMPT-1.31/mptrack/SampleGenerator.cpp Sat Oct 26 12:09:23 2024 (r21919) +++ branches/OpenMPT-1.31/mptrack/SampleGenerator.cpp Sat Oct 26 13:15:55 2024 (r21920) @@ -110,7 +110,7 @@ // Actual render loop. bool CSampleGenerator::RenderSample(CSoundFile *pSndFile, SAMPLEINDEX nSample) { - if(!CanRenderSample() || !TestExpression() || (pSndFile == nullptr) || (nSample < 1) || (nSample > pSndFile->m_nSamples)) return false; + if(!CanRenderSample() || !TestExpression() || (pSndFile == nullptr) || (nSample < 1) || (nSample > pSndFile->GetNumSamples())) return false; // allocate a new buffer sample_buffer = (mu::value_type *)malloc(sample_length * sizeof(mu::value_type)); Modified: branches/OpenMPT-1.31/mptrack/View_pat.cpp ============================================================================== --- branches/OpenMPT-1.31/mptrack/View_pat.cpp Sat Oct 26 12:09:23 2024 (r21919) +++ branches/OpenMPT-1.31/mptrack/View_pat.cpp Sat Oct 26 13:15:55 2024 (r21920) @@ -4811,20 +4811,18 @@ if(pSndFile == nullptr || !IsEditingEnabled_bmsg()) return; - PrepareUndo(m_Cursor, m_Cursor, "Volume Entry"); - ModCommand &target = GetCursorCommand(); - ModCommand oldcmd = target; // This is the command we are about to overwrite + ModCommand m = target; // This is the command we are about to overwrite const bool isDigit = (v >= 0) && (v <= 9); - if(target.IsPcNote()) + if(m.IsPcNote()) { - if(EnterPCNoteValue(v, target, &ModCommand::GetValueVolCol, &ModCommand::SetValueVolCol)) - m_PCNoteEditMemory = target; + if(EnterPCNoteValue(v, m, &ModCommand::GetValueVolCol, &ModCommand::SetValueVolCol)) + m_PCNoteEditMemory = m; } else { - ModCommand::VOLCMD volcmd = target.volcmd; - uint16 vol = target.vol; + ModCommand::VOLCMD volcmd = m.volcmd; + uint16 vol = m.vol; if(isDigit) { vol = ((vol * 10) + v) % 100; @@ -4849,7 +4847,7 @@ case kcSetVolumeITPortaDown: volcmd = VOLCMD_PORTADOWN; break; case kcSetVolumeITOffset: volcmd = VOLCMD_OFFSET; break; } - if(target.volcmd == VOLCMD_NONE && volcmd == m_cmdOld.volcmd) + if(m.volcmd == VOLCMD_NONE && volcmd == m_cmdOld.volcmd) { vol = m_cmdOld.vol; } @@ -4871,22 +4869,23 @@ vol %= 10; if(pSndFile->GetModSpecifications().HasVolCommand(volcmd)) { - m_cmdOld.volcmd = target.volcmd = volcmd; - m_cmdOld.vol = target.vol = static_cast<ModCommand::VOL>(vol); + m_cmdOld.volcmd = m.volcmd = volcmd; + m_cmdOld.vol = m.vol = static_cast<ModCommand::VOL>(vol); } } SetSelToCursor(); - if(oldcmd != target) + if(m != target) { + PrepareUndo(m_Cursor, m_Cursor, "Volume Entry"); SetModified(false); InvalidateCell(m_Cursor); UpdateIndicator(); } // Cursor step for command letter - if(!target.IsPcNote() && !isDigit && m_nSpacing > 0 && !IsLiveRecord() && TrackerSettings::Instance().patternStepCommands) + if(!m.IsPcNote() && !isDigit && m_nSpacing > 0 && !IsLiveRecord() && TrackerSettings::Instance().patternStepCommands) { if(m_Cursor.GetRow() + m_nSpacing < pSndFile->Patterns[m_nPattern].GetNumRows() || (TrackerSettings::Instance().m_dwPatternSetup & PATTERN_CONTSCROLL)) { @@ -4917,52 +4916,52 @@ } ModCommand &target = GetCursorCommand(); - ModCommand oldcmd = target; // This is the command we are about to overwrite - - PrepareUndo(m_Cursor, m_Cursor, "Effect Entry"); + ModCommand m = target; - if(target.IsPcNote()) + if(m.IsPcNote()) { - if(EnterPCNoteValue(c, target, &ModCommand::GetValueEffectCol, &ModCommand::SetValueEffectCol)) - m_PCNoteEditMemory = target; + if(EnterPCNoteValue(c, m, &ModCommand::GetValueEffectCol, &ModCommand::SetValueEffectCol)) + m_PCNoteEditMemory = m; } else if(pSndFile->GetModSpecifications().HasCommand(c)) { if(c != CMD_NONE) { - if((c == m_cmdOld.command) && (!target.param) && (target.command == CMD_NONE)) + if((c == m_cmdOld.command) && (!m.param) && (m.command == CMD_NONE)) { - target.param = m_cmdOld.param; + m.param = m_cmdOld.param; } else { m_cmdOld.param = 0; } m_cmdOld.command = c; } - target.command = c; + m.command = c; if(v >= 0) { - target.param = static_cast<ModCommand::PARAM>(v); + m.param = static_cast<ModCommand::PARAM>(v); } // Check for MOD/XM Speed/Tempo command if((pSndFile->GetType() & (MOD_TYPE_MOD | MOD_TYPE_XM)) - && (target.command == CMD_SPEED || target.command == CMD_TEMPO)) + && (m.command == CMD_SPEED || m.command == CMD_TEMPO)) { - target.command = static_cast<ModCommand::COMMAND>((target.param <= pSndFile->GetModSpecifications().speedMax) ? CMD_SPEED : CMD_TEMPO); + m.command = static_cast<ModCommand::COMMAND>((m.param <= pSndFile->GetModSpecifications().speedMax) ? CMD_SPEED : CMD_TEMPO); } } SetSelToCursor(); - if(oldcmd != target) + if(m != target) { + PrepareUndo(m_Cursor, m_Cursor, "Effect Entry"); + target = m; SetModified(false); InvalidateCell(m_Cursor); UpdateIndicator(); } // Cursor step for command letter - if(!target.IsPcNote() && m_nSpacing > 0 && !IsLiveRecord() && TrackerSettings::Instance().patternStepCommands) + if(!m.IsPcNote() && m_nSpacing > 0 && !IsLiveRecord() && TrackerSettings::Instance().patternStepCommands) { if(m_Cursor.GetRow() + m_nSpacing < pSndFile->Patterns[m_nPattern].GetNumRows() || (TrackerSettings::Instance().m_dwPatternSetup & PATTERN_CONTSCROLL)) { @@ -4983,35 +4982,34 @@ } ModCommand &target = GetCursorCommand(); - ModCommand oldcmd = target; // This is the command we are about to overwrite + ModCommand m = target; - PrepareUndo(m_Cursor, m_Cursor, "Parameter Entry"); - - if(target.IsPcNote()) + if(m.IsPcNote()) { - if(EnterPCNoteValue(v, target, &ModCommand::GetValueEffectCol, &ModCommand::SetValueEffectCol)) - m_PCNoteEditMemory = target; + if(EnterPCNoteValue(v, m, &ModCommand::GetValueEffectCol, &ModCommand::SetValueEffectCol)) + m_PCNoteEditMemory = m; } else { - target.param = static_cast<ModCommand::PARAM>((target.param << 4) | v); - if(target.command == m_cmdOld.command) + m.param = static_cast<ModCommand::PARAM>((m.param << 4) | v); + if(m.command == m_cmdOld.command) { - m_cmdOld.param = target.param; + m_cmdOld.param = m.param; } // Check for MOD/XM Speed/Tempo command if((pSndFile->GetType() & (MOD_TYPE_MOD | MOD_TYPE_XM)) - && (target.command == CMD_SPEED || target.command == CMD_TEMPO)) + && (m.command == CMD_SPEED || m.command == CMD_TEMPO)) { - target.command = static_cast<ModCommand::COMMAND>((target.param <= pSndFile->GetModSpecifications().speedMax) ? CMD_SPEED : CMD_TEMPO); + m.command = static_cast<ModCommand::COMMAND>((m.param <= pSndFile->GetModSpecifications().speedMax) ? CMD_SPEED : CMD_TEMPO); } } SetSelToCursor(); - if(target != oldcmd) + if(m != target) { + PrepareUndo(m_Cursor, m_Cursor, "Parameter Entry"); SetModified(false); InvalidateCell(m_Cursor); UpdateIndicator(); @@ -5235,7 +5233,7 @@ Limit(note, NOTE_MIN, NOTE_MAX); TempEnterNote(static_cast<ModCommand::NOTE>(note)); // Memorize note for key-up - ASSERT(size_t(val) < m_octaveKeyMemory.size()); + MPT_ASSERT(size_t(val) < m_octaveKeyMemory.size()); m_octaveKeyMemory[val] = target.note; } } @@ -5244,7 +5242,7 @@ // Stop note that has been triggered by entering an octave in the pattern. void CViewPattern::TempStopOctave(int val) { - ASSERT(size_t(val) < m_octaveKeyMemory.size()); + MPT_ASSERT(size_t(val) < m_octaveKeyMemory.size()); if(m_octaveKeyMemory[val] != NOTE_NONE) { TempStopNote(m_octaveKeyMemory[val]); @@ -5262,13 +5260,11 @@ return; } - PrepareUndo(m_Cursor, m_Cursor, "Instrument Entry"); - ModCommand &target = GetCursorCommand(); - ModCommand oldcmd = target; // This is the command we are about to overwrite + ModCommand m = target; // This is the command we are about to overwrite - UINT instr = target.instr, nTotalMax, nTempMax; - if(target.IsPcNote()) // this is a plugin index + UINT instr = m.instr, nTotalMax, nTempMax; + if(m.IsPcNote()) // this is a plugin index { nTotalMax = MAX_MIXPLUGINS + 1; nTempMax = MAX_MIXPLUGINS + 1; @@ -5288,20 +5284,21 @@ if(nTempMax < 100) // if we're using samples & have less than 100 samples instr = instr % 100; // or if we're using instruments and have less than 100 instruments // --> ensure the entered instrument value is less than 100. - target.instr = static_cast<ModCommand::INSTR>(instr); + m.instr = static_cast<ModCommand::INSTR>(instr); SetSelToCursor(); - if(target != oldcmd) + if(m != target) { + PrepareUndo(m_Cursor, m_Cursor, "Instrument Entry"); SetModified(false); InvalidateCell(m_Cursor); UpdateIndicator(); } - if(target.IsPcNote()) + if(m.IsPcNote()) { - m_PCNoteEditMemory = target; + m_PCNoteEditMemory = m; } } Modified: branches/OpenMPT-1.31/mptrack/mod2midi.cpp ============================================================================== --- branches/OpenMPT-1.31/mptrack/mod2midi.cpp Sat Oct 26 12:09:23 2024 (r21919) +++ branches/OpenMPT-1.31/mptrack/mod2midi.cpp Sat Oct 26 13:15:55 2024 (r21920) @@ -451,7 +451,7 @@ } if(!m_wasInstrumentMode) { - m_sndFile.m_nInstruments = std::min<INSTRUMENTINDEX>(m_sndFile.m_nSamples, MAX_INSTRUMENTS - 1u); + m_sndFile.m_nInstruments = std::min<INSTRUMENTINDEX>(m_sndFile.GetNumSamples(), MAX_INSTRUMENTS - 1u); } m_tracks.reserve(m_sndFile.GetNumInstruments() + 1); |
From: <sv...@op...> - 2024-10-26 10:09:30
|
Author: sagamusix Date: Sat Oct 26 12:09:23 2024 New Revision: 21919 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21919 Log: [Imp] Pattern tab: Don't create undo steps when entering effect data into the pattern doesn't actually result in any change. Modified: trunk/OpenMPT/mptrack/View_pat.cpp Modified: trunk/OpenMPT/mptrack/View_pat.cpp ============================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp Sat Oct 26 11:41:33 2024 (r21918) +++ trunk/OpenMPT/mptrack/View_pat.cpp Sat Oct 26 12:09:23 2024 (r21919) @@ -4926,20 +4926,18 @@ if(pSndFile == nullptr || !IsEditingEnabled_bmsg()) return; - PrepareUndo(m_Cursor, m_Cursor, "Volume Entry"); - ModCommand &target = GetCursorCommand(); - ModCommand oldcmd = target; // This is the command we are about to overwrite + ModCommand m = target; // This is the command we are about to overwrite const bool isDigit = (v >= 0) && (v <= 9); - if(target.IsPcNote()) + if(m.IsPcNote()) { - if(EnterPCNoteValue(v, target, &ModCommand::GetValueVolCol, &ModCommand::SetValueVolCol)) - m_PCNoteEditMemory = target; + if(EnterPCNoteValue(v, m, &ModCommand::GetValueVolCol, &ModCommand::SetValueVolCol)) + m_PCNoteEditMemory = m; } else { - ModCommand::VOLCMD volcmd = target.volcmd; - uint16 vol = target.vol; + ModCommand::VOLCMD volcmd = m.volcmd; + uint16 vol = m.vol; if(isDigit) { vol = ((vol * 10) + v) % 100; @@ -4964,7 +4962,7 @@ case kcSetVolumeITPortaDown: volcmd = VOLCMD_PORTADOWN; break; case kcSetVolumeITOffset: volcmd = VOLCMD_OFFSET; break; } - if(target.volcmd == VOLCMD_NONE && volcmd == m_cmdOld.volcmd) + if(m.volcmd == VOLCMD_NONE && volcmd == m_cmdOld.volcmd) { vol = m_cmdOld.vol; } @@ -4986,22 +4984,23 @@ vol %= 10; if(pSndFile->GetModSpecifications().HasVolCommand(volcmd)) { - m_cmdOld.volcmd = target.volcmd = volcmd; - m_cmdOld.vol = target.vol = static_cast<ModCommand::VOL>(vol); + m_cmdOld.volcmd = m.volcmd = volcmd; + m_cmdOld.vol = m.vol = static_cast<ModCommand::VOL>(vol); } } SetSelToCursor(); - if(oldcmd != target) + if(m != target) { + PrepareUndo(m_Cursor, m_Cursor, "Volume Entry"); SetModified(false); InvalidateCell(m_Cursor); UpdateIndicator(); } // Cursor step for command letter - if(!target.IsPcNote() && !isDigit && m_nSpacing > 0 && !IsLiveRecord() && TrackerSettings::Instance().patternStepCommands) + if(!m.IsPcNote() && !isDigit && m_nSpacing > 0 && !IsLiveRecord() && TrackerSettings::Instance().patternStepCommands) { if(m_Cursor.GetRow() + m_nSpacing < pSndFile->Patterns[m_nPattern].GetNumRows() || (TrackerSettings::Instance().m_dwPatternSetup & PATTERN_CONTSCROLL)) { @@ -5032,52 +5031,52 @@ } ModCommand &target = GetCursorCommand(); - ModCommand oldcmd = target; // This is the command we are about to overwrite - - PrepareUndo(m_Cursor, m_Cursor, "Effect Entry"); + ModCommand m = target; - if(target.IsPcNote()) + if(m.IsPcNote()) { - if(EnterPCNoteValue(c, target, &ModCommand::GetValueEffectCol, &ModCommand::SetValueEffectCol)) - m_PCNoteEditMemory = target; + if(EnterPCNoteValue(c, m, &ModCommand::GetValueEffectCol, &ModCommand::SetValueEffectCol)) + m_PCNoteEditMemory = m; } else if(pSndFile->GetModSpecifications().HasCommand(c)) { if(c != CMD_NONE) { - if((c == m_cmdOld.command) && (!target.param) && (target.command == CMD_NONE)) + if((c == m_cmdOld.command) && (!m.param) && (m.command == CMD_NONE)) { - target.param = m_cmdOld.param; + m.param = m_cmdOld.param; } else { m_cmdOld.param = 0; } m_cmdOld.command = c; } - target.command = c; + m.command = c; if(v >= 0) { - target.param = static_cast<ModCommand::PARAM>(v); + m.param = static_cast<ModCommand::PARAM>(v); } // Check for MOD/XM Speed/Tempo command if((pSndFile->GetType() & (MOD_TYPE_MOD | MOD_TYPE_XM)) - && (target.command == CMD_SPEED || target.command == CMD_TEMPO)) + && (m.command == CMD_SPEED || m.command == CMD_TEMPO)) { - target.command = static_cast<ModCommand::COMMAND>((target.param <= pSndFile->GetModSpecifications().speedMax) ? CMD_SPEED : CMD_TEMPO); + m.command = static_cast<ModCommand::COMMAND>((m.param <= pSndFile->GetModSpecifications().speedMax) ? CMD_SPEED : CMD_TEMPO); } } SetSelToCursor(); - if(oldcmd != target) + if(m != target) { + PrepareUndo(m_Cursor, m_Cursor, "Effect Entry"); + target = m; SetModified(false); InvalidateCell(m_Cursor); UpdateIndicator(); } // Cursor step for command letter - if(!target.IsPcNote() && m_nSpacing > 0 && !IsLiveRecord() && TrackerSettings::Instance().patternStepCommands) + if(!m.IsPcNote() && m_nSpacing > 0 && !IsLiveRecord() && TrackerSettings::Instance().patternStepCommands) { if(m_Cursor.GetRow() + m_nSpacing < pSndFile->Patterns[m_nPattern].GetNumRows() || (TrackerSettings::Instance().m_dwPatternSetup & PATTERN_CONTSCROLL)) { @@ -5098,35 +5097,34 @@ } ModCommand &target = GetCursorCommand(); - ModCommand oldcmd = target; // This is the command we are about to overwrite + ModCommand m = target; - PrepareUndo(m_Cursor, m_Cursor, "Parameter Entry"); - - if(target.IsPcNote()) + if(m.IsPcNote()) { - if(EnterPCNoteValue(v, target, &ModCommand::GetValueEffectCol, &ModCommand::SetValueEffectCol)) - m_PCNoteEditMemory = target; + if(EnterPCNoteValue(v, m, &ModCommand::GetValueEffectCol, &ModCommand::SetValueEffectCol)) + m_PCNoteEditMemory = m; } else { - target.param = static_cast<ModCommand::PARAM>((target.param << 4) | v); - if(target.command == m_cmdOld.command) + m.param = static_cast<ModCommand::PARAM>((m.param << 4) | v); + if(m.command == m_cmdOld.command) { - m_cmdOld.param = target.param; + m_cmdOld.param = m.param; } // Check for MOD/XM Speed/Tempo command if((pSndFile->GetType() & (MOD_TYPE_MOD | MOD_TYPE_XM)) - && (target.command == CMD_SPEED || target.command == CMD_TEMPO)) + && (m.command == CMD_SPEED || m.command == CMD_TEMPO)) { - target.command = static_cast<ModCommand::COMMAND>((target.param <= pSndFile->GetModSpecifications().speedMax) ? CMD_SPEED : CMD_TEMPO); + m.command = static_cast<ModCommand::COMMAND>((m.param <= pSndFile->GetModSpecifications().speedMax) ? CMD_SPEED : CMD_TEMPO); } } SetSelToCursor(); - if(target != oldcmd) + if(m != target) { + PrepareUndo(m_Cursor, m_Cursor, "Parameter Entry"); SetModified(false); InvalidateCell(m_Cursor); UpdateIndicator(); @@ -5350,7 +5348,7 @@ Limit(note, NOTE_MIN, NOTE_MAX); TempEnterNote(static_cast<ModCommand::NOTE>(note)); // Memorize note for key-up - ASSERT(size_t(val) < m_octaveKeyMemory.size()); + MPT_ASSERT(size_t(val) < m_octaveKeyMemory.size()); m_octaveKeyMemory[val] = target.note; } } @@ -5359,7 +5357,7 @@ // Stop note that has been triggered by entering an octave in the pattern. void CViewPattern::TempStopOctave(int val) { - ASSERT(size_t(val) < m_octaveKeyMemory.size()); + MPT_ASSERT(size_t(val) < m_octaveKeyMemory.size()); if(m_octaveKeyMemory[val] != NOTE_NONE) { TempStopNote(m_octaveKeyMemory[val]); @@ -5377,13 +5375,11 @@ return; } - PrepareUndo(m_Cursor, m_Cursor, "Instrument Entry"); - ModCommand &target = GetCursorCommand(); - ModCommand oldcmd = target; // This is the command we are about to overwrite + ModCommand m = target; // This is the command we are about to overwrite - UINT instr = target.instr, nTotalMax, nTempMax; - if(target.IsPcNote()) // this is a plugin index + UINT instr = m.instr, nTotalMax, nTempMax; + if(m.IsPcNote()) // this is a plugin index { nTotalMax = MAX_MIXPLUGINS + 1; nTempMax = MAX_MIXPLUGINS + 1; @@ -5403,20 +5399,21 @@ if(nTempMax < 100) // if we're using samples & have less than 100 samples instr = instr % 100; // or if we're using instruments and have less than 100 instruments // --> ensure the entered instrument value is less than 100. - target.instr = static_cast<ModCommand::INSTR>(instr); + m.instr = static_cast<ModCommand::INSTR>(instr); SetSelToCursor(); - if(target != oldcmd) + if(m != target) { + PrepareUndo(m_Cursor, m_Cursor, "Instrument Entry"); SetModified(false); InvalidateCell(m_Cursor); UpdateIndicator(); } - if(target.IsPcNote()) + if(m.IsPcNote()) { - m_PCNoteEditMemory = target; + m_PCNoteEditMemory = m; } } |