Commit Graph

1475 Commits

Author SHA1 Message Date
Tobias Doerffel
0e82b0facc Merge branch 'master' into mixer-new-fifo-arch
Conflicts:
	include/Mixer.h
	src/core/Mixer.cpp
	src/core/audio/AudioPort.cpp
	src/core/main.cpp
2009-11-30 00:50:31 +01:00
Tobias Doerffel
9bb3ab5f16 ProjectRenderer: lock Mixer while calling Song::{start,stop}Export()
We have to lock Mixer when touching Song's state via Song::startExport()
and Song::stopExport() in ProjectRenderer::run() as the FIFO writer
thread may call Mixer::renderNextBuffer() (which calls Song::doActions())
simultaneously. Fixes a random segfault when exporting project.

This was a new bug as the ProjectRenderer does not operate FIFO-less
anymore.
2009-11-29 23:57:30 +01:00
Tobias Doerffel
294fa87475 Merge branch 'auto-save'
* auto-save:
  don't change the current project when auto-saving
  auto-saves every minute and recovers upon crash
  don't show WelcomeScreen when importing/loading

Conflicts:
	src/gui/MainWindow.cpp
2009-11-29 23:21:54 +01:00
Tobias Doerffel
c9802d8a26 ProjectRenderer: start thread with normal priority
There's no need to start the ProjectRenderer thread with high priority
anymore as the actual rendering is done on the other side of the FIFO.
The ProjectRenderer just waits for new data in the FIFO and encodes
them as they arrive.
2009-11-29 15:49:21 +01:00
Tobias Doerffel
03d3548ba1 ProjectRenderer: renamed OutputSettings to EncoderSettings + Doxygen comments
Renamed the ProjectRenderer::OutputSettings structure to
ProjectRenderer::EncoderSettings to better reflect its meaning.

Additionally added some basic Doxygen comments.
2009-11-29 15:37:04 +01:00
Tobias Doerffel
20589f19e4 Mixer: rewrote processing chain of rendered audio buffers
Until now, Mixer not only was responsible for rendering audio buffers
but also managed writing them to audio backend (through a FIFO) and
handled various quality related parameters.

All this functionality has been moved into the new AudioOutputContext
class. It glues together AudioBackend (formerly called AudioDevice),
global quality settings and the Mixer.

The AudioOutputContext class creates a FifoWriter which calls
Mixer::renderNextBuffer() and writes the output into the BufferFifo of
the AudioOutputContext it belongs to. The BufferFifo is read by the
according AudioBackend which belongs to the AudioOutputContext as well.

The AudioOutputContext also handles resampling in case the AudioBackend
wants the buffers in a different samplerate.

During this rewrite the Mixer class and the according source files have
been renamed from "mixer" to "Mixer". This results in small changes
all over LMMS' code base.
2009-11-29 01:46:23 +01:00
Tobias Doerffel
ced0d8ecc6 Merge branch 'master' into fx-mixer-rework 2009-11-26 01:47:38 +01:00
Tobias Doerffel
63cb220090 ResourceDB: added Doxygen comments
Documented the ResourceDB class and all its members.
2009-11-26 01:41:57 +01:00
Tobias Doerffel
dc561a07e7 Revert "Mixer, FifoBuffer, AudioDevice: removed memory allocation/free cycles"
This reverts commit c517f1fa5a.

The commit was not very helpful and introduced new xrun problems.
Instead I'll be rewriting the part of LMMS where Mixer, Mixer's
quality settings, Buffer FIFO and AudioDevice are sticked together.
2009-11-26 01:36:36 +01:00
Tobias Doerffel
c517f1fa5a Mixer, FifoBuffer, AudioDevice: removed memory allocation/free cycles
There's really no need to allocate a buffer each period, push it to the
FifoBuffer and free it when fetching the buffer in
AudioDevice::getNextBuffer(). Instead keep the pointer in FifoBuffer's
pool and reuse it.
2009-11-24 12:46:08 +01:00
Armin Kazmi
92047f5e9e AudioPulseAudio: fixed latency and underrun problems
Try to adjust latency of PulseAudio according to our settings of mixer
so it does not have such a bad latency anymore.

