Commit Graph

1382 Commits

Author SHA1 Message Date
Vesa V
334a567620 Merge pull request #1234 from floft/master
GIG Player Plugin
2014-11-25 07:03:12 +02:00
Lukas W
3a206071b1 Fix merge conflicts 2014-11-25 01:07:39 +01:00
Lukas W
02cbc89f0f Merge branch 'stable-1.1' of git@github.com:LMMS/lmms.git
Conflicts:
	src/gui/MainWindow.cpp
	src/gui/plugin_browser.cpp
2014-11-25 01:01:47 +01:00
Garrett
205056621c Fixed release samples never being deleted
I removed code in a previous commit that deleted ended samples since
that sometimes caused issues when the samples had loop points. However,
removing the code caused issues with the release samples. Thus, now it
removes ended samples only if they are release samples. Otherwise, the
keyup event and ADSR handle ending the note.
2014-11-23 14:24:51 -08:00
Garrett
366e799791 More What's This messages 2014-11-23 10:31:18 -08:00
Vesa V
09f2f60af3 Merge pull request #1304 from curlymorphic/stable-1.1
Tempo synced Delay Plugin
2014-11-23 15:16:26 +02:00
dave
7e780fc057 Improved ui 2014-11-23 11:20:03 +00:00
dave
e0c10e030b Added linear interpolation , with help from Vesa 2014-11-18 20:38:39 +00:00
Garrett
76e182e586 Release only one note on keyup
Previously if you release a C4 then all C4 notes would be released. Now
it stores the pointer to the plugin data which is unique for each key
press and determines which to release based on the matching pointers.
2014-11-18 09:02:50 -08:00
Garrett
3f641c2c55 Make it work with MemoryManager 2014-11-18 08:30:31 -08:00
Garrett
702e2a1ee3 Added loop support and fixed fine tunings
Now it'll honor the loop regions specified in the file and it'll
properly use the fine tuning for the samples if specified. Also,
modified the exponential decay code again since it was glitching at the
end of some notes for some reason.
2014-11-18 08:05:28 -08:00
Garrett
71b6814729 Change pitch of notes if PitchTrack is set
Now if a Gig file provides a few samples per octave, it'll change the
pitch of the sample specified for a note instead of just assuming it is
the right pitch.

Also, fixed issue where if attack length was zero the note would never
sound.
2014-11-18 08:05:28 -08:00
Garrett
2c0b1ef4b0 Use stack array for buffer instead of gig::buffer_t 2014-11-18 08:05:28 -08:00
Garrett
8693623758 Fixed resampling glitches when deleting notes
Moving the code to detect the sample rates of the currently used samples
after the code deleting notes seemed to fix these glitches. Also, fixed a
few ADSR issues that could have resulted in clipping in the attack or
glitching after the release.
2014-11-18 08:05:27 -08:00
Garrett
a251391249 Always use linear interpolation for resampling 2014-11-18 08:05:27 -08:00
Garrett
4e8508b8a3 Exponential decay for release instead of linear
It now sounds much more like the release in Linux Sampler.
2014-11-18 08:05:27 -08:00
Garrett
822a3c52bb Convert 24-bit data if on big endian system
This is needed since libgig returns 24-bit data in a little endian.
Note: untested as I don't have a big endian system.
2014-11-18 08:05:27 -08:00
Garrett
c0ad77dfca Stack buffers instead of allocating on the heap 2014-11-18 08:05:27 -08:00
Garrett
d1bf19ef4a Don't use "note" as a variable name 2014-11-18 08:05:27 -08:00
Garrett
d0a821947a Fixed resampling issues
When providing extra frames, libsamplerate stores the extras internally
and outputs them in the next period. But, when it has enough internally
to output a whole period, it just outputs the internal buffer while not
using any more input frames. Now I provide some extra frames, check to
see how many frames we used actually used, and update the sample
positions and ADSR accordingly.
2014-11-18 08:05:27 -08:00
Garrett
a679e4e938 Fixed detuned resampling
Apparently the most noticeable detuning issues were caused by rounding
error by integer division.
2014-11-18 08:05:27 -08:00
Garrett
07032260e8 configManager to ConfigManager rename 2014-11-18 08:05:27 -08:00
Garrett
3aaa7ac6c4 Coding style fixes 2014-11-18 08:05:27 -08:00
Garrett
5a3b8d3da1 Restructured into GigNotes which contain GigSamples
Now notes are added/removed by locking only a note mutex when pressing
or releasing a note. Then, while processing we actually find and play
the samples using libgig.
2014-11-18 08:05:27 -08:00
Garrett
74ded6b7ef Switched from std::list to QList 2014-11-18 08:05:26 -08:00
Garrett
473fda505a Removed unused images, replaced logo and background
They aren't all that great, but at least now it doesn't say that it's a
soundfont player.
2014-11-18 08:05:26 -08:00
Garrett
95726eafed Better ADSR support, fixed some segfaults
Now it supports a simple envelope using attack, decay1, sustain, and
release from the GIG file. I couldn't figure out what amplitude it
should go to after decay2 (if set), so currently that is unused.

