1. 10 Nov, 2021 3 commits
    • Joel K. Pettersson's avatar
      Set version to v0.3.9. · c0c60578
      Joel K. Pettersson authored
    • Joel K. Pettersson's avatar
      Refactor parseconv, voicegraph, utility modules. · 95c7623a
      Joel K. Pettersson authored
      Refactor parseconv and voicegraph, use mempool for all produced
      data. Rename ptrlist to ptrarr.
      Add and use "mpmemdup" methods for arrtype and ptrarr,
      replacing ordinary "memdup" and traversal for freeing.
      Change log:
       * 2020-10-08: Simplified reworking of part of v0.3.6 redesign.
             The old ptrlist module is used, and nodelist is ignored.
         Old branch:
          - 2019-12-31: Renaming and refactoring.
                Add and use arrtype "mpmemdup" for scriptconv
                and voicegraph arrays, removing all but one free.
          - 2020-01-01: Add and use ptrlist "mpmemdup"; simplify,
                turn SAU_ProgramEvent array into array of pointers.
          - 2020-01-03: Merge de-const-ify ptrlist void pointers.
          - 2020-01-04: Move down from later v0.3.6 commits.
          - 2020-02-27: Remove const from parameters for arrtype
                memdup functions.
          - 2020-07-26: ISC-relicense arrtype, ptrlist, nodelist.
       * 2020-10-09: Move down to sgensys v0.2-beta.
       * 2021-11-02: Move to saugns on top of new sgensys.
         Old branch:
          - 2020-10-09: Rename ptrlist to ptrarr.
    • Joel K. Pettersson's avatar
      Rename project to 'saugns' from 'sgensys'. · b869cdbd
      Joel K. Pettersson authored
      Rename the program from 'sgensys'
      to 'saugns' (Scriptable AUdio GeNeration System).
      Change SSG prefix to SAU throughout code.
      Rename scripts from *.sgs
      to *.sau, naming the language SAU (Scriptable AUdio).
      Update descriptions in README.
      Set version to v0.3-dev.
      Change log:
       * 2018-12-05: Rename to 'saugns'. Change SGS prefix to SAG.
       * 2019-01-21: Update for newer code. Change prefix to AGS.
       * 2019-01-22: Bump copyright years. Change prefix to SAU.
             Rename scripts from *.sgs to *.sau, polish README.
       * 2019-07-04: Update for newer code. Tag "v0.3.0".
       * 2019-08-18: Increase version suffix to 'b'.
       * 2019-12-25: Update for newer code.
       * 2020-01-03: Increase version suffix to 'c'.
       * 2020-02-09: Update for newer code. Tag "v0.3.6e-2".
       * 2020-07-26: Update for newer code. Set version to v0.3-dev.
       * 2021-11-10: Update to latest code.
  2. 01 Nov, 2021 10 commits
    • Joel K. Pettersson's avatar
      Add help module, expand -h with <topic>. More cli clean-up. · 9cff9c36
      Joel K. Pettersson authored
      Command-line behavior:
       * Change the -h option to list topics
         available with -h <topic>. For now,
         only other lists are available, the
         first built-in help consisting of a
         'wave' type list and a 'ramp' list.
       * Print -p info for each script just prior to
         generating audio for it if done, instead of
         printing for all before generating for all.
      Parser warnings now use the new code for
      listing valid items. But a meta-list, of
      the lists to be available with -h, needs
      manual extension in help.c when more are
      added. All lists are in the same format.
      Change cli argument parsing to allow a flag to be followed
      by its argument without a space in-between. Recognize "--"
      as meaning no further strings are flags. Uses SGS_getopt()
      derived from Christopher Wellons's public domain getopt().
      Should fix the old cli non-POSIX annoyances & limitations.
      Option flag enum and handling is moved to 'sgensys.h'
      and the 'loader/loader.c' and 'player/player.c' code.
      Change log:
       * 2020-01-18: Add help module, expand -h.
             Simple code for printing out name array,
             used for wave module. Easily extended to
             print out more lists in the same format.
       * 2020-07-23: Move to saugns
             from the 2020-06 "mgensys" experiment.
             Replace 'noise' help type with 'ramp'.
         Old branch:
          - 2020-02-10: Add noise module with noise names,
                and add help type.
       * 2020-11-12: Group -p info printing with
             other per-script output generation.
       * 2020-12-20: List 'help' help type in itself.
             Change -h to also list normal usage info
             unless a topic is named.
       * 2021-01-08: Add SSG_getopt() and use in ssndgen.c.
             Change common module license from ISC to 0BSD.
             Point the user to pass -h on cli option error.
       * 2021-07-21: Move down to new sgensys.
    • Joel K. Pettersson's avatar
      Change Makefile & ramp module for improved performance. · 1c4af8e1
      Joel K. Pettersson authored
      Makefile changes to selectively use -O3.
      Use -Os where it matters most, currently
      the parser, for avoidance of size bloat.
      Comparing saugns v0.3.8 and v0.3.8b this
      made a large difference (as noted in the
      v0.3.8b tag). Also tweak the ramp module
      and move mulbuf use and further clean up
      the code as part of performance changes.
      Always handle/allow NULL mulbuf in ramp.
      Further accept a NULL pos to skip ahead,
      making the target value the state value.
      Change log:
       * 2020-10-27: Make ramp SSG_Ramp_skip()
             skip all remaining values if pos is NULL.
             May remain unused without a new use-idea.
       * 2021-01-12: Makefile changes to selectively use -O3 and -Os.
             ramp: Move mulbuf use into fill functions, improving the
             performance with clang 10. SSG_Ramp_run() mulbuf NULL
             checks to allow calls with missing mulbuf in the future.
       * 2021-01-15: Add noinline attribute for SSG_Ramp_fill_hold(),
             document necessity with clang where inlining hurt x86
             performance (costing half the 10% speed-up on the laptop
             with i386 OpenBSD, fixed with the use of SSG__noinline).
       * 2021-01-16: Tidy ramp.c and correct the comment on clang.
       * 2021-07-21: Move down to new sgensys.
       * 2021-07-22: Reorder the Makefile dependencies
             in each line alphabetically, while at it.
    • Joel K. Pettersson's avatar
      Rework scanner, symtab, clean up parser a bit. · fc986a9d
      Joel K. Pettersson authored
      Redesign scanner, and use the new way of
      filtering whitespace in parser. Further
      testing of line and char position numbering
      needed, but now better than with the v0.3.0
      scanner design. Also use refactored symtab
      with no functional change.
       * Add whitespace filtering level setting.
         Setting the level replaces the whitespace filtering
         functions in the table for the scanner instance.
       * Remove "nospace" versions of get/try functions.
         Simplify get function. Remove old space-skipping
         inline functions.
      Change log:
       * 2019-07-07: scanner: Add ws filter level setting.
             Remove nospace versions of functions.
             Use next design. Consistent for filtering,
             even if changed. Clear up ws types naming,
             really fill in everything. Tidying.
       * 2019-07-09: Scanner flag fix.
             (Recommitted after fixing the fix.)
             Set version to v0.3.1.
       * 2019-07-11: Microflensing.
             scanner: Remove "RAW" (NULL-pointer) ws level,
             rename "PASS" to "ALL" and make it the default
             (instead of "RED1").
       * 2019-08-05: Place after new v0.3.0,
             with July syntax changes split out into v0.2.13.
       * 2019-08-17: Remove scanner ws levels between ALL and NONE.
             (Not needed in current program.)
       * 2019-10-31: (Rebased on top of new v0.2.15.)
       * 2019-12-24: Merge ramp and v0.2.5-related changes.
       * 2020-02-09: Refactor num.exp. parsing.
       * 2021-07-10: Move down redesign changes
             to after change to use the scanner
             and merge with symtab refactoring.
             Keep version at v0.2-dev.
         Old branch:
          - 2019-12-27: symtab: For varying TabItem size,
                use sizeof and key[] instead of offsetof and key[1].
                (Resulting object file identical.)
          - 2020-01-26: Import from saugns v0.3.6d.
                Remove symtab get/set functions,
                rename types, expose MGS_SymStr type - used directly
                in parser to simplify code. Also changes
                to append NULL pointer to pool_stra arrays.
          - 2020-11-14: Clean up name/ver in cli strings.
          - 2020-11-20: Upgrade symtab to 2020-06 "mgensys"
                version and adapt the parser.
       * 2021-07-12: Change more struct array [1] members to [].
       * 2021-07-24: Move down a little parser style changes.
    • Joel K. Pettersson's avatar
      Use the new scanner. Extend comment syntax. Clean-up. · 38dac806
      Joel K. Pettersson authored
      Make the test scanner functional for use in the parser
      and change the parser to use the scanner module.
      (The scanner is now also used in the test lexer,
      replacing much of it.)
      C-style and C++-style comments are now supported
      (in addition to '#' line comments and the use of 'Q').
      The parser's old PScanner and warning printouts are
      replaced. Warnings now provide not only line, but also
      character, numbering. Most direct use of the file module
      is replaced. String and number reading is also further
      Scanner design changes include:
       * Flesh out design for tracking line and character positions.
         A fixed number of multiple ungets in a row are supported,
         using a circular buffer for scan frames, advanced each get.
       * Add pointer parameter to warning/error message functions
         for optionally overriding position info. (E.g. copy earlier
         position, use it when warning after more scan calls.)
       * Add number-reading functions (wrappers around those of
         the file module).
       * Add further space-skipping reading functions.
      Further refactoring:
       * Always check for NULL pointer in type
         destroy_*() functions, remove checks where called.
       * Minor code style changes for consistency.
      Set version to v0.2-dev.
      Reindent parser.c (the only remaining file).
      Use new comment styles in scripts.
      Change log:
       * 2019-05-15: Use the new scanner.
             Initial merge after changes as of v0.4.4.
             Adapt: Preserve use of symtab in scanner,
             remove wrapper function around string reading
             in parser. Let scanner handle file opening,
             replacing v0.4.1 additions in builder.c.
             Some comment and code clean-ups.
         Old branch:
          - 2018-12-17: scanner: Some renaming and clean-ups.
                Add, use, flag for overwriting scan frame next get.
          - 2018-12-18: scanner: Add advance_frame(), used to
                handle scan frames for symbol string reading.
          - 2018-12-19: Use scanner module in parser.
                Add SGS_Scanner_geti(), SGS_Scanner_getd().
                Debug line and char numbering.
                Move symtab use from scanner to parser,
                move string buffer from scanner to parser,
                refactor string reading in parser.
                Rename SGS_Scanner_unget()
                back to SGS_Scanner_ungetc().
                Add quick handling for unfiltered characters
                to SGS_Scanner_tryc() and SGS_Scanner_tryc_nospace().
                Move reading of SGS_SCAN_C_LNBRK
                flag out from SGS_Scanner_tryc_nospace().
                Add scanner statistics printing #define
                to common.h and #if'd counters in scanner.c.
                Refactor parser time number scanning.
                Further clean-ups in parser.
          - 2018-12-21: Comment and other minor clean-ups.
                Update README.
          - 2019-01-05: Complete branch merging.
                Use SGS_Scanner_getc_nospace() in parser.
                Clean up printing of no label warning in parser,
                silencing warning about non-const format string.
                Refactor parser uses of scan_symafind(),
                moving warning printouts into it.
          - 2019-01-09: Use scanner in lexer.
                Add SGS_SCAN_S_QUIET flag, use in lexer
                for SGS_LEXER_QUIET compile-time mode.
                Note: File module needs design change
                for safe unget, crash preventing code
                added to scanner in the meantime.
                Complete branch merging.
          - 2019-01-10: Complete branch merging.
                Remove obsolete debug code in scanner
                (file module now fixed).
          - 2019-01-11: Set version to v0.6.0.
                Clean-up in lexer. Use SGS_Scanner_getc_nospace().
          - 2019-01-15: Restructure parser code to
                reduce differences with previous version.
                No functional change.
       * 2019-05-17: Some tidying for last branch merge.
       * 2019-05-19: parser: Avoid duplicating code for name of
             script for string as file, copy name from file object.
       * 2019-05-24: Set version to v0.5.1.
             scanner: Name changes.
             in general: Always check for NULL pointer in type
             destroy_*() functions, remove checks where called.
             Minor code style changes for consistency.
       * 2019-05-28: Merge refactoring.
             Reindent parser.c (and adjust comments).
         Old branch:
          - 2019-02-08: Refactor parser warnings for
                EOF before closing character, and closing
                character without opening character.
       * 2019-06-04: Move refactoring back to v0.5.1,
             use old version number.
       * 2019-06-05: Merge parser diff after v0.2.3 syntax change.
       * 2019-06-07: Update debug script for too-long label
             for new scanner (new max length is 255).
       * 2019-06-13: Set version to v0.3.1.
       * 2019-06-16: Adjust parser for new v0.2.4 syntax changes.
       * 2019-06-20: Set version to v0.3.0.
       * 2019-06-30: Place after the split-out v0.2.12.
             Update comment style used in scripts.
       * 2019-07-04: Update for v0.2.12 'r' syntax change.
       * 2019-08-05: Update for v0.2.13 syntax changes.
       * 2019-10-08: Place after new v0.2.14.
       * 2019-10-31: Place after new v0.2.15.
       * 2019-12-21: Merge 'S a' multiplier apply-to-ramp fix.
       * 2019-12-22: Merge composite timing fix.
       * 2019-12-24: Merge changes related to v0.2.5 & v0.2.13.
       * 2019-12-25: Merge ramp default time changes.
       * 2020-02-09: Merge num.exp. fix for successive subtractions.
       * 2020-07-23: Merge renaming in ramp module.
       * 2020-07-26: Set version to v0.2-dev.
       * 2021-07-10: Move down as in v0.3.3
             and merge new work before the skipped.
             (Fixes included, not the stage split.)
    • Joel K. Pettersson's avatar
      Fix -r 1 hang, make 96000 default. Reorganize code. · 3f37b1ee
      Joel K. Pettersson authored
      Move 'audiodev' and 'wavfile' modules to 'player/',
      move 'renderer.c' into 'player/' as 'player.c', and
      rename 'builder/' to 'loader/', move 'builder.c' to
      'loader/' as 'loader.c'. Rename keyword-like SGS__*
      macros to sgs* without functional change. Relicense
      'audiodev' and 'wavfile' files, from LGPL-3 to ISC.
      Rename 'test-builder' to 'test-scan' and name
      the Makefile target 'tests' instead of 'test'
      (and minimize its linkage file dependencies).
      Change default -r sample rate to 96000 Hz,
      undoing the 2012-02-10 change to 44100 Hz.
      Add minimum per-channel buffer length
      (currently 1 sample) in player.c, fix
      hang if/when -r 1 loops 0-length run.
      Expand 'IDEAS' file on design
      ideas, and rename 'IDEAS.md'.
      Change log:
       * 2019-12-15: Expand 'IDEAS' file, and rename 'IDEAS.md'.
       * 2020-07-22: Rename renderer part -> player
             and move the audiodev & wavfile files.
             Also includes renaming SGS__* defines,
             for consistency, to sgs* (more like in
             2020-06 "mgensys"), and relicensing of
             audiodev & wavfile from LGPL-3 to ISC.
       * 2020-07-26: Reduce diff with 2020-06 "mgensys" experiment,
             changing default sample rate to 96000 Hz (was 44100 Hz
             after 2012-02-10). Also use ISC license header for the
             common module and math.h, to keep permissive code free
             from dependencies on including non-permissive code.
       * 2020-11-09: Renaming in "player/player.c".
       * 2020-12-14: Ensure output buffer holds >= 1 sample, fix
             hang with -r 1 when 0 samples were ran in run loop.
       * 2021-07-25: Move builder.c into builder/.
             Rename "test-builder" to "test-scan".
       * 2021-10-26: Rename 'builder/', 'loader/'.
    • Joel K. Pettersson's avatar
      Support running multiple scripts. Use larger output buffer. · 76ef7574
      Joel K. Pettersson authored
      Support multiple script files or strings per command-line
      invocation. Also make corresponding changes to the
      'test-builder' program. (Use SGS_PtrList in main module,
      builder, and renderer for lists. Combine the old behavior
      with running through a batch of things at each stage.)
      Use 256 ms of audio output buffering in renderer.
      Fixes stuttering on NetBSD 8 (which requires >= 128 ms
      of buffering for consistently smooth playback).
      The extra 128 ms is for the sake of portability.
      (All non-NetBSD systems I personally use have however
      worked fine with the old 1024 sample buffering.)
      While at it, also increase the generator's internal
      buffer length from the ancient value of 256 samples
      to 1024. (This is simply a performance vs. memory
      use trade-off. The number of buffers could potentially
      grow into the hundreds or thousands for extreme input.
      This increases memory use fairly conservatively.)
      Const-ify pointers to non-modified SGS_Program instances.
      Change log:
       * 2019-06-04: Move multiple script args support back
             to v0.5.0, use the old version number.
         Old branch:
          - 2019-02-10: Support multiple script paths per
                command-line invocation. Also make corresponding
                changes to the 'test-builder' program.
                Move ptrlist to main dir (out of builder/).
                Increase version to v0.6.1.
                Const-ify non-modified SAU_Program pointers.
          - 2019-05-28: Merge support for multiple script args,
                and refactoring. Combine with support
                for -e <string> in the simplest way.
                Set version to v0.5.2. Update README.
          - 2019-05-29: Tweak usage notice.
       * 2019-06-18: Merge audio buffering changes.
             Move it all back to after v0.2.8,
             set version to v0.2.9.
         Old branch:
          - 2019-06-13: Increase generator buffer length
                from 256 samples to 1024 samples.
          - 2019-06-14: Change renderer output buffer
                sizing to remove stuttering on NetBSD.
                (Use 256 ms instead of 1024 samples.)
                Refactor the code in the process.
                Increase version to v0.3.2.
       * 2019-02-09: Merge changes for renderer.c,
             fixing crash on opening several files when
             only some failed to open.
             Simplify usage notice.
         Old branch:
          - 2019-06-22: Minor refactoring in renderer.c.
          - 2020-02-03: Add missing NULL checks in renderer.c;
                check for NULL programs, as is supposed to be done.
       * 2020-07-13: Keep version at v0.2-beta.
    • Joel K. Pettersson's avatar
      Use restrict keyword. Update test code & split out as program. · 2f5b86aa
      Joel K. Pettersson authored
      Use restrict keyword for pointer function parameters
      throughout code. For now, this is the only use.
      Makes for a minor size and speed improvement.
      The design has been checked for safety with this,
      though something could have been missed.
      Various smaller updates for test lexer and scanner code.
      Split out usage of the test lexer and test scanner
      into the separate 'test-builder' program,
      built with 'make test'.
      Also add install/uninstall targets to Makefile.
      Change log:
       * 2018-11-18: Reduce lexer char switch cases to values 0-127,
             use default for the identical rest.
             Reduce scanner char handler array to 128 values,
             use entry for 0 when char > 127.
       * 2018-11-19: Move test lexer use to
             separate 'test-builder' program,
             instead of conditionally compiling it into sgensys.
             Add (unused) SGS_Scanner_handle_char1comments()
             for first-character-only line comment openers.
       * 2018-11-22: Move test scanner use to
             'test-builder' program.
             Complete branch merging.
       * 2018-11-23: Add SGS_Scanner_close().
       * 2018-11-28: Use restrict keyword.
             For now, only add to function argument pointers.
             Reduces size of the binary somewhat,
             and produces very marginal speed-up.
       * 2019-05-06: Move back to after new v0.4.2.
             Increase version to v0.4.3.
             Change test scanner file handling,
             write new SGS_Scanner_open().
             Copy scanner file handling to lexer.
             Update test-builder for new code.
       * 2019-05-10: Tweak usage notice.
             Fix missing part of scanner.c merge.
       * 2019-06-13: Set version to v0.2.8. Re-merge tidying.
       * 2019-06-22: Makefile: add install/uninstall targets.
       * 2019-09-12: Merge diff for renaming slope module to ramp.
       * 2020-07-13: Keep version at v0.2-beta.
    • Joel K. Pettersson's avatar
      Add -e string evaluation option. Add test scanner. · 5c1c51ed
      Joel K. Pettersson authored
      Support direct evaluation of a string argument with
      a new -e option. E.g., ./sgensys -e "Osin f643 t1"
      will run (play) a 643 Hz oscillator for 1 second.
      Add experimental test scanner, a reworking of
      the test lexer; a draft for future redesign,
      as in breaking up the tasks of the lexer
      and/or an intermediate parser redesign.
      Add file module string open/read/close code,
      and change sgensys, builder, parser, lexer to use it.
      Also add support to file for creating nested instances,
      in preparation for future nested file usage.
      Updates to the test lexer.
      Change log:
       * 2019-04-24: Add file module string open/read/close code.
       * 2019-04-25: Name changes in file.
       * 2019-04-29: Move back to after new v0.4.0.
       * 2019-04-30: Add -e string evaluation option.
             Also change file module to support nested (linked)
             instances, in preparation for future addition
             of nested file usage (prepend/predefine arg,
             file includes from file, etc.).
             Increase version to v0.4.1.
             Merge test lexer changes,
             with some final tweaks.
         Old branch:
          - 2018-11-04: Import updated test lexer code.
                (Drop new test scanner for now.)
          - 2018-11-09: Silence warnings in test lexer.
          - 2018-11-15: Use SGS_File_skipline() in test lexer.
          - 2018-11-16: Debug test lexer, also a few clean-ups
                and performance tweaks.
          - 2018-11-18: Minor fixes and tweaks for test lexer.
          - 2018-11-19: Minor clean-up in test lexer.
          - 2019-01-14: Use SGS_File_trynewline() in test lexer.
       * 2019-05-04: Add test scanner module,
             merging tidied up basic version.
         Old branch:
          - 2018-03-25: Add scanner module (incomplete)
                for use in parser (next) and lexer (later).
          - 2018-04-07: Some debugging and improvements
                for test scanner.
          - 2018-04-13: Improve test scanner design and
                add C-style comment support.
          - 2018-11-05: Complete branch merging.
                (Add the postponed test scanner.)
                Minor clean-up in test scanner.
          - 2018-11-09: Silence warnings in test scanner.
          - 2018-11-15: Use SGS_File_skipspace(),
                SGS_File_skipline(), in test scanner.
          - 2018-11-18: Properly check scanner EOF status for error.
          - 2018-11-19: Renaming and minor changes in test scanner.
                Use symtab in scanner symbol string reading.
          - 2019-01-14: Use SGS_File_trynewline() in test scanner.
       * 2019-05-08: Tweak usage notice.
       * 2019-05-10: Add -e quick test to README.
             Fix parser string matching when item
             ends with end of file marker
             (as happens with -e "Osin").
             Fix missing part of scanner.c merge.
       * 2019-06-13: Set version to v0.2.7.
             Merge minor code tidying for lexer.c, scanner.c.
       * 2020-02-09: Simplify usage notice.
       * 2020-07-13: Keep version at v0.2-beta.
    • Joel K. Pettersson's avatar
      Add ramp module, refactor parser & generator. Fixes. · 109850a1
      Joel K. Pettersson authored
       * Adjust which flags the parser checks to
         allow/disallow nesting-dependent 'r' and 'i'
         syntax elements, correcting handling for
         label references. Also make the parser use
         flags to cleanly guard against wrong end_*()
         processing for nested ParseLevel instances.
       * Add checks in parser to reject infinite numbers
         and expressions containing them.
       * For ramp default time duration, carry over
         'S t' default time instead of using a fixed
         1 second default. Changes default time for
         panning, and for operator ramps where the
         operator previously had infinite time set.
       * Turn Valit (VALue ITeration) types and code
         from program.h and generator.c into the new
         ramp module and SGS_Ramp type.
       * Simplify parse level SDPL_IN_* "location".
         Replace flags and macros with a simple enum state.
         No functional change, as only one flag was set at
         a time.
       * Use size_t for string and buffer lengths.
      Change wave LUTs from 16-bit int to float
      (refactoring osc & updating generator).
      No significant quality difference in the output,
      as mixing is still 16-bit.
      Change log:
       * 2019-06-13: Merge various clean-ups, and the change of
             wave LUTs from 16-bit int to float.
             Set version to v0.2.5.
         Old branch:
          - 2018-07-30: Change "http" to "https" in
                heading license comment.
          - 2018-11-06: Break out slope from program/generator.
                Change wave LUTs from int16_t to float.
                Refactor osc, update generator.
          - 2019-04-30: Place after new v0.4.1.
                Increase version to v0.4.2.
                Bring in README update.
          - 2018-12-29: Add check for infinite numbers in parser,
                refactor reading of multiplicative inverse numbers.
          - 2018-12-30: Change uint32_t to size_t for string lengths.
          - 2019-01-11: Complete merge of uint32_t -> size_t changes.
          - 2019-05-04: Add SGS__malloclike()
                to SGS_create_*() functions where missing.
          - 2019-05-17: Add missing #pragma once to slope.h.
          - 2019-06-05: Merge README diff after v0.2.3 syntax change.
       * 2019-08-07: Merge Makefile -ffast-math portability fix.
       * 2019-09-12: Rename slope module to ramp.
             (For cleaner diffs and old versions.)
       * 2019-12-21: Merge 'S a' multiplier apply-to-ramp fix.
       * 2019-12-22: Merge composite timing fix.
       * 2019-12-24: Move down clean-up changes
             from v0.2.6, v0.2.12, and v0.3.1d.
             Also change default time for ramp, using a flag
             instead of placeholder value, and using the 'S t'
             value instead of a fixed 1 second.
         Old branch:
          - 2018-12-29: Complete branch merging.
                Simplify parse level SDPL_IN_* "location",
                replacing flags and macros with a simple enum
                state, as only one flag was set at a time.
          - 2019-07-18: Use isinf() for infinite-number checks.
                Use isnan() for portable NAN checks in parser.
          - 2019-09-12: Merge down to v0.2.12.
          - 2019-12-21: Change which flags are checked to
                allow/disallow 'r' (rel. freq.) and 'i' (inf. time),
                fixing syntax for "@label" references. Update README.
                Change parser to use flags to cleanly guard
                against wrong end_*() processing for nested
                ParseLevel instances.
       * 2020-07-13: Keep version at v0.2-beta.
    • Joel K. Pettersson's avatar
      Further syntax changes. More bugfixes. Reorganize code. · d8ec9664
      Joel K. Pettersson authored
      Script syntax changes:
       * Label referencing after defining:
         From ":label" to "@label".
       * Compound value (e.g. gradual value change,
         arg value with subvalues): From "[...]" to "{...}".
       * PM modulator list prefix: Change from "p*" to "p+".
         (I.e., a list uses "p+[]". More fitting, as PM amounts
         to adding the amplitude of modulator(s) to the phase.)
       * Add downscaling of output amplitude by voice count
         by default. Using "S a" disables it.
       * Allow 'a' (amplitude) parameter for AM and FM modulators.
         (Previously disallowed within "a![]" and "f![]"/"r![]".)
       * Multiple operator binding: From "{...}" to
         nesting syntax prefixed by '@', i.e. "@[...]".
       * Reject stray '{'s and '['s. Disallow '[]' lists separate
         from those assigned to list parameters. Was undocumented
         and useless and could cause crashes. A more general list
         could be added later; the removed syntax was a hold-over
         from an ancient "allow more free whitespace use" feature
         (broken by the time of the 2012 releases).
       * Make multiple operator binding functional.
         (It has been a "todo" since it was added.)
      Wave type changes:
       * Make 'saw' (saw wave) increasing instead of decreasing.
         (Negative frequency or amplitude gives a decreasing saw.)
      Reorganize code:
       * Move parser.c, program.c, and the lexer and symtab modules
         to builder/, splitting out builder.c and renaming files:
          - parser.h -> script.h (parser output).
          - program.c -> parseconv.c.
         Place conditionally-compiled test use of lexer in builder.c.
       * Move generator and osc to renderer/,
         splitting out renderer.c from sgensys.c.
       * Create common module, moving the old sgensys.h contents
         to common.h. Add and use utility functions:
          - SGS_warning(), SGS_error(): now used for warnings
            and errors (when the format is suitable).
          - SGS_memdup(), SGS_strdup(): moved from parser.c.
      Consistent type and function naming:
       * Rename each "SGSType" to "SGS_Type".
       * For function and macro names including a type,
         use same (mixed) case as in type.
      Further clean-ups:
       * Use size_t for event IDs, uint32_t for operator IDs,
         uint16_t for voice IDs.
       * Rename parser struct types, flags, and functions.
         Name types "SGS_Script*", flags "SGS_S*".
       * In parser result (SGS_Script),
         include options set in script and script name.
       * Add circular reference guard for operators in generator to
         avoid crashes due to incompletely supported features.
       * Refactor generator memory handling.
         Also somewhat simplify memory handling in program module.
       * Add -p option for printing script info after loading.
         No longer print the program "debug info" unless -p used.
      Change log:
       * 2018-04-13: Rename parser struct types and flags.
       * 2018-04-18: Simplify memory management in program
             and generator. Implement downscaling
             of amplitude by voice count by default.
       * 2018-06-02: Undo faulty simplification in parser code, and
             some further renaming. Add circular reference
             guard for operators in generator, and some
             further clean-ups.
       * 2018-06-30: Rename types from "SGSName" to "SGS_Name".
             Rename corresponding functions and macros
             to use same (mixed) case in included type
       * 2018-09-11: Create common module, refactor warnings and
             errors. Move memdup from parser to common.
       * 2018-10-04: Further renaming of parser structs and flags.
             Some additional tidying.
       * 2018-10-15: Reorganize code, moving parser.c, program.c,
             and symtab to builder/. Rename program.c to
             parseconv.c, split out builder module.
             Further flag renaming in parser.c.
             Add -p option for printing program info.
       * 2018-10-16: Move lexer to builder/. Update headers, comments.
             Move lexer test invocation to builder.c.
             Complete branch merging.
             Split out renderer module from sgensys.c.
             Move audiodev, wavfile, generator, and osc
             to renderer/.
             Some code tidying.
       * 2018-10-17: Move audiodev and wavfile out from renderer/.
             Make "saw" wave increasing instead of decreasing.
             Replace renderer.h and builder.h with
             combined sgensys.h.
       * 2018-10-18: Enable 'a' parameter for
             "f!<>"/"r!<>" and "a!<>".
       * 2018-10-23: Change PM list syntax from "p*<>" to "p+<>".
       * 2018-12-25: Remove extra linebreak from file open error.
       * 2019-06-05: Merge syntax changes.
             Increase version to v0.3.1.
             Clean up a few scripts.
       * 2019-06-13: Set version to v0.2.4.
       * 2019-06-16: Backport further simple syntax changes.
         Old branch:
          - 2019-02-08: Fix inconsistent indentation
                in a few scripts.
          - 2019-06-13: Three simple syntax changes.
                Label ref: from ":label" to "@label".
                Subvalues: from within "[...]" to "{...}".
                Mul. op.b: from within "{...}" to "@[...]".
       * 2019-06-30: Update -p printout details
             to match June syntax changes.
       * 2019-08-07: Move back Makefile -ffast-math portability fix.
             Also update unusable 'devtests/newconcept' script.
         Old branch:
          - 2019-08-06: Fix parsing when -ffast-math breaks isnan().
                Only build some files with -ffast-math.
       * 2020-07-13: Keep version at v0.2-beta.
       * 2021-06-26: Check for stray '{'s & '['s.
       * 2021-07-19: Merge fixes as of the earlier commits.
  3. 31 Dec, 2020 2 commits
    • Joel K. Pettersson's avatar
      Add/rename wave types. Change PM syntax. Reorganize scripts. · e4d10f3e
      Joel K. Pettersson authored
      Change PM modulator list syntax from "p!<>" to "p*<>".
      Since semantics differ for PM lists vs. AM and FM lists,
      make this clearer in the syntax.
      (For PM lists, modulator amplitudes are summed,
      while for AM and FM lists, they are multiplied.)
      Split osc module into osc and wave. Wave type changes:
       * Add 'sha' (half-frequency absolute sine).
       * Add 'szh' (half-zero'd sine).
       * Add 'shh' (first quarter of sine).
       * Rename 'srs' (square root of sine) to 'ssr'.
      Move wave type names from parser to wave module.
      Reorganize example and test scripts. Move some old and useful
      scripts from devtests/ to examples/tests/. Rename scripts,
      add descriptions to some of them, modify a few, remove a few
      which are useless, and add more wavetype testing.
      Change log:
       * 2018-04-18: Move wave type names to osc module, add new
                     'sab' wave type, rename 'srs' to 'ssr'.
                     Reorganize and update example and test scripts.
       * 2018-06-02: Add 'shw' and 'shr' wave types, and
                     further LUT init code changes.
       * 2018-06-30: Split osc module into wave and osc.
       * 2018-09-12: Rename wavetypes
                     ("sab"->"sah", "shw"->"szh", "shr"->"szhhr").
       * 2018-09-27: Rename wave type 'sah'->'sha',
                     add 'shh', comment out 'szhhr'.
       * 2018-09-29: Rename debug #define switches in sgensys.h.
       * 2018-10-16: Update headers, heading comments, for added code.
                     Complete branch merging.
       * 2018-10-19: Change PM list syntax from "p!<>" to "p*<>".
       * 2020-07-11: Re-split in current branch
                     to provide fuller history.
    • Joel K. Pettersson's avatar
      Support sndio. Parser & "program" refactoring. · 9a45f109
      Joel K. Pettersson authored
      Support sndio and use on OpenBSD. Fixes audio on newer OpenBSD.
      (Remove OSS OpenBSD case and for NetBSD correct to /dev/audio.)
      Clean up the Linux audio code. Improve audiodev error messages.
      Program & parser changes:
       * Rework the SGSNodeList parser code into the SGSPtrList
         type, split out into the ptrlist module.
       * Return parser result in new SGSParserResult type. Add
         parser module method for destroying it, instead of it
         being implemented in program module. Add missing list
       * Rename voice and operator parameter flags
         from SGS_* to SGS_P_*.
      Further edit usage notice.
      Makefile changes: compile with -std=c99,
      add missing header dependencies.
      Change log:
       * 2018-02-16: Renamed voice and operator parameter flags
                     from SGS_* to SGS_P_*.
       * 2018-02-19: Split out ptrarr module from parser, reworking
                     node list code and its uses.
       * 2018-02-20: Makefile changes:
                     add -Werror=implicit-function-declaration,
                     list more header dependencies.
       * 2018-03-10: Change ptrarr to work more like old nodelist,
                     re-adding case for < 2 items and needed macros.
       * 2018-08-23: Makefile: use -std=c99. Adjust audiodev.
       * 2018-09-09: Add sndio support, use on OpenBSD.
                     Fixes audio on newer OpenBSD.
                     Move audiodev implementation files to audiodev/.
       * 2018-09-11: DragonFly portability fix:
                     On DragonFly, cannot build audiodev with
                     _POSIX_C_SOURCE defined (needed on Linux),
                     only define _POSIX_C_SOURCE on Linux,
                     in audiodev.c instead of in Makefile.
       * 2018-09-20: Replace ptrarr with cleaned-up ptrlist.
                     Fixes and clean-ups for parser, program,
                     as well as some addititional tidying.
       * 2018-10-12: audiodev code tidying, and
                     fix typo which broke Linux build.
                     Some further code tidying.
       * 2019-04-18: Re-split in current branch
                     to provide fuller history.
       * 2019-04-26: Remove useless uint typedef.
       * 2020-12-31: OSS on NetBSD: /dev/sound -> /dev/audio.
  4. 28 Dec, 2020 3 commits
    • Joel K. Pettersson's avatar
      Use modern types. Rework osc. Handle audiodev srate changes. · 017c6cd2
      Joel K. Pettersson authored
      Use stdint.h and stdbool.h types instead of ushort, uchar,
      and uint (and usually int) throughout all code. Universally
      use 32-bit IDs and counters for voices and operators.
      Rework the oscillator module:
       * Increment phase after each sample instead of before.
       * Move wave type enum (SGS_WAVE_*) to osc.h, use to
         index array of LUTs.
       * Replace extra value at end of LUTs with use of bitmask.
         Bump LUT values from 1024 to 2048.
       * Correct saw wave LUT initialization off-by-one
         indexing error. Also improve init code for other LUTs.
       * Remove unused SGSOsc_RUN*() variants.
         Renamings, a few new macros, improved comments.
       * Add wave type test script, examples/test-wavetypes.sgs.
      Remove math.h SET_I2FV() macro (x86/x86-64 fast float-to-int
      rounding). Replaced with lrint()/lrintf(), which nowadays is
      inlined to fast code when compiling with -O > 0
      and -ffast-math. This removes all inline assembly.
      Change audiodev and main module, retrieving and using modified
      sample rate when changed by the audio device. Handle resulting
      difference in sample rates for device and file outputs by
      generating audio twice if needed. Also improve audio
      output-related error and warning messages. Tweak usage notice.
      Split sgensys.h into sgensys.h (common type definitions),
      generator.h (new) and program.h (relevant lines moved over).
      Also rename some functions, do minor refactoring, improve
      commenting here and there.
      Change log:
       * 2017-12-03: Replace types in many cases. Quick first pass.
                     Remove sgensys.h. Program module still largely
                     not updated.
       * 2018-02-05: Replace more types. Rewrite and readd sgensys.h.
                     Rename some functions. Minor refactoring.
                     Improve audio output handling. Program module
       * 2018-02-06: Oscillator module changes. Use SGS_WAVE_* enums
                     to index LUTs. Correct saw wave LUT. Inc phase
                     after sample instead of before. Renamings, macro
       * 2018-02-08: Undo minor changes for SGSNodeList (parser) that
                     are better redone with a real redesign. Rename
                     a few more functions. Tweak messages in sgensys.c.
       * 2018-02-09: Remove math.h inline assembly, leaving none.
       * 2018-02-19: Replace a ';' with a ',' in heading comments.
       * 2018-02-22: Extend oscillator LUTs to 4096 values from 1024.
                     Some further renamings, init code improvements,
                     and smaller macro improvements.
                     Update COPYING file. (FSF link updates.)
       * 2018-02-23: Add examples/test-wavetypes.sgs.
       * 2018-03-14: Fix allocation size in generator.c. Use
                     offsetof(), avoid allocation failure which
                     resulted from unsigned value wrapping around
                     upon (zero flag count - 1).
       * 2018-09-27: Reduce osc LUTs to 2048 values (no point in
                     4096 with 16-bit int and lerp). Some more
                     osc module tidying.
       * 2019-04-17: Re-split in current branch
                     to provide fuller history.
    • Joel K. Pettersson's avatar
      Disable lexer testing. Clean-ups and portability fixes. · 01c39158
      Joel K. Pettersson authored
      Disable test lexer and re-enable normal output by default,
      adding a #define switch in sgensys.h to switch between the
      old parser and the test lexer.
      Some clean-ups for the test lexer, symtab code, and
      other parts of the program. Make the test lexer handle
      line comment ('#'), and change its buffered reading to
      make multiple character ungetting possible.
      Portability fixes:
       * Makefile and linking: Correct sh syntax.
         Check in Makefile for three uname -s cases:
          - Linux
          - OpenBSD or NetBSD
          - other ("generic UNIX")
         Unbreaks building on FreeBSD and DragonFly.
         Also reorder linking CC args for portability.
       * ALSA: Add missing call to snd_pcm_drain().
      Re-remove GNUmakefile and simply use Makefile.
      Change log:
       * 2017-11-27: Some cleanups for lexer and symtab modules.
                     Add debug #define for hash table in symtab.c
                     (for testing collisions).
       * 2018-01-21: Make lexer handle line comments ('#').
                     Source fix for ALSA.
                     Correct Makefile sh syntax
                     and reorder CC args for linking.
       * 2018-02-04: Fix program.c typo / memory init bug.
       * 2018-02-08: Only include LFLAGS addition
                     for OpenBSD and NetBSD on those systems.
                     Unbreaks building on FreeBSD and DragonFly.
       * 2018-02-12: Change buffered reading in the lexer.
       * 2018-02-13: Rearranging of and renamings in lexer code.
                     Add debug #define for lexer (for silent-enough
                     output to measure time to process file).
                     Move debug #define switches to sgensys.h.
       * 2018-02-14: Disable lexer, re-enable parser and output.
                     Insert #define switch in sgensys.h to toggle.
       * 2018-02-19: Replace a ';' with a ',' in heading comments.
       * 2018-02-22: Update COPYING file. (FSF link updates.)
       * 2018-05-01: Replace README with rewritten version from
                     04-16. Similar to newer versions, but with
                     references to added features removed.
       * 2018-09-19: In program.c, remove two unused functions,
                     and two useless conditionals, one broken.
       * 2018-10-25: Fix parser string matching bug
                     (not impacting the current uses).
       * 2019-01-19: Complete branch merging.
                     Correct README wording in one place.
                     Re-remove GNUmakefile and simply use Makefile.
    • Joel K. Pettersson's avatar
      2013-08-03: Add ALSA support. Rework cli. Move tests/. · 4398201e
      Joel K. Pettersson authored
      Add ALSA support, splitting out system audio support
      from the main module to the new audiodev module.
      Further rework main module, expanding command-line options.
      Indentation style changed to tabs in new code, as well as
      the wavfile module. (Having planned redesigning of sgensys,
      the indentation style was changed to tabs for new or "clean"
      modules after this, while those to be rewritten or further
      reworked still use 2 spaces.)
      Moved tests/ to devtests/. (This snapshot contains the
      scripts missing in and readded to the last 4 snapshots.)
      Change log:
       * 2013-02-28: ALSA support added. Reworked sgensys.c.
                     Reindented sgensys.c, audiodev and wavfile
       * 2013-03-04: Add -c command-line option to stop after
                     processing a script, before sound generation.
                     Re-add tests/ as devtests/.
       * 2013-08-03: Add '.' to heading comments.
  5. 09 Jul, 2020 3 commits
    • Joel K. Pettersson's avatar
      2012-02-26: Fixes, part 4. Source licensing info added. · dedbff7d
      Joel K. Pettersson authored
      Parser fix for added, incomplete multiple operator
      binding feature, and minor refactoring.
      Copyright notices and LGPL-3.0+ info added to source files.
      (README.COPYRIGHT, added to this repository for earlier versions
      lacking this, removed with this commit.)
      tests/ script changes. (Taken from later working dir because tests/
      missing in tarball, but no scripts dated later than 2012-02-20.)
    • Joel K. Pettersson's avatar
    • Joel K. Pettersson's avatar
      2012-01-12: Redesign. Readd '{}' op. bind. Syntax changes. · 9f90c1f1
      Joel K. Pettersson authored
      Some parser refactoring and experimental changes.
      Re-enable planned operator binding '{}' syntax,
      change nesting syntax to '<>'. Reorder code.
      Fix for voice allocation.
      Move string copying out of symbol table,
      make it simply store pointer.
      Syntax changes:
       - Use '<>' to list modulators rather than '{}', as in
         'a!<...>', 'f!<...>' or 'r!<...>', or 'p!<...>'.
       - Remove '-' syntax for PM modulators. Replaced with 'p!<...>'.
       - Add '{...}' for binding several operators as one object to
         manipulate. Used to e.g. link several carriers to one or more
      Update various test scripts.
  6. 02 Jul, 2020 1 commit
    • Joel K. Pettersson's avatar
      2011-04-04: Rename project "sgensys" from "mgensys". Redesign. · 6536c44d
      Joel K. Pettersson authored
      Parser refactoring and changes.
      Use per-block instead of per-sample processing for
      sound generation. Note click reduction code works.
      Note: Fixes some bugs, is the first version which
      "sounds" like sgensys, but also includes new bugs
      fixed in the 2011-04-26 version, see script3.mgs.