Furthermore force PulseAudio to play silence instead of rewinding
streams in case of underruns.
2009-11-20 23:08:07 +01:00
Tobias Doerffel
168805745e AudioPulseAudio: fixed improper shutdown + free allocated resources
There have been some problems with the threading logic in the
AudioPulseAudio backend resulting in an endless loop when quitting LMMS.

Furthermore allocated PulseAudio resources were not freed properly.
Thanks to Armin Kazmi <armin.kazmi@tu-dortmund.de> for pointing out
this issue.
2009-11-20 22:28:47 +01:00
Andrew Kelley
953522f34a don't change the current project when auto-saving
every time auto-save ran, it would change the current project to
"recover.mmp". Now it doesn't do this because Song has
guiSaveProject(), guiSaveProjectAs(), and saveProjectFile().
(the latter is used for auto-save)
2009-11-13 18:43:08 -07:00
Tobias Doerffel
58f53d9f5b PreferencesDialog: initial draft
Here's an initial draft for the new preferences dialog. The basics of
the GUI are done, however there's absolutely no functionality yet.
2009-11-14 00:36:52 +01:00
Andrew Kelley
b7e73fbe0c don't show WelcomeScreen when importing/loading
WelcomeScreen was incorrectly shown when lmms loaded or imported
a project (for example via command line). Fixed.
2009-11-13 08:18:03 -07:00
Tobias Doerffel
0679c83c33 LocalResourceProvider: watch out for changes in base directory
Changes in base directory were not tracked by filesystem watcher.
Explicitely add base directory to filesystem watcher and add a special
case to LocalResourceProvider::reloadDirectory().
2009-11-11 13:23:14 +01:00
Tobias Doerffel
0b5dae4a2a WelcomeScreen: disable horizontal scrollbars for listviews
When customizing background color of a widget via CSS, Qt somehow
falls back to ugly old windows style. This resulted in ugly looking
scrollbars in WelcomeScreen when working at a low screen resolution.
Therefore disable those scrollbars as they're rather useless anyways.
QListView automatically shows three dots for too wide text items.
2009-11-11 11:16:14 +01:00
Andrew Kelley
f73ccadc17 auto-saves every minute and recovers upon crash
auto-save time is not configurable yet. saves "recover.mmp" to
WORKING_DIR every 60 seconds. Deletes recover.mmp on successful
close of LMMS. If recover.mmp is found upon start, it loads that
project.
2009-11-10 21:41:45 -07:00
Andrew Kelley
96c8dcbeb4 don't show WelcomeScreen when importing/loading
WelcomeScreen was incorrectly shown when lmms loaded or imported
a project (for example via command line). Fixed.
2009-11-10 20:22:38 -07:00
Tobias Doerffel
598bbcd1f7 AudioPulseAudio: alloc pcmbuf via CPU class
In AudioPulseAudio::streamWriteCallback() we're operating on pcmbuf
via an operation from CPU class. All methods of CPU assume the buffer
being aligned on 16 byte boundaries. However pa_xmalloc() & friends do
not allocate aligned memory which resulted in a crash when calling
CPU::convertToS16() (SSE2 version takes advantage of aligned memory).

Replacing pa_xmalloc()/pa_xfree() with CPU::memAlloc()/CPU::memFree()
fixes this crash.

Closes bug #2890465.
2009-11-05 10:18:23 +01:00
Tobias Doerffel
822a22ca37 SideBar: rewritten to use QToolBar instead of KMultiTabBar
Rewrote implementation of class SideBar to use QToolBar instead of
KMultiTabBar. We can style the SideBar now easily via CSS and do not
have to ship 3rd party KDE code with LMMS. Also the QToolBar based
SideBar integrates much better into the according widget style.

Furthermore renamed SideBar related classes and files to match new
coding style.
2009-10-31 13:08:03 +01:00
Tobias Doerffel
1633cf2593 Removed usage of ASCII C strings in several places
Still QString::toAscii() & friends were used in several places causing
problems such as failed access to files with non-ASCII characters in
name.

