Skip to content
This repository
Browse code

Pulled in changes for v0.14.97.

  • Loading branch information...
commit 5463faab01a64aeae08352bd3539a2a60e17f3df 1 parent e6f7f8c
williamweston authored

Showing 94 changed files with 925 additions and 867 deletions. Show diff stats Hide diff stats

  1. +1 0  .gitignore
  2. +30 0 ChangeLog
  3. +3 2 INSTALL
  4. +2 2 LICENSE
  5. +11 0 Makefile.am
  6. +2 2 README
  7. +0 2  TODO
  8. +15 0 config.h.in
  9. +19 6 configure.ac
  10. +143 0 doc/release-checklist.txt
  11. +23 11 help/parameters.help
  12. +15 1 misc/phasex-convert-patch
  13. +1 0  phasex-version
  14. +2 2 pixmaps/Makefile.am
  15. +11 0 scripts/version-sh
  16. +1 1  src/Makefile.am
  17. +6 23 src/alsa_pcm.c
  18. +1 1  src/alsa_pcm.h
  19. +1 1  src/alsa_seq.c
  20. +1 1  src/alsa_seq.h
  21. +1 1  src/bank.c
  22. +11 10 src/bpm.c
  23. +2 2 src/bpm.h
  24. +9 2 src/buffer.c
  25. +2 2 src/buffer.h
  26. +2 4 src/debug.c
  27. +8 11 src/debug.h
  28. +5 8 src/driver.c
  29. +1 1  src/driver.h
  30. +3 3 src/engine.c
  31. +1 2  src/engine.h
  32. +1 1  src/filter.c
  33. +1 1  src/filter.h
  34. +34 41 src/gtkknob.c
  35. +2 2 src/gtkknob.h
  36. +1 1  src/gui_alsa.c
  37. +1 1  src/gui_bank.c
  38. +1 1  src/gui_jack.c
  39. +1 1  src/gui_jack.h
  40. +1 1  src/gui_layout.c
  41. +1 1  src/gui_layout.h
  42. +3 14 src/gui_main.c
  43. +1 1  src/gui_main.h
  44. +3 2 src/gui_menubar.c
  45. +12 192 src/gui_midimap.c
  46. +1 2  src/gui_midimap.h
  47. +10 15 src/gui_navbar.c
  48. +146 136 src/gui_param.c
  49. +1 4 src/gui_param.h
  50. +1 1  src/gui_patch.c
  51. +1 1  src/gui_patch.h
  52. +1 1  src/gui_session.c
  53. +1 1  src/gui_session.h
  54. +3 2 src/help.c
  55. +113 85 src/jack.c
  56. +1 2  src/jack.h
  57. +2 2 src/jack_midi.c
  58. +1 1  src/jack_midi.h
  59. +5 1 src/jack_transport.c
  60. +1 1  src/jack_transport.h
  61. +3 17 src/lash.c
  62. +1 4 src/lash.h
  63. +15 11 src/midi_event.c
  64. +1 1  src/midi_event.h
  65. +59 107 src/midi_process.c
  66. +1 1  src/midi_process.h
  67. +1 1  src/mididefs.h
  68. +75 13 src/midimap.c
  69. +2 1  src/midimap.h
  70. +1 1  src/param.c
  71. +11 1 src/param_cb.c
  72. +1 0  src/param_cb.h
  73. +1 1  src/param_parse.c
  74. +1 1  src/param_parse.h
  75. +1 1  src/param_strings.c
  76. +1 1  src/param_strings.h
  77. +1 1  src/patch.c
  78. +1 1  src/patch.h
  79. +16 21 src/phasex.c
  80. +9 8 src/phasex.h
  81. +17 15 src/rawmidi.c
  82. +1 1  src/rawmidi.h
  83. +1 1  src/session.c
  84. +1 1  src/session.h
  85. +10 21 src/settings.c
  86. +1 1  src/settings.h
  87. +1 1  src/string_util.c
  88. +1 1  src/string_util.h
  89. +2 2 src/timekeeping.c
  90. +1 1  src/timekeeping.h
  91. +1 1  src/wave.c
  92. +1 1  src/wave.h
  93. +0 10 themes/Phasex-Dark
  94. +1 1  themes/Phasex-Light
1  .gitignore
@@ -25,6 +25,7 @@ config.status
25 25 configure
26 26 phasex.spec
27 27 phasex-*.tar.gz
  28 +phasex-*.rpm
28 29 stamp-h1
29 30 misc/phasex.desktop
30 31 src/.deps/
30 ChangeLog
@@ -2,6 +2,36 @@
2 2
3 3 Changelog:
4 4
  5 +=======
  6 +2013-01-11 William Weston <whw@linuxmail.org> - 0.14.97
  7 + * Cleaned up pointer sign warning in queue_midi_event().
  8 + * Included (/usr)/bin/true configure.ac fix from Jörn Nettingsmeier.
  9 + * Included falktx's build patch for src/Makefile.am.
  10 + * Added synth-part to MIDI channel assignments to midimaps.
  11 + * Removed unused type_id from struct jack_port_info.
  12 + * Added proper detection and conditions for new JACK features.
  13 + * Reworked BPM handling and removed duplicated code.
  14 + * Fixed typo in pixmaps/Makefile.am. (Adam Sampson)
  15 + * Implemented note-off instant release from attack and decay.
  16 + * Implemented round-robin voice assignment for mono-multikey.
  17 + * Fixed bug with assigning MIDI CC in GUI.
  18 + * Changed MIDI CC mapping event (now ctrl-middle-click).
  19 + * Changed depracated AM_CONFIG_HEADER to AC_CONFIG_HEADERS.
  20 + * Fixed FTBFS on systems w/o CLOCK_MONOTONIC_RAW (Adrian Knoth).
  21 + * Fixed crash and clock sync issues with changing jack buffer size.
  22 + * Consolidated gtkknob frame offset calculations.
  23 + * Added checks to prevent errors on JACK client close.
  24 + * Fixed usage of JACK stereo/multi menuitems for monotimbral builds.
  25 + * Fixed potential LASH client name bug when using ALSA MIDI.
  26 + * Added JACK latency recalculation when changing buffer_latency.
  27 + * Added git version tag tracking to build system.
  28 + * Changed default locale to "C" instead using env defaults.
  29 + * Fixed settings not saved on quit.
  30 + * Fixed new dirs/files not created bug in phasex-convert-patch.
  31 + * Fixed GUI param update race condition on updated flag.
  32 + * Fixed sporadic GUI param sensitivity update issue.
  33 +
  34 +
