Compare commits

...

71 Commits

Author SHA1 Message Date
Tobias Doerffel
2ff42ac80b added copy constructor implementation for AtomicInt class - fixes build failure with Qt < 4.4.0, fixed typo
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@2074 0778d3d1-df1d-0410-868b-ea421aaaa00d
2009-02-23 22:32:31 +00:00
Tobias Doerffel
640f140ef1 made 0.4.3 release
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@2071 0778d3d1-df1d-0410-868b-ea421aaaa00d
2009-02-23 19:57:08 +00:00
Tobias Doerffel
fa7085d80f fixed typos
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@2070 0778d3d1-df1d-0410-868b-ea421aaaa00d
2009-02-23 19:55:06 +00:00
Tobias Doerffel
6c7e6571e7 reflect changes in MinGW crosscompiling environment
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@2068 0778d3d1-df1d-0410-868b-ea421aaaa00d
2009-02-23 18:55:38 +00:00
Tobias Doerffel
9b533f055a rewrote timing of fading animation for not postponing updates of hidden fadeButton until it becomes visible (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@2058 0778d3d1-df1d-0410-868b-ea421aaaa00d
2009-02-19 15:03:23 +00:00
Tobias Doerffel
168b65dfae make sure all buttons in trackOperationsWidget have focus-policy set to Qt::NoFocus in order to make space play song even if you clicked e.g. a mute-button (closes #2486211) (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@2057 0778d3d1-df1d-0410-868b-ea421aaaa00d
2009-02-19 15:02:41 +00:00
Tobias Doerffel
625c947d7a move timeLine marker in Piano Roll and autoscroll when recording while playing song (closes #2486334) (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@2054 0778d3d1-df1d-0410-868b-ea421aaaa00d
2009-02-19 14:27:42 +00:00
Tobias Doerffel
264ad268ba more record-accompany fixes (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@2052 0778d3d1-df1d-0410-868b-ea421aaaa00d
2009-02-19 13:57:22 +00:00
Tobias Doerffel
6b875a9181 coding style fixes, improved handling of shared detuningHelper object (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@2050 0778d3d1-df1d-0410-868b-ea421aaaa00d
2009-02-19 13:44:19 +00:00
Tobias Doerffel
4c93249aae coding style fixes, improved handling of shared detuningHelper object (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@2049 0778d3d1-df1d-0410-868b-ea421aaaa00d
2009-02-19 13:40:24 +00:00
Tobias Doerffel
c720c1f4c8 stable backport:
fixed various bugs regarding recording:
* once recording has been started, stop it as soon as playMode of song changes or similiar things happen (closes #2486341)
* fixed broken record-accompany in most use-cases other than using record-while-playing-song by also tracking NoteOn events and 
remember current play position to use
the correct note postitions on NoteOff events (play position might have wrapped around in the meantime due to looppoints or end 
of BB track) (closes #2486299, #2486203)



git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@2048 0778d3d1-df1d-0410-868b-ea421aaaa00d
2009-02-19 13:39:42 +00:00
Tobias Doerffel
1102f03fde reverted rev 2037 as we have custom changes in this file (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@2044 0778d3d1-df1d-0410-868b-ea421aaaa00d
2009-02-14 17:35:24 +00:00
Tobias Doerffel
c5d01d5e0d stable backport:
* added missing slot declaration for abortFreeze(), fixes lockup when freezing pattern (closes #2530320)
* update patternView after freezing
* fixed drawing of frozen pattern



git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@2042 0778d3d1-df1d-0410-868b-ea421aaaa00d
2009-02-13 23:36:32 +00:00
Tobias Doerffel
e5dddeffb0 stable backport:
* when resampling whole sampleBuffer, set end_of_input = 1 in libsamplerate data struct - fixes lots of zero samples at the end of output buffer (closes #2531452)
* coding style fixes
* removed obsolete save/restore of EOF-property in libsample rate data struct when resampling successively (always use 0)



git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@2040 0778d3d1-df1d-0410-868b-ea421aaaa00d
2009-02-13 16:37:15 +00:00
Tobias Doerffel
ab180ad254 integrated latest libsamplerate (0.1.6) which is both faster and more reliable (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@2038 0778d3d1-df1d-0410-868b-ea421aaaa00d
2009-02-13 16:31:01 +00:00
Tobias Doerffel
e867071e43 disable output monitor per default and show click-hint (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@2035 0778d3d1-df1d-0410-868b-ea421aaaa00d
2009-02-13 14:55:46 +00:00
Tobias Doerffel
bc2bf0e30b disable output monitor per default and show click-hint (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@2034 0778d3d1-df1d-0410-868b-ea421aaaa00d
2009-02-13 14:54:54 +00:00
Tobias Doerffel
4db2ef1f7d reverted some of the changes from 2008-11-10 which caused distorted graphics when running LMMS with Qt 4.5 (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@2031 0778d3d1-df1d-0410-868b-ea421aaaa00d
2009-02-13 11:33:04 +00:00
Tobias Doerffel
95df8100a2 various UI related backports from trunk
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@2027 0778d3d1-df1d-0410-868b-ea421aaaa00d
2009-02-13 00:07:20 +00:00
Tobias Doerffel
12b07484aa reflect recent changes to MinGW cross compiling environment (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@2026 0778d3d1-df1d-0410-868b-ea421aaaa00d
2009-02-12 23:34:20 +00:00
Tobias Doerffel
fa6e5be636 update patch after loading settings (closes #2486372) (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@2024 0778d3d1-df1d-0410-868b-ea421aaaa00d
2009-02-12 23:25:49 +00:00
Tobias Doerffel
84f3ecf76b ensure, cursor is never NULL when painting it in paintEvent()
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@2021 0778d3d1-df1d-0410-868b-ea421aaaa00d
2009-02-12 22:53:07 +00:00
Tobias Doerffel
a4ba618828 do not load samples bigger than 100 MB (closes #2458375) (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@2019 0778d3d1-df1d-0410-868b-ea421aaaa00d
2009-02-12 22:18:07 +00:00
Tobias Doerffel
83ce3c21b4 integrated pitanga's patch to fix unquantized BB dragging in song editor. Changed ctrl modifier to alt to be consistent (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@2009 0778d3d1-df1d-0410-868b-ea421aaaa00d
2009-02-05 13:24:19 +00:00
Tobias Doerffel
48990656b9 integrated pitanga's patch to fix unquantized BB dragging in song editor. Changed ctrl modifier to alt to be consistent (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@2008 0778d3d1-df1d-0410-868b-ea421aaaa00d
2009-02-05 13:23:32 +00:00
Tobias Doerffel
d3e6f5a348 better workaround for optimizer bug in GCC >= 4.3 (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@2006 0778d3d1-df1d-0410-868b-ea421aaaa00d
2009-02-05 13:19:18 +00:00
Tobias Doerffel
0d90ac3176 cleanups (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@2005 0778d3d1-df1d-0410-868b-ea421aaaa00d
2009-02-05 13:18:28 +00:00
Tobias Doerffel
48fe96c9ac added missing header for compilation with GCC 4.4
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@2004 0778d3d1-df1d-0410-868b-ea421aaaa00d
2009-02-05 13:17:50 +00:00
Tobias Doerffel
1ffe1c0733 simplified formulas for calculating envelope array resulting in about 3x performance with traditional FPU code; loops now can be vectorized by GCC 4.4
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@2003 0778d3d1-df1d-0410-868b-ea421aaaa00d
2009-02-05 13:17:21 +00:00
Tobias Doerffel
aa575bca83 fixed bug: you can use shift+left to move notes past the beginning (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1997 0778d3d1-df1d-0410-868b-ea421aaaa00d
2009-02-05 09:06:58 +00:00
Tobias Doerffel
b3c9bf011b reworked mixer-threads (synchronization, realization of jobqueue etc.) which results in a much better performance and stability
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1996 0778d3d1-df1d-0410-868b-ea421aaaa00d
2009-02-05 09:03:13 +00:00
Tobias Doerffel
8b3d3f33a7 stable backport of various fixes from trunk
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1972 0778d3d1-df1d-0410-868b-ea421aaaa00d
2009-01-27 00:21:37 +00:00
Tobias Doerffel
4fefc16f4b fixed plugins/ directory when updating localization file (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1967 0778d3d1-df1d-0410-868b-ea421aaaa00d
2008-12-22 17:51:51 +00:00
Tobias Doerffel
e1403ee10b in FL_EffectChannel initialize isMuted member - fixes muted FX channels when importing older FLP files (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1965 0778d3d1-df1d-0410-868b-ea421aaaa00d
2008-12-22 16:44:36 +00:00
Tobias Doerffel
6748aa99d1 made 0.4.2 release
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1963 0778d3d1-df1d-0410-868b-ea421aaaa00d
2008-12-19 16:39:05 +00:00
Tobias Doerffel
541d9d5ad6 fixed crash when adding VST effects
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1962 0778d3d1-df1d-0410-868b-ea421aaaa00d
2008-12-19 16:22:10 +00:00
Tobias Doerffel
10f2fab3d2 fixed broken version comparing which indicated 0.x.y to be less than 0.x.y-patch - fixes messed up projects when loading files created with LMMS 0.4.0
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1961 0778d3d1-df1d-0410-868b-ea421aaaa00d
2008-12-19 16:21:34 +00:00
Tobias Doerffel
340c47baf0 made 0.4.1 release
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1956 0778d3d1-df1d-0410-868b-ea421aaaa00d
2008-12-17 23:29:51 +00:00
Tobias Doerffel
3fdf9a1870 added another preset
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1955 0778d3d1-df1d-0410-868b-ea421aaaa00d
2008-12-17 23:29:16 +00:00
Tobias Doerffel
1c7efe8696 added STK support to win32 version of LMMS (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1954 0778d3d1-df1d-0410-868b-ea421aaaa00d
2008-12-17 23:26:47 +00:00
Tobias Doerffel
95729de5ee do not create a instrument track window just for calling dragEnterEvent() - use a static method instead (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1952 0778d3d1-df1d-0410-868b-ea421aaaa00d
2008-12-17 11:53:31 +00:00
Tobias Doerffel
a9f1242841 cache background per-object instead of per-class (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1951 0778d3d1-df1d-0410-868b-ea421aaaa00d
2008-12-17 11:52:46 +00:00
Tobias Doerffel
1737caf1e0 added Andrew Kelley as author (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1950 0778d3d1-df1d-0410-868b-ea421aaaa00d
2008-12-17 11:52:20 +00:00
Tobias Doerffel
fb25a51b5f changed modifier detection from mainWindow::isCtrlPressed etc to Qt framework detection. Fixes a bunch of little glitches and enables horizontal scroll wheels (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1949 0778d3d1-df1d-0410-868b-ea421aaaa00d
2008-12-17 11:51:27 +00:00
Tobias Doerffel
f62830c1ee added support for panning editing of notes (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1948 0778d3d1-df1d-0410-868b-ea421aaaa00d
2008-12-17 11:49:28 +00:00
Tobias Doerffel
3e0f9d0216 added Japanese localization files by Keishi Suenaga <skeishi/at/yahoo/dot/co/dot/jp>
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1947 0778d3d1-df1d-0410-868b-ea421aaaa00d
2008-12-17 11:38:07 +00:00
Tobias Doerffel
77d6f7586a require at least Qt 4.3.0
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1926 0778d3d1-df1d-0410-868b-ea421aaaa00d
2008-12-14 22:11:22 +00:00
Tobias Doerffel
d18cf92277 do not disable automation when just editing first point of an automation pattern (closes #2146230) (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1908 0778d3d1-df1d-0410-868b-ea421aaaa00d
2008-12-11 00:12:15 +00:00
Tobias Doerffel
3115642507 splitted view component out of automation_pattern.* (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1907 0778d3d1-df1d-0410-868b-ea421aaaa00d
2008-12-11 00:11:40 +00:00
Tobias Doerffel
dcb9f4dfb9 removed debugging messages (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1903 0778d3d1-df1d-0410-868b-ea421aaaa00d
2008-12-10 00:46:27 +00:00
Tobias Doerffel
46fe11b395 rewrote wide parts of LVSL backend, see ChangeLog for details (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1901 0778d3d1-df1d-0410-868b-ea421aaaa00d
2008-12-10 00:42:09 +00:00
Tobias Doerffel
55f606bc07 made "int"s to "const int"s, added CCONST macro (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1900 0778d3d1-df1d-0410-868b-ea421aaaa00d
2008-12-10 00:41:44 +00:00
Tobias Doerffel
aaddeb1a28 added support for debug messages from remote plugin (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1899 0778d3d1-df1d-0410-868b-ea421aaaa00d
2008-12-10 00:41:25 +00:00
Tobias Doerffel
56c5390888 win32-version: fixed crash when using VST plugins without GUI (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1890 0778d3d1-df1d-0410-868b-ea421aaaa00d
2008-12-08 20:46:35 +00:00
Tobias Doerffel
e5dc935ec5 export effectChain for properly building FLP import DLL (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1889 0778d3d1-df1d-0410-868b-ea421aaaa00d
2008-12-08 20:45:44 +00:00
Tobias Doerffel
3c767040b3 fixed recent commit (m_timeLine was not declared as member yet)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1886 0778d3d1-df1d-0410-868b-ea421aaaa00d
2008-12-08 20:40:08 +00:00
Tobias Doerffel
7de629794a added missing file
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1884 0778d3d1-df1d-0410-868b-ea421aaaa00d
2008-12-08 10:26:08 +00:00
Andrew Kelley
a08905af5b fixed glitch where song editor would use auto-scroll even if it was disabled (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1883 0778d3d1-df1d-0410-868b-ea421aaaa00d
2008-12-08 04:52:44 +00:00
Tobias Doerffel
b289c7a7a5 explicitely declare updateSampleRate() and updateBufferSize() as virtual (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1868 0778d3d1-df1d-0410-868b-ea421aaaa00d
2008-12-04 19:54:29 +00:00
Tobias Doerffel
19829ebb1c decreased step-property of volumeModel and panningModel from 1.0 to 0.1 for allowing smoother transitions when automating etc. (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1866 0778d3d1-df1d-0410-868b-ea421aaaa00d
2008-12-04 19:48:40 +00:00
Tobias Doerffel
78f4a3b0fc added Japanese localization files by Keishi Suenaga <skeishi/at/yahoo/dot/co/dot/jp> (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1864 0778d3d1-df1d-0410-868b-ea421aaaa00d
2008-12-02 19:48:34 +00:00
Tobias Doerffel
364c837a62 per default play sub-octaves of first oscillator in osc 2 and 3 (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1862 0778d3d1-df1d-0410-868b-ea421aaaa00d
2008-12-01 22:55:51 +00:00
Tobias Doerffel
69c8580a22 fixed wrong logic in automatableModel::setValue() which led to bugs when changing linked controls to 0 (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1846 0778d3d1-df1d-0410-868b-ea421aaaa00d
2008-11-22 21:47:37 +00:00
Tobias Doerffel
07f96d132e do not allow to import unhandled file types, e.g. ZynAddSubFX presets if plugin is not available (closes #2326384) (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1844 0778d3d1-df1d-0410-868b-ea421aaaa00d
2008-11-22 19:33:53 +00:00
Tobias Doerffel
98371cb148 rewrote FLP import filter, various coding style fixes (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1842 0778d3d1-df1d-0410-868b-ea421aaaa00d
2008-11-21 23:22:36 +00:00
Tobias Doerffel
1381709a58 set OpaquePaintEvent attribute for all widgets where suitable (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1836 0778d3d1-df1d-0410-868b-ea421aaaa00d
2008-11-11 08:48:12 +00:00
Tobias Doerffel
6f78e46035 fixed broken reference sharing (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1831 0778d3d1-df1d-0410-868b-ea421aaaa00d
2008-11-04 20:04:14 +00:00
Tobias Doerffel
062b615bd1 fixed loops when adding a controller to a model which is linked to another model (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1829 0778d3d1-df1d-0410-868b-ea421aaaa00d
2008-11-04 11:51:21 +00:00
Tobias Doerffel
92789f843e call saveSettings()/loadSettings() on model rather than loading/saving value directly - fixes lost automation on basic effect controls (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1827 0778d3d1-df1d-0410-868b-ea421aaaa00d
2008-11-04 10:46:09 +00:00
Tobias Doerffel
c9aa399e41 added missing README (stable backport)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1824 0778d3d1-df1d-0410-868b-ea421aaaa00d
2008-11-02 22:41:20 +00:00
Tobias Doerffel
6f5029d4ba created stable 0.4.x branch
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.4@1822 0778d3d1-df1d-0410-868b-ea421aaaa00d
2008-10-31 12:14:19 +00:00
127 changed files with 14618 additions and 3065 deletions

View File

@@ -14,6 +14,10 @@ Javier Serrano Polo
<jasp00/at/terra/dot/es>
development
Andrew Kelley
<superjoe30/at/gmail/dot/com>
development
Andreas Brandmaier
<andy/at/brandmaier/dot/de>
BitInvader plugin

View File

@@ -15,7 +15,7 @@ INCLUDE(FindPkgConfig)
SET(VERSION_MAJOR "0")
SET(VERSION_MINOR "4")
SET(VERSION_PATCH "0")
SET(VERSION_PATCH "3")
#SET(VERSION_SUFFIX "")
SET(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
IF(VERSION_SUFFIX)
@@ -29,7 +29,7 @@ INCLUDE(DetectMachine)
IF(LMMS_HOST_X86_64)
SET(STRIP /opt/mingw64/bin/x86_64-pc-mingw32-strip)
ELSE(LMMS_HOST_X86_64)
SET(STRIP /opt/mingw/bin/i586-mingw32-strip)
SET(STRIP /opt/mingw32/bin/i586-pc-mingw32-strip)
ENDIF(LMMS_HOST_X86_64)
OPTION(WANT_ALSA "Include ALSA (Advanced Linux Sound Architecture) support" ON)
@@ -54,14 +54,12 @@ IF(LMMS_BUILD_WIN32)
SET(WANT_ALSA OFF)
SET(WANT_JACK OFF)
SET(WANT_PULSEAUDIO OFF)
SET(WANT_STK OFF)
SET(WANT_SYSTEM_SR OFF)
SET(WANT_WINMM ON)
SET(LMMS_HAVE_WINMM TRUE)
SET(STATUS_ALSA "<not supported on this platform>")
SET(STATUS_JACK "<not supported on this platform>")
SET(STATUS_PULSEAUDIO "<not supported on this platform>")
SET(STATUS_STK "<not supported on this platform>")
SET(STATUS_WINMM "OK")
ELSE(LMMS_BUILD_WIN32)
SET(STATUS_WINMM "<not supported on this platform>")
@@ -93,9 +91,18 @@ CHECK_INCLUDE_FILES(process.h LMMS_HAVE_PROCESS_H)
CHECK_INCLUDE_FILES(locale.h LMMS_HAVE_LOCALE_H)
# check for Qt4
SET(QT_MIN_VERSION "4.3.0")
FIND_PACKAGE(Qt4 REQUIRED)
SET(QT_USE_QTXML 1)
EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE} ARGS "-query QT_INSTALL_TRANSLATIONS" OUTPUT_VARIABLE QT_TRANSLATIONS_DIR)
IF(LMMS_BUILD_WIN32)
SET(QT_TRANSLATIONS_DIR "/opt/mingw32/share/qt4/translations/")
# hack to allow making moc.exe a symlink to native moc-binary in compatible version
SET(QT_MOC_EXECUTABLE ${QT_BINARY_DIR}/moc.exe)
ENDIF(LMMS_BUILD_WIN32)
IF(LMMS_BUILD_WIN64)
SET(QT_TRANSLATIONS_DIR "/opt/mingw64/share/qt4/translations/")
ENDIF(LMMS_BUILD_WIN64)
IF(EXISTS "${QT_TRANSLATIONS_DIR}")
MESSAGE("-- Found Qt translations in ${QT_TRANSLATIONS_DIR}")
ADD_DEFINITIONS(-D'QT_TRANSLATIONS_DIR="${QT_TRANSLATIONS_DIR}"')
@@ -149,7 +156,7 @@ IF(WANT_SDL)
SET(STATUS_SDL "OK")
ELSE(SDL_FOUND)
SET(STATUS_SDL "not found, please install libsdl1.2-dev (or similiar) "
"if your require SDL support")
"if you require SDL support")
ENDIF(SDL_FOUND)
ENDIF(WANT_SDL)
IF(NOT LMMS_HAVE_SDL)
@@ -170,7 +177,7 @@ IF(WANT_STK)
ELSE(STK_FOUND)
SET(STK_INCLUDE_DIR "")
SET(STATUS_STK "not found, please install libstk0-dev (or similiar) "
"if your require the Vibed Instrument")
"if you require the Vibed Instrument")
ENDIF(STK_FOUND)
ENDIF(WANT_STK)
@@ -183,7 +190,7 @@ ENDIF(WANT_STK)
# SET(STATUS_PORTAUDIO "OK")
# ELSE(PORTAUDIO_FOUND)
# SET(STATUS_PORTAUDIO "not found, please install libportaudio-dev (or similiar, version >= 1.8) "
# "if your require Portaudio support")
# "if you require Portaudio support")
# ENDIF(PORTAUDIO_FOUND)
#ENDIF(WANT_PORTAUDIO)
IF(NOT LMMS_HAVE_PORTAUDIO)
@@ -200,7 +207,7 @@ IF(WANT_PULSEAUDIO)
SET(STATUS_PULSEAUDIO "OK")
ELSE(PULSEAUDIO_FOUND)
SET(STATUS_PULSEAUDIO "not found, please install libpulse-dev (or similiar) "
"if your require PulseAudio support")
"if you require PulseAudio support")
ENDIF(PULSEAUDIO_FOUND)
ENDIF(WANT_PULSEAUDIO)
IF(NOT LMMS_HAVE_PULSEAUDIO)
@@ -318,7 +325,7 @@ ENDIF(LMMS_BUILD_WIN32)
# check for libsamplerate
IF(WANT_SYSTEM_SR)
PKG_CHECK_MODULES(SAMPLERATE samplerate>=0.1.3)
PKG_CHECK_MODULES(SAMPLERATE samplerate>=0.1.6)
IF(SAMPLERATE_FOUND)
SET(LMMS_HAVE_SAMPLERATE TRUE)
ENDIF(SAMPLERATE_FOUND)
@@ -393,7 +400,7 @@ IF(WIN32)
IF(LMMS_HOST_X86_64)
SET(WINDRES /opt/mingw64/bin/x86_64-pc-mingw32-windres)
ELSE(LMMS_HOST_X86_64)
SET(WINDRES /opt/mingw/bin/i586-mingw32-windres)
SET(WINDRES /opt/mingw32/bin/i586-pc-mingw32-windres)
ENDIF(LMMS_HOST_X86_64)
ADD_CUSTOM_COMMAND(OUTPUT ${WINRC}
COMMAND ${WINDRES}
@@ -434,7 +441,7 @@ IF(LMMS_BUILD_WIN32)
IF(LMMS_BUILD_WIN64)
INSTALL(FILES /opt/mingw64/bin/QtCore4.dll /opt/mingw64/bin/QtGui4.dll /opt/mingw64/bin/QtXml4.dll /opt/mingw64/bin/libsndfile-1.dll /opt/mingw64/bin/libvorbis-0.dll /opt/mingw64/bin/libvorbisenc-2.dll /opt/mingw64/bin/libvorbisfile-3.dll /opt/mingw64/bin/libogg-0.dll /opt/mingw64/bin/libfluidsynth-1.dll /opt/mingw64/bin/libfftw3f-3.dll /opt/mingw64/bin/SDL.dll DESTINATION .)
ELSE(LMMS_BUILD_WIN64)
INSTALL(FILES /opt/mingw/bin/QtCore4.dll /opt/mingw/bin/QtGui4.dll /opt/mingw/bin/QtXml4.dll /opt/mingw/bin/libz.dll /opt/mingw/bin/libsndfile-1.dll /opt/mingw/bin/libvorbis-0.dll /opt/mingw/bin/libvorbisenc-2.dll /opt/mingw/bin/libvorbisfile-3.dll /opt/mingw/bin/libogg-0.dll /opt/mingw/bin/libfluidsynth-1.dll /opt/mingw/bin/libfftw3f-3.dll /opt/mingw/bin/SDL.dll /opt/mingw/i586-mingw32/bin/mingwm10.dll DESTINATION .)
INSTALL(FILES /opt/mingw32/bin/QtCore4.dll /opt/mingw32/bin/QtGui4.dll /opt/mingw32/bin/QtXml4.dll /opt/mingw32/bin/libz.dll /opt/mingw32/bin/libsndfile-1.dll /opt/mingw32/bin/libvorbis-0.dll /opt/mingw32/bin/libvorbisenc-2.dll /opt/mingw32/bin/libvorbisfile-3.dll /opt/mingw32/bin/libogg-0.dll /opt/mingw32/bin/libfluidsynth-1.dll /opt/mingw32/bin/libfftw3f-3.dll /opt/mingw32/bin/SDL.dll /opt/mingw32/i586-pc-mingw32/bin/mingwm10.dll DESTINATION .)
ENDIF(LMMS_BUILD_WIN64)
ELSE(LMMS_BUILD_WIN32)
INSTALL(TARGETS lmms RUNTIME DESTINATION bin)
@@ -451,7 +458,7 @@ FOREACH(_ts_file ${lmms_LOCALES})
STRING(REPLACE "${CMAKE_SOURCE_DIR}/data/locale/" "" _ts_target "${_ts_file}")
STRING(REPLACE ".ts" ".qm" _qm_file "${_ts_file}")
STRING(REPLACE ".ts" ".qm" _qm_target "${_ts_target}")
ADD_CUSTOM_TARGET(${_ts_target} COMMAND ${QT_LUPDATE_EXECUTABLE} ${lmms_SOURCES} `find plugins/ -type f -name '*.cpp'` -ts ${_ts_file})
ADD_CUSTOM_TARGET(${_ts_target} COMMAND ${QT_LUPDATE_EXECUTABLE} ${lmms_SOURCES} `find ${CMAKE_SOURCE_DIR}/plugins/ -type f -name '*.cpp'` -ts ${_ts_file})
ADD_CUSTOM_TARGET(${_qm_target} COMMAND ${QT_LRELEASE_EXECUTABLE} ${_ts_file} -qm ${_qm_file})
LIST(APPEND ts_targets "${_ts_target}")
LIST(APPEND qm_targets "${_qm_target}")
@@ -520,21 +527,21 @@ ADD_CUSTOM_TARGET(win32-pkg
COMMAND cp plugins/ladspa_effect/caps/caps.dll tmp/lmms/plugins/ladspa/
COMMAND cp plugins/ladspa_effect/tap/tap*.dll tmp/lmms/plugins/ladspa/
COMMAND cd data && make DESTDIR=${CMAKE_BINARY_DIR}/tmp/lmms/ install
COMMAND mv tmp/lmms/opt/mingw/share/lmms/* tmp/lmms/data/ && rm -rf tmp/lmms/opt
COMMAND cp /opt/mingw/bin/QtCore4.dll tmp/lmms
COMMAND cp /opt/mingw/bin/QtGui4.dll tmp/lmms
COMMAND cp /opt/mingw/bin/QtXml4.dll tmp/lmms
COMMAND cp /opt/mingw/bin/libz.dll tmp/lmms
COMMAND cp /opt/mingw/bin/libsndfile-1.dll tmp/lmms
COMMAND cp /opt/mingw/bin/libvorbis*.dll tmp/lmms
COMMAND cp /opt/mingw/bin/libogg-0.dll tmp/lmms
COMMAND cp /opt/mingw/bin/libfluidsynth-1.dll tmp/lmms
COMMAND cp /opt/mingw/bin/libfftw3f-3.dll tmp/lmms
COMMAND cp /opt/mingw/bin/SDL.dll tmp/lmms
COMMAND cp /opt/mingw/i586-mingw32/bin/mingwm10.dll tmp/lmms
COMMAND mv tmp/lmms/opt/mingw32/share/lmms/* tmp/lmms/data/ && rm -rf tmp/lmms/opt
COMMAND cp /opt/mingw32/bin/QtCore4.dll tmp/lmms
COMMAND cp /opt/mingw32/bin/QtGui4.dll tmp/lmms
COMMAND cp /opt/mingw32/bin/QtXml4.dll tmp/lmms
COMMAND cp /opt/mingw32/bin/libz.dll tmp/lmms
COMMAND cp /opt/mingw32/bin/libsndfile-1.dll tmp/lmms
COMMAND cp /opt/mingw32/bin/libvorbis*.dll tmp/lmms
COMMAND cp /opt/mingw32/bin/libogg-0.dll tmp/lmms
COMMAND cp /opt/mingw32/bin/libfluidsynth-1.dll tmp/lmms
COMMAND cp /opt/mingw32/bin/libfftw3f-3.dll tmp/lmms
COMMAND cp /opt/mingw32/bin/SDL.dll tmp/lmms
COMMAND cp /opt/mingw32/i586-mingw32/bin/mingwm10.dll tmp/lmms
COMMAND cp -L ${CMAKE_SOURCE_DIR}/COPYING tmp/lmms/LICENSE.TXT
COMMAND cp -L ${CMAKE_SOURCE_DIR}/README tmp/lmms/README.TXT
COMMAND /opt/mingw/bin/i586-mingw32-strip tmp/lmms/lmms.exe tmp/lmms/plugins/*.dll tmp/lmms/plugins/ladspa/*.dll
COMMAND /opt/mingw32/bin/i586-pc-mingw32-strip tmp/lmms/lmms.exe tmp/lmms/plugins/*.dll tmp/lmms/plugins/ladspa/*.dll
COMMAND mv tmp/lmms tmp/lmms-${VERSION}
COMMAND cd tmp && zip -r -9 ../lmms-${VERSION}-bin-win32.zip lmms-${VERSION}/*
COMMAND rm -rf tmp
@@ -624,7 +631,7 @@ SET(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}")
IF(VERSION_SUFFIX)
SET(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}-${VERSION_SUFFIX}")
ENDIF(VERSION_SUFFIX)
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "LMMS-${VERSION}")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "LMMS ${VERSION}")
IF(WIN32)
SET(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/data\\\\nsis_branding.bmp")
SET(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/data\\\\lmms.ico")

462
ChangeLog
View File

@@ -1,3 +1,465 @@
2009-02-23 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* README:
* CMakeLists.txt:
made 0.4.3 release
* include/atomic_int.h:
- fixed typo
- added copy constructor implementation for AtomicInt class - fixes
build failure with Qt < 4.4.0
* CMakeLists.txt:
fixed typos
* cmake/modules/FindSTK.cmake:
* CMakeLists.txt:
reflect changes in MinGW crosscompiling environment
2009-02-19 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* include/fade_button.h:
* src/gui/widgets/fade_button.cpp:
rewrote timing of fading animation for not postponing updates of
hidden fadeButton until it becomes visible
* src/gui/widgets/automatable_button.cpp:
* src/core/track.cpp:
make sure all buttons in trackOperationsWidget have focus-policy
set to Qt::NoFocus in order to make space play song even if you clicked
e.g. a mute-button (closes #2486211)
* include/note.h:
* src/core/note.cpp:
- coding style fixes
- improved handling of shared detuningHelper object
* include/instrument_track.h:
* include/piano_roll.h:
* src/gui/piano_roll.cpp:
* src/gui/song_editor.cpp:
* src/tracks/instrument_track.cpp:
fixed various bugs regarding recording:
- once recording has been started, stop it as soon as playMode of song
changes or similiar things happen (closes #2486341)
- fixed broken record-accompany in most use-cases other than using
record-while-playing-song by also tracking NoteOn events and remember
current play position to use the correct note postitions on NoteOff
events (play position might have wrapped around in the meantime due
to looppoints or end of BB track) (closes #2486299, #2486203)
- move timeLine marker in Piano Roll and autoscroll when recording while
playing song (closes #2486334)
2009-02-14 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* src/3rdparty/samplerate/samplerate.h:
reverted rev 2037 as we have custom changes in this file
2009-02-13 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* include/pattern.h:
* src/tracks/pattern.cpp:
- added missing slot declaration for abortFreeze(), fixes lockup when
freezing pattern (closes #2530320)
- update patternView after freezing
- fixed drawing of frozen pattern
* include/sample_buffer.h:
* src/core/sample_buffer.cpp:
- when resampling whole sampleBuffer, set end_of_input = 1 in
libsamplerate data struct - fixes lots of zero samples at the end
of output buffer (closes #2531452)
- coding style fixes
- removed obsolete save/restore of EOF-property in libsample rate
data struct when resampling successively (always use 0)
* src/3rdparty/samplerate/src_linear.c:
* src/3rdparty/samplerate/samplerate.h:
* src/3rdparty/samplerate/src_sinc.c:
* src/3rdparty/samplerate/src_zoh.c:
* src/3rdparty/samplerate/samplerate.c:
* CMakeLists.txt:
integrated latest libsamplerate which is both faster and more reliable
* src/gui/widgets/visualization_widget.cpp:
disable output monitor per default and show click-hint
2009-02-12 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* include/group_box.h:
* src/gui/widgets/effect_rack_view.cpp:
backport: manage effectRackView with a QVBoxLayout
* src/gui/widgets/controller_rack_view.cpp:
* src/gui/widgets/effect_rack_view.cpp:
backport: prevent Horizontal bars from appearing in some cases
* cmake/modules/Win32Toolchain.cmake:
reflect recent changes to MinGW cross compiling environment
* plugins/sf2_player/sf2_player.cpp:
update patch after loading settings (closes #2486372)
* src/gui/piano_roll.cpp:
ensure, cursor is never NULL when painting it in paintEvent()
* src/core/sample_buffer.cpp:
do not load samples bigger than 100 MB (closes #2458375)
2009-02-05 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* plugins/ladspa_effect/caps/dsp/Eq.h:
better workaround for optimizer bug in GCC >= 4.3
* plugins/sid/sid_instrument.cpp:
* plugins/flp_import/unrtf.cpp:
* src/core/track.cpp:
added missing header for compilation with GCC 4.4
* include/pattern.h:
* src/tracks/pattern.cpp:
cleanups
* src/core/envelope_and_lfo_parameters.cpp:
- simplified formulas for calculating envelope array resulting in about
3x performance with traditional FPU code
- loops now can be vectorized by GCC 4.4
* include/atomic_int.h:
* include/audio_port.h:
* include/mixer.h:
* src/core/mixer.cpp:
reworked mixer-threads (synchronization, realization of jobqueue etc.)
which results in a much better performance and stability
2009-02-04 Andrew Kelley <superjoe30/at/gmail/dot/com>
* src/gui/piano_roll.cpp:
fixed bug: you can use shift+left to move notes past the beginning
2009-02-01 Andrew Kelley <superjoe30/at/gmail/dot/com>
* src/core/track.cpp:
integrated pitanga's patch to fix unquantized BB dragging in
song editor. Changed ctrl modifier to alt to be consistent.
2009-01-25 Paul Giblock <drfaygo/at/gmail/dot/com>
* src/tracks/bb_track.cpp:
Integrate broken BB-clone bug from pitanga
2009-01-25 Paul Giblock <drfaygo/at/gmail/dot/com>
* src/gui/widgets/knob.cpp:
Fix infinite recursion on Mac OSX
* plugins/flp_import/unrtf/html.c:
* plugins/flp_import/unrtf/output.h:
* plugins/flp_import/unrtf/convert.c:
Avoid compile warnings
2008-12-22 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* CMakeLists.txt:
fixed plugins/ directory when updating localization file
* plugins/flp_import/flp_import.cpp:
in FL_EffectChannel initialize isMuted member - fixes muted FX channels
when importing older FLP files
2008-12-19 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* CMakeLists.txt:
* README:
made 0.4.2 release
* plugins/vst_base/vst_plugin.h:
* plugins/vst_base/vst_plugin.cpp:
* plugins/vst_effect/vst_effect_control_dialog.cpp:
* plugins/vst_effect/vst_effect.cpp:
* plugins/vestige/vestige.cpp:
fixed crash when adding VST effects
* include/project_version.h:
* src/core/project_version.cpp:
fixed broken version comparing which indicated 0.x.y to be less than
0.x.y-patch - fixes messed up projects when loading files created
with LMMS 0.4.0
2008-12-17 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* CMakeLists.txt:
* README:
made 0.4.1 release
* cmake/modules/FindSTK.cmake:
* include/combobox_model.h:
* include/combobox.h:
* src/core/config_mgr.cpp:
* data/CMakeLists.txt:
* CMakeLists.txt:
added STK support to win32 version of LMMS
* data/locale/ja.ts:
* data/locale/ja.qm:
added Japanese localization files by
Keishi Suenaga <skeishi/at/yahoo/dot/co/dot/jp>
* include/instrument_track.h:
* src/tracks/instrument_track.cpp:
backport: do not create a instrument track window just for calling
dragEnterEvent() - use a static method instead
2008-12-17 Paul Giblock <drfaygo/at/gmail/dot/com>
* include/track.h:
* src/core/track.cpp:
backport: cache background per-object instead of per-class
2008-12-17 Andrew Kelley <superjoe30/at/gmail/dot/com>
* AUTHORS:
backport: added Andrew Kelley as author
* src/core/timeline.cpp:
* src/gui/automatable_model_view.cpp:
* src/gui/automation_editor.cpp:
* src/gui/piano_roll.cpp:
* src/gui/widgets/automatable_button.cpp:
* src/gui/widgets/automatable_slider.cpp:
* src/gui/widgets/combobox.cpp:
* src/gui/widgets/fader.cpp:
* src/gui/widgets/knob.cpp:
* src/gui/widgets/lcd_spinbox.cpp:
* src/tracks/sample_track.cpp:
backport: changed modifier detection from mainWindow::isCtrlPressed
etc to Qt framework detection. Fixes a bunch of little glitches and
enables horizontal scroll wheels.
* include/midi.h:
* include/note.h:
* include/panning.h:
* include/panning_constants.h:
* include/pattern.h:
* include/piano_roll.h:
* src/core/note.cpp:
* src/core/piano.cpp:
* src/tracks/pattern.cpp:
backport: added support for panning editing of notes
2008-12-14 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* CMakeLists.txt:
require at least Qt 4.3.0
2008-12-11 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* include/automation_pattern.h:
* src/core/automation_pattern.cpp:
do not disable automation when just editing first point of an
automation pattern (closes #2146230)
* include/automation_pattern_view.h:
* src/gui/automation_pattern_view.cpp:
splitted view component out of automation_pattern.*
2008-12-10 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* plugins/vst_base/communication.h:
* plugins/vst_base/vst_plugin.cpp:
* plugins/vst_base/remote_vst_plugin.cpp:
rewrote wide parts of LVSL backend:
- now supports two threading models which makes LMMS support plugins
like Sytrus, z3ta+ etc.
- on win32 create native widget as parent for plugin's GUI, fixes
warning message when loading KarmaSynth (closes #2276787)
- try more symbol names for entry procedure
* include/aeffectx.h:
- made "int"s to "const int"s
- added CCONST macro
* include/remote_plugin.h:
* src/core/remote_plugin.cpp:
added support for debug messages from remote plugin
2008-12-08 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* plugins/vst_base/vst_plugin.cpp:
win32-version: fixed crash when using VST plugins without GUI
* include/effect_chain.h:
export effectChain for properly building FLP import DLL
* include/song_editor.h:
* src/gui/song_editor.cpp:
fixed recent commit (m_timeLine was not declared as member yet)
2008-12-07 Andrew Kelley <superjoe30/at/gmail/dot/com>
* src/gui/song_editor.cpp:
fixed glitch where it would auto-scroll even if it was off in
song-editor
2008-12-04 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* plugins/vst_base/remote_vst_plugin.cpp:
explicitely declare updateSampleRate() and updateBufferSize() as virtual
* src/tracks/instrument_track.cpp:
decreased step-property of volumeModel and panningModel from 1.0 to 0.1
for allowing smoother transitions when automating etc.
2008-12-02 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* data/locale/ja.ts:
* data/locale/ja.qm:
added Japanese localization files by
Keishi Suenaga <skeishi/at/yahoo/dot/co/dot/jp>
2008-12-01 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* plugins/triple_oscillator/triple_oscillator.cpp:
per default play sub-octaves of first oscillator in osc 2 and 3
2008-11-22 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* src/core/automatable_model.cpp:
fixed wrong logic in automatableModel::setValue() which led to bugs when
changing linked controls to 0
* src/gui/file_browser.cpp:
do not allow to import unhandled file types, e.g. ZynAddSubFX presets if
plugin is not available (closes #2326384)
2008-11-21 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* plugins/flp_import/flp_import.h:
* plugins/flp_import/flp_import.cpp:
completely rewrote FLP import filter since it didn't work at all
anymore - it now doesn't create or change any things in LMMS while
importing and instead builds up a complete data structure first
which represents the FL Studio project and then creates an LMMS
project based upon this data structure
- now supports projects from FL Studio 3 to 8
- more verbose debug output
- import volume, panning, pitch and FX channel for instrument tracks
- import amplification, loop-mode and reverse-mode settings for
AudioFileProcessor
- import FX mixer settings and effects
- import automation data
- import channel- and pattern names
- import volume and panning settings of individual notes
- add notes of instrument layer master to each layer children for at
least having a complete sound - need to replace with real layering
support later
- map more instruments to various LMMS instruments
- fixed calculations of length and position of notes
- fixed importing steps/dots
- fixed scaling factor of various controls (arpeggio time,
envelope sustain and amount, filter cut/res, TripleOsc volumes etc.)
- if three user defined samples were found for TripleOscillator set
first oscillator to oscillator::SawWave
* plugins/flp_import/unrtf.cpp:
* plugins/flp_import/CMakeLists.txt:
* plugins/flp_import/unrtf/error.h:
* plugins/flp_import/unrtf/output.c:
* plugins/flp_import/unrtf/html.c:
* plugins/flp_import/unrtf/output.h:
* plugins/flp_import/unrtf/malloc.c:
* plugins/flp_import/unrtf/html.h:
* plugins/flp_import/unrtf/attr.c:
* plugins/flp_import/unrtf/parse.c:
* plugins/flp_import/unrtf/word.c:
* plugins/flp_import/unrtf/malloc.h:
* plugins/flp_import/unrtf/util.c:
* plugins/flp_import/unrtf/attr.h:
* plugins/flp_import/unrtf/parse.h:
* plugins/flp_import/unrtf/convert.c:
* plugins/flp_import/unrtf/word.h:
* plugins/flp_import/unrtf/util.h:
* plugins/flp_import/unrtf/hash.c:
* plugins/flp_import/unrtf/convert.h:
* plugins/flp_import/unrtf/defs.h:
* plugins/flp_import/unrtf/hash.h:
* plugins/flp_import/unrtf/main.h:
* plugins/flp_import/unrtf/error.c:
updated to latest version of unrtf and improved string operations
* src/core/main.cpp:
added support for importing file from commandline
* include/effect_chain.h:
added method for enabling/disabling FX chain
* include/file_browser.h:
* src/gui/file_browser.cpp:
enhanced support for importing various file types directly from browser
* include/pattern.h:
* src/tracks/pattern.cpp:
added method for toggling steps
* include/fx_mixer.h:
added method for accessing FX channels
* plugins/midi_import/midi_import.cpp:
check for tempoAutomationPattern being NULL for not crashing when
importing to BB-Editor
* include/instrument_track.h:
return pointers instead of references to various internal models
* include/basic_filters.h:
* include/bb_track_container.h:
* include/instrument_track.h:
* include/pattern.h:
* include/track_container.h:
* src/core/instrument_functions.cpp:
* src/tracks/pattern.cpp:
* src/gui/track_container_view.cpp:
coding style fixes
2008-11-11 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* src/core/track.cpp:
* src/core/timeline.cpp:
* src/core/piano.cpp:
* src/core/automation_pattern.cpp:
* src/gui/piano_roll.cpp:
* src/gui/fx_mixer_view.cpp:
* src/gui/widgets/track_label_button.cpp:
* src/gui/widgets/visualization_widget.cpp:
* src/gui/widgets/combobox.cpp:
* src/gui/widgets/tab_widget.cpp:
* src/gui/widgets/kmultitabbar.cpp:
* src/gui/widgets/envelope_and_lfo_view.cpp:
* src/gui/widgets/cpuload_widget.cpp:
* src/gui/widgets/fade_button.cpp:
* src/gui/widgets/lcd_spinbox.cpp:
* src/gui/widgets/group_box.cpp:
* src/gui/widgets/fader.cpp:
* src/gui/widgets/effect_rack_view.cpp:
* src/gui/widgets/effect_view.cpp:
* src/gui/automation_editor.cpp:
set OpaquePaintEvent attribute for all widgets where suitable - makes
whole GUI less sluggish :)
2008-11-04 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* plugins/sf2_player/sf2_player.cpp:
fixed broken reference sharing
* include/automatable_model.h:
* src/core/automatable_model.cpp:
fixed loops when adding a controller to a model which is linked to
another model
* src/core/effect.cpp:
call saveSettings()/loadSettings() on model rather than loading/saving
value directly - fixes lost automation on basic effect controls
2008-10-30 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* CMakeLists.txt:

10
README
View File

@@ -1,7 +1,7 @@
Linux MultiMedia Studio 0.4.0
Linux MultiMedia Studio 0.4.3
==============================
Copyright (c) 2004-2008 by LMMS-developers
Copyright (c) 2004-2009 by LMMS-developers
This program is free software; you can redistribute it and/or modify
@@ -52,15 +52,15 @@ Required libraries:
- Qt >= 4.3.0 with devel-files (4.4.x recommended)
Optional, but strongly recommended:
- JACK with devel-files
- libvorbis & libogg with devel-files
- libalsa with devel-files
- libvorbis & libogg with devel-files
- libfluidsynth with devel files
- SDL with devel-files
- libsamplerate >= 0.1.3 with devel-files
- libsndfile with devel-files
- WINE + WINE-devel-files
- stk, libstk + libstk-dev
- libfluidsynth with devel files
- JACK with devel-files
For compiling you should have an up to date GCC with g++.

View File

@@ -1,6 +1,6 @@
FIND_PATH(STK_INCLUDE_DIR Stk.h /usr/include/stk /usr/local/include/stk)
FIND_PATH(STK_INCLUDE_DIR Stk.h /usr/include/stk /usr/local/include/stk ${CMAKE_INSTALL_PREFIX}/include/stk ${CMAKE_FIND_ROOT_PATH}/include/stk)
FIND_LIBRARY(STK_LIBRARY NAMES stk PATH /usr/lib /usr/local/lib)
FIND_LIBRARY(STK_LIBRARY NAMES stk PATH /usr/lib /usr/local/lib ${CMAKE_INSTALL_PREFIX}/lib ${CMAKE_FIND_ROOT_PATH}/lib)
IF (STK_INCLUDE_DIR AND STK_LIBRARY)
SET(STK_FOUND TRUE)

View File

@@ -4,16 +4,16 @@ SET(CMAKE_SYSTEM_NAME Windows)
SET(CMAKE_SYSTEM_VERSION 1)
SET(CMAKE_SYSTEM_PROCESSOR i686)
SET(CMAKE_INSTALL_PREFIX /opt/mingw)
SET(CMAKE_INSTALL_PREFIX /opt/mingw32)
SET(CC_PREFIX /opt/mingw)
SET(CC_PREFIX /opt/mingw32)
# specify the cross compiler
SET(CMAKE_C_COMPILER ${CC_PREFIX}/bin/i586-mingw32-gcc)
SET(CMAKE_CXX_COMPILER ${CC_PREFIX}/bin/i586-mingw32-g++)
SET(CMAKE_C_COMPILER ${CC_PREFIX}/bin/i586-pc-mingw32-gcc)
SET(CMAKE_CXX_COMPILER ${CC_PREFIX}/bin/i586-pc-mingw32-g++)
# where is the target environment
SET(CMAKE_FIND_ROOT_PATH /opt/mingw)
SET(CMAKE_FIND_ROOT_PATH /opt/mingw32)
SET(QT_BINARY_DIR ${CC_PREFIX}/bin)
SET(QT_LIBRARY_DIR ${CC_PREFIX}/lib)

View File

@@ -11,3 +11,8 @@ INSTALL(FILES lmms.desktop DESTINATION ${DATA_DIR}/applications)
INSTALL(FILES lmms.xml DESTINATION ${DATA_DIR}/mime/packages)
ENDIF(LMMS_BUILD_LINUX)
IF(LMMS_BUILD_WIN32)
FILE(GLOB RAWWAVES ${CMAKE_INSTALL_PREFIX}/share/stk/rawwaves/*.raw)
INSTALL(FILES ${RAWWAVES} DESTINATION ${DATA_DIR}/stk/rawwaves)
ENDIF(LMMS_BUILD_WIN32)

BIN
data/locale/ja.qm Normal file

Binary file not shown.

7093
data/locale/ja.ts Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,61 @@
<?xml version="1.0"?>
<!DOCTYPE multimedia-project>
<multimedia-project version="1.0" creator="Linux MultiMedia Studio (LMMS)" creatorversion="0.9.0-20081123" type="instrumenttracksettings" >
<head/>
<instrumenttracksettings muted="0" type="0" name="Supernova" >
<instrumenttrack pan="0" fxch="0" pitch="0" basenote="69" vol="200" >
<instrument name="tripleoscillator" >
<tripleoscillator phoffset2="0" userwavefile0="" finer0="0" userwavefile1="" finer1="-4" userwavefile2="" finer2="2" coarse0="0" coarse1="0" coarse2="0" finel0="0" finel1="4" modalgo1="0" modalgo2="0" finel2="-2" pan0="0" modalgo3="2" pan1="0" stphdetun0="0" pan2="0" stphdetun1="0" wavetype0="3" stphdetun2="0" wavetype1="5" wavetype2="5" vol0="33" vol1="33" phoffset0="0" phoffset1="0" vol2="33" />
</instrument>
<eldata fres="0.5" ftype="7" fcut="3221" fwet="1" >
<elvol lspd_denominator="4" pdel="0" userwavefile="" dec="0.13" lamt="0" syncmode="0" latt="0" rel="0.15" sus="0.5" amt="1" x100="0" att="0" lpdel="0" hold="0" lshp="0" lspd="0.1" ctlenvamt="0" lspd_numerator="4" />
<elcut lspd_denominator="4" pdel="0" userwavefile="" dec="0.25" lamt="0" syncmode="8" latt="0.24" rel="0.1" sus="0.5" amt="0.665" x100="0" att="0" lpdel="0" hold="0" lshp="1" lspd="0.0161" ctlenvamt="0" lspd_numerator="3" />
<elres lspd_denominator="4" pdel="0" userwavefile="" dec="0.5" lamt="0" syncmode="3" latt="0" rel="0.1" sus="0.5" amt="0" x100="0" att="0" lpdel="0" hold="0.5" lshp="3" lspd="0.0545" ctlenvamt="0" lspd_numerator="4" />
</eldata>
<chordcreator chord="0" chordrange="4" chord-enabled="1" />
<arpeggiator arptime="273" arprange="3" arptime_denominator="4" syncmode="5" arpmode="0" arp-enabled="0" arp="0" arptime_numerator="4" arpdir="1" arpgate="100" />
<midiport inputcontroller="0" inports="24:0 USB Oxygen 49:USB Oxygen 49 MIDI 1" fixedoutputvelocity="-1" inputchannel="0" outputcontroller="0" writable="0" outputchannel="1" fixedinputvelocity="-1" outputprogram="1" readable="1" />
<fxchain numofeffects="6" enabled="1" >
<effect autoquit_numerator="1" autoquit_denominator="1" syncmode="0" autoquit="0" gate="0" name="stereomatrix" wet="0.38" on="1" >
<stereomatrixcontrols l-l="-0.5" l-r="-0.5" r-l="-0.5" r-r="-0.5" />
<key/>
</effect>
<effect autoquit_numerator="1" autoquit_denominator="1" syncmode="0" autoquit="0" gate="0" name="ladspaeffect" wet="1" on="1" >
<ladspacontrols port11="0.15" port01="0.16" port12="1" port02="1" port13="1.5708" port03="1.5708" port14="0" port04="0" port04link="1" port02link="1" port03link="1" link="0" ports="8" port01link="0" />
<key>
<attribute value="caps" name="file" />
<attribute value="PhaserII" name="plugin" />
</key>
</effect>
<effect autoquit_numerator="1" autoquit_denominator="1" syncmode="0" autoquit="0" gate="0" name="ladspaeffect" wet="0.75" on="1" >
<ladspacontrols port11="0" port01="0" port12="0.5" port02="0.5" port13="0.5" port03="0.5" port14="0.5" port04="0.5" port04link="1" port02link="1" port03link="1" link="1" ports="8" port01link="1" />
<key>
<attribute value="caps" name="file" />
<attribute value="ToneStack" name="plugin" />
</key>
</effect>
<effect autoquit_numerator="1" autoquit_denominator="1" syncmode="0" autoquit="0" gate="0" name="ladspaeffect" wet="1" on="0" >
<ladspacontrols link="1" ports="0" />
<key>
<attribute value="dc_remove_1207" name="file" />
<attribute value="dcRemove" name="plugin" />
</key>
</effect>
<effect autoquit_numerator="4" autoquit_denominator="4" syncmode="0" autoquit="8000" gate="0" name="ladspaeffect" wet="0.25" on="1" >
<ladspacontrols port00="365" port01="50" port02="245" port03="50" port04="0" port05="0" port06="-70" port07="1" port08="0" port09="1" ports="10" />
<key>
<attribute value="tap_echo" name="file" />
<attribute value="tap_stereo_echo" name="plugin" />
</key>
</effect>
<effect autoquit_numerator="4" autoquit_denominator="4" syncmode="0" autoquit="1" gate="0" name="ladspaeffect" wet="1" on="1" >
<ladspacontrols port00="1.5" ports="1" />
<key>
<attribute value="cmt" name="file" />
<attribute value="amp_stereo" name="plugin" />
</key>
</effect>
</fxchain>
</instrumenttrack>
</instrumenttracksettings>
</multimedia-project>

View File

@@ -26,6 +26,10 @@
#ifndef _AEFFECTX_H
#define _AEFFECTX_H
#define CCONST(a, b, c, d)( ( ( (int) a ) << 24 ) | \
( ( (int) b ) << 16 ) | \
( ( (int) c ) << 8 ) | \
( ( (int) d ) << 0 ) )
const int audioMasterAutomate = 0;
const int audioMasterVersion = 1;
@@ -79,44 +83,39 @@ const int audioMasterEditFile = 47; // currently unused
const int audioMasterGetChunkFile = 48; // currently unused
const int audioMasterGetInputSpeakerArrangement = 49; // currently unused
int effFlagsHasEditor = 1;
int effFlagsCanReplacing = 1 << 4; // very likely
int effFlagsIsSynth = 1 << 8; // currently unused
const int effFlagsHasEditor = 1;
const int effFlagsCanReplacing = 1 << 4; // very likely
const int effFlagsIsSynth = 1 << 8; // currently unused
int effOpen = 0;
int effClose = 1; // currently unused
int effSetProgram = 2; // currently unused
int effGetProgram = 3; // currently unused
int effGetProgramName = 5; // currently unused
int effGetParamName = 8; // currently unused
int effSetSampleRate = 10;
int effSetBlockSize = 11;
int effMainsChanged = 12;
int effEditGetRect = 13;
int effEditOpen = 14;
int effEditClose = 15;
int effEditIdle = 19;
int effEditTop = 20;
int effProcessEvents = 25;
int effGetEffectName = 45;
int effGetParameterProperties = 47; // missing
int effGetVendorString = 47;
int effGetProductString = 48;
int effGetVendorVersion = 49;
int effCanDo = 51; // currently unused
int effGetVstVersion = 58; // currently unused
const int effOpen = 0;
const int effClose = 1; // currently unused
const int effSetProgram = 2; // currently unused
const int effGetProgram = 3; // currently unused
const int effGetProgramName = 5; // currently unused
const int effGetParamName = 8; // currently unused
const int effSetSampleRate = 10;
const int effSetBlockSize = 11;
const int effMainsChanged = 12;
const int effEditGetRect = 13;
const int effEditOpen = 14;
const int effEditClose = 15;
const int effEditIdle = 19;
const int effEditTop = 20;
const int effProcessEvents = 25;
const int effGetEffectName = 45;
const int effGetParameterProperties = 47; // missing
const int effGetVendorString = 47;
const int effGetProductString = 48;
const int effGetVendorVersion = 49;
const int effCanDo = 51; // currently unused
const int effGetVstVersion = 58; // currently unused
int kEffectMagic =
#ifdef WORDS_BIGENDIAN
0x50747356; // "VstP"
#else
0x56737450; // "PtsV"
#endif
int kVstLangEnglish = 1;
int kVstMidiType = 1;
int kVstParameterUsesFloatStep = 1 << 2;
int kVstTempoValid = 1 << 10;
int kVstTransportPlaying = 1 << 1;
const int kEffectMagic = CCONST( 'V', 's', 't', 'P' );
const int kVstLangEnglish = 1;
const int kVstMidiType = 1;
const int kVstParameterUsesFloatStep = 1 << 2;
const int kVstTempoValid = 1 << 10;
const int kVstTransportPlaying = 1 << 1;
class remoteVstPlugin;
@@ -232,7 +231,7 @@ public:
// Zeroes 44-47
char empty5[4];
// Id 48-4b
char unused_id[4];
int32_t uniqueID;
// Don't know 4c-4f
char unknown1[4];
// processReplacing 50-53

103
include/atomic_int.h Executable file
View File

@@ -0,0 +1,103 @@
/*
* atomic_int.h - fallback AtomicInt class when Qt is too old
*
* Copyright (c) 2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _ATOMIC_INT_H
#define _ATOMIC_INT_H
#include <QtCore/QMutex>
#if QT_VERSION >= 0x040400
typedef QAtomicInt AtomicInt;
#else
// implement our own (slow) QAtomicInt class when on old Qt
class AtomicInt
{
public:
inline AtomicInt( int _value = 0 ) :
m_value( _value ),
m_lock()
{
}
inline AtomicInt( const AtomicInt & _copy ) :
m_value( _copy.m_value ),
m_lock()
{
}
inline int fetchAndStoreOrdered( int _newVal )
{
m_lock.lock();
const int oldVal = m_value;
m_value = _newVal;
m_lock.unlock();
return oldVal;
}
inline int fetchAndAddOrdered( int _add )
{
m_lock.lock();
const int oldVal = m_value;
m_value += _add;
m_lock.unlock();
return oldVal;
}
inline AtomicInt & operator=( const AtomicInt & _copy )
{
m_lock.lock();
m_value = _copy.m_value;
m_lock.unlock();
return *this;
}
inline AtomicInt & operator=( int _value )
{
m_lock.lock();
m_value = _value;
m_lock.unlock();
return *this;
}
inline operator int() const
{
return m_value;
}
private:
volatile int m_value;
QMutex m_lock;
} ;
#endif
#endif

View File

@@ -1,7 +1,7 @@
/*
* audio_port.h - base-class for objects providing sound at a port
*
* Copyright (c) 2005-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -136,7 +136,7 @@ private:
friend class mixer;
friend class mixerWorkerThread;
friend class MixerWorkerThread;
} ;

View File

@@ -119,7 +119,8 @@ public:
template<class T>
inline T value( int _frameOffset = 0 ) const
{
if( unlikely( m_controllerConnection != NULL ) )
if( unlikely( m_hasLinkedModels ||
m_controllerConnection != NULL ) )
{
return castValue<T>( controllerValue( _frameOffset ) );
}
@@ -243,8 +244,10 @@ private:
// standard)
float m_oldValue;
bool m_journalEntryReady;
int m_setValueDepth;
autoModelVector m_linkedModels;
bool m_hasLinkedModels;
controllerConnection * m_controllerConnection;

View File

@@ -123,44 +123,4 @@ private:
} ;
class automationPatternView : public trackContentObjectView
{
Q_OBJECT
public:
automationPatternView( automationPattern * _pat, trackView * _parent );
virtual ~automationPatternView();
public slots:
virtual void update( void );
protected slots:
void resetName( void );
void changeName( void );
void disconnectObject( QAction * _a );
protected:
virtual void constructContextMenu( QMenu * );
virtual void mouseDoubleClickEvent( QMouseEvent * _me );
virtual void paintEvent( QPaintEvent * _pe );
virtual void resizeEvent( QResizeEvent * _re )
{
m_needsUpdate = true;
trackContentObjectView::resizeEvent( _re );
}
virtual void dragEnterEvent( QDragEnterEvent * _dee );
virtual void dropEvent( QDropEvent * _de );
private:
automationPattern * m_pat;
QPixmap m_paintPixmap;
bool m_needsUpdate;
} ;
#endif

View File

@@ -0,0 +1,73 @@
/*
* automation_pattern_view.h - declaration of class automationPatternView
*
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _AUTOMATION_PATTERN_VIEW_H
#define _AUTOMATION_PATTERN_VIEW_H
#include "track.h"
class automationPattern;
class automationPatternView : public trackContentObjectView
{
Q_OBJECT
public:
automationPatternView( automationPattern * _pat, trackView * _parent );
virtual ~automationPatternView();
public slots:
virtual void update( void );
protected slots:
void resetName( void );
void changeName( void );
void disconnectObject( QAction * _a );
protected:
virtual void constructContextMenu( QMenu * );
virtual void mouseDoubleClickEvent( QMouseEvent * _me );
virtual void paintEvent( QPaintEvent * _pe );
virtual void resizeEvent( QResizeEvent * _re )
{
m_needsUpdate = true;
trackContentObjectView::resizeEvent( _re );
}
virtual void dragEnterEvent( QDragEnterEvent * _dee );
virtual void dropEvent( QDropEvent * _de );
private:
automationPattern * m_pat;
QPixmap m_paintPixmap;
bool m_needsUpdate;
} ;
#endif

View File

@@ -45,7 +45,7 @@ template<ch_cnt_t CHANNELS/* = DEFAULT_CHANNELS*/>
class basicFilters
{
public:
enum filterTypes
enum FilterTypes
{
LowPass,
HiPass,
@@ -54,7 +54,7 @@ public:
Notch,
AllPass,
Moog,
NumOfFilters
NumFilters
} ;
static inline float minFreq( void )
@@ -69,14 +69,14 @@ public:
inline void setFilterType( const int _idx )
{
m_doubleFilter = _idx >= NumOfFilters;
m_doubleFilter = _idx >= NumFilters;
if( !m_doubleFilter )
{
m_type = static_cast<filterTypes>( _idx );
m_type = static_cast<FilterTypes>( _idx );
return;
}
m_type = static_cast<filterTypes>( LowPass + _idx -
NumOfFilters );
m_type = static_cast<FilterTypes>( LowPass + _idx -
NumFilters );
if( m_subFilter == NULL )
{
m_subFilter = new basicFilters<CHANNELS>(
@@ -289,7 +289,7 @@ private:
// in/out history for moog-filter
frame m_y1, m_y2, m_y3, m_y4, m_oldx, m_oldy1, m_oldy2, m_oldy3;
filterTypes m_type;
FilterTypes m_type;
bool m_doubleFilter;
float m_sampleRate;

View File

@@ -52,7 +52,7 @@ public:
tact lengthOfBB( int _bb );
inline tact lengthOfCurrentBB( void )
{
return( lengthOfBB( currentBB() ) );
return lengthOfBB( currentBB() );
}
int numOfBBs( void ) const;
void removeBB( int _bb );

View File

@@ -34,7 +34,7 @@
class comboBox : public QWidget, public intModelView
class EXPORT comboBox : public QWidget, public intModelView
{
Q_OBJECT
public:

View File

@@ -35,7 +35,7 @@
class pixmapLoader;
class comboBoxModel : public intModel
class EXPORT comboBoxModel : public intModel
{
Q_OBJECT
public:

View File

@@ -34,7 +34,7 @@
class effect;
class effectChain : public model, public serializingObject
class EXPORT effectChain : public model, public serializingObject
{
Q_OBJECT
public:
@@ -46,7 +46,7 @@ public:
inline virtual QString nodeName( void ) const
{
return( "fxchain" );
return "fxchain";
}
void appendEffect( effect * _effect );
@@ -59,6 +59,11 @@ public:
void clear( void );
void setEnabled( bool _on )
{
m_enabledModel.setValue( _on );
}
private:
typedef QVector<effect *> effectList;

View File

@@ -1,7 +1,7 @@
/*
* fade_button.h - declaration of class fadeButton
*
* Copyright (c) 2005-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -26,6 +26,7 @@
#ifndef _FADE_BUTTON_H
#define _FADE_BUTTON_H
#include <QtCore/QTime>
#include <QtGui/QAbstractButton>
#include <QtGui/QColor>
@@ -42,7 +43,6 @@ public:
public slots:
void activate( void );
void reset( void );
protected:
@@ -51,7 +51,7 @@ protected:
private:
float m_state;
QTime m_stateTimer;
QColor m_normalColor;
QColor m_activatedColor;

View File

@@ -187,7 +187,8 @@ public:
NotSupported,
LoadAsProject,
LoadAsPreset,
LoadByPlugin
LoadByPlugin,
ImportAsProject
} ;

View File

@@ -75,7 +75,16 @@ public:
virtual QString nodeName( void ) const
{
return( "fxmixer" );
return "fxmixer";
}
fxChannel * getEffectChannel( int _ch )
{
if( _ch >= 0 && _ch <= NumFxChannels )
{
return m_fxChannels[_ch];
}
return NULL;
}

View File

@@ -39,7 +39,7 @@ class groupBox : public QWidget, public boolModelView
{
Q_OBJECT
public:
groupBox( const QString & _caption, QWidget * _parent );
groupBox( const QString & _caption, QWidget * _parent = NULL );
virtual ~groupBox();
virtual void modelChanged( void );

View File

@@ -2,7 +2,7 @@
* instrument_track.h - declaration of class instrumentTrack, a track + window
* which holds an instrument-plugin
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -88,12 +88,12 @@ public:
QString instrumentName( void ) const;
inline const instrument * getInstrument( void ) const
{
return( m_instrument );
return m_instrument;
}
inline instrument * getInstrument( void )
{
return( m_instrument );
return m_instrument;
}
void deleteNotePluginData( notePlayHandle * _n );
@@ -108,7 +108,7 @@ public:
// translate pitch to midi-pitch [0,16383]
inline int midiPitch( void ) const
{
return( (int)( ( m_pitchModel.value()+100 ) * 81.92 ) );
return (int)( ( m_pitchModel.value()+100 ) * 81.92 );
}
// play everything in given frame-range - creates note-play-handles
@@ -135,58 +135,65 @@ public:
inline audioPort * getAudioPort( void )
{
return( &m_audioPort );
return &m_audioPort;
}
inline midiPort * getMidiPort( void )
{
return( &m_midiPort );
return &m_midiPort;
}
intModel * baseNoteModel( void )
{
return( &m_baseNoteModel );
return &m_baseNoteModel;
}
piano * getPiano( void )
{
return( &m_piano );
return &m_piano;
}
bool arpeggiatorEnabled( void ) const
{
return( m_arpeggiator.m_arpEnabledModel.value() );
return m_arpeggiator.m_arpEnabledModel.value();
}
// simple helper for removing midiport-XML-node when loading presets
static void removeMidiPortNode( multimediaProject & _mmp );
floatModel & pitchModel()
floatModel * pitchModel( void )
{
return m_pitchModel;
return &m_pitchModel;
}
floatModel & volumeModel()
floatModel * volumeModel( void )
{
return m_volumeModel;
return &m_volumeModel;
}
floatModel & panningModel()
floatModel * panningModel( void )
{
return m_panningModel;
return &m_panningModel;
}
intModel * effectChannelModel( void )
{
return &m_effectChannelModel;
}
signals:
void instrumentChanged( void );
void newNote( void );
void noteDone( const note & _n );
void noteOn( const note & _n );
void noteOff( const note & _n );
void nameChanged( void );
protected:
virtual QString nodeName( void ) const
{
return( "instrumenttrack" );
return "instrumenttrack";
}
// invalidates all note-play-handles linked to this instrument
void invalidateAllMyNPH( void );
@@ -245,18 +252,18 @@ public:
instrumentTrack * model( void )
{
return( castModel<instrumentTrack>() );
return castModel<instrumentTrack>();
}
const instrumentTrack * model( void ) const
{
return( castModel<instrumentTrack>() );
return castModel<instrumentTrack>();
}
QMenu * midiMenu( void )
{
return( m_midiMenu );
return m_midiMenu;
}
void freeInstrumentTrackWindow( void );
@@ -314,17 +321,17 @@ public:
// parent for all internal tab-widgets
tabWidget * tabWidgetParent( void )
{
return( m_tabWidget );
return m_tabWidget;
}
instrumentTrack * model( void )
{
return( castModel<instrumentTrack>() );
return castModel<instrumentTrack>();
}
const instrumentTrack * model( void ) const
{
return( castModel<instrumentTrack>() );
return castModel<instrumentTrack>();
}
void setInstrumentTrackView( instrumentTrackView * _tv )
@@ -332,6 +339,8 @@ public:
m_itv = _tv;
}
static void dragEnterEventGeneric( QDragEnterEvent * _dee );
virtual void dragEnterEvent( QDragEnterEvent * _dee );
virtual void dropEvent( QDropEvent * _de );

View File

@@ -26,8 +26,8 @@
#ifndef _MIDI_H
#define _MIDI_H
#include "lmms_basics.h"
#include "panning_constants.h"
#include <cstdlib>
@@ -63,6 +63,7 @@ enum MidiEventTypes
enum MidiMetaEvents
{
MidiMetaInvalid = 0x00,
MidiCopyright = 0x02,
MidiTrackName = 0x03,
MidiInstName = 0x04,
@@ -75,7 +76,9 @@ enum MidiMetaEvents
MidiSMPTEOffset = 0x54,
MidiTimeSignature = 0x58,
MidiKeySignature = 0x59,
MidiSequencerEvent = 0x7f
MidiSequencerEvent = 0x7f,
MidiMetaCustom = 0x80,
MidiNotePanning
} ;
@@ -84,6 +87,9 @@ const int MidiControllerCount = 128;
const int MidiProgramCount = 128;
const int MidiMaxVelocity = 127;
const int MidiMaxPanning = 127;
const int MidiMinPanning = -128;
struct midiEvent
{
@@ -92,6 +98,7 @@ struct midiEvent
Sint16 _param1 = 0,
Sint16 _param2 = 0 ) :
m_type( _type ),
m_metaEvent( MidiMetaInvalid ),
m_channel( _channel ),
m_sysExData( NULL )
{
@@ -101,6 +108,7 @@ struct midiEvent
midiEvent( MidiEventTypes _type, const char * _sysex_data,
int _data_len ) :
m_type( _type ),
m_metaEvent( MidiMetaInvalid ),
m_channel( 0 ),
m_sysExData( _sysex_data )
{
@@ -109,6 +117,7 @@ struct midiEvent
midiEvent( const midiEvent & _copy ) :
m_type( _copy.m_type ),
m_metaEvent( _copy.m_metaEvent ),
m_channel( _copy.m_channel ),
m_data( _copy.m_data ),
m_sysExData( _copy.m_sysExData )
@@ -139,14 +148,28 @@ struct midiEvent
{
return m_data.m_param[1];
}
inline Sint16 midiPanning( void ) const
{
return m_data.m_param[1];
}
inline volume getVolume( void ) const
{
return (volume)( velocity() * 100 / MidiMaxVelocity );
}
inline panning getPanning( void ) const
{
return (panning) ( PanningLeft +
( (float)( midiPanning() - MidiMinPanning ) ) /
( (float)( MidiMaxPanning - MidiMinPanning ) ) *
( (float)( PanningRight - PanningLeft ) ) );
}
MidiEventTypes m_type; // MIDI event type
MidiMetaEvents m_metaEvent; // Meta event (mostly unused)
Sint8 m_channel; // MIDI channel
union
{

View File

@@ -1,7 +1,7 @@
/*
* mixer.h - audio-device-independent mixer for LMMS
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -40,9 +40,9 @@
#include <QtCore/QMutex>
#include <QtCore/QSemaphore>
#include <QtCore/QThread>
#include <QtCore/QVector>
#include <QtCore/QWaitCondition>
#include "lmms_basics.h"
@@ -73,7 +73,7 @@ const Octaves BaseOctave = DefaultOctave;
#include "play_handle.h"
class mixerWorkerThread;
class MixerWorkerThread;
class EXPORT mixer : public QObject
@@ -438,10 +438,9 @@ private:
bool m_newBuffer[SURROUND_CHANNELS];
int m_cpuLoad;
QVector<mixerWorkerThread *> m_workers;
QVector<MixerWorkerThread *> m_workers;
int m_numWorkers;
QSemaphore m_queueReadySem;
QSemaphore m_workersDoneSem;
QWaitCondition m_queueReadyWaitCond;
playHandleVector m_playHandles;
@@ -469,7 +468,7 @@ private:
friend class engine;
friend class mixerWorkerThread;
friend class MixerWorkerThread;
} ;

View File

@@ -2,7 +2,7 @@
* note.h - declaration of class note which contains all informations about a
* note + definitions of several constants and enums
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -90,7 +90,21 @@ public:
detuningHelper * _detuning = NULL );
note( const note & _note );
virtual ~note();
// used by GUI
inline void setSelected( const bool _selected ){ m_selected = _selected; }
inline void setOldKey( const int _oldKey ){ m_oldKey = _oldKey; }
inline void setOldPos( const midiTime & _oldPos ){ m_oldPos = _oldPos; }
inline void setOldLength( const midiTime & _oldLength )
{
m_oldLength = _oldLength;
}
inline void setIsPlaying( const bool _isPlaying )
{
m_isPlaying = _isPlaying;
}
void setLength( const midiTime & _length );
void setPos( const midiTime & _pos );
void setKey( const int _key );
@@ -99,6 +113,38 @@ public:
void quantizeLength( const int _q_grid );
void quantizePos( const int _q_grid );
static inline bool lessThan(note * &lhs, note * &rhs)
{
// function to compare two notes - must be called explictly when
// using qSort
return (bool) ((int) ( *lhs ).pos() < (int) ( *rhs ).pos());
}
inline bool selected( void ) const
{
return m_selected;
}
inline int oldKey( void ) const
{
return m_oldKey;
}
inline midiTime oldPos( void ) const
{
return m_oldPos;
}
inline midiTime oldLength( void ) const
{
return m_oldLength;
}
inline bool isPlaying( void ) const
{
return m_isPlaying;
}
inline midiTime endPos( void ) const
{
const int l = length();
@@ -107,12 +153,12 @@ public:
inline const midiTime & length( void ) const
{
return( m_length );
return m_length;
}
inline const midiTime & pos( void ) const
{
return( m_pos );
return m_pos;
}
inline midiTime pos( midiTime _base_pos ) const
@@ -123,34 +169,34 @@ public:
inline int key( void ) const
{
return( m_key );
return m_key;
}
inline volume getVolume( void ) const
{
return( m_volume );
return m_volume;
}
inline panning getPanning( void ) const
{
return( m_panning );
return m_panning;
}
static QString classNodeName( void )
{
return( "note" );
return "note";
}
inline virtual QString nodeName( void ) const
{
return( classNodeName() );
return classNodeName();
}
static midiTime quantized( const midiTime & _m, const int _q_grid );
detuningHelper * detuning( void ) const
{
return( m_detuning );
return m_detuning;
}
void editDetuningPattern( void );
@@ -177,7 +223,14 @@ private:
ChangePosition
} ;*/
// for piano roll editing
bool m_selected;
int m_oldKey;
midiTime m_oldPos;
midiTime m_oldLength;
bool m_isPlaying;
int m_key;
volume m_volume;
panning m_panning;

View File

@@ -1,5 +1,5 @@
/*
* panning.h - declaration of some constants and types, concerning the
* panning.h - declaration of some types, concerning the
* panning of a note
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
@@ -29,11 +29,8 @@
#include "lmms_basics.h"
#include "volume.h"
#include "templates.h"
const panning PanningRight = ( 0 + 100 );
const panning PanningLeft = - PanningRight;
const panning PanningCenter = 0;
const panning DefaultPanning = PanningCenter;
#include "panning_constants.h"
#include "midi.h"
inline stereoVolumeVector panningToVolumeVector( panning _p,
float _scale = 1.0f )
@@ -44,4 +41,12 @@ inline stereoVolumeVector panningToVolumeVector( panning _p,
return v;
}
inline Sint16 panningToMidi( panning _p )
{
return MidiMinPanning +
( (float)( _p - PanningLeft ) ) /
( (float)( PanningRight - PanningLeft ) ) *
( (float)( MidiMaxPanning - MidiMinPanning ) );
}
#endif

View File

@@ -0,0 +1,34 @@
/*
* panning_constants.h - declaration of some constants, concerning the
* panning of a note
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _PANNING_CONSTANTS_H
#define _PANNING_CONSTANTS_H
const panning PanningRight = ( 0 + 100 );
const panning PanningLeft = - PanningRight;
const panning PanningCenter = 0;
const panning DefaultPanning = PanningCenter;
#endif

View File

@@ -2,7 +2,7 @@
* pattern.h - declaration of class pattern, which contains all informations
* about a pattern
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -68,24 +68,27 @@ public:
virtual midiTime length( void ) const;
midiTime beatPatternLength( void ) const;
note * addNote( const note & _new_note, const bool _quant_pos = TRUE );
// note management
note * addNote( const note & _new_note, const bool _quant_pos = true );
void removeNote( const note * _note_to_del );
note * rearrangeNote( const note * _note_to_proc,
const bool _quant_pos = TRUE );
const bool _quant_pos = true );
void rearrangeAllNotes( void );
void clearNotes( void );
inline const noteVector & notes( void )
{
return( m_notes );
return m_notes;
}
void setStep( int _step, bool _enabled );
// pattern-type stuff
inline PatternTypes type( void ) const
{
return( m_patternType );
return m_patternType;
}
void setType( PatternTypes _new_pattern_type );
void checkType( void );
@@ -94,17 +97,17 @@ public:
// functions which are part of freezing-feature
inline bool freezing( void ) const
{
return( m_freezing );
return m_freezing;
}
inline bool frozen( void ) const
{
return( m_frozenPattern != NULL );
return m_frozenPattern != NULL;
}
sampleBuffer * getFrozenPattern( void )
{
return( m_frozenPattern );
return m_frozenPattern;
}
// settings-management
@@ -112,12 +115,12 @@ public:
virtual void loadSettings( const QDomElement & _this );
inline virtual QString nodeName( void ) const
{
return( "pattern" );
return "pattern";
}
inline instrumentTrack * getInstrumentTrack( void )
{
return( m_instrumentTrack );
return m_instrumentTrack;
}
bool empty( void );
@@ -136,13 +139,12 @@ protected:
void ensureBeatNotes( void );
void updateBBTrack( void );
void abortFreeze( void );
protected slots:
void clear( void );
void freeze( void );
void unfreeze( void );
void abortFreeze( void );
void changeTimeSignature( void );
@@ -197,7 +199,7 @@ protected:
virtual void paintEvent( QPaintEvent * _pe );
virtual void resizeEvent( QResizeEvent * _re )
{
m_needsUpdate = TRUE;
m_needsUpdate = true;
trackContentObjectView::resizeEvent( _re );
}
virtual void wheelEvent( QWheelEvent * _we );

View File

@@ -2,7 +2,8 @@
* piano_roll.h - declaration of class pianoRoll which is a window where you
* can set and edit notes in an easy way
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2008 Andrew Kelley <superjoe30/at/gmail/dot/com>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -33,11 +34,15 @@
#include "serializing_object.h"
#include "note.h"
#include "lmms_basics.h"
#include "song.h"
class QPainter;
class QPixmap;
class QScrollBar;
class QString;
class QMenu;
class QSignalMapper;
class comboBox;
class notePlayHandle;
@@ -52,21 +57,28 @@ class pianoRoll : public QWidget, public serializingObject
public:
void setCurrentPattern( pattern * _new_pattern );
inline void stopRecording( void )
{
m_recording = false;
}
inline bool isRecording( void ) const
{
return( m_recording );
return m_recording;
}
inline const pattern * currentPattern( void ) const
{
return( m_pattern );
return m_pattern;
}
inline bool validPattern( void ) const
{
return( m_pattern != NULL );
return m_pattern != NULL;
}
song::PlayModes desiredPlayModeForAccompany( void ) const;
int quantization( void ) const;
@@ -75,7 +87,7 @@ public:
inline virtual QString nodeName( void ) const
{
return( "pianoroll" );
return "pianoroll";
}
@@ -85,20 +97,16 @@ protected:
virtual void keyReleaseEvent( QKeyEvent * _ke );
virtual void leaveEvent( QEvent * _e );
virtual void mousePressEvent( QMouseEvent * _me );
virtual void mouseDoubleClickEvent( QMouseEvent * _me );
virtual void mouseReleaseEvent( QMouseEvent * _me );
virtual void mouseMoveEvent( QMouseEvent * _me );
virtual void paintEvent( QPaintEvent * _pe );
virtual void resizeEvent( QResizeEvent * _re );
virtual void wheelEvent( QWheelEvent * _we );
#ifdef LMMS_BUILD_LINUX
virtual bool x11Event( XEvent * _xe );
#endif
int getKey( int _y ) const;
static inline void drawNoteRect( QPainter & _p, int _x, int _y,
int _width,
const bool _is_selected,
const bool _is_step_note );
int _width, note * _n );
void removeSelection( void );
void selectAll( void );
void getSelectedNotes( noteVector & _selected_notes );
@@ -110,7 +118,8 @@ protected slots:
void recordAccompany( void );
void stop( void );
void recordNote( const note & _n );
void startRecordNote( const note & _n );
void finishRecordNote( const note & _n );
void horScrolled( int _new_pos );
void verScrolled( int _new_pos );
@@ -118,7 +127,7 @@ protected slots:
void drawButtonToggled( void );
void eraseButtonToggled( void );
void selectButtonToggled( void );
void moveButtonToggled( void );
void detuneButtonToggled( void );
void copySelectedNotes( void );
void cutSelectedNotes( void );
@@ -126,9 +135,12 @@ protected slots:
void deleteSelectedNotes( void );
void updatePosition( const midiTime & _t );
void updatePositionAccompany( const midiTime & _t );
void zoomingChanged( void );
void quantizeChanged( void );
void changeNoteEditMode( int i );
private:
@@ -138,9 +150,8 @@ private:
ModeDraw,
ModeErase,
ModeSelect,
ModeMove,
ModeOpen
} ;
};
enum actions
{
@@ -148,26 +159,56 @@ private:
ActionMoveNote,
ActionResizeNote,
ActionSelectNotes,
ActionMoveSelection,
ActionChangeNoteVolume,
ActionChangeNotePanning
} ;
ActionChangeNoteProperty,
ActionResizeNoteEditArea
};
enum noteEditMode
{
NoteEditVolume,
NoteEditPanning,
NoteEditCount // make sure this one is always last
};
enum pianoRollKeyTypes
{
PR_WHITE_KEY_SMALL,
PR_WHITE_KEY_BIG,
PR_BLACK_KEY
} ;
};
QVector<QString> m_nemStr; // gui names of each edit mode
QMenu * m_noteEditMenu; // when you right click below the key area
QSignalMapper * m_signalMapper; // to keep track of edit mode events
pianoRoll( void );
pianoRoll( const pianoRoll & );
virtual ~pianoRoll();
void autoScroll( const midiTime & _t );
midiTime newNoteLen( void ) const;
void shiftPos(int amount);
void shiftSemiTone(int amount);
bool isSelection() const;
int selectionCount() const;
void testPlayNote( note * n );
void testPlayKey( int _key, int _vol, int _pan );
void pauseTestNotes( bool _pause = true );
inline int noteEditTop() const;
inline int keyAreaBottom() const;
inline int noteEditBottom() const;
inline int keyAreaTop() const;
inline int noteEditRight() const;
inline int noteEditLeft() const;
void dragNotes( int x, int y, bool alt );
static const int cm_scrollAmtHoriz = 10;
static const int cm_scrollAmtVert = 1;
static QPixmap * s_whiteKeyBigPm;
static QPixmap * s_whiteKeySmallPm;
static QPixmap * s_blackKeyPm;
@@ -190,8 +231,8 @@ private:
toolButton * m_drawButton;
toolButton * m_eraseButton;
toolButton * m_selectButton;
toolButton * m_moveButton;
toolButton * m_detuneButton;
toolButton * m_cutButton;
toolButton * m_copyButton;
toolButton * m_pasteButton;
@@ -212,33 +253,55 @@ private:
midiTime m_currentPosition;
bool m_recording;
QList<note> m_recordingNotes;
note * m_currentNote;
actions m_action;
noteEditMode m_noteEditMode;
Uint32 m_selectStartTick;
int m_selectedTick;
int m_selectStartKey;
int m_selectedKeys;
// boundary box around all selected notes when dragging
int m_moveBoundaryLeft;
int m_moveBoundaryTop;
int m_moveBoundaryRight;
int m_moveBoundaryBottom;
// remember where the scrolling started when dragging so that
// we can handle dragging while scrolling with arrow keys
int m_mouseDownKey;
int m_mouseDownTick;
// remember the last x and y of a mouse movement
int m_lastMouseX;
int m_lastMouseY;
// x,y of when the user starts a drag
int m_moveStartX;
int m_moveStartY;
int m_moveStartKey;
int m_moveStartTick;
int m_moveXOffset;
int m_oldNotesEditHeight;
int m_notesEditHeight;
int m_ppt;
int m_totalKeysToScroll;
// remember these values to use them
// for the next note that is set
midiTime m_lenOfNewNotes;
volume m_lastNoteVolume;
panning m_lastNotePanning;
int m_startKey; // first key when drawing
int m_lastKey;
noteVector m_selNotesForMove;
editModes m_editMode;
editModes m_ctrlMode; // mode they were in before they hit ctrl
bool m_mouseDownLeft; //true if left click is being held down
bool m_mouseDownRight; //true if right click is being held down
timeLine * m_timeLine;
bool m_scrollBack;
@@ -249,8 +312,10 @@ private:
bool mouseOverNote( void );
note * noteUnderMouse( void );
noteVector::const_iterator noteIteratorUnderMouse( void );
// turn a selection rectangle into selected notes
void computeSelectedNotes( bool shift );
void clearSelectedNotes( void );
friend class engine;

View File

@@ -47,7 +47,7 @@ public:
inline bool operator<( const projectVersion & _v1, const char * _str )
{
return( projectVersion::compare( _v1, projectVersion( _str ) ) < 0 );
return projectVersion::compare( _v1, projectVersion( _str ) ) < 0;
}

View File

@@ -483,6 +483,7 @@ enum RemoteMessageIDs
IdLoadSettingsFromString,
IdLoadSettingsFromFile,
IdLoadPresetFromFile,
IdDebugMessage,
IdUserBase = 64
} ;
@@ -818,6 +819,11 @@ public:
return m_outputCount;
}
void debugMessage( const std::string & _s )
{
sendMessage( message( IdDebugMessage ).addString( _s ) );
}
private:
void setShmKey( key_t _key, int _size );

View File

@@ -1,7 +1,7 @@
/*
* sample_buffer.h - container-class sampleBuffer
*
* Copyright (c) 2005-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -57,7 +57,6 @@ public:
f_cnt_t m_frameIndex;
const bool m_varyingPitch;
SRC_STATE * m_resamplingData;
int m_eof;
friend class sampleBuffer;
@@ -86,17 +85,17 @@ public:
inline const QString & audioFile( void ) const
{
return( m_audioFile );
return m_audioFile;
}
inline f_cnt_t startFrame( void ) const
{
return( m_startFrame );
return m_startFrame;
}
inline f_cnt_t endFrame( void ) const
{
return( m_endFrame );
return m_endFrame;
}
void setLoopStartFrame( f_cnt_t _start )
@@ -115,22 +114,22 @@ public:
inline f_cnt_t frames( void ) const
{
return( m_frames );
return m_frames;
}
inline float amplification( void ) const
{
return( m_amplification );
return m_amplification;
}
inline bool reversed( void ) const
{
return( m_reversed );
return m_reversed;
}
inline float frequency( void ) const
{
return( m_frequency );
return m_frequency;
}
inline void setFrequency( float _freq )
@@ -149,7 +148,7 @@ public:
inline const sampleFrame * data( void ) const
{
return( m_data );
return m_data;
}
QString openAudioFile( void ) const;
@@ -166,8 +165,8 @@ public:
const sample_rate_t _src_sr,
const sample_rate_t _dst_sr )
{
return( resample( _buf->m_data, _buf->m_frames, _src_sr,
_dst_sr ) );
return resample( _buf->m_data, _buf->m_frames, _src_sr,
_dst_sr );
}
void normalizeSampleRate( const sample_rate_t _src_sr,
@@ -182,7 +181,7 @@ public:
// sample_t waveSample = linearInterpolate( m_data[f1][0],
// m_data[f2][0],
// fraction( frame ) );
// return( waveSample );
// return waveSample;
// Fast implementation
const float frame = _sample * m_frames;
@@ -191,7 +190,7 @@ public:
{
f1 += m_frames;
}
return( m_data[f1][0] );
return m_data[f1][0];
}
static QString tryToMakeRelative( const QString & _file );

View File

@@ -106,6 +106,8 @@ private:
toolButton * m_stopButton;
lcdSpinBox * m_tempoSpinBox;
timeLine * m_timeLine;
meterDialog * m_timeSigDisplay;
automatableSlider * m_masterVolumeSlider;
automatableSlider * m_masterPitchSlider;

View File

@@ -284,6 +284,8 @@ private:
int m_pixelsPerTact;
QPixmap m_background;
} ;

View File

@@ -54,7 +54,7 @@ public:
virtual automationPattern * tempoAutomationPattern( void )
{
return( NULL );
return NULL;
}
int countTracks( track::TrackTypes _tt = track::NumTrackTypes ) const;
@@ -69,14 +69,14 @@ public:
const trackList & tracks( void ) const
{
return( m_tracks );
return m_tracks;
}
bool isEmpty( void ) const;
static const QString classNodeName( void )
{
return( "trackcontainer" );
return "trackcontainer";
}
@@ -107,12 +107,12 @@ public:
virtual QString nodeName( void ) const
{
return( "dummytrackcontainer" );
return "dummytrackcontainer";
}
instrumentTrack * dummyInstrumentTrack( void )
{
return( m_dummyInstrumentTrack );
return m_dummyInstrumentTrack;
}

View File

@@ -2,4 +2,4 @@ INCLUDE(BuildPlugin)
INCLUDE_DIRECTORIES(unrtf)
BUILD_PLUGIN(flpimport flp_import.cpp flp_import.h)
BUILD_PLUGIN(flpimport flp_import.cpp unrtf.cpp flp_import.h)

File diff suppressed because it is too large Load Diff

View File

@@ -34,134 +34,9 @@
#include "note.h"
enum flpEvents
{
// BYTE EVENTS
FLP_Byte = 0,
FLP_Enabled = 0,
FLP_NoteOn = 1, //+pos (byte)
FLP_Vol = 2,
FLP_Pan = 3,
FLP_MIDIChan = 4,
FLP_MIDINote = 5,
FLP_MIDIPatch = 6,
FLP_MIDIBank = 7,
FLP_LoopActive = 9,
FLP_ShowInfo = 10,
FLP_Shuffle = 11,
FLP_MainVol = 12,
FLP_Stretch = 13, // old byte version
FLP_Pitchable = 14,
FLP_Zipped = 15,
FLP_Delay_Flags = 16,
FLP_PatLength = 17,
FLP_BlockLength = 18,
FLP_UseLoopPoints = 19,
FLP_LoopType = 20,
FLP_ChanType = 21,
FLP_MixSliceNum = 22,
// WORD EVENTS
FLP_Word = 64,
FLP_NewChan = FLP_Word,
FLP_NewPat = FLP_Word + 1, //+PatNum (word)
FLP_Tempo = FLP_Word + 2,
FLP_CurrentPatNum = FLP_Word + 3,
FLP_PatData = FLP_Word + 4,
FLP_FX = FLP_Word + 5,
FLP_Fade_Stereo = FLP_Word + 6,
FLP_CutOff = FLP_Word + 7,
FLP_DotVol = FLP_Word + 8,
FLP_DotPan = FLP_Word + 9,
FLP_PreAmp = FLP_Word + 10,
FLP_Decay = FLP_Word + 11,
FLP_Attack = FLP_Word + 12,
FLP_DotNote = FLP_Word + 13,
FLP_DotPitch = FLP_Word + 14,
FLP_DotMix = FLP_Word + 15,
FLP_MainPitch = FLP_Word + 16,
FLP_RandChan = FLP_Word + 17,
FLP_MixChan = FLP_Word + 18,
FLP_Resonance = FLP_Word + 19,
FLP_LoopBar = FLP_Word + 20,
FLP_StDel = FLP_Word + 21,
FLP_FX3 = FLP_Word + 22,
FLP_DotReso = FLP_Word + 23,
FLP_DotCutOff = FLP_Word + 24,
FLP_ShiftDelay = FLP_Word + 25,
FLP_LoopEndBar = FLP_Word + 26,
FLP_Dot = FLP_Word + 27,
FLP_DotShift = FLP_Word + 28,
// DWORD EVENTS
FLP_Int = 128,
FLP_Color = FLP_Int,
FLP_PlayListItem = FLP_Int + 1, //+Pos (word) +PatNum (word)
FLP_Echo = FLP_Int + 2,
FLP_FXSine = FLP_Int + 3,
FLP_CutCutBy = FLP_Int + 4,
FLP_WindowH = FLP_Int + 5,
FLP_MiddleNote = FLP_Int + 7,
FLP_Reserved = FLP_Int + 8, // may contain an invalid version info
FLP_MainResoCutOff = FLP_Int + 9,
FLP_DelayReso = FLP_Int + 10,
FLP_Reverb = FLP_Int + 11,
FLP_IntStretch = FLP_Int + 12,
FLP_SSNote = FLP_Int + 13,
FLP_FineTune = FLP_Int + 14,
// TEXT EVENTS
FLP_Undef = 192, //+Size (var length)
FLP_Text = FLP_Undef, //+Size (var length)+Text
// (Null Term. String)
FLP_Text_ChanName = FLP_Text, // name for the current channel
FLP_Text_PatName = FLP_Text + 1, // name for the current pattern
FLP_Text_Title = FLP_Text + 2, // title of the loop
FLP_Text_Comment = FLP_Text + 3, // old comments in text format.
// Not used anymore
FLP_Text_SampleFileName = FLP_Text + 4, // filename for the sample in
// the current channel, stored
// as relative path
FLP_Text_URL = FLP_Text + 5,
FLP_Text_CommentRTF = FLP_Text + 6, // new comments in Rich Text
// format
FLP_Version = FLP_Text + 7,
FLP_Text_PluginName = FLP_Text + 9, // plugin file name
// (without path)
FLP_MIDICtrls = FLP_Text + 16,
FLP_Delay = FLP_Text + 17,
FLP_TS404Params = FLP_Text + 18,
FLP_DelayLine = FLP_Text + 19,
FLP_NewPlugin = FLP_Text + 20,
FLP_PluginParams = FLP_Text + 21,
FLP_ChanParams = FLP_Text + 23,// block of various channel
// params (can grow)
FLP_EnvLfoParams = FLP_Text + 26,
FLP_FilterParams = FLP_Text + 27,
FLP_PatternNotes = FLP_Text + 32,
FLP_StepData = FLP_Text + 33,
FLP_CmdCount
} ;
enum flPlugins
{
FL_Plugin_3x_Osc,
FL_Plugin_Sampler,
FL_Plugin_Plucked,
FL_Plugin_SimSynth,
FL_Plugin_DX10,
FL_Plugin_Sytrus,
FL_Plugin_WASP,
FL_Plugin_Undef
} ;
class instrument;
struct FL_Channel;
class flpImport : public importFilter
{
@@ -178,8 +53,7 @@ public:
private:
virtual bool tryImport( trackContainer * _tc );
bool processPluginParams( const flPlugins _plugin, const char * _data,
const int _data_len, instrument * _i );
void processPluginParams( FL_Channel * _ch );
inline int readInt( int _bytes )
{
@@ -226,15 +100,6 @@ private:
}
typedef QList<QPair<int, note> > patternNoteVector;
patternNoteVector m_notes;
typedef QList<int> stepVector;
stepVector m_steps;
typedef QList<Uint32> playListItems;
playListItems m_plItems;
} ;

View File

@@ -0,0 +1,71 @@
/*
* unrtf.cpp - integration of UnRTF
*
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#include "lmmsconfig.h"
#include <QtCore/QString>
#include <QtCore/QBuffer>
#include <cstdio>
extern "C"
{
// unrtf-stuff
#include "defs.h"
#include "main.h"
#include "html.h"
#include "word.h"
#include "hash.h"
#include "convert.h"
#include "attr.h"
int lineno = 0;
#define inline_mode 0
#define debug_mode 0
#define nopict_mode 1
#define verbose_mode 0
#define simple_mode 0
#define no_remap_mode 0
QString outstring;
short numchar_table;
OutputPersonality * op = NULL;
// include unrtf-source
#include "attr.c"
#include "convert.c"
#include "error.c"
#include "hash.c"
#include "html.c"
#include "malloc.c"
#include "output.c"
#include "parse.c"
#include "util.c"
#include "word.c"
}

View File

@@ -4,7 +4,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@ -33,6 +33,8 @@
* 22 Sep 01, tuorfa@yahoo.com: added comment blocks
* 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith
* 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions
* 16 Dec 07, daved@physiol.usyd.edu.au: fixed fore/background_begin error
* and updated to GPL v3
*--------------------------------------------------------------------*/
#ifdef LMMS_HAVE_CONFIG_H
@@ -106,10 +108,10 @@ attr_express_begin (int attr, const char* param) {
switch(attr)
{
case ATTR_BOLD:
outstring+=QString("%1").arg(op->bold_begin);
outstring+=QString().sprintf(op->bold_begin);
break;
case ATTR_ITALIC:
outstring+=QString("%1").arg(op->italic_begin);
outstring+=QString().sprintf(op->italic_begin);
break;
/* Various underlines, they all resolve to HTML's <u> */
@@ -121,11 +123,11 @@ attr_express_begin (int attr, const char* param) {
case ATTR_2DOT_DASH_UL:
case ATTR_WORD_UL:
case ATTR_UNDERLINE:
outstring+=QString("%1").arg(op->underline_begin);
outstring+=QString().sprintf(op->underline_begin);
break;
case ATTR_DOUBLE_UL:
outstring+=QString("%1").arg(op->dbl_underline_begin);
outstring+=QString().sprintf(op->dbl_underline_begin);
break;
case ATTR_FONTSIZE:
@@ -133,48 +135,48 @@ attr_express_begin (int attr, const char* param) {
break;
case ATTR_FONTFACE:
outstring+=QString("%1").arg(op->font_begin,param);
outstring+=QString().sprintf(op->font_begin,param);
break;
case ATTR_FOREGROUND:
outstring+=QString("%1").arg(op->foreground_begin, param);
outstring+=QString().sprintf(op->foreground_begin, param);
break;
case ATTR_BACKGROUND:
if (!simple_mode)
outstring+=QString("%1").arg(op->foreground_begin,param);
outstring+=QString().sprintf(op->background_begin,param);
break;
case ATTR_SUPER:
outstring+=QString("%1").arg(op->superscript_begin);
outstring+=QString().sprintf(op->superscript_begin);
break;
case ATTR_SUB:
outstring+=QString("%1").arg(op->subscript_begin);
outstring+=QString().sprintf(op->subscript_begin);
break;
case ATTR_STRIKE:
outstring+=QString("%1").arg(op->strikethru_begin);
outstring+=QString().sprintf(op->strikethru_begin);
break;
case ATTR_DBL_STRIKE:
outstring+=QString("%1").arg(op->dbl_strikethru_begin);
outstring+=QString().sprintf(op->dbl_strikethru_begin);
break;
case ATTR_EXPAND:
outstring+=QString("%1").arg(op->expand_begin, param);
outstring+=QString().sprintf(op->expand_begin, param);
break;
case ATTR_OUTLINE:
outstring+=QString("%1").arg(op->outline_begin);
outstring+=QString().sprintf(op->outline_begin);
break;
case ATTR_SHADOW:
outstring+=QString("%1").arg(op->shadow_begin);
outstring+=QString().sprintf(op->shadow_begin);
break;
case ATTR_EMBOSS:
outstring+=QString("%1").arg(op->emboss_begin);
outstring+=QString().sprintf(op->emboss_begin);
break;
case ATTR_ENGRAVE:
outstring+=QString("%1").arg(op->engrave_begin);
outstring+=QString().sprintf(op->engrave_begin);
break;
case ATTR_CAPS:
@@ -187,7 +189,7 @@ attr_express_begin (int attr, const char* param) {
simulate_smallcaps = TRUE;
else {
if (op->small_caps_begin)
outstring+=QString("%1").arg(op->small_caps_begin);
outstring+=QString().sprintf(op->small_caps_begin);
}
break;
}
@@ -207,10 +209,10 @@ attr_express_end (int attr, char *param)
switch(attr)
{
case ATTR_BOLD:
outstring+=QString("%1").arg(op->bold_end);
outstring+=QString().sprintf(op->bold_end);
break;
case ATTR_ITALIC:
outstring+=QString("%1").arg(op->italic_end);
outstring+=QString().sprintf(op->italic_end);
break;
/* Various underlines, they all resolve to HTML's </u> */
@@ -222,11 +224,11 @@ attr_express_end (int attr, char *param)
case ATTR_2DOT_DASH_UL:
case ATTR_WORD_UL:
case ATTR_UNDERLINE:
outstring+=QString("%1").arg(op->underline_end);
outstring+=QString().sprintf(op->underline_end);
break;
case ATTR_DOUBLE_UL:
outstring+=QString("%1").arg(op->dbl_underline_end);
outstring+=QString().sprintf(op->dbl_underline_end);
break;
case ATTR_FONTSIZE:
@@ -234,47 +236,47 @@ attr_express_end (int attr, char *param)
break;
case ATTR_FONTFACE:
outstring+=QString("%1").arg(op->font_end);
outstring+=QString().sprintf(op->font_end);
break;
case ATTR_FOREGROUND:
outstring+=QString("%1").arg(op->foreground_end);
outstring+=QString().sprintf(op->foreground_end);
break;
case ATTR_BACKGROUND:
if (!simple_mode)
outstring+=QString("%1").arg(op->background_end);
outstring+=QString().sprintf(op->background_end);
break;
case ATTR_SUPER:
outstring+=QString("%1").arg(op->superscript_end);
outstring+=QString().sprintf(op->superscript_end);
break;
case ATTR_SUB:
outstring+=QString("%1").arg(op->subscript_end);
outstring+=QString().sprintf(op->subscript_end);
break;
case ATTR_STRIKE:
outstring+=QString("%1").arg(op->strikethru_end);
outstring+=QString().sprintf(op->strikethru_end);
break;
case ATTR_DBL_STRIKE:
outstring+=QString("%1").arg(op->dbl_strikethru_end);
outstring+=QString().sprintf(op->dbl_strikethru_end);
break;
case ATTR_OUTLINE:
outstring+=QString("%1").arg(op->outline_end);
outstring+=QString().sprintf(op->outline_end);
break;
case ATTR_SHADOW:
outstring+=QString("%1").arg(op->shadow_end);
outstring+=QString().sprintf(op->shadow_end);
break;
case ATTR_EMBOSS:
outstring+=QString("%1").arg(op->emboss_end);
outstring+=QString().sprintf(op->emboss_end);
break;
case ATTR_ENGRAVE:
outstring+=QString("%1").arg(op->engrave_end);
outstring+=QString().sprintf(op->engrave_end);
break;
case ATTR_EXPAND:
outstring+=QString("%1").arg(op->expand_end);
outstring+=QString().sprintf(op->expand_end);
break;
case ATTR_CAPS:
@@ -287,7 +289,7 @@ attr_express_end (int attr, char *param)
simulate_smallcaps = FALSE;
else {
if (op->small_caps_end)
outstring+=QString("%1").arg(op->small_caps_end);
outstring+=QString().sprintf(op->small_caps_end);
}
break;
}
@@ -331,6 +333,42 @@ attr_push(int attr, const char* param)
attr_express_begin(attr, param);
}
#if 1 /* daved 0.20.2 */
/*========================================================================
* Name: attr_get_param
* Purpose: Reads an attribute from the current attribute stack.
* Args: Attribute number
* Returns: string.
*=======================================================================*/
char *
attr_get_param(int attr)
{
int i;
AttrStack *stack = stack_of_stacks_top;
if (!stack) {
warning_handler("No stack to get attribute from");
return NULL;
}
i=stack->tos;
while (i>=0)
{
if(stack->attr_stack [i] == attr)
{
if(stack->attr_stack_params [i] != NULL)
return stack->attr_stack_params [i];
else
return NULL;
}
i--;
}
return NULL;
}
#endif
/*========================================================================
* Name: attrstack_copy_all

View File

@@ -4,7 +4,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@ -32,11 +32,13 @@
* 18 Sep 01, tuorfa@yahoo.com: updates for AttrStack paradigm
* 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith
* 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions
* 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3
*--------------------------------------------------------------------*/
#ifndef _ATTR
#define _ATTR
enum {
ATTR_NONE=0,
ATTR_BOLD, ATTR_ITALIC,
@@ -90,6 +92,13 @@ extern void attr_pop_all();
extern void attr_pop_dump();
#if 1 /* daved 0.20.2 */
char * attr_get_param(int attr);
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -5,7 +5,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@ -28,7 +28,8 @@
* Purpose: Definitions for the conversion module
*----------------------------------------------------------------------
* Changes:
* 31 March 2005 by daved@physiol.usyd.edu.au: changes requested by ZT Smith
* 31 Mar 05, by daved@physiol.usyd.edu.au: changes requested by ZT Smith
* 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3
*--------------------------------------------------------------------*/
@@ -38,7 +39,7 @@ enum {
CHARSET_ANSI=1,
CHARSET_MAC,
CHARSET_CP437,
CHARSET_CP850
CHARSET_CP850,
};
#ifndef _WORD
@@ -48,9 +49,10 @@ enum {
extern void word_print (Word*, QString & _s);
#if 1 /* daved 0.19.6 - support for multiple char number->output tables */
short numchar_table;
extern short numchar_table;
#define FONTROMAN_TABLE 0
#define FONTSYMBOL_TABLE 1
#define FONTGREEK_TABLE 2
#endif
#define _CONVERT

View File

@@ -5,7 +5,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@ -35,6 +35,9 @@
* 09 Oct 03, daved@physiol.usyd.edu.au: changed to GNU website
* 17 Feb 04, marcossamaral@terra.com.br: changed some information
* 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith
* 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3
* 17 Dec 07, daved@physiol.usyd.edu.au: added --noremap to usage - from
* David Santinoli
*--------------------------------------------------------------------*/
@@ -61,7 +64,7 @@
#endif
#define USAGE "unrtf [--version] [--verbose] [--help] [--nopict|-n] [--html] [--text] [--vt] [--latex] [-t html|text|vt|latex] <filename>"
#define USAGE "unrtf [--version] [--verbose] [--help] [--nopict|-n] [--noremap] [--html] [--text] [--vt] [--latex] [-t html|text|vt|latex] <filename>"
/* Default names for RTF's default fonts */

View File

@@ -4,7 +4,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@ -37,6 +37,7 @@
* 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith
* 22 Aug 05, ax2groin@arbornet.org: added lineno to error_handler
* 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions
* 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3
*--------------------------------------------------------------------*/
#ifdef LMMS_HAVE_CONFIG_H

View File

@@ -4,7 +4,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@ -30,6 +30,7 @@
* Changes
* 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith
* 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions
* 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3
*--------------------------------------------------------------------*/

View File

@@ -4,7 +4,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@ -38,6 +38,7 @@
* 08 Oct 03, daved@physiol.usyd.edu.au: some type fixes
* 29 Mar 05, daved@physiol.usyd.edu.au: changes requsted by ZT Smith
* 06 Jan 06, marcossamaral@terra.com.br: changes hash_stats function
* 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3
*--------------------------------------------------------------------*/
#ifdef LMMS_HAVE_CONFIG_H

View File

@@ -4,7 +4,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@ -29,6 +29,7 @@
* Changes:
* 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith
* 06 Jan 06, marcossamaral@terra.com.br: changes hash_stats()
* 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3
*--------------------------------------------------------------------*/

View File

@@ -4,7 +4,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@ -39,6 +39,8 @@
* 19 Aug 05, ax2groin@arbornet.org: added more chars and changes to ANSI
* 05 Jan 06, marcossamaral@terra.com.br: fixed bugs #14982 and #14983
* 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions
* 13 Dec 07, daved@physiol.usyd.edu.au: fixed some missing entity ';'
* 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3
*--------------------------------------------------------------------*/
#ifdef LMMS_HAVE_CONFIG_H
@@ -644,8 +646,8 @@ static const char* cp437 [] = {
/* 0x9b */ "&cent;",
/* 0x9c */ "&pound;",
/* 0x9d */ "&yen;",
/* 0x9e */ "&#8359", /* peseta */
/* 0x9f */ "&#402", /* small f with hook */
/* 0x9e */ "&#8359;", /* peseta */
/* 0x9f */ "&#402;", /* small f with hook */
/* 0xa0 */ "&aacute;",
/* 0xa1 */ "&iacute;",
/* 0xa2 */ "&oacute;",
@@ -655,7 +657,7 @@ static const char* cp437 [] = {
/* 0xa6 */ "&ordf;",
/* 0xa7 */ "&frac14;",
/* 0xa8 */ "&iquest;",
/* 0xa9 */ "&#8976", /* reversed not */
/* 0xa9 */ "&#8976;", /* reversed not */
/* 0xaa */ "&not;",
/* 0xab */ "&frac12;",
/* 0xac */ "&raquo;",
@@ -874,6 +876,159 @@ static const char* cp850 [] = {
/* 0xfe */ "&#9632;", /* black square */
/* 0xff */ "&nbsp;",
};
#if 1 /* daved - 0.20.3 */
static const char * Greek[] =
{
/* 0x80 */ "&ccedil;",
/* 0x81 */ "&uuml;",
/* 0x82 */ "&eacute;",
/* 0x83 */ "&acirc;",
/* 0x84 */ "&auml;",
/* 0x85 */ "&agrave;",
/* 0x86 */ "&aring;",
/* 0x87 */ "&ccedil;",
/* 0x88 */ "&ecirc;",
/* 0x89 */ "&euml;",
/* 0x8a */ "&egrave;",
/* 0x8b */ "&iuml;",
/* 0x8c */ "&icirc;",
/* 0x8d */ "&igrave;",
/* 0x8e */ "&auml;",
/* 0x8f */ "&aring;",
/* 0x90 */ "&eacute;",
/* 0x91 */ "&aelig;",
/* 0x92 */ "&aelig;",
/* 0x93 */ "&ocirc;",
/* 0x94 */ "&ouml;",
/* 0x95 */ "&ograve;",
/* 0x96 */ "&ucirc;",
/* 0x97 */ "&ugrave;",
/* 0x98 */ "&yuml;",
/* 0x99 */ "&ouml;",
/* 0x9a */ "&uuml;",
/* 0x9b */ "&oslash;",
/* 0x9c */ "&pound;",
/* 0x9d */ "&oslash;",
/* 0x9e */ "&times;",
/* 0x9f */ "&#402;", /* small f with hook */
/* 0xa0 */ "&aacute;",
/* 0xa1 */ "&iacute;",
/* 0xa2 */ "&oacute;",
/* 0xa3 */ "&uacute;",
/* 0xa4 */ "&ntilde;",
/* 0xa5 */ "&ntilde;",
/* 0xa6 */ "&ordf;",
/* 0xa7 */ "&frac14;",
/* 0xa8 */ "&iquest;",
/* 0xa9 */ "&reg;",
/* 0xaa */ "&not;",
/* 0xab */ "&frac12;",
/* 0xac */ "&raquo;",
/* 0xad */ "&iexcl;",
/* 0xae */ "&laquo;",
/* 0xaf */ "&ordm;",
/* 0xb0 */ "&#9617;", /* light shade */
/* 0xb1 */ "&#9618;", /* med. shade */
/* 0xb2 */ "&#9619;", /* dark shade */
/* 0xb3 */ "&#9474;", /* box-draw light vert. */
/* 0xb4 */ "&#9508;", /* box-draw light vert. + lt. */
/* 0xb5 */ "&aacute;",
/* 0xb6 */ "&acirc;",
/* 0xb7 */ "&agrave;",
/* 0xb8 */ "&copy;",
/* 0xb9 */ "&#9571;", /* box-draw dbl. vert. + lt. */
/* 0xba */ "&#9553;", /* box-draw dbl. vert. */
/* 0xbb */ "&#9559;", /* box-draw dbl. dn. + lt. */
/* 0xbc */ "&#9565;", /* box-draw dbl. up + lt. */
/* 0xbd */ "&cent;",
/* 0xbe */ "&yen;",
/* 0xbf */ "&#9488;", /* box-draw light dn. + lt. */
/* 0xc0 */ "&#9492;", /* box-draw light up + rt. */
/* 0xc1 */ "&#9524;", /* box-draw light up + horiz. */
/* 0xc2 */ "&#9516;", /* box-draw light dn. + horiz. */
/* 0xc3 */ "&#9500;", /* box-draw light vert. + rt. */
/* 0xc4 */ "&#9472;", /* box-draw light horiz. */
/* 0xc5 */ "&#9532;", /* box-draw light vert. + horiz. */
/* 0xc6 */ "&atilde;",
/* 0xc7 */ "&atilde;",
/* 0xc8 */ "&#9562;", /* box-draw dbl. up + rt. */
/* 0xc9 */ "&#9556;", /* box-draw dbl. dn. + rt. */
/* 0xca */ "&#9577;", /* box-draw dbl. up + horiz. */
/* 0xcb */ "&#9574;", /* box-draw dbl. dn. + horiz. */
/* 0xcc */ "&#9568;", /* box-draw dbl. vert. + rt. */
/* 0xcd */ "&#9552;", /* box-draw dbl. horiz. */
/* 0xce */ "&#9580;", /* box-draw dbl. vert. + horiz. */
/* 0xcf */ "&curren;",
/* 0xd0 */ "&eth;",
/* 0xd1 */ "&eth;",
/* 0xd2 */ "&ecirc;",
/* 0xd3 */ "&euml;",
/* 0xd4 */ "&egrave;",
/* 0xd5 */ "&#305;", /* small dotless i */
/* 0xd6 */ "&iacute;",
/* 0xd7 */ "&icirc;",
/* 0xd8 */ "&iuml;",
/* 0xd9 */ "&#9496;", /* box-draw light up + lt. */
/* 0xda */ "&#9484;", /* box-draw light dn. + rt. */
/* 0xdb */ "&#9608;", /* full-block */
/* 0xdc */ "&#9604;", /* lower 1/2 block */
/* 0xdd */ "&brvbar;",
/* 0xde */ "&igrave;",
/* 0xdf */ "&#9600;", /* upper 1/2 block */
/* 0xe0 */ "&oacute;",
/* above here not done */
/* 0xe1 */ "&alpha;",
/* 0xe2 */ "&beta;",
/* 0xe3 */ "&gamma;",
/* 0xe4 */ "&delta;",
/* 0xe5 */ "&epsilon;",
/* 0xe6 */ "&zeta;",
/* 0xe7 */ "&eta;",
/* 0xe8 */ "&theta;",
/* 0xe9 */ "&iota;",
/* 0xea */ "&kappa;",
/* 0xeb */ "&lambda;",
/* 0xec */ "&mu;",
/* 0xed */ "&nu;",
/* 0xee */ "&xi;",
/* 0xef */ "&omicron;",
/* 0xf0 */ "&pi;",
/* 0xf1 */ "&rho;",
/* 0xf2 */ "&sigmaf;",
/* 0xf3 */ "&sigma;",
/* 0xf4 */ "&tau;",
/* 0xf5 */ "&upsilon;",
/* 0xf6 */ "&phi;",
/* 0xf7 */ "&chi;",
/* 0xf8 */ "&psi;",
/* 0xf9 */ "&omiga;",
/* 0xfa */ "&iotauml;",
/* 0xfb */ "&nuuml;",
/* 0xfc */ "&omicronacute;",
/* 0xfd */ "&nuacute;",
/* 0xfe */ "&omegaacute;", /* black square */
/* 0xff */ "&nbsp;",
};
#endif
/*========================================================================
* Name: html_unisymbol_print
* Purpose: Outputs arbitrary unicode symbol
* Args: Unsigned Short.
* Returns: String representing symbol.
*=======================================================================*/
char *
html_unisymbol_print (unsigned short c)
{
char r[12];
snprintf(r, 9, "&#%04d;", c);
return my_strdup(r);
}
@@ -1098,6 +1253,13 @@ html_init (void)
op->symbol_last_char = 254;
op->symbol_translation_table = symbol;
#endif
#if 1 /* daved - 0.20.3 - GREEK font support */
op->greek_first_char = 0x80;
op->greek_last_char = 0xff;
op->greek_translation_table = Greek;
#endif
op->unisymbol_print = html_unisymbol_print;
return op;
}

View File

@@ -4,7 +4,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@ -28,6 +28,7 @@
*----------------------------------------------------------------------
* Changes:
* 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith
* 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3
*--------------------------------------------------------------------*/

View File

@@ -4,7 +4,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@ -30,6 +30,7 @@
* 15 Oct 00, tuorfa@yahoo.com: removed echo_mode extern
* 19 Sep 01, tuorfa@yahoo.com: added output personality
* 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith
* 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3
*--------------------------------------------------------------------*/

View File

@@ -4,7 +4,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@ -35,6 +35,7 @@
* 08 Oct 03, daved@physiol.usyd.edu.au: added stdlib.h for linux
* 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith
* 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions
* 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3
*--------------------------------------------------------------------*/
#ifdef LMMS_HAVE_CONFIG_H

View File

@@ -4,7 +4,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@ -29,6 +29,7 @@
* Changes:
* 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith
* 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions
* 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3
*--------------------------------------------------------------------*/
extern char * my_malloc (unsigned long);

View File

@@ -4,7 +4,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@ -34,6 +34,9 @@
* 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith
* 06 Jan 06, marcossamaral@terra.com.br: changes in STDOUT
* 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions
* 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3
* 17 Dec 07, daved@physiol.usyd.edu.au: added support for --noremap from
* David Santinoli
*--------------------------------------------------------------------*/
@@ -114,16 +117,27 @@ op_free (OutputPersonality *op)
const char *
#if 1 /* daved - 0.19.6 */
op_translate_char (OutputPersonality *op, int charset, int ch, int ntable)
op_translate_char (OutputPersonality *op, int charset, CodepageInfo *codepage, int ch, int ntable)
#else
op_translate_char (OutputPersonality *op, int charset, int ch)
op_translate_char (OutputPersonality *op, int charset, CodepageInfo *codepage, int ch)
#endif
{
short start;
const char *result=NULL;
#if 1 /* daved - 0.20.5 */
static char output_buffer[2]={ 0, 0 };
#endif
CHECK_PARAM_NOT_NULL(op);
#if 1 /* daved - 0.20.5 */
if (no_remap_mode == TRUE && ch < 256)
{
output_buffer[0]=ch;
result=output_buffer;
}
else
#endif
#if 1 /* daved - 0.19.6 */
/* if we are seeking a character from a symbol font we can
be below 0x80
@@ -134,8 +148,21 @@ op_translate_char (OutputPersonality *op, int charset, int ch)
if(ch >= start && ch <= op->symbol_last_char)
result = op->symbol_translation_table[ch - start];
if(result)
return result;
}
else
#endif
#if 1 /* daved - 0.20.3 */
if(ntable == FONTGREEK_TABLE)
{
start = op->greek_first_char;
if(ch >= start && ch <= op->greek_last_char)
result = op->greek_translation_table[ch - start];
if(result)
return result;
}
#endif
if (ch >= 0x20 && ch < 0x80) {
result = op->ascii_translation_table [ch - 0x20];
@@ -149,10 +176,23 @@ op_translate_char (OutputPersonality *op, int charset, int ch)
else
switch (charset) {
case CHARSET_ANSI:
if (codepage != NULL && op->unisymbol_print != NULL && codepage->cp)
{
if(0)
printf("<CODEPAGE CHAR %d>", codepage->chars[ch - 0x80]);
if (codepage->chars[ch - 0x80]) {
if(0)
printf("<UNIPRINTING>");
result = op->unisymbol_print(codepage->chars[ch - 0x80]);
}
}
if(!result)
{
start = op->ansi_first_char;
if (ch >= start &&
ch <= op->ansi_last_char)
result = op->ansi_translation_table [ch-start];
if (ch >= start &&
ch <= op->ansi_last_char)
result = op->ansi_translation_table [ch-start];
}
break;
case CHARSET_MAC:
start = op->mac_first_char;
@@ -198,49 +238,49 @@ op_begin_std_fontsize (OutputPersonality *op, int size)
switch (size) {
case 8:
if (op->fontsize8_begin) {
outstring+=QString("%1").arg (op->fontsize8_begin);
outstring+=QString().sprintf(op->fontsize8_begin);
found_std_expr = TRUE;
}
break;
case 10:
if (op->fontsize10_begin) {
outstring+=QString("%1").arg (op->fontsize10_begin);
outstring+=QString().sprintf(op->fontsize10_begin);
found_std_expr = TRUE;
}
break;
case 12:
if (op->fontsize12_begin) {
outstring+=QString("%1").arg (op->fontsize12_begin);
outstring+=QString().sprintf(op->fontsize12_begin);
found_std_expr = TRUE;
}
break;
case 14:
if (op->fontsize14_begin) {
outstring+=QString("%1").arg (op->fontsize14_begin);
outstring+=QString().sprintf(op->fontsize14_begin);
found_std_expr = TRUE;
}
break;
case 18:
if (op->fontsize18_begin) {
outstring+=QString("%1").arg (op->fontsize18_begin);
outstring+=QString().sprintf(op->fontsize18_begin);
found_std_expr = TRUE;
}
break;
case 24:
if (op->fontsize24_begin) {
outstring+=QString("%1").arg (op->fontsize24_begin);
outstring+=QString().sprintf(op->fontsize24_begin);
found_std_expr = TRUE;
}
break;
case 36:
if (op->fontsize36_begin) {
outstring+=QString("%1").arg (op->fontsize36_begin);
outstring+=QString().sprintf(op->fontsize36_begin);
found_std_expr = TRUE;
}
break;
case 48:
if (op->fontsize48_begin) {
outstring+=QString("%1").arg (op->fontsize48_begin);
outstring+=QString().sprintf(op->fontsize48_begin);
found_std_expr = TRUE;
}
break;
@@ -253,53 +293,53 @@ op_begin_std_fontsize (OutputPersonality *op, int size)
if (op->fontsize_begin) {
char expr[16];
sprintf (expr, "%d", size);
outstring+=QString("%1").arg (op->fontsize_begin, expr);
outstring+=QString().sprintf(op->fontsize_begin, expr);
} else {
/* If we cannot write out a change for the exact
* point size, we must approximate to a standard
* size.
*/
if (size<9 && op->fontsize8_begin) {
outstring+=QString("%1").arg (op->fontsize8_begin);
outstring+=QString().sprintf(op->fontsize8_begin);
} else
if (size<11 && op->fontsize10_begin) {
outstring+=QString("%1").arg (op->fontsize10_begin);
outstring+=QString().sprintf(op->fontsize10_begin);
} else
if (size<13 && op->fontsize12_begin) {
outstring+=QString("%1").arg (op->fontsize12_begin);
outstring+=QString().sprintf(op->fontsize12_begin);
} else
if (size<16 && op->fontsize14_begin) {
outstring+=QString("%1").arg (op->fontsize14_begin);
outstring+=QString().sprintf(op->fontsize14_begin);
} else
if (size<21 && op->fontsize18_begin) {
outstring+=QString("%1").arg (op->fontsize18_begin);
outstring+=QString().sprintf(op->fontsize18_begin);
} else
if (size<30 && op->fontsize24_begin) {
outstring+=QString("%1").arg (op->fontsize24_begin);
outstring+=QString().sprintf(op->fontsize24_begin);
} else
if (size<42 && op->fontsize36_begin) {
outstring+=QString("%1").arg (op->fontsize36_begin);
outstring+=QString().sprintf(op->fontsize36_begin);
} else
if (size>40 && op->fontsize48_begin) {
outstring+=QString("%1").arg (op->fontsize48_begin);
outstring+=QString().sprintf(op->fontsize48_begin);
} else
/* If we can't even produce a good approximation,
* just try to get a font size near 12 point.
*/
if (op->fontsize12_begin)
outstring+=QString("%1").arg (op->fontsize12_begin);
outstring+=QString().sprintf(op->fontsize12_begin);
else
if (op->fontsize14_begin)
outstring+=QString("%1").arg (op->fontsize14_begin);
outstring+=QString().sprintf(op->fontsize14_begin);
else
if (op->fontsize10_begin)
outstring+=QString("%1").arg (op->fontsize10_begin);
outstring+=QString().sprintf(op->fontsize10_begin);
else
if (op->fontsize18_begin)
outstring+=QString("%1").arg (op->fontsize18_begin);
outstring+=QString().sprintf(op->fontsize18_begin);
else
if (op->fontsize8_begin)
outstring+=QString("%1").arg (op->fontsize8_begin);
outstring+=QString().sprintf(op->fontsize8_begin);
else
error_handler ("output personality lacks sufficient font size change capability");
}
@@ -327,49 +367,49 @@ op_end_std_fontsize (OutputPersonality *op, int size)
switch (size) {
case 8:
if (op->fontsize8_end) {
outstring+=QString("%1").arg (op->fontsize8_end);
outstring+=QString().sprintf(op->fontsize8_end);
found_std_expr = TRUE;
}
break;
case 10:
if (op->fontsize10_end) {
outstring+=QString("%1").arg (op->fontsize10_end);
outstring+=QString().sprintf(op->fontsize10_end);
found_std_expr = TRUE;
}
break;
case 12:
if (op->fontsize12_end) {
outstring+=QString("%1").arg (op->fontsize12_end);
outstring+=QString().sprintf(op->fontsize12_end);
found_std_expr = TRUE;
}
break;
case 14:
if (op->fontsize14_end) {
outstring+=QString("%1").arg (op->fontsize14_end);
outstring+=QString().sprintf(op->fontsize14_end);
found_std_expr = TRUE;
}
break;
case 18:
if (op->fontsize18_end) {
outstring+=QString("%1").arg (op->fontsize18_end);
outstring+=QString().sprintf(op->fontsize18_end);
found_std_expr = TRUE;
}
break;
case 24:
if (op->fontsize24_end) {
outstring+=QString("%1").arg (op->fontsize24_end);
outstring+=QString().sprintf(op->fontsize24_end);
found_std_expr = TRUE;
}
break;
case 36:
if (op->fontsize36_end) {
outstring+=QString("%1").arg (op->fontsize36_end);
outstring+=QString().sprintf(op->fontsize36_end);
found_std_expr = TRUE;
}
break;
case 48:
if (op->fontsize48_end) {
outstring+=QString("%1").arg (op->fontsize48_end);
outstring+=QString().sprintf(op->fontsize48_end);
found_std_expr = TRUE;
}
break;
@@ -382,53 +422,53 @@ op_end_std_fontsize (OutputPersonality *op, int size)
if (op->fontsize_end) {
char expr[16];
sprintf (expr, "%d", size);
outstring+=QString("%1").arg (op->fontsize_end, expr);
outstring+=QString().sprintf(op->fontsize_end, expr);
} else {
/* If we cannot write out a change for the exact
* point size, we must approximate to a standard
* size.
*/
if (size<9 && op->fontsize8_end) {
outstring+=QString("%1").arg (op->fontsize8_end);
outstring+=QString().sprintf(op->fontsize8_end);
} else
if (size<11 && op->fontsize10_end) {
outstring+=QString("%1").arg (op->fontsize10_end);
outstring+=QString().sprintf(op->fontsize10_end);
} else
if (size<13 && op->fontsize12_end) {
outstring+=QString("%1").arg (op->fontsize12_end);
outstring+=QString().sprintf(op->fontsize12_end);
} else
if (size<16 && op->fontsize14_end) {
outstring+=QString("%1").arg (op->fontsize14_end);
outstring+=QString().sprintf(op->fontsize14_end);
} else
if (size<21 && op->fontsize18_end) {
outstring+=QString("%1").arg (op->fontsize18_end);
outstring+=QString().sprintf(op->fontsize18_end);
} else
if (size<30 && op->fontsize24_end) {
outstring+=QString("%1").arg (op->fontsize24_end);
outstring+=QString().sprintf(op->fontsize24_end);
} else
if (size<42 && op->fontsize36_end) {
outstring+=QString("%1").arg (op->fontsize36_end);
outstring+=QString().sprintf(op->fontsize36_end);
} else
if (size>40 && op->fontsize48_end) {
outstring+=QString("%1").arg (op->fontsize48_end);
outstring+=QString().sprintf(op->fontsize48_end);
} else
/* If we can't even produce a good approximation,
* just try to get a font size near 12 point.
*/
if (op->fontsize12_end)
outstring+=QString("%1").arg (op->fontsize12_end);
outstring+=QString().sprintf(op->fontsize12_end);
else
if (op->fontsize14_end)
outstring+=QString("%1").arg (op->fontsize14_end);
outstring+=QString().sprintf(op->fontsize14_end);
else
if (op->fontsize10_end)
outstring+=QString("%1").arg (op->fontsize10_end);
outstring+=QString().sprintf(op->fontsize10_end);
else
if (op->fontsize18_end)
outstring+=QString("%1").arg (op->fontsize18_end);
outstring+=QString().sprintf(op->fontsize18_end);
else
if (op->fontsize8_end)
outstring+=QString("%1").arg (op->fontsize8_end);
outstring+=QString().sprintf(op->fontsize8_end);
else
error_handler ("output personality lacks sufficient font size change capability");
}

View File

@@ -4,7 +4,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@ -28,12 +28,18 @@
*----------------------------------------------------------------------
* Changes:
* 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith
* 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3
* 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions
*--------------------------------------------------------------------*/
#ifndef _OUTPUT
typedef struct {
int cp;
unsigned short chars[128];
} CodepageInfo;
typedef struct {
const char *comment_begin;
@@ -276,6 +282,13 @@ typedef struct {
short symbol_last_char;
const char **symbol_translation_table;
#endif
#if 1 /* daved 0.20.3 GREEK font support */
short greek_first_char;
short greek_last_char;
const char **greek_translation_table;
#endif
char *(*unisymbol_print) (unsigned short);
void (*write_set_foreground) (int,int,int);
}
@@ -285,9 +298,9 @@ OutputPersonality;
extern OutputPersonality* op_create(void);
extern void op_free (OutputPersonality*);
#if 1 /* daved - 0.19.6 */
extern const char* op_translate_char (OutputPersonality*,int,int, int);
extern const char* op_translate_char (OutputPersonality*,int,CodepageInfo*,int, int);
#else
extern char* op_translate_char (OutputPersonality*,int,int);
extern char* op_translate_char (OutputPersonality*,int,CodepageInfo*,int);
#endif
extern void op_begin_std_fontsize (OutputPersonality*, int);

View File

@@ -4,7 +4,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@ -36,6 +36,7 @@
* 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks
* 08 Sep 03, daved@physiol.usyd.edu.au: type fixes; ANSI C fixes
* 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith
* 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3
*--------------------------------------------------------------------*/
#ifdef LMMS_HAVE_CONFIG_H

View File

@@ -4,7 +4,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@ -29,6 +29,7 @@
* Changes:
* 15 Oct 00, tuorfa@yahoo.com: parse.h created with functions taken from word.c
* 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith
* 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3
*--------------------------------------------------------------------*/

View File

@@ -4,7 +4,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@ -29,6 +29,7 @@
* Changes:
* 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks
* 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith
* 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3
*--------------------------------------------------------------------*/
#ifdef LMMS_HAVE_CONFIG_H

View File

@@ -4,7 +4,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@ -28,6 +28,7 @@
*----------------------------------------------------------------------
* Changes:
* 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith
* 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3
*--------------------------------------------------------------------*/
extern int h2toi (char *);

View File

@@ -4,7 +4,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@ -46,6 +46,7 @@
* 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks
* 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith
* 11 Jan 07, jasp00@users.sourceforge.net: optimized unsafe loop
* 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3
*--------------------------------------------------------------------*/
#ifdef LMMS_HAVE_CONFIG_H

View File

@@ -4,7 +4,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@ -28,6 +28,7 @@
*----------------------------------------------------------------------
* Changes:
* 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith
* 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3
*--------------------------------------------------------------------*/
#ifndef _WORD

View File

@@ -84,14 +84,9 @@ class Eq
{
for (int z = 0; z < 2; ++z)
{
// work-around for buggy optimizer in GCC 4.3
for (int i = 0; i < Bands-1; ++i)
y[z][i] = 0;
y[z][Bands-1] = 0;
memset( y[z], 0, Bands*sizeof( eq_sample ) );
x[z] = 0;
}
for (int i = 0; i < 2; ++i)
x[i] = 0;
}
void init (double fs, double Q)

View File

@@ -0,0 +1,7 @@
Computer Music Toolkit (CMT)
----------------------------
This toolkit is a set of musical sound processing and synthesis tools
presented as a LADSPA plugin library. See the doc/ directory for
documentation and installation instructions. See http://www.ladspa.org
for LADSPA information. See http://www.ladspa.org/cmt for CMT updates.

View File

@@ -292,20 +292,23 @@ bool midiImport::readSMF( trackContainer * _tc )
// Tempo stuff
automationPattern * tap = _tc->tempoAutomationPattern();
tap->clear();
Alg_time_map * timeMap = seq->get_time_map();
Alg_beats & beats = timeMap->beats;
for( int i = 0; i < beats.len - 1; i++ )
if( tap )
{
Alg_beat_ptr b = &(beats[i]);
double tempo = ( beats[i + 1].beat - b->beat ) /
( beats[i + 1].time - beats[i].time );
tap->putValue( b->beat * ticksPerBeat, tempo * 60.0 );
}
if( timeMap->last_tempo_flag )
{
Alg_beat_ptr b = &( beats[beats.len - 1] );
tap->putValue( b->beat * ticksPerBeat, timeMap->last_tempo * 60.0 );
tap->clear();
Alg_time_map * timeMap = seq->get_time_map();
Alg_beats & beats = timeMap->beats;
for( int i = 0; i < beats.len - 1; i++ )
{
Alg_beat_ptr b = &(beats[i]);
double tempo = ( beats[i + 1].beat - b->beat ) /
( beats[i + 1].time - beats[i].time );
tap->putValue( b->beat * ticksPerBeat, tempo * 60.0 );
}
if( timeMap->last_tempo_flag )
{
Alg_beat_ptr b = &( beats[beats.len - 1] );
tap->putValue( b->beat * ticksPerBeat, timeMap->last_tempo * 60.0 );
}
}
// Song events
@@ -416,17 +419,17 @@ bool midiImport::readSMF( trackContainer * _tc )
break;
case 7:
objModel = &ch->it->volumeModel();
objModel = ch->it->volumeModel();
cc *= 100.0f;
break;
case 10:
objModel = &ch->it->panningModel();
objModel = ch->it->panningModel();
cc = cc * 200.f - 100.0f;
break;
case 128:
objModel = &ch->it->pitchModel();
objModel = ch->it->pitchModel();
cc = cc * 100.0f;
break;
}

View File

@@ -236,6 +236,7 @@ void sf2Instrument::loadSettings( const QDomElement & _this )
m_chorusSpeed.loadSettings( _this, "chorusSpeed" );
m_chorusDepth.loadSettings( _this, "chorusDepth" );
updatePatch();
updateGain();
}
@@ -299,7 +300,7 @@ void sf2Instrument::freeFont( void )
cout << "Really deleting " << m_filename << endl;
fluid_synth_sfunload( m_synth, m_fontId, TRUE );
s_fonts.remove( m_filename );
delete m_font;
}
// Just remove our reference

View File

@@ -26,6 +26,9 @@
#include <QtGui/QPainter>
#include <QtXml/QDomElement>
#include <cstdio>
#include "sid.h"
#include "sid_instrument.h"

View File

@@ -72,7 +72,8 @@ oscillatorObject::oscillatorObject( model * _parent, int _idx ) :
MaxVolume, 1.0f, this, tr( "Osc %1 volume" ).arg( _idx+1 ) ),
m_panModel( DefaultPanning, PanningLeft, PanningRight, 1.0f, this,
tr( "Osc %1 panning" ).arg( _idx+1 ) ),
m_coarseModel( 0, -2 * KeysPerOctave, 2 * KeysPerOctave, 1.0f, this,
m_coarseModel( -_idx*KeysPerOctave,
-2 * KeysPerOctave, 2 * KeysPerOctave, 1.0f, this,
tr( "Osc %1 coarse detuning" ).arg( _idx+1 ) ),
m_fineLeftModel( 0.0f, -100.0f, 100.0f, 1.0f, this,
tr( "Osc %1 fine detuning left" ).arg( _idx+1 ) ),

View File

@@ -222,6 +222,10 @@ bool vestigeInstrument::handleMidiEvent( const midiEvent & _me,
void vestigeInstrument::closePlugin( void )
{
m_pluginMutex.lock();
if( m_plugin )
{
delete m_plugin->pluginWidget();
}
delete m_plugin;
m_plugin = NULL;
m_pluginMutex.unlock();

View File

@@ -72,6 +72,7 @@ enum VstRemoteMessageIDs
IdVstPluginVersion,
IdVstPluginVendorString,
IdVstPluginProductString,
IdVstPluginUniqueID,
IdVstParameterCount,
IdVstParameterDump,
IdVstParameterProperties

File diff suppressed because it is too large Load Diff

View File

@@ -93,11 +93,11 @@ vstPlugin::vstPlugin( const QString & _plugin ) :
lock();
#ifdef LMMS_BUILD_WIN32
QWidget * helper = new QWidget;
QHBoxLayout * l = new QHBoxLayout( helper );
QWidget * target = new QWidget( helper );
QHBoxLayout * l = new QHBoxLayout;
l->setSpacing( 0 );
l->setMargin( 0 );
l->addWidget( target );
helper->setLayout( l );
static int k = 0;
const QString t = QString( "vst%1%2" ).arg( GetCurrentProcessId()<<10 ).
@@ -159,7 +159,6 @@ vstPlugin::vstPlugin( const QString & _plugin ) :
vstPlugin::~vstPlugin()
{
delete pluginWidget();
}
@@ -196,7 +195,10 @@ void vstPlugin::showEditor( QWidget * _parent )
xe->show();
#endif
m_pluginWidget->show();
if( m_pluginWidget )
{
m_pluginWidget->show();
}
}
@@ -331,23 +333,9 @@ bool vstPlugin::processMessage( const message & _m )
break;
case IdVstPluginEditorGeometry:
{
const int w = _m.getInt( 0 );
const int h = _m.getInt( 1 );
m_pluginGeometry = QSize( w, h );
/* if( m_pluginWidget != NULL )
{
m_pluginWidget->setFixedSize(
m_pluginGeometry );
if( m_pluginWidget->childAt( 0, 0 ) != NULL )
{
m_pluginWidget->childAt( 0, 0
)->setFixedSize(
m_pluginGeometry );
}
}*/
m_pluginGeometry = QSize( _m.getInt( 0 ),
_m.getInt( 1 ) );
break;
}
case IdVstPluginName:
m_name = _m.getQString();
@@ -365,6 +353,11 @@ bool vstPlugin::processMessage( const message & _m )
m_productString = _m.getQString();
break;
case IdVstPluginUniqueID:
// TODO: display graphically in case of failure
printf("unique ID: %s\n", _m.getString().c_str() );
break;
case IdVstParameterDump:
{
m_parameterDump.clear();

View File

@@ -74,9 +74,9 @@ public:
void setParameterDump( const QMap<QString, QString> & _pdump );
inline QWidget * pluginWidget( void )
inline QWidget * pluginWidget( bool _top_widget = true )
{
if( m_pluginWidget )
if( _top_widget && m_pluginWidget )
{
if( m_pluginWidget->parentWidget() )
{

View File

@@ -86,7 +86,7 @@ bool vstEffect::processAudioBuffer( sampleFrame * _buf, const fpp_t _frames )
{
if( !isEnabled() || !isRunning () )
{
return( FALSE );
return false;
}
if( m_plugin )
@@ -180,9 +180,9 @@ extern "C"
// neccessary for getting instance out of shared lib
plugin * lmms_plugin_main( model * _parent, void * _data )
{
return( new vstEffect( _parent,
return new vstEffect( _parent,
static_cast<const plugin::descriptor::subPluginFeatures::key *>(
_data ) ) );
_data ) );
}
}

View File

@@ -35,10 +35,14 @@ vstEffectControlDialog::vstEffectControlDialog( vstEffectControls * _ctl ) :
effectControlDialog( _ctl )
{
QVBoxLayout * l = new QVBoxLayout( this );
l->setMargin( 0 );
l->setSpacing( 0 );
_ctl->m_effect->m_plugin->showEditor( this );
QWidget * w = _ctl->m_effect->m_plugin->pluginWidget();
QWidget * w = _ctl->m_effect->m_plugin->pluginWidget( false );
if( w )
{
setWindowTitle( w->windowTitle() );
l->addWidget( w );
}
}

View File

@@ -87,7 +87,8 @@ src_callback_new (src_callback_t func, int converter_type, int channels, int *er
if (error != NULL)
*error = 0 ;
src_state = src_new (converter_type, channels, error) ;
if ((src_state = src_new (converter_type, channels, error)) == NULL)
return NULL ;
src_reset (src_state) ;
@@ -132,16 +133,13 @@ src_process (SRC_STATE *state, SRC_DATA *data)
if (data == NULL)
return SRC_ERR_BAD_DATA ;
/* Check src_ratio is in range. */
if (is_bad_src_ratio (data->src_ratio))
return SRC_ERR_BAD_SRC_RATIO ;
/* And that data_in and data_out are valid. */
if (data->data_in == NULL || data->data_out == NULL)
return SRC_ERR_BAD_DATA_PTR ;
if (data->data_in == NULL)
data->input_frames = 0 ;
/* Check src_ratio is in range. */
if (is_bad_src_ratio (data->src_ratio))
return SRC_ERR_BAD_SRC_RATIO ;
if (data->input_frames < 0)
data->input_frames = 0 ;
@@ -224,9 +222,13 @@ src_callback_read (SRC_STATE *state, double src_ratio, long frames, float *data)
output_frames_gen = 0 ;
while (output_frames_gen < frames)
{
{ /* Use a dummy array for the case where the callback function
** returns without setting the ptr.
*/
float dummy [1] ;
if (src_data.input_frames == 0)
{ float *ptr ;
{ float *ptr = dummy ;
src_data.input_frames = psrc->callback_func (psrc->user_callback_data, &ptr) ;
src_data.data_in = ptr ;

View File

@@ -54,42 +54,42 @@ typedef struct
static int
linear_vari_process (SRC_PRIVATE *psrc, SRC_DATA *data)
{ LINEAR_DATA *linear ;
{ LINEAR_DATA *priv ;
double src_ratio, input_index, rem ;
int ch ;
if (psrc->private_data == NULL)
return SRC_ERR_NO_PRIVATE ;
linear = (LINEAR_DATA*) psrc->private_data ;
priv = (LINEAR_DATA*) psrc->private_data ;
if (linear->reset)
if (priv->reset)
{ /* If we have just been reset, set the last_value data. */
for (ch = 0 ; ch < linear->channels ; ch++)
linear->last_value [ch] = data->data_in [ch] ;
linear->reset = 0 ;
for (ch = 0 ; ch < priv->channels ; ch++)
priv->last_value [ch] = data->data_in [ch] ;
priv->reset = 0 ;
} ;
linear->in_count = data->input_frames * linear->channels ;
linear->out_count = data->output_frames * linear->channels ;
linear->in_used = linear->out_gen = 0 ;
priv->in_count = data->input_frames * priv->channels ;
priv->out_count = data->output_frames * priv->channels ;
priv->in_used = priv->out_gen = 0 ;
src_ratio = psrc->last_ratio ;
input_index = psrc->last_position ;
/* Calculate samples before first sample in input array. */
while (input_index < 1.0 && linear->out_gen < linear->out_count)
while (input_index < 1.0 && priv->out_gen < priv->out_count)
{
if (linear->in_used + linear->channels * input_index > linear->in_count)
if (priv->in_used + priv->channels * (1.0 + input_index) >= priv->in_count)
break ;
if (linear->out_count > 0 && fabs (psrc->last_ratio - data->src_ratio) > SRC_MIN_RATIO_DIFF)
src_ratio = psrc->last_ratio + linear->out_gen * (data->src_ratio - psrc->last_ratio) / linear->out_count ;
if (priv->out_count > 0 && fabs (psrc->last_ratio - data->src_ratio) > SRC_MIN_RATIO_DIFF)
src_ratio = psrc->last_ratio + priv->out_gen * (data->src_ratio - psrc->last_ratio) / priv->out_count ;
for (ch = 0 ; ch < linear->channels ; ch++)
{ data->data_out [linear->out_gen] = (float) (linear->last_value [ch] + input_index *
(data->data_in [ch] - linear->last_value [ch])) ;
linear->out_gen ++ ;
for (ch = 0 ; ch < priv->channels ; ch++)
{ data->data_out [priv->out_gen] = (float) (priv->last_value [ch] + input_index *
(data->data_in [ch] - priv->last_value [ch])) ;
priv->out_gen ++ ;
} ;
/* Figure out the next index. */
@@ -97,50 +97,50 @@ linear_vari_process (SRC_PRIVATE *psrc, SRC_DATA *data)
} ;
rem = fmod_one (input_index) ;
linear->in_used += linear->channels * lrint (input_index - rem) ;
priv->in_used += priv->channels * lrint (input_index - rem) ;
input_index = rem ;
/* Main processing loop. */
while (linear->out_gen < linear->out_count && linear->in_used + linear->channels * input_index <= linear->in_count)
while (priv->out_gen < priv->out_count && priv->in_used + priv->channels * input_index < priv->in_count)
{
if (linear->out_count > 0 && fabs (psrc->last_ratio - data->src_ratio) > SRC_MIN_RATIO_DIFF)
src_ratio = psrc->last_ratio + linear->out_gen * (data->src_ratio - psrc->last_ratio) / linear->out_count ;
if (priv->out_count > 0 && fabs (psrc->last_ratio - data->src_ratio) > SRC_MIN_RATIO_DIFF)
src_ratio = psrc->last_ratio + priv->out_gen * (data->src_ratio - psrc->last_ratio) / priv->out_count ;
if (SRC_DEBUG && linear->in_used < linear->channels && input_index < 1.0)
{ printf ("Whoops!!!! in_used : %ld channels : %d input_index : %f\n", linear->in_used, linear->channels, input_index) ;
if (SRC_DEBUG && priv->in_used < priv->channels && input_index < 1.0)
{ printf ("Whoops!!!! in_used : %ld channels : %d input_index : %f\n", priv->in_used, priv->channels, input_index) ;
exit (1) ;
} ;
for (ch = 0 ; ch < linear->channels ; ch++)
{ data->data_out [linear->out_gen] = (float) (data->data_in [linear->in_used - linear->channels + ch] + input_index *
(data->data_in [linear->in_used + ch] - data->data_in [linear->in_used - linear->channels + ch])) ;
linear->out_gen ++ ;
for (ch = 0 ; ch < priv->channels ; ch++)
{ data->data_out [priv->out_gen] = (float) (data->data_in [priv->in_used - priv->channels + ch] + input_index *
(data->data_in [priv->in_used + ch] - data->data_in [priv->in_used - priv->channels + ch])) ;
priv->out_gen ++ ;
} ;
/* Figure out the next index. */
input_index += 1.0 / src_ratio ;
rem = fmod_one (input_index) ;
linear->in_used += linear->channels * lrint (input_index - rem) ;
priv->in_used += priv->channels * lrint (input_index - rem) ;
input_index = rem ;
} ;
if (linear->in_used > linear->in_count)
{ input_index += (linear->in_used - linear->in_count) / linear->channels ;
linear->in_used = linear->in_count ;
if (priv->in_used > priv->in_count)
{ input_index += (priv->in_used - priv->in_count) / priv->channels ;
priv->in_used = priv->in_count ;
} ;
psrc->last_position = input_index ;
if (linear->in_used > 0)
for (ch = 0 ; ch < linear->channels ; ch++)
linear->last_value [ch] = data->data_in [linear->in_used - linear->channels + ch] ;
if (priv->in_used > 0)
for (ch = 0 ; ch < priv->channels ; ch++)
priv->last_value [ch] = data->data_in [priv->in_used - priv->channels + ch] ;
/* Save current ratio rather then target ratio. */
psrc->last_ratio = src_ratio ;
data->input_frames_used = linear->in_used / linear->channels ;
data->output_frames_gen = linear->out_gen / linear->channels ;
data->input_frames_used = priv->in_used / priv->channels ;
data->output_frames_gen = priv->out_gen / priv->channels ;
return SRC_ERR_NO_ERROR ;
} /* linear_vari_process */
@@ -168,28 +168,25 @@ linear_get_description (int src_enum)
int
linear_set_converter (SRC_PRIVATE *psrc, int src_enum)
{ LINEAR_DATA *linear = NULL ;
{ LINEAR_DATA *priv = NULL ;
if (src_enum != SRC_LINEAR)
return SRC_ERR_BAD_CONVERTER ;
if (psrc->private_data != NULL)
{ linear = (LINEAR_DATA*) psrc->private_data ;
if (linear->linear_magic_marker != LINEAR_MAGIC_MARKER)
{ free (psrc->private_data) ;
psrc->private_data = NULL ;
} ;
{ free (psrc->private_data) ;
psrc->private_data = NULL ;
} ;
if (psrc->private_data == NULL)
{ linear = calloc (1, sizeof (*linear) + psrc->channels * sizeof (float)) ;
if (linear == NULL)
{ priv = calloc (1, sizeof (*priv) + psrc->channels * sizeof (float)) ;
if (priv == NULL)
return SRC_ERR_MALLOC_FAILED ;
psrc->private_data = linear ;
psrc->private_data = priv ;
} ;
linear->linear_magic_marker = LINEAR_MAGIC_MARKER ;
linear->channels = psrc->channels ;
priv->linear_magic_marker = LINEAR_MAGIC_MARKER ;
priv->channels = psrc->channels ;
psrc->const_process = linear_vari_process ;
psrc->vari_process = linear_vari_process ;
@@ -205,15 +202,16 @@ linear_set_converter (SRC_PRIVATE *psrc, int src_enum)
static void
linear_reset (SRC_PRIVATE *psrc)
{ LINEAR_DATA *linear = NULL ;
{ LINEAR_DATA *priv = NULL ;
linear = (LINEAR_DATA*) psrc->private_data ;
if (linear == NULL)
priv = (LINEAR_DATA*) psrc->private_data ;
if (priv == NULL)
return ;
linear->channels = psrc->channels ;
linear->reset = 1 ;
priv->channels = psrc->channels ;
priv->reset = 1 ;
memset (priv->last_value, 0, sizeof (priv->last_value [0]) * priv->channels) ;
memset (linear->last_value, 0, sizeof (linear->last_value [0]) * linear->channels) ;
return ;
} /* linear_reset */

View File

@@ -65,12 +65,16 @@ typedef struct
coeff_t const *coeffs ;
int b_current, b_end, b_real_end, b_len ;
float buffer [1] ;
/* C99 struct flexible array. */
float buffer [] ;
} SINC_FILTER ;
static int sinc_vari_process (SRC_PRIVATE *psrc, SRC_DATA *data) ;
static double calc_output (SINC_FILTER *filter, increment_t increment, increment_t start_filter_index, int ch) ;
static int sinc_multichan_vari_process (SRC_PRIVATE *psrc, SRC_DATA *data) ;
static int sinc_hex_vari_process (SRC_PRIVATE *psrc, SRC_DATA *data) ;
static int sinc_quad_vari_process (SRC_PRIVATE *psrc, SRC_DATA *data) ;
static int sinc_stereo_vari_process (SRC_PRIVATE *psrc, SRC_DATA *data) ;
static int sinc_mono_vari_process (SRC_PRIVATE *psrc, SRC_DATA *data) ;
static void prepare_data (SINC_FILTER *filter, SRC_DATA *data, int half_filter_chan_len) ;
@@ -78,9 +82,7 @@ static void sinc_reset (SRC_PRIVATE *psrc) ;
static inline increment_t
double_to_fp (double x)
{ if (sizeof (increment_t) == 8)
return (llrint ((x) * FP_ONE)) ;
return (lrint ((x) * FP_ONE)) ;
{ return (lrint ((x) * FP_ONE)) ;
} /* double_to_fp */
static inline increment_t
@@ -157,11 +159,8 @@ sinc_set_converter (SRC_PRIVATE *psrc, int src_enum)
return SRC_ERR_SHIFT_BITS ;
if (psrc->private_data != NULL)
{ filter = (SINC_FILTER*) psrc->private_data ;
if (filter->sinc_magic_marker != SINC_MAGIC_MARKER)
{ free (psrc->private_data) ;
psrc->private_data = NULL ;
} ;
{ free (psrc->private_data) ;
psrc->private_data = NULL ;
} ;
memset (&temp_filter, 0, sizeof (temp_filter)) ;
@@ -169,8 +168,29 @@ sinc_set_converter (SRC_PRIVATE *psrc, int src_enum)
temp_filter.sinc_magic_marker = SINC_MAGIC_MARKER ;
temp_filter.channels = psrc->channels ;
psrc->const_process = sinc_vari_process ;
psrc->vari_process = sinc_vari_process ;
if (psrc->channels == 1)
{ psrc->const_process = sinc_mono_vari_process ;
psrc->vari_process = sinc_mono_vari_process ;
}
else
if (psrc->channels == 2)
{ psrc->const_process = sinc_stereo_vari_process ;
psrc->vari_process = sinc_stereo_vari_process ;
}
else
if (psrc->channels == 4)
{ psrc->const_process = sinc_quad_vari_process ;
psrc->vari_process = sinc_quad_vari_process ;
}
else
if (psrc->channels == 6)
{ psrc->const_process = sinc_hex_vari_process ;
psrc->vari_process = sinc_hex_vari_process ;
}
else
{ psrc->const_process = sinc_multichan_vari_process ;
psrc->vari_process = sinc_multichan_vari_process ;
} ;
psrc->reset = sinc_reset ;
switch (src_enum)
@@ -248,12 +268,64 @@ sinc_reset (SRC_PRIVATE *psrc)
** Beware all ye who dare pass this point. There be dragons here.
*/
static inline double
calc_output_single (SINC_FILTER *filter, increment_t increment, increment_t start_filter_index)
{ double fraction, left, right, icoeff ;
increment_t filter_index, max_filter_index ;
int data_index, coeff_count, indx ;
/* Convert input parameters into fixed point. */
max_filter_index = int_to_fp (filter->coeff_half_len) ;
/* First apply the left half of the filter. */
filter_index = start_filter_index ;
coeff_count = (max_filter_index - filter_index) / increment ;
filter_index = filter_index + coeff_count * increment ;
data_index = filter->b_current - coeff_count ;
left = 0.0 ;
do
{ fraction = fp_to_double (filter_index) ;
indx = fp_to_int (filter_index) ;
icoeff = filter->coeffs [indx] + fraction * (filter->coeffs [indx + 1] - filter->coeffs [indx]) ;
left += icoeff * filter->buffer [data_index] ;
filter_index -= increment ;
data_index = data_index + 1 ;
}
while (filter_index >= MAKE_INCREMENT_T (0)) ;
/* Now apply the right half of the filter. */
filter_index = increment - start_filter_index ;
coeff_count = (max_filter_index - filter_index) / increment ;
filter_index = filter_index + coeff_count * increment ;
data_index = filter->b_current + 1 + coeff_count ;
right = 0.0 ;
do
{ fraction = fp_to_double (filter_index) ;
indx = fp_to_int (filter_index) ;
icoeff = filter->coeffs [indx] + fraction * (filter->coeffs [indx + 1] - filter->coeffs [indx]) ;
right += icoeff * filter->buffer [data_index] ;
filter_index -= increment ;
data_index = data_index - 1 ;
}
while (filter_index > MAKE_INCREMENT_T (0)) ;
return (left + right) ;
} /* calc_output_single */
static int
sinc_vari_process (SRC_PRIVATE *psrc, SRC_DATA *data)
sinc_mono_vari_process (SRC_PRIVATE *psrc, SRC_DATA *data)
{ SINC_FILTER *filter ;
double input_index, src_ratio, count, float_increment, terminate, rem ;
increment_t increment, start_filter_index ;
int half_filter_chan_len, samples_in_hand, ch ;
int half_filter_chan_len, samples_in_hand ;
if (psrc->private_data == NULL)
return SRC_ERR_NO_PRIVATE ;
@@ -318,11 +390,9 @@ sinc_vari_process (SRC_PRIVATE *psrc, SRC_DATA *data)
start_filter_index = double_to_fp (input_index * float_increment) ;
for (ch = 0 ; ch < filter->channels ; ch++)
{ data->data_out [filter->out_gen] = (float) ((float_increment / filter->index_inc) *
calc_output (filter, increment, start_filter_index, ch)) ;
filter->out_gen ++ ;
} ;
data->data_out [filter->out_gen] = (float) ((float_increment / filter->index_inc) *
calc_output_single (filter, increment, start_filter_index)) ;
filter->out_gen ++ ;
/* Figure out the next index. */
input_index += 1.0 / src_ratio ;
@@ -341,7 +411,709 @@ sinc_vari_process (SRC_PRIVATE *psrc, SRC_DATA *data)
data->output_frames_gen = filter->out_gen / filter->channels ;
return SRC_ERR_NO_ERROR ;
} /* sinc_vari_process */
} /* sinc_mono_vari_process */
static inline void
calc_output_stereo (SINC_FILTER *filter, increment_t increment, increment_t start_filter_index, double scale, float * output)
{ double fraction, left [2], right [2], icoeff ;
increment_t filter_index, max_filter_index ;
int data_index, coeff_count, indx ;
/* Convert input parameters into fixed point. */
max_filter_index = int_to_fp (filter->coeff_half_len) ;
/* First apply the left half of the filter. */
filter_index = start_filter_index ;
coeff_count = (max_filter_index - filter_index) / increment ;
filter_index = filter_index + coeff_count * increment ;
data_index = filter->b_current - filter->channels * coeff_count ;
left [0] = left [1] = 0.0 ;
do
{ fraction = fp_to_double (filter_index) ;
indx = fp_to_int (filter_index) ;
icoeff = filter->coeffs [indx] + fraction * (filter->coeffs [indx + 1] - filter->coeffs [indx]) ;
left [0] += icoeff * filter->buffer [data_index] ;
left [1] += icoeff * filter->buffer [data_index + 1] ;
filter_index -= increment ;
data_index = data_index + 2 ;
}
while (filter_index >= MAKE_INCREMENT_T (0)) ;
/* Now apply the right half of the filter. */
filter_index = increment - start_filter_index ;
coeff_count = (max_filter_index - filter_index) / increment ;
filter_index = filter_index + coeff_count * increment ;
data_index = filter->b_current + filter->channels * (1 + coeff_count) ;
right [0] = right [1] = 0.0 ;
do
{ fraction = fp_to_double (filter_index) ;
indx = fp_to_int (filter_index) ;
icoeff = filter->coeffs [indx] + fraction * (filter->coeffs [indx + 1] - filter->coeffs [indx]) ;
right [0] += icoeff * filter->buffer [data_index] ;
right [1] += icoeff * filter->buffer [data_index + 1] ;
filter_index -= increment ;
data_index = data_index - 2 ;
}
while (filter_index > MAKE_INCREMENT_T (0)) ;
output [0] = scale * (left [0] + right [0]) ;
output [1] = scale * (left [1] + right [1]) ;
} /* calc_output_stereo */
static int
sinc_stereo_vari_process (SRC_PRIVATE *psrc, SRC_DATA *data)
{ SINC_FILTER *filter ;
double input_index, src_ratio, count, float_increment, terminate, rem ;
increment_t increment, start_filter_index ;
int half_filter_chan_len, samples_in_hand ;
if (psrc->private_data == NULL)
return SRC_ERR_NO_PRIVATE ;
filter = (SINC_FILTER*) psrc->private_data ;
/* If there is not a problem, this will be optimised out. */
if (sizeof (filter->buffer [0]) != sizeof (data->data_in [0]))
return SRC_ERR_SIZE_INCOMPATIBILITY ;
filter->in_count = data->input_frames * filter->channels ;
filter->out_count = data->output_frames * filter->channels ;
filter->in_used = filter->out_gen = 0 ;
src_ratio = psrc->last_ratio ;
/* Check the sample rate ratio wrt the buffer len. */
count = (filter->coeff_half_len + 2.0) / filter->index_inc ;
if (MIN (psrc->last_ratio, data->src_ratio) < 1.0)
count /= MIN (psrc->last_ratio, data->src_ratio) ;
/* Maximum coefficientson either side of center point. */
half_filter_chan_len = filter->channels * (lrint (count) + 1) ;
input_index = psrc->last_position ;
float_increment = filter->index_inc ;
rem = fmod_one (input_index) ;
filter->b_current = (filter->b_current + filter->channels * lrint (input_index - rem)) % filter->b_len ;
input_index = rem ;
terminate = 1.0 / src_ratio + 1e-20 ;
/* Main processing loop. */
while (filter->out_gen < filter->out_count)
{
/* Need to reload buffer? */
samples_in_hand = (filter->b_end - filter->b_current + filter->b_len) % filter->b_len ;
if (samples_in_hand <= half_filter_chan_len)
{ prepare_data (filter, data, half_filter_chan_len) ;
samples_in_hand = (filter->b_end - filter->b_current + filter->b_len) % filter->b_len ;
if (samples_in_hand <= half_filter_chan_len)
break ;
} ;
/* This is the termination condition. */
if (filter->b_real_end >= 0)
{ if (filter->b_current + input_index + terminate >= filter->b_real_end)
break ;
} ;
if (filter->out_count > 0 && fabs (psrc->last_ratio - data->src_ratio) > 1e-10)
src_ratio = psrc->last_ratio + filter->out_gen * (data->src_ratio - psrc->last_ratio) / filter->out_count ;
float_increment = filter->index_inc * 1.0 ;
if (src_ratio < 1.0)
float_increment = filter->index_inc * src_ratio ;
increment = double_to_fp (float_increment) ;
start_filter_index = double_to_fp (input_index * float_increment) ;
calc_output_stereo (filter, increment, start_filter_index, float_increment / filter->index_inc, data->data_out + filter->out_gen) ;
filter->out_gen += 2 ;
/* Figure out the next index. */
input_index += 1.0 / src_ratio ;
rem = fmod_one (input_index) ;
filter->b_current = (filter->b_current + filter->channels * lrint (input_index - rem)) % filter->b_len ;
input_index = rem ;
} ;
psrc->last_position = input_index ;
/* Save current ratio rather then target ratio. */
psrc->last_ratio = src_ratio ;
data->input_frames_used = filter->in_used / filter->channels ;
data->output_frames_gen = filter->out_gen / filter->channels ;
return SRC_ERR_NO_ERROR ;
} /* sinc_stereo_vari_process */
static inline void
calc_output_quad (SINC_FILTER *filter, increment_t increment, increment_t start_filter_index, double scale, float * output)
{ double fraction, left [4], right [4], icoeff ;
increment_t filter_index, max_filter_index ;
int data_index, coeff_count, indx ;
/* Convert input parameters into fixed point. */
max_filter_index = int_to_fp (filter->coeff_half_len) ;
/* First apply the left half of the filter. */
filter_index = start_filter_index ;
coeff_count = (max_filter_index - filter_index) / increment ;
filter_index = filter_index + coeff_count * increment ;
data_index = filter->b_current - filter->channels * coeff_count ;
left [0] = left [1] = left [2] = left [3] = 0.0 ;
do
{ fraction = fp_to_double (filter_index) ;
indx = fp_to_int (filter_index) ;
icoeff = filter->coeffs [indx] + fraction * (filter->coeffs [indx + 1] - filter->coeffs [indx]) ;
left [0] += icoeff * filter->buffer [data_index] ;
left [1] += icoeff * filter->buffer [data_index + 1] ;
left [2] += icoeff * filter->buffer [data_index + 2] ;
left [3] += icoeff * filter->buffer [data_index + 3] ;
filter_index -= increment ;
data_index = data_index + 4 ;
}
while (filter_index >= MAKE_INCREMENT_T (0)) ;
/* Now apply the right half of the filter. */
filter_index = increment - start_filter_index ;
coeff_count = (max_filter_index - filter_index) / increment ;
filter_index = filter_index + coeff_count * increment ;
data_index = filter->b_current + filter->channels * (1 + coeff_count) ;
right [0] = right [1] = right [2] = right [3] = 0.0 ;
do
{ fraction = fp_to_double (filter_index) ;
indx = fp_to_int (filter_index) ;
icoeff = filter->coeffs [indx] + fraction * (filter->coeffs [indx + 1] - filter->coeffs [indx]) ;
right [0] += icoeff * filter->buffer [data_index] ;
right [1] += icoeff * filter->buffer [data_index + 1] ;
right [2] += icoeff * filter->buffer [data_index + 2] ;
right [3] += icoeff * filter->buffer [data_index + 3] ;
filter_index -= increment ;
data_index = data_index - 4 ;
}
while (filter_index > MAKE_INCREMENT_T (0)) ;
output [0] = scale * (left [0] + right [0]) ;
output [1] = scale * (left [1] + right [1]) ;
output [2] = scale * (left [2] + right [2]) ;
output [3] = scale * (left [3] + right [3]) ;
} /* calc_output_quad */
static int
sinc_quad_vari_process (SRC_PRIVATE *psrc, SRC_DATA *data)
{ SINC_FILTER *filter ;
double input_index, src_ratio, count, float_increment, terminate, rem ;
increment_t increment, start_filter_index ;
int half_filter_chan_len, samples_in_hand ;
if (psrc->private_data == NULL)
return SRC_ERR_NO_PRIVATE ;
filter = (SINC_FILTER*) psrc->private_data ;
/* If there is not a problem, this will be optimised out. */
if (sizeof (filter->buffer [0]) != sizeof (data->data_in [0]))
return SRC_ERR_SIZE_INCOMPATIBILITY ;
filter->in_count = data->input_frames * filter->channels ;
filter->out_count = data->output_frames * filter->channels ;
filter->in_used = filter->out_gen = 0 ;
src_ratio = psrc->last_ratio ;
/* Check the sample rate ratio wrt the buffer len. */
count = (filter->coeff_half_len + 2.0) / filter->index_inc ;
if (MIN (psrc->last_ratio, data->src_ratio) < 1.0)
count /= MIN (psrc->last_ratio, data->src_ratio) ;
/* Maximum coefficientson either side of center point. */
half_filter_chan_len = filter->channels * (lrint (count) + 1) ;
input_index = psrc->last_position ;
float_increment = filter->index_inc ;
rem = fmod_one (input_index) ;
filter->b_current = (filter->b_current + filter->channels * lrint (input_index - rem)) % filter->b_len ;
input_index = rem ;
terminate = 1.0 / src_ratio + 1e-20 ;
/* Main processing loop. */
while (filter->out_gen < filter->out_count)
{
/* Need to reload buffer? */
samples_in_hand = (filter->b_end - filter->b_current + filter->b_len) % filter->b_len ;
if (samples_in_hand <= half_filter_chan_len)
{ prepare_data (filter, data, half_filter_chan_len) ;
samples_in_hand = (filter->b_end - filter->b_current + filter->b_len) % filter->b_len ;
if (samples_in_hand <= half_filter_chan_len)
break ;
} ;
/* This is the termination condition. */
if (filter->b_real_end >= 0)
{ if (filter->b_current + input_index + terminate >= filter->b_real_end)
break ;
} ;
if (filter->out_count > 0 && fabs (psrc->last_ratio - data->src_ratio) > 1e-10)
src_ratio = psrc->last_ratio + filter->out_gen * (data->src_ratio - psrc->last_ratio) / filter->out_count ;
float_increment = filter->index_inc * 1.0 ;
if (src_ratio < 1.0)
float_increment = filter->index_inc * src_ratio ;
increment = double_to_fp (float_increment) ;
start_filter_index = double_to_fp (input_index * float_increment) ;
calc_output_quad (filter, increment, start_filter_index, float_increment / filter->index_inc, data->data_out + filter->out_gen) ;
filter->out_gen += 4 ;
/* Figure out the next index. */
input_index += 1.0 / src_ratio ;
rem = fmod_one (input_index) ;
filter->b_current = (filter->b_current + filter->channels * lrint (input_index - rem)) % filter->b_len ;
input_index = rem ;
} ;
psrc->last_position = input_index ;
/* Save current ratio rather then target ratio. */
psrc->last_ratio = src_ratio ;
data->input_frames_used = filter->in_used / filter->channels ;
data->output_frames_gen = filter->out_gen / filter->channels ;
return SRC_ERR_NO_ERROR ;
} /* sinc_quad_vari_process */
static inline void
calc_output_hex (SINC_FILTER *filter, increment_t increment, increment_t start_filter_index, double scale, float * output)
{ double fraction, left [6], right [6], icoeff ;
increment_t filter_index, max_filter_index ;
int data_index, coeff_count, indx ;
/* Convert input parameters into fixed point. */
max_filter_index = int_to_fp (filter->coeff_half_len) ;
/* First apply the left half of the filter. */
filter_index = start_filter_index ;
coeff_count = (max_filter_index - filter_index) / increment ;
filter_index = filter_index + coeff_count * increment ;
data_index = filter->b_current - filter->channels * coeff_count ;
left [0] = left [1] = left [2] = left [3] = left [4] = left [5] = 0.0 ;
do
{ fraction = fp_to_double (filter_index) ;
indx = fp_to_int (filter_index) ;
icoeff = filter->coeffs [indx] + fraction * (filter->coeffs [indx + 1] - filter->coeffs [indx]) ;
left [0] += icoeff * filter->buffer [data_index] ;
left [1] += icoeff * filter->buffer [data_index + 1] ;
left [2] += icoeff * filter->buffer [data_index + 2] ;
left [3] += icoeff * filter->buffer [data_index + 3] ;
left [4] += icoeff * filter->buffer [data_index + 4] ;
left [5] += icoeff * filter->buffer [data_index + 5] ;
filter_index -= increment ;
data_index = data_index + 6 ;
}
while (filter_index >= MAKE_INCREMENT_T (0)) ;
/* Now apply the right half of the filter. */
filter_index = increment - start_filter_index ;
coeff_count = (max_filter_index - filter_index) / increment ;
filter_index = filter_index + coeff_count * increment ;
data_index = filter->b_current + filter->channels * (1 + coeff_count) ;
right [0] = right [1] = right [2] = right [3] = right [4] = right [5] = 0.0 ;
do
{ fraction = fp_to_double (filter_index) ;
indx = fp_to_int (filter_index) ;
icoeff = filter->coeffs [indx] + fraction * (filter->coeffs [indx + 1] - filter->coeffs [indx]) ;
right [0] += icoeff * filter->buffer [data_index] ;
right [1] += icoeff * filter->buffer [data_index + 1] ;
right [2] += icoeff * filter->buffer [data_index + 2] ;
right [3] += icoeff * filter->buffer [data_index + 3] ;
right [4] += icoeff * filter->buffer [data_index + 4] ;
right [5] += icoeff * filter->buffer [data_index + 5] ;
filter_index -= increment ;
data_index = data_index - 6 ;
}
while (filter_index > MAKE_INCREMENT_T (0)) ;
output [0] = scale * (left [0] + right [0]) ;
output [1] = scale * (left [1] + right [1]) ;
output [2] = scale * (left [2] + right [2]) ;
output [3] = scale * (left [3] + right [3]) ;
output [4] = scale * (left [4] + right [4]) ;
output [5] = scale * (left [5] + right [5]) ;
} /* calc_output_hex */
static int
sinc_hex_vari_process (SRC_PRIVATE *psrc, SRC_DATA *data)
{ SINC_FILTER *filter ;
double input_index, src_ratio, count, float_increment, terminate, rem ;
increment_t increment, start_filter_index ;
int half_filter_chan_len, samples_in_hand ;
if (psrc->private_data == NULL)
return SRC_ERR_NO_PRIVATE ;
filter = (SINC_FILTER*) psrc->private_data ;
/* If there is not a problem, this will be optimised out. */
if (sizeof (filter->buffer [0]) != sizeof (data->data_in [0]))
return SRC_ERR_SIZE_INCOMPATIBILITY ;
filter->in_count = data->input_frames * filter->channels ;
filter->out_count = data->output_frames * filter->channels ;
filter->in_used = filter->out_gen = 0 ;
src_ratio = psrc->last_ratio ;
/* Check the sample rate ratio wrt the buffer len. */
count = (filter->coeff_half_len + 2.0) / filter->index_inc ;
if (MIN (psrc->last_ratio, data->src_ratio) < 1.0)
count /= MIN (psrc->last_ratio, data->src_ratio) ;
/* Maximum coefficientson either side of center point. */
half_filter_chan_len = filter->channels * (lrint (count) + 1) ;
input_index = psrc->last_position ;
float_increment = filter->index_inc ;
rem = fmod_one (input_index) ;
filter->b_current = (filter->b_current + filter->channels * lrint (input_index - rem)) % filter->b_len ;
input_index = rem ;
terminate = 1.0 / src_ratio + 1e-20 ;
/* Main processing loop. */
while (filter->out_gen < filter->out_count)
{
/* Need to reload buffer? */
samples_in_hand = (filter->b_end - filter->b_current + filter->b_len) % filter->b_len ;
if (samples_in_hand <= half_filter_chan_len)
{ prepare_data (filter, data, half_filter_chan_len) ;
samples_in_hand = (filter->b_end - filter->b_current + filter->b_len) % filter->b_len ;
if (samples_in_hand <= half_filter_chan_len)
break ;
} ;
/* This is the termination condition. */
if (filter->b_real_end >= 0)
{ if (filter->b_current + input_index + terminate >= filter->b_real_end)
break ;
} ;
if (filter->out_count > 0 && fabs (psrc->last_ratio - data->src_ratio) > 1e-10)
src_ratio = psrc->last_ratio + filter->out_gen * (data->src_ratio - psrc->last_ratio) / filter->out_count ;
float_increment = filter->index_inc * 1.0 ;
if (src_ratio < 1.0)
float_increment = filter->index_inc * src_ratio ;
increment = double_to_fp (float_increment) ;
start_filter_index = double_to_fp (input_index * float_increment) ;
calc_output_hex (filter, increment, start_filter_index, float_increment / filter->index_inc, data->data_out + filter->out_gen) ;
filter->out_gen += 6 ;
/* Figure out the next index. */
input_index += 1.0 / src_ratio ;
rem = fmod_one (input_index) ;
filter->b_current = (filter->b_current + filter->channels * lrint (input_index - rem)) % filter->b_len ;
input_index = rem ;
} ;
psrc->last_position = input_index ;
/* Save current ratio rather then target ratio. */
psrc->last_ratio = src_ratio ;
data->input_frames_used = filter->in_used / filter->channels ;
data->output_frames_gen = filter->out_gen / filter->channels ;
return SRC_ERR_NO_ERROR ;
} /* sinc_hex_vari_process */
static inline void
calc_output_multi (SINC_FILTER *filter, increment_t increment, increment_t start_filter_index, int channels, double scale, float * output)
{ double fraction, icoeff ;
/* The following line is 1999 ISO Standard C. If your compiler complains, get a better compiler. */
double left [channels], right [channels] ;
increment_t filter_index, max_filter_index ;
int data_index, coeff_count, indx, ch ;
/* Convert input parameters into fixed point. */
max_filter_index = int_to_fp (filter->coeff_half_len) ;
/* First apply the left half of the filter. */
filter_index = start_filter_index ;
coeff_count = (max_filter_index - filter_index) / increment ;
filter_index = filter_index + coeff_count * increment ;
data_index = filter->b_current - channels * coeff_count ;
memset (left, 0, sizeof (left)) ;
do
{ fraction = fp_to_double (filter_index) ;
indx = fp_to_int (filter_index) ;
icoeff = filter->coeffs [indx] + fraction * (filter->coeffs [indx + 1] - filter->coeffs [indx]) ;
/*
** Duff's Device.
** See : http://en.wikipedia.org/wiki/Duff's_device
*/
ch = channels ;
do
{
switch (ch % 8)
{ default :
ch -- ;
left [ch] += icoeff * filter->buffer [data_index + ch] ;
case 7 :
ch -- ;
left [ch] += icoeff * filter->buffer [data_index + ch] ;
case 6 :
ch -- ;
left [ch] += icoeff * filter->buffer [data_index + ch] ;
case 5 :
ch -- ;
left [ch] += icoeff * filter->buffer [data_index + ch] ;
case 4 :
ch -- ;
left [ch] += icoeff * filter->buffer [data_index + ch] ;
case 3 :
ch -- ;
left [ch] += icoeff * filter->buffer [data_index + ch] ;
case 2 :
ch -- ;
left [ch] += icoeff * filter->buffer [data_index + ch] ;
case 1 :
ch -- ;
left [ch] += icoeff * filter->buffer [data_index + ch] ;
} ;
}
while (ch > 0) ;
filter_index -= increment ;
data_index = data_index + channels ;
}
while (filter_index >= MAKE_INCREMENT_T (0)) ;
/* Now apply the right half of the filter. */
filter_index = increment - start_filter_index ;
coeff_count = (max_filter_index - filter_index) / increment ;
filter_index = filter_index + coeff_count * increment ;
data_index = filter->b_current + channels * (1 + coeff_count) ;
memset (right, 0, sizeof (right)) ;
do
{ fraction = fp_to_double (filter_index) ;
indx = fp_to_int (filter_index) ;
icoeff = filter->coeffs [indx] + fraction * (filter->coeffs [indx + 1] - filter->coeffs [indx]) ;
ch = channels ;
do
{
switch (ch % 8)
{ default :
ch -- ;
right [ch] += icoeff * filter->buffer [data_index + ch] ;
case 7 :
ch -- ;
right [ch] += icoeff * filter->buffer [data_index + ch] ;
case 6 :
ch -- ;
right [ch] += icoeff * filter->buffer [data_index + ch] ;
case 5 :
ch -- ;
right [ch] += icoeff * filter->buffer [data_index + ch] ;
case 4 :
ch -- ;
right [ch] += icoeff * filter->buffer [data_index + ch] ;
case 3 :
ch -- ;
right [ch] += icoeff * filter->buffer [data_index + ch] ;
case 2 :
ch -- ;
right [ch] += icoeff * filter->buffer [data_index + ch] ;
case 1 :
ch -- ;
right [ch] += icoeff * filter->buffer [data_index + ch] ;
} ;
}
while (ch > 0) ;
filter_index -= increment ;
data_index = data_index - channels ;
}
while (filter_index > MAKE_INCREMENT_T (0)) ;
ch = channels ;
do
{
switch (ch % 8)
{ default :
ch -- ;
output [ch] = scale * (left [ch] + right [ch]) ;
case 7 :
ch -- ;
output [ch] = scale * (left [ch] + right [ch]) ;
case 6 :
ch -- ;
output [ch] = scale * (left [ch] + right [ch]) ;
case 5 :
ch -- ;
output [ch] = scale * (left [ch] + right [ch]) ;
case 4 :
ch -- ;
output [ch] = scale * (left [ch] + right [ch]) ;
case 3 :
ch -- ;
output [ch] = scale * (left [ch] + right [ch]) ;
case 2 :
ch -- ;
output [ch] = scale * (left [ch] + right [ch]) ;
case 1 :
ch -- ;
output [ch] = scale * (left [ch] + right [ch]) ;
} ;
}
while (ch > 0) ;
return ;
} /* calc_output_multi */
static int
sinc_multichan_vari_process (SRC_PRIVATE *psrc, SRC_DATA *data)
{ SINC_FILTER *filter ;
double input_index, src_ratio, count, float_increment, terminate, rem ;
increment_t increment, start_filter_index ;
int half_filter_chan_len, samples_in_hand ;
if (psrc->private_data == NULL)
return SRC_ERR_NO_PRIVATE ;
filter = (SINC_FILTER*) psrc->private_data ;
/* If there is not a problem, this will be optimised out. */
if (sizeof (filter->buffer [0]) != sizeof (data->data_in [0]))
return SRC_ERR_SIZE_INCOMPATIBILITY ;
filter->in_count = data->input_frames * filter->channels ;
filter->out_count = data->output_frames * filter->channels ;
filter->in_used = filter->out_gen = 0 ;
src_ratio = psrc->last_ratio ;
/* Check the sample rate ratio wrt the buffer len. */
count = (filter->coeff_half_len + 2.0) / filter->index_inc ;
if (MIN (psrc->last_ratio, data->src_ratio) < 1.0)
count /= MIN (psrc->last_ratio, data->src_ratio) ;
/* Maximum coefficientson either side of center point. */
half_filter_chan_len = filter->channels * (lrint (count) + 1) ;
input_index = psrc->last_position ;
float_increment = filter->index_inc ;
rem = fmod_one (input_index) ;
filter->b_current = (filter->b_current + filter->channels * lrint (input_index - rem)) % filter->b_len ;
input_index = rem ;
terminate = 1.0 / src_ratio + 1e-20 ;
/* Main processing loop. */
while (filter->out_gen < filter->out_count)
{
/* Need to reload buffer? */
samples_in_hand = (filter->b_end - filter->b_current + filter->b_len) % filter->b_len ;
if (samples_in_hand <= half_filter_chan_len)
{ prepare_data (filter, data, half_filter_chan_len) ;
samples_in_hand = (filter->b_end - filter->b_current + filter->b_len) % filter->b_len ;
if (samples_in_hand <= half_filter_chan_len)
break ;
} ;
/* This is the termination condition. */
if (filter->b_real_end >= 0)
{ if (filter->b_current + input_index + terminate >= filter->b_real_end)
break ;
} ;
if (filter->out_count > 0 && fabs (psrc->last_ratio - data->src_ratio) > 1e-10)
src_ratio = psrc->last_ratio + filter->out_gen * (data->src_ratio - psrc->last_ratio) / filter->out_count ;
float_increment = filter->index_inc * 1.0 ;
if (src_ratio < 1.0)
float_increment = filter->index_inc * src_ratio ;
increment = double_to_fp (float_increment) ;
start_filter_index = double_to_fp (input_index * float_increment) ;
calc_output_multi (filter, increment, start_filter_index, filter->channels, float_increment / filter->index_inc, data->data_out + filter->out_gen) ;
filter->out_gen += psrc->channels ;
/* Figure out the next index. */
input_index += 1.0 / src_ratio ;
rem = fmod_one (input_index) ;
filter->b_current = (filter->b_current + filter->channels * lrint (input_index - rem)) % filter->b_len ;
input_index = rem ;
} ;
psrc->last_position = input_index ;
/* Save current ratio rather then target ratio. */
psrc->last_ratio = src_ratio ;
data->input_frames_used = filter->in_used / filter->channels ;
data->output_frames_gen = filter->out_gen / filter->channels ;
return SRC_ERR_NO_ERROR ;
} /* sinc_multichan_vari_process */
/*----------------------------------------------------------------------------------------
*/
@@ -414,55 +1186,3 @@ prepare_data (SINC_FILTER *filter, SRC_DATA *data, int half_filter_chan_len)
} /* prepare_data */
static double
calc_output (SINC_FILTER *filter, increment_t increment, increment_t start_filter_index, int ch)
{ double fraction, left, right, icoeff ;
increment_t filter_index, max_filter_index ;
int data_index, coeff_count, indx ;
/* Convert input parameters into fixed point. */
max_filter_index = int_to_fp (filter->coeff_half_len) ;
/* First apply the left half of the filter. */
filter_index = start_filter_index ;
coeff_count = (max_filter_index - filter_index) / increment ;
filter_index = filter_index + coeff_count * increment ;
data_index = filter->b_current - filter->channels * coeff_count + ch ;
left = 0.0 ;
do
{ fraction = fp_to_double (filter_index) ;
indx = fp_to_int (filter_index) ;
icoeff = filter->coeffs [indx] + fraction * (filter->coeffs [indx + 1] - filter->coeffs [indx]) ;
left += icoeff * filter->buffer [data_index] ;
filter_index -= increment ;
data_index = data_index + filter->channels ;
}
while (filter_index >= MAKE_INCREMENT_T (0)) ;
/* Now apply the right half of the filter. */
filter_index = increment - start_filter_index ;
coeff_count = (max_filter_index - filter_index) / increment ;
filter_index = filter_index + coeff_count * increment ;
data_index = filter->b_current + filter->channels * (1 + coeff_count) + ch ;
right = 0.0 ;
do
{ fraction = fp_to_double (filter_index) ;
indx = fp_to_int (filter_index) ;
icoeff = filter->coeffs [indx] + fraction * (filter->coeffs [indx + 1] - filter->coeffs [indx]) ;
right += icoeff * filter->buffer [data_index] ;
filter_index -= increment ;
data_index = data_index - filter->channels ;
}
while (filter_index > MAKE_INCREMENT_T (0)) ;
return (left + right) ;
} /* calc_output */

View File

@@ -52,41 +52,41 @@ typedef struct
static int
zoh_vari_process (SRC_PRIVATE *psrc, SRC_DATA *data)
{ ZOH_DATA *zoh ;
{ ZOH_DATA *priv ;
double src_ratio, input_index, rem ;
int ch ;
if (psrc->private_data == NULL)
return SRC_ERR_NO_PRIVATE ;
zoh = (ZOH_DATA*) psrc->private_data ;
priv = (ZOH_DATA*) psrc->private_data ;
if (zoh->reset)
if (priv->reset)
{ /* If we have just been reset, set the last_value data. */
for (ch = 0 ; ch < zoh->channels ; ch++)
zoh->last_value [ch] = data->data_in [ch] ;
zoh->reset = 0 ;
for (ch = 0 ; ch < priv->channels ; ch++)
priv->last_value [ch] = data->data_in [ch] ;
priv->reset = 0 ;
} ;
zoh->in_count = data->input_frames * zoh->channels ;
zoh->out_count = data->output_frames * zoh->channels ;
zoh->in_used = zoh->out_gen = 0 ;
priv->in_count = data->input_frames * priv->channels ;
priv->out_count = data->output_frames * priv->channels ;
priv->in_used = priv->out_gen = 0 ;
src_ratio = psrc->last_ratio ;
input_index = psrc->last_position ;
/* Calculate samples before first sample in input array. */
while (input_index < 1.0 && zoh->out_gen < zoh->out_count)
while (input_index < 1.0 && priv->out_gen < priv->out_count)
{
if (zoh->in_used + zoh->channels * input_index >= zoh->in_count)
if (priv->in_used + priv->channels * input_index >= priv->in_count)
break ;
if (zoh->out_count > 0 && fabs (psrc->last_ratio - data->src_ratio) > SRC_MIN_RATIO_DIFF)
src_ratio = psrc->last_ratio + zoh->out_gen * (data->src_ratio - psrc->last_ratio) / zoh->out_count ;
if (priv->out_count > 0 && fabs (psrc->last_ratio - data->src_ratio) > SRC_MIN_RATIO_DIFF)
src_ratio = psrc->last_ratio + priv->out_gen * (data->src_ratio - psrc->last_ratio) / priv->out_count ;
for (ch = 0 ; ch < zoh->channels ; ch++)
{ data->data_out [zoh->out_gen] = zoh->last_value [ch] ;
zoh->out_gen ++ ;
for (ch = 0 ; ch < priv->channels ; ch++)
{ data->data_out [priv->out_gen] = priv->last_value [ch] ;
priv->out_gen ++ ;
} ;
/* Figure out the next index. */
@@ -94,44 +94,44 @@ zoh_vari_process (SRC_PRIVATE *psrc, SRC_DATA *data)
} ;
rem = fmod_one (input_index) ;
zoh->in_used += zoh->channels * lrint (input_index - rem) ;
priv->in_used += priv->channels * lrint (input_index - rem) ;
input_index = rem ;
/* Main processing loop. */
while (zoh->out_gen < zoh->out_count && zoh->in_used + zoh->channels * input_index <= zoh->in_count)
while (priv->out_gen < priv->out_count && priv->in_used + priv->channels * input_index <= priv->in_count)
{
if (zoh->out_count > 0 && fabs (psrc->last_ratio - data->src_ratio) > SRC_MIN_RATIO_DIFF)
src_ratio = psrc->last_ratio + zoh->out_gen * (data->src_ratio - psrc->last_ratio) / zoh->out_count ;
if (priv->out_count > 0 && fabs (psrc->last_ratio - data->src_ratio) > SRC_MIN_RATIO_DIFF)
src_ratio = psrc->last_ratio + priv->out_gen * (data->src_ratio - psrc->last_ratio) / priv->out_count ;
for (ch = 0 ; ch < zoh->channels ; ch++)
{ data->data_out [zoh->out_gen] = data->data_in [zoh->in_used - zoh->channels + ch] ;
zoh->out_gen ++ ;
for (ch = 0 ; ch < priv->channels ; ch++)
{ data->data_out [priv->out_gen] = data->data_in [priv->in_used - priv->channels + ch] ;
priv->out_gen ++ ;
} ;
/* Figure out the next index. */
input_index += 1.0 / src_ratio ;
rem = fmod_one (input_index) ;
zoh->in_used += zoh->channels * lrint (input_index - rem) ;
priv->in_used += priv->channels * lrint (input_index - rem) ;
input_index = rem ;
} ;
if (zoh->in_used > zoh->in_count)
{ input_index += (zoh->in_used - zoh->in_count) / zoh->channels ;
zoh->in_used = zoh->in_count ;
if (priv->in_used > priv->in_count)
{ input_index += (priv->in_used - priv->in_count) / priv->channels ;
priv->in_used = priv->in_count ;
} ;
psrc->last_position = input_index ;
if (zoh->in_used > 0)
for (ch = 0 ; ch < zoh->channels ; ch++)
zoh->last_value [ch] = data->data_in [zoh->in_used - zoh->channels + ch] ;
if (priv->in_used > 0)
for (ch = 0 ; ch < priv->channels ; ch++)
priv->last_value [ch] = data->data_in [priv->in_used - priv->channels + ch] ;
/* Save current ratio rather then target ratio. */
psrc->last_ratio = src_ratio ;
data->input_frames_used = zoh->in_used / zoh->channels ;
data->output_frames_gen = zoh->out_gen / zoh->channels ;
data->input_frames_used = priv->in_used / priv->channels ;
data->output_frames_gen = priv->out_gen / priv->channels ;
return SRC_ERR_NO_ERROR ;
} /* zoh_vari_process */
@@ -159,28 +159,25 @@ zoh_get_description (int src_enum)
int
zoh_set_converter (SRC_PRIVATE *psrc, int src_enum)
{ ZOH_DATA *zoh = NULL ;
{ ZOH_DATA *priv = NULL ;
if (src_enum != SRC_ZERO_ORDER_HOLD)
return SRC_ERR_BAD_CONVERTER ;
if (psrc->private_data != NULL)
{ zoh = (ZOH_DATA*) psrc->private_data ;
if (zoh->zoh_magic_marker != ZOH_MAGIC_MARKER)
{ free (psrc->private_data) ;
psrc->private_data = NULL ;
} ;
{ free (psrc->private_data) ;
psrc->private_data = NULL ;
} ;
if (psrc->private_data == NULL)
{ zoh = calloc (1, sizeof (*zoh) + psrc->channels * sizeof (float)) ;
if (zoh == NULL)
{ priv = calloc (1, sizeof (*priv) + psrc->channels * sizeof (float)) ;
if (priv == NULL)
return SRC_ERR_MALLOC_FAILED ;
psrc->private_data = zoh ;
psrc->private_data = priv ;
} ;
zoh->zoh_magic_marker = ZOH_MAGIC_MARKER ;
zoh->channels = psrc->channels ;
priv->zoh_magic_marker = ZOH_MAGIC_MARKER ;
priv->channels = psrc->channels ;
psrc->const_process = zoh_vari_process ;
psrc->vari_process = zoh_vari_process ;
@@ -196,15 +193,15 @@ zoh_set_converter (SRC_PRIVATE *psrc, int src_enum)
static void
zoh_reset (SRC_PRIVATE *psrc)
{ ZOH_DATA *zoh ;
{ ZOH_DATA *priv ;
zoh = (ZOH_DATA*) psrc->private_data ;
if (zoh == NULL)
priv = (ZOH_DATA*) psrc->private_data ;
if (priv == NULL)
return ;
zoh->channels = psrc->channels ;
zoh->reset = 1 ;
memset (zoh->last_value, 0, sizeof (zoh->last_value [0]) * zoh->channels) ;
priv->channels = psrc->channels ;
priv->reset = 1 ;
memset (priv->last_value, 0, sizeof (priv->last_value [0]) * priv->channels) ;
return ;
} /* zoh_reset */

View File

@@ -52,7 +52,9 @@ automatableModel::automatableModel( DataType _type,
m_maxValue( _max ),
m_step( _step ),
m_range( _max - _min ),
m_journalEntryReady( FALSE ),
m_journalEntryReady( false ),
m_setValueDepth( 0 ),
m_hasLinkedModels( false ),
m_controllerConnection( NULL )
{
}
@@ -62,7 +64,7 @@ automatableModel::automatableModel( DataType _type,
automatableModel::~automatableModel()
{
while( m_linkedModels.empty() == FALSE )
while( m_linkedModels.empty() == false )
{
m_linkedModels.last()->unlinkModel( this );
m_linkedModels.erase( m_linkedModels.end() - 1 );
@@ -81,7 +83,7 @@ automatableModel::~automatableModel()
bool automatableModel::isAutomated( void ) const
{
return( automationPattern::isAutomated( this ) );
return automationPattern::isAutomated( this );
}
@@ -176,6 +178,7 @@ void automatableModel::loadSettings( const QDomElement & _this,
void automatableModel::setValue( const float _value )
{
++m_setValueDepth;
const float old_val = m_value;
m_value = fittedValue( _value );
@@ -189,13 +192,13 @@ void automatableModel::setValue( const float _value )
m_linkedModels.begin();
it != m_linkedModels.end(); ++it )
{
if( value<float>() != (*it)->value<float>() &&
(*it)->fittedValue( value<float>() )
!= (*it)->value<float>() )
if( (*it)->m_setValueDepth < 1 &&
(*it)->fittedValue( _value ) !=
(*it)->m_value )
{
bool journalling = (*it)->testAndSetJournalling(
isJournalling() );
(*it)->setValue( value<float>() );
(*it)->setValue( _value );
(*it)->setJournalling( journalling );
}
}
@@ -205,6 +208,7 @@ void automatableModel::setValue( const float _value )
{
emit dataUnchanged();
}
--m_setValueDepth;
}
@@ -212,6 +216,7 @@ void automatableModel::setValue( const float _value )
void automatableModel::setAutomatedValue( const float _value )
{
++m_setValueDepth;
const float old_val = m_value;
m_value = fittedValue( _value );
@@ -222,15 +227,16 @@ void automatableModel::setAutomatedValue( const float _value )
m_linkedModels.begin();
it != m_linkedModels.end(); ++it )
{
if( value<float>() != (*it)->value<float>() &&
(*it)->fittedValue( value<float>() )
!= (*it)->value<float>() )
if( (*it)->m_setValueDepth < 1 &&
!(*it)->fittedValue( m_value ) !=
(*it)->m_value )
{
(*it)->setAutomatedValue( value<float>() );
(*it)->setAutomatedValue( m_value );
}
}
emit dataChanged();
}
--m_setValueDepth;
}
@@ -308,7 +314,7 @@ float automatableModel::fittedValue( float _value ) const
void automatableModel::redoStep( journalEntry & _je )
{
bool journalling = testAndSetJournalling( FALSE );
bool journalling = testAndSetJournalling( false );
setValue( value<float>() + (float) _je.data().toDouble() );
setJournalling( journalling );
}
@@ -328,8 +334,8 @@ void automatableModel::undoStep( journalEntry & _je )
void automatableModel::prepareJournalEntryFromOldVal( void )
{
m_oldValue = value<float>();
saveJournallingState( FALSE );
m_journalEntryReady = TRUE;
saveJournallingState( false );
m_journalEntryReady = true;
}
@@ -345,7 +351,7 @@ void automatableModel::addJournalEntryFromOldToCurVal( void )
addJournalEntry( journalEntry( 0, value<float>() -
m_oldValue ) );
}
m_journalEntryReady = FALSE;
m_journalEntryReady = false;
}
}
@@ -354,10 +360,15 @@ void automatableModel::addJournalEntryFromOldToCurVal( void )
void automatableModel::linkModel( automatableModel * _model )
{
if( qFind( m_linkedModels.begin(), m_linkedModels.end(), _model )
== m_linkedModels.end() )
if( !m_linkedModels.contains( _model ) )
{
m_linkedModels.push_back( _model );
m_hasLinkedModels = true;
if( !_model->m_hasLinkedModels )
{
QObject::connect( this, SIGNAL( dataChanged() ),
_model, SIGNAL( dataChanged() ) );
}
}
}
@@ -366,13 +377,13 @@ void automatableModel::linkModel( automatableModel * _model )
void automatableModel::unlinkModel( automatableModel * _model )
{
if( qFind( m_linkedModels.begin(), m_linkedModels.end(), _model )
!= m_linkedModels.end() )
autoModelVector::iterator it = qFind( m_linkedModels.begin(),
m_linkedModels.end(), _model );
if( it != m_linkedModels.end() )
{
m_linkedModels.erase( qFind( m_linkedModels.begin(),
m_linkedModels.end(),
_model ) );
m_linkedModels.erase( it );
}
m_hasLinkedModels = !m_linkedModels.isEmpty();
}
@@ -410,7 +421,7 @@ void automatableModel::setControllerConnection( controllerConnection * _c )
this, SIGNAL( dataChanged() ) );
QObject::connect( m_controllerConnection,
SIGNAL( destroyed() ),
this, SLOT( unlinkControllerConnection() ) );
this, SLOT( unlinkControllerConnection() ) );
emit dataChanged();
}
}
@@ -419,14 +430,23 @@ void automatableModel::setControllerConnection( controllerConnection * _c )
float automatableModel::controllerValue( int _frameOffset ) const
{
const float v = m_minValue +
if( m_controllerConnection )
{
const float v = m_minValue +
( m_range * m_controllerConnection->currentValue(
_frameOffset ) );
if( typeInfo<float>::isEqual( m_step, 1 ) )
{
return qRound( v );
if( typeInfo<float>::isEqual( m_step, 1 ) )
{
return qRound( v );
}
return v;
}
return v;
automatableModel * lm = m_linkedModels.first();
if( lm->m_controllerConnection )
{
return lm->controllerValue( _frameOffset );
}
return lm->m_value;
}
@@ -448,7 +468,7 @@ void automatableModel::unlinkControllerConnection( void )
void automatableModel::setInitValue( const float _value )
{
m_initValue = _value;
bool journalling = testAndSetJournalling( FALSE );
bool journalling = testAndSetJournalling( false );
setValue( _value );
setJournalling( journalling );
emit initValueChanged( _value );

View File

@@ -30,20 +30,12 @@
#include <QtGui/QPainter>
#include "automation_pattern.h"
#include "automation_track.h"
#include "automation_pattern_view.h"
#include "automation_editor.h"
#include "bb_track_container.h"
#include "embed.h"
#include "engine.h"
#include "gui_templates.h"
#include "note.h"
#include "automation_track.h"
#include "project_journal.h"
#include "rename_dialog.h"
#include "bb_track_container.h"
#include "song.h"
#include "string_pair_drag.h"
#include "templates.h"
#include "tooltip.h"
#include "track_container.h"
@@ -161,20 +153,15 @@ midiTime automationPattern::putValue( const midiTime & _time,
const float _value,
const bool _quant_pos )
{
midiTime new_time = _quant_pos && engine::getAutomationEditor() ?
midiTime newTime = _quant_pos && engine::getAutomationEditor() ?
note::quantized( _time,
engine::getAutomationEditor()->quantization() ) :
_time;
m_timeMap[new_time] = _value;
m_timeMap[newTime] = _value;
if( new_time != 0 )
if( newTime == 0 )
{
m_hasAutomation = true;
}
else
{
m_hasAutomation = false;
for( objectVector::iterator it = m_objects.begin();
it != m_objects.end(); )
{
@@ -190,6 +177,29 @@ midiTime automationPattern::putValue( const midiTime & _time,
}
}
// just one automation value?
if( m_timeMap.size() == 1 )
{
m_hasAutomation = m_objects.isEmpty(); // usually false
for( objectVector::iterator it = m_objects.begin();
it != m_objects.end(); ++it )
{
// default value differs from current value?
if( *it && _value != ( *it )->initValue<float>() )
{
// then enable automating this object
m_hasAutomation = true;
}
}
}
else
{
// in all other cases assume we have automation
m_hasAutomation = true;
}
// we need to maximize our length in case we're part of a hidden
// automation track as the user can't resize this pattern
if( getTrack() && getTrack()->type() == track::HiddenAutomationTrack )
{
changeLength( length() );
@@ -197,7 +207,7 @@ midiTime automationPattern::putValue( const midiTime & _time,
emit dataChanged();
return new_time;
return newTime;
}
@@ -209,15 +219,20 @@ void automationPattern::removeValue( const midiTime & _time )
{
m_timeMap.remove( _time );
if( m_timeMap.size() <= 1 )
if( m_timeMap.size() == 1 )
{
const float val = m_timeMap[0];
m_hasAutomation = false;
for( objectVector::iterator it = m_objects.begin();
it != m_objects.end(); )
{
if( *it )
{
( *it )->setValue( m_timeMap[0] );
( *it )->setValue( val );
if( ( *it )->initValue<float>() != val )
{
m_hasAutomation = true;
}
++it;
}
else
@@ -272,7 +287,7 @@ void automationPattern::saveSettings( QDomDocument & _doc, QDomElement & _this )
for( objectVector::const_iterator it = m_objects.begin();
it != m_objects.end(); ++it )
{
if( *it != NULL )
if( *it )
{
QDomElement element = _doc.createElement( "object" );
element.setAttribute( "id", ( *it )->id() );
@@ -522,300 +537,5 @@ void automationPattern::objectDestroyed( jo_id_t _id )
automationPatternView::automationPatternView( automationPattern * _pattern,
trackView * _parent ) :
trackContentObjectView( _pattern, _parent ),
m_pat( _pattern ),
m_paintPixmap(),
m_needsUpdate( true )
{
connect( m_pat, SIGNAL( dataChanged() ),
this, SLOT( update() ) );
setFixedHeight( parentWidget()->height() - 2 );
setAutoResizeEnabled( false );
toolTip::add( this, tr( "double-click to open this pattern in "
"automation editor" ) );
}
automationPatternView::~automationPatternView()
{
}
void automationPatternView::update( void )
{
m_needsUpdate = true;
if( fixedTCOs() )
{
m_pat->changeLength( m_pat->length() );
}
trackContentObjectView::update();
}
void automationPatternView::resetName( void )
{
m_pat->setName( QString::null );
}
void automationPatternView::changeName( void )
{
QString s = m_pat->name();
renameDialog rename_dlg( s );
rename_dlg.exec();
m_pat->setName( s );
update();
}
void automationPatternView::disconnectObject( QAction * _a )
{
journallingObject * j = engine::getProjectJournal()->
getJournallingObject( _a->data().toInt() );
if( j && dynamic_cast<automatableModel *>( j ) )
{
m_pat->m_objects.erase( qFind( m_pat->m_objects.begin(),
m_pat->m_objects.end(),
dynamic_cast<automatableModel *>( j ) ) );
update();
}
}
void automationPatternView::constructContextMenu( QMenu * _cm )
{
QAction * a = new QAction( embed::getIconPixmap( "automation" ),
tr( "Open in Automation editor" ), _cm );
_cm->insertAction( _cm->actions()[0], a );
connect( a, SIGNAL( triggered( bool ) ),
m_pat, SLOT( openInAutomationEditor() ) );
_cm->insertSeparator( _cm->actions()[1] );
_cm->addSeparator();
_cm->addAction( embed::getIconPixmap( "edit_erase" ),
tr( "Clear" ), m_pat, SLOT( clear() ) );
_cm->addSeparator();
_cm->addAction( embed::getIconPixmap( "reload" ), tr( "Reset name" ),
this, SLOT( resetName() ) );
_cm->addAction( embed::getIconPixmap( "edit_rename" ),
tr( "Change name" ),
this, SLOT( changeName() ) );
if( !m_pat->m_objects.isEmpty() )
{
_cm->addSeparator();
QMenu * m = new QMenu( tr( "%1 Connections" ).
arg( m_pat->m_objects.count() ), _cm );
for( automationPattern::objectVector::iterator it =
m_pat->m_objects.begin();
it != m_pat->m_objects.end(); ++it )
{
if( *it )
{
a = new QAction( tr( "Disconnect \"%1\"" ).
arg( ( *it )->fullDisplayName() ), m );
a->setData( ( *it )->id() );
m->addAction( a );
}
}
connect( m, SIGNAL( triggered( QAction * ) ),
this, SLOT( disconnectObject( QAction * ) ) );
_cm->addMenu( m );
}
_cm->addSeparator();
}
void automationPatternView::mouseDoubleClickEvent( QMouseEvent * _me )
{
if( _me->button() != Qt::LeftButton )
{
_me->ignore();
return;
}
m_pat->openInAutomationEditor();
}
void automationPatternView::paintEvent( QPaintEvent * )
{
if( m_needsUpdate == false )
{
QPainter p( this );
p.drawPixmap( 0, 0, m_paintPixmap );
return;
}
m_needsUpdate = false;
if( m_paintPixmap.isNull() == true || m_paintPixmap.size() != size() )
{
m_paintPixmap = QPixmap( size() );
}
QPainter p( &m_paintPixmap );
QLinearGradient lingrad( 0, 0, 0, height() );
const QColor c = isSelected() ? QColor( 0, 0, 224 ) :
QColor( 96, 96, 96 );
lingrad.setColorAt( 0, c );
lingrad.setColorAt( 0.5, Qt::black );
lingrad.setColorAt( 1, c );
p.setBrush( lingrad );
p.setPen( QColor( 0, 0, 0 ) );
p.drawRect( QRect( 0, 0, width() - 1, height() - 1 ) );
const float ppt = fixedTCOs() ?
( parentWidget()->width() - 2 * TCO_BORDER_WIDTH )
/ (float) m_pat->length().getTact() :
pixelsPerTact();
const int x_base = TCO_BORDER_WIDTH;
p.setPen( QColor( 0, 0, 0 ) );
for( tact t = 1; t < m_pat->length().getTact(); ++t )
{
p.drawLine( x_base + static_cast<int>( ppt * t ) - 1,
TCO_BORDER_WIDTH, x_base + static_cast<int>(
ppt * t ) - 1, 5 );
p.drawLine( x_base + static_cast<int>( ppt * t ) - 1,
height() - ( 4 + 2 * TCO_BORDER_WIDTH ),
x_base + static_cast<int>( ppt * t ) - 1,
height() - 2 * TCO_BORDER_WIDTH );
}
const float min = m_pat->firstObject()->minValue<float>();
const float max = m_pat->firstObject()->maxValue<float>();
const float y_scale = max - min;
const float h = ( height()-2*TCO_BORDER_WIDTH ) / y_scale;
p.translate( 0.0f, max * height() / y_scale-1 );
p.scale( 1.0f, -h );
QLinearGradient lin2grad( 0, min, 0, max );
const QColor cl = QColor( 255, 224, 0 );
const QColor cd = QColor( 229, 158, 0 );
lin2grad.setColorAt( 1, cl );
lin2grad.setColorAt( 0, cd );
for( automationPattern::timeMap::const_iterator it =
m_pat->getTimeMap().begin();
it != m_pat->getTimeMap().end(); ++it )
{
const float x1 = 2 * x_base + it.key() * ppt /
midiTime::ticksPerTact();
float x2;
if( it+1 != m_pat->getTimeMap().end() )
{
x2 = (it+1).key() * ppt / midiTime::ticksPerTact() + 2;
}
else
{
x2 = (float)( width() - TCO_BORDER_WIDTH );
}
p.fillRect( QRectF( x1, 0.0f, x2-x1, it.value() ),
lin2grad );
}
p.resetMatrix();
p.setFont( pointSize<7>( p.font() ) );
if( m_pat->isMuted() || m_pat->getTrack()->isMuted() )
{
p.setPen( QColor( 192, 192, 192 ) );
}
else
{
p.setPen( QColor( 0, 64, 255 ) );
}
p.drawText( 2, p.fontMetrics().height() - 1, m_pat->name() );
if( m_pat->isMuted() )
{
p.drawPixmap( 3, p.fontMetrics().height() + 1,
embed::getIconPixmap( "muted", 16, 16 ) );
}
p.end();
p.begin( this );
p.drawPixmap( 0, 0, m_paintPixmap );
}
void automationPatternView::dragEnterEvent( QDragEnterEvent * _dee )
{
stringPairDrag::processDragEnterEvent( _dee, "automatable_model" );
if( !_dee->isAccepted() )
{
trackContentObjectView::dragEnterEvent( _dee );
}
}
void automationPatternView::dropEvent( QDropEvent * _de )
{
QString type = stringPairDrag::decodeKey( _de );
QString val = stringPairDrag::decodeValue( _de );
if( type == "automatable_model" )
{
automatableModel * mod = dynamic_cast<automatableModel *>(
engine::getProjectJournal()->
getJournallingObject( val.toInt() ) );
if( mod != NULL )
{
m_pat->addObject( mod );
}
update();
if( engine::getAutomationEditor() &&
engine::getAutomationEditor()->currentPattern() ==
m_pat )
{
engine::getAutomationEditor()->setCurrentPattern(
m_pat );
}
}
else
{
trackContentObjectView::dropEvent( _de );
}
}
#include "moc_automation_pattern.cxx"

View File

@@ -314,9 +314,13 @@ void configManager::loadConfigFile( void )
}
#ifdef LMMS_HAVE_STK
if( m_stkDir == "" )
if( m_stkDir == "" || m_stkDir == QDir::separator() )
{
#ifdef LMMS_BUILD_WIN32
m_stkDir = m_dataDir + "stk/rawwaves/";
#else
m_stkDir = "/usr/share/stk/rawwaves/";
#endif
}
#endif

View File

@@ -75,10 +75,10 @@ effect::~effect()
void effect::saveSettings( QDomDocument & _doc, QDomElement & _this )
{
_this.setAttribute( "on", m_enabledModel.value() );
_this.setAttribute( "wet", m_wetDryModel.value() );
_this.setAttribute( "autoquit", m_autoQuitModel.value() );
_this.setAttribute( "gate", m_gateModel.value() );
m_enabledModel.saveSettings( _doc, _this, "on" );
m_wetDryModel.saveSettings( _doc, _this, "wet" );
m_autoQuitModel.saveSettings( _doc, _this, "autoquit" );
m_gateModel.saveSettings( _doc, _this, "gate" );
getControls()->saveState( _doc, _this );
}
@@ -87,10 +87,10 @@ void effect::saveSettings( QDomDocument & _doc, QDomElement & _this )
void effect::loadSettings( const QDomElement & _this )
{
m_enabledModel.setValue( (float) _this.attribute( "on" ).toInt() );
m_wetDryModel.setValue( _this.attribute( "wet" ).toFloat() );
m_autoQuitModel.setValue( _this.attribute( "autoquit" ).toFloat() );
m_gateModel.setValue( _this.attribute( "gate" ).toFloat() );
m_enabledModel.loadSettings( _this, "on" );
m_wetDryModel.loadSettings( _this, "wet" );
m_autoQuitModel.loadSettings( _this, "autoquit" );
m_gateModel.loadSettings( _this, "gate" );
QDomNode node = _this.firstChild();
while( !node.isNull() )

View File

@@ -245,10 +245,11 @@ inline void envelopeAndLFOParameters::fillLFOLevel( float * _buf,
}
fpp_t offset = 0;
const float lafI = 1.0f / m_lfoAttackFrames;
for( ; offset < _frames && _frame < m_lfoAttackFrames; ++offset,
++_frame )
{
*_buf++ = m_lfoShapeData[offset] * _frame / m_lfoAttackFrames;
*_buf++ = m_lfoShapeData[offset] * _frame * lafI;
}
for( ; offset < _frames; ++offset )
{
@@ -411,39 +412,44 @@ void envelopeAndLFOParameters::updateSampleVars( void )
m_pahdEnv = new sample_t[m_pahdFrames];
m_rEnv = new sample_t[m_rFrames];
const float aa = m_amountAdd;
for( f_cnt_t i = 0; i < predelay_frames; ++i )
{
m_pahdEnv[i] = m_amountAdd;
m_pahdEnv[i] = aa;
}
f_cnt_t add = predelay_frames;
const float afI = ( 1.0f / attack_frames ) * m_amount;
for( f_cnt_t i = 0; i < attack_frames; ++i )
{
m_pahdEnv[add + i] = ( (float)i / attack_frames ) *
m_amount + m_amountAdd;
m_pahdEnv[add+i] = i * afI + aa;
}
add += attack_frames;
const float amsum = m_amount + m_amountAdd;
for( f_cnt_t i = 0; i < hold_frames; ++i )
{
m_pahdEnv[add + i] = m_amount + m_amountAdd;
m_pahdEnv[add + i] = amsum;
}
add += hold_frames;
const float dfI = (1.0 / decay_frames)*(m_sustainLevel-1)*m_amount;
for( f_cnt_t i = 0; i < decay_frames; ++i )
{
/*
m_pahdEnv[add + i] = ( m_sustainLevel + ( 1.0f -
(float)i / decay_frames ) *
( 1.0f - m_sustainLevel ) ) *
m_amount + m_amountAdd;
*/
m_pahdEnv[add + i] = amsum + i*dfI;
}
const float rfI = ( 1.0f / m_rFrames ) * m_amount;
for( f_cnt_t i = 0; i < m_rFrames; ++i )
{
m_rEnv[i] = ( (float)( m_rFrames - i ) / m_rFrames
// * m_sustainLevel
) * m_amount;
m_rEnv[i] = (float)( m_rFrames - i ) * rfI;
}
// save this calculation in real-time-part

View File

@@ -113,43 +113,27 @@ chordCreator::chord chordCreator::s_chordTable[] =
{ chordCreator::tr( "m-Maj13" ), { 0, 3, 7, 11, 14, 21, -1 } },
{ chordCreator::tr( "Major" ), { 0, 2, 4, 5, 7, 9, 11, -1 } },
{ chordCreator::tr( "Harmonic minor" ), { 0, 2, 3, 5, 7, 8,
11, -1 } },
{ chordCreator::tr( "Melodic minor" ), { 0, 2, 3, 5, 7, 9,
11, -1 } },
{ chordCreator::tr( "Whole tone" ), { 0, 2, 4, 6, 8, 10,
-1 } },
{ chordCreator::tr( "Diminished" ), { 0, 2, 3, 5, 6, 8, 9,
11, -1 } },
{ chordCreator::tr( "Major pentatonic" ), { 0, 2, 4, 7, 10,
-1 } },
{ chordCreator::tr( "Minor pentatonic" ), { 0, 3, 5, 7, 10,
-1 } },
{ chordCreator::tr( "Harmonic minor" ), { 0, 2, 3, 5, 7, 8, 11, -1 } },
{ chordCreator::tr( "Melodic minor" ), { 0, 2, 3, 5, 7, 9, 11, -1 } },
{ chordCreator::tr( "Whole tone" ), { 0, 2, 4, 6, 8, 10, -1 } },
{ chordCreator::tr( "Diminished" ), { 0, 2, 3, 5, 6, 8, 9, 11, -1 } },
{ chordCreator::tr( "Major pentatonic" ), { 0, 2, 4, 7, 10, -1 } },
{ chordCreator::tr( "Minor pentatonic" ), { 0, 3, 5, 7, 10, -1 } },
{ chordCreator::tr( "Jap in sen" ), { 0, 1, 5, 7, 10, -1 } },
{ chordCreator::tr( "Major bebop" ), { 0, 2, 4, 5, 7, 8, 9,
11, -1 } },
{ chordCreator::tr( "Dominant bebop" ), { 0, 2, 4, 5, 7, 9,
10, 11, -1 } },
{ chordCreator::tr( "Major bebop" ), { 0, 2, 4, 5, 7, 8, 9, 11, -1 } },
{ chordCreator::tr( "Dominant bebop" ), { 0, 2, 4, 5, 7, 9, 10, 11, -1 } },
{ chordCreator::tr( "Blues" ), { 0, 3, 5, 6, 7, 10, -1 } },
{ chordCreator::tr( "Arabic" ), { 0, 1, 4, 5, 7, 8, 11, -1 } },
{ chordCreator::tr( "Enigmatic" ), { 0, 1, 4, 6, 8, 10, 11,
-1 } },
{ chordCreator::tr( "Neopolitan" ), { 0, 1, 3, 5, 7, 9, 11,
-1 } },
{ chordCreator::tr( "Neopolitan minor" ), { 0, 1, 3, 5, 7, 9,
11, -1 } },
{ chordCreator::tr( "Hungarian minor" ), { 0, 2, 3, 6, 7, 9,
11, -1 } },
{ chordCreator::tr( "Enigmatic" ), { 0, 1, 4, 6, 8, 10, 11, -1 } },
{ chordCreator::tr( "Neopolitan" ), { 0, 1, 3, 5, 7, 9, 11, -1 } },
{ chordCreator::tr( "Neopolitan minor" ), { 0, 1, 3, 5, 7, 9, 11, -1 } },
{ chordCreator::tr( "Hungarian minor" ), { 0, 2, 3, 6, 7, 9, 11, -1 } },
{ chordCreator::tr( "Dorian" ), { 0, 2, 3, 5, 7, 9, 10, -1 } },
{ chordCreator::tr( "Phrygolydian" ), { 0, 1, 3, 5, 7, 8, 10,
-1 } },
{ chordCreator::tr( "Phrygolydian" ), { 0, 1, 3, 5, 7, 8, 10, -1 } },
{ chordCreator::tr( "Lydian" ), { 0, 2, 4, 6, 7, 9, 11, -1 } },
{ chordCreator::tr( "Mixolydian" ), { 0, 2, 4, 5, 7, 9, 10,
-1 } },
{ chordCreator::tr( "Aeolian" ), { 0, 2, 3, 5, 7, 8, 10,
-1 } },
{ chordCreator::tr( "Locrian" ), { 0, 1, 3, 5, 6, 8, 10,
-1 } },
{ chordCreator::tr( "Mixolydian" ), { 0, 2, 4, 5, 7, 9, 10, -1 } },
{ chordCreator::tr( "Aeolian" ), { 0, 2, 3, 5, 7, 8, 10, -1 } },
{ chordCreator::tr( "Locrian" ), { 0, 1, 3, 5, 6, 8, 10, -1 } },
{ "", { -1, -1 } }

View File

@@ -53,6 +53,7 @@
#include "config_mgr.h"
#include "embed.h"
#include "engine.h"
#include "import_filter.h"
#include "lmms_style.h"
#include "main_window.h"
#include "project_renderer.h"
@@ -84,7 +85,9 @@ int main( int argc, char * * argv )
// intialize RNG
srand( getpid() + time( 0 ) );
bool core_only = FALSE;
bool core_only = false;
bool exit_after_import = false;
QString file_to_load, file_to_save, file_to_import, render_out;
for( int i = 1; i < argc; ++i )
{
@@ -93,7 +96,7 @@ int main( int argc, char * * argv )
( QString( argv[i] ) == "--help" ||
QString( argv[i] ) == "-h" ) ) )
{
core_only = TRUE;
core_only = true;
break;
}
}
@@ -102,10 +105,9 @@ int main( int argc, char * * argv )
new QCoreApplication( argc, argv ) :
new QApplication( argc, argv ) ;
QString file_to_load, file_to_save, render_out;
mixer::qualitySettings qs( mixer::qualitySettings::Mode_HighQuality );
projectRenderer::outputSettings os( 44100, FALSE, 160,
projectRenderer::outputSettings os( 44100, false, 160,
projectRenderer::Depth_16Bit );
projectRenderer::ExportFileFormats eff = projectRenderer::WaveFile;
@@ -300,6 +302,17 @@ int main( int argc, char * * argv )
}
++i;
}
else if( argc > i &&
( QString( argv[i] ) == "--import" ) )
{
file_to_import = argv[i+1];
++i;
// exit after import? (only for debugging)
if( argc > i && QString( argv[i+1] ) == "-e" )
{
exit_after_import = true;
}
}
else
{
if( argv[i][0] == '-' )
@@ -390,11 +403,21 @@ int main( int argc, char * * argv )
srand( getpid() + time( 0 ) );
// we try to load given file
if( file_to_load != "" )
if( !file_to_load.isEmpty() )
{
engine::getMainWindow()->showMaximized();
engine::getSong()->loadProject( file_to_load );
}
else if( !file_to_import.isEmpty() )
{
importFilter::import( file_to_import,
engine::getSong() );
if( exit_after_import )
{
return 0;
}
engine::getMainWindow()->showMaximized();
}
else
{
engine::getSong()->createNewProject();
@@ -404,7 +427,7 @@ int main( int argc, char * * argv )
else
{
// we're going to render our song
engine::init( FALSE );
engine::init( false );
printf( "loading project...\n" );
engine::getSong()->loadProject( file_to_load );
printf( "done\n" );

View File

@@ -1,7 +1,7 @@
/*
* mixer.cpp - audio-device-independent mixer for LMMS
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -41,6 +41,7 @@
#include "sample_play_handle.h"
#include "piano_roll.h"
#include "micro_timer.h"
#include "atomic_int.h"
#include "audio_device.h"
#include "midi_client.h"
@@ -95,7 +96,7 @@ static void * aligned_malloc( int _bytes )
class mixerWorkerThread : public QThread
class MixerWorkerThread : public QThread
{
public:
enum JobTypes
@@ -107,50 +108,47 @@ public:
NumJobTypes
} ;
struct jobQueueItem
struct JobQueueItem
{
jobQueueItem() :
JobQueueItem() :
type( InvalidJob ),
job( NULL ),
param( 0 ),
done( false )
{
}
jobQueueItem( JobTypes _type, void * _job ) :
JobQueueItem( JobTypes _type, void * _job, int _param = 0 ) :
type( _type ),
job( _job ),
param( _param ),
done( false )
{
}
JobTypes type;
void * job;
int param;
union
{
playHandle * playHandleJob;
audioPort * audioPortJob;
int effectChannelJob;
volatile void * job;
};
#if QT_VERSION >= 0x040400
QAtomicInt done;
#else
volatile bool done;
#endif
AtomicInt done;
} ;
typedef QVector<jobQueueItem> jobQueueItems;
struct jobQueue
struct JobQueue
{
jobQueueItems items;
#if QT_VERSION < 0x040400
QMutex lock;
#endif
#define JOB_QUEUE_SIZE 1024
JobQueue() :
queueSize( 0 )
{
}
JobQueueItem items[JOB_QUEUE_SIZE];
int queueSize;
AtomicInt itemsDone;
} ;
static jobQueue s_jobQueue;
static JobQueue s_jobQueue;
mixerWorkerThread( int _worker_num, mixer * _mixer ) :
MixerWorkerThread( int _worker_num, mixer * _mixer ) :
QThread( _mixer ),
m_workingBuf( (sampleFrame *) aligned_malloc(
_mixer->framesPerPeriod() *
@@ -158,12 +156,11 @@ public:
m_workerNum( _worker_num ),
m_quit( false ),
m_mixer( _mixer ),
m_queueReadySem( &m_mixer->m_queueReadySem ),
m_workersDoneSem( &m_mixer->m_workersDoneSem )
m_queueReadyWaitCond( &m_mixer->m_queueReadyWaitCond )
{
}
virtual ~mixerWorkerThread()
virtual ~MixerWorkerThread()
{
aligned_free( m_workingBuf );
}
@@ -173,60 +170,7 @@ public:
m_quit = true;
}
void processJobQueue( void )
{
jobQueueItems::iterator end_it = s_jobQueue.items.end();
for( jobQueueItems::iterator it =
s_jobQueue.items.begin();
it != end_it; ++it )
{
#if QT_VERSION >= 0x040400
if( it->done.fetchAndStoreOrdered( 1 ) == 0 )
{
#else
s_jobQueue.lock.lock();
if( !it->done )
{
it->done = true;
s_jobQueue.lock.unlock();
#endif
switch( it->type )
{
case PlayHandle:
it->playHandleJob->play( m_workingBuf );
break;
case AudioPortEffects:
{
audioPort * a = it->audioPortJob;
const bool me = a->processEffects();
if( me || a->m_bufferUsage != audioPort::NoUsage )
{
engine::getFxMixer()->mixToChannel( a->firstBuffer(),
a->nextFxChannel() );
a->nextPeriod();
}
}
break;
case EffectChannel:
engine::getFxMixer()->processChannel(
(fx_ch_t) it->effectChannelJob );
break;
default:
/*fprintf( stderr, "invalid job item type %d at %ld in jobqueue(%ld:%ld)\n",
(int) it->type, (long int) it,
(long int) s_jobQueue.items.begin(),
(long int) end_it );*/
break;
}
}
#if QT_VERSION < 0x040400
else
{
s_jobQueue.lock.unlock();
}
#endif
}
}
void processJobQueue( void );
private:
@@ -242,12 +186,13 @@ private:
#endif
#endif
#endif
QMutex m;
while( m_quit == false )
{
m_queueReadySem->acquire();
m.lock();
m_queueReadyWaitCond->wait( &m );
processJobQueue();
m_workersDoneSem->release();
m.unlock();
}
}
@@ -255,34 +200,103 @@ private:
int m_workerNum;
volatile bool m_quit;
mixer * m_mixer;
QSemaphore * m_queueReadySem;
QSemaphore * m_workersDoneSem;
QWaitCondition * m_queueReadyWaitCond;
} ;
mixerWorkerThread::jobQueue mixerWorkerThread::s_jobQueue;
MixerWorkerThread::JobQueue MixerWorkerThread::s_jobQueue;
#define FILL_JOB_QUEUE(_vec_type,_vec,_job_type,_condition) \
mixerWorkerThread::s_jobQueue.items.clear(); \
void MixerWorkerThread::processJobQueue( void )
{
for( int i = 0; i < s_jobQueue.queueSize; ++i )
{
JobQueueItem * it = &s_jobQueue.items[i];
if( it->done.fetchAndStoreOrdered( 1 ) == 0 )
{
switch( it->type )
{
case PlayHandle:
( (playHandle *) it->job )->
play( m_workingBuf );
break;
case AudioPortEffects:
{
audioPort * a = (audioPort *) it->job;
const bool me = a->processEffects();
if( me || a->m_bufferUsage != audioPort::NoUsage )
{
engine::getFxMixer()->mixToChannel( a->firstBuffer(),
a->nextFxChannel() );
a->nextPeriod();
}
}
break;
case EffectChannel:
engine::getFxMixer()->processChannel( (fx_ch_t) it->param );
break;
default:
break;
}
s_jobQueue.itemsDone.fetchAndAddOrdered( 1 );
}
}
}
#define FILL_JOB_QUEUE_BEGIN(_vec_type,_vec,_condition) \
MixerWorkerThread::s_jobQueue.queueSize = 0; \
MixerWorkerThread::s_jobQueue.itemsDone = 0; \
for( _vec_type::iterator it = _vec.begin(); \
it != _vec.end(); ++it ) \
it != _vec.end(); ++it ) \
{ \
if( _condition ) \
{ \
mixerWorkerThread::s_jobQueue.items. \
push_back( \
mixerWorkerThread::jobQueueItem( _job_type, \
(void *)*it ) );\
{
#define FILL_JOB_QUEUE_END() \
++MixerWorkerThread::s_jobQueue.queueSize; \
} \
}
#define FILL_JOB_QUEUE(_vec_type,_vec,_job_type,_condition) \
FILL_JOB_QUEUE_BEGIN(_vec_type,_vec,_condition) \
MixerWorkerThread::s_jobQueue.items \
[MixerWorkerThread::s_jobQueue.queueSize] = \
MixerWorkerThread::JobQueueItem( _job_type, \
(void *) *it ); \
FILL_JOB_QUEUE_END()
#define FILL_JOB_QUEUE_PARAM(_vec_type,_vec,_job_type,_condition) \
FILL_JOB_QUEUE_BEGIN(_vec_type,_vec,_condition) \
MixerWorkerThread::s_jobQueue.items \
[MixerWorkerThread::s_jobQueue.queueSize] = \
MixerWorkerThread::JobQueueItem( _job_type, \
NULL, *it ); \
FILL_JOB_QUEUE_END()
#define START_JOBS() \
m_queueReadySem.release( m_numWorkers ); \
m_queueReadyWaitCond.wakeAll();
// define a pause instruction for spinlock-loop - merely useful on
// HyperThreading systems with just one physical core (e.g. Intel Atom)
#ifdef LMMS_HOST_X86_64
#define SPINLOCK_PAUSE() asm( "pause" )
#else
#ifdef LMMS_HOST_X86_64
#define SPINLOCK_PAUSE() asm( "pause" )
#else
#define SPINLOCK_PAUSE()
#endif
#endif
#define WAIT_FOR_JOBS() \
m_workersDoneSem.acquire( m_numWorkers );
m_workers[m_numWorkers]->processJobQueue(); \
while( MixerWorkerThread::s_jobQueue.itemsDone < \
MixerWorkerThread::s_jobQueue.queueSize ) \
{ \
SPINLOCK_PAUSE(); \
} \
@@ -296,10 +310,8 @@ mixer::mixer( void ) :
m_writeBuf( NULL ),
m_cpuLoad( 0 ),
m_workers(),
m_numWorkers( QThread::idealThreadCount() > 1 ?
QThread::idealThreadCount()-1 : 0 ),
m_queueReadySem( m_numWorkers ),
m_workersDoneSem( m_numWorkers ),
m_numWorkers( QThread::idealThreadCount()-1 ),
m_queueReadyWaitCond(),
m_qualitySettings( qualitySettings::Mode_Draft ),
m_masterGain( 1.0f ),
m_audioDev( NULL ),
@@ -363,14 +375,12 @@ mixer::mixer( void ) :
m_bufferPool.push_back( m_readBuf );
}
m_queueReadySem.acquire( m_numWorkers );
m_workersDoneSem.acquire( m_numWorkers );
for( int i = 0; i < m_numWorkers+1; ++i )
{
mixerWorkerThread * wt = new mixerWorkerThread( i, this );
if( i > 0 )
MixerWorkerThread * wt = new MixerWorkerThread( i, this );
if( i < m_numWorkers )
{
wt->start( QThread::HighestPriority );
wt->start( QThread::TimeCriticalPriority );
}
m_workers.push_back( wt );
}
@@ -387,15 +397,15 @@ mixer::~mixer()
{
// distribute an empty job-queue so that worker-threads
// get out of their processing-loop
mixerWorkerThread::s_jobQueue.items.clear();
MixerWorkerThread::s_jobQueue.queueSize = 0;
for( int w = 0; w < m_numWorkers; ++w )
{
m_workers[w+1]->quit();
m_workers[w]->quit();
}
START_JOBS();
for( int w = 0; w < m_numWorkers; ++w )
{
m_workers[w+1]->wait( 500 );
m_workers[w]->wait( 500 );
}
while( m_fifo->available() )
@@ -432,7 +442,7 @@ void mixer::startProcessing( bool _needs_fifo )
if( _needs_fifo )
{
m_fifoWriter = new fifoWriter( this, m_fifo );
m_fifoWriter->start( QThread::TimeCriticalPriority );
m_fifoWriter->start( QThread::HighPriority );
}
else
{
@@ -609,10 +619,9 @@ const surroundSampleFrame * mixer::renderNextBuffer( void )
// STAGE 1: run and render all play handles
FILL_JOB_QUEUE(playHandleVector,m_playHandles,
mixerWorkerThread::PlayHandle,
MixerWorkerThread::PlayHandle,
!( *it )->done());
START_JOBS();
m_workers[0]->processJobQueue();
WAIT_FOR_JOBS();
// removed all play handles which are done
@@ -620,7 +629,7 @@ const surroundSampleFrame * mixer::renderNextBuffer( void )
it != m_playHandles.end(); )
{
if( ( *it )->affinityMatters() &&
( *it )->affinity() != QThread::currentThread() )
( *it )->affinity() != QThread::currentThread() )
{
++it;
continue;
@@ -639,17 +648,15 @@ const surroundSampleFrame * mixer::renderNextBuffer( void )
// STAGE 2: process effects of all instrument- and sampletracks
FILL_JOB_QUEUE(QVector<audioPort*>,m_audioPorts,
mixerWorkerThread::AudioPortEffects,1);
MixerWorkerThread::AudioPortEffects,1);
START_JOBS();
m_workers[0]->processJobQueue();
WAIT_FOR_JOBS();
// STAGE 3: process effects in FX mixer
FILL_JOB_QUEUE(QVector<fx_ch_t>,__fx_channel_jobs,
mixerWorkerThread::EffectChannel,1);
FILL_JOB_QUEUE_PARAM(QVector<fx_ch_t>,__fx_channel_jobs,
MixerWorkerThread::EffectChannel,1);
START_JOBS();
m_workers[0]->processJobQueue();
WAIT_FOR_JOBS();

View File

@@ -3,7 +3,7 @@
/*
* note.cpp - implementation of class note
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -40,15 +40,20 @@
note::note( const midiTime & _length, const midiTime & _pos,
int _key, volume _volume, panning _panning,
detuningHelper * _detuning ) :
m_selected( false ),
m_oldKey( tLimit( _key, 0, NumKeys ) ),
m_oldPos( _pos ),
m_oldLength( _length ),
m_isPlaying( false ),
m_key( tLimit( _key, 0, NumKeys ) ),
m_volume( tLimit( _volume, MinVolume, MaxVolume ) ),
m_panning( tLimit( _panning, PanningLeft, PanningRight ) ),
m_length( _length ),
m_pos( _pos )
m_pos( _pos ),
m_detuning( NULL )
{
//saveJournallingState( FALSE );
// setJournalling( FALSE );
if( _detuning )
{
m_detuning = sharedObject::ref( _detuning );
@@ -65,13 +70,26 @@ note::note( const midiTime & _length, const midiTime & _pos,
note::note( const note & _note ) :
serializingObject( _note ),
m_selected( _note.m_selected ),
m_oldKey( _note.m_oldKey ),
m_oldPos( _note.m_oldPos ),
m_oldLength( _note.m_oldLength ),
m_isPlaying( _note.m_isPlaying ),
m_key( _note.m_key),
m_volume( _note.m_volume ),
m_panning( _note.m_panning ),
m_length( _note.m_length ),
m_pos( _note.m_pos )
m_pos( _note.m_pos ),
m_detuning( NULL )
{
m_detuning = sharedObject::ref( _note.m_detuning );
if( _note.m_detuning )
{
m_detuning = sharedObject::ref( _note.m_detuning );
}
else
{
createDetuning();
}
}
@@ -79,7 +97,10 @@ note::note( const note & _note ) :
note::~note()
{
sharedObject::unref( m_detuning );
if( m_detuning )
{
sharedObject::unref( m_detuning );
}
}
@@ -260,7 +281,7 @@ void note::createDetuning( void )
bool note::hasDetuningInfo( void ) const
{
return( m_detuning && m_detuning->hasAutomation() );
return m_detuning && m_detuning->hasAutomation();
}

View File

@@ -208,6 +208,7 @@ pianoView::pianoView( QWidget * _parent ) :
"black_key_pressed" ) );
}
setAttribute( Qt::WA_OpaquePaintEvent, true );
setFocusPolicy( Qt::StrongFocus );
m_pianoScroll = new QScrollBar( Qt::Horizontal, this );
@@ -505,7 +506,7 @@ void pianoView::mousePressEvent( QMouseEvent * _me )
}
else
{
if( engine::getMainWindow()->isCtrlPressed() )
if( _me->modifiers() & Qt::ControlModifier )
{
new stringPairDrag( "automatable_model",
QString::number( m_piano->

View File

@@ -4,6 +4,7 @@
* project_version.cpp - compare versions in import upgrades
*
* Copyright (c) 2007 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -42,7 +43,7 @@ int projectVersion::compare( const projectVersion & _v1,
n2 = _v2.section( '.', 0, 0 ).toInt();
if( n1 != n2 )
{
return( n1 - n2 );
return n1 - n2;
}
// Minor
@@ -50,7 +51,7 @@ int projectVersion::compare( const projectVersion & _v1,
n2 = _v2.section( '.', 1, 1 ).toInt();
if( n1 != n2 )
{
return( n1 - n2 );
return n1 - n2;
}
// Release
@@ -58,12 +59,24 @@ int projectVersion::compare( const projectVersion & _v1,
n2 = _v2.section( '.', 2 ).section( '-', 0, 0 ).toInt();
if( n1 != n2 )
{
return( n1 - n2 );
return n1 - n2;
}
// Build
return( QString::compare( _v1.section( '.', 2 ).section( '-', 1 ),
_v2.section( '.', 2 ).section( '-', 1 ) ) );
const QString b1 = _v1.section( '.', 2 ).section( '-', 1 );
const QString b2 = _v2.section( '.', 2 ).section( '-', 1 );
// make sure 0.x.y > 0.x.y-patch
if( b1.isEmpty() )
{
return 1;
}
if( b2.isEmpty() )
{
return -1;
}
return QString::compare( b1, b2 );
}

View File

@@ -355,6 +355,11 @@ bool remotePlugin::processMessage( const message & _m )
resizeSharedProcessingMemory();
break;
case IdDebugMessage:
fprintf( stderr, "RemotePlugin::DebugMessage: %s",
_m.getString( 0 ).c_str() );
break;
case IdProcessingDone:
case IdQuit:
default:

View File

@@ -3,7 +3,7 @@
/*
* sample_buffer.cpp - container-class sampleBuffer
*
* Copyright (c) 2005-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -67,7 +67,7 @@
sampleBuffer::sampleBuffer( const QString & _audio_file,
bool _is_base64_data ) :
m_audioFile( ( _is_base64_data == TRUE ) ? "" : _audio_file ),
m_audioFile( ( _is_base64_data == true ) ? "" : _audio_file ),
m_origData( NULL ),
m_origFrames( 0 ),
m_data( NULL ),
@@ -77,11 +77,11 @@ sampleBuffer::sampleBuffer( const QString & _audio_file,
m_loopStartFrame( 0 ),
m_loopEndFrame( 0 ),
m_amplification( 1.0f ),
m_reversed( FALSE ),
m_reversed( false ),
m_frequency( BaseFreq ),
m_sampleRate( engine::getMixer()->baseSampleRate() )
{
if( _is_base64_data == TRUE )
if( _is_base64_data == true )
{
loadFromBase64( _audio_file );
}
@@ -102,7 +102,7 @@ sampleBuffer::sampleBuffer( const sampleFrame * _data, const f_cnt_t _frames ) :
m_loopStartFrame( 0 ),
m_loopEndFrame( 0 ),
m_amplification( 1.0f ),
m_reversed( FALSE ),
m_reversed( false ),
m_frequency( BaseFreq ),
m_sampleRate( engine::getMixer()->baseSampleRate() )
{
@@ -129,7 +129,7 @@ sampleBuffer::sampleBuffer( const f_cnt_t _frames ) :
m_loopStartFrame( 0 ),
m_loopEndFrame( 0 ),
m_amplification( 1.0f ),
m_reversed( FALSE ),
m_reversed( false ),
m_frequency( BaseFreq ),
m_sampleRate( engine::getMixer()->baseSampleRate() )
{
@@ -165,13 +165,13 @@ void sampleBuffer::update( bool _keep_settings )
delete[] m_data;
}
if( m_audioFile == "" && m_origData != NULL && m_origFrames > 0 )
if( m_audioFile.isEmpty() && m_origData != NULL && m_origFrames > 0 )
{
// TODO: reverse- and amplification-property is not covered
// by following code...
m_data = new sampleFrame[m_origFrames];
memcpy( m_data, m_origData, m_origFrames * BYTES_PER_FRAME );
if( _keep_settings == FALSE )
if( _keep_settings == false )
{
m_frames = m_origFrames;
m_loopStartFrame = m_startFrame = 0;
@@ -185,9 +185,16 @@ void sampleBuffer::update( bool _keep_settings )
int_sample_t * buf = NULL;
ch_cnt_t channels = DEFAULT_CHANNELS;
sample_rate_t samplerate = engine::getMixer()->baseSampleRate();
m_frames = 0;
if( QFileInfo( file ).size() > 100*1024*1024 )
{
qWarning( "refusing to load sample files bigger "
"than 100 MB" );
}
else
{
if( m_frames == 0 )
{
m_frames = decodeSampleSF( f, buf, channels,
@@ -207,6 +214,7 @@ void sampleBuffer::update( bool _keep_settings )
}
delete[] f;
}
if( m_frames > 0 && buf != NULL )
{
@@ -295,7 +303,7 @@ void sampleBuffer::normalizeSampleRate( const sample_rate_t _src_sr,
delete resampled;
}
if( _keep_settings == FALSE )
if( _keep_settings == false )
{
// update frame-variables
m_loopStartFrame = m_startFrame = 0;
@@ -338,7 +346,7 @@ f_cnt_t sampleBuffer::decodeSampleSF( const char * _f,
"sample %s: %s\n", _f, sf_strerror( NULL ) );
#endif
}
return( frames );
return frames;
}
@@ -350,8 +358,8 @@ f_cnt_t sampleBuffer::decodeSampleSF( const char * _f,
size_t qfileReadCallback( void * _ptr, size_t _size, size_t _n, void * _udata )
{
return( static_cast<QFile *>( _udata )->read( (char*) _ptr,
_size * _n ) );
return static_cast<QFile *>( _udata )->read( (char*) _ptr,
_size * _n );
}
@@ -373,7 +381,7 @@ int qfileSeekCallback( void * _udata, ogg_int64_t _offset, int _whence )
{
f->seek( _offset );
}
return( 0 );
return 0;
}
@@ -382,7 +390,7 @@ int qfileSeekCallback( void * _udata, ogg_int64_t _offset, int _whence )
int qfileCloseCallback( void * _udata )
{
delete static_cast<QFile *>( _udata );
return( 0 );
return 0;
}
@@ -390,7 +398,7 @@ int qfileCloseCallback( void * _udata )
long qfileTellCallback( void * _udata )
{
return( static_cast<QFile *>( _udata )->pos() );
return static_cast<QFile *>( _udata )->pos();
}
@@ -414,10 +422,10 @@ f_cnt_t sampleBuffer::decodeSampleOGGVorbis( const char * _f,
f_cnt_t frames = 0;
QFile * f = new QFile( _f );
if( f->open( QFile::ReadOnly ) == FALSE )
if( f->open( QFile::ReadOnly ) == false )
{
delete f;
return( 0 );
return 0;
}
int err = ov_open_callbacks( f, &vf, NULL, 0, callbacks );
@@ -448,7 +456,7 @@ f_cnt_t sampleBuffer::decodeSampleOGGVorbis( const char * _f,
break;
}
delete f;
return( 0 );
return 0;
}
ov_pcm_seek( &vf, 0 );
@@ -479,7 +487,7 @@ f_cnt_t sampleBuffer::decodeSampleOGGVorbis( const char * _f,
ov_clear( &vf );
return( frames );
return frames;
}
#endif
@@ -492,7 +500,7 @@ f_cnt_t sampleBuffer::decodeSampleDS( const char * _f,
sample_rate_t & _samplerate )
{
DrumSynth ds;
return( ds.GetDSFileSamples( _f, _buf, _channels ) );
return ds.GetDSFileSamples( _f, _buf, _channels );
}
@@ -509,7 +517,7 @@ bool sampleBuffer::play( sampleFrame * _ab, handleState * _state,
if( m_endFrame == 0 || _frames == 0 )
{
return( FALSE );
return false;
}
const double freq_factor = (double) _freq / (double) m_frequency *
@@ -521,7 +529,7 @@ bool sampleBuffer::play( sampleFrame * _ab, handleState * _state,
freq_factor );
if( total_frames_for_current_pitch == 0 )
{
return( FALSE );
return false;
}
// this holds the number of the first frame to play
@@ -544,14 +552,14 @@ bool sampleBuffer::play( sampleFrame * _ab, handleState * _state,
{
if( play_frame >= m_endFrame )
{
return( FALSE );
return false;
}
frames_for_loop = static_cast<f_cnt_t>(
( m_endFrame - play_frame ) /
freq_factor );
if( frames_for_loop == 0 )
{
return( FALSE );
return false;
}
}
@@ -571,7 +579,7 @@ bool sampleBuffer::play( sampleFrame * _ab, handleState * _state,
src_data.input_frames = fragment_size;
src_data.output_frames = _frames;
src_data.src_ratio = 1.0 / freq_factor;
src_data.end_of_input = _state->m_eof;
src_data.end_of_input = 0;
int error = src_process( _state->m_resamplingData,
&src_data );
if( error )
@@ -584,7 +592,6 @@ bool sampleBuffer::play( sampleFrame * _ab, handleState * _state,
printf( "sampleBuffer: not enough frames: %ld / %d\n",
src_data.output_frames_gen, _frames );
}
_state->m_eof = src_data.end_of_input;
// Advance
play_frame += src_data.input_frames_used;
if( _looped )
@@ -613,7 +620,7 @@ bool sampleBuffer::play( sampleFrame * _ab, handleState * _state,
_state->m_frameIndex = play_frame;
return( TRUE );
return true;
}
@@ -627,14 +634,14 @@ sampleFrame * sampleBuffer::getSampleFragment( f_cnt_t _start,
{
if( _start + _frames <= m_loopEndFrame )
{
return( m_data + _start );
return m_data + _start;
}
}
else
{
if( _start + _frames <= m_endFrame )
{
return( m_data + _start );
return m_data + _start;
}
}
@@ -661,7 +668,7 @@ sampleFrame * sampleBuffer::getSampleFragment( f_cnt_t _start,
BYTES_PER_FRAME );
}
return( *_tmp );
return *_tmp;
}
@@ -671,10 +678,10 @@ f_cnt_t sampleBuffer::getLoopedIndex( f_cnt_t _index ) const
{
if( _index < m_loopEndFrame )
{
return( _index );
return _index;
}
return( m_loopStartFrame + ( _index - m_loopStartFrame )
% ( m_loopEndFrame - m_loopStartFrame ) );
return m_loopStartFrame + ( _index - m_loopStartFrame )
% ( m_loopEndFrame - m_loopStartFrame );
}
@@ -727,7 +734,7 @@ QString sampleBuffer::openAudioFile( void ) const
if( QFileInfo( f ).isRelative() )
{
f = configManager::inst()->userSamplesDir() + f;
if( QFileInfo( f ).exists() == FALSE )
if( QFileInfo( f ).exists() == false )
{
f = configManager::inst()->factorySamplesDir() +
m_audioFile;
@@ -771,12 +778,12 @@ QString sampleBuffer::openAudioFile( void ) const
{
if( ofd.selectedFiles().isEmpty() )
{
return( "" );
return QString::null;
}
return( tryToMakeRelative( ofd.selectedFiles()[0] ) );
return tryToMakeRelative( ofd.selectedFiles()[0] );
}
return( "" );
return QString::null;
}
@@ -795,13 +802,13 @@ FLAC__StreamEncoderWriteStatus flacStreamEncoderWriteCallback(
{
/* if( _bytes == 0 )
{
return( FLAC__STREAM_ENCODER_WRITE_STATUS_OK );
return FLAC__STREAM_ENCODER_WRITE_STATUS_OK;
}*/
return( ( static_cast<QBuffer *>( _client_data )->write(
return ( static_cast<QBuffer *>( _client_data )->write(
(const char *) _buffer, _bytes ) ==
(int) _bytes ) ?
FLAC__STREAM_ENCODER_WRITE_STATUS_OK :
FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR );
FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR;
}
@@ -826,8 +833,8 @@ QString & sampleBuffer::toBase64( QString & _dst ) const
FLAC__StreamEncoder * flac_enc = FLAC__stream_encoder_new();
FLAC__stream_encoder_set_channels( flac_enc, DEFAULT_CHANNELS );
FLAC__stream_encoder_set_blocksize( flac_enc, FRAMES_PER_BUF );
/* FLAC__stream_encoder_set_do_exhaustive_model_search( flac_enc, TRUE );
FLAC__stream_encoder_set_do_mid_side_stereo( flac_enc, TRUE );*/
/* FLAC__stream_encoder_set_do_exhaustive_model_search( flac_enc, true );
FLAC__stream_encoder_set_do_mid_side_stereo( flac_enc, true );*/
FLAC__stream_encoder_set_sample_rate( flac_enc,
engine::getMixer()->sampleRate() );
QBuffer ba_writer;
@@ -877,7 +884,7 @@ QString & sampleBuffer::toBase64( QString & _dst ) const
#endif /* LMMS_HAVE_FLAC_STREAM_ENCODER_H */
return( _dst );
return _dst;
}
@@ -900,7 +907,7 @@ sampleBuffer * sampleBuffer::resample( sampleFrame * _data,
DEFAULT_CHANNELS, &error ) ) != NULL )
{
SRC_DATA src_data;
src_data.end_of_input = 0;
src_data.end_of_input = 1;
src_data.data_in = _data[0];
src_data.data_out = dst_buf[0];
src_data.input_frames = _frames;
@@ -918,7 +925,7 @@ sampleBuffer * sampleBuffer::resample( sampleFrame * _data,
printf( "Error: src_new() failed in sample_buffer.cpp!\n" );
}
dst_sb->update();
return( dst_sb );
return dst_sb;
}
@@ -956,11 +963,11 @@ FLAC__StreamDecoderReadStatus flacStreamDecoderReadCallback(
if( res > 0 )
{
*_bytes = res;
return( FLAC__STREAM_DECODER_READ_STATUS_CONTINUE );
return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
}
*_bytes = 0;
return( FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM );
return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM;
}
@@ -977,14 +984,14 @@ FLAC__StreamDecoderWriteStatus flacStreamDecoderWriteCallback(
{
printf( "channels != 2 in "
"flacStreamDecoderWriteCallback()\n" );
return( FLAC__STREAM_DECODER_WRITE_STATUS_ABORT );
return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
}
if( _frame->header.bits_per_sample != 16 )
{
printf( "bits_per_sample != 16 in "
"flacStreamDecoderWriteCallback()\n" );
return( FLAC__STREAM_DECODER_WRITE_STATUS_ABORT );
return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
}
const f_cnt_t frames = _frame->header.blocksize;
@@ -999,7 +1006,7 @@ FLAC__StreamDecoderWriteStatus flacStreamDecoderWriteCallback(
_client_data )->write_buffer->write(
(const char *) sframe, sizeof( sframe ) );
}
return( FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE );
return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
}
@@ -1112,7 +1119,7 @@ void sampleBuffer::setEndFrame( const f_cnt_t _e )
void sampleBuffer::setAmplification( float _a )
{
m_amplification = _a;
update( TRUE );
update( true );
}
@@ -1121,7 +1128,7 @@ void sampleBuffer::setAmplification( float _a )
void sampleBuffer::setReversed( bool _on )
{
m_reversed = _on;
update( TRUE );
update( true );
}
@@ -1129,7 +1136,7 @@ void sampleBuffer::setReversed( bool _on )
QString sampleBuffer::tryToMakeRelative( const QString & _file )
{
if( QFileInfo( _file ).isRelative() == FALSE )
if( QFileInfo( _file ).isRelative() == false )
{
QString f = QString( _file ).replace( QDir::separator(), '/' );
QString fsd = configManager::inst()->factorySamplesDir();
@@ -1138,14 +1145,14 @@ QString sampleBuffer::tryToMakeRelative( const QString & _file )
usd.replace( QDir::separator(), '/' );
if( f.startsWith( fsd ) )
{
return( QString( f ).mid( fsd.length() ) );
return QString( f ).mid( fsd.length() );
}
else if( f.startsWith( usd ) )
{
return( QString( f ).mid( usd.length() ) );
return QString( f ).mid( usd.length() );
}
}
return( _file );
return _file;
}
@@ -1155,16 +1162,16 @@ QString sampleBuffer::tryToMakeAbsolute( const QString & _file )
{
if( QFileInfo( _file ).isAbsolute() )
{
return( _file );
return _file;
}
QString f = configManager::inst()->userSamplesDir() + _file;
if( QFileInfo( f ).exists() )
{
return( f );
return f;
}
return( configManager::inst()->factorySamplesDir() + _file );
return configManager::inst()->factorySamplesDir() + _file;
}
@@ -1176,12 +1183,11 @@ QString sampleBuffer::tryToMakeAbsolute( const QString & _file )
sampleBuffer::handleState::handleState( bool _varying_pitch ) :
m_frameIndex( 0 ),
m_varyingPitch( _varying_pitch ),
m_eof( 0 )
m_varyingPitch( _varying_pitch )
{
int error;
if( ( m_resamplingData = src_new(/*
( engine::getMixer()->highQuality() == TRUE ) ?
( engine::getMixer()->highQuality() == true ) ?
SRC_SINC_FASTEST :*/
SRC_LINEAR,
DEFAULT_CHANNELS, &error ) ) == NULL )

View File

@@ -85,6 +85,7 @@ timeLine::timeLine( const int _xoff, const int _yoff, const float _ppt,
"loop_point" ) );
}
setAttribute( Qt::WA_OpaquePaintEvent, true );
move( 0, _yoff );
setFixedHeight( s_timeLinePixmap->height() );
@@ -333,7 +334,7 @@ void timeLine::mouseMoveEvent( QMouseEvent * _me )
case MoveLoopEnd:
{
const Uint8 i = m_action - MoveLoopBegin;
if( engine::getMainWindow()->isCtrlPressed() == TRUE )
if( _me->modifiers() & Qt::ControlModifier )
{
// no ctrl-press-hint when having ctrl pressed
delete m_hint;

View File

@@ -4,7 +4,7 @@
* track.cpp - implementation of classes concerning tracks -> neccessary for
* all track-like objects (beat/bassline, sample-track...)
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -40,6 +40,7 @@
#include "track.h"
#include <assert.h>
#include <cstdio>
#include <QtGui/QLayout>
#include <QtGui/QMenu>
@@ -112,16 +113,16 @@ trackContentObject::trackContentObject( track * _track ) :
m_name( QString::null ),
m_startPosition(),
m_length(),
m_mutedModel( FALSE, this, tr( "Muted" ) )
m_mutedModel( false, this, tr( "Muted" ) )
{
if( getTrack() )
{
getTrack()->addTCO( this );
}
setJournalling( FALSE );
setJournalling( false );
movePosition( 0 );
changeLength( 0 );
setJournalling( TRUE );
setJournalling( true );
}
@@ -197,7 +198,7 @@ void trackContentObject::changeLength( const midiTime & _length )
*/
void trackContentObject::undoStep( journalEntry & _je )
{
saveJournallingState( FALSE );
saveJournallingState( false );
switch( _je.actionID() )
{
case Move:
@@ -295,7 +296,7 @@ trackContentObjectView::trackContentObjectView( trackContentObject * _tco,
m_tco( _tco ),
m_trackView( _tv ),
m_action( NoAction ),
m_autoResize( FALSE ),
m_autoResize( false ),
m_initialMouseX( 0 ),
m_hint( NULL )
{
@@ -305,15 +306,16 @@ trackContentObjectView::trackContentObjectView( trackContentObject * _tco,
s_textFloat->setPixmap( embed::getIconPixmap( "clock" ) );
}
setAttribute( Qt::WA_DeleteOnClose );
setAttribute( Qt::WA_OpaquePaintEvent, true );
setAttribute( Qt::WA_DeleteOnClose, true );
setFocusPolicy( Qt::StrongFocus );
setCursor( QCursor( embed::getIconPixmap( "hand" ), 0, 0 ) );
move( 0, 1 );
show();
setFixedHeight( _tv->getTrackContentWidget()->height() - 2 );
setAcceptDrops( TRUE );
setMouseTracking( TRUE );
setAcceptDrops( true );
setMouseTracking( true );
connect( m_tco, SIGNAL( lengthChanged() ),
this, SLOT( updateLength() ) );
@@ -486,7 +488,7 @@ void trackContentObjectView::dropEvent( QDropEvent * _de )
{
// value contains our XML-data so simply create a
// multimediaProject which does the rest for us...
multimediaProject mmp( value, FALSE );
multimediaProject mmp( value, false );
// at least save position before getting to moved to somewhere
// the user doesn't expect...
midiTime pos = m_tco->startPosition();
@@ -536,17 +538,17 @@ void trackContentObjectView::leaveEvent( QEvent * _e )
*/
void trackContentObjectView::mousePressEvent( QMouseEvent * _me )
{
if( m_trackView->getTrackContainerView()->allowRubberband() == TRUE &&
if( m_trackView->getTrackContainerView()->allowRubberband() == true &&
_me->button() == Qt::LeftButton )
{
// if rubberband is active, we can be selected
if( !m_trackView->getTrackContainerView()->rubberBandActive() )
{
if( engine::getMainWindow()->isCtrlPressed() == TRUE )
if( _me->modifiers() & Qt::ControlModifier )
{
setSelected( !isSelected() );
}
else if( isSelected() == TRUE )
else if( isSelected() == true )
{
m_action = MoveSelection;
m_initialMouseX = _me->x();
@@ -558,13 +560,13 @@ void trackContentObjectView::mousePressEvent( QMouseEvent * _me )
}
return;
}
else if( engine::getMainWindow()->isShiftPressed() == TRUE )
else if( _me->modifiers() & Qt::ShiftModifier )
{
// add/remove object to/from selection
selectableObject::mousePressEvent( _me );
}
else if( _me->button() == Qt::LeftButton &&
engine::getMainWindow()->isCtrlPressed() == TRUE )
_me->modifiers() & Qt::ControlModifier )
{
// start drag-action
multimediaProject mmp( multimediaProject::DragNDropData );
@@ -578,11 +580,11 @@ void trackContentObjectView::mousePressEvent( QMouseEvent * _me )
mmp.toString(), thumbnail, this );
}
else if( _me->button() == Qt::LeftButton &&
/* engine::getMainWindow()->isShiftPressed() == FALSE &&*/
fixedTCOs() == FALSE )
/* engine::getMainWindow()->isShiftPressed() == false &&*/
fixedTCOs() == false )
{
// move or resize
m_tco->setJournalling( FALSE );
m_tco->setJournalling( false );
m_initialMouseX = _me->x();
@@ -599,7 +601,7 @@ void trackContentObjectView::mousePressEvent( QMouseEvent * _me )
"a copy." ),
embed::getIconPixmap( "hint" ), 0 );
}
else if( m_autoResize == FALSE )
else if( m_autoResize == false )
{
m_action = Resize;
m_oldTime = m_tco->length();
@@ -619,11 +621,11 @@ void trackContentObjectView::mousePressEvent( QMouseEvent * _me )
}
else if( _me->button() == Qt::MidButton )
{
if( engine::getMainWindow()->isCtrlPressed() )
if( _me->modifiers() & Qt::ControlModifier )
{
m_tco->toggleMute();
}
else if( fixedTCOs() == FALSE )
else if( fixedTCOs() == false )
{
remove();
}
@@ -648,7 +650,7 @@ void trackContentObjectView::mousePressEvent( QMouseEvent * _me )
*/
void trackContentObjectView::mouseMoveEvent( QMouseEvent * _me )
{
if( engine::getMainWindow()->isCtrlPressed() == TRUE )
if( _me->modifiers() & Qt::ControlModifier )
{
delete m_hint;
m_hint = NULL;
@@ -662,8 +664,8 @@ void trackContentObjectView::mouseMoveEvent( QMouseEvent * _me )
m_trackView->getTrackContainerView()->currentPosition()+
static_cast<int>( x * midiTime::ticksPerTact() /
ppt ) );
if( engine::getMainWindow()->isCtrlPressed() ==
FALSE && _me->button() == Qt::NoButton )
if( ! ( _me->modifiers() & Qt::ControlModifier )
&& _me->button() == Qt::NoButton )
{
t = t.toNearestTact();
}
@@ -682,7 +684,7 @@ void trackContentObjectView::mouseMoveEvent( QMouseEvent * _me )
QVector<selectableObject *> so =
m_trackView->getTrackContainerView()->selectedObjects();
QVector<trackContentObject *> tcos;
midiTime smallest_pos;
midiTime smallest_pos, t;
// find out smallest position of all selected objects for not
// moving an object before zero
for( QVector<selectableObject *>::iterator it = so.begin();
@@ -704,10 +706,15 @@ void trackContentObjectView::mouseMoveEvent( QMouseEvent * _me )
for( QVector<trackContentObject *>::iterator it = tcos.begin();
it != tcos.end(); ++it )
{
( *it )->movePosition( ( *it )->startPosition() +
static_cast<int>( dx *
midiTime::ticksPerTact() / ppt ) -
smallest_pos );
t = ( *it )->startPosition() +
static_cast<int>( dx *midiTime::ticksPerTact() /
ppt )-smallest_pos;
if( ! ( _me->modifiers() & Qt::AltModifier )
&& _me->button() == Qt::NoButton )
{
t = t.toNearestTact();
}
( *it )->movePosition( t );
}
}
else if( m_action == Resize )
@@ -715,8 +722,8 @@ void trackContentObjectView::mouseMoveEvent( QMouseEvent * _me )
midiTime t = qMax( midiTime::ticksPerTact(),
static_cast<int>( _me->x() *
midiTime::ticksPerTact() / ppt ) );
if( engine::getMainWindow()->isCtrlPressed() ==
FALSE && _me->button() == Qt::NoButton )
if( ! ( _me->modifiers() & Qt::ControlModifier )
&& _me->button() == Qt::NoButton )
{
t = t.toNearestTact();
}
@@ -771,7 +778,7 @@ void trackContentObjectView::mouseReleaseEvent( QMouseEvent * _me )
{
if( m_action == Move || m_action == Resize )
{
m_tco->setJournalling( TRUE );
m_tco->setJournalling( true );
m_tco->addJournalEntry( journalEntry( m_action, m_oldTime -
( ( m_action == Move ) ?
m_tco->startPosition() : m_tco->length() ) ) );
@@ -797,7 +804,7 @@ void trackContentObjectView::mouseReleaseEvent( QMouseEvent * _me )
void trackContentObjectView::contextMenuEvent( QContextMenuEvent * _cme )
{
QMenu contextMenu( this );
if( fixedTCOs() == FALSE )
if( fixedTCOs() == false )
{
contextMenu.addAction( embed::getIconPixmap( "cancel" ),
tr( "Delete (middle mousebutton)" ),
@@ -863,14 +870,14 @@ trackContentWidget::trackContentWidget( trackView * _parent ) :
QWidget( _parent ),
m_trackView( _parent )
{
setAcceptDrops( TRUE );
setAcceptDrops( true );
connect( _parent->getTrackContainerView(),
SIGNAL( positionChanged( const midiTime & ) ),
this, SLOT( changePosition( const midiTime & ) ) );
setAutoFillBackground( false );
setAttribute( Qt::WA_OpaquePaintEvent );
setAttribute( Qt::WA_OpaquePaintEvent, true );
}
@@ -903,7 +910,7 @@ void trackContentWidget::addTCOView( trackContentObjectView * _tcov )
m_tcoViews.push_back( _tcov );
tco->saveJournallingState( FALSE );
tco->saveJournallingState( false );
changePosition();
tco->restoreJournallingState();
@@ -1070,7 +1077,7 @@ void trackContentWidget::dropEvent( QDropEvent * _de )
QString type = stringPairDrag::decodeKey( _de );
QString value = stringPairDrag::decodeValue( _de );
if( type == ( "tco_" + QString::number( getTrack()->type() ) ) &&
m_trackView->getTrackContainerView()->fixedTCOs() == FALSE )
m_trackView->getTrackContainerView()->fixedTCOs() == false )
{
const midiTime pos = getPosition( _de->pos().x()
).toNearestTact();
@@ -1078,7 +1085,7 @@ void trackContentWidget::dropEvent( QDropEvent * _de )
// value contains our XML-data so simply create a
// multimediaProject which does the rest for us...
multimediaProject mmp( value, FALSE );
multimediaProject mmp( value, false );
// at least save position before getting moved to somewhere
// the user doesn't expect...
tco->restoreState( mmp.content().firstChild().toElement() );
@@ -1101,11 +1108,11 @@ void trackContentWidget::dropEvent( QDropEvent * _de )
*/
void trackContentWidget::mousePressEvent( QMouseEvent * _me )
{
if( m_trackView->getTrackContainerView()->allowRubberband() == TRUE )
if( m_trackView->getTrackContainerView()->allowRubberband() == true )
{
QWidget::mousePressEvent( _me );
}
else if( engine::getMainWindow()->isShiftPressed() == TRUE )
else if( _me->modifiers() & Qt::ShiftModifier )
{
QWidget::mousePressEvent( _me );
}
@@ -1116,7 +1123,7 @@ void trackContentWidget::mousePressEvent( QMouseEvent * _me )
midiTime::ticksPerTact();
trackContentObject * tco = getTrack()->createTCO( pos );
tco->saveJournallingState( FALSE );
tco->saveJournallingState( false );
tco->movePosition( pos );
tco->restoreJournallingState();
@@ -1132,76 +1139,16 @@ void trackContentWidget::mousePressEvent( QMouseEvent * _me )
*/
void trackContentWidget::paintEvent( QPaintEvent * _pe )
{
static QPixmap backgrnd;
static int last_geometry = 0;
QPainter p( this );
const int tactsPerBar = 4;
const trackContainerView * tcv = m_trackView->getTrackContainerView();
// Assume even-pixels-per-tact. Makes sense, should be like this anyways
const trackContainerView * tcv = m_trackView->getTrackContainerView();
int ppt = static_cast<int>( tcv->pixelsPerTact() );
// Update background if needed
if( ppt*height() != last_geometry )
{
int w = ppt * tactsPerBar;
int h = height();
backgrnd = QPixmap( w * 2, height() );
QPainter pmp( &backgrnd );
//pmp.setRenderHint( QPainter::Antialiasing );
QLinearGradient grad( 0, 1, 0, h-2 );
pmp.fillRect( 0, 0, 1, h, QColor( 96, 96, 96 ) );
pmp.fillRect( 1, 0, w+1, h, QColor( 128, 128, 128 ) );
grad.setColorAt( 0.0, QColor( 64, 64, 64 ) );
grad.setColorAt( 0.3, QColor( 128, 128, 128 ) );
grad.setColorAt( 0.5, QColor( 128, 128, 128 ) );
grad.setColorAt( 0.95, QColor( 160, 160, 160 ) );
//grad.setColorAt( 1.0, QColor( 128, 128, 128 ) );
//grad.setColorAt( 1.0, QColor( 64, 64, 64) );
pmp.fillRect( 0, 1, w, h-2, grad );
QLinearGradient grad2( 0,1, 0, h-2 );
pmp.fillRect( w+1, 0, w , h, QColor( 96, 96, 96 ) );
grad2.setColorAt( 0.0, QColor( 48, 48, 48 ) );
grad2.setColorAt( 0.3, QColor( 96, 96, 96 ) );
grad2.setColorAt( 0.5, QColor( 96, 96, 96 ) );
grad2.setColorAt( 0.95, QColor( 120, 120, 120 ) );
//grad2.setColorAt( 1.0, QColor( 96, 96, 96 ) );
//grad2.setColorAt( 1.0, QColor( 48, 48, 48 ) );
pmp.fillRect( w, 1, w , h-2, grad2 );
// draw vertical lines
//pmp.setPen( QPen( QBrush( QColor( 80, 84, 96, 192 ) ), 1 ) );
pmp.setPen( QPen( QColor( 0, 0, 0, 112 ), 1 ) );
for( float x = 0.5; x < w * 2; x += ppt )
{
pmp.drawLine( QLineF( x, 1.0, x, h-2.0 ) );
}
//pmp.setPen( QPen( QColor( 255,0,0, 128 ), 1 ) );
pmp.drawLine( 0, 1, w*2, 1 );
pmp.setPen( QPen( QColor( 255, 255, 255, 32 ), 1 ) );
for( float x = 1.5; x < w * 2; x += ppt )
{
pmp.drawLine( QLineF( x, 1.0, x, h-2.0 ) );
}
//pmp.setPen( QPen( QColor( 0,255,0, 128 ), 1 ) );
pmp.drawLine( 0, h-2, w*2, h-2 );
pmp.end();
last_geometry = ppt*h;
}
QPainter p( this );
// Don't draw background on BB-Editor
if( m_trackView->getTrackContainerView() != engine::getBBEditor() )
{
p.drawTiledPixmap( rect(), backgrnd, QPoint(
p.drawTiledPixmap( rect(), m_background, QPoint(
tcv->currentPosition().getTact() * ppt, 0 ) );
}
}
@@ -1213,6 +1160,53 @@ void trackContentWidget::paintEvent( QPaintEvent * _pe )
*/
void trackContentWidget::resizeEvent( QResizeEvent * _re )
{
// Update backgroud
const int tactsPerBar = 4;
const trackContainerView * tcv = m_trackView->getTrackContainerView();
// Assume even-pixels-per-tact. Makes sense, should be like this anyways
int ppt = static_cast<int>( tcv->pixelsPerTact() );
int w = ppt * tactsPerBar;
int h = height();
m_background = QPixmap( w * 2, height() );
QPainter pmp( &m_background );
QLinearGradient grad( 0, 1, 0, h-2 );
pmp.fillRect( 0, 0, 1, h, QColor( 96, 96, 96 ) );
pmp.fillRect( 1, 0, w+1, h, QColor( 128, 128, 128 ) );
grad.setColorAt( 0.0, QColor( 64, 64, 64 ) );
grad.setColorAt( 0.3, QColor( 128, 128, 128 ) );
grad.setColorAt( 0.5, QColor( 128, 128, 128 ) );
grad.setColorAt( 0.95, QColor( 160, 160, 160 ) );
pmp.fillRect( 0, 1, w, h-2, grad );
QLinearGradient grad2( 0,1, 0, h-2 );
pmp.fillRect( w+1, 0, w , h, QColor( 96, 96, 96 ) );
grad2.setColorAt( 0.0, QColor( 48, 48, 48 ) );
grad2.setColorAt( 0.3, QColor( 96, 96, 96 ) );
grad2.setColorAt( 0.5, QColor( 96, 96, 96 ) );
grad2.setColorAt( 0.95, QColor( 120, 120, 120 ) );
pmp.fillRect( w, 1, w , h-2, grad2 );
// draw vertical lines
pmp.setPen( QPen( QColor( 0, 0, 0, 112 ), 1 ) );
for( float x = 0.5; x < w * 2; x += ppt )
{
pmp.drawLine( QLineF( x, 1.0, x, h-2.0 ) );
}
pmp.drawLine( 0, 1, w*2, 1 );
pmp.setPen( QPen( QColor( 255, 255, 255, 32 ), 1 ) );
for( float x = 1.5; x < w * 2; x += ppt )
{
pmp.drawLine( QLineF( x, 1.0, x, h-2.0 ) );
}
pmp.drawLine( 0, h-2, w*2, h-2 );
pmp.end();
// Force redraw
update();
}
@@ -1225,7 +1219,7 @@ void trackContentWidget::resizeEvent( QResizeEvent * _re )
*/
void trackContentWidget::undoStep( journalEntry & _je )
{
saveJournallingState( FALSE );
saveJournallingState( false );
switch( _je.actionID() )
{
case AddTrackContentObject:
@@ -1249,7 +1243,7 @@ void trackContentWidget::undoStep( journalEntry & _je )
trackContentObject * tco = getTrack()->createTCO(
midiTime( 0 ) );
multimediaProject mmp(
_je.data().toMap()["state"].toString(), FALSE );
_je.data().toMap()["state"].toString(), false );
tco->restoreState(
mmp.content().firstChild().toElement() );
break;
@@ -1367,6 +1361,7 @@ trackOperationsWidget::trackOperationsWidget( trackView * _parent ) :
m_trackOps = new QPushButton( this );
m_trackOps->move( 12, 1 );
m_trackOps->setFocusPolicy( Qt::NoFocus );
m_trackOps->setMenu( to_menu );
toolTip::add( m_trackOps, tr( "Actions for this track" ) );
@@ -1374,7 +1369,7 @@ trackOperationsWidget::trackOperationsWidget( trackView * _parent ) :
m_muteBtn = new pixmapButton( this, tr( "Mute" ) );
m_muteBtn->setActiveGraphic( embed::getIconPixmap( "led_off" ) );
m_muteBtn->setInactiveGraphic( embed::getIconPixmap( "led_green" ) );
m_muteBtn->setCheckable( TRUE );
m_muteBtn->setCheckable( true );
m_muteBtn->move( 46, 8 );
m_muteBtn->show();
toolTip::add( m_muteBtn, tr( "Mute this track" ) );
@@ -1382,7 +1377,7 @@ trackOperationsWidget::trackOperationsWidget( trackView * _parent ) :
m_soloBtn = new pixmapButton( this, tr( "Solo" ) );
m_soloBtn->setActiveGraphic( embed::getIconPixmap( "led_red" ) );
m_soloBtn->setInactiveGraphic( embed::getIconPixmap( "led_off" ) );
m_soloBtn->setCheckable( TRUE );
m_soloBtn->setCheckable( true );
m_soloBtn->move( 62, 8 );
toolTip::add( m_soloBtn, tr( "Solo" ) );
@@ -1390,7 +1385,6 @@ trackOperationsWidget::trackOperationsWidget( trackView * _parent ) :
m_trackView->getTrackContainerView(),
SLOT( deleteTrackView( trackView * ) ),
Qt::QueuedConnection );
}
@@ -1419,7 +1413,7 @@ trackOperationsWidget::~trackOperationsWidget()
void trackOperationsWidget::mousePressEvent( QMouseEvent * _me )
{
if( _me->button() == Qt::LeftButton &&
engine::getMainWindow()->isCtrlPressed() == TRUE &&
_me->modifiers() & Qt::ControlModifier &&
m_trackView->getTrack()->type() != track::BBTrack )
{
multimediaProject mmp( multimediaProject::DragNDropData );
@@ -1455,9 +1449,9 @@ void trackOperationsWidget::mousePressEvent( QMouseEvent * _me )
void trackOperationsWidget::paintEvent( QPaintEvent * _pe )
{
QPainter p( this );
p.fillRect( rect(), QColor( 56, 60, 72 ) );
p.fillRect( rect(), palette().brush(QPalette::Background) );
if( m_trackView->isMovingTrack() == FALSE )
if( m_trackView->isMovingTrack() == false )
{
p.drawPixmap( 2, 2, *s_grip );
m_trackOps->show();
@@ -1545,11 +1539,11 @@ track::track( TrackTypes _type, trackContainer * _tc ) :
m_trackContainer( _tc ), /*!< The track container object */
m_type( _type ), /*!< The track type */
m_name(), /*!< The track's name */
m_mutedModel( FALSE, this, tr( "Muted" ) ),
m_mutedModel( false, this, tr( "Muted" ) ),
/*!< For controlling track muting */
m_soloModel( FALSE, this, tr( "Solo" ) ),
m_soloModel( false, this, tr( "Solo" ) ),
/*!< For controlling track soloing */
m_simpleSerializingMode( FALSE ),
m_simpleSerializingMode( false ),
m_trackContentObjects() /*!< The track content objects (segments) */
{
m_trackContainer->addTrack( this );
@@ -1601,7 +1595,7 @@ track * track::create( TrackTypes _tt, trackContainer * _tc )
// case VIDEO_TRACK:
case AutomationTrack: t = new automationTrack( _tc ); break;
case HiddenAutomationTrack:
t = new automationTrack( _tc, TRUE ); break;
t = new automationTrack( _tc, true ); break;
default: break;
}
@@ -1680,7 +1674,7 @@ void track::saveSettings( QDomDocument & _doc, QDomElement & _this )
if( m_simpleSerializingMode )
{
m_simpleSerializingMode = FALSE;
m_simpleSerializingMode = false;
return;
}
@@ -1732,7 +1726,7 @@ void track::loadSettings( const QDomElement & _this )
}
node = node.nextSibling();
}
m_simpleSerializingMode = FALSE;
m_simpleSerializingMode = false;
return;
}
@@ -1757,7 +1751,7 @@ void track::loadSettings( const QDomElement & _this )
trackContentObject * tco = createTCO(
midiTime( 0 ) );
tco->restoreState( node.toElement() );
saveJournallingState( FALSE );
saveJournallingState( false );
restoreJournallingState();
}
}
@@ -1903,18 +1897,18 @@ void track::getTCOsInRange( tcoVector & _tco_v, const midiTime & _start,
// ok, TCO is posated within given range
// now let's search according position for TCO in list
// -> list is ordered by TCO's position afterwards
bool inserted = FALSE;
bool inserted = false;
for( tcoVector::iterator it = _tco_v.begin();
it != _tco_v.end(); ++it )
{
if( ( *it )->startPosition() >= s )
{
_tco_v.insert( it, tco );
inserted = TRUE;
inserted = true;
break;
}
}
if( inserted == FALSE )
if( inserted == false )
{
// no TCOs found posated behind current TCO...
_tco_v.push_back( tco );
@@ -2031,7 +2025,7 @@ void track::toggleSolo( void )
{
const trackContainer::trackList & tl = m_trackContainer->tracks();
bool solo_before = FALSE;
bool solo_before = false;
for( trackContainer::trackList::const_iterator it = tl.begin();
it != tl.end(); ++it )
{
@@ -2039,7 +2033,7 @@ void track::toggleSolo( void )
{
if( ( *it )->m_soloModel.value() )
{
solo_before = TRUE;
solo_before = true;
break;
}
}
@@ -2056,10 +2050,10 @@ void track::toggleSolo( void )
{
( *it )->m_mutedBeforeSolo = ( *it )->isMuted();
}
( *it )->setMuted( *it == this ? FALSE : TRUE );
( *it )->setMuted( *it == this ? false : true );
if( *it != this )
{
( *it )->m_soloModel.setValue( FALSE );
( *it )->m_soloModel.setValue( false );
}
}
else if( !solo_before )
@@ -2097,16 +2091,12 @@ trackView::trackView( track * _track, trackContainerView * _tcv ) :
m_trackContentWidget( this ), /*!< Our trackContentWidget */
m_action( NoAction ) /*!< The action we're currently performing */
{
setAutoFillBackground( TRUE );
setAutoFillBackground( true );
QPalette pal;
pal.setColor( backgroundRole(), QColor( 32, 36, 40 ) );
setPalette( pal );
m_trackSettingsWidget.setAutoFillBackground( TRUE );
pal.setColor( m_trackSettingsWidget.backgroundRole(),
QColor( 56, 60, 72 ) );
m_trackSettingsWidget.setPalette( pal );
m_trackSettingsWidget.setAutoFillBackground( true );
QHBoxLayout * layout = new QHBoxLayout( this );
layout->setMargin( 0 );
@@ -2117,8 +2107,9 @@ trackView::trackView( track * _track, trackContainerView * _tcv ) :
resizeEvent( NULL );
setAcceptDrops( TRUE );
setAttribute( Qt::WA_DeleteOnClose );
setAcceptDrops( true );
setAttribute( Qt::WA_DeleteOnClose, true );
setAttribute( Qt::WA_OpaquePaintEvent, true );
connect( m_track, SIGNAL( destroyedTrack() ), this, SLOT( close() ) );
@@ -2221,7 +2212,7 @@ void trackView::modelChanged( void )
*/
void trackView::undoStep( journalEntry & _je )
{
saveJournallingState( FALSE );
saveJournallingState( false );
switch( _je.actionID() )
{
case MoveTrack:
@@ -2289,7 +2280,7 @@ void trackView::dropEvent( QDropEvent * _de )
{
// value contains our XML-data so simply create a
// multimediaProject which does the rest for us...
multimediaProject mmp( value, FALSE );
multimediaProject mmp( value, false );
engine::getMixer()->lock();
m_track->restoreState( mmp.content().firstChild().toElement() );
engine::getMixer()->unlock();
@@ -2315,13 +2306,13 @@ void trackView::dropEvent( QDropEvent * _de )
*/
void trackView::mousePressEvent( QMouseEvent * _me )
{
if( m_trackContainerView->allowRubberband() == TRUE )
if( m_trackContainerView->allowRubberband() == true )
{
QWidget::mousePressEvent( _me );
}
else if( _me->button() == Qt::LeftButton )
{
if( engine::getMainWindow()->isShiftPressed() == TRUE )
if( _me->modifiers() & Qt::ShiftModifier )
{
m_action = ResizeTrack;
QCursor::setPos( mapToGlobal( QPoint( _me->x(),
@@ -2369,7 +2360,7 @@ void trackView::mousePressEvent( QMouseEvent * _me )
*/
void trackView::mouseMoveEvent( QMouseEvent * _me )
{
if( m_trackContainerView->allowRubberband() == TRUE )
if( m_trackContainerView->allowRubberband() == true )
{
QWidget::mouseMoveEvent( _me );
}

View File

@@ -144,7 +144,7 @@ void automatableModelView::setModel( model * _model, bool _old_model_valid )
void automatableModelView::mousePressEvent( QMouseEvent * _me )
{
if( _me->button() == Qt::LeftButton &&
engine::getMainWindow()->isCtrlPressed() == TRUE )
_me->modifiers() & Qt::ControlModifier )
{
new stringPairDrag( "automatable_model",
QString::number( modelUntyped()->id() ),

View File

@@ -118,6 +118,8 @@ automationEditor::automationEditor( void ) :
"edit_move" ) );
}
setAttribute( Qt::WA_OpaquePaintEvent, true );
// add time-line
m_timeLine = new timeLine( VALUES_WIDTH, 32, m_ppt,
engine::getSong()->getPlayPos(
@@ -743,7 +745,7 @@ void automationEditor::mousePressEvent( QMouseEvent * _me )
m_editMode == DRAW )
{
// Connect the dots
if( engine::getMainWindow()->isShiftPressed() )
if( _me->modifiers() & Qt::ShiftModifier )
{
drawLine( m_drawLastTick,
m_drawLastLevel,
@@ -1610,7 +1612,7 @@ void automationEditor::resizeEvent( QResizeEvent * )
void automationEditor::wheelEvent( QWheelEvent * _we )
{
_we->accept();
if( engine::getMainWindow()->isCtrlPressed() == TRUE )
if( _we->modifiers() & Qt::ControlModifier )
{
if( _we->delta() > 0 )
{
@@ -1630,7 +1632,8 @@ void automationEditor::wheelEvent( QWheelEvent * _we )
m_timeLine->setPixelsPerTact( m_ppt );
update();
}
else if( engine::getMainWindow()->isShiftPressed() )
else if( _we->modifiers() & Qt::ShiftModifier
|| _we->orientation() == Qt::Horizontal )
{
m_leftRightScroll->setValue( m_leftRightScroll->value() -
_we->delta() * 2 / 15 );

View File

@@ -0,0 +1,338 @@
/*
* automation_pattern_view.cpp - implementation of view for automationPattern
*
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#include <QtGui/QMouseEvent>
#include <QtGui/QPainter>
#include <QtGui/QMenu>
#include "automation_pattern_view.h"
#include "automation_editor.h"
#include "automation_pattern.h"
#include "embed.h"
#include "engine.h"
#include "gui_templates.h"
#include "project_journal.h"
#include "rename_dialog.h"
#include "string_pair_drag.h"
#include "tooltip.h"
automationPatternView::automationPatternView( automationPattern * _pattern,
trackView * _parent ) :
trackContentObjectView( _pattern, _parent ),
m_pat( _pattern ),
m_paintPixmap(),
m_needsUpdate( true )
{
connect( m_pat, SIGNAL( dataChanged() ),
this, SLOT( update() ) );
setAttribute( Qt::WA_OpaquePaintEvent, true );
setFixedHeight( parentWidget()->height() - 2 );
setAutoResizeEnabled( false );
toolTip::add( this, tr( "double-click to open this pattern in "
"automation editor" ) );
}
automationPatternView::~automationPatternView()
{
}
void automationPatternView::update( void )
{
m_needsUpdate = true;
if( fixedTCOs() )
{
m_pat->changeLength( m_pat->length() );
}
trackContentObjectView::update();
}
void automationPatternView::resetName( void )
{
m_pat->setName( QString::null );
}
void automationPatternView::changeName( void )
{
QString s = m_pat->name();
renameDialog rename_dlg( s );
rename_dlg.exec();
m_pat->setName( s );
update();
}
void automationPatternView::disconnectObject( QAction * _a )
{
journallingObject * j = engine::getProjectJournal()->
getJournallingObject( _a->data().toInt() );
if( j && dynamic_cast<automatableModel *>( j ) )
{
m_pat->m_objects.erase( qFind( m_pat->m_objects.begin(),
m_pat->m_objects.end(),
dynamic_cast<automatableModel *>( j ) ) );
update();
}
}
void automationPatternView::constructContextMenu( QMenu * _cm )
{
QAction * a = new QAction( embed::getIconPixmap( "automation" ),
tr( "Open in Automation editor" ), _cm );
_cm->insertAction( _cm->actions()[0], a );
connect( a, SIGNAL( triggered( bool ) ),
m_pat, SLOT( openInAutomationEditor() ) );
_cm->insertSeparator( _cm->actions()[1] );
_cm->addSeparator();
_cm->addAction( embed::getIconPixmap( "edit_erase" ),
tr( "Clear" ), m_pat, SLOT( clear() ) );
_cm->addSeparator();
_cm->addAction( embed::getIconPixmap( "reload" ), tr( "Reset name" ),
this, SLOT( resetName() ) );
_cm->addAction( embed::getIconPixmap( "edit_rename" ),
tr( "Change name" ),
this, SLOT( changeName() ) );
if( !m_pat->m_objects.isEmpty() )
{
_cm->addSeparator();
QMenu * m = new QMenu( tr( "%1 Connections" ).
arg( m_pat->m_objects.count() ), _cm );
for( automationPattern::objectVector::iterator it =
m_pat->m_objects.begin();
it != m_pat->m_objects.end(); ++it )
{
if( *it )
{
a = new QAction( tr( "Disconnect \"%1\"" ).
arg( ( *it )->fullDisplayName() ), m );
a->setData( ( *it )->id() );
m->addAction( a );
}
}
connect( m, SIGNAL( triggered( QAction * ) ),
this, SLOT( disconnectObject( QAction * ) ) );
_cm->addMenu( m );
}
_cm->addSeparator();
}
void automationPatternView::mouseDoubleClickEvent( QMouseEvent * _me )
{
if( _me->button() != Qt::LeftButton )
{
_me->ignore();
return;
}
m_pat->openInAutomationEditor();
}
void automationPatternView::paintEvent( QPaintEvent * )
{
if( m_needsUpdate == false )
{
QPainter p( this );
p.drawPixmap( 0, 0, m_paintPixmap );
return;
}
m_needsUpdate = false;
if( m_paintPixmap.isNull() == true || m_paintPixmap.size() != size() )
{
m_paintPixmap = QPixmap( size() );
}
QPainter p( &m_paintPixmap );
QLinearGradient lingrad( 0, 0, 0, height() );
const QColor c = isSelected() ? QColor( 0, 0, 224 ) :
QColor( 96, 96, 96 );
lingrad.setColorAt( 0, c );
lingrad.setColorAt( 0.5, Qt::black );
lingrad.setColorAt( 1, c );
p.setBrush( lingrad );
p.setPen( QColor( 0, 0, 0 ) );
p.drawRect( QRect( 0, 0, width() - 1, height() - 1 ) );
const float ppt = fixedTCOs() ?
( parentWidget()->width() - 2 * TCO_BORDER_WIDTH )
/ (float) m_pat->length().getTact() :
pixelsPerTact();
const int x_base = TCO_BORDER_WIDTH;
p.setPen( QColor( 0, 0, 0 ) );
for( tact t = 1; t < m_pat->length().getTact(); ++t )
{
p.drawLine( x_base + static_cast<int>( ppt * t ) - 1,
TCO_BORDER_WIDTH, x_base + static_cast<int>(
ppt * t ) - 1, 5 );
p.drawLine( x_base + static_cast<int>( ppt * t ) - 1,
height() - ( 4 + 2 * TCO_BORDER_WIDTH ),
x_base + static_cast<int>( ppt * t ) - 1,
height() - 2 * TCO_BORDER_WIDTH );
}
const float min = m_pat->firstObject()->minValue<float>();
const float max = m_pat->firstObject()->maxValue<float>();
const float y_scale = max - min;
const float h = ( height()-2*TCO_BORDER_WIDTH ) / y_scale;
p.translate( 0.0f, max * height() / y_scale-1 );
p.scale( 1.0f, -h );
QLinearGradient lin2grad( 0, min, 0, max );
const QColor cl = QColor( 255, 224, 0 );
const QColor cd = QColor( 229, 158, 0 );
lin2grad.setColorAt( 1, cl );
lin2grad.setColorAt( 0, cd );
for( automationPattern::timeMap::const_iterator it =
m_pat->getTimeMap().begin();
it != m_pat->getTimeMap().end(); ++it )
{
const float x1 = 2 * x_base + it.key() * ppt /
midiTime::ticksPerTact();
float x2;
if( it+1 != m_pat->getTimeMap().end() )
{
x2 = (it+1).key() * ppt / midiTime::ticksPerTact() + 2;
}
else
{
x2 = (float)( width() - TCO_BORDER_WIDTH );
}
p.fillRect( QRectF( x1, 0.0f, x2-x1, it.value() ),
lin2grad );
}
p.resetMatrix();
p.setFont( pointSize<7>( p.font() ) );
if( m_pat->isMuted() || m_pat->getTrack()->isMuted() )
{
p.setPen( QColor( 192, 192, 192 ) );
}
else
{
p.setPen( QColor( 0, 64, 255 ) );
}
p.drawText( 2, p.fontMetrics().height() - 1, m_pat->name() );
if( m_pat->isMuted() )
{
p.drawPixmap( 3, p.fontMetrics().height() + 1,
embed::getIconPixmap( "muted", 16, 16 ) );
}
p.end();
p.begin( this );
p.drawPixmap( 0, 0, m_paintPixmap );
}
void automationPatternView::dragEnterEvent( QDragEnterEvent * _dee )
{
stringPairDrag::processDragEnterEvent( _dee, "automatable_model" );
if( !_dee->isAccepted() )
{
trackContentObjectView::dragEnterEvent( _dee );
}
}
void automationPatternView::dropEvent( QDropEvent * _de )
{
QString type = stringPairDrag::decodeKey( _de );
QString val = stringPairDrag::decodeValue( _de );
if( type == "automatable_model" )
{
automatableModel * mod = dynamic_cast<automatableModel *>(
engine::getProjectJournal()->
getJournallingObject( val.toInt() ) );
if( mod != NULL )
{
m_pat->addObject( mod );
}
update();
if( engine::getAutomationEditor() &&
engine::getAutomationEditor()->currentPattern() ==
m_pat )
{
engine::getAutomationEditor()->setCurrentPattern(
m_pat );
}
}
else
{
trackContentObjectView::dropEvent( _de );
}
}
#include "moc_automation_pattern_view.cxx"

Some files were not shown because too many files have changed in this diff Show More