Closes #2884115.
2009-10-27 17:54:40 +01:00
Tobias Doerffel
871c4ae06f Added new DirectorySelectDialog
DirectorySelectDialog is another subclass of ResourceSelectDialog,
allowing to pick a certain directory via a tree view and a filter
line edit.
2009-10-27 00:35:07 +01:00
Tobias Doerffel
91cc2d27aa Minor comment and coding style fixes
Minor comment and coding style fixes in ResourceModel and ResourceBrowser.
2009-10-27 00:34:06 +01:00
Tobias Doerffel
a6d86bbf66 ResourceTreeView: more flexible constructor
Now there's no need anymore to pass a model to constructor of
ResourceTreeView. Instead ResourceTreeView::setModel() can be called
later.
2009-10-27 00:30:19 +01:00
Tobias Doerffel
582ce407de Added generic and flexible ResourceSelectDialog class
Functionality from QuickLoadDialog which can be used in similiar dialogs
for selecting resources has been moved into generic and highly flexible
base class ResourceSelectDialog.
2009-10-27 00:14:41 +01:00
Tobias Doerffel
722aa11563 ResourceBrowser: move implementation of default actions to ResourceAction
Again there's no need for duplicated functionality. Adding a
ResourceAction::defaultTrigger() method allows to separate all
functionality from ResourceBrowser and possibly use it in other places
as well.
2009-10-26 16:21:55 +01:00
Tobias Doerffel
de1675f39e ResourceBrowser: removed duplicate Action enumeration
There's absolutely no need for duplicating the Action enumeration
in ResourceBrowser as there's already one in ResourceAction class.
Replacing the enumeration with ResourceAction's one makes code clearer
and reduces redundancy.
2009-10-26 16:11:07 +01:00
Tobias Doerffel
d9220e3229 ResourceBrowser: added support for importing files
Supported file types can now be imported via ResourceBrowser as well.
2009-10-26 15:54:51 +01:00
Tobias Doerffel
59800c1570 Merge branch 'master' into fx-mixer-rework 2009-10-26 00:24:45 +01:00
Tobias Doerffel
d2fd133f64 Cpu: use qDebug() rather than fprintf()
Using old C functions is really deprecated. Therefore use qDebug()
instead of fprintf().
2009-10-26 00:23:21 +01:00
Tobias Doerffel
2262c00973 FxMixer: use new CPU::bufMixCoeff()
When mixing FX channel to another use new CPU::bufMixCoeff() function
instead of implementing an own (slower) mixing loop.
2009-10-26 00:12:06 +01:00
Tobias Doerffel
aff3789834 Cpu: added BufMixCoeff + SSE implementation
Added another buffer operation BufMixCoeff allowing to mix a certain
buffer to another at a given amount (coeff). CpuX86 has been extended
by an according SSE implementation.
2009-10-26 00:00:37 +01:00
Paul Giblock
3fe353545b Alsa and OSS Device hints
This should resolve the remaining issues.  OSS has auto-complete with
the filesystem.  Alsa has an editable combobox for PCM and MIDI-raw.
The DEVICE  box for Alsa MIDI-seq should be obsoleted
2009-10-25 16:19:57 -04:00
Paul Giblock
82fd694e4a Add dev-file autocompletion to OSS device fields
Added QDirModel-based completion for OSS device fields in the settings
dialog
2009-10-25 16:19:57 -04:00
Paul Giblock
a45a211f2b Add Audio-device listing support for alsa-pcm
Added a AlsaDeviceListModel, will do the same for other devices as well
2009-10-25 16:19:57 -04:00
Tobias Doerffel
ff03ddb8e4 MixerWorkerThread: added job queue modes and improved class structure
JobQueues can now operate in JobQueue::Static and JobQueue::Dynamic mode.
In static mode it operates the way it always used to while in dynamic
mode a changing job queue is supported. This is particularly important
for FX mixer sends.

There were also heavy improvements regarding the overall structure
and functionality of MixerWorkerThread and MixerWorkerThread::JobQueue.
There's now a clean distinction between multi-threaded processing
and actual (thread-safe) job queue processing. MixerWorkerThread does
not need to be a friend class of Mixer anymore.
2009-10-24 18:59:00 +02:00
Tobias Doerffel
4f5d31f862 MixerWorkerThread: exit outer loop in processJobQueue() if finished
Exit the outer loop of processJobQueue() Only as soon as we went through
the job queue without having processed at least one job.