5 35 2012-12-28 William Weston <whw@linuxmail.org> - 0.14.96
6 36 * Added initial JACK Session support.
7 37 * Added sess dump dir skipping for Load Session dialog.
5 INSTALL
@@ -87,8 +87,9 @@ flag. Options are: 1 (slow CPU), 2 (average CPU), 3 (fast CPU and
87 87 The number of active synth threads (and thus the number of active
88 88 synth parts) can be set with the --enable-parts= option. In general,
89 89 enabling one part per CPU core will provide rock-solid xrun-free
90   -performance. Modern multi-core systems may perform the same with as
91   -many as two synth threads per CPU core enabled. YMMV.
  90 +performance (recommended for live / on-stage use). Modern multi-core
  91 +systems may perform the same with as many as two synth threads per CPU
  92 +core enabled (recommended for studio use). As usual, YMMV.
92 93
93 94 By default, 64-bit builds are enabled on 64-bit architectures. To
94 95 force a 32-bit build on a 64-bit architecture (for a native 32-bit
4 LICENSE
@@ -8,7 +8,7 @@ PHASEX Waveform Logo (branding) Copyright (C) 2012 William Weston
8 8 <whw@linuxmail.org>. All Rights Reserved. Permission is hereby
9 9 granted to use this logo to represent PHASEX (in desktop menus,
10 10 software repositories, websites indexing such repositories, etc.) as
11   -built from the author's source packages, a clone of the author's
  11 +built from the author's source packages, or a clone of the author's
12 12 source code repository. While forking of the PHASEX code is of course
13 13 permitted and encouraged by the GPL, the use of this Logo for branding
14 14 of branches outside the author's tree is not permitted. For the
@@ -31,7 +31,7 @@ Inclusion of these images with commercial or otherwise non open source
31 31 projects without explicit written consent of the author is not
32 32 permitted.
33 33
34   -Source code and audio samples Copyright (C) 1999-2012 William Weston
  34 +Source code and audio samples Copyright (C) 1999-2013 William Weston
35 35 <whw@linuxmail.org>, with portions of the source code Copyright (C)
36 36 2010 Anton Kormakov, Copyright (C) 2007 Peter Shorthose, Copyright (C)
37 37 2004 Sean Bolton, and Copyright (C) 1999 Tony Garnock-Jones (see
11 Makefile.am
@@ -37,6 +37,16 @@ distclean-local:
37 37 rm -rf autom4te.cache
38 38
39 39
  40 +phasex-$(PACKAGE_VERSION).tar.gz: dist
  41 +
  42 +
  43 +phasex-version:
  44 + scripts/version-sh
  45 +
  46 +
  47 +phasex.spec: phasex-version phasex.spec.in
  48 +
  49 +
40 50 rpm: phasex-$(PACKAGE_VERSION).tar.gz phasex.spec
41 51 rpmbuild=$$(mktemp -d -t rpmbuild-phasex.XXXXXXX); src=$$(pwd); \
42 52 cp phasex-$(PACKAGE_VERSION).tar.gz "$$rpmbuild"; \
@@ -52,3 +62,4 @@ rpm: phasex-$(PACKAGE_VERSION).tar.gz phasex.spec
52 62 popd; \
53 63 mv "$$rpmbuild"/$$(arch)/*.rpm . && mv "$$rpmbuild"/*.src.rpm . && \
54 64 rm -rf "$$rpmbuild" && ls -1 *.rpm
  65 +
4 README
... ... @@ -1,5 +1,5 @@
1 1
2   -PHASEX-0.14.96:
  2 +PHASEX-0.14.97:
3 3
4 4 -------------------------------------------------------------------------------
5 5 [P]hase [H]armonic [A]dvanced [S]ynthesis [EX]periment
@@ -506,7 +506,7 @@ LICENSING AND COPYRIGHT:
506 506 PHASEX is distributed under the terms of the GNU Public License,
507 507 version 3. See LICENSE for details.
508 508
509   - Copyright (C) 1999-2012 William Weston <whw@linuxmail.org>.
  509 + Copyright (C) 1999-2013 William Weston <whw@linuxmail.org>.
510 510
511 511 With portions of and contributions to the PHASEX source:
512 512
2  TODO
@@ -192,8 +192,6 @@ MIDI improvements:
192 192
193 193 * Add support for modwheel and generic high-res controllers.
194 194
195   -* Save part --> MIDI channel mapping with session and/or midimap.
196   -
197 195 * Add MIDI Program Change option to select sessions with values >= 64;
198 196
199 197
15 config.h.in
@@ -57,6 +57,21 @@
57 57 /* Define to 1 if you have the `isupper' function. */
58 58 #undef HAVE_ISUPPER
59 59
  60 +/* Define to 1 if you have the <jack/session.h> header file. */
  61 +#undef HAVE_JACK_SESSION_H
  62 +
  63 +/* libjack has jack_set_latency_callback(). */
  64 +#undef HAVE_JACK_SET_LATENCY_CALLBACK
  65 +
  66 +/* libjack has jack_set_port_rename_callback(). */
  67 +#undef HAVE_JACK_SET_PORT_RENAME_CALLBACK
  68 +
  69 +/* libjack has jack_set_session_callback(). */
  70 +#undef HAVE_JACK_SET_SESSION_CALLBACK
  71 +
  72 +/* Define to 1 if you have the <jack/weakjack.h> header file. */
  73 +#undef HAVE_JACK_WEAKJACK_H
  74 +
60 75 /* Define to 1 if you have the `m' library (-lm). */
61 76 #undef HAVE_LIBM
62 77
25 configure.ac
@@ -3,7 +3,7 @@ dnl # configure.ac
3 3 dnl #
4 4 dnl # PHASEX: [P]hase [H]armonic [A]dvanced [S]ynthesis [EX]periment
5 5 dnl #
6   -dnl # Copyright (C) 2007-2012 William Weston <whw@linuxmail.org>
  6 +dnl # Copyright (C) 2007-2013 William Weston <whw@linuxmail.org>
7 7 dnl #
8 8 dnl # PHASEX is free software: you can redistribute it and/or modify
9 9 dnl # it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@ dnl #
18 18 dnl # You should have received a copy of the GNU General Public License
19 19 dnl # along with PHASEX. If not, see <http://www.gnu.org/licenses/>.
20 20
21   -AC_INIT(PHASEX, 0.14.96)
  21 +AC_INIT([PHASEX], m4_esyscmd_s([scripts/version-sh]))
22 22
23 23 AC_CONFIG_AUX_DIR(scripts)
24 24 AM_INIT_AUTOMAKE(0.10.0)
@@ -186,6 +186,17 @@ PKG_CHECK_MODULES(JACK,
186 186 AC_MSG_ERROR([need JACK >= 0.99.0])
187 187 )
188 188 AC_SUBST(JACK_CFLAGS)
  189 +AC_CHECK_HEADERS([jack/session.h])
  190 +AC_CHECK_HEADERS([jack/weakjack.h])
  191 +AC_CHECK_LIB(jack, jack_set_port_rename_callback,
  192 + [AC_DEFINE_UNQUOTED(HAVE_JACK_SET_PORT_RENAME_CALLBACK, [1],
  193 + [libjack has jack_set_port_rename_callback().])])
  194 +AC_CHECK_LIB(jack, jack_set_session_callback,
  195 + [AC_DEFINE_UNQUOTED(HAVE_JACK_SET_SESSION_CALLBACK, [1],
  196 + [libjack has jack_set_session_callback().])])
  197 +AC_CHECK_LIB(jack, jack_set_latency_callback,
  198 + [AC_DEFINE_UNQUOTED(HAVE_JACK_SET_LATENCY_CALLBACK, [1],
  199 + [libjack has jack_set_latency_callback().])])
189 200
190 201 # libsamplerate
191 202 PKG_CHECK_MODULES(SAMPLERATE,
@@ -229,7 +240,7 @@ fi
229 240
230 241 AM_CONDITIONAL(WITH_LASH, test x$without_lash != x1)
231 242
232   -# librt (for clock_gettime)
  243 +# librt (for clock_gettime and clock_nanosleep)
233 244 have_librt="no"
234 245 found_librt="no"
235 246 AC_ARG_WITH(librt,
@@ -334,7 +345,8 @@ AC_DEFINE_UNQUOTED(PHASEX_GCC_MINOR, [$gccminor], [Built with gcc minor version]
334 345 CPU_POWER_LEVEL=2
335 346 ARCH_OPT_CFLAGS=""
336 347 ARCH_MATH_CFLAGS=""
337   -ARCH_BITS=`( file /bin/true | grep 'ELF 64-bit' > /dev/null && echo 64 ) || echo 32`
  348 +ARCH_TRUE=`which true`
  349 +ARCH_BITS=`( file $ARCH_TRUE | grep 'ELF 64-bit' > /dev/null && echo 64 ) || echo 32`
338 350
339 351 WARNING=`echo "*"`
340 352 case "$OPT_ARCH" in
@@ -692,7 +704,7 @@ AC_CONFIG_FILES([
692 704 phasex.spec
693 705 misc/phasex.desktop
694 706 ])
695   -AM_CONFIG_HEADER(config.h)
  707 +AC_CONFIG_HEADERS([config.h])
696 708
697 709 AC_OUTPUT
698 710
@@ -701,6 +713,8 @@ AC_OUTPUT
701 713 AC_MSG_NOTICE([
702 714 ******************************************************************************
703 715 *
  716 +* Build configuration for phasex-$PACKAGE_VERSION:
  717 +*
704 718 * Optimized for arch: ... $OPT_ARCH (${ARCH_BITS}-bit)
705 719 * CPU power level: ...... $CPU_POWER_LEVEL / 4
706 720 *
@@ -731,6 +745,5 @@ AC_MSG_NOTICE([
731 745 * make clean
732 746 * make
733 747 * make install
734   -*
735 748 $WARNING
736 749 ******************************************************************************])
143 doc/release-checklist.txt
... ... @@ -0,0 +1,143 @@
  1 +------------------------------------------------------------------------------
  2 +PHASEX Release Checklist
  3 +------------------------------------------------------------------------------
  4 +
  5 +The PHASEX git repository follows a simple branch naming scheme:
  6 +
  7 +Branch: Description:
  8 +------------------------------------------------------------------------------
  9 +master Root of all branches (v0.x.w, v0.x.y-dev, v0.x.y, ...).
  10 +v0.x.w Old release branch.
  11 +v0.x.y-dev Current dev branch, based on old release branch.
  12 +v0.x.y New release branch, based on current dev branch.
  13 +v0.x.z-dev New dev branch, based on new release branch.
  14 +feature-q New feature branch, to be merged into new dev branch.
  15 +------------------------------------------------------------------------------
  16 +
  17 +
  18 +------------------------------------------------------------------------------
  19 +
  20 +1) Prepare git repository, starting by committing all changes to
  21 + current development branch:
  22 +
  23 + git commit -a -m "Finished changes for v0.x.y"
  24 +
  25 +2) Switch to previous release branch:
  26 +
  27 + git checkout v0.x.w
  28 +
  29 +3) Create the new release branch and switch to it:
  30 +
  31 + git checkout -b v0.x.y v0.x.w
  32 +
  33 +4) Merge commits from development branch:
  34 +
  35 + git merge --no-commit v0.x.y-dev
  36 +
  37 +5) If necessary resolve any merge conflicts manually, then commit
  38 + the merge:
  39 +
  40 + git commit -a -m "Merged in changes for v0.x.w --> v0.x.y."
  41 +
  42 +6) Browse through git log and spot-check / proofread all changes.
  43 +
  44 +7) Update all documentation to reflect changes (README, INSTALL,
  45 + LICENSE, AUTHORS, NEWS, TODO, ChangeLog, parameters.help,
  46 + signal-diagram.txt, etc.) Proofread and/or spell-check.
  47 +
  48 +8) Give credit where credit is due. For significant contributions,
  49 + make sure the developer's name and email are listed at the top of
  50 + each source code file containing the contributions, and keep a
  51 + master list of authors and contributors in the AUTHORS file.
  52 +
  53 +9) Test all new features and bug-fixes for correct behavior.
  54 +
  55 +10) Test core functionality with a known MIDI file and saved session.
  56 + Does everything sound like it should?
  57 +
  58 +11) Test all audio and MIDI drivers and the ability to change their
  59 + settings.
  60 +
  61 +12) Test all new patches and samples.
  62 +
  63 +13) Test all parameters and functionality exposed to code changes.
  64 +
  65 +14) Test running with and without the GUI, and with and without
  66 + seldom-used configuration / build options.
  67 +
  68 +15) Test 32- and 64-bit builds, generic and native optimized builds,
  69 + monotimbral and multitimbral builds, local installs and RPM or
  70 + any other binary package installs, across as many distributions
  71 + as possible.
  72 +
  73 +16) Compare with previous versions and test for regressions.
  74 +
  75 +17) Verify that all significant changes are listed in the ChangeLog.
  76 +
  77 +18) Verify source packaging with 'make distcheck'.
  78 +
  79 +19) Update version number in source files (currently in multiple
  80 + places, so use grep to find them all.)
  81 +
  82 +20) Commit changes to git repo and revisit steps 6-20 until no
  83 + commits are necessary to complete all steps. All tests must pass
  84 + before progressing beyond step 20.
  85 +
  86 +21) In the upstream repository, create new release branch:
  87 +
  88 + git checkout v0.x.y v0.x.y-dev
  89 +
  90 +22) Pull in release branch from development repository:
  91 +
  92 + git pull --squash <dev-repo> v0.x.y
  93 +
  94 +23) Clone upstream repository and checkout new branch with:
  95 +
  96 + git clone <upstream-repo> phasex-release
  97 + cd phasex-release
  98 + git checkout v0.x.y
  99 +
  100 +24) Verify build with 'make distcheck'.
  101 +
  102 +25) Build official release source tarball with 'make dist'.
  103 +
  104 +26) Unpack new source archive and verify that it builds.
  105 +
  106 +27) Verify local install with 'make install' and 'make uninstall'.
  107 +
  108 +28) Build and verify RPMs made from official source tarball.
  109 +
  110 +29) Archive source tarball, i686 RPM, x86_64 RPM, and source RPM.
  111 +
  112 +30) If any new commits have been made during steps 22-28, repeat
  113 + steps 22-30 until the official packages can be built from the
  114 + sources checked out from git using the proper version tag. This
  115 + practice allows the always-avoided last minute commits to be
  116 + included with the proper branch, and guarantees that the release
  117 + packages are built with the same sources as found in the git
  118 + branch named with the corresponding release version.
  119 +
  120 +31) Add a new git branch for the next version's development cycle with:
  121 +
  122 + git checkout -b v0.x.z-dev v0.x.y
  123 +
  124 + where v0.x.z will be the next release _after_ the newly released
  125 + v0.x.y. Be sure to remember the -dev at the end of the version
  126 + tag and branch name for the upcoming development branch. This
  127 + practice provides a well defined way to differentiate between
  128 + release branches and development branches.
  129 +
  130 +32) Announce / distribute the new release.
  131 +
  132 +33) Answer emails and fix bugs. If a hot-fix if necessary, make the
  133 + hot-fix changes on a new hot-fix branch based on the new release
  134 + branch. Pull hot-fix branch into upstream repository and go back
  135 + to step 23.
  136 +
  137 +34) Work on new code in new development branch, and pull in new
  138 + features from feature branches.
  139 +
  140 +35) When new features and/or bug-fixes are ready, code is deemed
  141 + stable and worthy of release, go back to step 1.
  142 +
  143 +------------------------------------------------------------------------------