It would segfault if you had notes being played and then switched the
instrument since the samples no longer exited. Now it'll delete all
notes when you switch GIG files.
2014-11-18 08:05:26 -08:00
Garrett
641be31d66 No more reference counts for GIG file instances
Since libgig can't really be used in a multithreaded way unless it was
somewhat rewritten, just use a separate instance of the file for each
new GIG file regardless of if we already have one open in the current
file. Since it's fast now, you can easily have quite a few very large
GIG files open and still have low latency.

Also removed C++11 requirement since I no longer need a move
constructor.
2014-11-18 08:05:26 -08:00
Garrett
96194bcee2 Stream instead of loading all into memory
Now, when you press a note, it won't have to load the entire sample into
memory before playing the note. This means that now you can play many
more notes without it glitching. Frequently, the entire note sample
isn't played, so before there was a lot of wasted processing time
converting the sample into float and doing sample rate conversions if
needed.

Also, perform sample rate conversion on the final rendered-out version
of all the combined notes for a period. This drastically decreases
processing time.

Note: currently having more than one instance causes glitching
2014-11-18 08:05:26 -08:00
Garrett
337cc833dd Multiple references load samples from one instance without segfault
Now it doesn't appear to segfault when multiple references to the same
instance try accessing samples at the same time. In libgig it said I
just have to create another decompression buffer for each thread. This
doesn't quite make the whole addNotes function thread safe since I still
hear missing notes. But, it's getting closer.
2014-11-18 08:05:26 -08:00
Garrett
261b436f08 Fixed second instance no name
Previously if you created a second instance of a certain GIG file, it
would set the name to an empty string since it didn't create a new
instance, only increased a reference count. Though, it still seg faults
eventually when the reference count is greater than one.
2014-11-18 08:05:26 -08:00
Garrett
85998a7b78 Rebased on master, minor changes 2014-11-18 08:05:26 -08:00
Garrett
d9b4511321 Mutex for note output, delete note after fade out
Hopefully the separate mutex for playing the samples reduces the
glitching. Deleting notes after fading out instead of after the entire
sample finished playing (with many zeros after the fade out) will reduce
the number of notes playing at the same time which should allow for more
actually-heard notes to be played.

Also, moved delete note code from release function into the rendering
the notes to the output function. This seemed to fix notes occasionally
not being released.
2014-11-18 08:05:26 -08:00
Garrett
5b7eb30756 Use release time as linear fade out time
This makes it sound better than before, so that pianos fade out like
expected and synths abruptly stop as intended. It's not the fully
implemented ADSR of the format, but it's better.
2014-11-18 08:05:26 -08:00
Garrett
f544caf18b Key changing dimension, 24-bit samples, locking
Support for 24-bit samples. It just so happens that the only GIG file I
have that is 24-bit also has the key changing dimension set, so I
implemented that so I could compare the output sound with that of Linux
Sampler. It still sounds different, brighter in LMMS. Not sure if that
has to do with gain, ADSR, or incorrect 24-bit decoding. I'm guessing
ADSR.