In MixerWorkerThread::waitForJobs() re-introduced "pause" instruction on
x86 and x86_64 giving better performance on HyperThreading systems.

These improvements however still do not solve all performance and
multithreading issues.
2009-10-19 01:13:22 +02:00
Tobias Doerffel
05b1325c09 Song: do not refresh FxMixerView when loading song in console mode
Calling FxMixerView::refreshDisplay causes LMMS to crash when running
in console mode. Therefore explicitely check GUI mode before calling
this function.
2009-10-19 01:03:22 +02:00
Tobias Doerffel
a9d24d34f2 Mixer/FxMixer: separated MixerWorkerThread and ThreadableJob into files
Declarations and implementations of MixerWorkerThread and ThreadableJob
have been moved into separate source files.

Furthermore there were some improvements to MixerWorkerThreads.
MixerWorkerThread::processJobQueue() does not return until the job
queue completely has been processed. This way each thread can "help"
to finish processing the queue and does not get back to sleep until
all of the work is done.

Management of the queue is now done via an array of QAtomicPointers.
Items that are non-NULL still need to be processed while NULL-items
were taken from the queue (i.e. in progress or done). Thus we do not
need to deal with ThreadableJob-states within MixerWorkerThread anymore.
2009-10-14 01:44:41 +02:00
Andrew Kelley
c4647a58ac Merge commit 'origin/master' into fx-mixer-rework 2009-10-13 03:15:33 -07:00
Andrew Kelley
45a2f81eaa Rough fix for freeze-up bug
Added startJobs() to the waitForJobs() loop, and don't give up in
masterMix() until status of master channel is Done.
2009-10-13 03:14:23 -07:00
Andrew Kelley
95eb60f05f Fixed the audio/visual screwups
With the help of Toby, effects in the channels work and the peak
displays correctly. However the freeze-up bug is still wreaking havoc.
2009-10-13 02:21:13 -07:00
Andrew Kelley
f6f4414c98 NOT WORKING! Fx Mixer uses job threads
The FxMixer now uses job threads to accomplish its mixing. It's
theoretically efficient, but there is a horrible thread bug
preventing the code from working. I've spent 5 hours debugging and
need some external help!
2009-10-12 01:09:35 -07:00
Tobias Doerffel
3fa96a576c Mixer: rewrote/reorganized job queueing for worker threads
In Mixer, the old C-macro based code has been replaced by an OOP-like
design. Management of job queue now happens via some static member
methods of MixerWorkerThread. All the moved code still needs to be
splitted into some new files but here's a first dirty version.

All objects that are intended to be processed by MixerWorkerThreads
have to inherit ThreadableJob (name of class is subject of change).

One can add jobs to the job queue even if the queue is already being
processed. This is merely important for multithreading with upcoming
FX sends support.
2009-10-11 01:43:16 +02:00
Paul Giblock
49c2f6bad1 Rename "All Files" to "All file types" release QM
Translations didn't work because I didn't "release" within Linguist.  I
wonder how to update the *.ts files with missing strings...
2009-10-08 14:39:24 -04:00
Paul Giblock
beb92563f1 Proper File import extensions and translations
Previously, the extensions were stored in the translations, this i18n
more difficult, additionally, there was a preprocessor statement that
would cause the translated phrase to change! Hence, no translations if
you didn't have ZIP file support.  The text is now split into seperate
translations and I added "All Files".
2009-10-08 12:01:25 -04:00
Paul Giblock
c504bc84d4 Increase import filter for *.midi and *.riff
Fix song.cpp and translations so the somewhat common *.midi extension is
recognized.
2009-10-07 17:21:29 -04:00
Andrew Kelley
abfdb6a74d Fixed bug - Instruments had wrong channel models
Instruments were initialized with hardcoded 0-10 for min/max
channel selector range. Fixed.
2009-10-01 17:42:14 -07:00
Andrew Kelley
1c9b24afb7 Fixed a mixer bug regarding deleting channels 2009-10-01 11:37:46 -07:00