34 help/parameters.help
@@ -664,19 +664,31 @@ time. For the value labels connected to detent knobs, left-, middle-,
664 664 and right-click events correspond to the value being decremented,
665 665 centered, or incremented respectively.
666 666
667   -<b>MIDI Control:</b>
  667 +<b>Mapping MIDI Controllers:</b>
668 668
669 669 Every parameter is mappable to a MIDI controller. For instant
670   -mapping, right-click on the name of a parameter to open its update
671   -window (and to close any other currently visible update window).
672   -Select the desired MIDI controller number either through the
673   -spinbutton control or by sending a MIDI controller message. Up to 15
674   -parameters may be mapped to a single MIDI controller. Parameters may
675   -be locked as well, blocking all changes from patch loads and program
676   -changes. Left-clicking on the name of a parameter whose update window
677   -is already visible will result in the update window being closed.
678   -MIDI controller maps may be opened and saved through the MIDI menu.
679   -The last opened or saved MIDI map becomes the default.
  670 +mapping, ctrl-middle-click on the name of a parameter to open its MIDI
  671 +controller update window (and to close any other currently visible
  672 +update window). Select the desired MIDI controller number either
  673 +through the spinbutton control or by sending a MIDI controller
  674 +message. Up to 15 parameters may be mapped to a single MIDI
  675 +controller. Parameters may be locked as well, blocking all changes
  676 +from patch loads and program changes. Clicking on the name of a
  677 +parameter whose update window is already visible will result in the
  678 +update window being closed. MIDI controller maps may be opened and
  679 +saved through the MIDI menu. The last opened or saved MIDI map
  680 +becomes the default MIDI map.
  681 +
  682 +<b>Session Management:</b>
  683 +
  684 +The native session manager in PHASEX behaves much like the patch
  685 +manager. Sessions can selected from the session bank with the Session
  686 +# spinbutton, loaded or saved from the filesystem using the Session
  687 +Name entry and the Session Load and Save buttons. By default, new
  688 +sessions are saved to ~/.phasex/sessions but can be saved anywhere.
  689 +When using LASH or JACK Session for session management, sessions
  690 +include full state information and are saved to a location of the
  691 +session manager's choosing.