There were many crashing issues when playing notes when changing
patches/instruments. More locking, less crashing. However, this also
means that it is quite slow when playing a lot of notes with large
samples and converting sample rates. Linux Sampler amazingly can handle
36 or so keys being pressed at once whereas LMMS nowhere near that many
at the moment.
2014-11-18 08:05:26 -08:00
Garrett
cc59313ad9 Release samples, move constructors, attenuation
An initial implementation of playing release samples on key up. It seems
a bit messy at the moment. Wrote a move constructor since there's quite
a bit of passing around the gigNote class. Use attenuation so that notes
set their gain properly based on the information in the GIG file,
quite noticeable on some release samples.

Note that to support move constructors I enabled building the plugin
with the C++11 standard.
2014-11-18 08:05:25 -08:00
Garrett
a18061bdab GIG Player now uses correct velocity and changes sample rate properly
Fixed crashes when loading invalid file, but this required exceptions
since libgig throws exceptions, hence the changes to CMakeLists.txt.

If the sample rate is changed (e.g. on exporting at 48k when the samples
are at 44.1k), when playing the note convert each note individually to
the correct sample rate instead of converting the output from the notes
to the correct sample rate.

Save the instrument so we don't have to search the entire GIG file every
time we play a note. This should make it work better on computers that
don't have tons of RAM.

Currently there is a 0.5 second fade out time when the note is released.
I still have to implement the release-triggered samples.
2014-11-18 08:05:25 -08:00
Garrett
d4adf8cc31 Initial version of the GIG Player
It currently loads 16-bit mono and stereo GIG files. It plays the whole
note (no attack/delay/release), doesn't resample when exporting as a
different sample rate, and it doesn't do anything different based on
velocity.
2014-11-18 08:05:25 -08:00
Vesa
ba05b7523d More peak controller changes:
Add treshold knob to peak controller
This causes the peak controller to react only when the measured peaks are above the set treshold
Might be useful for finetuning your sidechains
2014-11-18 13:58:41 +02:00
Vesa
b441bdae15 Freeverb3: make it work properly on all samplerates 2014-11-18 13:58:41 +02:00
Vesa
f207613d5f Some attention on peak controller 2014-11-18 13:58:40 +02:00
Vesa
50bfed7180 Fix Carla in memmgr branch 2014-11-18 13:58:40 +02:00
Vesa
dc4bfdc60d Various fixes and precautions
Samplebuffer: reload all samples when samplerate changes. This is because of the way LMMS uses samples: we always resample all samples t$
LadspaEffect: some safeguards for the non-inplacebroken plugins which use the same buffer for input and output. Theoretically, if some p$
FxMixer: fix effect processing in multichannel-chains
2014-11-18 13:58:40 +02:00
Vesa
1deb80acc3 Finish audioport rehaul, get vol/pan knobs working again, also some bugfixes
We're now doing the vol/pan stuff in audioport, since this way we avoid the pointless repetition of doing it in the playhandles
2014-11-18 13:58:39 +02:00
Vesa
857de8d2c8 Huge structural changes
Well, this commit got a bit out of hand, what with 26 files changed. Oh well.

Basically, we're using the buffermanager to dispense temporary buffers for playhandles and audioports to use.
This allows us to change the way playhandles work. Earlier, playhandles of the same track were waiting in line
to push their output to the audioport. This was of course inefficient, so now they just register themselves to the port,
then the port handles mixing the buffers.

Caveat: this is still a work in progress, the vol/pan knobs on instruments are temporarily non-functional - will be fixed in
the next commit, but I have to get some sleep now.
2014-11-18 13:58:39 +02:00
Vesa
af60402078 Make it possible to use sample-exact controls in LADSPA plugins
I don't think we currently have any that would support this functionality, but in case someone has a LADSPA plugin that has audiorate control ports, this allows them to be used with the new sample-exact models
Again... not strictly related to memory management, but since I was in that part of the codebase already...
2014-11-18 13:58:38 +02:00
Vesa
daa5f6c26d Use memory management in LADSPA effects
Also optimize non-inplacebroken plugins by using the same buffer for input/output
2014-11-18 13:58:38 +02:00
Vesa
5e4308507b More fixes 2014-11-18 13:58:37 +02:00
Vesa
75770b4d2e Fix 64 bit, increase mm usage 2014-11-18 13:58:36 +02:00
Vesa
9c25be1bde LMMS Memory Manager 2014-11-18 13:58:36 +02:00