680 692
681 693 <b>Session Management:</b>
682 694
16 misc/phasex-convert-patch
@@ -107,7 +107,18 @@ if ((-d "${in_arg}/") && (-d "${out_arg}/")) {
107 107
108 108 @in_files = <${in_dir}*.phx>;
109 109 }
110   -elsif ((-f $in_arg) && (-f $out_arg)) {
  110 +elsif ((-d "${in_arg}/") && !(-e "${out_arg}/")) {
  111 + $in_dir = $in_arg;
  112 + $in_dir =~ s|/*$|/|g;
  113 +
  114 + $out_dir = $out_arg;
  115 + $out_dir =~ s|/*$|/|g;
  116 +
  117 + @in_files = <${in_dir}*.phx>;
  118 +
  119 + mkdir $out_dir;
  120 +}
  121 +elsif ((-f $in_arg) && ((-w $out_arg) || !(-e $out_arg))) {
111 122 @in_files = ( $in_arg );
112 123 }
113 124 else {
@@ -122,6 +133,9 @@ foreach $in_file (@in_files) {
122 133
123 134 print "Converting patch. New file: ${out_file}\n";
124 135
  136 + $osc_index = 0;
  137 + $lfo_index = 0;
  138 +
125 139 open (in_f, "<", $in_file) || die "Unable to open $in_file for read.\n";
126 140 open (out_f, ">", $out_file) || die "Unable to open $out_file for write.\n";
127 141
1  phasex-version
... ... @@ -0,0 +1 @@
  1 +0.14.97
4 pixmaps/Makefile.am
@@ -86,7 +86,7 @@ gtk_update_icon_cache = gtk-update-icon-cache -f -t
86 86
87 87
88 88 update-icon-cache:
89   - if test -z "$(DESTDIR)"; then \
  89 + @if test -z "$(DESTDIR)"; then \
90 90 if echo "${datadir}" | grep -q "_inst"; then \
91 91 rm -f $(DESTDIR)$(datadir)/icons/hicolor/icon-theme.cache; \
92 92 else \
@@ -153,7 +153,7 @@ uninstall-local: uninstall-pixmaps uninstall-splash uninstall-icons update-icon-
153 153
154 154
155 155 install-data-hook:
156   - @mkdir -p $(DESTDIR)$(pxkdatadir)/pixmaps
  156 + @mkdir -p $(DESTDIR)$(pkgdatadir)/pixmaps
157 157
158 158
159 159 uninstall-hook:
11 scripts/version-sh
... ... @@ -0,0 +1,11 @@
  1 +#!/bin/sh
  2 +
  3 +umask 133
  4 +version_string=`git describe --tags`;
  5 +if [ -n "${version_string}" ]; then
  6 + echo "${version_string}" > phasex-version
  7 +else
  8 + version_string=`cat phasex-version`
  9 +fi
  10 +perl -pi -e "s/^PHASEX-.*:$/PHASEX-${version_string}:/g" README
  11 +echo "${version_string}"
2  src/Makefile.am
@@ -52,7 +52,7 @@ endif
52 52
53 53 AM_CFLAGS = @PHASEX_CFLAGS@
54 54 AM_CPPFLAGS = $(EXTRA_CPPFLAGS) @PHASEX_CPPFLAGS@
55   -AM_LDFLAGS = $(INTLLIBS) @PHASEX_LIBS@
  55 +phasex_LDADD = $(INTLLIBS) @PHASEX_LIBS@
56 56
57 57
58 58 clean-local:
29 src/alsa_pcm.c
@@ -4,7 +4,7 @@
4 4 *
5 5 * PHASEX: [P]hase [H]armonic [A]dvanced [S]ynthesis [EX]periment
6 6 *
7   - * Copyright (C) 2012 William Weston <whw@linuxmail.org>
  7 + * Copyright (C) 2012-2013 William Weston <whw@linuxmail.org>
8 8 *
9 9 * Shamelessly adapded from test/pcm.c in alsa-lib-1.0.24.
10 10 * Copyright (C) Free Software Foundation, Inc.
@@ -796,7 +796,7 @@ alsa_pcm_init(void)
796 796 }
797 797 }
798 798
799   - init_buffer_indices();
  799 + init_buffer_indices(0);
800 800 g_atomic_int_set(&need_increment, 0);
801 801
802 802 if (!alsa_pcm_can_mmap) {
@@ -1204,7 +1204,6 @@ alsa_pcm_write_and_poll_loop(ALSA_PCM_INFO *pcminfo)
1204 1204 int result;
1205 1205 int nframes;
1206 1206 int init;
1207   - unsigned int part_num;
1208 1207 #ifdef ENABLE_INPUTS__
1209 1208 struct pollfd *capture_ufds;
1210 1209 int capture_count;
@@ -1307,10 +1306,7 @@ alsa_pcm_write_and_poll_loop(ALSA_PCM_INFO *pcminfo)
1307 1306 within the audio cycle, so make sure we catch this after an
1308 1307 xrun when we know that a cycle is being skipped. */
1309 1308 g_atomic_int_add(&need_increment, -1);
1310   - init_buffer_indices();
1311   - for (part_num = 0; part_num < MAX_PARTS; part_num++) {
1312   - need_index_resync[part_num] = 1;
1313   - }
  1309 + init_buffer_indices(1);
1314 1310 break; /* skip one period */
1315 1311 }
1316 1312 if (snd_pcm_state(pcminfo->capture_handle) == SND_PCM_STATE_RUNNING) {
@@ -1418,10 +1414,7 @@ alsa_pcm_write_and_poll_loop(ALSA_PCM_INFO *pcminfo)
1418 1414 within the audio cycle, so make sure we catch this after an
1419 1415 xrun when we know that a cycle is being skipped. */
1420 1416 g_atomic_int_add(&need_increment, -1);
1421   - init_buffer_indices();
1422   - for (part_num = 0; part_num < MAX_PARTS; part_num++) {
1423   - need_index_resync[part_num] = 1;
1424   - }
  1417 + init_buffer_indices(1);
1425 1418 break; /* skip one period */
1426 1419 }
1427 1420 if (snd_pcm_state(pcminfo->playback_handle) == SND_PCM_STATE_RUNNING) {
@@ -1671,8 +1664,6 @@ alsa_pcm_mmap_loop(ALSA_PCM_INFO *pcminfo)
1671 1664 void
1672 1665 alsa_pcm_cleanup(void *UNUSED(arg))
1673 1666 {
1674   - int part_num;
1675   -
1676 1667 if (alsa_pcm_info != NULL) {
1677 1668 #ifdef ENABLE_INPUTS
1678 1669 if (alsa_pcm_info->capture_handle != NULL) {
@@ -1719,11 +1710,7 @@ alsa_pcm_cleanup(void *UNUSED(arg))
1719 1710 }
1720 1711
1721 1712 init_engine_buffers();
1722   -
1723   - init_buffer_indices();
1724   - for (part_num = 0; part_num < MAX_PARTS; part_num++) {
1725   - need_index_resync[part_num] = 1;
1726   - }
  1713 + init_buffer_indices(1);
1727 1714
1728 1715 audio_stopped = 1;
1729 1716 audio_thread_p = 0;
@@ -1738,7 +1725,6 @@ alsa_pcm_thread(void *UNUSED(arg))
1738 1725 {
1739 1726 struct sched_param schedparam;
1740 1727 pthread_t thread_id;
1741   - int part_num;
1742 1728
1743 1729 /* set realtime scheduling and priority */
1744 1730 thread_id = pthread_self();
@@ -1758,10 +1744,7 @@ alsa_pcm_thread(void *UNUSED(arg))
1758 1744 pthread_mutex_unlock(&audio_ready_mutex);
1759 1745
1760 1746 /* initialize buffer indices and set reference clock. */
1761   - init_buffer_indices();
1762   - for (part_num = 0; part_num < MAX_PARTS; part_num++) {
1763   - need_index_resync[part_num] = 1;
1764   - }
  1747 + init_buffer_indices(1);
1765 1748 start_midi_clock();
1766 1749
1767 1750 /* MAIN LOOP: poll for audio and copy buffers */
2  src/alsa_pcm.h
@@ -4,7 +4,7 @@
4 4 *
5 5 * PHASEX: [P]hase [H]armonic [A]uroral [S]ynthesis [EX]periment
6 6 *
7   - * Copyright 1999-2012 William Weston <whw@linuxmail.org>
  7 + * Copyright 1999-2013 William Weston <whw@linuxmail.org>
8 8 *
9 9 * PHASEX is free software: you can redistribute it and/or modify
10 10 * it under the terms of the GNU General Public License as published by
2  src/alsa_seq.c
@@ -4,7 +4,7 @@
4 4 *
5 5 * PHASEX: [P]hase [H]armonic [A]dvanced [S]ynthesis [EX]periment
6 6 *
7   - * Copyright (C) 1999-2012 William Weston <whw@linuxmail.org>
  7 + * Copyright (C) 1999-2013 William Weston <whw@linuxmail.org>
8 8 *
9 9 * PHASEX is free software: you can redistribute it and/or modify
10 10 * it under the terms of the GNU General Public License as published by
2  src/alsa_seq.h
@@ -4,7 +4,7 @@
4 4 *
5 5 * PHASEX: [P]hase [H]armonic [A]dvanced [S]ynthesis [EX]periment
6 6 *
7   - * Copyright (C) 1999-2012 William Weston <whw@linuxmail.org>
  7 + * Copyright (C) 1999-2013 William Weston <whw@linuxmail.org>
8 8 *
9 9 * PHASEX is free software: you can redistribute it and/or modify
10 10 * it under the terms of the GNU General Public License as published by
2  src/bank.c
@@ -4,7 +4,7 @@
4 4 *
5 5 * PHASEX: [P]hase [H]armonic [A]dvanced [S]ynthesis [EX]periment
6 6 *
7   - * Copyright (C) 1999-2012 William Weston <whw@linuxmail.org>
  7 + * Copyright (C) 1999-2013 William Weston <whw@linuxmail.org>
8 8 *
9 9 * PHASEX is free software: you can redistribute it and/or modify
10 10 * it under the terms of the GNU General Public License as published by
21 src/bpm.c
@@ -4,7 +4,7 @@
4 4 *
5 5 * PHASEX: [P]hase [H]armonic [A]dvanced [S]ynthesis [EX]periment
6 6 *
7   - * Copyright (C) 1999-2012 William Weston <whw@linuxmail.org>
  7 + * Copyright (C) 1999-2013 William Weston <whw@linuxmail.org>
8 8 *
9 9 * PHASEX is free software: you can redistribute it and/or modify
10 10 * it under the terms of the GNU General Public License as published by
@@ -66,10 +66,10 @@ override_bpm(unsigned int new_bpm)
66 66
67 67
68 68 /*****************************************************************************
69   - * update_bpm()
  69 + * set_bpm()
70 70 *****************************************************************************/
71 71 void
72   -update_bpm(PARAM *param)
  72 +set_bpm(PARAM *param, sample_t float_bpm)
73 73 {
74 74 PATCH_STATE *state = param->patch->state;
75 75 PART *part = param->patch->part;
@@ -84,6 +84,12 @@ update_bpm(PARAM *param)
84 84 unsigned int osc;
85 85 unsigned int voice_num;
86 86
  87 + /* use supplied floating point value, if non-zero. */
  88 + if (float_bpm > 0.0) {
  89 + int_val = (int) float_bpm;
  90 + cc_val = int_val - 64;
  91 + }
  92 +
87 93 /* initialize all variables based on bpm */
88 94 state->bpm_cc = cc_val & 0x7F;
89 95 state->bpm = (sample_t) int_val;
@@ -91,13 +97,9 @@ update_bpm(PARAM *param)
91 97 global.bpm = (sample_t)(state->bpm);
92 98 global.bps = (sample_t)(state->bpm) / 60.0;
93 99
94   - /* For now, keep bpm as a per part param, and update all parts at once to
95   - make it appear as a global. this way, bpm can still be saved with
96   - patches. */
  100 + /* For now, keep bpm per part, and update all parts at once to make it
  101 + appear as global. This way, bpm can still be saved with patches. */
97 102 for (part_num = 0; part_num < MAX_PARTS; part_num++) {
98   -
99   - /* Update what the gui thinks for all parts. When gui/midi callbacks
100   - are separated, this needs to move. */
101 103 param = get_param(part_num, id);
102 104 state = get_active_state(part_num);
103 105 part = get_part(part_num);
@@ -146,4 +148,3 @@ update_bpm(PARAM *param)
146 148 }
147 149 }
148 150 }
149   -
4 src/bpm.h
@@ -4,7 +4,7 @@
4 4 *
5 5 * PHASEX: [P]hase [H]armonic [A]dvanced [S]ynthesis [EX]periment
6 6 *
7   - * Copyright (C) 1999-2012 William Weston <whw@linuxmail.org>
  7 + * Copyright (C) 1999-2013 William Weston <whw@linuxmail.org>
8 8 *
9 9 * PHASEX is free software: you can redistribute it and/or modify
10 10 * it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@
27 27
28 28
29 29 void override_bpm(unsigned int new_bpm);
30   -void update_bpm(PARAM *param);
  30 +void set_bpm(PARAM *param, sample_t float_bpm);
31 31
32 32
33 33 #endif /* _PHASEX_BPM_H_ */
11 src/buffer.c
@@ -4,7 +4,7 @@
4 4 *
5 5 * PHASEX: [P]hase [H]armonic [A]dvanced [S]ynthesis [EX]periment
6 6 *
7   - * Copyright (C) 2012 William Weston <whw@linuxmail.org>
  7 + * Copyright (C) 2012-2013 William Weston <whw@linuxmail.org>
8 8 *
9 9 * PHASEX is free software: you can redistribute it and/or modify
10 10 * it under the terms of the GNU General Public License as published by
@@ -52,12 +52,19 @@ int need_index_resync[MAX_PARTS];
52 52 * init_buffer_indices()
53 53 *****************************************************************************/
54 54 void
55   -init_buffer_indices(void)
  55 +init_buffer_indices(int resync)
56 56 {
  57 + int part_num;
  58 +
57 59 g_atomic_int_set(&need_increment, 0);
58 60 set_audio_index(buffer_size - buffer_latency);
59 61 set_engine_index(0);
60 62 set_midi_index(0);
  63 + if (resync) {
  64 + for (part_num = 0; part_num < MAX_PARTS; part_num++) {
  65 + need_index_resync[part_num] = 1;
  66 + }
  67 + }
61 68 }
62 69
63 70
4 src/buffer.h
@@ -4,7 +4,7 @@
4 4 *
5 5 * PHASEX: [P]hase [H]armonic [A]dvanced [S]ynthesis [EX]periment
6 6 *
7   - * Copyright (C) 1999-2012 William Weston <whw@linuxmail.org>
  7 + * Copyright (C) 1999-2013 William Weston <whw@linuxmail.org>
8 8 *
9 9 * PHASEX is free software: you can redistribute it and/or modify
10 10 * it under the terms of the GNU General Public License as published by
@@ -43,7 +43,7 @@ extern volatile gint engine_index;
43 43 extern int need_index_resync[MAX_PARTS];
44 44
45 45
46   -void init_buffer_indices(void);
  46 +void init_buffer_indices(int resync);
47 47
48 48 unsigned int test_midi_index(unsigned int val);
49 49 unsigned int get_midi_index(void);
6 src/debug.c
@@ -4,7 +4,7 @@
4 4 *
5 5 * PHASEX: [P]hase [H]armonic [A]dvanced [S]ynthesis [EX]periment
6 6 *
7   - * Copyright (C) 2012 William Weston <whw@linuxmail.org>
  7 + * Copyright (C) 2012-2013 William Weston <whw@linuxmail.org>
8 8 *
9 9 * PHASEX is free software: you can redistribute it and/or modify
10 10 * it under the terms of the GNU General Public License as published by
@@ -35,10 +35,9 @@ DEBUG_RINGBUFFER main_debug_queue;
35 35 int debug = 0;
36 36 unsigned long debug_class = 0;
37 37
38   -DEBUG_CLASS debug_class_list[19] = {
  38 +DEBUG_CLASS debug_class_list[16] = {
39 39 { DEBUG_CLASS_NONE, "none" },
40 40 { DEBUG_CLASS_INIT, "init" },
41   - { DEBUG_CLASS_MAIN, "main" },
42 41 { DEBUG_CLASS_GUI, "gui" },
43 42 { DEBUG_CLASS_PARAM, "param" },
44 43 { DEBUG_CLASS_RAW_MIDI, "raw-midi" },
@@ -48,7 +47,6 @@ DEBUG_CLASS debug_class_list[19] = {
48 47 { DEBUG_CLASS_MIDI_TIMING, "timing" },
49 48 { DEBUG_CLASS_AUDIO, "audio" },
50 49 { DEBUG_CLASS_JACK_TRANSPORT, "jack-transport" },
51   - { DEBUG_CLASS_JACK_MIDI, "jack-midi" },
52 50 { DEBUG_CLASS_ENGINE, "engine" },
53 51 { DEBUG_CLASS_ENGINE_TIMING, "engine-timing" },
54 52 { DEBUG_CLASS_SESSION, "session" },
19 src/debug.h
@@ -4,7 +4,7 @@
4 4 *
5 5 * PHASEX: [P]hase [H]armonic [A]dvanced [S]ynthesis [EX]periment
6 6 *
7   - * Copyright (C) 2012 William Weston <whw@linuxmail.org>
  7 + * Copyright (C) 2012-2013 William Weston <whw@linuxmail.org>
8 8 *
9 9 * PHASEX is free software: you can redistribute it and/or modify
10 10 * it under the terms of the GNU General Public License as published by
@@ -35,8 +35,7 @@
35 35 #define DEBUG_BUFFER_MASK (DEBUG_MESSAGE_POOL_SIZE - 1)
36 36
37 37 #define DEBUG_CLASS_NONE 0
38   -#define DEBUG_CLASS_INIT 1
39   -#define DEBUG_CLASS_MAIN (1<<1)
  38 +#define DEBUG_CLASS_INIT (1<<1)
40 39 #define DEBUG_CLASS_GUI (1<<2)
41 40 #define DEBUG_CLASS_PARAM (1<<3)
42 41 #define DEBUG_CLASS_MIDI (1<<4)
@@ -44,13 +43,11 @@
44 43 #define DEBUG_CLASS_MIDI_EVENT (1<<6)
45 44 #define DEBUG_CLASS_MIDI_TIMING (1<<7)
46 45 #define DEBUG_CLASS_AUDIO (1<<8)
47   -#define DEBUG_CLASS_JACK_AUDIO (1<<9)
48   -#define DEBUG_CLASS_JACK_TRANSPORT (1<<10)
49   -#define DEBUG_CLASS_JACK_MIDI (1<<11)
50   -#define DEBUG_CLASS_RAW_MIDI (1<<12)
51   -#define DEBUG_CLASS_ENGINE (1<<13)
52   -#define DEBUG_CLASS_ENGINE_TIMING (1<<14)
53   -#define DEBUG_CLASS_SESSION (1<<15)
  46 +#define DEBUG_CLASS_JACK_TRANSPORT (1<<9)
  47 +#define DEBUG_CLASS_RAW_MIDI (1<<10)
  48 +#define DEBUG_CLASS_ENGINE (1<<11)
  49 +#define DEBUG_CLASS_ENGINE_TIMING (1<<12)
  50 +#define DEBUG_CLASS_SESSION (1<<13)
54 51 #define DEBUG_CLASS_ALL ~(0UL | DEBUG_CLASS_MIDI_TIMING | DEBUG_CLASS_ENGINE_TIMING)
55 52
56 53 #define DEBUG_ATTR_RESET 0
@@ -102,7 +99,7 @@ extern DEBUG_RINGBUFFER main_debug_queue;
102 99 extern int debug;
103 100 extern unsigned long debug_class;
104 101
105   -extern DEBUG_CLASS debug_class_list[19];
  102 +extern DEBUG_CLASS debug_class_list[16];
106 103
107 104
108 105 #define PHASEX_ERROR(args...) \
13 src/driver.c
@@ -4,7 +4,7 @@
4 4 *
5 5 * PHASEX: [P]hase [H]armonic [A]dvanced [S]ynthesis [EX]periment
6 6 *
7   - * Copyright (C) 2012 William Weston <whw@linuxmail.org>
  7 + * Copyright (C) 2012-2013 William Weston <whw@linuxmail.org>
8 8 *
9 9 * PHASEX is free software: you can redistribute it and/or modify
10 10 * it under the terms of the GNU General Public License as published by
@@ -44,6 +44,7 @@
44 44 #include "patch.h"
45 45 #include "param.h"
46 46 #include "midimap.h"
  47 +#include "gui_main.h"
47 48
48 49 #ifndef WITHOUT_LASH
49 50 # include "lash.h"
@@ -656,9 +657,7 @@ phasex_watchdog(void)
656 657 audio_stopped = 0;
657 658 start_audio();
658 659 wait_audio_start();
659   - if ((gtkui_thread_p != 0) &&
660   - (config_dialog != NULL) &&
661   - (audio_status_label != NULL)) {
  660 + if (gtkui_ready && (config_dialog != NULL) && (audio_status_label != NULL)) {
662 661 query_audio_driver_status(audio_driver_status_msg);
663 662 gtk_label_set_text(GTK_LABEL(audio_status_label), audio_driver_status_msg);
664 663 }
@@ -669,10 +668,8 @@ phasex_watchdog(void)
669 668 start_midi();
670 669 wait_midi_start();
671 670 }
672   - if (config_changed &&
673   - !engine_stopped && !audio_stopped && !midi_stopped &&
674   - (audio_driver != AUDIO_DRIVER_NONE) &&
675   - (midi_driver != MIDI_DRIVER_NONE)) {
  671 + if (config_changed && !engine_stopped && !audio_stopped && !midi_stopped &&
  672 + (audio_driver != AUDIO_DRIVER_NONE) && (midi_driver != MIDI_DRIVER_NONE)) {
676 673 config_changed = 0;
677 674 save_settings(NULL);
678 675 }
2  src/driver.h
@@ -4,7 +4,7 @@
4 4 *
5 5 * PHASEX: [P]hase [H]armonic [A]dvanced [S]ynthesis [EX]periment
6 6 *
7   - * Copyright (C) 2012 William Weston <whw@linuxmail.org>
  7 + * Copyright (C) 2012-2013 William Weston <whw@linuxmail.org>
8 8 *
9 9 * PHASEX is free software: you can redistribute it and/or modify
10 10 * it under the terms of the GNU General Public License as published by
6 src/engine.c
@@ -4,7 +4,7 @@
4 4 *
5 5 * PHASEX: [P]hase [H]armonic [A]dvanced [S]ynthesis [EX]periment
6 6 *
7   - * Copyright (C) 1999-2012 William Weston <whw@linuxmail.org>
  7 + * Copyright (C) 1999-2013 William Weston <whw@linuxmail.org>
8 8 * Copyright (C) 2010 Anton Kormakov <assault64@gmail.com>
9 9 *
10 10 * PHASEX is free software: you can redistribute it and/or modify
@@ -219,7 +219,7 @@ init_engine_parameters(void)
219 219 unsigned int part_num;
220 220 unsigned int voice_num;
221 221
222   - init_buffer_indices();
  222 + init_buffer_indices(0);
223 223
224 224 for (part_num = 0; part_num < MAX_PARTS; part_num++) {
225 225 part = get_part(part_num);
@@ -561,7 +561,7 @@ engine_thread(void *arg)
561 561 /* MAIN LOOP: one time through for each sample */
562 562 while (!engine_stopped && !pending_shutdown) {
563 563
564   - if (cycle_frame == (int) buffer_period_size) {
  564 + if (cycle_frame >= (int) buffer_period_size) {
565 565 cycle_frame = 0;
566 566
567 567 /* At period boundry, set patch state in case of program change. */
3  src/engine.h
@@ -4,7 +4,7 @@
4 4 *
5 5 * PHASEX: [P]hase [H]armonic [A]dvanced [S]ynthesis [EX]periment
6 6 *
7   - * Copyright (C) 1999-2012 William Weston <whw@linuxmail.org>
  7 + * Copyright (C) 1999-2013 William Weston <whw@linuxmail.org>
8 8 * Copyright (C) 2010 Anton Kormakov <assault64@gmail.com>
9 9 *
10 10 * PHASEX is free software: you can redistribute it and/or modify
@@ -365,4 +365,3 @@ void run_parts(void);
365 365
366 366
367 367 #endif /* _PHASEX_ENGINE_H_ */
368   -
2  src/filter.c
@@ -4,7 +4,7 @@
4 4 *
5 5 * PHASEX: [P]hase [H]armonic [A]dvanced [S]ynthesis [EX]periment
6 6 *
7   - * Copyright (C) 1999-2008,2012 William Weston <whw@linuxmail.org>
  7 + * Copyright (C) 1999-2008,2012-2013 William Weston <whw@linuxmail.org>
8 8 *
9 9 * PHASEX is free software: you can redistribute it and/or modify
10 10 * it under the terms of the GNU General Public License as published by
2  src/filter.h
@@ -4,7 +4,7 @@
4 4 *
5 5 * PHASEX: [P]hase [H]armonic [A]dvanced [S]ynthesis [EX]periment
6 6 *
7   - * Copyright (C) 1999-2012 William Weston <whw@linuxmail.org>
  7 + * Copyright (C) 1999-2013 William Weston <whw@linuxmail.org>
8 8 *
9 9 * PHASEX is free software: you can redistribute it and/or modify
10 10 * it under the terms of the GNU General Public License as published by
75 src/gtkknob.c
@@ -8,7 +8,7 @@
8 8 *
9 9 * Modifications by Sean Bolton: Copyright (C) 2004, 2008-2010
10 10 * Modifications by Pete Shorthose: Copyright (C) 2007
11   - * Modifications by William Weston: Copyright (C) 2007-2008, 2012
  11 + * Modifications by William Weston: Copyright (C) 2007-2008, 2012-2013
12 12 *
13 13 * PHASEX is free software: you can redistribute it and/or modify
14 14 * it under the terms of the GNU General Public License as published by
@@ -48,7 +48,7 @@
48 48 #define STATE_PRESSED 1
49 49 #define STATE_DRAGGING 2
50 50
51   -static void gtk_knob_class_init(GtkKnobClass *klass);
  51 +static void gtk_knob_class_init(GtkKnobClass *class);
52 52 static void gtk_knob_init(GtkKnob *knob);
53 53 static void gtk_knob_destroy(GtkObject *object);
54 54 static void gtk_knob_realize(GtkWidget *widget);
@@ -75,7 +75,7 @@ int knob_height[14] = { 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, -1 }
75 75
76 76 /* Local data */
77 77
78   -static GtkWidgetClass *parent_class = NULL;
  78 +static GtkWidgetClass *knob_parent_class = NULL;
79 79
80 80
81 81 /*****************************************************************************
@@ -122,7 +122,7 @@ gtk_knob_class_init(GtkKnobClass *class)
122 122 object_class = (GtkObjectClass *) class;
123 123 widget_class = (GtkWidgetClass *) class;
124 124
125   - parent_class = gtk_type_class(gtk_widget_get_type());
  125 + knob_parent_class = gtk_type_class(gtk_widget_get_type());
126 126
127 127 object_class->destroy = gtk_knob_destroy;
128 128
@@ -144,7 +144,6 @@ static void
144 144 gtk_knob_init(GtkKnob *knob)
145 145 {
146 146 knob->policy = GTK_UPDATE_CONTINUOUS;
147   - // knob->policy = GTK_UPDATE_DELAYED;
148 147 knob->state = STATE_IDLE;
149 148 knob->saved_x = 0;
150 149 knob->saved_y = 0;
@@ -225,8 +224,8 @@ gtk_knob_destroy(GtkObject *object)
225 224 knob->timer = 0;
226 225 }
227 226
228   - if (GTK_OBJECT_CLASS(parent_class)->destroy) {
229   - (*GTK_OBJECT_CLASS(parent_class)->destroy)(object);
  227 + if (GTK_OBJECT_CLASS(knob_parent_class)->destroy) {
  228 + (*GTK_OBJECT_CLASS(knob_parent_class)->destroy)(object);
230 229 }
231 230 }
232 231
@@ -237,8 +236,7 @@ gtk_knob_destroy(GtkObject *object)
237 236 GtkAdjustment *
238 237 gtk_knob_get_adjustment(GtkKnob *knob)
239 238 {
240   -
241   - g_return_val_if_fail(knob != NULL, NULL);
  239 + g_return_val_if_fail((knob != NULL), NULL);
242 240 g_return_val_if_fail(GTK_IS_KNOB(knob), NULL);
243 241
244 242 return knob->adjustment;
@@ -251,7 +249,6 @@ gtk_knob_get_adjustment(GtkKnob *knob)
251 249 void
252 250 gtk_knob_set_update_policy(GtkKnob *knob, GtkUpdateType policy)
253 251 {
254   -
255 252 g_return_if_fail(knob != NULL);
256 253 g_return_if_fail(GTK_IS_KNOB(knob));
257 254
@@ -260,6 +257,27 @@ gtk_knob_set_update_policy(GtkKnob *knob, GtkUpdateType policy)
260 257
261 258
262 259 /*****************************************************************************
  260 + * gtk_knob_set_frame_offset()
  261 + *****************************************************************************/
  262 +gint
  263 +gtk_knob_set_frame_offset(GtkKnob *knob, gfloat value)
  264 +{
  265 + g_return_val_if_fail((knob != NULL), 0);
  266 + g_return_val_if_fail(GTK_IS_KNOB(knob), 0);
  267 +
  268 + if ((knob->anim != NULL) && (knob->adjustment != NULL)) {
  269 + knob->frame_offset = (int)((((gfloat)(knob->anim->width) /
  270 + (gfloat)(knob->anim->frame_width)) - 1) *
  271 + (value - knob->adjustment->lower) *
  272 + (1.0 / ((gfloat)(knob->adjustment->upper) -
  273 + (gfloat)(knob->adjustment->lower)))
  274 + ) * knob->width;
  275 + }
  276 + return knob->frame_offset;
  277 +}
  278 +
  279 +
  280 +/*****************************************************************************
263 281 * gtk_knob_set_adjustment()
264 282 *
265 283 * Establishes supplied adjustment as the knob's internal adjustment.
@@ -267,7 +285,6 @@ gtk_knob_set_update_policy(GtkKnob *knob, GtkUpdateType policy)
267 285 void
268 286 gtk_knob_set_adjustment(GtkKnob *knob, GtkAdjustment *adjustment)
269 287 {
270   -
271 288 g_return_if_fail(knob != NULL);
272 289 g_return_if_fail(GTK_IS_KNOB(knob));
273 290
@@ -296,16 +313,7 @@ gtk_knob_set_adjustment(GtkKnob *knob, GtkAdjustment *adjustment)
296 313 knob->old_lower = (gfloat) adjustment->lower;
297 314 knob->old_upper = (gfloat) adjustment->upper;
298 315
299   - if (knob->anim != NULL) {
300   - knob->frame_offset = (int)(
301   - (((gfloat)(knob->anim->width) /
302   - (gfloat)(knob->anim->frame_width)) - 1) *
303   - (knob->adjustment->value - knob->adjustment->lower) *
304   - (1.0 / ((gfloat)(adjustment->upper) -
305   - (gfloat)(adjustment->lower)))
306   - ) * knob->width;
307   - }
308   -
  316 + gtk_knob_set_frame_offset(knob, adjustment->value);
309 317 gtk_knob_update(knob);
310 318 }
311 319
@@ -343,11 +351,9 @@ gtk_knob_realize(GtkWidget *widget)
343 351 attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
344 352
345 353 widget->window = gdk_window_new(widget->parent->window, &attributes, attributes_mask);
346   -
347   - widget->style = gtk_style_attach(widget->style, widget->window);
  354 + widget->style = gtk_style_attach(widget->style, widget->window);
348 355
349 356 gdk_window_set_user_data(widget->window, widget);
350   -
351 357 gtk_style_set_background(widget->style, widget->window, GTK_STATE_NORMAL);
352 358
353 359 knob->mask_gc = gdk_gc_new(widget->window);
@@ -362,7 +368,6 @@ gtk_knob_realize(GtkWidget *widget)
362 368 static void
363 369 gtk_knob_size_request(GtkWidget *widget, GtkRequisition *requisition)
364 370 {
365   -
366 371 g_return_if_fail(widget != NULL);
367 372 g_return_if_fail(GTK_IS_KNOB(widget));
368 373
@@ -602,7 +607,6 @@ gtk_knob_motion_notify(GtkWidget *widget, GdkEventMotion *event)
602 607 static gint
603 608 gtk_knob_timer(GtkKnob *knob)
604 609 {
605   -
606 610 g_return_val_if_fail(knob != NULL, FALSE);
607 611 g_return_val_if_fail(GTK_IS_KNOB(knob), FALSE);
608 612
@@ -725,12 +729,7 @@ gtk_knob_update(GtkKnob *knob)
725 729 new_value = (gfloat) knob->adjustment->upper;
726 730 }
727 731
728   - knob->frame_offset = (int)((((gfloat)(knob->anim->width) /
729   - (gfloat)(knob->anim->frame_width)) - 1) *
730   - (new_value - knob->adjustment->lower) *
731   - (1.0 / ((gfloat)(knob->adjustment->upper) -
732   - (gfloat)(knob->adjustment->lower)))
733   - ) * knob->width;
  732 + gtk_knob_set_frame_offset(knob, new_value);
734 733
735 734 if (new_value != knob->adjustment->value) {
736 735 knob->adjustment->value = new_value;
@@ -807,17 +806,11 @@ gtk_knob_set_animation(GtkKnob *knob, GtkKnobAnim *anim)
807 806 g_object_unref(G_OBJECT(knob->anim->pixbuf));
808 807 }
809 808 knob->anim = (GtkKnobAnim *) anim;
810   - g_object_ref(G_OBJECT(knob->anim->pixbuf));