diff --git a/ChangeLog b/ChangeLog index fc11e4b22..d5b29dcdb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,257 @@ +2007-04-19 Javier Serrano Polo + + * include/audio_port.h: + * include/automatable_button.h: + * include/automatable_object.h: + * include/automatable_slider.h: + * include/automation_editor.h: + * include/automation_pattern.h: + * include/bb_editor.h: + * include/bb_track.h: + * include/combobox.h: + * include/cpuload_widget.h: + * include/dummy_plugin.h: + * include/effect.h: + * include/effect_chain.h: + * include/effect_label.h: + * include/effect_select_dialog.h: + * include/engine.h: + * include/envelope_and_lfo_widget.h: + * include/export_project_dialog.h: + * include/file_browser.h: + * include/group_box.h: + * include/import_filter.h: + * include/instrument.h: + * include/journalling_object.h: + * include/knob.h: + * include/lcd_spinbox.h: + * include/led_checkbox.h: + * include/main_window.h: + * include/midi_alsa_raw.h: + * include/midi_alsa_seq.h: + * include/midi_client.h: + * include/midi_dummy.h: + * include/midi_oss.h: + * include/mixer.h: + * include/name_label.h: + * include/note.h: + * include/pattern.h: + * include/piano_roll.h: + * include/pixmap_button.h: + * include/plugin.h: + * include/plugin_browser.h: + * include/preset_preview_play_handle.h: + * include/project_journal.h: + * include/project_notes.h: + * include/rack_view.h: + * include/sample_buffer.h: + * include/sample_play_handle.h: + * include/setup_dialog.h: + * include/song_editor.h: + * include/string_pair_drag.h: + * include/surround_area.h: + * include/tempo_sync_knob.h: + * include/timeline.h: + * include/track_container.h: + * include/visualization_widget.h: + * include/volume_knob.h: + * plugins/audio_file_processor/audio_file_processor.cpp: + * plugins/bass_booster/bass_booster.cpp: + * plugins/bass_booster/bass_booster.h: + * plugins/bass_booster/bassbooster_control_dialog.cpp + * plugins/bit_invader/bit_invader.cpp: + * plugins/bit_invader/graph.cpp: + * plugins/bit_invader/graph.h: + * plugins/flp_import/flp_import.cpp: + * plugins/kicker/kicker.cpp: + * plugins/ladspa_base/ladspa_2_lmms.cpp: + * plugins/ladspa_base/ladspa_2_lmms.h: + * plugins/ladspa_base/ladspa_base.h: + * plugins/ladspa_base/ladspa_control.cpp: + * plugins/ladspa_base/ladspa_control.h: + * plugins/ladspa_base/ladspa_manager.cpp: + * plugins/ladspa_base/ladspa_manager.h: + * plugins/ladspa_base/ladspa_port_dialog.cpp: + * plugins/ladspa_base/ladspa_port_dialog.h: + * plugins/ladspa_effect/ladspa_control_dialog.cpp: + * plugins/ladspa_effect/ladspa_effect.cpp: + * plugins/ladspa_effect/ladspa_effect.h: + * plugins/ladspa_effect/ladspa_subplugin_features.cpp: + * plugins/ladspa_effect/ladspa_subplugin_features.h: + * plugins/lb302/lb302.cpp: + * plugins/live_tool/live_tool.cpp: + * plugins/midi_import/midi_import.cpp: + * plugins/organic/organic.cpp: + * plugins/patman/patman.cpp: + * plugins/plucked_string_synth/plucked_string_synth.cpp: + * plugins/polyb302/polyb302.cpp: + * plugins/polyb302/polyb302.h: + * plugins/singerbot/singerbot.cpp: + * plugins/stk/mallets/mallets.cpp: + * plugins/triple_oscillator/triple_oscillator.cpp: + * plugins/vestige/vestige.cpp: + * plugins/vibed/graph.cpp: + * plugins/vibed/graph.h: + * plugins/vibed/impulse_editor.cpp: + * plugins/vibed/impulse_editor.h: + * plugins/vibed/nine_button_selector.cpp: + * plugins/vibed/nine_button_selector.h: + * plugins/vibed/vibed.cpp: + * plugins/vst_base/lvsl_client.cpp: + * plugins/vst_base/lvsl_client.h: + * plugins/vst_effect/vst_effect.cpp: + * plugins/vst_effect/vst_effect.h: + * plugins/vst_effect/vst_subplugin_features.cpp: + * plugins/vst_effect/vst_subplugin_features.h: + * src/audio/audio_alsa.cpp: + * src/audio/audio_jack.cpp: + * src/audio/audio_oss.cpp: + * src/audio/audio_port.cpp: + * src/audio/audio_sample_recorder.cpp: + * src/core/arp_and_chords_tab_widget.cpp: + * src/core/automation_editor.cpp: + * src/core/bb_editor.cpp: + * src/core/effect.cpp: + * src/core/effect_chain.cpp: + * src/core/effect_control_dialog.cpp: + * src/core/effect_select_dialog.cpp: + * src/core/effect_tab_widget.cpp: + * src/core/engine.cpp: + * src/core/envelope_and_lfo_widget.cpp: + * src/core/envelope_tab_widget.cpp: + * src/core/export_project_dialog.cpp: + * src/core/file_browser.cpp: + * src/core/import_filter.cpp: + * src/core/instrument.cpp: + * src/core/main.cpp: + * src/core/main_window.cpp: + * src/core/meter_dialog.cpp: + * src/core/midi_tab_widget.cpp: + * src/core/mixer.cpp: + * src/core/name_label.cpp: + * src/core/note.cpp: + * src/core/note_play_handle.cpp: + * src/core/piano_roll.cpp: + * src/core/piano_widget.cpp: + * src/core/plugin.cpp: + * src/core/plugin_browser.cpp: + * src/core/preset_preview_play_handle.cpp: + * src/core/sample_play_handle.cpp: + * src/core/setup_dialog.cpp: + * src/core/song_editor.cpp: + * src/core/surround_area.cpp: + * src/core/timeline.cpp: + * src/core/tool.cpp: + * src/core/track.cpp: + * src/core/track_container.cpp: + * src/lib/journalling_object.cpp: + * src/lib/project_journal.cpp: + * src/lib/sample_buffer.cpp: + * src/lib/string_pair_drag.cpp: + * src/midi/midi_alsa_raw.cpp: + * src/midi/midi_alsa_seq.cpp: + * src/midi/midi_client.cpp: + * src/midi/midi_oss.cpp: + * src/tracks/automation_pattern.cpp: + * src/tracks/bb_track.cpp: + * src/tracks/instrument_track.cpp: + * src/tracks/pattern.cpp: + * src/tracks/sample_track.cpp: + * src/widgets/automatable_button.cpp: + * src/widgets/automatable_slider.cpp: + * src/widgets/combobox.cpp: + * src/widgets/cpuload_widget.cpp: + * src/widgets/effect_label.cpp: + * src/widgets/group_box.cpp: + * src/widgets/knob.cpp: + * src/widgets/lcd_spinbox.cpp: + * src/widgets/led_checkbox.cpp: + * src/widgets/pixmap_button.cpp: + * src/widgets/project_notes.cpp: + * src/widgets/rack_plugin.cpp: + * src/widgets/rack_view.cpp: + * src/widgets/tempo_sync_knob.cpp: + * src/widgets/visualization_widget.cpp: + * src/widgets/volume_knob.cpp: + return of the singletons + + * include/fifo_buffer.h: + initial release, allows chunked audio buffer + + * include/audio_alsa.h: + * include/audio_device.h: + * include/audio_dummy.h: + * include/audio_jack.h: + * include/audio_oss.h: + * include/audio_sdl.h: + * include/mixer.h: + * src/audio/audio_alsa.cpp: + * src/audio/audio_device.cpp: + * src/audio/audio_jack.cpp: + * src/audio/audio_oss.cpp: + * src/audio/audio_sdl.cpp: + * src/core/mixer.cpp: + * src/core/setup_dialog.cpp: + use chunked audio buffer + + * src/core/mixer.cpp: + don't delete the audio device when changing quality, fixes JACK without + external server + + * include/sample_buffer.h: + * plugins/audio_file_processor/audio_file_processor.cpp: + * plugins/patman/patman.cpp: + * src/lib/sample_buffer.cpp: + handle different sample rates, fixes many looping patch samples + + * src/core/sample_play_handle.cpp: + fixed high quality + + * plugins/patman/patman.cpp: + automated Loop and Tune modes + + * plugins/audio_file_processor/audio_file_processor.cpp: + automated Loop mode + + * src/core/automation_editor.cpp: + fixed selections + + * src/core/track_container.cpp: + use modularized sample extensions + + * include/string_pair_drag.h: + * plugins/audio_file_processor/audio_file_processor.cpp: + * plugins/patman/patman.cpp: + * src/lib/string_pair_drag.cpp: + changed string pair MIME type + + * src/lib/mmp.cpp: + renamed root element + + * data/lmms.xml: + initial release, project MIME type + + * data/Makefile.am: + install project MIME type + + * data/lmms.desktop: + - added project MIME type + - added Catalan translation + + * include/oscillator.h: + * src/lib/oscillator.cpp: + got switches out of for-loops + + * include/arp_and_chords_tab_widget.h: + * include/effect_tab_widget.h: + * include/instrument_track.h: + * include/midi_tab_widget.h: + * include/track.h: + cleaned up dependencies + + * data/locale/ca.ts: + updated translation + 2007-04-07 Javier Serrano Polo * plugins/patman/artwork.png: diff --git a/Makefile.am b/Makefile.am index 893496417..a1972e31a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -331,6 +331,7 @@ lmms_SOURCES = \ $(srcdir)/include/midi_alsa_seq.h \ $(srcdir)/include/micro_timer.h \ $(srcdir)/include/fade_button.h \ + $(srcdir)/include/fifo_buffer.h \ $(srcdir)/include/combobox.h \ $(srcdir)/include/rubberband.h \ $(srcdir)/include/base64.h \ diff --git a/configure.in b/configure.in index 10c0e8767..47c83a74d 100644 --- a/configure.in +++ b/configure.in @@ -2,8 +2,8 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.50) -AC_INIT(lmms, 0.2.1-svn20070407, lmms-devel/at/lists/dot/sf/dot/net) -AM_INIT_AUTOMAKE(lmms, 0.2.1-svn20070407) +AC_INIT(lmms, 0.2.1-svn20070419, lmms-devel/at/lists/dot/sf/dot/net) +AM_INIT_AUTOMAKE(lmms, 0.2.1-svn20070419) AM_CONFIG_HEADER(config.h) diff --git a/data/Makefile.am b/data/Makefile.am index 9ad042502..3b6ec740b 100755 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -6,6 +6,8 @@ menu_DATA = lmms applicationsdir = $(datadir)/applications applications_DATA = lmms.desktop -EXTRA_DIST = $(menu_DATA) $(applications_DATA) +mimedir = $(datadir)/mime/packages +mime_DATA = lmms.xml +EXTRA_DIST = $(menu_DATA) $(applications_DATA) $(mime_DATA) diff --git a/data/lmms.desktop b/data/lmms.desktop index 566ab7ff4..e3afaa971 100644 --- a/data/lmms.desktop +++ b/data/lmms.desktop @@ -1,8 +1,10 @@ [Desktop Entry] Name=Linux MultiMedia Studio GenericName=software for music-production +GenericName[ca]=Programari de producció musical GenericName[de]=Software zur Musik-Produktion Comment=easy music-production for everyone! +Comment[ca]=Producció fàcil de música per a tothom! Icon=/usr/share/lmms/themes/default/icon.png Exec=/usr/bin/lmms Terminal=false @@ -10,3 +12,4 @@ Type=Application Encoding=UTF-8 X-Desktop-File-Install-Version=0.3 Categories=Application;AudioVideo;Qt +MimeType=application/x-lmms-project diff --git a/data/lmms.xml b/data/lmms.xml new file mode 100644 index 000000000..016751560 --- /dev/null +++ b/data/lmms.xml @@ -0,0 +1,14 @@ + + + + + LMMS project + Projecte LMMS + + + + + + + + diff --git a/data/locale/ca.qm b/data/locale/ca.qm index 9285e681a..d1aee0395 100644 Binary files a/data/locale/ca.qm and b/data/locale/ca.qm differ diff --git a/data/locale/ca.ts b/data/locale/ca.ts index 8196519fc..3beea0a7d 100644 --- a/data/locale/ca.ts +++ b/data/locale/ca.ts @@ -691,6 +691,10 @@ http://lmms.sourceforge.net END FI + + Loop + Bucle + automatableButton @@ -2741,6 +2745,14 @@ Per favor, visita http://wiki.mindrules.net per a documentació sobre LMMS.Patch-Files (*.pat) Fitxers Pedaç (*.pat) + + Loop + Bucle + + + Tune + Afina + pattern @@ -3510,7 +3522,7 @@ Si funciona amb altre programari VST sota Linux, per favor contacta amb un desen BUFFER SIZE - TAMANY DE MEMÒRIA INTERMÈDIA + MIDA DE MEMÒRIA INTERMÈDIA Reset to default-value @@ -3620,7 +3632,7 @@ Latència: %2 ms Here you can setup the internal buffer-size used by LMMS. Smaller values result in a lower latency but also may cause unusable sound or bad performance, especially on older computers or systems with a non-realtime kernel. - Aquí pots configurar la grandària de la memòria intermèdia interna usada per LMMS. Els valors més petits donen menor latència però també poden causar so inservible o baix rendiment, especialment a ordinadors antics o sistemes amb un nucli sense temps real. + Aquí pots configurar la mida de la memòria intermèdia interna usada per LMMS. Els valors més petits donen menor latència però també poden causar so inservible o baix rendiment, especialment a ordinadors antics o sistemes amb un nucli sense temps real. Choose LMMS working directory @@ -3670,7 +3682,7 @@ Latència: %2 ms If you have a machine with more then one processor (e.g. dual-core systems) you should use a parallelizing-level above 1 which means that LMMS will try to split up sound-processing into several threads which should should be run on several cores by the underlaying operating-system. Please note that in some cases parallelizing won't work with small buffer-sizes. If you experience problems (i.e. lot of xruns), try to increase buffer-size. Si tens una màquina amb més d'un processador (p.e. sistemes amb nucli dual) hauries d'usar un nivell de paral·lelització més gran que 1, que vol dir que LMMS tractarà de dividir el processament de so en varis fils que haurien d'executar-se en varis nuclis pel sistema operatiu subjacent. -Fixa't que en alguns casos la paral·lelització no funcionarà amb memòries intermèdies de grandària petita. Si experimentes problemes (p.e. molts xruns), prova d'augmentar la grandària de la memòria intermèdia. +Fixa't que en alguns casos la paral·lelització no funcionarà amb memòries intermèdies de mida petita. Si experimentes problemes (p.e. molts xruns), prova d'augmentar la mida de la memòria intermèdia. Choose LADSPA plugin directory diff --git a/include/arp_and_chords_tab_widget.h b/include/arp_and_chords_tab_widget.h index ff3b5ae25..46a26ce2c 100644 --- a/include/arp_and_chords_tab_widget.h +++ b/include/arp_and_chords_tab_widget.h @@ -2,7 +2,7 @@ * arp_and_chords_tab_widget.h - declaration of class arpAndChordWidget which * provides code for using arpeggio and chords * - * Copyright (c) 2004-2006 Tobias Doerffel + * Copyright (c) 2004-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -45,7 +45,6 @@ #include "journalling_object.h" #include "types.h" -#include "engine.h" class QPixmap; diff --git a/include/audio_alsa.h b/include/audio_alsa.h index 93911d382..40cdbb720 100644 --- a/include/audio_alsa.h +++ b/include/audio_alsa.h @@ -100,7 +100,6 @@ private: snd_pcm_sw_params_t * m_swParams; bool m_convertEndian; - volatile bool m_quit; } ; diff --git a/include/audio_device.h b/include/audio_device.h index 7e9f41eb8..c4e72c654 100644 --- a/include/audio_device.h +++ b/include/audio_device.h @@ -97,15 +97,13 @@ public: return( m_channels ); } - void processNextBuffer( void ); + bool processNextBuffer( void ); virtual void startProcessing( void ) { } - virtual void stopProcessing( void ) - { - } + virtual void stopProcessing( void ); class setupWidget : public tabWidget diff --git a/include/audio_dummy.h b/include/audio_dummy.h index 937d84d50..d909ef5f0 100644 --- a/include/audio_dummy.h +++ b/include/audio_dummy.h @@ -35,8 +35,7 @@ class audioDummy : public audioDevice, public QThread public: audioDummy( const sample_rate_t _sample_rate, bool & _success_ful, mixer * _mixer ) : - audioDevice( _sample_rate, DEFAULT_CHANNELS, _mixer ), - m_quit( FALSE ) + audioDevice( _sample_rate, DEFAULT_CHANNELS, _mixer ) { _success_ful = TRUE; } @@ -82,7 +81,6 @@ private: { if( isRunning() ) { - m_quit = TRUE; wait( 1000 ); terminate(); } @@ -91,10 +89,13 @@ private: virtual void run( void ) { microTimer timer; - while( m_quit == FALSE ) + while( TRUE ) { timer.reset(); - processNextBuffer(); + if ( !processNextBuffer() ) + { + break; + } const Sint32 microseconds = static_cast( getMixer()->framesPerAudioBuffer() * 1000000.0f / getMixer()->sampleRate() - @@ -106,9 +107,6 @@ private: } } - - volatile bool m_quit; - } ; diff --git a/include/audio_jack.h b/include/audio_jack.h index b7c60c32e..41725f915 100644 --- a/include/audio_jack.h +++ b/include/audio_jack.h @@ -107,9 +107,11 @@ private: jack_client_t * m_client; + bool m_active; bool m_stopped; - QMutex m_processCallbackMutex; +// QMutex m_processCallbackMutex; + QSemaphore m_stop_semaphore; vvector m_outputPorts; surroundSampleFrame * m_outBuf; diff --git a/include/audio_oss.h b/include/audio_oss.h index 38389c271..5071e4802 100644 --- a/include/audio_oss.h +++ b/include/audio_oss.h @@ -83,7 +83,6 @@ private: int m_audioFD; bool m_convertEndian; - volatile bool m_quit; } ; diff --git a/include/audio_port.h b/include/audio_port.h index dc23bfadb..b36b702c4 100644 --- a/include/audio_port.h +++ b/include/audio_port.h @@ -1,7 +1,7 @@ /* * audio_port.h - base-class for objects providing sound at a port * - * Copyright (c) 2005-2006 Tobias Doerffel + * Copyright (c) 2005-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -43,10 +43,10 @@ #include "effect_chain.h" -class audioPort : public engineObject +class audioPort { public: - audioPort( const QString & _name, engine * _engine ); + audioPort( const QString & _name ); ~audioPort(); inline surroundSampleFrame * firstBuffer( void ) diff --git a/include/audio_sdl.h b/include/audio_sdl.h index 368af2802..4dee0cec4 100644 --- a/include/audio_sdl.h +++ b/include/audio_sdl.h @@ -92,6 +92,9 @@ private: bool m_convertEndian; + bool m_stopped; + QSemaphore m_stop_semaphore; + } ; #endif diff --git a/include/automatable_button.h b/include/automatable_button.h index a0158c6cf..55ca2e282 100755 --- a/include/automatable_button.h +++ b/include/automatable_button.h @@ -1,7 +1,7 @@ /* * automatable_button.h - class automatableButton, the base for all buttons * - * Copyright (c) 2006 Tobias Doerffel + * Copyright (c) 2006-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -51,7 +51,7 @@ class automatableButton : public QWidget, public automatableObject Q_OBJECT public: automatableButtonGroup( QWidget * _parent, const QString & _name, - engine * _engine, track * _track ); + track * _track ); virtual ~automatableButtonGroup(); void addButton( automatableButton * _btn ); diff --git a/include/automatable_object.h b/include/automatable_object.h index 118a57cd8..88e5f809d 100755 --- a/include/automatable_object.h +++ b/include/automatable_object.h @@ -1,7 +1,7 @@ /* * automatable_object.h - declaration of class automatableObject * - * Copyright (c) 2006 Tobias Doerffel + * Copyright (c) 2006-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -31,6 +31,7 @@ #include "qt3support.h" #include "automation_editor.h" #include "automation_pattern.h" +#include "engine.h" #include "journalling_object.h" #include "templates.h" #include "midi_time.h" @@ -57,11 +58,9 @@ class automatableObject : public journallingObject, public levelObject public: typedef automatableObject autoObj; - automatableObject( engine * _engine, track * _track = NULL, - const T _val = 0, const T _min = 0, - const T _max = 0, + automatableObject( track * _track = NULL, const T _val = 0, + const T _min = 0, const T _max = 0, const T _step = defaultRelStep() ) : - journallingObject( _engine ), m_value( _val ), m_minValue( _min ), m_maxValue( _max ), @@ -372,9 +371,9 @@ public: return( m_track == NULL ); } - void initAutomationPattern( engine * _engine ) + void initAutomationPattern( void ) { - m_automation_pattern = new automationPattern( _engine, this ); + m_automation_pattern = new automationPattern( NULL, this ); } @@ -432,11 +431,11 @@ protected: { m_automation_pattern->putValue( midiTime( 0 ), m_curLevel, FALSE ); - if( eng()->getAutomationEditor() && - eng()->getAutomationEditor()->currentPattern() + if( engine::getAutomationEditor() && + engine::getAutomationEditor()->currentPattern() == m_automation_pattern ) { - eng()->getAutomationEditor()->update(); + engine::getAutomationEditor()->update(); } } } diff --git a/include/automatable_slider.h b/include/automatable_slider.h index d40220d38..7d562843c 100644 --- a/include/automatable_slider.h +++ b/include/automatable_slider.h @@ -1,7 +1,7 @@ /* * automatable_slider.h - class automatableSlider, a QSlider with automation * - * Copyright (c) 2006 Javier Serrano Polo + * Copyright (c) 2006-2007 Javier Serrano Polo * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -48,7 +48,7 @@ class automatableSlider : public QSlider Q_OBJECT public: automatableSlider( QWidget * _parent, const QString & _name, - engine * _engine, class track * _track ); + class track * _track ); virtual ~automatableSlider(); virtual void setRange( int _min, int _max ); diff --git a/include/automation_editor.h b/include/automation_editor.h index 1bb593104..bd617eb30 100644 --- a/include/automation_editor.h +++ b/include/automation_editor.h @@ -2,7 +2,7 @@ * automation_editor.h - declaration of class automationEditor which is a window * where you can edit dynamic values in an easy way * - * Copyright (c) 2006 Javier Serrano Polo + * Copyright (c) 2006-2007 Javier Serrano Polo * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -45,7 +45,6 @@ #include "types.h" #include "note.h" -#include "engine.h" #include "journalling_object.h" #include "automation_pattern.h" @@ -168,7 +167,7 @@ private: static const int VALUES_WIDTH = 64; - automationEditor( engine * _engine ); + automationEditor( void ); automationEditor( const automationEditor & ); virtual ~automationEditor(); diff --git a/include/automation_pattern.h b/include/automation_pattern.h index b20c33746..07098ffd1 100644 --- a/include/automation_pattern.h +++ b/include/automation_pattern.h @@ -2,7 +2,7 @@ * automation_pattern.h - declaration of class automationPattern, which contains * all information about an automation pattern * - * Copyright (c) 2006 Javier Serrano Polo + * Copyright (c) 2006-2007 Javier Serrano Polo * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -52,7 +52,6 @@ public: #endif automationPattern( track * _track, levelObject * _object ); - automationPattern( engine * _engine, levelObject * _object ); automationPattern( const automationPattern & _pat_to_copy ); automationPattern( const automationPattern & _pat_to_copy, levelObject * _object ); diff --git a/include/bb_editor.h b/include/bb_editor.h index d577f6c69..3543933af 100644 --- a/include/bb_editor.h +++ b/include/bb_editor.h @@ -1,7 +1,7 @@ /* * bb_editor.h - declaration of class bbEditor, a basic-component of LMMS * - * Copyright (c) 2004-2006 Tobias Doerffel + * Copyright (c) 2004-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -89,7 +89,7 @@ protected: private: - bbEditor( engine * _engine ); + bbEditor( void ); //bbEditor( const bbEditor & ); virtual ~bbEditor(); diff --git a/include/bb_track.h b/include/bb_track.h index a23688878..7f3146c71 100644 --- a/include/bb_track.h +++ b/include/bb_track.h @@ -2,7 +2,7 @@ * bb_track.h - class bbTrack, a wrapper for using bbEditor * (which is a singleton-class) as track * - * Copyright (c) 2004-2006 Tobias Doerffel + * Copyright (c) 2004-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -113,7 +113,7 @@ public: virtual void FASTCALL loadTrackSpecificSettings( const QDomElement & _this ); - static bbTrack * FASTCALL findBBTrack( csize _bb_num, engine * _engine ); + static bbTrack * FASTCALL findBBTrack( csize _bb_num ); static csize FASTCALL numOfBBTrack( track * _track ); static void FASTCALL swapBBTracks( track * _track1, track * _track2 ); diff --git a/include/combobox.h b/include/combobox.h index b7adc8279..de88f8679 100644 --- a/include/combobox.h +++ b/include/combobox.h @@ -1,7 +1,7 @@ /* * combobox.h - class comboBox, a very cool combo-box * - * Copyright (c) 2006 Tobias Doerffel + * Copyright (c) 2006-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -56,8 +56,7 @@ class comboBox : public QWidget, public automatableObject { Q_OBJECT public: - comboBox( QWidget * _parent, const QString & _name, engine * _engine, - track * _track ); + comboBox( QWidget * _parent, const QString & _name, track * _track ); virtual ~comboBox(); void addItem( const QString & _item, const QPixmap & _pixmap = diff --git a/include/cpuload_widget.h b/include/cpuload_widget.h index 52b9105c3..ee5c38995 100644 --- a/include/cpuload_widget.h +++ b/include/cpuload_widget.h @@ -2,7 +2,7 @@ * cpuload_widget.h - widget for displaying CPU-load (partly based on * Hydrogen's CPU-load-widget) * - * Copyright (c) 2005-2006 Tobias Doerffel + * Copyright (c) 2005-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -44,14 +44,13 @@ #endif #include "types.h" -#include "engine.h" -class cpuloadWidget : public QWidget, public engineObject +class cpuloadWidget : public QWidget { Q_OBJECT public: - cpuloadWidget( QWidget * _parent, engine * _engine ); + cpuloadWidget( QWidget * _parent ); virtual ~cpuloadWidget(); diff --git a/include/dummy_plugin.h b/include/dummy_plugin.h index f8dbbf199..6dcc413d0 100644 --- a/include/dummy_plugin.h +++ b/include/dummy_plugin.h @@ -2,7 +2,7 @@ * dummy_plugin.h - empty plugin which is used as fallback if a plugin couldn't * be found * - * Copyright (c) 2005-2006 Tobias Doerffel + * Copyright (c) 2005-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -33,8 +33,8 @@ class dummyPlugin : public plugin { public: - inline dummyPlugin( engine * _engine = NULL ) : - plugin( NULL, _engine ) + inline dummyPlugin( void ) : + plugin( NULL ) { } diff --git a/include/effect.h b/include/effect.h index 2346ecc57..4a8bed25a 100644 --- a/include/effect.h +++ b/include/effect.h @@ -1,8 +1,8 @@ /* * effect.h - base class for effects * - * Copyright (c) 2006 Danny McRae - * Copyright (c) 2006 Tobias Doerffel + * Copyright (c) 2006-2007 Danny McRae + * Copyright (c) 2006-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -57,14 +57,8 @@ class track; class effect : public plugin { public: - struct constructionData - { - engine * eng; - descriptor::subPluginFeatures::key key; - } ; - - - effect( const plugin::descriptor * _desc, constructionData * _cdata ); + effect( const plugin::descriptor * _desc, + const descriptor::subPluginFeatures::key * _key ); virtual ~effect(); virtual bool FASTCALL processAudioBuffer( @@ -196,7 +190,7 @@ public: virtual effectControlDialog * createControlDialog( track * _track ) = 0; static effect * FASTCALL instantiate( const QString & _plugin_name, - constructionData & _cdata ); + descriptor::subPluginFeatures::key * _key ); private: diff --git a/include/effect_chain.h b/include/effect_chain.h index e8249c7b1..b3a870d80 100644 --- a/include/effect_chain.h +++ b/include/effect_chain.h @@ -1,7 +1,7 @@ /* * effect_chain.h - class for processing and effects chain * - * Copyright (c) 2006 Danny McRae + * Copyright (c) 2006-2007 Danny McRae * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -37,15 +37,14 @@ #include "qt3support.h" -#include "engine.h" #include "effect.h" typedef vvector effect_list_t; -class effectChain: public engineObject +class effectChain { public: - effectChain( engine * _engine ); + effectChain( void ); virtual ~effectChain(); void FASTCALL appendEffect( effect * _effect ); diff --git a/include/effect_label.h b/include/effect_label.h index d7b9ea6f1..46cdeb044 100644 --- a/include/effect_label.h +++ b/include/effect_label.h @@ -2,7 +2,7 @@ * effect_label.h - a label which is renamable by double-clicking it and * offers access to an effect rack * - * Copyright (c) 2006 Danny McRae + * Copyright (c) 2006-2007 Danny McRae * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -54,9 +54,8 @@ class effectLabel: public QWidget, public journallingObject { Q_OBJECT public: - effectLabel( const QString & _initial_name, - QWidget * _parent, engine * _engine, - sampleTrack * _track ); + effectLabel( const QString & _initial_name, QWidget * _parent, + sampleTrack * _track ); virtual ~effectLabel(); inline const QString & text( void ) diff --git a/include/effect_select_dialog.h b/include/effect_select_dialog.h index effe4a68f..ad9d9a963 100644 --- a/include/effect_select_dialog.h +++ b/include/effect_select_dialog.h @@ -43,15 +43,14 @@ #endif -#include "engine.h" #include "effect.h" -class effectSelectDialog : public QDialog, public engineObject +class effectSelectDialog : public QDialog { Q_OBJECT public: - effectSelectDialog( QWidget * _parent, engine * _engine ); + effectSelectDialog( QWidget * _parent ); virtual ~effectSelectDialog(); effect * instantiateSelectedPlugin( void ); @@ -68,11 +67,11 @@ private: -class effectList : public QWidget, public engineObject +class effectList : public QWidget { Q_OBJECT public: - effectList( QWidget * _parent, engine * _engine ); + effectList( QWidget * _parent ); virtual ~effectList(); diff --git a/include/effect_tab_widget.h b/include/effect_tab_widget.h index 45312fc9a..664654b2a 100644 --- a/include/effect_tab_widget.h +++ b/include/effect_tab_widget.h @@ -2,7 +2,7 @@ * effect_tab_widget.h - tab-widget in channel-track-window for setting up * effects * - * Copyright (c) 2006 Danny McRae + * Copyright (c) 2006-2007 Danny McRae * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -50,7 +50,6 @@ #endif #include "journalling_object.h" -#include "engine.h" #include "rack_plugin.h" #include "rack_view.h" #include "audio_port.h" diff --git a/include/engine.h b/include/engine.h index a57747454..6e217f17f 100644 --- a/include/engine.h +++ b/include/engine.h @@ -55,142 +55,97 @@ class ladspa2LMMS; class engine { public: - engine( const bool _has_gui = true ); - engine( const engine & _engine ); - ~engine(); + static void init( const bool _has_gui = true ); + static void destroy( void ); - engine * duplicate( const engine * _engine ) + static bool hasGUI( void ) { - return( new engine( *_engine ) ); + return( s_hasGUI ); } - inline bool hasGUI( void ) const + static mixer * getMixer( void ) { - return( m_hasGUI ); + return( s_mixer ); } - inline mixer * getMixer( void ) + static mainWindow * getMainWindow( void ) { - return( m_mixer ); + return( s_mainWindow ); } - inline const mixer * getMixer( void ) const + static songEditor * getSongEditor( void ) { - return( m_mixer ); + return( s_songEditor ); } - inline mainWindow * getMainWindow( void ) + static bbEditor * getBBEditor( void ) { - return( m_mainWindow ); + return( s_bbEditor ); } - inline songEditor * getSongEditor( void ) + static pianoRoll * getPianoRoll( void ) { - return( m_songEditor ); + return( s_pianoRoll ); } - inline const songEditor * getSongEditor( void ) const + static projectNotes * getProjectNotes( void ) { - return( m_songEditor ); + return( s_projectNotes ); } - inline bbEditor * getBBEditor( void ) + static projectJournal * getProjectJournal( void ) { - return( m_bbEditor ); + return( s_projectJournal ); } - inline pianoRoll * getPianoRoll( void ) + static automationEditor * getAutomationEditor( void ) { - return( m_pianoRoll ); - } - - inline projectNotes * getProjectNotes( void ) - { - return( m_projectNotes ); - } - - inline projectJournal * getProjectJournal( void ) - { - return( m_projectJournal ); - } - - inline automationEditor * getAutomationEditor( void ) - { - return( m_automationEditor ); + return( s_automationEditor ); } #ifdef LADSPA_SUPPORT - inline ladspa2LMMS * getLADSPAManager( void ) + static ladspa2LMMS * getLADSPAManager( void ) { - return( m_ladspaManager ); + return( s_ladspaManager ); } #endif - void close( void ); - - float framesPerTact64th( void ) const + static float framesPerTact64th( void ) { - return( m_frames_per_tact64th ); + return( s_frames_per_tact64th ); } - void updateFramesPerTact64th( void ); + static void updateFramesPerTact64th( void ); - const QMap & sampleExtensions( void ) + static const QMap & sampleExtensions( void ) { - return( m_sample_extensions ); + return( s_sample_extensions ); } private: - bool m_hasGUI; - float m_frames_per_tact64th; + static bool s_hasGUI; + static float s_frames_per_tact64th; - mixer * m_mixer; - mainWindow * m_mainWindow; - songEditor * m_songEditor; - automationEditor * m_automationEditor; - bbEditor * m_bbEditor; - pianoRoll * m_pianoRoll; - projectNotes * m_projectNotes; - projectJournal * m_projectJournal; + static mixer * s_mixer; + static mainWindow * s_mainWindow; + static songEditor * s_songEditor; + static automationEditor * s_automationEditor; + static bbEditor * s_bbEditor; + static pianoRoll * s_pianoRoll; + static projectNotes * s_projectNotes; + static projectJournal * s_projectJournal; #ifdef LADSPA_SUPPORT - ladspa2LMMS * m_ladspaManager; + static ladspa2LMMS * s_ladspaManager; #endif - QMap m_sample_extensions; + static QMap s_sample_extensions; - void load_extensions( void ); + static void load_extensions( void ); } ; -class engineObject -{ -public: - engineObject( engine * _engine ); - ~engineObject(); - - inline engine * eng( void ) - { - return( m_engine ); - } - - inline const engine * eng( void ) const - { - return( m_engine ); - } - - inline bool hasGUI( void ) const - { - return( m_engine->hasGUI() ); - } - - -private: - engine * m_engine; - -} ; - #endif diff --git a/include/envelope_and_lfo_widget.h b/include/envelope_and_lfo_widget.h index 2b9b318f1..2ff7b889f 100644 --- a/include/envelope_and_lfo_widget.h +++ b/include/envelope_and_lfo_widget.h @@ -3,7 +3,7 @@ * is used by envelope/lfo/filter-tab of * channel-window * - * Copyright (c) 2004-2006 Tobias Doerffel + * Copyright (c) 2004-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -37,13 +37,11 @@ #ifdef QT4 #include -#include #include #else #include -#include #include #endif @@ -76,7 +74,7 @@ class envelopeAndLFOWidget : public QWidget, public journallingObject, Q_OBJECT public: envelopeAndLFOWidget( float _value_for_zero_amount, QWidget * _parent, - engine * _engine, track * _track ); + track * _track ); virtual ~envelopeAndLFOWidget(); static inline float expKnobVal( float val ) @@ -84,8 +82,8 @@ public: return( ( ( val < 0 ) ? -1 : 1 ) * val*val ); } - static void triggerLFO( engine * _engine ); - static void resetLFO( engine * _engine ); + static void triggerLFO( void ); + static void resetLFO( void ); void FASTCALL fillLevel( float * _buf, f_cnt_t _frame, const f_cnt_t _release_begin, @@ -140,7 +138,7 @@ private: static QPixmap * s_envGraph; static QPixmap * s_lfoGraph; - static QMap > s_EaLWidgets; + static vvector s_EaLWidgets; bool m_used; diff --git a/include/export_project_dialog.h b/include/export_project_dialog.h index d26eb98c1..7cdf22c03 100644 --- a/include/export_project_dialog.h +++ b/include/export_project_dialog.h @@ -2,7 +2,7 @@ * export_project_dialog.h - declaration of class exportProjectDialog which is * responsible for exporting project * - * Copyright (c) 2004-2006 Tobias Doerffel + * Copyright (c) 2004-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -44,7 +44,6 @@ #endif #include "export.h" -#include "engine.h" class QLabel; @@ -56,12 +55,11 @@ class ledCheckBox; class pixmapButton; -class exportProjectDialog : public QDialog, public engineObject +class exportProjectDialog : public QDialog { Q_OBJECT public: - exportProjectDialog( const QString & _file_name, QWidget * _parent, - engine * _engine ); + exportProjectDialog( const QString & _file_name, QWidget * _parent ); virtual ~exportProjectDialog(); diff --git a/include/fifo_buffer.h b/include/fifo_buffer.h new file mode 100644 index 000000000..675c13457 --- /dev/null +++ b/include/fifo_buffer.h @@ -0,0 +1,97 @@ +/* + * fifo_buffer.h - FIFO fixed-size buffer + * + * Copyright (c) 2007 Javier Serrano Polo + * + * 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 _FIFO_BUFFER_H +#define _FIFO_BUFFER_H + + +#ifdef QT4 + +#include + +#else + +#include + +#endif + + +template +class fifoBuffer +{ +public: + fifoBuffer( int _size ) : + m_reader_sem( _size ), + m_writer_sem( _size ), + m_reader_index( 0 ), + m_writer_index( 0 ), + m_size( _size ) + { + m_buffer = new T[_size]; + m_reader_sem += _size; + } + + ~fifoBuffer() + { + delete[] m_buffer; + m_reader_sem -= m_size; + } + + void write( T _element ) + { + m_writer_sem++; + m_buffer[m_writer_index++] = _element; + m_writer_index %= m_size; + m_reader_sem--; + } + + T read( void ) + { + m_reader_sem++; + T element = m_buffer[m_reader_index++]; + m_reader_index %= m_size; + m_writer_sem--; + return( element ); + } + + bool available( void ) + { + return( m_reader_sem.available() ); + } + + +private: + QSemaphore m_reader_sem; + QSemaphore m_writer_sem; + int m_reader_index; + int m_writer_index; + int m_size; + T * m_buffer; + +} ; + + + + +#endif diff --git a/include/file_browser.h b/include/file_browser.h index 0948d2b9f..731ecfd3b 100644 --- a/include/file_browser.h +++ b/include/file_browser.h @@ -48,7 +48,6 @@ #include "side_bar_widget.h" -#include "engine.h" class fileItem; @@ -59,13 +58,13 @@ class trackContainer; -class fileBrowser : public sideBarWidget, public engineObject +class fileBrowser : public sideBarWidget { Q_OBJECT public: fileBrowser( const QString & _directories, const QString & _filter, const QString & _title, const QPixmap & _pm, - QWidget * _parent, engine * _engine ); + QWidget * _parent ); virtual ~fileBrowser(); static bool isDirWithContent( const QString & _path, @@ -107,11 +106,11 @@ private: -class listView : public Q3ListView, public engineObject +class listView : public Q3ListView { Q_OBJECT public: - listView( QWidget * _parent, engine * _engine ); + listView( QWidget * _parent ); virtual ~listView(); @@ -133,15 +132,13 @@ private: -class directory : public Q3ListViewItem, public engineObject +class directory : public Q3ListViewItem { public: directory( Q3ListView * _parent, const QString & _filename, - const QString & _path, const QString & _filter, - engine * _engine ); + const QString & _path, const QString & _filter ); directory( directory * _parent, const QString & _filename, - const QString & _path, const QString & _filter, - engine * _engine ); + const QString & _path, const QString & _filter ); void setOpen( bool ); void setup( void ); @@ -189,15 +186,13 @@ private: -class fileItem : public Q3ListViewItem, public engineObject +class fileItem : public Q3ListViewItem { public: fileItem( Q3ListView * _parent, const QString & _name, - const QString & _path, - engine * _engine ); + const QString & _path ); fileItem( Q3ListViewItem * _parent, const QString & _name, - const QString & _path, - engine * _engine ); + const QString & _path ); inline QString fullName( void ) const { diff --git a/include/group_box.h b/include/group_box.h index fe3184902..499d5d24c 100644 --- a/include/group_box.h +++ b/include/group_box.h @@ -1,7 +1,7 @@ /* * group_box.h - LMMS-groupbox * - * Copyright (c) 2005-2006 Tobias Doerffel + * Copyright (c) 2005-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -44,12 +44,11 @@ class QPixmap; -class groupBox : public QWidget, public engineObject +class groupBox : public QWidget { Q_OBJECT public: - groupBox( const QString & _caption, QWidget * _parent, - engine * _engine, track * _track ); + groupBox( const QString & _caption, QWidget * _parent, track * _track ); virtual ~groupBox(); bool isActive( void ) const diff --git a/include/import_filter.h b/include/import_filter.h index 347a17f0d..61c05ad36 100755 --- a/include/import_filter.h +++ b/include/import_filter.h @@ -2,7 +2,7 @@ * import_filter.h - declaration of class importFilter, the base-class for all * file import filters * - * Copyright (c) 2006 Tobias Doerffel + * Copyright (c) 2006-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -55,7 +55,7 @@ class importFilter : public plugin { public: importFilter( const QString & _file_name, - const descriptor * _descriptor, engine * _eng ); + const descriptor * _descriptor ); virtual ~importFilter(); diff --git a/include/instrument.h b/include/instrument.h index bfde4b533..f29185cc1 100644 --- a/include/instrument.h +++ b/include/instrument.h @@ -2,7 +2,7 @@ * instrument.h - declaration of class instrument, which provides a * standard interface for all instrument plugins * - * Copyright (c) 2005-2006 Tobias Doerffel + * Copyright (c) 2005-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -48,6 +48,7 @@ #endif +#include "engine.h" #include "plugin.h" #include "mixer.h" @@ -140,7 +141,7 @@ protected: inline void invalidate( void ) { m_valid = FALSE; - eng()->getMixer()->checkValidityOfPlayHandles(); + engine::getMixer()->checkValidityOfPlayHandles(); } diff --git a/include/instrument_track.h b/include/instrument_track.h index 1d91a6ec0..431d3b5ac 100755 --- a/include/instrument_track.h +++ b/include/instrument_track.h @@ -2,7 +2,7 @@ * instrument_track.h - declaration of class instrumentTrack, a track + window * which holds an instrument-plugin * - * Copyright (c) 2004-2006 Tobias Doerffel + * Copyright (c) 2004-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -50,7 +50,6 @@ #include "midi_event_processor.h" #include "gui_templates.h" #include "tab_widget.h" -#include "engine.h" #include "volume_knob.h" #include "instrument.h" diff --git a/include/journalling_object.h b/include/journalling_object.h index a97c356f4..0de9ced1f 100755 --- a/include/journalling_object.h +++ b/include/journalling_object.h @@ -1,7 +1,7 @@ /* * journalling_object.h - declaration of class journallingObject * - * Copyright (c) 2006 Tobias Doerffel + * Copyright (c) 2006-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -31,7 +31,6 @@ #endif #include "types.h" -#include "engine.h" #include "qt3support.h" #ifndef QT3 @@ -110,10 +109,10 @@ typedef vvector journalEntryVector; -class journallingObject : public engineObject +class journallingObject { public: - journallingObject( engine * _engine ); + journallingObject( void ); virtual ~journallingObject(); inline const jo_id_t id( void ) const diff --git a/include/knob.h b/include/knob.h index 784abbbc4..91a5a1c09 100644 --- a/include/knob.h +++ b/include/knob.h @@ -4,7 +4,7 @@ * This file is based on the knob-widget of the Qwt Widget Library by * Josef Wilgen * - * Copyright (c) 2004-2006 Tobias Doerffel + * Copyright (c) 2004-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -44,7 +44,6 @@ #endif -#include "engine.h" #include "automatable_object.h" @@ -64,7 +63,7 @@ class knob : public QWidget, public automatableObject Q_OBJECT public: knob( int _knob_num, QWidget * _parent, const QString & _name, - engine * _engine, track * _track ); + track * _track ); virtual ~knob(); diff --git a/include/lcd_spinbox.h b/include/lcd_spinbox.h index e8b2d55d2..b0a826038 100644 --- a/include/lcd_spinbox.h +++ b/include/lcd_spinbox.h @@ -1,7 +1,7 @@ /* * lcd_spinbox.h - class lcdSpinBox, an improved QLCDNumber * - * Copyright (c) 2005-2006 Tobias Doerffel + * Copyright (c) 2005-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -52,8 +52,7 @@ class lcdSpinBox : public QWidget, public automatableObject Q_OBJECT public: lcdSpinBox( int _min, int _max, int _num_digits, QWidget * _parent, - const QString & _name, - engine * _engine, track * _track ); + const QString & _name, track * _track ); virtual ~lcdSpinBox(); virtual void setStep( const int _step ); diff --git a/include/led_checkbox.h b/include/led_checkbox.h index 33198450b..17529c653 100644 --- a/include/led_checkbox.h +++ b/include/led_checkbox.h @@ -1,7 +1,7 @@ /* * led_checkbox.h - class ledCheckBox, an improved QCheckBox * - * Copyright (c) 2005-2006 Tobias Doerffel + * Copyright (c) 2005-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -42,8 +42,8 @@ public: } ; ledCheckBox( const QString & _txt, QWidget * _parent, - const QString & _name, engine * _engine, - track * _track, ledColors _color = YELLOW ); + const QString & _name, track * _track, + ledColors _color = YELLOW ); virtual ~ledCheckBox(); diff --git a/include/main_window.h b/include/main_window.h index 5e3691f91..734cf3cd0 100644 --- a/include/main_window.h +++ b/include/main_window.h @@ -49,7 +49,6 @@ #include "types.h" -#include "engine.h" class QDomElement; @@ -61,7 +60,7 @@ class tool; class toolButton; -class mainWindow : public QMainWindow, public engineObject +class mainWindow : public QMainWindow { Q_OBJECT public: @@ -138,7 +137,7 @@ protected: private: - mainWindow( engine * _engine ); + mainWindow( void ); mainWindow( const mainWindow & ); virtual ~mainWindow(); diff --git a/include/midi_alsa_raw.h b/include/midi_alsa_raw.h index 149058dd9..ea36e9136 100644 --- a/include/midi_alsa_raw.h +++ b/include/midi_alsa_raw.h @@ -61,7 +61,7 @@ class QLineEdit; class midiALSARaw : public midiClientRaw, public QThread { public: - midiALSARaw( engine * _engine ); + midiALSARaw( void ); virtual ~midiALSARaw(); static QString probeDevice( void ); diff --git a/include/midi_alsa_seq.h b/include/midi_alsa_seq.h index 3b8efd280..4e0d928ef 100644 --- a/include/midi_alsa_seq.h +++ b/include/midi_alsa_seq.h @@ -71,7 +71,7 @@ class midiALSASeq : { Q_OBJECT public: - midiALSASeq( engine * _engine ); + midiALSASeq( void ); virtual ~midiALSASeq(); static QString probeDevice( void ); diff --git a/include/midi_client.h b/include/midi_client.h index c502ea8d1..c6dd9ef59 100644 --- a/include/midi_client.h +++ b/include/midi_client.h @@ -44,17 +44,16 @@ #include "midi.h" #include "midi_event_processor.h" #include "tab_widget.h" -#include "engine.h" class midiPort; // base-class for all MIDI-clients -class midiClient : public engineObject +class midiClient { public: - midiClient( engine * _engine ); + midiClient( void ); virtual ~midiClient(); // to be implemented by sub-classes @@ -144,7 +143,7 @@ const Uint8 RAW_MIDI_PARSE_BUF_SIZE = 16; class midiClientRaw : public midiClient { public: - midiClientRaw( engine * _engine ); + midiClientRaw( void ); virtual ~midiClientRaw(); // we are raw-clients for sure! diff --git a/include/midi_dummy.h b/include/midi_dummy.h index 5f4ec39a6..316bb5808 100644 --- a/include/midi_dummy.h +++ b/include/midi_dummy.h @@ -35,8 +35,7 @@ class midiDummy : public midiClientRaw { public: - midiDummy( engine * _engine ) : - midiClientRaw( _engine ) + midiDummy( void ) { } virtual ~midiDummy() diff --git a/include/midi_oss.h b/include/midi_oss.h index 4b9cb931c..d7a3fa06f 100644 --- a/include/midi_oss.h +++ b/include/midi_oss.h @@ -43,7 +43,7 @@ class QLineEdit; class midiOSS : public midiClientRaw, public QThread { public: - midiOSS( engine * _engine ); + midiOSS( void ); virtual ~midiOSS(); static QString probeDevice( void ); diff --git a/include/midi_tab_widget.h b/include/midi_tab_widget.h index 1e194fd53..bff3193cd 100644 --- a/include/midi_tab_widget.h +++ b/include/midi_tab_widget.h @@ -2,7 +2,7 @@ * midi_tab_widget.h - tab-widget in channel-track-window for setting up * MIDI-related stuff * - * Copyright (c) 2005-2006 Tobias Doerffel + * Copyright (c) 2005-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -44,7 +44,6 @@ #endif #include "journalling_object.h" -#include "engine.h" class QMenu; diff --git a/include/mixer.h b/include/mixer.h index df678ee2e..f52152f1e 100644 --- a/include/mixer.h +++ b/include/mixer.h @@ -35,12 +35,14 @@ #ifdef QT4 #include +#include #include #else #include #include +#include #include #endif @@ -52,7 +54,7 @@ #include "note.h" #include "play_handle.h" #include "effect_board.h" -#include "engine.h" +#include "fifo_buffer.h" class audioDevice; @@ -106,7 +108,7 @@ const octaves BASE_OCTAVE = OCTAVE_4; -class mixer : public QObject, public engineObject +class mixer : public QObject { Q_OBJECT public: @@ -285,7 +287,10 @@ public: bool criticalXRuns( void ) const; - const surroundSampleFrame * renderNextBuffer( void ); + const surroundSampleFrame * nextBuffer( void ) + { + return( m_fifo->read() ); + } public slots: @@ -299,7 +304,27 @@ signals: private: - mixer( engine * _engine ); + typedef fifoBuffer fifo; + + class fifoWriter : public QThread + { + public: + fifoWriter( mixer * _mixer, fifo * _fifo ); + + void finish( void ); + + + private: + mixer * m_mixer; + fifo * m_fifo; + bool m_writing; + + virtual void run( void ); + + } ; + + + mixer( void ); virtual ~mixer(); void startProcessing( void ); @@ -307,8 +332,7 @@ private: // we don't allow to create mixer by using copy-ctor - mixer( const mixer & ) : - engineObject( NULL ) + mixer( const mixer & ) { } @@ -322,6 +346,8 @@ private: void FASTCALL scaleClip( fpab_t _frame, ch_cnt_t _chnl ); + const surroundSampleFrame * renderNextBuffer( void ); + vvector m_audioPorts; fpab_t m_framesPerAudioBuffer; @@ -366,7 +392,12 @@ private: Uint8 m_mixMutexLockLevel; + fifo * m_fifo; + fifoWriter * m_fifo_writer; + + friend class engine; + friend class fifoWriter; } ; diff --git a/include/name_label.h b/include/name_label.h index e6bdc09ef..8eede8a29 100644 --- a/include/name_label.h +++ b/include/name_label.h @@ -2,7 +2,7 @@ * name_label.h - class nameLabel, a label which is renamable by * double-clicking it * - * Copyright (c) 2004-2006 Tobias Doerffel + * Copyright (c) 2004-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -41,15 +41,12 @@ #endif -#include "engine.h" - -class nameLabel : public QLabel, public engineObject +class nameLabel : public QLabel { Q_OBJECT public: - nameLabel( const QString & _initial_name, QWidget * _parent, - engine * _engine ); + nameLabel( const QString & _initial_name, QWidget * _parent ); virtual ~nameLabel(); const QPixmap & pixmap( void ) const diff --git a/include/note.h b/include/note.h index 971341cbf..5b72c0fe2 100644 --- a/include/note.h +++ b/include/note.h @@ -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-2006 Tobias Doerffel + * Copyright (c) 2004-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -95,13 +95,13 @@ class knob; class note : public journallingObject { public: - note( engine * _engine = NULL, - const midiTime & _length = 0, + note( const midiTime & _length = 0, const midiTime & _pos = 0, tones _tone = A, octaves _octave = DEFAULT_OCTAVE, volume _volume = DEFAULT_VOLUME, - panning _panning = DEFAULT_PANNING ) FASTCALL; + panning _panning = DEFAULT_PANNING, + knob * _detuning = NULL ) FASTCALL; note( const note & _note ); virtual ~note(); @@ -112,7 +112,6 @@ public: void FASTCALL setKey( const int _key ); void FASTCALL setVolume( const volume _volume = DEFAULT_VOLUME ); void FASTCALL setPanning( const panning _panning = DEFAULT_PANNING ); - void FASTCALL setDetuning( knob * _detuning ); void FASTCALL quantizeLength( const int _q_grid ); void FASTCALL quantizePos( const int _q_grid ); @@ -208,6 +207,7 @@ private: knob * m_detuning; void createDetuning( void ); + void FASTCALL setDetuning( knob * _detuning ); } ; diff --git a/include/oscillator.h b/include/oscillator.h index ea4ce0968..dc3030aae 100644 --- a/include/oscillator.h +++ b/include/oscillator.h @@ -1,7 +1,7 @@ /* * oscillator.h - header-file for oscillator.cpp, a powerful oscillator-class * - * Copyright (c) 2004-2006 Tobias Doerffel + * Copyright (c) 2004-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -183,10 +183,33 @@ private: const ch_cnt_t _chnl ); inline bool syncOk( float _osc_coeff ); + template + void updateNoSub( sampleFrame * _ab, const fpab_t _frames, + const ch_cnt_t _chnl ); + template + void updatePM( sampleFrame * _ab, const fpab_t _frames, + const ch_cnt_t _chnl ); + template + void updateAM( sampleFrame * _ab, const fpab_t _frames, + const ch_cnt_t _chnl ); + template + void updateMix( sampleFrame * _ab, const fpab_t _frames, + const ch_cnt_t _chnl ); + template + void updateSync( sampleFrame * _ab, const fpab_t _frames, + const ch_cnt_t _chnl ); + template + void updateFM( sampleFrame * _ab, const fpab_t _frames, + const ch_cnt_t _chnl ); + + template inline sample_t getSample( const float _sample ); + inline void FASTCALL recalcPhase( void ); } ; + + #endif diff --git a/include/pattern.h b/include/pattern.h index c680502bd..ff68855a3 100644 --- a/include/pattern.h +++ b/include/pattern.h @@ -273,7 +273,7 @@ signals: -class patternFreezeThread : public QThread, public engineObject +class patternFreezeThread : public QThread { public: patternFreezeThread( pattern * _pattern ); diff --git a/include/piano_roll.h b/include/piano_roll.h index cff274e3e..93ef48871 100644 --- a/include/piano_roll.h +++ b/include/piano_roll.h @@ -2,7 +2,7 @@ * 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-2006 Tobias Doerffel + * Copyright (c) 2004-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -45,7 +45,6 @@ #include "types.h" #include "note.h" -#include "engine.h" #include "journalling_object.h" @@ -173,7 +172,7 @@ private: } ; - pianoRoll( engine * _engine ); + pianoRoll( void ); pianoRoll( const pianoRoll & ); virtual ~pianoRoll(); diff --git a/include/pixmap_button.h b/include/pixmap_button.h index 49f1acdc1..066d5da54 100644 --- a/include/pixmap_button.h +++ b/include/pixmap_button.h @@ -1,7 +1,7 @@ /* * pixmap_button.h - declaration of class pixmapButton * - * Copyright (c) 2004-2006 Tobias Doerffel + * Copyright (c) 2004-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -47,7 +47,7 @@ class pixmapButton : public automatableButton Q_OBJECT public: pixmapButton( QWidget * _parent, const QString & _name, - engine * _engine, track * _track ); + track * _track ); virtual ~pixmapButton(); void setActiveGraphic( const QPixmap & _pm ); diff --git a/include/plugin.h b/include/plugin.h index c54ea3091..e8e8b262d 100644 --- a/include/plugin.h +++ b/include/plugin.h @@ -134,12 +134,11 @@ public: { } - virtual void fillDescriptionWidget( - QWidget *, engine *, const key & ) + virtual void fillDescriptionWidget( QWidget *, + const key * ) { } - virtual void listSubPluginKeys( engine *, - plugin::descriptor *, + virtual void listSubPluginKeys( plugin::descriptor *, keyList & ) { } @@ -159,7 +158,7 @@ public: } ; // contructor of a plugin - plugin( const descriptor * _descriptor, engine * _engine ); + plugin( const descriptor * _descriptor ); virtual ~plugin(); // returns public-name out of descriptor diff --git a/include/plugin_browser.h b/include/plugin_browser.h index cd70f5433..f736f278a 100644 --- a/include/plugin_browser.h +++ b/include/plugin_browser.h @@ -1,7 +1,7 @@ /* * plugin_browser.h - include file for pluginBrowser * - * Copyright (c) 2005-2006 Tobias Doerffel + * Copyright (c) 2005-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -55,11 +55,11 @@ class trackContainer; -class pluginBrowser : public sideBarWidget, public engineObject +class pluginBrowser : public sideBarWidget { Q_OBJECT public: - pluginBrowser( QWidget * _parent, engine * _engine ); + pluginBrowser( QWidget * _parent ); virtual ~pluginBrowser(); @@ -73,12 +73,11 @@ private: -class pluginDescWidget : public QWidget, public engineObject +class pluginDescWidget : public QWidget { Q_OBJECT public: - pluginDescWidget( const plugin::descriptor & _pd, QWidget * _parent, - engine * _engine ); + pluginDescWidget( const plugin::descriptor & _pd, QWidget * _parent ); virtual ~pluginDescWidget(); diff --git a/include/preset_preview_play_handle.h b/include/preset_preview_play_handle.h index e77546102..049c70f60 100644 --- a/include/preset_preview_play_handle.h +++ b/include/preset_preview_play_handle.h @@ -2,7 +2,7 @@ * preset_preview_play_handle.h - play-handle for playing a short preview-sound * of a preset * - * Copyright (c) 2005-2006 Tobias Doerffel + * Copyright (c) 2005-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -29,19 +29,8 @@ #include "qt3support.h" -#ifdef QT4 - -#include - -#else - -#include - -#endif - #include "note_play_handle.h" -#include "engine.h" class instrumentTrack; @@ -49,27 +38,21 @@ class notePlayHandle; class previewTrackContainer; -class presetPreviewPlayHandle : public playHandle, public engineObject +class presetPreviewPlayHandle : public playHandle { public: - presetPreviewPlayHandle( const QString & _preset_file, - engine * _engine ); + presetPreviewPlayHandle( const QString & _preset_file ); virtual ~presetPreviewPlayHandle(); virtual void play( bool _try_parallelizing ); virtual bool done( void ) const; - static void cleanUp( engine * _engine ); + static void cleanUp( void ); static constNotePlayHandleVector nphsOfInstrumentTrack( const instrumentTrack * _ct ); private: - inline previewTrackContainer * previewTC( void ) - { - return( s_previewTCs[eng()] ); - } - - static QMap s_previewTCs; + static previewTrackContainer * s_previewTC; notePlayHandle * m_previewNote; diff --git a/include/project_journal.h b/include/project_journal.h index ad9b24e9f..662a085ba 100755 --- a/include/project_journal.h +++ b/include/project_journal.h @@ -1,7 +1,7 @@ /* * project_journal.h - declaration of class projectJournal * - * Copyright (c) 2006 Tobias Doerffel + * Copyright (c) 2006-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -27,7 +27,6 @@ #define _PROJECT_JOURNAL_H #include "types.h" -#include "engine.h" #include "qt3support.h" #ifndef QT3 @@ -48,10 +47,10 @@ class journallingObject; -class projectJournal : public engineObject +class projectJournal { public: - projectJournal( engine * _engine ); + projectJournal( void ); virtual ~projectJournal(); void undo( void ); diff --git a/include/project_notes.h b/include/project_notes.h index 49b1a6756..cfcd1349e 100644 --- a/include/project_notes.h +++ b/include/project_notes.h @@ -1,7 +1,7 @@ /* * project_notes.h - header for project-notes-editor * - * Copyright (c) 2005-2006 Tobias Doerffel + * Copyright (c) 2005-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -40,7 +40,6 @@ #endif #include "journalling_object.h" -#include "engine.h" class QAction; @@ -52,7 +51,7 @@ class projectNotes : public QMainWindow, public journallingObject { Q_OBJECT public: - projectNotes( engine * _engine ); + projectNotes( void ); virtual ~projectNotes(); void clear( void ); diff --git a/include/rack_view.h b/include/rack_view.h index 713d06f4e..6e600ba6d 100644 --- a/include/rack_view.h +++ b/include/rack_view.h @@ -1,7 +1,7 @@ /* * right_frame.h - provides the display for the rackInsert instances * - * Copyright (c) 2006 Danny McRae + * Copyright (c) 2006-2007 Danny McRae * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -56,8 +56,7 @@ class rackView: public QWidget, public journallingObject Q_OBJECT public: - rackView( QWidget * _parent, engine * _engine, - track * _track, audioPort * _port ); + rackView( QWidget * _parent, track * _track, audioPort * _port ); ~rackView(); void addEffect( effect * _e ); diff --git a/include/sample_buffer.h b/include/sample_buffer.h index 9071b0a4b..db1d509f9 100644 --- a/include/sample_buffer.h +++ b/include/sample_buffer.h @@ -60,7 +60,7 @@ class QPainter; -class sampleBuffer : public QObject, public engineObject, public sharedObject +class sampleBuffer : public QObject, public sharedObject { Q_OBJECT public: @@ -92,11 +92,10 @@ public: // constructor which either loads sample _audio_file or decodes // base64-data out of string - sampleBuffer( engine * _engine, const QString & _audio_file = "", + sampleBuffer( const QString & _audio_file = "", bool _is_base64_data = FALSE ); - sampleBuffer( const sampleFrame * _data, const f_cnt_t _frames, - engine * _engine ); - sampleBuffer( const f_cnt_t _frames, engine * _engine ); + sampleBuffer( const sampleFrame * _data, const f_cnt_t _frames ); + sampleBuffer( const f_cnt_t _frames ); virtual ~sampleBuffer(); @@ -164,6 +163,11 @@ public: m_frequency = _freq; } + inline void setSampleRate( sample_rate_t _rate ) + { + m_sample_rate = _rate; + } + inline const sampleFrame * data( void ) const { return( m_data ); @@ -177,8 +181,7 @@ public: static sampleBuffer * FASTCALL resample( sampleFrame * _data, const f_cnt_t _frames, const sample_rate_t _src_sr, - const sample_rate_t _dst_sr, - engine * _engine ); + const sample_rate_t _dst_sr ); static inline sampleBuffer * FASTCALL resample( sampleBuffer * _buf, @@ -186,7 +189,7 @@ public: const sample_rate_t _dst_sr ) { return( resample( _buf->m_data, _buf->m_frames, _src_sr, - _dst_sr, _buf->eng() ) ); + _dst_sr ) ); } void normalize_sample_rate( const sample_rate_t _src_sr, @@ -270,6 +273,7 @@ private: float m_amplification; bool m_reversed; float m_frequency; + sample_rate_t m_sample_rate; QMutex m_dataMutex; #ifdef HAVE_SAMPLERATE_H diff --git a/include/sample_play_handle.h b/include/sample_play_handle.h index e639459a8..f8a95abeb 100644 --- a/include/sample_play_handle.h +++ b/include/sample_play_handle.h @@ -31,7 +31,6 @@ #include "play_handle.h" #include "sample_buffer.h" #include "types.h" -#include "engine.h" class bbTrack; class pattern; @@ -40,11 +39,11 @@ class track; class audioPort; -class samplePlayHandle : public QObject, public playHandle, public engineObject +class samplePlayHandle : public QObject, public playHandle { Q_OBJECT public: - samplePlayHandle( const QString & _sample_file, engine * _engine ); + samplePlayHandle( const QString & _sample_file ); samplePlayHandle( sampleBuffer * _sample_buffer ); samplePlayHandle( sampleTCO * _tco ); samplePlayHandle( pattern * _pattern ); diff --git a/include/setup_dialog.h b/include/setup_dialog.h index f4e1e07ef..5f0df0745 100644 --- a/include/setup_dialog.h +++ b/include/setup_dialog.h @@ -53,7 +53,7 @@ class QSlider; class tabBar; -class setupDialog : public QDialog, public engineObject +class setupDialog : public QDialog { Q_OBJECT public: @@ -63,8 +63,7 @@ public: AUDIO_SETTINGS, MIDI_SETTINGS } ; - setupDialog( engine * _engine, - configTabs _tab_to_open = GENERAL_SETTINGS ); + setupDialog( configTabs _tab_to_open = GENERAL_SETTINGS ); virtual ~setupDialog(); diff --git a/include/song_editor.h b/include/song_editor.h index 5f55699bf..5184193db 100644 --- a/include/song_editor.h +++ b/include/song_editor.h @@ -2,7 +2,7 @@ * song_editor.h - declaration of class songEditor, a window where you can * setup your songs * - * Copyright (c) 2004-2006 Tobias Doerffel + * Copyright (c) 2004-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -230,7 +230,7 @@ protected slots: private: - songEditor( engine * _engine ); + songEditor( void ); songEditor( const songEditor & ); virtual ~songEditor(); diff --git a/include/string_pair_drag.h b/include/string_pair_drag.h index 4ed4e8b33..c57fcf541 100644 --- a/include/string_pair_drag.h +++ b/include/string_pair_drag.h @@ -2,7 +2,7 @@ * string_pair_drag.h - class stringPairDrag which provides general support * for drag'n'drop of string-pairs * - * Copyright (c) 2005-2006 Tobias Doerffel + * Copyright (c) 2005-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -39,23 +39,19 @@ #endif -#include "engine.h" - - class QPixmap; class stringPairDrag : public #ifdef QT4 - QDrag, + QDrag #else - QStoredDrag, + QStoredDrag #endif - public engineObject { public: stringPairDrag( const QString & _key, const QString & _value, - const QPixmap & _icon, QWidget * _w, engine * _engine ); + const QPixmap & _icon, QWidget * _w ); ~stringPairDrag(); static bool processDragEnterEvent( QDragEnterEvent * _dee, @@ -63,6 +59,11 @@ public: static QString decodeKey( QDropEvent * _de ); static QString decodeValue( QDropEvent * _de ); + static const char * mimeType( void ) + { + return( "application/x-lmms-stringpair" ); + } + } ; diff --git a/include/surround_area.h b/include/surround_area.h index 3a235ac4a..319b1abb7 100644 --- a/include/surround_area.h +++ b/include/surround_area.h @@ -3,7 +3,7 @@ * position of a channel + calculation of volume for each * speaker * - * Copyright (c) 2004-2005 Tobias Doerffel + * Copyright (c) 2004-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -57,7 +57,7 @@ class surroundArea : public QWidget Q_OBJECT public: surroundArea( QWidget * _parent, const QString & _name, - engine * _engine, track * _track ); + track * _track ); virtual ~surroundArea(); volumeVector getVolumeVector( float _v_scale = 0.0f ) const; inline const QPoint & value( void ) const diff --git a/include/tempo_sync_knob.h b/include/tempo_sync_knob.h index 636daf918..96ee52f73 100644 --- a/include/tempo_sync_knob.h +++ b/include/tempo_sync_knob.h @@ -1,7 +1,7 @@ /* * tempo_sync_knob.h - adds bpm to ms conversion for knob class * - * Copyright (c) 2005 Danny McRae + * Copyright (c) 2005-2007 Danny McRae * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -63,8 +63,7 @@ public: tempoSyncKnob( int _knob_num, QWidget * _parent, const QString & _name, - engine * _engine, track * _track, - float _scale = 1.0f ); + track * _track, float _scale = 1.0f ); virtual ~tempoSyncKnob(); virtual void FASTCALL saveSettings( QDomDocument & _doc, diff --git a/include/timeline.h b/include/timeline.h index 9088b54f1..450ec209d 100644 --- a/include/timeline.h +++ b/include/timeline.h @@ -1,7 +1,7 @@ /* * timeline.h - class timeLine, representing a time-line with position marker * - * Copyright (c) 2004-2006 Tobias Doerffel + * Copyright (c) 2004-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -68,7 +68,7 @@ public: timeLine( int _xoff, int _yoff, float _ppt, songEditor::playPos & _pos, - const midiTime & _begin, QWidget * _parent, engine * _engine ); + const midiTime & _begin, QWidget * _parent ); virtual ~timeLine(); inline songEditor::playPos & pos( void ) diff --git a/include/track.h b/include/track.h index 557a685f3..3cc78915b 100644 --- a/include/track.h +++ b/include/track.h @@ -2,7 +2,7 @@ * track.h - declaration of classes concerning tracks -> neccessary for all * track-like objects (beat/bassline, sample-track...) * - * Copyright (c) 2004-2006 Tobias Doerffel + * Copyright (c) 2004-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -55,7 +55,6 @@ #include "types.h" #include "midi_time.h" #include "rubberband.h" -#include "engine.h" #include "journalling_object.h" diff --git a/include/track_container.h b/include/track_container.h index 78dfff1dd..89d839ba1 100644 --- a/include/track_container.h +++ b/include/track_container.h @@ -2,7 +2,7 @@ * track_container.h - base-class for all track-containers like Song-Editor, * BB-Editor... * - * Copyright (c) 2004-2006 Tobias Doerffel + * Copyright (c) 2004-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -47,7 +47,6 @@ #include "track.h" #include "journalling_object.h" #include "rubberband.h" -#include "engine.h" @@ -60,7 +59,7 @@ class trackContainer : public QMainWindow, public journallingObject { Q_OBJECT public: - trackContainer( engine * _engine ); + trackContainer( void ); virtual ~trackContainer(); inline QWidget * containerWidget( void ) diff --git a/include/visualization_widget.h b/include/visualization_widget.h index d6b8b65e2..761afefb9 100644 --- a/include/visualization_widget.h +++ b/include/visualization_widget.h @@ -1,7 +1,7 @@ /* * visualization_widget.h - widget for visualization of sound-data * - * Copyright (c) 2005-2006 Tobias Doerffel + * Copyright (c) 2005-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -47,7 +47,7 @@ class QTimer; -class visualizationWidget : public QWidget, public engineObject +class visualizationWidget : public QWidget { Q_OBJECT public: @@ -56,7 +56,6 @@ public: SIMPLE // add more here } ; visualizationWidget( const QPixmap & _bg, QWidget * _parent, - engine * _engine, visualizationTypes _vtype = SIMPLE ); virtual ~visualizationWidget(); diff --git a/include/volume_knob.h b/include/volume_knob.h index 02a91c594..93fb36a85 100644 --- a/include/volume_knob.h +++ b/include/volume_knob.h @@ -2,7 +2,7 @@ * volume_knob.h - defines a knob that display it's value as either a * percentage or in dbV. * - * Copyright (c) 2006 Danny McRae + * Copyright (c) 2006-2007 Danny McRae * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -45,7 +45,7 @@ class volumeKnob: public knob Q_OBJECT public: volumeKnob( int _knob_num, QWidget * _parent, const QString & _name, - engine * _engine, track * _track ); + track * _track ); virtual ~volumeKnob(); diff --git a/plugins/audio_file_processor/audio_file_processor.cpp b/plugins/audio_file_processor/audio_file_processor.cpp index 6756ce749..e003f695a 100644 --- a/plugins/audio_file_processor/audio_file_processor.cpp +++ b/plugins/audio_file_processor/audio_file_processor.cpp @@ -92,7 +92,6 @@ QPixmap * audioFileProcessor::s_artwork = NULL; audioFileProcessor::audioFileProcessor( instrumentTrack * _channel_track ) : instrument( _channel_track, &audiofileprocessor_plugin_descriptor ), specialBgHandlingWidget( PLUGIN_NAME::getIconPixmap( "artwork" ) ), - m_sampleBuffer( eng(), "" ), m_drawMethod( sampleBuffer::LINE_CONNECT ) { connect( &m_sampleBuffer, SIGNAL( sampleUpdated() ), this, @@ -105,7 +104,7 @@ audioFileProcessor::audioFileProcessor( instrumentTrack * _channel_track ) : } - m_openAudioFileButton = new pixmapButton( this, NULL, eng(), NULL ); + m_openAudioFileButton = new pixmapButton( this, NULL, NULL ); m_openAudioFileButton->setCursor( QCursor( Qt::PointingHandCursor ) ); m_openAudioFileButton->move( 200, 90 ); m_openAudioFileButton->setActiveGraphic( embed::getIconPixmap( @@ -130,7 +129,7 @@ audioFileProcessor::audioFileProcessor( instrumentTrack * _channel_track ) : "are not reset, so please don't wonder if your sample " "doesn't sound like the original one..." ) ); - m_reverseButton = new pixmapButton( this, NULL, eng(), NULL ); + m_reverseButton = new pixmapButton( this, NULL, NULL ); m_reverseButton->setCheckable( TRUE ); m_reverseButton->move( 160, 124 ); m_reverseButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap( @@ -150,7 +149,7 @@ audioFileProcessor::audioFileProcessor( instrumentTrack * _channel_track ) : "This is useful for cool effects, e.g. a reversed " "crash." ) ); - m_loopButton = new pixmapButton( this, NULL, eng(), NULL ); + m_loopButton = new pixmapButton( this, tr( "Loop" ), _channel_track ); m_loopButton->setCheckable( TRUE ); m_loopButton->move( 180, 124 ); m_loopButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap( @@ -171,8 +170,7 @@ audioFileProcessor::audioFileProcessor( instrumentTrack * _channel_track ) : "This is useful for things like string- and choir-" "samples." ) ); - m_ampKnob = new volumeKnob( knobDark_28, this, tr( "Amplify" ), eng(), - NULL ); + m_ampKnob = new volumeKnob( knobDark_28, this, tr( "Amplify" ), NULL ); m_ampKnob->setRange( 0, 500, 1.0f ); m_ampKnob->move( 6, 114 ); m_ampKnob->setInitValue( 100.0f ); @@ -191,7 +189,7 @@ audioFileProcessor::audioFileProcessor( instrumentTrack * _channel_track ) : "actual sample-file isn't touched!)" ) ); m_startKnob = new knob( knobDark_28, this, tr( "Start of sample" ), - eng(), _channel_track ); + _channel_track ); m_startKnob->setRange( 0.0f, 1.0f, 0.00001f ); m_startKnob->move( 46, 114 ); m_startKnob->setInitValue( 0.0f ); @@ -210,7 +208,7 @@ audioFileProcessor::audioFileProcessor( instrumentTrack * _channel_track ) : "which AudioFileProcessor returns if a note is longer " "than the sample between start- and end-point." ) ); - m_endKnob = new knob( knobDark_28, this, tr( "End of sample" ), eng(), + m_endKnob = new knob( knobDark_28, this, tr( "End of sample" ), _channel_track ); m_endKnob->setRange( 0.0f, 1.0f, 0.00001f ); m_endKnob->move( 84, 114 ); @@ -230,7 +228,7 @@ audioFileProcessor::audioFileProcessor( instrumentTrack * _channel_track ) : "AudioFileProcessor returns if a note is longer than " "the sample between start- and end-point." ) ); - m_viewLinesPB = new pixmapButton( this, NULL, eng(), NULL ); + m_viewLinesPB = new pixmapButton( this, NULL, NULL ); m_viewLinesPB->move( 154, 158 ); m_viewLinesPB->setBgGraphic( getBackground( m_viewLinesPB ) ); if( m_drawMethod == sampleBuffer::LINE_CONNECT ) @@ -249,7 +247,7 @@ audioFileProcessor::audioFileProcessor( instrumentTrack * _channel_track ) : "sound itself. It just gives you another view to your " "sample." ) ); - m_viewDotsPB = new pixmapButton( this, NULL, eng(), NULL ); + m_viewDotsPB = new pixmapButton( this, NULL, NULL ); m_viewDotsPB->move( 204, 158 ); m_viewDotsPB->setBgGraphic( getBackground( m_viewDotsPB ) ); if( m_drawMethod == sampleBuffer::DOTS ) @@ -268,7 +266,7 @@ audioFileProcessor::audioFileProcessor( instrumentTrack * _channel_track ) : "It just gives you another view to your sample." ) ); automatableButtonGroup * view_group = new automatableButtonGroup( this, - NULL, eng(), NULL ); + NULL, NULL ); view_group->addButton( m_viewLinesPB ); view_group->addButton( m_viewDotsPB ); @@ -360,7 +358,7 @@ Uint32 audioFileProcessor::getBeatLen( notePlayHandle * _n ) const const float freq_factor = BASE_FREQ / ( getInstrumentTrack()->frequency( _n ) * DEFAULT_SAMPLE_RATE / - eng()->getMixer()->sampleRate() ); + engine::getMixer()->sampleRate() ); return( static_cast( floorf( ( m_sampleBuffer.endFrame() - m_sampleBuffer.startFrame() ) * @@ -394,13 +392,11 @@ void audioFileProcessor::setAudioFile( const QString & _audio_file, bool _rename void audioFileProcessor::playNote( notePlayHandle * _n, bool ) { - const Uint32 frames = eng()->getMixer()->framesPerAudioBuffer(); + const Uint32 frames = engine::getMixer()->framesPerAudioBuffer(); sampleFrame * buf = bufferAllocator::alloc( frames ); // calculate frequency of note - const float note_freq = getInstrumentTrack()->frequency( _n ) / - ( eng()->getMixer()->sampleRate() / - DEFAULT_SAMPLE_RATE ); + const float note_freq = getInstrumentTrack()->frequency( _n ); if( !_n->m_pluginData ) { @@ -430,9 +426,10 @@ void audioFileProcessor::deleteNotePluginData( notePlayHandle * _n ) void audioFileProcessor::dragEnterEvent( QDragEnterEvent * _dee ) { #ifdef QT4 - if( _dee->mimeData()->hasFormat( "lmms/stringpair" ) ) + if( _dee->mimeData()->hasFormat( stringPairDrag::mimeType() ) ) { - QString txt = _dee->mimeData()->data( "lmms/stringpair" ); + QString txt = _dee->mimeData()->data( + stringPairDrag::mimeType() ); if( txt.section( ':', 0, 0 ) == QString( "tco_%1" ).arg( track::SAMPLE_TRACK ) ) { @@ -452,7 +449,7 @@ void audioFileProcessor::dragEnterEvent( QDragEnterEvent * _dee ) _dee->ignore(); } #else - QString txt = _dee->encodedData( "lmms/stringpair" ); + QString txt = _dee->encodedData( stringPairDrag::mimeType() ); if( txt != "" ) { if( txt.section( ':', 0, 0 ) == QString( "tco_%1" ).arg( @@ -620,7 +617,7 @@ void audioFileProcessor::sampleUpdated( void ) void audioFileProcessor::reverseBtnToggled( bool _on ) { m_sampleBuffer.setReversed( _on ); - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); } @@ -727,7 +724,7 @@ void audioFileProcessor::openAudioFile( void ) if( af != "" ) { setAudioFile( af ); - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); } } diff --git a/plugins/bass_booster/bass_booster.cpp b/plugins/bass_booster/bass_booster.cpp index 5bbbdd76b..e9ae7458e 100644 --- a/plugins/bass_booster/bass_booster.cpp +++ b/plugins/bass_booster/bass_booster.cpp @@ -1,7 +1,7 @@ /* * bass_booster.cpp - bass-booster-effect-plugin * - * Copyright (c) 2006 Tobias Doerffel + * Copyright (c) 2006-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -51,8 +51,9 @@ plugin::descriptor bassbooster_plugin_descriptor = -bassBoosterEffect::bassBoosterEffect( effect::constructionData * _cdata ) : - effect( &bassbooster_plugin_descriptor, _cdata ), +bassBoosterEffect::bassBoosterEffect( + const descriptor::subPluginFeatures::key * _key ) : + effect( &bassbooster_plugin_descriptor, _key ), m_bbFX( effectLib::fastBassBoost<>( 70.0f, 1.0f, 2.8f ) ) { } @@ -116,7 +117,8 @@ extern "C" plugin * lmms_plugin_main( void * _data ) { return( new bassBoosterEffect( - static_cast( _data ) ) ); + static_cast( + _data ) ) ); } } diff --git a/plugins/bass_booster/bass_booster.h b/plugins/bass_booster/bass_booster.h index 1f907bcd6..7f3ecadf3 100644 --- a/plugins/bass_booster/bass_booster.h +++ b/plugins/bass_booster/bass_booster.h @@ -1,7 +1,7 @@ /* * bass_booster.h - bass-booster-effect-plugin * - * Copyright (c) 2006 Tobias Doerffel + * Copyright (c) 2006-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -29,6 +29,7 @@ #include "effect.h" #include "effect_lib.h" +#include "engine.h" #include "main_window.h" #include "bassbooster_control_dialog.h" @@ -37,7 +38,7 @@ class bassBoosterEffect : public effect { public: - bassBoosterEffect( effect::constructionData * _cdata ); + bassBoosterEffect( const descriptor::subPluginFeatures::key * _key ); virtual ~bassBoosterEffect(); virtual bool FASTCALL processAudioBuffer( surroundSampleFrame * _buf, const fpab_t _frames ); @@ -49,7 +50,7 @@ public: virtual inline effectControlDialog * createControlDialog( track * ) { return( new bassBoosterControlDialog( - eng()->getMainWindow()->workspace(), + engine::getMainWindow()->workspace(), this ) ); } diff --git a/plugins/bass_booster/bassbooster_control_dialog.cpp b/plugins/bass_booster/bassbooster_control_dialog.cpp index eb743e9f7..b7d978761 100644 --- a/plugins/bass_booster/bassbooster_control_dialog.cpp +++ b/plugins/bass_booster/bassbooster_control_dialog.cpp @@ -1,7 +1,7 @@ /* * bassbooster_control_dialog.cpp - control-dialog for bassbooster-effect * - * Copyright (c) 2006 Tobias Doerffel + * Copyright (c) 2006-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -45,8 +45,7 @@ bassBoosterControlDialog::bassBoosterControlDialog( QWidget * _parent, { QHBoxLayout * l = new QHBoxLayout( this ); - m_freqKnob = new knob( knobBright_26, this, tr( "Frequency" ), - eng(), NULL ); + m_freqKnob = new knob( knobBright_26, this, tr( "Frequency" ), NULL ); m_freqKnob->setRange( 50.0f, 200.0f, 1.0f ); m_freqKnob->setInitValue( 100.0f ); m_freqKnob->setLabel( tr( "FREQ" ) ); @@ -54,7 +53,7 @@ bassBoosterControlDialog::bassBoosterControlDialog( QWidget * _parent, connect( m_freqKnob, SIGNAL( valueChanged( float ) ), this, SLOT( changeFrequency( void ) ) ); - m_gainKnob = new knob( knobBright_26, this, tr( "Gain" ), eng(), NULL ); + m_gainKnob = new knob( knobBright_26, this, tr( "Gain" ), NULL ); m_gainKnob->setRange( 0.1f, 5.0f, 0.1f ); m_gainKnob->setInitValue( 1.0f ); m_gainKnob->setLabel( tr( "GAIN" ) ); @@ -62,8 +61,7 @@ bassBoosterControlDialog::bassBoosterControlDialog( QWidget * _parent, connect( m_gainKnob, SIGNAL( valueChanged( float ) ), this, SLOT( changeGain( void ) ) ); - m_ratioKnob = new knob( knobBright_26, this, tr( "Ratio" ), eng(), - NULL ); + m_ratioKnob = new knob( knobBright_26, this, tr( "Ratio" ), NULL ); m_ratioKnob->setRange( 0.1f, 10.0f, 0.1f ); m_ratioKnob->setInitValue( 2.0f ); m_ratioKnob->setLabel( tr( "RATIO" ) ); diff --git a/plugins/bit_invader/bit_invader.cpp b/plugins/bit_invader/bit_invader.cpp index f34a84ed3..544a0bfcd 100644 --- a/plugins/bit_invader/bit_invader.cpp +++ b/plugins/bit_invader/bit_invader.cpp @@ -1,7 +1,7 @@ /* * bit_invader.cpp - instrument which uses a usereditable wavetable * - * Copyright (c) 2006 Andreas Brandmaier + * Copyright (c) 2006-2007 Andreas Brandmaier * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -189,7 +189,7 @@ bitInvader::bitInvader( instrumentTrack * _channel_track ) : m_sampleLengthKnob = new knob( knobDark_28, this, tr( "Samplelength" ), - eng(), _channel_track ); + _channel_track ); m_sampleLengthKnob->setRange( 8, 128, 1 ); m_sampleLengthKnob->setInitValue( 128 ); m_sampleLengthKnob->move( 10, 120 ); @@ -201,7 +201,7 @@ bitInvader::bitInvader( instrumentTrack * _channel_track ) : m_interpolationToggle = new ledCheckBox( "Interpolation", this, tr( "Interpolation" ), - eng(), _channel_track ); + _channel_track ); m_interpolationToggle->move( 55,80 ); connect( m_interpolationToggle, SIGNAL( toggled( bool ) ), @@ -209,14 +209,14 @@ bitInvader::bitInvader( instrumentTrack * _channel_track ) : m_normalizeToggle = new ledCheckBox( "Normalize", this, tr( "Normalize" ), - eng(), _channel_track ); + _channel_track ); m_normalizeToggle->move( 55, 100 ); connect( m_normalizeToggle, SIGNAL( toggled( bool ) ), this, SLOT ( normalizeToggle( bool ) ) ); - m_graph = new graph( this, eng() ); + m_graph = new graph( this ); m_graph->move(53,118); // 55,120 - 2px border m_graph->setCursor( QCursor( Qt::CrossCursor ) ); @@ -234,7 +234,7 @@ bitInvader::bitInvader( instrumentTrack * _channel_track ) : connect( m_graph, SIGNAL ( sampleChanged( void ) ), this, SLOT ( sampleChanged( void ) ) ); - sinWaveBtn = new pixmapButton( this, tr( "Sine wave" ), eng(), + sinWaveBtn = new pixmapButton( this, tr( "Sine wave" ), _channel_track ); sinWaveBtn->move( 188, 120 ); sinWaveBtn->setActiveGraphic( embed::getIconPixmap( @@ -246,7 +246,7 @@ bitInvader::bitInvader( instrumentTrack * _channel_track ) : "current oscillator." ) ); triangleWaveBtn = new pixmapButton( this, tr( "Triangle wave" ), - eng(), _channel_track ); + _channel_track ); triangleWaveBtn->move( 188, 136 ); triangleWaveBtn->setActiveGraphic( embed::getIconPixmap( "triangle_wave_active" ) ); @@ -256,7 +256,7 @@ bitInvader::bitInvader( instrumentTrack * _channel_track ) : tr( "Click here if you want a triangle-wave " "for current oscillator." ) ); - sawWaveBtn = new pixmapButton( this, tr( "Saw wave" ), eng(), + sawWaveBtn = new pixmapButton( this, tr( "Saw wave" ), _channel_track ); sawWaveBtn->move( 188, 152 ); sawWaveBtn->setActiveGraphic( embed::getIconPixmap( @@ -267,7 +267,7 @@ bitInvader::bitInvader( instrumentTrack * _channel_track ) : tr( "Click here if you want a saw-wave for " "current oscillator." ) ); - sqrWaveBtn = new pixmapButton( this, tr( "Square wave" ), eng(), + sqrWaveBtn = new pixmapButton( this, tr( "Square wave" ), _channel_track ); sqrWaveBtn->move( 188, 168 ); sqrWaveBtn->setActiveGraphic( embed::getIconPixmap( @@ -280,7 +280,7 @@ bitInvader::bitInvader( instrumentTrack * _channel_track ) : whiteNoiseWaveBtn = new pixmapButton( this, tr( "White noise wave" ), - eng(), _channel_track ); + _channel_track ); whiteNoiseWaveBtn->move( 188, 184 ); whiteNoiseWaveBtn->setActiveGraphic( embed::getIconPixmap( "white_noise_wave_active" ) ); @@ -291,7 +291,7 @@ bitInvader::bitInvader( instrumentTrack * _channel_track ) : "current oscillator." ) ); usrWaveBtn = new pixmapButton( this, tr( "User defined wave" ), - eng(), _channel_track ); + _channel_track ); usrWaveBtn->move( 188, 200 ); usrWaveBtn->setActiveGraphic( embed::getIconPixmap( "usr_wave_active" ) ); @@ -317,7 +317,7 @@ bitInvader::bitInvader( instrumentTrack * _channel_track ) : - smoothBtn = new pixmapButton( this, tr( "Smooth" ), eng(), + smoothBtn = new pixmapButton( this, tr( "Smooth" ), _channel_track ); smoothBtn->move( 55, 225 ); smoothBtn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( @@ -447,7 +447,7 @@ void bitInvader::usrWaveClicked( void ) } // load user shape - sampleBuffer buffer( eng() ); + sampleBuffer buffer; QString af = buffer.openAudioFile(); if ( af != "" ) { @@ -635,14 +635,14 @@ void bitInvader::interpolationToggle( bool value ) { interpolation = value; - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); } void bitInvader::normalizeToggle( bool value ) { normalize = value; - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); } @@ -674,7 +674,7 @@ void bitInvader::smoothClicked( void ) update(); m_graph->update(); - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); } @@ -697,10 +697,10 @@ void bitInvader::playNote( notePlayHandle * _n, bool ) _n->m_pluginData = new bSynth( sample_shape, sample_length,freq , interpolation, factor, - eng()->getMixer()->sampleRate() ); + engine::getMixer()->sampleRate() ); } - const fpab_t frames = eng()->getMixer()->framesPerAudioBuffer(); + const fpab_t frames = engine::getMixer()->framesPerAudioBuffer(); sampleFrame * buf = bufferAllocator::alloc( frames ); bSynth * ps = static_cast( _n->m_pluginData ); @@ -772,7 +772,7 @@ void bitInvader::sampleSizeChanged( float _new_sample_length ) m_graph->setSamplePointer( sample_shape, sample_length ); // set Song modified - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); } @@ -793,7 +793,7 @@ void bitInvader::sampleChanged() m_graph->update(); } - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); } diff --git a/plugins/bit_invader/graph.cpp b/plugins/bit_invader/graph.cpp index a38b2edcc..ada8fc6d5 100644 --- a/plugins/bit_invader/graph.cpp +++ b/plugins/bit_invader/graph.cpp @@ -1,7 +1,7 @@ /* * graph.cpp - a QT widget for displaying and manipulating waveforms * - * Copyright (c) 2006 Andreas Brandmaier + * Copyright (c) 2006-2007 Andreas Brandmaier * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -50,9 +50,8 @@ using namespace std; -graph::graph( QWidget * _parent, engine * _engine ) : - QWidget( _parent ), - engineObject( _engine ) +graph::graph( QWidget * _parent ) : + QWidget( _parent ) { // m_background = 0; TODO @@ -96,7 +95,7 @@ void graph::loadSampleFromFile( const QString & _filename ) } // load user shape - sampleBuffer buffer( eng(), _filename ); + sampleBuffer buffer( _filename ); // copy buffer data sampleLength = min( sampleLength, static_cast(buffer.frames()) ); diff --git a/plugins/bit_invader/graph.h b/plugins/bit_invader/graph.h index 17cfbd2a1..55848fff3 100644 --- a/plugins/bit_invader/graph.h +++ b/plugins/bit_invader/graph.h @@ -1,7 +1,7 @@ /* * graph.h - a QT widget for displaying and manipulating waveforms * - * Copyright (c) 2006 Andreas Brandmaier + * Copyright (c) 2006-2007 Andreas Brandmaier * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -43,14 +43,11 @@ #endif -#include "engine.h" - - -class graph : public QWidget, public engineObject +class graph : public QWidget { Q_OBJECT public: - graph( QWidget * _parent, engine * _engine ); + graph( QWidget * _parent ); virtual ~graph(); void setSamplePointer( float * pointer, int length ); diff --git a/plugins/flp_import/flp_import.cpp b/plugins/flp_import/flp_import.cpp index bef4fb4e5..f0be546ea 100644 --- a/plugins/flp_import/flp_import.cpp +++ b/plugins/flp_import/flp_import.cpp @@ -127,7 +127,7 @@ static void dump_mem( const void * buffer, uint n_bytes ) flpImport::flpImport( const QString & _file ) : - importFilter( _file, &flpimport_plugin_descriptor, NULL ) + importFilter( _file, &flpimport_plugin_descriptor ) { } @@ -246,9 +246,9 @@ bool flpImport::tryImport( trackContainer * _tc ) int ev_cnt = 0; - _tc->eng()->getSongEditor()->clearProject(); - const bool is_journ = _tc->eng()->getProjectJournal()->isJournalling(); - _tc->eng()->getProjectJournal()->setJournalling( FALSE ); + engine::getSongEditor()->clearProject(); + const bool is_journ = engine::getProjectJournal()->isJournalling(); + engine::getProjectJournal()->setJournalling( FALSE ); while( file().atEnd() == FALSE ) @@ -333,7 +333,7 @@ bool flpImport::tryImport( trackContainer * _tc ) case FLP_MainVol: printf( "main-volume: %d\n", data ); - _tc->eng()->getSongEditor()->setMasterVolume( + engine::getSongEditor()->setMasterVolume( static_cast( data * 100 / 128 ) ); break; @@ -364,7 +364,7 @@ bool flpImport::tryImport( trackContainer * _tc ) printf( "new channel\n" ); it = dynamic_cast( - track::create( track::INSTRUMENT_TRACK, _tc->eng()->getBBEditor() ) ); + track::create( track::INSTRUMENT_TRACK, engine::getBBEditor() ) ); assert( it != NULL ); i_tracks.push_back( it ); it_inst = it->loadInstrument( @@ -384,7 +384,7 @@ bool flpImport::tryImport( trackContainer * _tc ) case FLP_Tempo: printf( "tempo: %d\n", data ); - _tc->eng()->getSongEditor()->setTempo( data ); + engine::getSongEditor()->setTempo( data ); break; case FLP_CurrentPatNum: @@ -417,8 +417,7 @@ bool flpImport::tryImport( trackContainer * _tc ) break; case FLP_MainPitch: - _tc->eng()->getSongEditor()->setMasterPitch( - data ); + engine::getSongEditor()->setMasterPitch( data ); break; case FLP_Resonance: @@ -533,7 +532,7 @@ bool flpImport::tryImport( trackContainer * _tc ) ba.resetRawData( text, text_len ); #endif - _tc->eng()->getProjectNotes()->setText( out ); + engine::getProjectNotes()->setText( out ); outstring = ""; break; } @@ -749,7 +748,7 @@ bool flpImport::tryImport( trackContainer * _tc ) 8 ) ); pos /= 6; len /= 6; - note n( NULL, len, pos ); + note n( len, pos ); n.setKey( key ); m_notes.push_back( qMakePair( num_channels * current_pattern + ch, n ) ); @@ -816,10 +815,10 @@ bool flpImport::tryImport( trackContainer * _tc ) const int ch = ( *it ) >> 16; const csize pat = ( ( *it ) & 0xffff ) / 16; const csize pos = ( ( ( *it ) & 0xffff ) % 16 ) * 4; - while( _tc->eng()->getBBEditor()->numOfBBs() <= pat ) + while( engine::getBBEditor()->numOfBBs() <= pat ) { track::create( track::BB_TRACK, - _tc->eng()->getSongEditor() ); + engine::getSongEditor() ); } pattern * p = dynamic_cast( i_tracks[ch]->getTCO( pat ) ); @@ -827,7 +826,7 @@ bool flpImport::tryImport( trackContainer * _tc ) { continue; } - p->setNoteAt( pos / 4, note( NULL, -64, pos ) ); + p->setNoteAt( pos / 4, note( -64, pos ) ); } // now process all notes @@ -841,10 +840,10 @@ bool flpImport::tryImport( trackContainer * _tc ) { continue; } - while( _tc->eng()->getBBEditor()->numOfBBs() <= pat ) + while( engine::getBBEditor()->numOfBBs() <= pat ) { track::create( track::BB_TRACK, - _tc->eng()->getSongEditor() ); + engine::getSongEditor() ); #ifdef QT4 qApp->processEvents( QEventLoop::AllEvents, 100 ); #else @@ -868,10 +867,10 @@ bool flpImport::tryImport( trackContainer * _tc ) { continue; } - while( _tc->eng()->getBBEditor()->numOfBBs() <= pat_num ) + while( engine::getBBEditor()->numOfBBs() <= pat_num ) { track::create( track::BB_TRACK, - _tc->eng()->getSongEditor() ); + engine::getSongEditor() ); #ifdef QT4 qApp->processEvents( QEventLoop::AllEvents, 100 ); #else @@ -879,17 +878,17 @@ bool flpImport::tryImport( trackContainer * _tc ) #endif } - bbTrack * bbt = bbTrack::findBBTrack( pat_num, _tc->eng() ); + bbTrack * bbt = bbTrack::findBBTrack( pat_num ); trackContentObject * tco = bbt->addTCO( bbt->createTCO( 0 ) ); tco->movePosition( midiTime( ( ( *it ) & 0xffff ) * 64 ) ); } - if( (csize) project_cur_pat < _tc->eng()->getBBEditor()->numOfBBs() ) + if( (csize) project_cur_pat < engine::getBBEditor()->numOfBBs() ) { - _tc->eng()->getBBEditor()->setCurrentBB( project_cur_pat ); + engine::getBBEditor()->setCurrentBB( project_cur_pat ); } - _tc->eng()->getProjectJournal()->setJournalling( is_journ ); + engine::getProjectJournal()->setJournalling( is_journ ); return( TRUE ); } diff --git a/plugins/kicker/kicker.cpp b/plugins/kicker/kicker.cpp index c46278756..5cb055dcf 100644 --- a/plugins/kicker/kicker.cpp +++ b/plugins/kicker/kicker.cpp @@ -1,7 +1,7 @@ /* * kicker.cpp - bassdrum-synthesizer * - * Copyright (c) 2006 Tobias Doerffel + * Copyright (c) 2006-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -74,35 +74,35 @@ kickerInstrument::kickerInstrument( instrumentTrack * _instrument_track ) : QVBoxLayout * vl = new QVBoxLayout( this ); QHBoxLayout * hl = new QHBoxLayout; m_startFreqKnob = new knob( knobDark_28, this, tr( "Start frequency" ), - eng(), _instrument_track ); + _instrument_track ); m_startFreqKnob->setRange( 5.0f, 1000.0f, 1.0f ); m_startFreqKnob->setInitValue( 150.0f ); m_startFreqKnob->setLabel( tr( "START" ) ); m_startFreqKnob->setHintText( tr( "Start frequency:" ) + " ", "Hz" ); m_endFreqKnob = new knob( knobDark_28, this, tr( "End frequency" ), - eng(), _instrument_track ); + _instrument_track ); m_endFreqKnob->setRange( 5.0f, 1000.0f, 1.0f ); m_endFreqKnob->setInitValue( 40.0f ); m_endFreqKnob->setLabel( tr( "END" ) ); m_endFreqKnob->setHintText( tr( "End frequency:" ) + " ", "Hz" ); m_decayKnob = new knob( knobDark_28, this, tr( "Decay" ), - eng(), _instrument_track ); + _instrument_track ); m_decayKnob->setRange( 5.0f, 1000.0f, 1.0f ); m_decayKnob->setInitValue( 120.0f ); m_decayKnob->setLabel( tr( "DECAY" ) ); m_decayKnob->setHintText( tr( "Decay:" ) + " ", "ms" ); m_distKnob = new knob( knobDark_28, this, tr( "Distortion" ), - eng(), _instrument_track ); + _instrument_track ); m_distKnob->setRange( 0.0f, 100.0f, 0.1f ); m_distKnob->setInitValue( 0.8f ); m_distKnob->setLabel( tr( "DIST" ) ); m_distKnob->setHintText( tr( "Distortion:" ) + " ", "" ); m_gainKnob = new knob( knobDark_28, this, tr( "Gain" ), - eng(), _instrument_track ); + _instrument_track ); m_gainKnob->setRange( 0.1f, 5.0f, 0.05f ); m_gainKnob->setInitValue( 1.0f ); m_gainKnob->setLabel( tr( "GAIN" ) ); @@ -176,7 +176,7 @@ typedef sweepOscillator > sweepOsc; void kickerInstrument::playNote( notePlayHandle * _n, bool ) { const float decfr = m_decayKnob->value() * - eng()->getMixer()->sampleRate() / 1000.0f; + engine::getMixer()->sampleRate() / 1000.0f; const f_cnt_t tfp = _n->totalFramesPlayed(); if ( tfp == 0 ) @@ -195,9 +195,9 @@ void kickerInstrument::playNote( notePlayHandle * _n, bool ) const fpab_t frames = _n->released() ? tMax( tMin( desiredReleaseFrames() - _n->releaseFramesDone(), - eng()->getMixer()->framesPerAudioBuffer() ), 0 ) + engine::getMixer()->framesPerAudioBuffer() ), 0 ) : - eng()->getMixer()->framesPerAudioBuffer(); + engine::getMixer()->framesPerAudioBuffer(); const float f1 = m_startFreqKnob->value() + tfp * fdiff / decfr; const float f2 = m_startFreqKnob->value() + (frames+tfp-1)*fdiff/decfr; @@ -205,7 +205,7 @@ void kickerInstrument::playNote( notePlayHandle * _n, bool ) sweepOsc * so = static_cast( _n->m_pluginData ); - so->update( buf, frames, f1, f2, eng()->getMixer()->sampleRate() ); + so->update( buf, frames, f1, f2, engine::getMixer()->sampleRate() ); if( _n->released() ) { diff --git a/plugins/ladspa_base/ladspa_2_lmms.cpp b/plugins/ladspa_base/ladspa_2_lmms.cpp index d3496b4fa..3c091e89d 100644 --- a/plugins/ladspa_base/ladspa_2_lmms.cpp +++ b/plugins/ladspa_base/ladspa_2_lmms.cpp @@ -2,7 +2,7 @@ * ladspa_2_lmms.cpp - class that identifies and instantiates LADSPA effects * for use with LMMS * - * Copyright (c) 2005 Danny McRae + * Copyright (c) 2005-2007 Danny McRae * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -30,8 +30,7 @@ #define indexOf find #endif -ladspa2LMMS::ladspa2LMMS( engine * _engine ): - ladspaManager( _engine ) +ladspa2LMMS::ladspa2LMMS( void ) { l_sortable_plugin_t plugins = getSortedPlugins(); diff --git a/plugins/ladspa_base/ladspa_2_lmms.h b/plugins/ladspa_base/ladspa_2_lmms.h index caabc04d3..8b6ca35bd 100644 --- a/plugins/ladspa_base/ladspa_2_lmms.h +++ b/plugins/ladspa_base/ladspa_2_lmms.h @@ -2,7 +2,7 @@ * ladspa_2_lmms.h - class that identifies and instantiates LADSPA effects * for use with LMMS * - * Copyright (c) 2005 Danny McRae + * Copyright (c) 2005-2007 Danny McRae * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -28,7 +28,6 @@ #include "ladspa_manager.h" -#include "engine.h" class ladspa2LMMS: public ladspaManager @@ -64,10 +63,9 @@ public: QString getShortName( const ladspa_key_t & _key ); private: - ladspa2LMMS( engine * _engine ); + ladspa2LMMS( void ); ~ladspa2LMMS(); -// engine * m_engine; // ladspaManager * m_ladspa; l_sortable_plugin_t m_instruments; diff --git a/plugins/ladspa_base/ladspa_base.h b/plugins/ladspa_base/ladspa_base.h index 0550af185..d4813233a 100644 --- a/plugins/ladspa_base/ladspa_base.h +++ b/plugins/ladspa_base/ladspa_base.h @@ -1,8 +1,8 @@ /* * ladspa_base.h - basic declarations concerning LADSPA * - * Copyright (c) 2006 Danny McRae - * Copyright (c) 2006 Tobias Doerffel + * Copyright (c) 2006-2007 Danny McRae + * Copyright (c) 2006-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -70,10 +70,10 @@ typedef struct portDescription inline ladspa_key_t subPluginKeyToLadspaKey( - const plugin::descriptor::subPluginFeatures::key & _key ) + const plugin::descriptor::subPluginFeatures::key * _key ) { - return( ladspa_key_t( _key.user.toStringList().first(), - _key.user.toStringList().last() ) ); + return( ladspa_key_t( _key->user.toStringList().first(), + _key->user.toStringList().last() ) ); } inline plugin::descriptor::subPluginFeatures::key ladspaKeyToSubPluginKey( diff --git a/plugins/ladspa_base/ladspa_control.cpp b/plugins/ladspa_base/ladspa_control.cpp index 9c9a78731..ae9a47f3c 100644 --- a/plugins/ladspa_base/ladspa_control.cpp +++ b/plugins/ladspa_base/ladspa_control.cpp @@ -44,7 +44,6 @@ ladspaControl::ladspaControl( QWidget * _parent, port_desc_t * _port, - engine * _engine, track * _track, bool _link) : QWidget( _parent @@ -52,7 +51,6 @@ ladspaControl::ladspaControl( QWidget * _parent, , "ladspaControl" #endif ), - journallingObject( _engine ), m_port( _port ), m_track( _track ), m_link( NULL ), @@ -67,7 +65,7 @@ ladspaControl::ladspaControl( QWidget * _parent, if( _link ) { - m_link = new ledCheckBox( "", this, "", eng(), m_track ); + m_link = new ledCheckBox( "", this, "", m_track ); m_link->setChecked( FALSE ); connect( m_link, SIGNAL( toggled( bool ) ), this, SLOT( portLink( bool ) ) ); @@ -78,9 +76,8 @@ ladspaControl::ladspaControl( QWidget * _parent, switch( m_port->data_type ) { case TOGGLED: - m_toggle = new ledCheckBox( m_port->name, this, "", - eng(), m_track, - ledCheckBox::GREEN ); + m_toggle = new ledCheckBox( m_port->name, this, "", + m_track, ledCheckBox::GREEN ); connect( m_toggle, SIGNAL( toggled( bool ) ), this, SLOT( ledChange( bool ) ) ); setFixedSize( m_toggle->width(), m_toggle->height() ); @@ -97,8 +94,8 @@ ladspaControl::ladspaControl( QWidget * _parent, } break; case INTEGER: - m_knob = new knob( knobBright_26, this, - m_port->name, eng(), m_track); + m_knob = new knob( knobBright_26, this, m_port->name, + m_track ); connect( m_knob, SIGNAL( valueChanged( float ) ), this, SLOT( knobChange( float ) ) ); m_knob->setLabel( m_port->name ); @@ -125,8 +122,8 @@ ladspaControl::ladspaControl( QWidget * _parent, } break; case FLOAT: - m_knob = new knob( knobBright_26, this, - m_port->name, eng(), m_track); + m_knob = new knob( knobBright_26, this, m_port->name, + m_track ); connect( m_knob, SIGNAL( valueChanged( float ) ), this, SLOT( knobChange( float ) ) ); m_knob->setLabel( m_port->name ); @@ -153,8 +150,8 @@ ladspaControl::ladspaControl( QWidget * _parent, } break; case TIME: - m_knob = new tempoSyncKnob( knobBright_26, this, - m_port->name, eng(), m_track); + m_knob = new tempoSyncKnob( knobBright_26, this, + m_port->name, m_track ); connect( m_knob, SIGNAL( valueChanged( float ) ), this, SLOT( knobChange( float ) ) ); m_knob->setLabel( m_port->name ); diff --git a/plugins/ladspa_base/ladspa_control.h b/plugins/ladspa_base/ladspa_control.h index 7af464239..eae86d2ea 100644 --- a/plugins/ladspa_base/ladspa_control.h +++ b/plugins/ladspa_base/ladspa_control.h @@ -1,7 +1,7 @@ /* * ladspa_control.h - widget for controlling a LADSPA port * - * Copyright (c) 2006 Danny McRae + * Copyright (c) 2006-2007 Danny McRae * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -56,9 +56,8 @@ class ladspaControl : public QWidget, public journallingObject { Q_OBJECT public: - ladspaControl( QWidget * _parent, port_desc_t * _port, - engine * _engine, track * _track, - bool _link = FALSE ); + ladspaControl( QWidget * _parent, port_desc_t * _port, track * _track, + bool _link = FALSE ); ~ladspaControl(); LADSPA_Data getValue( void ); diff --git a/plugins/ladspa_base/ladspa_manager.cpp b/plugins/ladspa_base/ladspa_manager.cpp index 40384a523..75c986289 100644 --- a/plugins/ladspa_base/ladspa_manager.cpp +++ b/plugins/ladspa_base/ladspa_manager.cpp @@ -2,7 +2,7 @@ * ladspa_manager.cpp - a class to manage loading and instantiation * of ladspa plugins * - * Copyright (c) 2005 Danny McRae + * Copyright (c) 2005-2007 Danny McRae * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -50,7 +50,7 @@ -ladspaManager::ladspaManager( engine * _engine ) +ladspaManager::ladspaManager( void ) { #ifdef QT4 QStringList ladspaDirectories = QString( getenv( "LADSPA_PATH" ) ). diff --git a/plugins/ladspa_base/ladspa_manager.h b/plugins/ladspa_base/ladspa_manager.h index 08d7e7885..654f2bace 100644 --- a/plugins/ladspa_base/ladspa_manager.h +++ b/plugins/ladspa_base/ladspa_manager.h @@ -3,7 +3,7 @@ * a class to manage loading and instantiation * of ladspa plugins * - * Copyright (c) 2005 Danny McRae + * Copyright (c) 2005-2007 Danny McRae * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -61,7 +61,6 @@ #include "types.h" //#include "qt3support.h" -class engine; const float NOHINT = -99342.2243f; @@ -107,7 +106,7 @@ class ladspaManager { public: - ladspaManager( engine * _engine ); + ladspaManager( void ); ~ladspaManager(); l_sortable_plugin_t getSortedPlugins(); diff --git a/plugins/ladspa_base/ladspa_port_dialog.cpp b/plugins/ladspa_base/ladspa_port_dialog.cpp index ce3266a1c..f170c1dc6 100644 --- a/plugins/ladspa_base/ladspa_port_dialog.cpp +++ b/plugins/ladspa_base/ladspa_port_dialog.cpp @@ -1,7 +1,7 @@ /* * ladspa_port_dialog.cpp - dialog to test a LADSPA plugin * - * Copyright (c) 2006 Danny McRae + * Copyright (c) 2006-2007 Danny McRae * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -41,15 +41,13 @@ #include "ladspa_port_dialog.h" #include "embed.h" +#include "engine.h" #include "mixer.h" -ladspaPortDialog::ladspaPortDialog( const ladspa_key_t & _key, - engine * _engine ) : - QDialog(), - engineObject( _engine ), +ladspaPortDialog::ladspaPortDialog( const ladspa_key_t & _key ) : m_key( _key ), - m_ladspa( _engine->getLADSPAManager() ) + m_ladspa( engine::getLADSPAManager() ) { setWindowIcon( embed::getIconPixmap( "ports" ) ); setWindowTitle( "Ports" ); @@ -158,11 +156,11 @@ ladspaPortDialog::ladspaPortDialog( const ladspa_key_t & _key, { if( min != NOHINT ) { - min *= eng()->getMixer()->sampleRate(); + min *= engine::getMixer()->sampleRate(); } if( max != NOHINT ) { - max *= eng()->getMixer()->sampleRate(); + max *= engine::getMixer()->sampleRate(); } } diff --git a/plugins/ladspa_base/ladspa_port_dialog.h b/plugins/ladspa_base/ladspa_port_dialog.h index cf00cf903..22c2f02ee 100644 --- a/plugins/ladspa_base/ladspa_port_dialog.h +++ b/plugins/ladspa_base/ladspa_port_dialog.h @@ -1,7 +1,7 @@ /* * ladspa_port_dialog.h - dialog to test a LADSPA plugin * - * Copyright (c) 2006 Danny McRae + * Copyright (c) 2006-2007 Danny McRae * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -42,12 +42,11 @@ #include "ladspa_2_lmms.h" -class ladspaPortDialog : public QDialog, public engineObject +class ladspaPortDialog : public QDialog { Q_OBJECT public: - ladspaPortDialog( const ladspa_key_t & _key, - engine * _engine ); + ladspaPortDialog( const ladspa_key_t & _key ); virtual ~ladspaPortDialog(); private: diff --git a/plugins/ladspa_effect/ladspa_control_dialog.cpp b/plugins/ladspa_effect/ladspa_control_dialog.cpp index 19f3b718e..ef1c5ecea 100644 --- a/plugins/ladspa_effect/ladspa_control_dialog.cpp +++ b/plugins/ladspa_effect/ladspa_control_dialog.cpp @@ -2,7 +2,7 @@ * ladspa_control_dialog.cpp - dialog for displaying and editing control port * values for LADSPA plugins * - * Copyright (c) 2006 Danny McRae + * Copyright (c) 2006-2007 Danny McRae * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -110,9 +110,8 @@ ladspaControlDialog::ladspaControlDialog( QWidget * _parent, last_port == TOGGLED ) ) { (*it)->control = - new ladspaControl( - grouper, (*it), - eng(), m_track, + new ladspaControl( grouper, *it, + m_track, linked_control ); } else @@ -123,9 +122,8 @@ ladspaControlDialog::ladspaControlDialog( QWidget * _parent, new QWidget( grouper ) ); row_cnt++; } - (*it)->control = new ladspaControl( + (*it)->control = new ladspaControl( grouper, (*it), - eng(), m_track, linked_control ); row_cnt = 0; @@ -163,8 +161,8 @@ ladspaControlDialog::ladspaControlDialog( QWidget * _parent, QHBoxLayout * center = new QHBoxLayout(); m_mainLay->addLayout( center ); #endif - m_stereoLink = new ledCheckBox( tr( "Link Channels" ), - this, "", eng(), m_track ); + m_stereoLink = new ledCheckBox( tr( "Link Channels" ), this, "", + m_track ); connect( m_stereoLink, SIGNAL( toggled( bool ) ), this, SLOT( link( bool ) ) ); m_stereoLink->setChecked( TRUE ); diff --git a/plugins/ladspa_effect/ladspa_effect.cpp b/plugins/ladspa_effect/ladspa_effect.cpp index 4eeefb650..45f8d9163 100644 --- a/plugins/ladspa_effect/ladspa_effect.cpp +++ b/plugins/ladspa_effect/ladspa_effect.cpp @@ -70,13 +70,13 @@ plugin::descriptor ladspaeffect_plugin_descriptor = } -ladspaEffect::ladspaEffect( effect::constructionData * _cdata ) : - effect( &ladspaeffect_plugin_descriptor, _cdata ), +ladspaEffect::ladspaEffect( const descriptor::subPluginFeatures::key * _key ) : + effect( &ladspaeffect_plugin_descriptor, _key ), m_effName( "none" ), - m_key( subPluginKeyToLadspaKey( _cdata->key ) + m_key( subPluginKeyToLadspaKey( _key ) /* ladspa_key_t( _cdata->settings.attribute( "label" ), _cdata->settings.attribute( "lib" ) )*/ ), - m_ladspa( eng()->getLADSPAManager() ) + m_ladspa( engine::getLADSPAManager() ) { if( m_ladspa->getDescription( m_key ) == NULL ) { @@ -90,7 +90,7 @@ ladspaEffect::ladspaEffect( effect::constructionData * _cdata ) : setPublicName( m_ladspa->getShortName( m_key ) ); // Calculate how many processing units are needed. - const ch_cnt_t lmms_chnls = eng()->getMixer()->audioDev()->channels(); + const ch_cnt_t lmms_chnls = engine::getMixer()->audioDev()->channels(); m_effectChannels = m_ladspa->getDescription( m_key )->inputChannels; setProcessorCount( lmms_chnls / m_effectChannels ); @@ -117,7 +117,7 @@ ladspaEffect::ladspaEffect( effect::constructionData * _cdata ) : // during cleanup. It was easier to troubleshoot with the // memory management all taking place in one file. p->buffer = - new LADSPA_Data[eng()->getMixer()->framesPerAudioBuffer()]; + new LADSPA_Data[engine::getMixer()->framesPerAudioBuffer()]; if( p->name.toUpper().contains( "IN" ) && m_ladspa->isPortInput( m_key, port ) ) @@ -198,7 +198,7 @@ ladspaEffect::ladspaEffect( effect::constructionData * _cdata ) : if( m_ladspa->areHintsSampleRateDependent( m_key, port ) ) { - p->max *= eng()->getMixer()->sampleRate(); + p->max *= engine::getMixer()->sampleRate(); } p->min = m_ladspa->getLowerBound( m_key, port ); @@ -210,7 +210,7 @@ ladspaEffect::ladspaEffect( effect::constructionData * _cdata ) : if( m_ladspa->areHintsSampleRateDependent( m_key, port ) ) { - p->min *= eng()->getMixer()->sampleRate(); + p->min *= engine::getMixer()->sampleRate(); } p->def = m_ladspa->getDefaultSetting( m_key, port ); @@ -267,7 +267,7 @@ ladspaEffect::ladspaEffect( effect::constructionData * _cdata ) : for( ch_cnt_t proc = 0; proc < getProcessorCount(); proc++ ) { LADSPA_Handle effect = m_ladspa->instantiate( m_key, - eng()->getMixer()->sampleRate() ); + engine::getMixer()->sampleRate() ); if( effect == NULL ) { QMessageBox::warning( 0, "Effect", @@ -492,7 +492,8 @@ extern "C" plugin * lmms_plugin_main( void * _data ) { return( new ladspaEffect( - static_cast( _data ) ) ); + static_cast( + _data ) ) ); } } diff --git a/plugins/ladspa_effect/ladspa_effect.h b/plugins/ladspa_effect/ladspa_effect.h index c1f5d8740..db57904fa 100644 --- a/plugins/ladspa_effect/ladspa_effect.h +++ b/plugins/ladspa_effect/ladspa_effect.h @@ -1,7 +1,7 @@ /* * ladspa_effect.h - class for handling LADSPA effect plugins * - * Copyright (c) 2006 Danny McRae + * Copyright (c) 2006-2007 Danny McRae * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -45,7 +45,7 @@ typedef vvector multi_proc_t; class ladspaEffect : public effect { public: - ladspaEffect( effect::constructionData * _cdata ); + ladspaEffect( const descriptor::subPluginFeatures::key * _key ); virtual ~ladspaEffect(); virtual bool FASTCALL processAudioBuffer( surroundSampleFrame * _buf, @@ -72,7 +72,7 @@ public: track * _track ) { return( new ladspaControlDialog( - eng()->getMainWindow()->workspace(), + engine::getMainWindow()->workspace(), this, _track ) ); } diff --git a/plugins/ladspa_effect/ladspa_subplugin_features.cpp b/plugins/ladspa_effect/ladspa_subplugin_features.cpp index d26fc6f2a..17727923e 100644 --- a/plugins/ladspa_effect/ladspa_subplugin_features.cpp +++ b/plugins/ladspa_effect/ladspa_subplugin_features.cpp @@ -45,6 +45,7 @@ #include "ladspa_2_lmms.h" #include "mixer.h" #include "audio_device.h" +#include "engine.h" ladspaSubPluginFeatures::ladspaSubPluginFeatures( plugin::pluginTypes _type ) : @@ -55,11 +56,11 @@ ladspaSubPluginFeatures::ladspaSubPluginFeatures( plugin::pluginTypes _type ) : -void ladspaSubPluginFeatures::fillDescriptionWidget( - QWidget * _parent, engine * _eng, const key & _key ) +void ladspaSubPluginFeatures::fillDescriptionWidget( QWidget * _parent, + const key * _key ) { const ladspa_key_t & lkey = subPluginKeyToLadspaKey( _key ); - ladspa2LMMS * lm = _eng->getLADSPAManager(); + ladspa2LMMS * lm = engine::getLADSPAManager(); QLabel * label = new QLabel( _parent ); label->setText( QWidget::tr( "Name: " ) + lm->getName( lkey ) ); @@ -113,10 +114,10 @@ void ladspaSubPluginFeatures::fillDescriptionWidget( -void ladspaSubPluginFeatures::listSubPluginKeys( engine * _eng, - plugin::descriptor * _desc, keyList & _kl ) +void ladspaSubPluginFeatures::listSubPluginKeys( plugin::descriptor * _desc, + keyList & _kl ) { - ladspa2LMMS * lm = _eng->getLADSPAManager(); + ladspa2LMMS * lm = engine::getLADSPAManager(); l_sortable_plugin_t plugins; switch( m_type ) @@ -142,7 +143,7 @@ void ladspaSubPluginFeatures::listSubPluginKeys( engine * _eng, it != plugins.end(); ++it ) { if( lm->getDescription( ( *it ).second )->inputChannels <= - _eng->getMixer()->audioDev()->channels() ) + engine::getMixer()->audioDev()->channels() ) { _kl.push_back( ladspaKeyToSubPluginKey( _desc, diff --git a/plugins/ladspa_effect/ladspa_subplugin_features.h b/plugins/ladspa_effect/ladspa_subplugin_features.h index d675b915b..1e00c48a8 100644 --- a/plugins/ladspa_effect/ladspa_subplugin_features.h +++ b/plugins/ladspa_effect/ladspa_subplugin_features.h @@ -39,11 +39,10 @@ public: ladspaSubPluginFeatures( plugin::pluginTypes _type ); virtual void fillDescriptionWidget( QWidget * _parent, - engine * _eng, - const key & _key ); + const key * _key ); - virtual void listSubPluginKeys( engine * _eng, - plugin::descriptor * _desc, keyList & _kl ); + virtual void listSubPluginKeys( plugin::descriptor * _desc, + keyList & _kl ); } ; diff --git a/plugins/lb302/lb302.cpp b/plugins/lb302/lb302.cpp index 95025d5f5..918ea8be4 100644 --- a/plugins/lb302/lb302.cpp +++ b/plugins/lb302/lb302.cpp @@ -258,7 +258,7 @@ lb302Synth::lb302Synth( instrumentTrack * _channel_track ) : // GUI vcf_cut_knob = new knob( knobBright_26, this, tr( "VCF Cutoff Frequency" ), - eng(), _channel_track ); + _channel_track ); vcf_cut_knob->setRange( 0.0f, 1.5f, 0.005f ); // Originally [0,1.0] vcf_cut_knob->setInitValue( 0.75f ); vcf_cut_knob->move( 75, 130 ); @@ -266,7 +266,7 @@ lb302Synth::lb302Synth( instrumentTrack * _channel_track ) : vcf_cut_knob->setLabel( tr("CUT") ); vcf_res_knob = new knob( knobBright_26, this, tr( "VCF Resonance" ), - eng(), _channel_track ); + _channel_track ); vcf_res_knob->setRange( 0.0f, 1.25f, 0.005f ); // Originally [0,1.0] vcf_res_knob->setInitValue( 0.75f ); vcf_res_knob->move( 120, 130 ); @@ -274,7 +274,7 @@ lb302Synth::lb302Synth( instrumentTrack * _channel_track ) : vcf_res_knob->setLabel( tr("RES") ); vcf_mod_knob = new knob( knobBright_26, this, tr( "VCF Envelope Mod" ), - eng(), _channel_track ); + _channel_track ); vcf_mod_knob->setRange( 0.0f, 1.0f, 0.005f ); // Originally [0,1.0] vcf_mod_knob->setInitValue( 1.0f ); vcf_mod_knob->move( 165, 130 ); @@ -282,7 +282,7 @@ lb302Synth::lb302Synth( instrumentTrack * _channel_track ) : vcf_mod_knob->setLabel( tr("ENV MOD") ); vcf_dec_knob = new knob( knobBright_26, this, tr( "VCF Envelope Decay" ), - eng(), _channel_track ); + _channel_track ); vcf_dec_knob->setRange( 0.0f, 1.0f, 0.005f ); // Originally [0,1.0] vcf_dec_knob->setInitValue( 0.1f ); vcf_dec_knob->move( 210, 130 ); @@ -291,30 +291,30 @@ lb302Synth::lb302Synth( instrumentTrack * _channel_track ) : slideToggle = new ledCheckBox( "Slide", this, tr( "Slide" ), - eng(), _channel_track ); + _channel_track ); slideToggle->move( 10, 180 ); accentToggle = new ledCheckBox( "Accent", this, tr( "Accent" ), - eng(), _channel_track ); + _channel_track ); accentToggle->move( 10, 200 ); accentToggle->setDisabled(true); deadToggle = new ledCheckBox( "Dead", this, tr( "Dead" ), - eng(), _channel_track ); + _channel_track ); deadToggle->move( 10, 220 ); db24Toggle = new ledCheckBox( "24dB/oct", this, tr( "303-es-que, 24dB/octave, 3 pole filter" ), - eng(), _channel_track ); + _channel_track ); db24Toggle->move( 10, 150); slide_dec_knob = new knob( knobBright_26, this, tr( "Slide Decay" ), - eng(), _channel_track ); + _channel_track ); slide_dec_knob->setRange( 0.0f, 1.0f, 0.005f ); // Originally [0,1.0] slide_dec_knob->setInitValue( 0.6f ); slide_dec_knob->move( 210, 75 ); @@ -323,7 +323,7 @@ lb302Synth::lb302Synth( instrumentTrack * _channel_track ) : vco_fine_detune_knob = new knob( knobBright_26, this, tr("Fine detuning of the VCO. Ranged between -100 and 100 centes."), - eng(), _channel_track ); + _channel_track ); vco_fine_detune_knob->setRange(-100.0f, 100.0f, 1.0f); vco_fine_detune_knob->setInitValue(0.0f); vco_fine_detune_knob->move(165,75); @@ -332,7 +332,7 @@ lb302Synth::lb302Synth( instrumentTrack * _channel_track ) : dist_knob = new knob( knobBright_26, this, tr( "Distortion" ), - eng(), _channel_track ); + _channel_track ); dist_knob->setRange( 0.0f, 1.0f, 0.01f ); // Originally [0,1.0] dist_knob->setInitValue( 0.0f ); dist_knob->move( 210, 190 ); @@ -341,7 +341,7 @@ lb302Synth::lb302Synth( instrumentTrack * _channel_track ) : wave_knob = new knob( knobBright_26, this, tr( "Waveform" ), - eng(), _channel_track ); + _channel_track ); wave_knob->setRange( 0.0f, 5.0f, 1.0f ); // Originally [0,1.0] wave_knob->setInitValue( 0.0f ); wave_knob->move( 120, 75 ); @@ -730,7 +730,7 @@ void lb302Synth::playNote( notePlayHandle * _n, bool ) } } - const Uint32 frames = eng()->getMixer()->framesPerAudioBuffer(); + const Uint32 frames = engine::getMixer()->framesPerAudioBuffer(); sampleFrame *buf = bufferAllocator::alloc( frames ); if (buf) { diff --git a/plugins/live_tool/live_tool.cpp b/plugins/live_tool/live_tool.cpp index dbb331966..48233ff06 100644 --- a/plugins/live_tool/live_tool.cpp +++ b/plugins/live_tool/live_tool.cpp @@ -32,6 +32,7 @@ #include "live_tool.h" #include "bb_editor.h" +#include "engine.h" #include "song_editor.h" #ifdef Q_WS_X11 @@ -113,19 +114,19 @@ void liveTool::keyPressEvent( QKeyEvent * _ke ) switch( _ke->key() ) { case Qt::Key_Space: - if( eng()->getSongEditor()->playing() ) + if( engine::getSongEditor()->playing() ) { - eng()->getSongEditor()->pause(); + engine::getSongEditor()->pause(); } - else if( eng()->getSongEditor()->paused() && - eng()->getSongEditor()->playMode() == + else if( engine::getSongEditor()->paused() && + engine::getSongEditor()->playMode() == songEditor::PLAY_SONG ) { - eng()->getSongEditor()->resumeFromPause(); + engine::getSongEditor()->resumeFromPause(); } else { - eng()->getSongEditor()->play(); + engine::getSongEditor()->play(); } break; @@ -161,7 +162,7 @@ bool liveTool::x11Event( XEvent * _xe ) void liveTool::toggleInstrument( int _n ) { bool track_exists; - track * t = eng()->getBBEditor()->tracks().at( _n, &track_exists ); + track * t = engine::getBBEditor()->tracks().at( _n, &track_exists ); if( track_exists ) { t->setMuted( !t->muted() ); diff --git a/plugins/midi_import/midi_import.cpp b/plugins/midi_import/midi_import.cpp index 47c9b6fa4..1b945472f 100644 --- a/plugins/midi_import/midi_import.cpp +++ b/plugins/midi_import/midi_import.cpp @@ -1,7 +1,7 @@ /* * midi_import.cpp - support for importing MIDI-files * - * Copyright (c) 2005-2006 Tobias Doerffel + * Copyright (c) 2005-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -71,7 +71,7 @@ plugin::descriptor midiimport_plugin_descriptor = midiImport::midiImport( const QString & _file ) : - importFilter( _file, &midiimport_plugin_descriptor, NULL ) + importFilter( _file, &midiimport_plugin_descriptor ) { } @@ -269,8 +269,7 @@ invalid_format: NOTES_PER_OCTAVE * OCTAVES && keys[ev.key()][0] >= 0 ) { - note n( eng(), - midiTime( ( tick - keys[ev.key()][0] ) / 10 ), + note n( midiTime( ( tick - keys[ev.key()][0] ) / 10 ), midiTime( keys[ev.key()][0] / 10 ), (tones)( ev.key() % NOTES_PER_OCTAVE ), (octaves)( ev.key() / NOTES_PER_OCTAVE ), diff --git a/plugins/organic/organic.cpp b/plugins/organic/organic.cpp index a81ada5ae..d2623d58b 100644 --- a/plugins/organic/organic.cpp +++ b/plugins/organic/organic.cpp @@ -122,7 +122,7 @@ organicInstrument::organicInstrument( instrumentTrack * _channel_track ) : // setup volume-knob m_osc[i].oscKnob = new knob( knobGreen_17, this, tr( - "Osc %1 waveform" ).arg( i+1 ), eng(), + "Osc %1 waveform" ).arg( i+1 ), _channel_track ); m_osc[i].oscKnob->move( 25+i*20, 90 ); m_osc[i].oscKnob->setRange( 0.0f, 5.0f, 0.25f ); @@ -136,7 +136,7 @@ organicInstrument::organicInstrument( instrumentTrack * _channel_track ) : // setup volume-knob m_osc[i].volKnob = new volumeKnob( knobGreen_17, this, tr( - "Osc %1 volume" ).arg( i+1 ), eng(), + "Osc %1 volume" ).arg( i+1 ), _channel_track ); m_osc[i].volKnob->setData( i ); m_osc[i].volKnob->move( 25+i*20, 110 ); @@ -147,7 +147,7 @@ organicInstrument::organicInstrument( instrumentTrack * _channel_track ) : // setup panning-knob m_osc[i].panKnob = new knob( knobGreen_17, this, - tr( "Osc %1 panning" ).arg( i + 1 ), eng(), + tr( "Osc %1 panning" ).arg( i + 1 ), _channel_track ); m_osc[i].panKnob->setData( i ); m_osc[i].panKnob->move( 25+i*20, 130 ); @@ -159,7 +159,7 @@ organicInstrument::organicInstrument( instrumentTrack * _channel_track ) : // setup knob for left fine-detuning m_osc[i].detuneKnob = new knob( knobGreen_17, this, tr( "Osc %1 fine detuning left" ).arg( i+1 ), - eng(), _channel_track ); + _channel_track ); m_osc[i].detuneKnob->setData( i ); m_osc[i].detuneKnob->move( 25+i*20, 150 ); m_osc[i].detuneKnob->setRange( -100.0f, 100.0f, 1.0f ); @@ -184,19 +184,19 @@ organicInstrument::organicInstrument( instrumentTrack * _channel_track ) : } - connect( eng()->getMixer(), SIGNAL( sampleRateChanged() ), + connect( engine::getMixer(), SIGNAL( sampleRateChanged() ), this, SLOT( updateAllDetuning() ) ); // setup knob for FX1 - fx1Knob = new knob( knobGreen_17, this, - tr( "FX1" ), eng(), _channel_track ); + fx1Knob = new knob( knobGreen_17, this, tr( "FX1" ), + _channel_track ); fx1Knob->move( 20, 200 ); fx1Knob->setRange( 0.0f, 0.99f, 0.01f ); fx1Knob->setInitValue( 0.0f); // setup volume-knob volKnob = new knob( knobGreen_17, this, tr( - "Osc %1 volume" ).arg( 1 ), eng(), + "Osc %1 volume" ).arg( 1 ), _channel_track ); volKnob->move( 50, 200 ); volKnob->setRange( 0, 200, 1.0f ); @@ -205,7 +205,7 @@ organicInstrument::organicInstrument( instrumentTrack * _channel_track ) : 1 ) + " ", "%" ); // randomise - m_randBtn = new pixmapButton( this, tr( "Randomise" ), eng(), + m_randBtn = new pixmapButton( this, tr( "Randomise" ), _channel_track ); m_randBtn->move( 100, 200 ); m_randBtn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( @@ -370,7 +370,7 @@ void organicInstrument::playNote( notePlayHandle * _n, bool ) oscillator * osc_r = static_cast( _n->m_pluginData )->oscRight; - const fpab_t frames = eng()->getMixer()->framesPerAudioBuffer(); + const fpab_t frames = engine::getMixer()->framesPerAudioBuffer(); sampleFrame * buf = bufferAllocator::alloc( frames ); osc_l->update( buf, frames, 0 ); @@ -511,10 +511,10 @@ void organicInstrument::updateDetuning( const QVariant & _data ) const int _i = _data.toInt(); m_osc[_i].detuningLeft = powf( 2.0f, m_osc[_i].harmonic + (float)m_osc[_i].detuneKnob->value() / 100.0f ) - / static_cast( eng()->getMixer()->sampleRate() ); + / engine::getMixer()->sampleRate(); m_osc[_i].detuningRight = powf( 2.0f, m_osc[_i].harmonic - (float)m_osc[_i].detuneKnob->value() / 100.0f ) - / static_cast( eng()->getMixer()->sampleRate() ); + / engine::getMixer()->sampleRate(); } diff --git a/plugins/patman/patman.cpp b/plugins/patman/patman.cpp index 9d886a125..055044ca7 100644 --- a/plugins/patman/patman.cpp +++ b/plugins/patman/patman.cpp @@ -85,7 +85,7 @@ patmanSynth::patmanSynth( instrumentTrack * _track ) : { setPaletteBackgroundPixmap( PLUGIN_NAME::getIconPixmap( "artwork" ) ); - m_openFileButton = new pixmapButton( this, NULL, eng(), NULL ); + m_openFileButton = new pixmapButton( this, NULL, NULL ); m_openFileButton->setCursor( QCursor( Qt::PointingHandCursor ) ); m_openFileButton->move( 200, 90 ); m_openFileButton->setActiveGraphic( embed::getIconPixmap( @@ -106,7 +106,7 @@ patmanSynth::patmanSynth( instrumentTrack * _track ) : tr( "Click here to open another patch-file. Loop and Tune " "settings are not reset." ) ); - m_loopButton = new pixmapButton( this, NULL, eng(), NULL ); + m_loopButton = new pixmapButton( this, tr( "Loop" ), _track ); m_loopButton->setCheckable( TRUE ); m_loopButton->move( 160, 160 ); m_loopButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap( @@ -124,7 +124,7 @@ patmanSynth::patmanSynth( instrumentTrack * _track ) : "will use the loop information available in the " "file." ) ); - m_tuneButton = new pixmapButton( this, NULL, eng(), NULL ); + m_tuneButton = new pixmapButton( this, tr( "Tune" ), _track ); m_tuneButton->setCheckable( TRUE ); m_tuneButton->setValue( TRUE ); m_tuneButton->move( 180, 160 ); @@ -200,12 +200,10 @@ QString patmanSynth::nodeName( void ) const void patmanSynth::playNote( notePlayHandle * _n, bool ) { - const Uint32 frames = eng()->getMixer()->framesPerAudioBuffer(); + const Uint32 frames = engine::getMixer()->framesPerAudioBuffer(); sampleFrame * buf = bufferAllocator::alloc( frames ); - float freq = getInstrumentTrack()->frequency( _n ) / - ( eng()->getMixer()->sampleRate() / - DEFAULT_SAMPLE_RATE ); + float freq = getInstrumentTrack()->frequency( _n ); if( !_n->m_pluginData ) { @@ -240,9 +238,10 @@ void patmanSynth::deleteNotePluginData( notePlayHandle * _n ) void patmanSynth::dragEnterEvent( QDragEnterEvent * _dee ) { #ifdef QT4 - if( _dee->mimeData()->hasFormat( "lmms/stringpair" ) ) + if( _dee->mimeData()->hasFormat( stringPairDrag::mimeType() ) ) { - QString txt = _dee->mimeData()->data( "lmms/stringpair" ); + QString txt = _dee->mimeData()->data( + stringPairDrag::mimeType() ); if( txt.section( ':', 0, 0 ) == "samplefile" ) { _dee->acceptProposedAction(); @@ -257,7 +256,7 @@ void patmanSynth::dragEnterEvent( QDragEnterEvent * _dee ) _dee->ignore(); } #else - QString txt = _dee->encodedData( "lmms/stringpair" ); + QString txt = _dee->encodedData( stringPairDrag::mimeType() ); if( txt != "" ) { if( txt.section( ':', 0, 0 ) == "samplefile" @@ -386,7 +385,7 @@ void patmanSynth::openFile( void ) if( f != "" ) { setFile( f ); - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); } } } @@ -589,19 +588,14 @@ patmanSynth::load_error patmanSynth::load_patch( const QString & _filename ) } } - sampleBuffer * psample = new sampleBuffer( data, frames, - eng() ); + sampleBuffer * psample = new sampleBuffer( data, frames ); psample->setFrequency( root_freq / 1000.0f ); - psample->normalize_sample_rate( sample_rate ); + psample->setSampleRate( sample_rate ); if( modes & MODES_LOOPING ) { - psample->setLoopStartFrame( loop_start - * SAMPLE_RATES[DEFAULT_QUALITY_LEVEL] - / sample_rate ); - psample->setLoopEndFrame( loop_end - * SAMPLE_RATES[DEFAULT_QUALITY_LEVEL] - / sample_rate ); + psample->setLoopStartFrame( loop_start ); + psample->setLoopEndFrame( loop_end ); } m_patch_samples.push_back( psample ); @@ -630,9 +624,7 @@ void patmanSynth::unload_current_patch( void ) void patmanSynth::select_sample( notePlayHandle * _n ) { - float freq = getInstrumentTrack()->frequency( _n ) / - ( eng()->getMixer()->sampleRate() / - DEFAULT_SAMPLE_RATE ); + float freq = getInstrumentTrack()->frequency( _n ); float min_dist = HUGE_VALF; sampleBuffer * sample = NULL; @@ -659,7 +651,7 @@ void patmanSynth::select_sample( notePlayHandle * _n ) } else { - hdata->sample = new sampleBuffer( NULL, 0, eng() ); + hdata->sample = new sampleBuffer( NULL, 0 ); } hdata->state = new sampleBuffer::handleState( _n->hasDetuningInfo() ); diff --git a/plugins/plucked_string_synth/plucked_string_synth.cpp b/plugins/plucked_string_synth/plucked_string_synth.cpp index 1791bba5d..1f8ff7e42 100644 --- a/plugins/plucked_string_synth/plucked_string_synth.cpp +++ b/plugins/plucked_string_synth/plucked_string_synth.cpp @@ -1,7 +1,7 @@ /* * plucked_string_synth.cpp - instrument which uses the Karplus-Strong-algorithm * - * Copyright (c) 2004-2006 Tobias Doerffel + * Copyright (c) 2004-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -73,14 +73,14 @@ pluckedStringSynth::pluckedStringSynth( instrumentTrack * _instrument_track ) : instrument( _instrument_track, &pluckedstringsynth_plugin_descriptor ) { m_pickKnob = new knob( knobDark_28, this, tr( "Pick position" ), - eng(), _instrument_track ); + _instrument_track ); m_pickKnob->setRange( 0.0f, 0.5f, 0.005f ); m_pickKnob->setInitValue( 0.0f ); m_pickKnob->move( 86, 134 ); m_pickKnob->setHintText( tr( "Pick position:" ) + " ", "" ); m_pickupKnob = new knob( knobDark_28, this, tr( "Pickup position" ), - eng(), _instrument_track ); + _instrument_track ); m_pickupKnob->setRange( 0.0f, 0.5f, 0.005f ); m_pickupKnob->setInitValue( 0.05f ); m_pickupKnob->move( 138, 134 ); @@ -140,10 +140,10 @@ void pluckedStringSynth::playNote( notePlayHandle * _n, bool ) float freq = getInstrumentTrack()->frequency( _n ); _n->m_pluginData = new pluckSynth( freq, m_pickKnob->value(), m_pickupKnob->value(), - eng()->getMixer()->sampleRate() ); + engine::getMixer()->sampleRate() ); } - const Uint32 frames = eng()->getMixer()->framesPerAudioBuffer(); + const Uint32 frames = engine::getMixer()->framesPerAudioBuffer(); sampleFrame * buf = bufferAllocator::alloc( frames ); pluckSynth * ps = static_cast( _n->m_pluginData ); diff --git a/plugins/polyb302/polyb302.cpp b/plugins/polyb302/polyb302.cpp index 4a6c29512..64a5c5008 100644 --- a/plugins/polyb302/polyb302.cpp +++ b/plugins/polyb302/polyb302.cpp @@ -88,8 +88,7 @@ plugin * lmms_plugin_main( void * _data ) // lb302Filter // -lb302Filter::lb302Filter( lb302FilterState * _p_fs, engine * _engine ) : - engineObject( _engine ), +lb302Filter::lb302Filter( lb302FilterState * _p_fs ) : m_fs( _p_fs ), m_vcf_c0( 0 ), m_vcf_e0( 0 ), @@ -106,8 +105,8 @@ void lb302Filter::recalc( void ) + 1.2 * m_fs->reso ); m_vcf_e0 = exp( 4.8434 - 0.8 * m_fs->envmod + 2.1553 * m_fs->cutoff + 0.7696 * m_fs->reso ); - m_vcf_e0 *= M_PI / eng()->getMixer()->sampleRate(); - m_vcf_e1 *= M_PI / eng()->getMixer()->sampleRate(); + m_vcf_e0 *= M_PI / engine::getMixer()->sampleRate(); + m_vcf_e1 *= M_PI / engine::getMixer()->sampleRate(); m_vcf_e1 -= m_vcf_e0; } @@ -135,8 +134,8 @@ void lb302Filter::playNote( void ) // lb302FilterIIR2 // -lb302FilterIIR2::lb302FilterIIR2( lb302FilterState * _p_fs, engine * _engine ) : - lb302Filter( _p_fs, _engine ), +lb302FilterIIR2::lb302FilterIIR2( lb302FilterState * _p_fs ) : + lb302Filter( _p_fs ), m_vcf_d1( 0 ), m_vcf_d2( 0 ), m_vcf_a( 0 ), @@ -204,9 +203,8 @@ float lb302FilterIIR2::process( const float & _samp ) // lb302Filter3Pole // -lb302Filter3Pole::lb302Filter3Pole( lb302FilterState * _p_fs, - engine * _engine ) : - lb302Filter( _p_fs, _engine ), +lb302Filter3Pole::lb302Filter3Pole( lb302FilterState * _p_fs ) : + lb302Filter( _p_fs ), m_ay1( 0 ), m_ay2( 0 ), m_aout( 0 ), @@ -239,14 +237,14 @@ void lb302Filter3Pole::envRecalc( void ) //TODO: Fix high quality float kfco = 50.0f + k * ( 2300.0f - 1600.0f * m_fs->envmod + w * ( 700.0f + 1500.0f * k + ( 1500.0f + k * ( - eng()->getMixer()->sampleRate() / 2.0f - 6000.0f ) ) + engine::getMixer()->sampleRate() / 2.0f - 6000.0f ) ) * m_fs->envmod ) ); //+iacc*(.3+.7*kfco*kenvmod)*kaccent*kaccurve*2000 #ifdef LB_24_IGNORE_ENVELOPE // m_kfcn = m_fs->cutoff; - m_kfcn = 2.0 * kfco / eng()->getMixer()->sampleRate(); + m_kfcn = 2.0 * kfco / engine::getMixer()->sampleRate(); #else m_kfcn = w; #endif @@ -295,7 +293,7 @@ polyb302Synth::polyb302Synth( instrumentTrack * _track ) : { m_vcf_cut_knob = new knob( knobBright_26, this, tr( "VCF Cutoff Frequency" ), - eng(), _track ); + _track ); m_vcf_cut_knob->setRange( 0.0f, 1.5f, 0.005f ); // Originally [0,1.0] m_vcf_cut_knob->setInitValue( 0.75f ); m_vcf_cut_knob->move( 75, 130 ); @@ -303,7 +301,7 @@ polyb302Synth::polyb302Synth( instrumentTrack * _track ) : m_vcf_cut_knob->setLabel( tr( "CUT" ) ); m_vcf_res_knob = new knob( knobBright_26, this, tr( "VCF Resonance" ), - eng(), _track ); + _track ); m_vcf_res_knob->setRange( 0.0f, 1.25f, 0.005f ); // Originally [0,1.0] m_vcf_res_knob->setInitValue( 0.75f ); m_vcf_res_knob->move( 120, 130 ); @@ -312,7 +310,7 @@ polyb302Synth::polyb302Synth( instrumentTrack * _track ) : m_vcf_mod_knob = new knob( knobBright_26, this, tr( "VCF Envelope Mod" ), - eng(), _track ); + _track ); m_vcf_mod_knob->setRange( 0.0f, 1.0f, 0.005f ); // Originally [0,1.0] m_vcf_mod_knob->setInitValue( 1.0f ); m_vcf_mod_knob->move( 165, 130 ); @@ -321,38 +319,37 @@ polyb302Synth::polyb302Synth( instrumentTrack * _track ) : m_vcf_dec_knob = new knob( knobBright_26, this, tr( "VCF Envelope Decay" ), - eng(), _track ); + _track ); m_vcf_dec_knob->setRange( 0.0f, 1.0f, 0.005f ); // Originally [0,1.0] m_vcf_dec_knob->setInitValue( 0.1f ); m_vcf_dec_knob->move( 210, 130 ); m_vcf_dec_knob->setHintText( tr( "Decay:" ) + " ", "" ); m_vcf_dec_knob->setLabel( tr( "DEC" ) ); - m_slideToggle = new ledCheckBox( "Slide", this, tr( "Slide" ), - eng(), _track ); + m_slideToggle = new ledCheckBox( "Slide", this, tr( "Slide" ), _track ); m_slideToggle->move( 10, 200 ); // m_accentToggle = new ledCheckBox( "Accent", this, // tr( "Accent" ), -// eng(), _track ); +// _track ); // m_accentToggle->move( 10, 200 ); // m_accentToggle->setDisabled(true); // m_deadToggle = new ledCheckBox( "Dead", this, // tr( "Dead" ), -// eng(), _track ); +// _track ); // m_deadToggle->move( 10, 220 ); m_db24Toggle = new ledCheckBox( "24dB/oct", this, tr( "303-es-que, 24dB/octave, 3 pole filter" ), - eng(), _track ); + _track ); m_db24Toggle->move( 10, 150 ); m_slide_dec_knob = new knob( knobBright_26, this, tr( "Slide Decay" ), - eng(), _track ); + _track ); m_slide_dec_knob->setRange( 0.0f, 1.0f, 0.005f ); // Originally [0,1.0] m_slide_dec_knob->setInitValue( 0.6f ); m_slide_dec_knob->move( 210, 75 ); @@ -361,7 +358,7 @@ polyb302Synth::polyb302Synth( instrumentTrack * _track ) : m_vco_fine_detune_knob = new knob( knobBright_26, this, tr( "VCO fine detuning" ), - eng(), _track ); + _track ); m_vco_fine_detune_knob->setRange( -100.0f, 100.0f, 1.0f ); m_vco_fine_detune_knob->setInitValue( 0.0f ); m_vco_fine_detune_knob->move( 165, 75 ); @@ -371,7 +368,7 @@ polyb302Synth::polyb302Synth( instrumentTrack * _track ) : m_dist_knob = new knob( knobBright_26, this, tr( "Distortion" ), - eng(), _track ); + _track ); m_dist_knob->setRange( 0.0f, 1.0f, 0.01f ); // Originally [0,1.0] m_dist_knob->setInitValue( 0.0f ); m_dist_knob->move( 210, 190 ); @@ -379,8 +376,7 @@ polyb302Synth::polyb302Synth( instrumentTrack * _track ) : m_dist_knob->setLabel( tr( "DIST" ) ); - m_wave_knob = new knob( knobBright_26, this, tr( "Waveform" ), - eng(), _track ); + m_wave_knob = new knob( knobBright_26, this, tr( "Waveform" ), _track ); m_wave_knob->setRange( 0.0f, 5.0f, 1.0f ); // Originally [0,1.0] m_wave_knob->setInitValue( 0.0f ); m_wave_knob->move( 120, 75 ); @@ -519,7 +515,7 @@ void polyb302Synth::playNote( notePlayHandle * _n, bool ) // Adjust inc on SampRate change or detuning change hstate->m_vco_inc = hstate->m_vco_detune - / eng()->getMixer()->sampleRate(); + / engine::getMixer()->sampleRate(); // Initiate Slide // TODO: Break out into function, @@ -561,7 +557,7 @@ void polyb302Synth::playNote( notePlayHandle * _n, bool ) } } - const Uint32 frames = eng()->getMixer()->framesPerAudioBuffer(); + const Uint32 frames = engine::getMixer()->framesPerAudioBuffer(); sampleFrame * buf = bufferAllocator::alloc( frames ); if( buf ) @@ -660,8 +656,7 @@ void polyb302Synth::waveChanged( float ) -polyb302Synth::handleState::handleState( polyb302Synth * _synth ) : - engineObject( _synth->eng() ) +polyb302Synth::handleState::handleState( polyb302Synth * _synth ) { m_vco_inc = 0.0; m_vco_c = 0; @@ -692,11 +687,11 @@ polyb302Synth::handleState::handleState( polyb302Synth * _synth ) : if( _synth->m_db24Toggle->isChecked() ) { - m_vcf = new lb302Filter3Pole( &m_fs, eng() ); + m_vcf = new lb302Filter3Pole( &m_fs ); } else { - m_vcf = new lb302FilterIIR2( &m_fs, eng() ); + m_vcf = new lb302FilterIIR2( &m_fs ); } recalcFilter(); @@ -724,11 +719,11 @@ void polyb302Synth::handleState::db24Toggled( void ) delete m_vcf; if( m_synth->m_db24Toggle->isChecked() ) { - m_vcf = new lb302Filter3Pole( &m_fs, eng() ); + m_vcf = new lb302Filter3Pole( &m_fs ); } else { - m_vcf = new lb302FilterIIR2( &m_fs, eng() ); + m_vcf = new lb302FilterIIR2( &m_fs ); } recalcFilter(); } @@ -741,7 +736,7 @@ void polyb302Synth::handleState::detuneChanged( void ) m_vco_detune = powf( 2.0f, (float)m_synth->m_vco_fine_detune_knob->value() / 1200.0f ); - m_vco_inc = m_vco_detune / eng()->getMixer()->sampleRate(); + m_vco_inc = m_vco_detune / engine::getMixer()->sampleRate(); // If a slide note is pending, if( m_vco_slideinc ) @@ -754,7 +749,7 @@ void polyb302Synth::handleState::detuneChanged( void ) if( m_vco_slide ) { m_vco_slidebase = m_vco_detune - / eng()->getMixer()->sampleRate(); + / engine::getMixer()->sampleRate(); } } @@ -771,7 +766,7 @@ void polyb302Synth::handleState::filterChanged( void ) m_fs.dist = LB_DIST_RATIO * m_synth->m_dist_knob->value(); float d = 0.2 + 2.3 * m_synth->m_vcf_dec_knob->value(); - d *= eng()->getMixer()->sampleRate(); + d *= engine::getMixer()->sampleRate(); // decay is 0.1 to the 1/d * ENVINC m_fs.envdecay = pow( 0.1, ENVINC / d ); // vcf_envdecay is now adjusted for both @@ -922,7 +917,7 @@ void polyb302Synth::handleState::process( sampleFrame * _outbuf, // Handle Envelope // TODO: Add decay once I figure out how to extend past the end // of a note. - if( m_sample_cnt >= 0.5 * eng()->getMixer()->sampleRate() ) + if( m_sample_cnt >= 0.5 * engine::getMixer()->sampleRate() ) { m_vca_mode = 2; } diff --git a/plugins/polyb302/polyb302.h b/plugins/polyb302/polyb302.h index 681d85eb9..2d2a2a947 100644 --- a/plugins/polyb302/polyb302.h +++ b/plugins/polyb302/polyb302.h @@ -53,10 +53,10 @@ typedef struct -class lb302Filter : public engineObject +class lb302Filter { public: - lb302Filter( lb302FilterState * _p_fs, engine * _engine ); + lb302Filter( lb302FilterState * _p_fs ); virtual ~lb302Filter() {}; virtual void recalc( void ); @@ -82,7 +82,7 @@ protected: class lb302FilterIIR2 : public lb302Filter { public: - lb302FilterIIR2( lb302FilterState * _p_fs, engine * _engine ); + lb302FilterIIR2( lb302FilterState * _p_fs ); virtual ~lb302FilterIIR2(); virtual void recalc( void ); @@ -110,7 +110,7 @@ protected: class lb302Filter3Pole : public lb302Filter { public: - lb302Filter3Pole( lb302FilterState * _p_fs, engine * _engine ); + lb302Filter3Pole( lb302FilterState * _p_fs ); virtual void envRecalc( void ); virtual void recalc( void ); @@ -160,7 +160,7 @@ public slots: private: - class handleState : public engineObject + class handleState { public: handleState( polyb302Synth * _synth ); diff --git a/plugins/singerbot/singerbot.cpp b/plugins/singerbot/singerbot.cpp index 35d7ef9ca..5edc2a448 100644 --- a/plugins/singerbot/singerbot.cpp +++ b/plugins/singerbot/singerbot.cpp @@ -135,7 +135,7 @@ singerBot::~singerBot() void singerBot::playNote( notePlayHandle * _n, bool ) { - const Uint32 frames = eng()->getMixer()->framesPerAudioBuffer(); + const Uint32 frames = engine::getMixer()->framesPerAudioBuffer(); sampleFrame * buf = bufferAllocator::alloc( frames ); if( !_n->m_pluginData ) @@ -145,7 +145,7 @@ void singerBot::playNote( notePlayHandle * _n, bool ) handle_data * hdata = (handle_data *)_n->m_pluginData; sampleBuffer * sample_buffer = hdata->remaining_frames ? - readWave( hdata ) : new sampleBuffer( NULL, 0, eng() ); + readWave( hdata ) : new sampleBuffer( NULL, 0 ); sampleBuffer::handleState hstate; @@ -252,7 +252,7 @@ void singerBot::createWave( notePlayHandle * _n ) hdata->frequency = getInstrumentTrack()->frequency( _n ); hdata->duration = _n->length() > 0 ? _n->length() * 60.0f * BEATS_PER_TACT - / 64.0f / eng()->getSongEditor()->getTempo() : + / 64.0f / engine::getSongEditor()->getTempo() : 0; int word_index = _n->patternIndex() % m_words.size(); hdata->text = m_words[word_index].ascii(); @@ -274,7 +274,7 @@ void singerBot::createWave( notePlayHandle * _n ) src_strerror( error ) ); } - hdata->resampling_data.src_ratio = eng()->getMixer()->sampleRate() + hdata->resampling_data.src_ratio = engine::getMixer()->sampleRate() / (double)hdata->wave->sample_rate(); hdata->resampling_data.end_of_input = 0; hdata->remaining_frames = hdata->wave->num_samples(); @@ -285,7 +285,7 @@ void singerBot::createWave( notePlayHandle * _n ) sampleBuffer * singerBot::readWave( handle_data * _hdata ) { - f_cnt_t frames = eng()->getMixer()->framesPerAudioBuffer(); + f_cnt_t frames = engine::getMixer()->framesPerAudioBuffer(); f_cnt_t offset = _hdata->wave->num_samples() - _hdata->remaining_frames; const float fac = 1.0f / OUTPUT_SAMPLE_MULTIPLIER; @@ -324,7 +324,7 @@ sampleBuffer * singerBot::readWave( handle_data * _hdata ) } } - sampleBuffer * buffer = new sampleBuffer( data, frames, eng() ); + sampleBuffer * buffer = new sampleBuffer( data, frames ); _hdata->remaining_frames -= _hdata->resampling_data.input_frames_used; delete[] wave_samples; delete[] mono_data; diff --git a/plugins/stk/mallets/mallets.cpp b/plugins/stk/mallets/mallets.cpp index 1ed2a9c53..07f614058 100644 --- a/plugins/stk/mallets/mallets.cpp +++ b/plugins/stk/mallets/mallets.cpp @@ -1,7 +1,7 @@ /* * mallets.h - tuned instruments that one would bang upon * - * Copyright (c) 2006 Danny McRae + * Copyright (c) 2006-2007 Danny McRae * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -85,7 +85,7 @@ mallets::mallets( instrumentTrack * _channel_track ) : m_presets = setupPresets( this, _channel_track ); m_spread = new knob( knobBright_26, this, tr( "Spread" ), - eng(), _channel_track ); + _channel_track ); m_spread->setLabel( tr( "Spread" ) ); m_spread->setRange( 0, 255, 1 ); m_spread->setInitValue( 0 ); @@ -93,7 +93,7 @@ mallets::mallets( instrumentTrack * _channel_track ) : m_spread->setHintText( tr( "Spread:" ) + " ", "" ); m_buffer = bufferAllocator::alloc( - eng()->getMixer()->framesPerAudioBuffer() ); + engine::getMixer()->framesPerAudioBuffer() ); } @@ -129,7 +129,7 @@ QWidget * mallets::setupModalBarControls( QWidget * _parent, track * _track ) widget->setFixedSize( 250, 250 ); m_hardness = new knob( knobBright_26, widget, tr( "Hardness" ), - eng(), _track ); + _track ); m_hardness->setLabel( tr( "Hardness" ) ); m_hardness->setRange( 0.0, 128.0, 0.1 ); m_hardness->setInitValue( 64.0 ); @@ -137,7 +137,7 @@ QWidget * mallets::setupModalBarControls( QWidget * _parent, track * _track ) m_hardness->setHintText( tr( "Hardness:" ) + " ", "" ); m_position = new knob( knobBright_26, widget, tr( "Position" ), - eng(), _track ); + _track ); m_position->setLabel( tr( "Position" ) ); m_position->setRange( 0.0, 128.0, 0.1 ); m_position->setInitValue( 64.0 ); @@ -145,7 +145,7 @@ QWidget * mallets::setupModalBarControls( QWidget * _parent, track * _track ) m_position->setHintText( tr( "Position:" ) + " ", "" ); m_vibratoGain = new knob( knobBright_26, widget, tr( "Vibrato Gain" ), - eng(), _track ); + _track ); m_vibratoGain->setLabel( tr( "Vib Gain" ) ); m_vibratoGain->setRange( 0.0, 128.0, 0.1 ); m_vibratoGain->setInitValue( 64.0 ); @@ -153,7 +153,7 @@ QWidget * mallets::setupModalBarControls( QWidget * _parent, track * _track ) m_vibratoGain->setHintText( tr( "Vib Gain:" ) + " ", "" ); m_vibratoFreq = new knob( knobBright_26, widget, tr( "Vibrato Freq" ), - eng(), _track ); + _track ); m_vibratoFreq->setLabel( tr( "Vib Freq" ) ); m_vibratoFreq->setRange( 0.0, 128.0, 0.1 ); m_vibratoFreq->setInitValue( 64.0 ); @@ -161,7 +161,7 @@ QWidget * mallets::setupModalBarControls( QWidget * _parent, track * _track ) m_vibratoFreq->setHintText( tr( "Vib Freq:" ) + " ", "" ); m_stick = new knob( knobBright_26, widget, tr( "Stick Mix" ), - eng(), _track ); + _track ); m_stick->setLabel( tr( "Stick Mix" ) ); m_stick->setRange( 0.0, 128.0, 0.1 ); m_stick->setInitValue( 64.0 ); @@ -180,7 +180,7 @@ QWidget * mallets::setupTubeBellControls( QWidget * _parent, track * _track ) widget->setFixedSize( 250, 250 ); m_modulator = new knob( knobBright_26, widget, tr( "Modulator" ), - eng(), _track ); + _track ); m_modulator->setLabel( tr( "Modulator" ) ); m_modulator->setRange( 0.0, 128.0, 0.1 ); m_modulator->setInitValue( 100.0 ); @@ -188,7 +188,7 @@ QWidget * mallets::setupTubeBellControls( QWidget * _parent, track * _track ) m_modulator->setHintText( tr( "Modulator:" ) + " ", "" ); m_crossfade = new knob( knobBright_26, widget, tr( "Crossfade" ), - eng(), _track ); + _track ); m_crossfade->setLabel( tr( "Crossfade" ) ); m_crossfade->setRange( 0.0, 128.0, 0.1 ); m_crossfade->setInitValue( 0.0 ); @@ -196,7 +196,7 @@ QWidget * mallets::setupTubeBellControls( QWidget * _parent, track * _track ) m_crossfade->setHintText( tr( "Crossfade:" ) + " ", "" ); m_lfoSpeed = new knob( knobBright_26, widget, tr( "LFO Speed" ), - eng(), _track ); + _track ); m_lfoSpeed->setLabel( tr( "LFO Speed" ) ); m_lfoSpeed->setRange( 0.0, 128.0, 0.1 ); m_lfoSpeed->setInitValue( 20.0 ); @@ -204,15 +204,14 @@ QWidget * mallets::setupTubeBellControls( QWidget * _parent, track * _track ) m_lfoSpeed->setHintText( tr( "LFO Speed:" ) + " ", "" ); m_lfoDepth = new knob( knobBright_26, widget, tr( "LFO Depth" ), - eng(), _track ); + _track ); m_lfoDepth->setLabel( tr( "LFO Depth" ) ); m_lfoDepth->setRange( 0.0, 128.0, 0.1 ); m_lfoDepth->setInitValue( 10.0 ); m_lfoDepth->move( 117, 86 ); m_lfoDepth->setHintText( tr( "LFO Depth:" ) + " ", "" ); - m_adsr = new knob( knobBright_26, widget, tr( "ADSR" ), - eng(), _track ); + m_adsr = new knob( knobBright_26, widget, tr( "ADSR" ), _track ); m_adsr->setLabel( tr( "ADSR" ) ); m_adsr->setRange( 0.0, 128.0, 0.1 ); m_adsr->setInitValue( 0.0 ); @@ -232,35 +231,32 @@ QWidget * mallets::setupBandedWGControls( QWidget * _parent, track * _track ) widget->setFixedSize( 250, 250 ); m_strike = new ledCheckBox( tr( "Bowed" ), widget, tr( "Bowed" ), - eng(), _track ); + _track ); m_strike->move( 165, 30 ); m_pressure = new knob( knobBright_26, widget, tr( "Pressure" ), - eng(), _track ); + _track ); m_pressure->setLabel( tr( "Pressure" ) ); m_pressure->setRange( 0.0, 128.0, 0.1 ); m_pressure->setInitValue( 64.0 ); m_pressure->move( 56, 86 ); m_pressure->setHintText( tr( "Pressure:" ) + " ", "" ); - m_motion = new knob( knobBright_26, widget, tr( "Motion" ), - eng(), _track ); + m_motion = new knob( knobBright_26, widget, tr( "Motion" ), _track ); m_motion->setLabel( tr( "Motion" ) ); m_motion->setRange( 0.0, 128.0, 0.1 ); m_motion->setInitValue( 64.0 ); m_motion->move( 117, 86 ); m_motion->setHintText( tr( "Motion:" ) + " ", "" ); - m_velocity = new knob( knobBright_26, widget, tr( "Speed" ), - eng(), _track ); + m_velocity = new knob( knobBright_26, widget, tr( "Speed" ), _track ); m_velocity->setLabel( tr( "Speed" ) ); m_velocity->setRange( 0.0, 128.0, 0.1 ); m_velocity->setInitValue( 74.5 ); m_velocity->move( 178, 86 ); m_velocity->setHintText( tr( "Speed:" ) + " ", "" ); - m_vibrato = new knob( knobBright_26, widget, tr( "Vibrato" ), - eng(), _track ); + m_vibrato = new knob( knobBright_26, widget, tr( "Vibrato" ), _track ); m_vibrato->setLabel( tr( "Vibrato" ) ); m_vibrato->setRange( 0.0, 128.0, 0.1 ); m_vibrato->setInitValue( 64.0 ); @@ -276,7 +272,7 @@ QWidget * mallets::setupBandedWGControls( QWidget * _parent, track * _track ) comboBox * mallets::setupPresets( QWidget * _parent, track * _track ) { comboBox * presets = new comboBox( _parent, tr( "Instrument" ), - eng(), _track ); + _track ); presets->setGeometry( 64, 157, 99, 22 ); presets->setFont( pointSize<8>( presets->font() ) ); @@ -412,7 +408,7 @@ void mallets::playNote( notePlayHandle * _n, bool ) m_vibratoFreq->value(), p, (Uint8) m_spread->value(), - eng()->getMixer()->sampleRate() ); + engine::getMixer()->sampleRate() ); } else if( p == 9 ) { @@ -426,7 +422,7 @@ void mallets::playNote( notePlayHandle * _n, bool ) m_lfoSpeed->value(), m_adsr->value(), (Uint8) m_spread->value(), - eng()->getMixer()->sampleRate() ); + engine::getMixer()->sampleRate() ); } else { @@ -440,11 +436,11 @@ void mallets::playNote( notePlayHandle * _n, bool ) m_strike->value() * 128.0, m_velocity->value(), (Uint8) m_spread->value(), - eng()->getMixer()->sampleRate() ); + engine::getMixer()->sampleRate() ); } } - const Uint32 frames = eng()->getMixer()->framesPerAudioBuffer(); + const Uint32 frames = engine::getMixer()->framesPerAudioBuffer(); malletsSynth * ps = static_cast( _n->m_pluginData ); sample_t add_scale = 0.0f; diff --git a/plugins/triple_oscillator/triple_oscillator.cpp b/plugins/triple_oscillator/triple_oscillator.cpp index 0784dae6a..f9e27c6e0 100644 --- a/plugins/triple_oscillator/triple_oscillator.cpp +++ b/plugins/triple_oscillator/triple_oscillator.cpp @@ -89,7 +89,7 @@ tripleOscillator::tripleOscillator( instrumentTrack * _channel_track ) : { for( int i = 0; i < NUM_OF_OSCILLATORS; ++i ) { - m_osc[i].m_sampleBuffer = new sampleBuffer( eng() ); + m_osc[i].m_sampleBuffer = new sampleBuffer; } #ifdef QT4 @@ -102,8 +102,7 @@ tripleOscillator::tripleOscillator( instrumentTrack * _channel_track ) : setErasePixmap( PLUGIN_NAME::getIconPixmap( "artwork" ) ); #endif - pixmapButton * pm_osc1_btn = new pixmapButton( this, NULL, eng(), - NULL ); + pixmapButton * pm_osc1_btn = new pixmapButton( this, NULL, NULL ); pm_osc1_btn->move( 80, 50 ); pm_osc1_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "pm_active" ) ); @@ -115,8 +114,7 @@ tripleOscillator::tripleOscillator( instrumentTrack * _channel_track ) : "modulating oscillator 2 with " "oscillator 1" ) ); - pixmapButton * am_osc1_btn = new pixmapButton( this, NULL, eng(), - NULL ); + pixmapButton * am_osc1_btn = new pixmapButton( this, NULL, NULL ); am_osc1_btn->move( 120, 50 ); am_osc1_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "am_active" ) ); @@ -128,8 +126,7 @@ tripleOscillator::tripleOscillator( instrumentTrack * _channel_track ) : "modulating oscillator 2 with " "oscillator 1" ) ); - pixmapButton * mix_osc1_btn = new pixmapButton( this, NULL, eng(), - NULL ); + pixmapButton * mix_osc1_btn = new pixmapButton( this, NULL, NULL ); mix_osc1_btn->move( 160, 50 ); mix_osc1_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "mix_active" ) ); @@ -139,8 +136,7 @@ tripleOscillator::tripleOscillator( instrumentTrack * _channel_track ) : "btn_mask" ).createHeuristicMask() ) ); toolTip::add( mix_osc1_btn, tr( "mix output of oscillator 1 & 2" ) ); - pixmapButton * sync_osc1_btn = new pixmapButton( this, NULL, eng(), - NULL ); + pixmapButton * sync_osc1_btn = new pixmapButton( this, NULL, NULL ); sync_osc1_btn->move( 200, 50 ); sync_osc1_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "sync_active" ) ); @@ -151,8 +147,7 @@ tripleOscillator::tripleOscillator( instrumentTrack * _channel_track ) : toolTip::add( sync_osc1_btn, tr( "synchronize oscillator 1 with " "oscillator 2" ) ); - pixmapButton * fm_osc1_btn = new pixmapButton( this, NULL, eng(), - NULL ); + pixmapButton * fm_osc1_btn = new pixmapButton( this, NULL, NULL ); fm_osc1_btn->move( 330, 50 ); fm_osc1_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "fm_active" ) ); @@ -166,7 +161,7 @@ tripleOscillator::tripleOscillator( instrumentTrack * _channel_track ) : m_mod1BtnGrp = new automatableButtonGroup( this, tr( "Modulation type 1" ), - eng(), _channel_track ); + _channel_track ); m_mod1BtnGrp->addButton( pm_osc1_btn ); m_mod1BtnGrp->addButton( am_osc1_btn ); m_mod1BtnGrp->addButton( mix_osc1_btn ); @@ -178,8 +173,7 @@ tripleOscillator::tripleOscillator( instrumentTrack * _channel_track ) : this, SLOT( mod1Ch( int ) ) ); - pixmapButton * pm_osc2_btn = new pixmapButton( this, NULL, eng(), - NULL ); + pixmapButton * pm_osc2_btn = new pixmapButton( this, NULL, NULL ); pm_osc2_btn->move( 80, 70 ); pm_osc2_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "pm_active" ) ); @@ -191,8 +185,7 @@ tripleOscillator::tripleOscillator( instrumentTrack * _channel_track ) : "modulating oscillator 3 with " "oscillator 2" ) ); - pixmapButton * am_osc2_btn = new pixmapButton( this, NULL, eng(), - NULL ); + pixmapButton * am_osc2_btn = new pixmapButton( this, NULL, NULL ); am_osc2_btn->move( 120, 70 ); am_osc2_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "am_active" ) ); @@ -204,8 +197,7 @@ tripleOscillator::tripleOscillator( instrumentTrack * _channel_track ) : "modulating oscillator 3 with " "oscillator 2" ) ); - pixmapButton * mix_osc2_btn = new pixmapButton( this, NULL, eng(), - NULL ); + pixmapButton * mix_osc2_btn = new pixmapButton( this, NULL, NULL ); mix_osc2_btn->move( 160, 70 ); mix_osc2_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "mix_active" ) ); @@ -215,8 +207,7 @@ tripleOscillator::tripleOscillator( instrumentTrack * _channel_track ) : "btn_mask" ).createHeuristicMask() ) ); toolTip::add( mix_osc2_btn, tr("mix output of oscillator 2 & 3" ) ); - pixmapButton * sync_osc2_btn = new pixmapButton( this, NULL, eng(), - NULL ); + pixmapButton * sync_osc2_btn = new pixmapButton( this, NULL, NULL ); sync_osc2_btn->move( 200, 70 ); sync_osc2_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "sync_active" ) ); @@ -227,8 +218,7 @@ tripleOscillator::tripleOscillator( instrumentTrack * _channel_track ) : toolTip::add( sync_osc2_btn, tr( "synchronize oscillator 2 with " "oscillator 3" ) ); - pixmapButton * fm_osc2_btn = new pixmapButton( this, NULL, eng(), - NULL ); + pixmapButton * fm_osc2_btn = new pixmapButton( this, NULL, NULL ); fm_osc2_btn->move( 330, 70 ); fm_osc2_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "fm_active" ) ); @@ -242,7 +232,7 @@ tripleOscillator::tripleOscillator( instrumentTrack * _channel_track ) : m_mod2BtnGrp = new automatableButtonGroup( this, tr( "Modulation type 2" ), - eng(), _channel_track ); + _channel_track ); m_mod2BtnGrp->addButton( pm_osc2_btn ); m_mod2BtnGrp->addButton( am_osc2_btn ); m_mod2BtnGrp->addButton( mix_osc2_btn ); @@ -261,8 +251,7 @@ tripleOscillator::tripleOscillator( instrumentTrack * _channel_track ) : // setup volume-knob m_osc[i].volKnob = new volumeKnob( knobSmall_17, this, tr( - "Osc %1 volume" ).arg( i+1 ), eng(), - _channel_track ); + "Osc %1 volume" ).arg( i+1 ), _channel_track ); m_osc[i].volKnob->setData( i ); m_osc[i].volKnob->move( 6, 104+i*50 ); m_osc[i].volKnob->setRange( MIN_VOLUME, MAX_VOLUME, 1.0f ); @@ -283,7 +272,7 @@ tripleOscillator::tripleOscillator( instrumentTrack * _channel_track ) : // setup panning-knob m_osc[i].panKnob = new knob( knobSmall_17, this, - tr( "Osc %1 panning" ).arg( i + 1 ), eng(), + tr( "Osc %1 panning" ).arg( i + 1 ), _channel_track ); m_osc[i].panKnob->setData( i ); m_osc[i].panKnob->move( 33, 104+i*50 ); @@ -304,7 +293,7 @@ tripleOscillator::tripleOscillator( instrumentTrack * _channel_track ) : // setup coarse-knob m_osc[i].coarseKnob = new knob( knobSmall_17, this, tr( "Osc %1 coarse detuning" ).arg( i + 1 ), - eng(), _channel_track ); + _channel_track ); m_osc[i].coarseKnob->setData( i ); m_osc[i].coarseKnob->move( 66, 104 + i * 50 ); m_osc[i].coarseKnob->setRange( -2 * NOTES_PER_OCTAVE, @@ -327,7 +316,7 @@ tripleOscillator::tripleOscillator( instrumentTrack * _channel_track ) : // setup knob for left fine-detuning m_osc[i].fineLKnob = new knob( knobSmall_17, this, tr( "Osc %1 fine detuning left" ).arg( i+1 ), - eng(), _channel_track ); + _channel_track ); m_osc[i].fineLKnob->setData( i ); m_osc[i].fineLKnob->move( 90, 104 + i * 50 ); m_osc[i].fineLKnob->setRange( -100.0f, 100.0f, 1.0f ); @@ -351,7 +340,7 @@ tripleOscillator::tripleOscillator( instrumentTrack * _channel_track ) : m_osc[i].fineRKnob = new knob( knobSmall_17, this, tr( "Osc %1 fine detuning right" ).arg( i + 1 ), - eng(), _channel_track ); + _channel_track ); m_osc[i].fineRKnob->setData( i ); m_osc[i].fineRKnob->move( 110, 104 + i * 50 ); m_osc[i].fineRKnob->setRange( -100.0f, 100.0f, 1.0f ); @@ -374,7 +363,6 @@ tripleOscillator::tripleOscillator( instrumentTrack * _channel_track ) : m_osc[i].phaseOffsetKnob = new knob( knobSmall_17, this, tr( "Osc %1 phase-" "offset" ).arg( i+1 ), - eng(), _channel_track ); m_osc[i].phaseOffsetKnob->setData( i ); m_osc[i].phaseOffsetKnob->move( 142, 104 + i * 50 ); @@ -402,7 +390,6 @@ tripleOscillator::tripleOscillator( instrumentTrack * _channel_track ) : m_osc[i].stereoPhaseDetuningKnob = new knob( knobSmall_17, this, tr( "Osc %1 stereo phase-" "detuning" ).arg( i+1 ), - eng(), _channel_track ); m_osc[i].stereoPhaseDetuningKnob->setData( i ); m_osc[i].stereoPhaseDetuningKnob->move( 166, 104 + i * 50 ); @@ -467,7 +454,7 @@ tripleOscillator::tripleOscillator( instrumentTrack * _channel_track ) : updatePhaseOffsetRight( i ); pixmapButton * sin_wave_btn = new pixmapButton( this, NULL, - eng(), NULL ); + NULL ); sin_wave_btn->move( 188, 105 + i * 50 ); sin_wave_btn->setActiveGraphic( embed::getIconPixmap( "sin_wave_active" ) ); @@ -479,7 +466,7 @@ tripleOscillator::tripleOscillator( instrumentTrack * _channel_track ) : "current oscillator." ) ); pixmapButton * triangle_wave_btn = new pixmapButton( this, NULL, - eng(), NULL ); + NULL ); triangle_wave_btn->move( 203, 105 + i * 50 ); triangle_wave_btn->setActiveGraphic( embed::getIconPixmap( "triangle_wave_active" ) ); @@ -490,7 +477,7 @@ tripleOscillator::tripleOscillator( instrumentTrack * _channel_track ) : "for current oscillator." ) ); pixmapButton * saw_wave_btn = new pixmapButton( this, NULL, - eng(), NULL ); + NULL ); saw_wave_btn->move( 218, 105 + i * 50 ); saw_wave_btn->setActiveGraphic( embed::getIconPixmap( "saw_wave_active" ) ); @@ -501,7 +488,7 @@ tripleOscillator::tripleOscillator( instrumentTrack * _channel_track ) : "current oscillator." ) ); pixmapButton * sqr_wave_btn = new pixmapButton( this, NULL, - eng(), NULL ); + NULL ); sqr_wave_btn->move( 233, 105 + i * 50 ); sqr_wave_btn->setActiveGraphic( embed::getIconPixmap( "square_wave_active" ) ); @@ -512,7 +499,7 @@ tripleOscillator::tripleOscillator( instrumentTrack * _channel_track ) : "current oscillator." ) ); pixmapButton * moog_saw_wave_btn = new pixmapButton( this, NULL, - eng(), NULL ); + NULL ); moog_saw_wave_btn->move( 188, 120+i*50 ); moog_saw_wave_btn->setActiveGraphic( embed::getIconPixmap( "moog_saw_wave_active" ) ); @@ -523,7 +510,7 @@ tripleOscillator::tripleOscillator( instrumentTrack * _channel_track ) : "for current oscillator." ) ); pixmapButton * exp_wave_btn = new pixmapButton( this, NULL, - eng(), NULL ); + NULL ); exp_wave_btn->move( 203, 120+i*50 ); exp_wave_btn->setActiveGraphic( embed::getIconPixmap( "exp_wave_active" ) ); @@ -534,7 +521,7 @@ tripleOscillator::tripleOscillator( instrumentTrack * _channel_track ) : "wave for current oscillator." ) ); pixmapButton * white_noise_btn = new pixmapButton( this, NULL, - eng(), NULL ); + NULL ); white_noise_btn->move( 218, 120+i*50 ); white_noise_btn->setActiveGraphic( embed::getIconPixmap( "white_noise_wave_active" ) ); @@ -544,8 +531,7 @@ tripleOscillator::tripleOscillator( instrumentTrack * _channel_track ) : tr( "Click here if you want a white-noise for " "current oscillator." ) ); - m_osc[i].usrWaveBtn = new pixmapButton( this, NULL, eng(), - NULL ); + m_osc[i].usrWaveBtn = new pixmapButton( this, NULL, NULL ); m_osc[i].usrWaveBtn->move( 233, 120+i*50 ); m_osc[i].usrWaveBtn->setActiveGraphic( embed::getIconPixmap( "usr_wave_active" ) ); @@ -557,7 +543,7 @@ tripleOscillator::tripleOscillator( instrumentTrack * _channel_track ) : m_osc[i].waveBtnGrp = new automatableButtonGroup( this, tr( "Osc %1 wave shape" ).arg( i + 1 ), - eng(), _channel_track ); + _channel_track ); m_osc[i].waveBtnGrp->addButton( sin_wave_btn ); m_osc[i].waveBtnGrp->addButton( triangle_wave_btn ); m_osc[i].waveBtnGrp->addButton( saw_wave_btn ); @@ -596,7 +582,7 @@ tripleOscillator::tripleOscillator( instrumentTrack * _channel_track ) : } } - connect( eng()->getMixer(), SIGNAL( sampleRateChanged() ), + connect( engine::getMixer(), SIGNAL( sampleRateChanged() ), this, SLOT( updateAllDetuning() ) ); } @@ -753,7 +739,7 @@ void tripleOscillator::playNote( notePlayHandle * _n, bool ) oscillator * osc_r = static_cast( _n->m_pluginData )->oscRight; - const fpab_t frames = eng()->getMixer()->framesPerAudioBuffer(); + const fpab_t frames = engine::getMixer()->framesPerAudioBuffer(); sampleFrame * buf = bufferAllocator::alloc( frames ); osc_l->update( buf, frames, 0 ); @@ -893,7 +879,7 @@ void tripleOscillator::updateDetuningLeft( const QVariant & _data ) m_osc[_i].detuningLeft = powf( 2.0f, ( (float)m_osc[_i].coarseKnob->value() * 100.0f + (float)m_osc[_i].fineLKnob->value() ) / 1200.0f ) - / static_cast( eng()->getMixer()->sampleRate() ); + / engine::getMixer()->sampleRate(); } @@ -905,7 +891,7 @@ void tripleOscillator::updateDetuningRight( const QVariant & _data ) m_osc[_i].detuningRight = powf( 2.0f, ( (float)m_osc[_i].coarseKnob->value() * 100.0f + (float)m_osc[_i].fineRKnob->value() ) / 1200.0f ) - / static_cast( eng()->getMixer()->sampleRate() ); + / engine::getMixer()->sampleRate(); } diff --git a/plugins/vestige/vestige.cpp b/plugins/vestige/vestige.cpp index 199b57bed..c16d79c89 100644 --- a/plugins/vestige/vestige.cpp +++ b/plugins/vestige/vestige.cpp @@ -108,7 +108,7 @@ vestigeInstrument::vestigeInstrument( instrumentTrack * _instrument_track ) : setErasePixmap( *s_artwork ); #endif - m_openPluginButton = new pixmapButton( this, NULL, eng(), NULL ); + m_openPluginButton = new pixmapButton( this, NULL, NULL ); m_openPluginButton->setCheckable( FALSE ); m_openPluginButton->setCursor( Qt::PointingHandCursor ); m_openPluginButton->move( 200, 70 ); @@ -160,7 +160,7 @@ vestigeInstrument::vestigeInstrument( instrumentTrack * _instrument_track ) : // now we need a play-handle which cares for calling play() instrumentPlayHandle * iph = new instrumentPlayHandle( this ); - eng()->getMixer()->addPlayHandle( iph ); + engine::getMixer()->addPlayHandle( iph ); } @@ -231,7 +231,7 @@ void vestigeInstrument::setParameter( const QString & _param, PLUGIN_NAME::getIconPixmap( "logo", 24, 24 ), 0 ); m_pluginMutex.lock(); - m_plugin = new remoteVSTPlugin( m_pluginDLL, eng() ); + m_plugin = new remoteVSTPlugin( m_pluginDLL ); if( m_plugin->failed() ) { m_pluginMutex.unlock(); @@ -261,10 +261,10 @@ void vestigeInstrument::setParameter( const QString & _param, return; }*/ m_plugin->showEditor(); - connect( eng()->getSongEditor(), + connect( engine::getSongEditor(), SIGNAL( tempoChanged( bpm_t ) ), m_plugin, SLOT( setTempo( bpm_t ) ) ); - m_plugin->setTempo( eng()->getSongEditor()->getTempo() ); + m_plugin->setTempo( engine::getSongEditor()->getTempo() ); if( set_ch_name == TRUE ) { getInstrumentTrack()->setName( m_plugin->name() ); @@ -297,7 +297,7 @@ void vestigeInstrument::waitForWorkerThread( void ) return; } - const fpab_t frames = eng()->getMixer()->framesPerAudioBuffer(); + const fpab_t frames = engine::getMixer()->framesPerAudioBuffer(); sampleFrame * buf = bufferAllocator::alloc( frames ); if( m_plugin->waitForProcessingFinished( buf ) ) diff --git a/plugins/vibed/graph.cpp b/plugins/vibed/graph.cpp index b669119f0..366e5e0f9 100644 --- a/plugins/vibed/graph.cpp +++ b/plugins/vibed/graph.cpp @@ -1,7 +1,7 @@ /* * graph.cpp - a QT widget for displaying and manipulating waveforms * - * Copyright (c) 2006 Andreas Brandmaier + * Copyright (c) 2006-2007 Andreas Brandmaier * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -50,9 +50,8 @@ using namespace std; -graph::graph( QWidget * _parent, engine * _engine ) : - QWidget( _parent ), - engineObject( _engine ) +graph::graph( QWidget * _parent ) : + QWidget( _parent ) { m_mouseDown = false; @@ -94,7 +93,7 @@ void graph::loadSampleFromFile( const QString & _filename ) } // load user shape - sampleBuffer buffer( eng(), _filename ); + sampleBuffer buffer( _filename ); // copy buffer data sampleLength = min( sampleLength, static_cast(buffer.frames()) ); diff --git a/plugins/vibed/graph.h b/plugins/vibed/graph.h index 74418ba71..75e0ae391 100644 --- a/plugins/vibed/graph.h +++ b/plugins/vibed/graph.h @@ -1,7 +1,7 @@ /* * graph.h - a QT widget for displaying and manipulating waveforms * - * Copyright (c) 2006 Andreas Brandmaier + * Copyright (c) 2006-2007 Andreas Brandmaier * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -43,14 +43,11 @@ #endif -#include "engine.h" - - -class graph : public QWidget, public engineObject +class graph : public QWidget { Q_OBJECT public: - graph( QWidget * _parent, engine * _engine ); + graph( QWidget * _parent ); virtual ~graph(); void setSamplePointer( float * pointer, int length ); diff --git a/plugins/vibed/impulse_editor.cpp b/plugins/vibed/impulse_editor.cpp index 635f66927..d2054665e 100644 --- a/plugins/vibed/impulse_editor.cpp +++ b/plugins/vibed/impulse_editor.cpp @@ -1,7 +1,7 @@ /* * impulse_editor.cpp - graphic waveform editor * - * Copyright (c) 2006 Danny McRae + * Copyright (c) 2006-2007 Danny McRae * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -52,11 +52,9 @@ #include "song_editor.h" -impulseEditor::impulseEditor( QWidget * _parent, int _x, int _y, - engine * _engine, track * _track, - Uint32 _len ) : +impulseEditor::impulseEditor( QWidget * _parent, int _x, int _y, track * _track, + Uint32 _len ) : QWidget( _parent/*, "impulseEditor"*/ ), - engineObject( _engine ), m_sampleLength( _len ), m_normalizeFactor( 1.0f ), m_forward( TRUE ) @@ -72,7 +70,7 @@ impulseEditor::impulseEditor( QWidget * _parent, int _x, int _y, setPaletteBackgroundPixmap( m_base ); #endif - m_graph = new graph( this, eng() ); + m_graph = new graph( this ); m_graph->setForeground( PLUGIN_NAME::getIconPixmap( "wavegraph4" ) ); m_graph->move( 0, 0 ); m_graph->setCursor( QCursor( Qt::CrossCursor ) ); @@ -82,8 +80,7 @@ impulseEditor::impulseEditor( QWidget * _parent, int _x, int _y, connect( m_graph, SIGNAL ( sampleChanged( void ) ), this, SLOT ( sampleChanged( void ) ) ); - m_sinWaveBtn = new pixmapButton( this, tr( "Sine wave" ), eng(), - _track ); + m_sinWaveBtn = new pixmapButton( this, tr( "Sine wave" ), _track ); m_sinWaveBtn->move( 136, 3 ); m_sinWaveBtn->setActiveGraphic( embed::getIconPixmap( "sin_wave_active" ) ); @@ -98,7 +95,7 @@ impulseEditor::impulseEditor( QWidget * _parent, int _x, int _y, m_triangleWaveBtn = new pixmapButton( this, tr( "Triangle wave" ), - eng(), _track ); + _track ); m_triangleWaveBtn->move( 136, 20 ); m_triangleWaveBtn->setActiveGraphic( embed::getIconPixmap( "triangle_wave_active" ) ); @@ -111,8 +108,7 @@ impulseEditor::impulseEditor( QWidget * _parent, int _x, int _y, this, SLOT ( triangleWaveClicked( void ) ) ); - m_sawWaveBtn = new pixmapButton( this, tr( "Saw wave" ), eng(), - _track ); + m_sawWaveBtn = new pixmapButton( this, tr( "Saw wave" ), _track ); m_sawWaveBtn->move( 136, 37 ); m_sawWaveBtn->setActiveGraphic( embed::getIconPixmap( "saw_wave_active" ) ); @@ -125,8 +121,7 @@ impulseEditor::impulseEditor( QWidget * _parent, int _x, int _y, this, SLOT ( sawWaveClicked( void ) ) ); - m_sqrWaveBtn = new pixmapButton( this, tr( "Square wave" ), eng(), - _track ); + m_sqrWaveBtn = new pixmapButton( this, tr( "Square wave" ), _track ); m_sqrWaveBtn->move( 136, 54 ); m_sqrWaveBtn->setActiveGraphic( embed::getIconPixmap( "square_wave_active" ) ); @@ -140,7 +135,7 @@ impulseEditor::impulseEditor( QWidget * _parent, int _x, int _y, m_whiteNoiseWaveBtn = new pixmapButton( this, tr( "White noise wave" ), - eng(), _track ); + _track ); m_whiteNoiseWaveBtn->move( 136, 71 ); m_whiteNoiseWaveBtn->setActiveGraphic( embed::getIconPixmap( "white_noise_wave_active" ) ); @@ -153,7 +148,7 @@ impulseEditor::impulseEditor( QWidget * _parent, int _x, int _y, this, SLOT ( noiseWaveClicked( void ) ) ); - m_usrWaveBtn = new pixmapButton( this, tr( "User defined wave" ), eng(), + m_usrWaveBtn = new pixmapButton( this, tr( "User defined wave" ), _track ); m_usrWaveBtn->move( 136, 88 ); m_usrWaveBtn->setActiveGraphic( embed::getIconPixmap( @@ -167,7 +162,7 @@ impulseEditor::impulseEditor( QWidget * _parent, int _x, int _y, this, SLOT ( usrWaveClicked( void ) ) ); - m_smoothBtn = new pixmapButton( this, tr( "Smooth" ), eng(), _track ); + m_smoothBtn = new pixmapButton( this, tr( "Smooth" ), _track ); m_smoothBtn->move( 3, 108 ); m_smoothBtn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "smooth_active" ) ); @@ -180,8 +175,7 @@ impulseEditor::impulseEditor( QWidget * _parent, int _x, int _y, this, SLOT ( smoothClicked( void ) ) ); - m_normalizeBtn = new pixmapButton( this, tr( "Normalize" ), eng(), - _track ); + m_normalizeBtn = new pixmapButton( this, tr( "Normalize" ), _track ); m_normalizeBtn->move( 20, 108 ); m_normalizeBtn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "normalize_active" ) ); @@ -194,8 +188,7 @@ impulseEditor::impulseEditor( QWidget * _parent, int _x, int _y, connect( m_normalizeBtn, SIGNAL ( clicked ( void ) ), this, SLOT ( normalizeClicked( void ) ) ); - m_state = new ledCheckBox( "", this, tr( "Enable waveform" ), eng(), - _track ); + m_state = new ledCheckBox( "", this, tr( "Enable waveform" ), _track ); m_state->move( 136, 109 ); m_state->setChecked( TRUE ); toolTip::add( m_state, @@ -325,7 +318,7 @@ void impulseEditor::usrWaveClicked( void ) } // load user shape - sampleBuffer buffer( eng() ); + sampleBuffer buffer; QString af = buffer.openAudioFile(); if( af != "" ) { @@ -379,7 +372,7 @@ void impulseEditor::smoothClicked( void ) update(); m_graph->update(); - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); m_smoothBtn->setChecked( FALSE ); m_smoothBtn->update(); @@ -411,7 +404,7 @@ void impulseEditor::normalizeClicked( void ) update(); m_graph->update(); - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); m_normalizeBtn->setChecked( FALSE ); m_normalizeBtn->update(); @@ -439,7 +432,7 @@ void impulseEditor::sampleChanged() m_graph->update(); } - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); } diff --git a/plugins/vibed/impulse_editor.h b/plugins/vibed/impulse_editor.h index 6e2a587fd..447808e94 100644 --- a/plugins/vibed/impulse_editor.h +++ b/plugins/vibed/impulse_editor.h @@ -1,7 +1,7 @@ /* * impulse_editor.cpp - graphic waveform editor * - * Copyright (c) 2006 Danny McRae + * Copyright (c) 2006-2007 Danny McRae * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -44,16 +44,14 @@ #include "types.h" #include "graph.h" #include "pixmap_button.h" -#include "engine.h" #include "led_checkbox.h" -class impulseEditor: public QWidget, public engineObject +class impulseEditor: public QWidget { Q_OBJECT public: - impulseEditor( QWidget *parent, int _x, int _y, - engine * _engine, track * _track, - Uint32 _len = 128 ); + impulseEditor( QWidget *parent, int _x, int _y, track * _track, + Uint32 _len = 128 ); ~impulseEditor(); inline float * getValues() { return( m_sampleShape ); }; diff --git a/plugins/vibed/nine_button_selector.cpp b/plugins/vibed/nine_button_selector.cpp index b94f33115..67dd1cb29 100644 --- a/plugins/vibed/nine_button_selector.cpp +++ b/plugins/vibed/nine_button_selector.cpp @@ -1,7 +1,7 @@ /* * nine_button_selector.cpp * - * Copyright (c) 2006 Danny McRae + * Copyright (c) 2006-2007 Danny McRae * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -64,10 +64,8 @@ nineButtonSelector::nineButtonSelector( QPixmap _button0_on, Uint8 _default, Uint32 _x, Uint32 _y, QWidget * _parent, - engine * _engine, track * _track ): QWidget( _parent/*, "nineButtonSelector"*/ ), - engineObject( _engine ), m_selected( _default ) { setFixedSize( 50, 50 ); @@ -82,7 +80,7 @@ nineButtonSelector::nineButtonSelector( QPixmap _button0_on, setPaletteBackgroundPixmap( m_base ); #endif - m_button = new pixmapButton( this, NULL, eng(), _track ); + m_button = new pixmapButton( this, NULL, _track ); m_button->move( 1, 1 ); m_button->setActiveGraphic( _button0_on ); m_button->setInactiveGraphic( _button0_off ); @@ -91,7 +89,7 @@ nineButtonSelector::nineButtonSelector( QPixmap _button0_on, this, SLOT ( button0Clicked( void ) ) ); m_buttons.append( m_button ); - m_button = new pixmapButton( this, NULL, eng(), _track ); + m_button = new pixmapButton( this, NULL, _track ); m_button->move( 18, 1 ); m_button->setActiveGraphic( _button1_on ); m_button->setInactiveGraphic( _button1_off ); @@ -100,7 +98,7 @@ nineButtonSelector::nineButtonSelector( QPixmap _button0_on, this, SLOT ( button1Clicked( void ) ) ); m_buttons.append( m_button ); - m_button = new pixmapButton( this, NULL, eng(), _track ); + m_button = new pixmapButton( this, NULL, _track ); m_button->move( 35, 1 ); m_button->setActiveGraphic( _button2_on ); m_button->setInactiveGraphic( _button2_off ); @@ -109,7 +107,7 @@ nineButtonSelector::nineButtonSelector( QPixmap _button0_on, this, SLOT ( button2Clicked( void ) ) ); m_buttons.append( m_button ); - m_button = new pixmapButton( this, NULL, eng(), _track ); + m_button = new pixmapButton( this, NULL, _track ); m_button->move( 1, 18 ); m_button->setActiveGraphic( _button3_on ); m_button->setInactiveGraphic( _button3_off ); @@ -118,7 +116,7 @@ nineButtonSelector::nineButtonSelector( QPixmap _button0_on, this, SLOT ( button3Clicked( void ) ) ); m_buttons.append( m_button ); - m_button = new pixmapButton( this, NULL, eng(), _track ); + m_button = new pixmapButton( this, NULL, _track ); m_button->move( 18, 18 ); m_button->setActiveGraphic( _button4_on ); m_button->setInactiveGraphic( _button4_off ); @@ -127,7 +125,7 @@ nineButtonSelector::nineButtonSelector( QPixmap _button0_on, this, SLOT ( button4Clicked( void ) ) ); m_buttons.append( m_button ); - m_button = new pixmapButton( this, NULL, eng(), _track ); + m_button = new pixmapButton( this, NULL, _track ); m_button->move( 35, 18 ); m_button->setActiveGraphic( _button5_on ); m_button->setInactiveGraphic( _button5_off ); @@ -136,7 +134,7 @@ nineButtonSelector::nineButtonSelector( QPixmap _button0_on, this, SLOT ( button5Clicked( void ) ) ); m_buttons.append( m_button ); - m_button = new pixmapButton( this, NULL, eng(), _track ); + m_button = new pixmapButton( this, NULL, _track ); m_button->move( 1, 35 ); m_button->setActiveGraphic( _button6_on ); m_button->setInactiveGraphic( _button6_off ); @@ -145,7 +143,7 @@ nineButtonSelector::nineButtonSelector( QPixmap _button0_on, this, SLOT ( button6Clicked( void ) ) ); m_buttons.append( m_button ); - m_button = new pixmapButton( this, NULL, eng(), _track ); + m_button = new pixmapButton( this, NULL, _track ); m_button->move( 18, 35 ); m_button->setActiveGraphic( _button7_on ); m_button->setInactiveGraphic( _button7_off ); @@ -154,7 +152,7 @@ nineButtonSelector::nineButtonSelector( QPixmap _button0_on, this, SLOT ( button7Clicked( void ) ) ); m_buttons.append( m_button ); - m_button = new pixmapButton( this, NULL, eng(), _track ); + m_button = new pixmapButton( this, NULL, _track ); m_button->move( 35, 35 ); m_button->setActiveGraphic( _button8_on ); m_button->setInactiveGraphic( _button8_off ); diff --git a/plugins/vibed/nine_button_selector.h b/plugins/vibed/nine_button_selector.h index b8facc330..34fd4db88 100644 --- a/plugins/vibed/nine_button_selector.h +++ b/plugins/vibed/nine_button_selector.h @@ -1,7 +1,7 @@ /* * nine_button_selector.h * - * Copyright (c) 2006 Danny McRae + * Copyright (c) 2006-2007 Danny McRae * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -30,7 +30,7 @@ #include "pixmap_button.h" -class nineButtonSelector: public QWidget, public engineObject +class nineButtonSelector: public QWidget { Q_OBJECT @@ -56,7 +56,6 @@ public: Uint8 _default, Uint32 _x, Uint32 _y, QWidget * _parent, - engine * _engine, track * _track ); ~nineButtonSelector(); diff --git a/plugins/vibed/vibed.cpp b/plugins/vibed/vibed.cpp index 6052640fa..a7b95179e 100644 --- a/plugins/vibed/vibed.cpp +++ b/plugins/vibed/vibed.cpp @@ -1,7 +1,7 @@ /* * vibed.cpp - combination of PluckedStringSynth and BitInvader * - * Copyright (c) 2006 Danny McRae + * Copyright (c) 2006-2007 Danny McRae * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -96,8 +96,7 @@ vibed::vibed( instrumentTrack * _channel_track ) : for( Uint8 harm = 0; harm < 9; harm++ ) { - m_editor = new impulseEditor( this, 76, 21, eng(), - _channel_track ); + m_editor = new impulseEditor( this, 76, 21, _channel_track ); m_editor->setOn( FALSE ); m_editor->hide(); m_editors.append( m_editor ); @@ -119,8 +118,8 @@ vibed::vibed( instrumentTrack * _channel_track ) : "The 'N' button will normalize the waveform.") ); - m_volumeKnob = new volumeKnob( knobBright_26, this, - tr( "Volume" ), eng(), _channel_track ); + m_volumeKnob = new volumeKnob( knobBright_26, this, + tr( "Volume" ), _channel_track ); m_volumeKnob->setRange( MIN_VOLUME, MAX_VOLUME, 1.0f ); m_volumeKnob->setInitValue( DEFAULT_VOLUME ); m_volumeKnob->move( 103, 142 ); @@ -137,7 +136,7 @@ vibed::vibed( instrumentTrack * _channel_track ) : m_stiffnessKnob = new knob( knobBright_26, this, tr( "String stiffness" ), - eng(), _channel_track ); + _channel_track ); m_stiffnessKnob->setRange( 0.0f, 0.05f, 0.001f ); m_stiffnessKnob->setInitValue( 0.0f ); m_stiffnessKnob->move( 129, 142 ); @@ -158,7 +157,7 @@ vibed::vibed( instrumentTrack * _channel_track ) : m_pickKnob = new knob( knobBright_26, this, tr( "Pick position" ), - eng(), _channel_track ); + _channel_track ); m_pickKnob->setRange( 0.0f, 0.5f, 0.005f ); m_pickKnob->setInitValue( 0.0f ); m_pickKnob->move( 153, 142 ); @@ -176,7 +175,7 @@ vibed::vibed( instrumentTrack * _channel_track ) : m_pickupKnob = new knob( knobBright_26, this, tr( "Pickup position" ), - eng(), _channel_track ); + _channel_track ); m_pickupKnob->setRange( 0.0f, 0.5f, 0.005f ); m_pickupKnob->setInitValue( 0.05f ); m_pickupKnob->move( 177, 142 ); @@ -194,8 +193,8 @@ vibed::vibed( instrumentTrack * _channel_track ) : "for the selected string. The lower the setting, the closer the " "pickup is to the bridge." ) ); - m_panKnob = new knob( knobBright_26, this, - tr( "Pan" ), eng(), _channel_track ); + m_panKnob = new knob( knobBright_26, this, tr( "Pan" ), + _channel_track ); m_panKnob->setRange( -1.0f, 1.0f, 0.01f ); m_panKnob->setInitValue( 0.0f ); m_panKnob->move( 105, 187 ); @@ -211,9 +210,8 @@ vibed::vibed( instrumentTrack * _channel_track ) : "The Pan knob determines the location of the selected string in the stereo " "field." ) ); - m_detuneKnob = new knob( knobBright_26, this, - tr( "Detune" ), - eng(), _channel_track ); + m_detuneKnob = new knob( knobBright_26, this, tr( "Detune" ), + _channel_track ); m_detuneKnob->setRange( -0.1f, 0.1f, 0.001f ); m_detuneKnob->setInitValue( 0.0f ); m_detuneKnob->move( 150, 187 ); @@ -230,9 +228,8 @@ vibed::vibed( instrumentTrack * _channel_track ) : "than zero will cause the string to sound flat. Settings greater than zero " "will cause the string to sound sharp." ) ); - m_randomKnob = new knob( knobBright_26, this, - tr( "Fuzziness" ), - eng(), _channel_track ); + m_randomKnob = new knob( knobBright_26, this, tr( "Fuzziness" ), + _channel_track ); m_randomKnob->setRange( 0.0f, 0.75f, 0.01f ); m_randomKnob->setInitValue( 0.0f ); m_randomKnob->move( 194, 187 ); @@ -250,8 +247,8 @@ vibed::vibed( instrumentTrack * _channel_track ) : "apparent during the attack, though it can also be used to make the string " "sound more 'metallic'.") ); - m_lengthKnob = new knob( knobBright_26, this, - tr( "Length" ), eng(), _channel_track ); + m_lengthKnob = new knob( knobBright_26, this, tr( "Length" ), + _channel_track ); m_lengthKnob->setRange( 1, 16, 1 ); m_lengthKnob->setInitValue( 1 ); m_lengthKnob->move( 23, 193 ); @@ -269,7 +266,7 @@ vibed::vibed( instrumentTrack * _channel_track ) : "will both ring longer and sound brighter, however, they will also eat up " "more CPU cycles." ) ); - m_impulse = new ledCheckBox( "", this, tr( "Impulse" ), eng(), + m_impulse = new ledCheckBox( "", this, tr( "Impulse" ), _channel_track ); m_impulse->move( 23, 94 ); m_impulse->setChecked( FALSE ); @@ -309,7 +306,6 @@ vibed::vibed( instrumentTrack * _channel_track ) : 2, 21, 127, this, - eng(), NULL ); m_harmonic->hide(); m_harmonics.append( m_harmonic ); @@ -348,7 +344,6 @@ vibed::vibed( instrumentTrack * _channel_track ) : 0, 21, 39, this, - eng(), NULL ); connect( m_stringSelector, SIGNAL( nineButtonSelection( Uint8 ) ), this, SLOT( showString( Uint8 ) ) ); @@ -559,7 +554,7 @@ void vibed::playNote( notePlayHandle * _n, bool ) _n->m_pluginData = new stringContainer( freq, - eng()->getMixer()->sampleRate(), + engine::getMixer()->sampleRate(), m_sampleLength ); for( Uint8 i = 0; i < 9; ++i ) @@ -583,7 +578,7 @@ void vibed::playNote( notePlayHandle * _n, bool ) } } - const fpab_t frames = eng()->getMixer()->framesPerAudioBuffer(); + const fpab_t frames = engine::getMixer()->framesPerAudioBuffer(); stringContainer * ps = static_cast( _n->m_pluginData ); diff --git a/plugins/vst_base/lvsl_client.cpp b/plugins/vst_base/lvsl_client.cpp index a4041f43c..cbc91462a 100644 --- a/plugins/vst_base/lvsl_client.cpp +++ b/plugins/vst_base/lvsl_client.cpp @@ -1,7 +1,7 @@ /* * lvsl_client.cpp - client for LVSL Server * - * Copyright (c) 2005-2006 Tobias Doerffel + * Copyright (c) 2005-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -79,15 +79,15 @@ #include "templates.h" #include "config_mgr.h" +#include "engine.h" #include "main_window.h" #include "lvsl_client.h" -remoteVSTPlugin::remoteVSTPlugin( const QString & _plugin, engine * _engine ) : +remoteVSTPlugin::remoteVSTPlugin( const QString & _plugin ) : QObject(), - journallingObject( _engine ), m_failed( TRUE ), m_plugin( _plugin ), m_pluginWidget( NULL ), @@ -253,11 +253,11 @@ void remoteVSTPlugin::showEditor( void ) return; } - m_pluginWidget = new QWidget( eng()->getMainWindow()->workspace() ); + m_pluginWidget = new QWidget( engine::getMainWindow()->workspace() ); m_pluginWidget->setFixedSize( m_pluginGeometry ); m_pluginWidget->setWindowTitle( name() ); #ifndef QT3 - eng()->getMainWindow()->workspace()->addWindow( m_pluginWidget ); + engine::getMainWindow()->workspace()->addWindow( m_pluginWidget ); #endif m_pluginWidget->show(); @@ -289,7 +289,7 @@ void remoteVSTPlugin::hideEditor( void ) bool remoteVSTPlugin::process( const sampleFrame * _in_buf, sampleFrame * _out_buf, bool _wait ) { - const fpab_t frames = eng()->getMixer()->framesPerAudioBuffer(); + const fpab_t frames = engine::getMixer()->framesPerAudioBuffer(); if( m_shm == NULL ) { @@ -303,7 +303,8 @@ bool remoteVSTPlugin::process( const sampleFrame * _in_buf, } if( _out_buf != NULL ) { - eng()->getMixer()->clearAudioBuffer( _out_buf, frames ); + engine::getMixer()->clearAudioBuffer( _out_buf, + frames ); } return( FALSE ); } @@ -352,13 +353,13 @@ bool remoteVSTPlugin::waitForProcessingFinished( sampleFrame * _out_buf ) usleep( 10 ); } - const fpab_t frames = eng()->getMixer()->framesPerAudioBuffer(); + const fpab_t frames = engine::getMixer()->framesPerAudioBuffer(); const ch_cnt_t outputs = tMax( m_outputCount, DEFAULT_CHANNELS ); if( outputs != DEFAULT_CHANNELS ) { // clear buffer, if plugin didn't fill up both channels - eng()->getMixer()->clearAudioBuffer( _out_buf, frames ); + engine::getMixer()->clearAudioBuffer( _out_buf, frames ); } for( ch_cnt_t ch = 0; ch < outputs; ++ch ) @@ -553,14 +554,14 @@ Sint16 remoteVSTPlugin::processNextMessage( void ) writeValueS( VST_SAMPLE_RATE ); // handle is the same writeValueS( - eng()->getMixer()->sampleRate() ); + engine::getMixer()->sampleRate() ); break; case VST_GET_BUFFER_SIZE: writeValueS( VST_BUFFER_SIZE ); // handle is the same writeValueS( - eng()->getMixer()->framesPerAudioBuffer() ); + engine::getMixer()->framesPerAudioBuffer() ); break; case VST_SHM_KEY_AND_SIZE: diff --git a/plugins/vst_base/lvsl_client.h b/plugins/vst_base/lvsl_client.h index a75b89c62..d3bda2581 100644 --- a/plugins/vst_base/lvsl_client.h +++ b/plugins/vst_base/lvsl_client.h @@ -1,7 +1,7 @@ /* * lvsl_client.h - client for LVSL Server * - * Copyright (c) 2005-2006 Tobias Doerffel + * Copyright (c) 2005-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -54,7 +54,7 @@ class remoteVSTPlugin : public QObject, public journallingObject { Q_OBJECT public: - remoteVSTPlugin( const QString & _plugin, engine * _engine ); + remoteVSTPlugin( const QString & _plugin ); virtual ~remoteVSTPlugin(); void showEditor( void ); diff --git a/plugins/vst_effect/vst_effect.cpp b/plugins/vst_effect/vst_effect.cpp index 9bf162905..c279eafd1 100644 --- a/plugins/vst_effect/vst_effect.cpp +++ b/plugins/vst_effect/vst_effect.cpp @@ -1,7 +1,7 @@ /* * vst_effect.cpp - class for handling VST effect plugins * - * Copyright (c) 2006 Tobias Doerffel + * Copyright (c) 2006-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -65,11 +65,11 @@ plugin::descriptor vsteffect_plugin_descriptor = } -vstEffect::vstEffect( effect::constructionData * _cdata ) : - effect( &vsteffect_plugin_descriptor, _cdata ), +vstEffect::vstEffect( const descriptor::subPluginFeatures::key * _key ) : + effect( &vsteffect_plugin_descriptor, _key ), m_plugin( NULL ), m_pluginMutex(), - m_key( _cdata->key ) + m_key( *_key ) { if( !m_key.user.toString().isEmpty() ) { @@ -150,7 +150,7 @@ void vstEffect::openPlugin( const QString & _plugin ) "Please wait while loading VST-plugin..." ), PLUGIN_NAME::getIconPixmap( "logo", 24, 24 ), 0 ); m_pluginMutex.lock(); - m_plugin = new remoteVSTPlugin( _plugin, eng() ); + m_plugin = new remoteVSTPlugin( _plugin ); if( m_plugin->failed() ) { m_pluginMutex.unlock(); @@ -168,10 +168,10 @@ void vstEffect::openPlugin( const QString & _plugin ) return; } m_plugin->showEditor(); - remoteVSTPlugin::connect( eng()->getSongEditor(), + remoteVSTPlugin::connect( engine::getSongEditor(), SIGNAL( tempoChanged( bpm_t ) ), m_plugin, SLOT( setTempo( bpm_t ) ) ); - m_plugin->setTempo( eng()->getSongEditor()->getTempo() ); + m_plugin->setTempo( engine::getSongEditor()->getTempo() ); if( m_plugin->pluginWidget() != NULL ) { /*#ifdef QT4 @@ -206,7 +206,8 @@ extern "C" plugin * lmms_plugin_main( void * _data ) { return( new vstEffect( - static_cast( _data ) ) ); + static_cast( + _data ) ) ); } } diff --git a/plugins/vst_effect/vst_effect.h b/plugins/vst_effect/vst_effect.h index 33707dbee..1620ae7e8 100644 --- a/plugins/vst_effect/vst_effect.h +++ b/plugins/vst_effect/vst_effect.h @@ -1,7 +1,7 @@ /* * vst_effect.h - class for handling VST effect plugins * - * Copyright (c) 2006 Tobias Doerffel + * Copyright (c) 2006-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -40,6 +40,7 @@ #include "effect.h" +#include "engine.h" #include "main_window.h" #include "lvsl_client.h" #include "vst_control_dialog.h" @@ -48,7 +49,7 @@ class vstEffect : public effect { public: - vstEffect( effect::constructionData * _cdata ); + vstEffect( const descriptor::subPluginFeatures::key * _key ); virtual ~vstEffect(); virtual bool FASTCALL processAudioBuffer( surroundSampleFrame * _buf, @@ -62,7 +63,7 @@ public: virtual inline effectControlDialog * createControlDialog( track * ) { return( new vstControlDialog( - eng()->getMainWindow()->workspace(), + engine::getMainWindow()->workspace(), this ) ); } diff --git a/plugins/vst_effect/vst_subplugin_features.cpp b/plugins/vst_effect/vst_subplugin_features.cpp index 1da9a0114..8c453f541 100644 --- a/plugins/vst_effect/vst_subplugin_features.cpp +++ b/plugins/vst_effect/vst_subplugin_features.cpp @@ -50,18 +50,18 @@ vstSubPluginFeatures::vstSubPluginFeatures( plugin::pluginTypes _type ) : -void vstSubPluginFeatures::fillDescriptionWidget( - QWidget * _parent, engine * _eng, const key & _key ) +void vstSubPluginFeatures::fillDescriptionWidget( QWidget * _parent, + const key * _key ) { - new QLabel( QWidget::tr( "Name: " ) + _key.name, _parent ); - new QLabel( QWidget::tr( "File: " ) + _key.user.toString(), _parent ); + new QLabel( QWidget::tr( "Name: " ) + _key->name, _parent ); + new QLabel( QWidget::tr( "File: " ) + _key->user.toString(), _parent ); } -void vstSubPluginFeatures::listSubPluginKeys( engine * _eng, - plugin::descriptor * _desc, keyList & _kl ) +void vstSubPluginFeatures::listSubPluginKeys( plugin::descriptor * _desc, + keyList & _kl ) { QStringList dlls = QDir( configManager::inst()->vstDir() ). #ifndef QT3 diff --git a/plugins/vst_effect/vst_subplugin_features.h b/plugins/vst_effect/vst_subplugin_features.h index be5ea15bf..df2c6ac76 100644 --- a/plugins/vst_effect/vst_subplugin_features.h +++ b/plugins/vst_effect/vst_subplugin_features.h @@ -37,11 +37,10 @@ public: vstSubPluginFeatures( plugin::pluginTypes _type ); virtual void fillDescriptionWidget( QWidget * _parent, - engine * _eng, - const key & _key ); + const key * _key ); - virtual void listSubPluginKeys( engine * _eng, - plugin::descriptor * _desc, keyList & _kl ); + virtual void listSubPluginKeys( plugin::descriptor * _desc, + keyList & _kl ); } ; diff --git a/src/audio/audio_alsa.cpp b/src/audio/audio_alsa.cpp index 9d21e71ac..3952b8d59 100644 --- a/src/audio/audio_alsa.cpp +++ b/src/audio/audio_alsa.cpp @@ -65,8 +65,7 @@ audioALSA::audioALSA( const sample_rate_t _sample_rate, bool & _success_ful, m_handle( NULL ), m_hwParams( NULL ), m_swParams( NULL ), - m_convertEndian( FALSE ), - m_quit( FALSE ) + m_convertEndian( FALSE ) { _success_ful = FALSE; @@ -204,7 +203,6 @@ void audioALSA::stopProcessing( void ) { if( isRunning() ) { - m_quit = TRUE; wait( 1000 ); terminate(); } @@ -223,13 +221,13 @@ void audioALSA::run( void ) channels() ); int_sample_t * pcmbuf = bufferAllocator::alloc( m_periodSize * channels() ); - m_quit = FALSE; int outbuf_size = getMixer()->framesPerAudioBuffer() * channels(); int outbuf_pos = 0; int pcmbuf_size = m_periodSize * channels(); - while( m_quit == FALSE ) + bool quit = FALSE; + while( quit == FALSE ) { int_sample_t * ptr = pcmbuf; int len = pcmbuf_size; @@ -239,6 +237,13 @@ void audioALSA::run( void ) { // frames depend on the sample rate const fpab_t frames = getNextBuffer( temp ); + if( !frames ) + { + quit = TRUE; + memset( ptr, 0, len + * sizeof( int_sample_t ) ); + break; + } outbuf_size = frames * channels(); convertToS16( temp, frames, @@ -488,7 +493,7 @@ audioALSA::setupWidget::setupWidget( QWidget * _parent ) : dev_lbl->setGeometry( 10, 40, 160, 10 ); m_channels = new lcdSpinBox( DEFAULT_CHANNELS, SURROUND_CHANNELS, 1, - this, NULL, NULL, NULL ); + this, NULL, NULL ); m_channels->setStep( 2 ); m_channels->setLabel( tr( "CHANNELS" ) ); m_channels->setValue( configManager::inst()->value( "audioalsa", diff --git a/src/audio/audio_device.cpp b/src/audio/audio_device.cpp index 4a2b3ef19..9f88bb2c2 100644 --- a/src/audio/audio_device.cpp +++ b/src/audio/audio_device.cpp @@ -3,7 +3,7 @@ /* * audio_device.cpp - base-class for audio-devices used by LMMS-mixer * - * Copyright (c) 2004-2006 Tobias Doerffel + * Copyright (c) 2004-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -85,10 +85,15 @@ audioDevice::~audioDevice() -void audioDevice::processNextBuffer( void ) +bool audioDevice::processNextBuffer( void ) { const fpab_t frames = getNextBuffer( m_buffer ); + if( !frames ) + { + return( FALSE ); + } writeBuffer( m_buffer, frames, getMixer()->masterGain() ); + return( TRUE ); } @@ -97,7 +102,11 @@ void audioDevice::processNextBuffer( void ) fpab_t audioDevice::getNextBuffer( surroundSampleFrame * _ab ) { fpab_t frames = getMixer()->framesPerAudioBuffer(); - const surroundSampleFrame * b = getMixer()->renderNextBuffer(); + const surroundSampleFrame * b = getMixer()->nextBuffer(); + if( !b ) + { + return( 0 ); + } // make sure, no other thread is accessing device lock(); @@ -117,12 +126,22 @@ fpab_t audioDevice::getNextBuffer( surroundSampleFrame * _ab ) // release lock unlock(); + delete[] b; + return( frames ); } +void audioDevice::stopProcessing( void ) +{ + while( processNextBuffer() ); +} + + + + void audioDevice::registerPort( audioPort * ) { } @@ -348,4 +367,6 @@ void FASTCALL audioDevice::clearS16Buffer( int_sample_t * _outbuf, } + + #endif diff --git a/src/audio/audio_jack.cpp b/src/audio/audio_jack.cpp index a41f6aa4b..8d3207dea 100644 --- a/src/audio/audio_jack.cpp +++ b/src/audio/audio_jack.cpp @@ -3,7 +3,7 @@ /* * audio_jack.cpp - support for JACK-transport * - * Copyright (c) 2005-2006 Tobias Doerffel + * Copyright (c) 2005-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -65,8 +65,9 @@ audioJACK::audioJACK( const sample_rate_t _sample_rate, bool & _success_ful, DEFAULT_CHANNELS, SURROUND_CHANNELS ), _mixer ), m_client( NULL ), - m_stopped( FALSE ), - m_processCallbackMutex(), + m_active( FALSE ), +// m_processCallbackMutex(), + m_stop_semaphore( 1 ), m_outBuf( bufferAllocator::alloc( getMixer()->framesPerAudioBuffer() ) ), m_framesDoneInCurBuf( 0 ), @@ -94,7 +95,7 @@ audioJACK::audioJACK( const sample_rate_t _sample_rate, bool & _success_ful, server_name ); if( m_client == NULL ) { - printf( "jack_client_open() failed with status %d\n", status ); + printf( "jack_client_open() failed, status 0x%2.0x\n", status ); if( status & JackServerFailed ) { printf( "Could not connect to JACK server.\n" ); @@ -165,6 +166,48 @@ audioJACK::audioJACK( const sample_rate_t _sample_rate, bool & _success_ful, } } + m_stop_semaphore += m_stop_semaphore.total(); + + + _success_ful = TRUE; +} + + + + +audioJACK::~audioJACK() +{ + m_stop_semaphore -= m_stop_semaphore.total(); + + while( m_portMap.size() ) + { + unregisterPort( m_portMap.begin().key() ); + } + + if( m_client != NULL ) + { + if( m_active ) + { + jack_deactivate( m_client ); + } + jack_client_close( m_client ); + } + + bufferAllocator::free( m_outBuf ); + +} + + + + +void audioJACK::startProcessing( void ) +{ + m_stopped = FALSE; + + if( m_active ) + { + return; + } if( jack_activate( m_client ) ) { @@ -172,6 +215,8 @@ audioJACK::audioJACK( const sample_rate_t _sample_rate, bool & _success_ful, return; } + m_active = TRUE; + // make sure, JACK transport is rolling if( jack_transport_query( m_client, NULL ) != JackTransportRolling ) @@ -209,37 +254,6 @@ audioJACK::audioJACK( const sample_rate_t _sample_rate, bool & _success_ful, } free( ports ); - - - _success_ful = TRUE; -} - - - - -audioJACK::~audioJACK() -{ - while( m_portMap.size() ) - { - unregisterPort( m_portMap.begin().key() ); - } - - if( m_client != NULL ) - { - jack_deactivate( m_client ); - jack_client_close( m_client ); - } - - bufferAllocator::free( m_outBuf ); - -} - - - - -void audioJACK::startProcessing( void ) -{ - m_stopped = FALSE; } @@ -247,7 +261,7 @@ void audioJACK::startProcessing( void ) void audioJACK::stopProcessing( void ) { - m_stopped = TRUE; + m_stop_semaphore++; } @@ -329,7 +343,7 @@ void audioJACK::renamePort( audioPort * _port ) int audioJACK::processCallback( jack_nframes_t _nframes, void * _udata ) { audioJACK * _this = static_cast( _udata ); - _this->m_processCallbackMutex.lock(); +// _this->m_processCallbackMutex.lock(); /* printf( "%f\n", jack_cpu_load( _this->m_client ) );*/ @@ -397,6 +411,11 @@ int audioJACK::processCallback( jack_nframes_t _nframes, void * _udata ) { _this->m_framesToDoInCurBuf = _this->getNextBuffer( _this->m_outBuf ); + if( !_this->m_framesToDoInCurBuf ) + { + _this->m_stopped = TRUE; + _this->m_stop_semaphore--; + } _this->m_framesDoneInCurBuf = 0; } } @@ -405,12 +424,12 @@ int audioJACK::processCallback( jack_nframes_t _nframes, void * _udata ) { for( Uint8 ch = 0; ch < _this->channels(); ++ch ) { - jack_default_audio_sample_t * b = outbufs[ch]; - memset( b, 0, sizeof( *b ) * _nframes ); + jack_default_audio_sample_t * b = outbufs[ch] + done; + memset( b, 0, sizeof( *b ) * ( _nframes - done ) ); } } - _this->m_processCallbackMutex.unlock(); +// _this->m_processCallbackMutex.unlock(); return( 0 ); } @@ -451,7 +470,7 @@ audioJACK::setupWidget::setupWidget( QWidget * _parent ) : cn_lbl->setGeometry( 10, 40, 160, 10 ); m_channels = new lcdSpinBox( DEFAULT_CHANNELS, SURROUND_CHANNELS, 1, - this, NULL, NULL, NULL ); + this, NULL, NULL ); m_channels->setStep( 2 ); m_channels->setLabel( tr( "CHANNELS" ) ); m_channels->setValue( configManager::inst()->value( "audiojack", diff --git a/src/audio/audio_oss.cpp b/src/audio/audio_oss.cpp index 45b41793d..3cc94b42a 100644 --- a/src/audio/audio_oss.cpp +++ b/src/audio/audio_oss.cpp @@ -99,8 +99,7 @@ audioOSS::audioOSS( const sample_rate_t _sample_rate, bool & _success_ful, configManager::inst()->value( "audiooss", "channels" ).toInt(), DEFAULT_CHANNELS, SURROUND_CHANNELS ), _mixer ), - m_convertEndian( FALSE ), - m_quit( FALSE ) + m_convertEndian( FALSE ) { _success_ful = FALSE; @@ -307,7 +306,6 @@ void audioOSS::stopProcessing( void ) { if( isRunning() ) { - m_quit = TRUE; wait( 1000 ); terminate(); } @@ -324,11 +322,14 @@ void audioOSS::run( void ) int_sample_t * outbuf = bufferAllocator::alloc( getMixer()->framesPerAudioBuffer() * channels() ); - m_quit = FALSE; - while( m_quit == FALSE ) + while( TRUE ) { const fpab_t frames = getNextBuffer( temp ); + if( !frames ) + { + break; + } int bytes = convertToS16( temp, frames, getMixer()->masterGain(), outbuf, @@ -354,7 +355,7 @@ audioOSS::setupWidget::setupWidget( QWidget * _parent ) : dev_lbl->setGeometry( 10, 40, 160, 10 ); m_channels = new lcdSpinBox( DEFAULT_CHANNELS, SURROUND_CHANNELS, 1, - this, NULL, NULL, NULL ); + this, NULL, NULL ); m_channels->setStep( 2 ); m_channels->setLabel( tr( "CHANNELS" ) ); m_channels->setValue( configManager::inst()->value( "audiooss", diff --git a/src/audio/audio_port.cpp b/src/audio/audio_port.cpp index 882539169..02dab03d5 100644 --- a/src/audio/audio_port.cpp +++ b/src/audio/audio_port.cpp @@ -3,7 +3,7 @@ /* * audio_port.cpp - base-class for objects providing sound at a port * - * Copyright (c) 2004-2006 Tobias Doerffel + * Copyright (c) 2004-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -31,26 +31,26 @@ #include "audio_port.h" #include "audio_device.h" #include "buffer_allocator.h" +#include "engine.h" -audioPort::audioPort( const QString & _name, engine * _engine ) : - engineObject( _engine ), +audioPort::audioPort( const QString & _name ) : m_bufferUsage( NONE ), m_firstBuffer( bufferAllocator::alloc( - eng()->getMixer()->framesPerAudioBuffer() ) ), + engine::getMixer()->framesPerAudioBuffer() ) ), m_secondBuffer( bufferAllocator::alloc( - eng()->getMixer()->framesPerAudioBuffer() ) ), + engine::getMixer()->framesPerAudioBuffer() ) ), m_extOutputEnabled( FALSE ), m_nextFxChannel( -1 ), m_name( "unnamed port" ) { - eng()->getMixer()->clearAudioBuffer( m_firstBuffer, - eng()->getMixer()->framesPerAudioBuffer() ); - eng()->getMixer()->clearAudioBuffer( m_secondBuffer, - eng()->getMixer()->framesPerAudioBuffer() ); - eng()->getMixer()->addAudioPort( this ); + engine::getMixer()->clearAudioBuffer( m_firstBuffer, + engine::getMixer()->framesPerAudioBuffer() ); + engine::getMixer()->clearAudioBuffer( m_secondBuffer, + engine::getMixer()->framesPerAudioBuffer() ); + engine::getMixer()->addAudioPort( this ); setExtOutputEnabled( TRUE ); - m_frames = eng()->getMixer()->framesPerAudioBuffer(); - m_effects = new effectChain( eng() ); + m_frames = engine::getMixer()->framesPerAudioBuffer(); + m_effects = new effectChain; } @@ -58,10 +58,10 @@ audioPort::audioPort( const QString & _name, engine * _engine ) : audioPort::~audioPort() { - eng()->getMixer()->removeAudioPort( this ); + engine::getMixer()->removeAudioPort( this ); if( m_extOutputEnabled == TRUE ) { - eng()->getMixer()->audioDev()->unregisterPort( this ); + engine::getMixer()->audioDev()->unregisterPort( this ); } bufferAllocator::free( m_firstBuffer ); bufferAllocator::free( m_secondBuffer ); @@ -72,8 +72,8 @@ audioPort::~audioPort() void audioPort::nextPeriod( void ) { - eng()->getMixer()->clearAudioBuffer( m_firstBuffer, - eng()->getMixer()->framesPerAudioBuffer() ); + engine::getMixer()->clearAudioBuffer( m_firstBuffer, + engine::getMixer()->framesPerAudioBuffer() ); qSwap( m_firstBuffer, m_secondBuffer ); // this is how we decrease state of buffer-usage ;-) m_bufferUsage = ( m_bufferUsage != NONE ) ? @@ -90,11 +90,11 @@ void audioPort::setExtOutputEnabled( bool _enabled ) m_extOutputEnabled = _enabled; if( m_extOutputEnabled ) { - eng()->getMixer()->audioDev()->registerPort( this ); + engine::getMixer()->audioDev()->registerPort( this ); } else { - eng()->getMixer()->audioDev()->unregisterPort( this ); + engine::getMixer()->audioDev()->unregisterPort( this ); } } } @@ -105,7 +105,7 @@ void audioPort::setExtOutputEnabled( bool _enabled ) void audioPort::setName( const QString & _name ) { m_name = _name; - eng()->getMixer()->audioDev()->renamePort( this ); + engine::getMixer()->audioDev()->renamePort( this ); } diff --git a/src/audio/audio_sample_recorder.cpp b/src/audio/audio_sample_recorder.cpp index d0538f23d..c74cec3ae 100644 --- a/src/audio/audio_sample_recorder.cpp +++ b/src/audio/audio_sample_recorder.cpp @@ -5,7 +5,7 @@ * surround-audio-buffers into RAM, maybe later * also harddisk * - * Copyright (c) 2004-2006 Tobias Doerffel + * Copyright (c) 2004-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -94,7 +94,7 @@ void audioSampleRecorder::createSampleBuffer( sampleBuffer * * _sample_buf ) data += ( *it ).second; } // create according sample-buffer out of big buffer - *_sample_buf = new sampleBuffer( ac.ptr(), frames, getMixer()->eng() ); + *_sample_buf = new sampleBuffer( ac.ptr(), frames ); } diff --git a/src/audio/audio_sdl.cpp b/src/audio/audio_sdl.cpp index 47b681580..af12c7f94 100644 --- a/src/audio/audio_sdl.cpp +++ b/src/audio/audio_sdl.cpp @@ -57,7 +57,8 @@ audioSDL::audioSDL( const sample_rate_t _sample_rate, bool & _success_ful, m_outBuf( bufferAllocator::alloc( getMixer()->framesPerAudioBuffer() ) ), m_convertedBuf_pos( 0 ), - m_convertEndian( FALSE ) + m_convertEndian( FALSE ), + m_stop_semaphore( 1 ) { _success_ful = FALSE; @@ -106,6 +107,8 @@ audioSDL::audioSDL( const sample_rate_t _sample_rate, bool & _success_ful, } m_convertEndian = ( m_audioHandle.format != actual.format ); + m_stop_semaphore += m_stop_semaphore.total(); + _success_ful = TRUE; } @@ -115,6 +118,7 @@ audioSDL::audioSDL( const sample_rate_t _sample_rate, bool & _success_ful, audioSDL::~audioSDL() { stopProcessing(); + m_stop_semaphore -= m_stop_semaphore.total(); SDL_CloseAudio(); SDL_Quit(); bufferAllocator::free( m_convertedBuf ); @@ -126,6 +130,8 @@ audioSDL::~audioSDL() void audioSDL::startProcessing( void ) { + m_stopped = FALSE; + SDL_PauseAudio( 0 ); SDL_UnlockAudio(); } @@ -137,6 +143,8 @@ void audioSDL::stopProcessing( void ) { if( SDL_GetAudioStatus() == SDL_AUDIO_PLAYING ) { + m_stop_semaphore++; + SDL_LockAudio(); SDL_PauseAudio( 1 ); } @@ -161,12 +169,25 @@ void audioSDL::sdlAudioCallback( void * _udata, Uint8 * _buf, int _len ) void audioSDL::sdlAudioCallback( Uint8 * _buf, int _len ) { + if( m_stopped ) + { + memset( _buf, 0, _len ); + return; + } + while( _len ) { if( m_convertedBuf_pos == 0 ) { // frames depend on the sample rate const fpab_t frames = getNextBuffer( m_outBuf ); + if( !frames ) + { + m_stopped = TRUE; + m_stop_semaphore--; + memset( _buf, 0, _len ); + return; + } m_convertedBuf_size = frames * channels() * sizeof( int_sample_t ); diff --git a/src/core/arp_and_chords_tab_widget.cpp b/src/core/arp_and_chords_tab_widget.cpp index 30b88f102..94aaee54b 100644 --- a/src/core/arp_and_chords_tab_widget.cpp +++ b/src/core/arp_and_chords_tab_widget.cpp @@ -194,18 +194,18 @@ const int ARP_GROUPBOX_HEIGHT = 240 - ARP_GROUPBOX_Y; -arpAndChordsTabWidget::arpAndChordsTabWidget( instrumentTrack * _instrument_track ) : - QWidget( _instrument_track->tabWidgetParent() ), - journallingObject( _instrument_track->eng() ) +arpAndChordsTabWidget::arpAndChordsTabWidget( + instrumentTrack * _instrument_track ) : + QWidget( _instrument_track->tabWidgetParent() ) { - m_chordsGroupBox = new groupBox( tr( "CHORDS" ), this, eng(), + m_chordsGroupBox = new groupBox( tr( "CHORDS" ), this, _instrument_track ); m_chordsGroupBox->setGeometry( CHORDS_GROUPBOX_X, CHORDS_GROUPBOX_Y, CHORDS_GROUPBOX_WIDTH, CHORDS_GROUPBOX_HEIGHT ); m_chordsComboBox = new comboBox( m_chordsGroupBox, tr( "Chord type" ), - eng(), _instrument_track ); + _instrument_track ); m_chordsComboBox->setFont( pointSize<8>( m_chordsComboBox->font() ) ); m_chordsComboBox->setGeometry( 10, 25, 140, 22 ); @@ -219,8 +219,8 @@ arpAndChordsTabWidget::arpAndChordsTabWidget( instrumentTrack * _instrument_trac } m_chordRangeKnob = new knob( knobBright_26, m_chordsGroupBox, - tr( "Chord range" ), - eng(), _instrument_track ); + tr( "Chord range" ), + _instrument_track ); m_chordRangeKnob->setLabel( tr( "RANGE" ) ); m_chordRangeKnob->setRange( 1.0f, 9.0f, 1.0f ); m_chordRangeKnob->setInitValue( 1.0f ); @@ -239,7 +239,7 @@ arpAndChordsTabWidget::arpAndChordsTabWidget( instrumentTrack * _instrument_trac - m_arpGroupBox = new groupBox( tr( "ARPEGGIO" ), this, eng(), + m_arpGroupBox = new groupBox( tr( "ARPEGGIO" ), this, _instrument_track ); m_arpGroupBox->setGeometry( ARP_GROUPBOX_X, ARP_GROUPBOX_Y, ARP_GROUPBOX_WIDTH, @@ -259,7 +259,7 @@ arpAndChordsTabWidget::arpAndChordsTabWidget( instrumentTrack * _instrument_trac "major or minor triads. But there're a lot of other " "possible chords, you can select." ) ); m_arpComboBox = new comboBox( m_arpGroupBox, tr( "Arpeggio type" ), - eng(), _instrument_track ); + _instrument_track ); m_arpComboBox->setFont( pointSize<8>( m_arpComboBox->font() ) ); m_arpComboBox->setGeometry( 10, 25, 140, 22 ); @@ -274,8 +274,8 @@ arpAndChordsTabWidget::arpAndChordsTabWidget( instrumentTrack * _instrument_trac m_arpRangeKnob = new knob( knobBright_26, m_arpGroupBox, - tr( "Arpeggio range" ), - eng(), _instrument_track ); + tr( "Arpeggio range" ), + _instrument_track ); m_arpRangeKnob->setLabel( tr( "RANGE" ) ); m_arpRangeKnob->setRange( 1.0f, 9.0f, 1.0f ); m_arpRangeKnob->setInitValue( 1.0f ); @@ -292,8 +292,8 @@ arpAndChordsTabWidget::arpAndChordsTabWidget( instrumentTrack * _instrument_trac "amount of octaves." ) ); m_arpTimeKnob = new tempoSyncKnob( knobBright_26, m_arpGroupBox, - tr( "Arpeggio time" ), - eng(), _instrument_track ); + tr( "Arpeggio time" ), + _instrument_track ); m_arpTimeKnob->setLabel( tr( "TIME" ) ); m_arpTimeKnob->setRange( 25.0f, 2000.0f, 1.0f ); m_arpTimeKnob->setInitValue( 100.0f ); @@ -310,8 +310,8 @@ arpAndChordsTabWidget::arpAndChordsTabWidget( instrumentTrack * _instrument_trac "each arpeggio-tone should be played." ) ); m_arpGateKnob = new knob( knobBright_26, m_arpGroupBox, - tr( "Arpeggio gate" ), - eng(), _instrument_track ); + tr( "Arpeggio gate" ), + _instrument_track ); m_arpGateKnob->setLabel( tr( "GATE" ) ); m_arpGateKnob->setRange( 1.0f, 200.0f, 1.0f ); m_arpGateKnob->setInitValue( 100.0f ); @@ -334,7 +334,7 @@ arpAndChordsTabWidget::arpAndChordsTabWidget( instrumentTrack * _instrument_trac pixmapButton * arp_up_btn = new pixmapButton( m_arpGroupBox, NULL, - eng(), NULL ); + NULL ); arp_up_btn->move( 10, 74 ); arp_up_btn->setActiveGraphic( embed::getIconPixmap( "arp_up_on" ) ); arp_up_btn->setInactiveGraphic( embed::getIconPixmap( "arp_up_off" ) ); @@ -345,7 +345,7 @@ arpAndChordsTabWidget::arpAndChordsTabWidget( instrumentTrack * _instrument_trac pixmapButton * arp_down_btn = new pixmapButton( m_arpGroupBox, NULL, - eng(), NULL ); + NULL ); arp_down_btn->move( 30, 74 ); arp_down_btn->setActiveGraphic( embed::getIconPixmap( "arp_down_on" ) ); arp_down_btn->setInactiveGraphic( embed::getIconPixmap( @@ -357,7 +357,7 @@ arpAndChordsTabWidget::arpAndChordsTabWidget( instrumentTrack * _instrument_trac pixmapButton * arp_up_and_down_btn = new pixmapButton( m_arpGroupBox, - NULL, eng(), NULL ); + NULL, NULL ); arp_up_and_down_btn->move( 50, 74 ); arp_up_and_down_btn->setActiveGraphic( embed::getIconPixmap( "arp_up_and_down_on" ) ); @@ -371,7 +371,7 @@ arpAndChordsTabWidget::arpAndChordsTabWidget( instrumentTrack * _instrument_trac pixmapButton * arp_random_btn = new pixmapButton( m_arpGroupBox, NULL, - eng(), NULL ); + NULL ); arp_random_btn->move( 70, 74 ); arp_random_btn->setActiveGraphic( embed::getIconPixmap( "arp_random_on" ) ); @@ -384,7 +384,7 @@ arpAndChordsTabWidget::arpAndChordsTabWidget( instrumentTrack * _instrument_trac m_arpDirectionBtnGrp = new automatableButtonGroup( this, tr( "Arpeggio direction" ), - eng(), _instrument_track ); + _instrument_track ); m_arpDirectionBtnGrp->addButton( arp_up_btn ); m_arpDirectionBtnGrp->addButton( arp_down_btn ); m_arpDirectionBtnGrp->addButton( arp_up_and_down_btn ); @@ -398,7 +398,7 @@ arpAndChordsTabWidget::arpAndChordsTabWidget( instrumentTrack * _instrument_trac mode_lbl->setFont( pointSize<7>( mode_lbl->font() ) ); m_arpModeComboBox = new comboBox( m_arpGroupBox, tr( "Arpeggio mode" ), - eng(), _instrument_track ); + _instrument_track ); m_arpModeComboBox->setFont( pointSize<8>( m_arpModeComboBox->font() ) ); m_arpModeComboBox->setGeometry( 10, 118, 128, 22 ); @@ -461,14 +461,14 @@ void arpAndChordsTabWidget::processNote( notePlayHandle * _n ) break; } // create copy of base-note - note note_copy( NULL, _n->length(), 0, + note note_copy( _n->length(), 0, (tones)( sub_note_key % NOTES_PER_OCTAVE ), (octaves)( sub_note_key / NOTES_PER_OCTAVE ), _n->getVolume(), - _n->getPanning() ); - note_copy.setDetuning( _n->detuning() ); + _n->getPanning(), + _n->detuning() ); // duplicate note-play-handle, only note is // different notePlayHandle * note_play_handle = @@ -524,7 +524,7 @@ void arpAndChordsTabWidget::processNote( notePlayHandle * _n ) // number of frames that every note should be played const f_cnt_t arp_frames = (f_cnt_t)( m_arpTimeKnob->value() / 1000.0f * - eng()->getMixer()->sampleRate() ); + engine::getMixer()->sampleRate() ); const f_cnt_t gated_frames = (f_cnt_t)( m_arpGateKnob->value() * arp_frames / 100.0f ); @@ -537,13 +537,13 @@ void arpAndChordsTabWidget::processNote( notePlayHandle * _n ) // used for loop f_cnt_t frames_processed = 0; - while( frames_processed < eng()->getMixer()->framesPerAudioBuffer() ) + while( frames_processed < engine::getMixer()->framesPerAudioBuffer() ) { const f_cnt_t remaining_frames_for_cur_arp = arp_frames - ( cur_frame % arp_frames ); // does current arp-note fill whole audio-buffer? if( remaining_frames_for_cur_arp > - eng()->getMixer()->framesPerAudioBuffer() ) + engine::getMixer()->framesPerAudioBuffer() ) { // then we don't have to do something! break; @@ -609,7 +609,8 @@ void arpAndChordsTabWidget::processNote( notePlayHandle * _n ) // range-checking if( sub_note_key >= NOTES_PER_OCTAVE * OCTAVES || - sub_note_key < 0 || eng()->getMixer()->criticalXRuns() ) + sub_note_key < 0 || + engine::getMixer()->criticalXRuns() ) { continue; } @@ -621,15 +622,14 @@ void arpAndChordsTabWidget::processNote( notePlayHandle * _n ) } // create new arp-note - note new_note( NULL, midiTime( 0 ), midiTime( 0 ), + note new_note( midiTime( 0 ), midiTime( 0 ), static_cast( sub_note_key % NOTES_PER_OCTAVE ), static_cast( sub_note_key / NOTES_PER_OCTAVE ), static_cast( _n->getVolume() * vol_level ), - _n->getPanning() ); - new_note.setDetuning( _n->detuning() ); + _n->getPanning(), _n->detuning() ); // duplicate note-play-handle, only ptr to note is different // and is_arp_note=TRUE diff --git a/src/core/automation_editor.cpp b/src/core/automation_editor.cpp index 4dff2d270..b17156fa5 100644 --- a/src/core/automation_editor.cpp +++ b/src/core/automation_editor.cpp @@ -85,9 +85,8 @@ QPixmap * automationEditor::s_toolSelect = NULL; QPixmap * automationEditor::s_toolMove = NULL; -automationEditor::automationEditor( engine * _engine ) : - QWidget( _engine->getMainWindow()->workspace() ), - journallingObject( _engine ), +automationEditor::automationEditor( void ) : + QWidget( engine::getMainWindow()->workspace() ), m_paintPixmap(), m_pattern( NULL ), m_min_level( 0 ), @@ -129,14 +128,14 @@ automationEditor::automationEditor( engine * _engine ) : #ifdef QT4 // add us to workspace - eng()->getMainWindow()->workspace()->addWindow( this ); + engine::getMainWindow()->workspace()->addWindow( this ); #endif // add time-line m_timeLine = new timeLine( VALUES_WIDTH, 32, m_ppt, - eng()->getSongEditor()->getPlayPos( + engine::getSongEditor()->getPlayPos( songEditor::PLAY_AUTOMATION_PATTERN ), - m_currentPosition, this, eng() ); + m_currentPosition, this ); connect( this, SIGNAL( positionChanged( const midiTime & ) ), m_timeLine, SLOT( updatePosition( const midiTime & ) ) ); connect( m_timeLine, SIGNAL( positionChanged( const midiTime & ) ), @@ -321,7 +320,7 @@ automationEditor::automationEditor( engine * _engine ) : QLabel * zoom_x_lbl = new QLabel( m_toolBar ); zoom_x_lbl->setPixmap( embed::getIconPixmap( "zoom_x" ) ); - m_zoomingXComboBox = new comboBox( m_toolBar, NULL, eng(), NULL ); + m_zoomingXComboBox = new comboBox( m_toolBar, NULL, NULL ); m_zoomingXComboBox->setFixedSize( 80, 22 ); for( int i = 0; i < 6; ++i ) { @@ -335,7 +334,7 @@ automationEditor::automationEditor( engine * _engine ) : QLabel * zoom_y_lbl = new QLabel( m_toolBar ); zoom_y_lbl->setPixmap( embed::getIconPixmap( "zoom_y" ) ); - m_zoomingYComboBox = new comboBox( m_toolBar, NULL, eng(), NULL ); + m_zoomingYComboBox = new comboBox( m_toolBar, NULL, NULL ); m_zoomingYComboBox->setFixedSize( 80, 22 ); m_zoomingYComboBox->addItem( "Auto" ); for( int i = 0; i < 6; ++i ) @@ -351,7 +350,7 @@ automationEditor::automationEditor( engine * _engine ) : QLabel * quantize_lbl = new QLabel( m_toolBar ); quantize_lbl->setPixmap( embed::getIconPixmap( "quantize" ) ); - m_quantizeComboBox = new comboBox( m_toolBar, NULL, eng(), NULL ); + m_quantizeComboBox = new comboBox( m_toolBar, NULL, NULL ); m_quantizeComboBox->setFixedSize( 60, 22 ); for( int i = 0; i < 7; ++i ) { @@ -737,7 +736,7 @@ void automationEditor::updatePaintPixmap( void ) is_selected = TRUE; } } - else if( level > sel_level_start && + else if( level >= sel_level_start && level <= sel_level_end && pos_tact_64th >= sel_pos_start && pos_tact_64th + len_tact_64th <= @@ -975,7 +974,7 @@ void automationEditor::keyPressEvent( QKeyEvent * _ke ) break; case Qt::Key_Space: - if( eng()->getSongEditor()->playing() ) + if( engine::getSongEditor()->playing() ) { stop(); } @@ -1095,7 +1094,7 @@ void automationEditor::mousePressEvent( QMouseEvent * _me ) QCursor c( Qt::SizeAllCursor ); QApplication::setOverrideCursor( c ); - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); } else if( ( _me->button() == Qt::RightButton && m_editMode == DRAW ) || @@ -1106,7 +1105,7 @@ void automationEditor::mousePressEvent( QMouseEvent * _me ) if( it != time_map.end() ) { m_pattern->removeValue( -it.key() ); - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); } } else if( _me->button() == Qt::LeftButton && @@ -1140,7 +1139,7 @@ void automationEditor::mousePressEvent( QMouseEvent * _me ) m_action = MOVE_SELECTION; - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); } else if( _me->button() == Qt::RightButton && m_editMode == MOVE ) @@ -1222,7 +1221,7 @@ void automationEditor::mouseMoveEvent( QMouseEvent * _me ) level ); } - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); } else if( @@ -1658,9 +1657,9 @@ void automationEditor::resizeEvent( QResizeEvent * ) m_topBottomScroll->setValue( m_scroll_level ); - if( eng()->getSongEditor() ) + if( engine::getSongEditor() ) { - eng()->getSongEditor()->getPlayPos( + engine::getSongEditor()->getPlayPos( songEditor::PLAY_AUTOMATION_PATTERN ).m_timeLine->setFixedWidth( width() ); } @@ -1676,7 +1675,7 @@ void automationEditor::resizeEvent( QResizeEvent * ) void automationEditor::wheelEvent( QWheelEvent * _we ) { _we->accept(); - if( eng()->getMainWindow()->isCtrlPressed() == TRUE ) + if( engine::getMainWindow()->isCtrlPressed() == TRUE ) { if( _we->delta() > 0 ) { @@ -1696,7 +1695,7 @@ void automationEditor::wheelEvent( QWheelEvent * _we ) m_timeLine->setPixelsPerTact( m_ppt ); update(); } - else if( eng()->getMainWindow()->isShiftPressed() ) + else if( engine::getMainWindow()->isShiftPressed() ) { m_leftRightScroll->setValue( m_leftRightScroll->value() - _we->delta() * 2 / 15 ); @@ -1745,23 +1744,23 @@ void automationEditor::play( void ) if( !m_pattern->getTrack() ) { - if( eng()->getSongEditor()->playMode() != + if( engine::getSongEditor()->playMode() != songEditor::PLAY_PATTERN ) { - eng()->getSongEditor()->stop(); - eng()->getSongEditor()->playPattern( (pattern *) - eng()->getPianoRoll()->currentPattern() ); + engine::getSongEditor()->stop(); + engine::getSongEditor()->playPattern( (pattern *) + engine::getPianoRoll()->currentPattern() ); m_playButton->setIcon( embed::getIconPixmap( "pause" ) ); } - else if( eng()->getSongEditor()->playing() ) + else if( engine::getSongEditor()->playing() ) { - eng()->getSongEditor()->pause(); + engine::getSongEditor()->pause(); m_playButton->setIcon( embed::getIconPixmap( "play" ) ); } - else if( eng()->getSongEditor()->paused() ) + else if( engine::getSongEditor()->paused() ) { - eng()->getSongEditor()->resumeFromPause(); + engine::getSongEditor()->resumeFromPause(); m_playButton->setIcon( embed::getIconPixmap( "pause" ) ); } @@ -1769,13 +1768,13 @@ void automationEditor::play( void ) { m_playButton->setIcon( embed::getIconPixmap( "pause" ) ); - eng()->getSongEditor()->playPattern( (pattern *) - eng()->getPianoRoll()->currentPattern() ); + engine::getSongEditor()->playPattern( (pattern *) + engine::getPianoRoll()->currentPattern() ); } } else if( inBBEditor() ) { - if( eng()->getSongEditor()->playing() ) + if( engine::getSongEditor()->playing() ) { m_playButton->setIcon( embed::getIconPixmap( "play" ) ); } @@ -1784,18 +1783,18 @@ void automationEditor::play( void ) m_playButton->setIcon( embed::getIconPixmap( "pause" ) ); } - eng()->getBBEditor()->play(); + engine::getBBEditor()->play(); } else { - if( eng()->getSongEditor()->playing() ) + if( engine::getSongEditor()->playing() ) { - eng()->getSongEditor()->pause(); + engine::getSongEditor()->pause(); m_playButton->setIcon( embed::getIconPixmap( "play" ) ); } - else if( eng()->getSongEditor()->paused() ) + else if( engine::getSongEditor()->paused() ) { - eng()->getSongEditor()->resumeFromPause(); + engine::getSongEditor()->resumeFromPause(); m_playButton->setIcon( embed::getIconPixmap( "pause" ) ); } @@ -1803,7 +1802,7 @@ void automationEditor::play( void ) { m_playButton->setIcon( embed::getIconPixmap( "pause" ) ); - eng()->getSongEditor()->play(); + engine::getSongEditor()->play(); } } } @@ -1819,11 +1818,11 @@ void automationEditor::stop( void ) } if( m_pattern->getTrack() && inBBEditor() ) { - eng()->getBBEditor()->stop(); + engine::getBBEditor()->stop(); } else { - eng()->getSongEditor()->stop(); + engine::getSongEditor()->stop(); } m_playButton->setIcon( embed::getIconPixmap( "play" ) ); m_playButton->update(); @@ -1979,9 +1978,9 @@ void automationEditor::getSelectedValues( timeMap & _selected_values ) #endif Sint32 pos_tact_64th = -it.key(); - if( level > sel_level_start && level <= sel_level_end && + if( level >= sel_level_start && level <= sel_level_end && pos_tact_64th >= sel_pos_start && - pos_tact_64th+len_tact_64th <= sel_pos_end ) + pos_tact_64th + len_tact_64th <= sel_pos_end ) { _selected_values[it.key()] = level; } @@ -2033,7 +2032,7 @@ void automationEditor::cutSelectedValues( void ) if( !selected_values.isEmpty() ) { - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); for( timeMap::iterator it = selected_values.begin(); it != selected_values.end(); ++it ) @@ -2048,7 +2047,7 @@ void automationEditor::cutSelectedValues( void ) } update(); - eng()->getSongEditor()->update(); + engine::getSongEditor()->update(); } @@ -2076,9 +2075,9 @@ void automationEditor::pasteValues( void ) // we only have to do the following lines if we pasted at // least one value... - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); update(); - eng()->getSongEditor()->update(); + engine::getSongEditor()->update(); } } @@ -2105,9 +2104,9 @@ void automationEditor::deleteSelectedValues( void ) if( update_after_delete == TRUE ) { - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); update(); - eng()->getSongEditor()->update(); + engine::getSongEditor()->update(); } } @@ -2116,8 +2115,8 @@ void automationEditor::deleteSelectedValues( void ) void automationEditor::updatePosition( const midiTime & _t ) { - if( ( eng()->getSongEditor()->playing() && - eng()->getSongEditor()->playMode() == + if( ( engine::getSongEditor()->playing() && + engine::getSongEditor()->playMode() == songEditor::PLAY_AUTOMATION_PATTERN ) || m_scrollBack == TRUE ) { @@ -2228,7 +2227,7 @@ void automationEditor::updateTopBottomLevels( void ) inline bool automationEditor::inBBEditor( void ) { return( m_pattern->getTrack()->getTrackContainer() - == eng()->getBBEditor() ); + == engine::getBBEditor() ); } @@ -2240,7 +2239,7 @@ void automationEditor::update( void ) // Note detuning? if( m_pattern && !m_pattern->getTrack() ) { - eng()->getPianoRoll()->update(); + engine::getPianoRoll()->update(); } } diff --git a/src/core/bb_editor.cpp b/src/core/bb_editor.cpp index 00a296147..8ac9fbdea 100644 --- a/src/core/bb_editor.cpp +++ b/src/core/bb_editor.cpp @@ -3,7 +3,7 @@ /* * bb_editor.cpp - basic main-window for editing of beats and basslines * - * Copyright (c) 2004-2006 Tobias Doerffel + * Copyright (c) 2004-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -62,8 +62,7 @@ const int BBE_PPT = 192; -bbEditor::bbEditor( engine * _engine ) : - trackContainer( _engine ) +bbEditor::bbEditor( void ) { // create toolbar m_toolBar = new QWidget( this ); @@ -91,7 +90,7 @@ bbEditor::bbEditor( engine * _engine ) : DEFAULT_SCROLLBAR_SIZE ); QWidget * w = ( parentWidget() != NULL ) ? parentWidget() : this; - if( eng()->getMainWindow()->workspace() != NULL ) + if( engine::getMainWindow()->workspace() != NULL ) { resize( minimumWidth(), 300 ); w->move( 10, 340 ); @@ -117,7 +116,7 @@ bbEditor::bbEditor( engine * _engine ) : toolButton * add_bb_track = new toolButton( embed::getIconPixmap( "add_bb_track" ), tr( "Add beat/bassline" ), - eng()->getSongEditor(), SLOT( addBBTrack() ), + engine::getSongEditor(), SLOT( addBBTrack() ), m_toolBar ); @@ -140,7 +139,7 @@ bbEditor::bbEditor( engine * _engine ) : QLabel * l = new QLabel( m_toolBar ); l->setPixmap( embed::getIconPixmap( "drum" ) ); - m_bbComboBox = new comboBox( m_toolBar, NULL, eng(), NULL ); + m_bbComboBox = new comboBox( m_toolBar, NULL, NULL ); m_bbComboBox->setFixedSize( 200, 22 ); connect( m_bbComboBox, SIGNAL( valueChanged( int ) ), this, SLOT( setCurrentBB( int ) ) ); @@ -193,7 +192,7 @@ void bbEditor::setCurrentBB( int _bb ) // the others green) for( csize i = 0; i < numOfBBs(); ++i ) { - bbTrack::findBBTrack( i, eng() )->trackLabel()->update(); + bbTrack::findBBTrack( i )->trackLabel()->update(); } emit positionChanged( m_currentPosition = midiTime( @@ -257,7 +256,7 @@ bool FASTCALL bbEditor::play( midiTime _start, fpab_t _frames, csize bbEditor::numOfBBs( void ) const { - return( eng()->getSongEditor()->countTracks( track::BB_TRACK ) ); + return( engine::getSongEditor()->countTracks( track::BB_TRACK ) ); } @@ -281,7 +280,7 @@ void bbEditor::removeBB( csize _bb ) void bbEditor::updateBBTrack( trackContentObject * _tco ) { - bbTrack * t = bbTrack::findBBTrack( _tco->startPosition() / 64, eng() ); + bbTrack * t = bbTrack::findBBTrack( _tco->startPosition() / 64 ); if( t != NULL ) { t->getTrackContentWidget()->updateTCOs(); @@ -302,7 +301,7 @@ void bbEditor::updateComboBox( void ) for( csize i = 0; i < numOfBBs(); ++i ) { - bbTrack * bbt = bbTrack::findBBTrack( i, eng() ); + bbTrack * bbt = bbTrack::findBBTrack( i ); m_bbComboBox->addItem( bbt->trackLabel()->text(), bbt->trackLabel()->pixmap() ); } @@ -330,7 +329,7 @@ void bbEditor::keyPressEvent( QKeyEvent * _ke ) { if ( _ke->key() == Qt::Key_Space ) { - if( eng()->getSongEditor()->playing() ) + if( engine::getSongEditor()->playing() ) { stop(); } @@ -388,31 +387,31 @@ QRect bbEditor::scrollAreaRect( void ) const void bbEditor::play( void ) { - if( eng()->getSongEditor()->playing() ) + if( engine::getSongEditor()->playing() ) { - if( eng()->getSongEditor()->playMode() != songEditor::PLAY_BB ) + if( engine::getSongEditor()->playMode() != songEditor::PLAY_BB ) { - eng()->getSongEditor()->stop(); - eng()->getSongEditor()->playBB(); + engine::getSongEditor()->stop(); + engine::getSongEditor()->playBB(); m_playButton->setIcon( embed::getIconPixmap( "pause" ) ); } else { - eng()->getSongEditor()->pause(); + engine::getSongEditor()->pause(); m_playButton->setIcon( embed::getIconPixmap( "play" ) ); } } - else if( eng()->getSongEditor()->paused() ) + else if( engine::getSongEditor()->paused() ) { - eng()->getSongEditor()->resumeFromPause(); + engine::getSongEditor()->resumeFromPause(); m_playButton->setIcon( embed::getIconPixmap( "pause" ) ); } else { m_playButton->setIcon( embed::getIconPixmap( "pause" ) ); - eng()->getSongEditor()->playBB(); + engine::getSongEditor()->playBB(); } } @@ -422,7 +421,7 @@ void bbEditor::play( void ) void bbEditor::stop( void ) { - eng()->getSongEditor()->stop(); + engine::getSongEditor()->stop(); m_playButton->setIcon( embed::getIconPixmap( "play" ) ); m_playButton->update(); } diff --git a/src/core/effect.cpp b/src/core/effect.cpp index 2032aa604..071198adf 100644 --- a/src/core/effect.cpp +++ b/src/core/effect.cpp @@ -3,8 +3,8 @@ /* * effect.cpp - base-class for effects * - * Copyright (c) 2006 Danny McRae - * Copyright (c) 2006 Tobias Doerffel + * Copyright (c) 2006-2007 Danny McRae + * Copyright (c) 2006-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -37,12 +37,14 @@ #include "effect.h" +#include "engine.h" #include "dummy_effect.h" -effect::effect( const plugin::descriptor * _desc, constructionData * _cdata ) : - plugin( _desc, _cdata->eng ), - m_key( _cdata->key ), +effect::effect( const plugin::descriptor * _desc, + const descriptor::subPluginFeatures::key * _key ) : + plugin( _desc ), + m_key( *_key ), m_okay( TRUE ), m_noRun( FALSE ), m_running( FALSE ), @@ -77,15 +79,15 @@ void FASTCALL effect::setGate( float _level ) { m_processLock.lock(); m_gate = _level * _level * m_processors * - eng()->getMixer()->framesPerAudioBuffer(); + engine::getMixer()->framesPerAudioBuffer(); m_processLock.unlock(); } effect * effect::instantiate( const QString & _plugin_name, - constructionData & _cdata ) + descriptor::subPluginFeatures::key * _key ) { - plugin * p = plugin::instantiate( _plugin_name, &_cdata ); + plugin * p = plugin::instantiate( _plugin_name, _key ); // check whether instantiated plugin is an instrument if( dynamic_cast( p ) != NULL ) { diff --git a/src/core/effect_chain.cpp b/src/core/effect_chain.cpp index 6fb7a41fd..693b13fb9 100644 --- a/src/core/effect_chain.cpp +++ b/src/core/effect_chain.cpp @@ -3,7 +3,7 @@ /* * effect_chain.cpp - class for processing and effects chain * - * Copyright (c) 2006 Danny McRae + * Copyright (c) 2006-2007 Danny McRae * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -27,8 +27,7 @@ #include "effect_chain.h" -effectChain::effectChain( engine * _engine ): - engineObject( _engine ), +effectChain::effectChain( void ) : m_bypassed( TRUE ) { } diff --git a/src/core/effect_control_dialog.cpp b/src/core/effect_control_dialog.cpp index c7d94aceb..8b784f4f4 100644 --- a/src/core/effect_control_dialog.cpp +++ b/src/core/effect_control_dialog.cpp @@ -4,7 +4,7 @@ * effect_control_dialog.cpp - base-class for effect-dialogs for displaying * and editing control port values * - * Copyright (c) 2006 Tobias Doerffel + * Copyright (c) 2006-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -48,7 +48,6 @@ effectControlDialog::effectControlDialog( QWidget * _parent, effect * _eff ) : , "effectControlDialog" #endif ), - journallingObject( _eff->eng() ), m_effect( _eff ) { setWindowTitle( m_effect->publicName() ); diff --git a/src/core/effect_select_dialog.cpp b/src/core/effect_select_dialog.cpp index 1bed2014a..b31984f7c 100644 --- a/src/core/effect_select_dialog.cpp +++ b/src/core/effect_select_dialog.cpp @@ -47,9 +47,8 @@ #include "embed.h" -effectSelectDialog::effectSelectDialog( QWidget * _parent, engine * _engine ) : - QDialog( _parent ), - engineObject( _engine ) +effectSelectDialog::effectSelectDialog( QWidget * _parent ) : + QDialog( _parent ) { setWindowIcon( embed::getIconPixmap( "setup_audio" ) ); setWindowTitle( tr( "Effects Selector" ) ); @@ -59,7 +58,7 @@ effectSelectDialog::effectSelectDialog( QWidget * _parent, engine * _engine ) : vlayout->setSpacing( 10 ); vlayout->setMargin( 10 ); - effectList * elist = new effectList( this, eng() ); + effectList * elist = new effectList( this ); elist->setMinimumSize( 500, 400 ); connect( elist, SIGNAL( doubleClicked( const effectKey & ) ), this, SLOT( selectPlugin() ) ); @@ -123,13 +122,8 @@ effect * effectSelectDialog::instantiateSelectedPlugin( void ) { if( !m_currentSelection.name.isEmpty() && m_currentSelection.desc ) { - effect::constructionData cd = - { - eng(), - m_currentSelection - } ; return( effect::instantiate( m_currentSelection.desc->name, - cd ) ); + &m_currentSelection ) ); } return( NULL ); } @@ -139,7 +133,7 @@ effect * effectSelectDialog::instantiateSelectedPlugin( void ) void effectSelectDialog::showPorts( void ) { -/* ladspaPortDialog ports( m_currentSelection, eng() ); +/* ladspaPortDialog ports( m_currentSelection ); ports.exec();*/ } @@ -165,9 +159,8 @@ void effectSelectDialog::selectPlugin( void ) -effectList::effectList( QWidget * _parent, engine * _engine ) : - QWidget( _parent ), - engineObject( _engine ) +effectList::effectList( QWidget * _parent ) : + QWidget( _parent ) { plugin::getDescriptorsOfAvailPlugins( m_pluginDescriptors ); @@ -181,7 +174,7 @@ effectList::effectList( QWidget * _parent, engine * _engine ) : } if( it->sub_plugin_features ) { - it->sub_plugin_features->listSubPluginKeys( eng(), + it->sub_plugin_features->listSubPluginKeys( // as iterators are always stated to be not // equal with pointers, we dereference the // iterator and take the address of the item, @@ -267,7 +260,7 @@ void effectList::onHighlighted( int _pluginIndex ) { m_currentSelection.desc->sub_plugin_features-> fillDescriptionWidget( m_descriptionWidget, - eng(), m_currentSelection ); + &m_currentSelection ); m_descriptionWidget->show(); } emit( highlighted( m_currentSelection ) ); diff --git a/src/core/effect_tab_widget.cpp b/src/core/effect_tab_widget.cpp index 09ff64d38..a6a4e1339 100644 --- a/src/core/effect_tab_widget.cpp +++ b/src/core/effect_tab_widget.cpp @@ -4,7 +4,7 @@ * effect_tab_widget.cpp - tab-widget in channel-track-window for setting up * effects * - * Copyright (c) 2006 Danny McRae + * Copyright (c) 2006-2007 Danny McRae * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -59,7 +59,6 @@ effectTabWidget::effectTabWidget( instrumentTrack * _track, audioPort * _port ) : QWidget( _track->tabWidgetParent() ), - journallingObject( _track->eng() ), m_track( dynamic_cast( _track ) ), m_port( _port ) { @@ -73,7 +72,6 @@ effectTabWidget::effectTabWidget( QWidget * _parent, sampleTrack * _track, audioPort * _port ) : QWidget( _parent ), - journallingObject( _track->eng() ), m_track( dynamic_cast( _track ) ), m_port( _port ) { @@ -92,13 +90,13 @@ effectTabWidget::~effectTabWidget() void effectTabWidget::setupWidget( void ) { - m_effectsGroupBox = new groupBox( tr( "EFFECTS CHAIN" ), - this, eng(), m_track ); + m_effectsGroupBox = new groupBox( tr( "EFFECTS CHAIN" ), this, + m_track ); connect( m_effectsGroupBox, SIGNAL( toggled( bool ) ), this, SLOT( setBypass( bool ) ) ); m_effectsGroupBox->setGeometry( 2, 2, 242, 244 ); - m_rack = new rackView( m_effectsGroupBox, eng(), m_track, m_port ); + m_rack = new rackView( m_effectsGroupBox, m_track, m_port ); m_rack->move( 6, 22 ); m_addButton = new QPushButton( m_effectsGroupBox/*, "Add Effect"*/ ); @@ -145,7 +143,7 @@ void effectTabWidget::loadSettings( const QDomElement & _this ) void effectTabWidget::addEffect( void ) { - effectSelectDialog esd( this, eng() ); + effectSelectDialog esd( this ); esd.exec(); if( esd.result() == QDialog::Rejected ) diff --git a/src/core/engine.cpp b/src/core/engine.cpp index 31d9c7c63..2d8a34493 100644 --- a/src/core/engine.cpp +++ b/src/core/engine.cpp @@ -42,75 +42,80 @@ #endif -engine::engine( const bool _has_gui ) : - m_hasGUI( _has_gui ), - m_mixer( NULL ), - m_mainWindow( NULL ), - m_songEditor( NULL ), - m_automationEditor( NULL ), - m_bbEditor( NULL ), - m_pianoRoll( NULL ), - m_projectJournal( NULL ) +bool engine::s_hasGUI = TRUE; +float engine::s_frames_per_tact64th; +mixer * engine::s_mixer; +mainWindow * engine::s_mainWindow; +songEditor * engine::s_songEditor; +automationEditor * engine::s_automationEditor; +bbEditor * engine::s_bbEditor; +pianoRoll * engine::s_pianoRoll; +projectNotes * engine::s_projectNotes; +projectJournal * engine::s_projectJournal; +#ifdef LADSPA_SUPPORT +ladspa2LMMS * engine::s_ladspaManager; +#endif +QMap engine::s_sample_extensions; + + + + +void engine::init( const bool _has_gui ) { + s_hasGUI = _has_gui; + load_extensions(); - m_projectJournal = new projectJournal( this ); - m_mainWindow = new mainWindow( this ); - m_mixer = new mixer( this ); - m_songEditor = new songEditor( this ); - m_projectNotes = new projectNotes( this ); - m_bbEditor = new bbEditor( this ); - m_pianoRoll = new pianoRoll( this ); - m_automationEditor = new automationEditor( this ); + s_projectJournal = new projectJournal; + s_mainWindow = new mainWindow; + s_mixer = new mixer; + s_songEditor = new songEditor; + s_projectNotes = new projectNotes; + s_bbEditor = new bbEditor; + s_pianoRoll = new pianoRoll; + s_automationEditor = new automationEditor; #ifdef LADSPA_SUPPORT - m_ladspaManager = new ladspa2LMMS( this ); + s_ladspaManager = new ladspa2LMMS; #endif - m_mixer->initDevices(); + s_mixer->initDevices(); - m_mainWindow->finalize(); + s_mainWindow->finalize(); - m_mixer->startProcessing(); + s_mixer->startProcessing(); } -engine::~engine() +void engine::destroy( void ) { -} + s_mixer->stopProcessing(); + delete s_projectNotes; + s_projectNotes = NULL; + delete s_songEditor; + s_songEditor = NULL; + delete s_bbEditor; + s_bbEditor = NULL; + delete s_pianoRoll; + s_pianoRoll = NULL; + delete s_automationEditor; + s_automationEditor = NULL; - - -void engine::close( void ) -{ - m_mixer->stopProcessing(); - - delete m_projectNotes; - m_projectNotes = NULL; - delete m_songEditor; - m_songEditor = NULL; - delete m_bbEditor; - m_bbEditor = NULL; - delete m_pianoRoll; - m_pianoRoll = NULL; - delete m_automationEditor; - m_automationEditor = NULL; - - presetPreviewPlayHandle::cleanUp( this ); + presetPreviewPlayHandle::cleanUp(); // now we can clean up all allocated buffer //bufferAllocator::cleanUp( 0 ); - delete m_mixer; - m_mixer = NULL; + delete s_mixer; + s_mixer = NULL; //delete configManager::inst(); - delete m_projectJournal; - m_projectJournal = NULL; - m_mainWindow = NULL; + delete s_projectJournal; + s_projectJournal = NULL; + s_mainWindow = NULL; } @@ -118,8 +123,8 @@ void engine::close( void ) void engine::updateFramesPerTact64th( void ) { - m_frames_per_tact64th = m_mixer->sampleRate() * 60.0f * BEATS_PER_TACT - / 64.0f / m_songEditor->getTempo(); + s_frames_per_tact64th = s_mixer->sampleRate() * 60.0f * BEATS_PER_TACT + / 64.0f / s_songEditor->getTempo(); } @@ -144,7 +149,7 @@ void engine::load_extensions( void ) ext.begin(); itExt != ext.end(); ++itExt ) { - m_sample_extensions[*itExt] = it->name; + s_sample_extensions[*itExt] = it->name; } } } @@ -154,18 +159,4 @@ void engine::load_extensions( void ) - -engineObject::engineObject( engine * _engine ) : - m_engine( _engine ) -{ -} - - - - -engineObject::~engineObject() -{ -} - - #endif diff --git a/src/core/envelope_and_lfo_widget.cpp b/src/core/envelope_and_lfo_widget.cpp index 847e82250..d621ff1f4 100644 --- a/src/core/envelope_and_lfo_widget.cpp +++ b/src/core/envelope_and_lfo_widget.cpp @@ -4,7 +4,7 @@ * envelope_and_lfo_widget.cpp - widget which is m_used by envelope/lfo/filter- * tab of channel-window * - * Copyright (c) 2004-2006 Tobias Doerffel + * Copyright (c) 2004-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -100,17 +100,14 @@ const int LFO_SHAPES_Y = LFO_GRAPH_Y + 50; QPixmap * envelopeAndLFOWidget::s_envGraph = NULL; QPixmap * envelopeAndLFOWidget::s_lfoGraph = NULL; -QMap > - envelopeAndLFOWidget::s_EaLWidgets; +vvector envelopeAndLFOWidget::s_EaLWidgets; envelopeAndLFOWidget::envelopeAndLFOWidget( float _value_for_zero_amount, QWidget * _parent, - engine * _engine, track * _track ) : QWidget( _parent ), - journallingObject( _engine ), #ifdef QT4 specialBgHandlingWidget( palette().color( backgroundRole() ) ), #else @@ -123,7 +120,6 @@ envelopeAndLFOWidget::envelopeAndLFOWidget( float _value_for_zero_amount, m_lfoFrame( 0 ), m_lfoAmountIsZero( FALSE ), m_lfoShapeData( NULL ), - m_userWave( eng() ), m_lfoShape( SIN ), m_busyMutex( #ifdef QT3 @@ -143,11 +139,11 @@ envelopeAndLFOWidget::envelopeAndLFOWidget( float _value_for_zero_amount, s_lfoGraph = new QPixmap( embed::getIconPixmap( "lfo_graph" ) ); } - s_EaLWidgets[eng()].push_back( this ); + s_EaLWidgets.push_back( this ); m_predelayKnob = new knob( knobBright_26, this, tr( "Predelay-time" ), - eng(), _track ); + _track ); m_predelayKnob->setLabel( tr( "DEL" ) ); m_predelayKnob->setRange( 0.0, 1.0, 0.001 ); m_predelayKnob->setInitValue( 0.0 ); @@ -165,7 +161,7 @@ envelopeAndLFOWidget::envelopeAndLFOWidget( float _value_for_zero_amount, SLOT( updateAfterKnobChange( float ) ) ); m_attackKnob = new knob( knobBright_26, this, tr( "Attack-time" ), - eng(), _track ); + _track ); m_attackKnob->setLabel( tr( "ATT" ) ); m_attackKnob->setRange( 0.0, 1.0, 0.001 ); m_attackKnob->setInitValue( 0.0 ); @@ -184,8 +180,7 @@ envelopeAndLFOWidget::envelopeAndLFOWidget( float _value_for_zero_amount, connect( m_attackKnob, SIGNAL( valueChanged( float ) ), this, SLOT( updateAfterKnobChange( float ) ) ); - m_holdKnob = new knob( knobBright_26, this, tr( "Hold-time" ), - eng(), _track ); + m_holdKnob = new knob( knobBright_26, this, tr( "Hold-time" ), _track ); m_holdKnob->setLabel( tr( "HOLD" ) ); m_holdKnob->setRange( 0.0, 1.0, 0.001 ); m_holdKnob->setInitValue( 0.5 ); @@ -204,7 +199,7 @@ envelopeAndLFOWidget::envelopeAndLFOWidget( float _value_for_zero_amount, SLOT( updateAfterKnobChange( float ) ) ); m_decayKnob = new knob( knobBright_26, this, tr( "Decay-time" ), - eng(), _track ); + _track ); m_decayKnob->setLabel( tr( "DEC" ) ); m_decayKnob->setRange( 0.0, 1.0, 0.001 ); m_decayKnob->setInitValue( 0.5 ); @@ -224,7 +219,7 @@ envelopeAndLFOWidget::envelopeAndLFOWidget( float _value_for_zero_amount, SLOT( updateAfterKnobChange( float ) ) ); m_sustainKnob = new knob( knobBright_26, this, tr( "Sustain-level" ), - eng(), _track ); + _track ); m_sustainKnob->setLabel( tr( "SUST" ) ); m_sustainKnob->setRange( 0.0, 1.0, 0.001 ); m_sustainKnob->setInitValue( 0.5 ); @@ -243,7 +238,7 @@ envelopeAndLFOWidget::envelopeAndLFOWidget( float _value_for_zero_amount, SLOT( updateAfterKnobChange( float ) ) ); m_releaseKnob = new knob( knobBright_26, this, tr( "Release-time" ), - eng(), _track ); + _track ); m_releaseKnob->setLabel( tr( "REL" ) ); m_releaseKnob->setRange( 0.0, 1.0, 0.001 ); m_releaseKnob->setInitValue( 0.1 ); @@ -264,7 +259,7 @@ envelopeAndLFOWidget::envelopeAndLFOWidget( float _value_for_zero_amount, m_amountKnob = new knob( knobBright_26, this, tr( "Modulation amount" ), - eng(), _track ); + _track ); m_amountKnob->setLabel( tr( "AMT" ) ); m_amountKnob->setRange( -1.0, 1.0, 0.005 ); m_amountKnob->setInitValue( 0.0 ); @@ -286,7 +281,7 @@ envelopeAndLFOWidget::envelopeAndLFOWidget( float _value_for_zero_amount, m_lfoPredelayKnob = new knob( knobBright_26, this, tr( "LFO-predelay-time" ), - eng(), _track ); + _track ); m_lfoPredelayKnob->setLabel( tr( "DEL" ) ); m_lfoPredelayKnob->setRange( 0.0, 1.0, 0.001 ); m_lfoPredelayKnob->setInitValue( 0.0 ); @@ -305,7 +300,7 @@ envelopeAndLFOWidget::envelopeAndLFOWidget( float _value_for_zero_amount, m_lfoAttackKnob = new knob( knobBright_26, this, tr( "LFO-attack-time" ), - eng(), _track ); + _track ); m_lfoAttackKnob->setLabel( tr( "ATT" ) ); m_lfoAttackKnob->setRange( 0.0, 1.0, 0.001 ); m_lfoAttackKnob->setInitValue( 0.0 ); @@ -323,8 +318,8 @@ envelopeAndLFOWidget::envelopeAndLFOWidget( float _value_for_zero_amount, SLOT( updateAfterKnobChange( float ) ) ); m_lfoSpeedKnob = new tempoSyncKnob( knobBright_26, this, - tr( "LFO-speed" ), - eng(), _track, 20000.0 ); + tr( "LFO-speed" ), + _track, 20000.0 ); m_lfoSpeedKnob->setLabel( tr( "SPD" ) ); m_lfoSpeedKnob->setRange( 0.01, 1.0, 0.0001 ); m_lfoSpeedKnob->setInitValue( 0.1 ); @@ -343,7 +338,7 @@ envelopeAndLFOWidget::envelopeAndLFOWidget( float _value_for_zero_amount, m_lfoAmountKnob = new knob( knobBright_26, this, tr( "LFO-modulation-amount" ), - eng(), _track ); + _track ); m_lfoAmountKnob->setLabel( tr( "AMT" ) ); m_lfoAmountKnob->setRange( -1.0, 1.0, 0.005 ); m_lfoAmountKnob->setInitValue( 0.0 ); @@ -362,8 +357,7 @@ envelopeAndLFOWidget::envelopeAndLFOWidget( float _value_for_zero_amount, SLOT( updateAfterKnobChange( float ) ) ); - pixmapButton * sin_lfo_btn = new pixmapButton( this, NULL, eng(), - NULL ); + pixmapButton * sin_lfo_btn = new pixmapButton( this, NULL, NULL ); sin_lfo_btn->move( LFO_SHAPES_X, LFO_SHAPES_Y ); sin_lfo_btn->setActiveGraphic( embed::getIconPixmap( "sin_wave_active" ) ); @@ -377,8 +371,7 @@ envelopeAndLFOWidget::envelopeAndLFOWidget( float _value_for_zero_amount, tr( "Click here if you want a sine-wave for current " "oscillator." ) ); - pixmapButton * triangle_lfo_btn = new pixmapButton( this, NULL, eng(), - NULL ); + pixmapButton * triangle_lfo_btn = new pixmapButton( this, NULL, NULL ); triangle_lfo_btn->move( LFO_SHAPES_X+15, LFO_SHAPES_Y ); triangle_lfo_btn->setActiveGraphic( embed::getIconPixmap( "triangle_wave_active" ) ); @@ -392,8 +385,7 @@ envelopeAndLFOWidget::envelopeAndLFOWidget( float _value_for_zero_amount, tr( "Click here if you want a triangle-wave for current " "oscillator." ) ); - pixmapButton * saw_lfo_btn = new pixmapButton( this, NULL, eng(), - NULL ); + pixmapButton * saw_lfo_btn = new pixmapButton( this, NULL, NULL ); saw_lfo_btn->move( LFO_SHAPES_X+30, LFO_SHAPES_Y ); saw_lfo_btn->setActiveGraphic( embed::getIconPixmap( "saw_wave_active" ) ); @@ -407,8 +399,7 @@ envelopeAndLFOWidget::envelopeAndLFOWidget( float _value_for_zero_amount, tr( "Click here if you want a saw-wave for current " "oscillator." ) ); - pixmapButton * sqr_lfo_btn = new pixmapButton( this, NULL, eng(), - NULL ); + pixmapButton * sqr_lfo_btn = new pixmapButton( this, NULL, NULL ); sqr_lfo_btn->move( LFO_SHAPES_X+45, LFO_SHAPES_Y ); sqr_lfo_btn->setActiveGraphic( embed::getIconPixmap( "square_wave_active" ) ); @@ -422,7 +413,7 @@ envelopeAndLFOWidget::envelopeAndLFOWidget( float _value_for_zero_amount, tr( "Click here if you want a square-wave for current " "oscillator." ) ); - m_userLfoBtn = new pixmapButton( this, NULL, eng(), NULL ); + m_userLfoBtn = new pixmapButton( this, NULL, NULL ); m_userLfoBtn->move( LFO_SHAPES_X+60, LFO_SHAPES_Y ); m_userLfoBtn->setActiveGraphic( embed::getIconPixmap( "usr_wave_active" ) ); @@ -442,7 +433,7 @@ envelopeAndLFOWidget::envelopeAndLFOWidget( float _value_for_zero_amount, m_lfoWaveBtnGrp = new automatableButtonGroup( this, tr( "LFO wave shape" ), - eng(), _track ); + _track ); m_lfoWaveBtnGrp->addButton( sin_lfo_btn ); m_lfoWaveBtnGrp->addButton( triangle_lfo_btn ); m_lfoWaveBtnGrp->addButton( saw_lfo_btn ); @@ -454,7 +445,7 @@ envelopeAndLFOWidget::envelopeAndLFOWidget( float _value_for_zero_amount, SLOT( lfoWaveCh( int ) ) ); m_x100Cb = new ledCheckBox( tr( "FREQ x 100" ), this, - tr( "Freq x 100" ), eng(), _track ); + tr( "Freq x 100" ), _track ); m_x100Cb->setFont( pointSize<6>( m_x100Cb->font() ) ); m_x100Cb->move( LFO_PREDELAY_KNOB_X, LFO_GRAPH_Y + 36 ); #ifdef QT4 @@ -471,7 +462,7 @@ envelopeAndLFOWidget::envelopeAndLFOWidget( float _value_for_zero_amount, m_controlEnvAmountCb = new ledCheckBox( tr( "MODULATE ENV-AMOUNT" ), this, tr( "Modulate Env-Amount" ), - eng(), _track ); + _track ); m_controlEnvAmountCb->move( LFO_PREDELAY_KNOB_X, LFO_GRAPH_Y + 54 ); m_controlEnvAmountCb->setFont( pointSize<6>( m_controlEnvAmountCb->font() ) ); @@ -492,11 +483,11 @@ envelopeAndLFOWidget::envelopeAndLFOWidget( float _value_for_zero_amount, #endif setAcceptDrops( TRUE ); - connect( eng()->getMixer(), SIGNAL( sampleRateChanged() ), this, + connect( engine::getMixer(), SIGNAL( sampleRateChanged() ), this, SLOT( updateSampleVars() ) ); m_lfoShapeData = - new sample_t[eng()->getMixer()->framesPerAudioBuffer()]; + new sample_t[engine::getMixer()->framesPerAudioBuffer()]; updateSampleVars(); } @@ -509,7 +500,7 @@ envelopeAndLFOWidget::~envelopeAndLFOWidget() delete[] m_rEnv; delete[] m_lfoShapeData; - vvector & v = s_EaLWidgets[eng()]; + vvector & v = s_EaLWidgets; if( qFind( v.begin(), v.end(), this ) != v.end() ) { v.erase( qFind( v.begin(), v.end(), this ) ); @@ -521,7 +512,7 @@ envelopeAndLFOWidget::~envelopeAndLFOWidget() void envelopeAndLFOWidget::updateLFOShapeData( void ) { - const fpab_t frames = eng()->getMixer()->framesPerAudioBuffer(); + const fpab_t frames = engine::getMixer()->framesPerAudioBuffer(); m_userWave.lock(); for( fpab_t offset = 0; offset < frames; ++offset ) { @@ -534,14 +525,14 @@ void envelopeAndLFOWidget::updateLFOShapeData( void ) -void envelopeAndLFOWidget::triggerLFO( engine * _engine ) +void envelopeAndLFOWidget::triggerLFO( void ) { - vvector & v = s_EaLWidgets[_engine]; + vvector & v = s_EaLWidgets; for( vvector::iterator it = v.begin(); it != v.end(); ++it ) { ( *it )->m_lfoFrame += - _engine->getMixer()->framesPerAudioBuffer(); + engine::getMixer()->framesPerAudioBuffer(); ( *it )->m_bad_lfoShapeData = TRUE; } } @@ -549,9 +540,9 @@ void envelopeAndLFOWidget::triggerLFO( engine * _engine ) -void envelopeAndLFOWidget::resetLFO( engine * _engine ) +void envelopeAndLFOWidget::resetLFO( void ) { - vvector & v = s_EaLWidgets[_engine]; + vvector & v = s_EaLWidgets; for( vvector::iterator it = v.begin(); it != v.end(); ++it ) { @@ -859,7 +850,7 @@ void envelopeAndLFOWidget::paintEvent( QPaintEvent * ) int graph_y_base = LFO_GRAPH_Y + 3 + LFO_GRAPH_H / 2; const float frames_for_graph = SECS_PER_LFO_OSCILLATION * - eng()->getMixer()->sampleRate() / 10; + engine::getMixer()->sampleRate() / 10; const float lfo_gray_amount = 1.0f - fabsf( m_lfoAmountKnob->value() ); p.setPen( QPen( QColor( static_cast( 96 * lfo_gray_amount ), @@ -950,7 +941,7 @@ void envelopeAndLFOWidget::updateSampleVars( void ) m_busyMutex.lock(); const float frames_per_env_seg = SECS_PER_ENV_SEGMENT * - eng()->getMixer()->sampleRate(); + engine::getMixer()->sampleRate(); const f_cnt_t predelay_frames = static_cast( frames_per_env_seg * expKnobVal( m_predelayKnob->value() ) ); @@ -1036,7 +1027,7 @@ void envelopeAndLFOWidget::updateSampleVars( void ) const float frames_per_lfo_oscillation = SECS_PER_LFO_OSCILLATION * - eng()->getMixer()->sampleRate(); + engine::getMixer()->sampleRate(); m_lfoPredelayFrames = static_cast( frames_per_lfo_oscillation * expKnobVal( m_lfoPredelayKnob->value() ) ); m_lfoAttackFrames = static_cast( frames_per_lfo_oscillation * @@ -1107,7 +1098,7 @@ inline sample_t envelopeAndLFOWidget::lfoShapeSample( fpab_t _frame_offset ) void envelopeAndLFOWidget::x100Toggled( bool ) { - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); updateSampleVars(); } @@ -1144,7 +1135,7 @@ void envelopeAndLFOWidget::lfoUserWaveCh( bool _on ) } m_lfoShape = USER; } - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); updateSampleVars(); } diff --git a/src/core/envelope_tab_widget.cpp b/src/core/envelope_tab_widget.cpp index 8ea5181ce..7dbadea9e 100644 --- a/src/core/envelope_tab_widget.cpp +++ b/src/core/envelope_tab_widget.cpp @@ -4,7 +4,7 @@ * envelope_tab_widget.cpp - widget for use in envelope/lfo/filter-tab of * instrument-track-window * - * Copyright (c) 2004-2006 Tobias Doerffel + * Copyright (c) 2004-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -84,7 +84,6 @@ static const QString targetNames[envelopeTabWidget::TARGET_COUNT][2] = envelopeTabWidget::envelopeTabWidget( instrumentTrack * _instrument_track ) : QWidget( _instrument_track->tabWidgetParent() ), - journallingObject( _instrument_track->eng() ), m_instrumentTrack( _instrument_track ) { @@ -122,7 +121,6 @@ envelopeTabWidget::envelopeTabWidget( instrumentTrack * _instrument_track ) : m_envLFOWidgets[i] = new envelopeAndLFOWidget( value_for_zero_amount, m_targetsTabWidget, - eng(), _instrument_track ); m_targetsTabWidget->addTab( m_envLFOWidgets[i], tr( targetNames[i][0] @@ -138,14 +136,14 @@ envelopeTabWidget::envelopeTabWidget( instrumentTrack * _instrument_track ) : } - m_filterGroupBox = new groupBox( tr( "FILTER" ), this, eng(), + m_filterGroupBox = new groupBox( tr( "FILTER" ), this, _instrument_track ); m_filterGroupBox->setGeometry( FILTER_GROUPBOX_X, FILTER_GROUPBOX_Y, FILTER_GROUPBOX_WIDTH, FILTER_GROUPBOX_HEIGHT ); m_filterComboBox = new comboBox( m_filterGroupBox, tr( "Filter type" ), - eng(), _instrument_track ); + _instrument_track ); m_filterComboBox->setGeometry( 14, 22, 120, 22 ); m_filterComboBox->setFont( pointSize<8>( m_filterComboBox->font() ) ); @@ -179,7 +177,7 @@ envelopeTabWidget::envelopeTabWidget( instrumentTrack * _instrument_track ) : m_filterCutKnob = new knob( knobBright_26, m_filterGroupBox, tr( "cutoff-frequency" ), - eng(), _instrument_track ); + _instrument_track ); m_filterCutKnob->setLabel( tr( "CUTOFF" ) ); m_filterCutKnob->setRange( 0.0, 14000.0, 1.0 ); m_filterCutKnob->move( 140, 18 ); @@ -199,8 +197,8 @@ envelopeTabWidget::envelopeTabWidget( instrumentTrack * _instrument_track ) : "frequencies below cutoff-frequency and so on..." ) ); m_filterResKnob = new knob( knobBright_26, m_filterGroupBox, - tr( "Q/Resonance" ), - eng(), _instrument_track ); + tr( "Q/Resonance" ), + _instrument_track ); m_filterResKnob->setLabel( tr( "Q/RESO" ) ); m_filterResKnob->setRange( basicFilters<>::minQ(), 10.0, 0.01 ); m_filterResKnob->move( 190, 18 ); @@ -236,7 +234,7 @@ float FASTCALL envelopeTabWidget::volumeLevel( notePlayHandle * _n, if( _n->released() == FALSE ) { - release_begin += eng()->getMixer()->framesPerAudioBuffer(); + release_begin += engine::getMixer()->framesPerAudioBuffer(); } float volume_level; @@ -261,7 +259,7 @@ void envelopeTabWidget::processAudioBuffer( sampleFrame * _ab, if( _n->released() == FALSE ) { - release_begin += eng()->getMixer()->framesPerAudioBuffer(); + release_begin += engine::getMixer()->framesPerAudioBuffer(); } // because of optimizations, there's special code for several cases: @@ -281,7 +279,7 @@ void envelopeTabWidget::processAudioBuffer( sampleFrame * _ab, if( _n->m_filter == NULL ) { _n->m_filter = new basicFilters<>( - eng()->getMixer()->sampleRate() ); + engine::getMixer()->sampleRate() ); } m_envLFOWidgets[VOLUME]->lock(); diff --git a/src/core/export_project_dialog.cpp b/src/core/export_project_dialog.cpp index 8d407fb88..0fbfbd9f2 100644 --- a/src/core/export_project_dialog.cpp +++ b/src/core/export_project_dialog.cpp @@ -3,7 +3,7 @@ /* * export_project_dialog.cpp - implementation of dialog for exporting project * - * Copyright (c) 2004-2006 Tobias Doerffel + * Copyright (c) 2004-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -129,10 +129,8 @@ Sint16 exportProjectDialog::s_availableBitrates[] = // TODO: rewrite that crap using layouts!! exportProjectDialog::exportProjectDialog( const QString & _file_name, - QWidget * _parent, - engine * _engine ) : + QWidget * _parent ) : QDialog( _parent ), - engineObject( _engine ), m_fileName( _file_name ), m_hourglassLbl( NULL ), m_deleteFile( FALSE ) @@ -153,7 +151,7 @@ exportProjectDialog::exportProjectDialog( const QString & _file_name, m_typeLbl->setGeometry( LABEL_X, TYPE_STUFF_Y, LABEL_WIDTH, TYPE_HEIGHT ); - m_typeCombo = new comboBox( this, NULL, eng(), NULL ); + m_typeCombo = new comboBox( this, NULL, NULL ); m_typeCombo->setGeometry( LABEL_X + LABEL_WIDTH+LABEL_MARGIN, TYPE_STUFF_Y, TYPE_COMBO_WIDTH, TYPE_HEIGHT ); @@ -176,7 +174,7 @@ exportProjectDialog::exportProjectDialog( const QString & _file_name, m_kbpsLbl->setGeometry( LABEL_X, KBPS_STUFF_Y, LABEL_WIDTH, KBPS_HEIGHT ); - m_kbpsCombo = new comboBox( this, NULL, eng(), NULL ); + m_kbpsCombo = new comboBox( this, NULL, NULL ); m_kbpsCombo->setGeometry( LABEL_X + LABEL_WIDTH + LABEL_MARGIN, KBPS_STUFF_Y, KBPS_COMBO_WIDTH, KBPS_HEIGHT ); @@ -192,15 +190,14 @@ exportProjectDialog::exportProjectDialog( const QString & _file_name, QString::number( 128 ) ) ); - m_vbrCb = new ledCheckBox( tr( "variable bitrate" ), this, NULL, eng(), - NULL ); + m_vbrCb = new ledCheckBox( tr( "variable bitrate" ), this, NULL, NULL ); m_vbrCb->setGeometry( LABEL_X + LABEL_WIDTH + 3 * LABEL_MARGIN + KBPS_COMBO_WIDTH, KBPS_STUFF_Y + 3, 190, 20 ); m_vbrCb->setChecked( TRUE ); m_hqmCb = new ledCheckBox( tr( "use high-quality-mode (recommened)" ), - this, NULL, eng(), NULL ); + this, NULL, NULL ); m_hqmCb->setGeometry( LABEL_X, HQ_MODE_CB_Y + 3, HQ_MODE_CB_WIDTH, HQ_MODE_CB_HEIGHT ); m_hqmCb->setChecked( TRUE ); @@ -258,7 +255,7 @@ void exportProjectDialog::keyPressEvent( QKeyEvent * _ke ) { if( _ke->key() == Qt::Key_Escape ) { - if( eng()->getSongEditor()->exporting() == FALSE ) + if( engine::getSongEditor()->exporting() == FALSE ) { accept(); } @@ -274,7 +271,7 @@ void exportProjectDialog::keyPressEvent( QKeyEvent * _ke ) void exportProjectDialog::closeEvent( QCloseEvent * _ce ) { - if( eng()->getSongEditor()->exporting() == TRUE ) + if( engine::getSongEditor()->exporting() == TRUE ) { abortProjectExport(); _ce->ignore(); @@ -332,7 +329,7 @@ void exportProjectDialog::exportBtnClicked( void ) m_kbpsCombo->currentText().toInt(), m_kbpsCombo->currentText().toInt() - 64, m_kbpsCombo->currentText().toInt() + 64, - eng()->getMixer() ); + engine::getMixer() ); if( success_ful == FALSE ) { QMessageBox::information( this, @@ -377,28 +374,29 @@ void exportProjectDialog::exportBtnClicked( void ) - eng()->getMixer()->setAudioDevice( dev, m_hqmCb->isChecked() ); - eng()->getSongEditor()->startExport(); + engine::getMixer()->setAudioDevice( dev, m_hqmCb->isChecked() ); + engine::getSongEditor()->startExport(); delete m_hqmCb; - songEditor::playPos & pp = eng()->getSongEditor()->getPlayPos( + songEditor::playPos & pp = engine::getSongEditor()->getPlayPos( songEditor::PLAY_SONG ); - while( eng()->getSongEditor()->exportDone() == FALSE && - eng()->getSongEditor()->exporting() == TRUE ) + while( engine::getSongEditor()->exportDone() == FALSE && + engine::getSongEditor()->exporting() == TRUE ) { dev->processNextBuffer(); int pval = pp * 100 / - ( ( eng()->getSongEditor()->lengthInTacts() + 1 ) * 64 ); + ( ( engine::getSongEditor()->lengthInTacts() + 1 ) + * 64 ); #ifdef QT4 m_exportProgressBar->setValue( pval ); #else m_exportProgressBar->setProgress( pval ); #endif // update lmms-main-win-caption - eng()->getMainWindow()->setWindowTitle( tr( "Rendering:" ) + " " + - QString::number( pval ) + "%" ); + engine::getMainWindow()->setWindowTitle( tr( "Rendering:" ) + + " " + QString::number( pval ) + "%" ); // process paint-events etc. qApp->processEvents(); } @@ -418,7 +416,7 @@ void exportProjectDialog::exportBtnClicked( void ) void exportProjectDialog::cancelBtnClicked( void ) { // is song-export-thread active? - if( eng()->getSongEditor()->exporting() == TRUE ) + if( engine::getSongEditor()->exporting() == TRUE ) { // then dispose abort of export abortProjectExport(); @@ -443,7 +441,7 @@ void exportProjectDialog::abortProjectExport( void ) void exportProjectDialog::finishProjectExport( void ) { - eng()->getMixer()->restoreAudioDevice(); + engine::getMixer()->restoreAudioDevice(); // if the user aborted export-process, the file has to be deleted if( m_deleteFile ) @@ -452,9 +450,9 @@ void exportProjectDialog::finishProjectExport( void ) } // restore window-title - eng()->getMainWindow()->resetWindowTitle(); + engine::getMainWindow()->resetWindowTitle(); - eng()->getSongEditor()->stopExport(); + engine::getSongEditor()->stopExport(); // if we rendered file from command line, quit after export if( file_to_render != "" ) diff --git a/src/core/file_browser.cpp b/src/core/file_browser.cpp index 3ea07380e..cf3bbc89c 100644 --- a/src/core/file_browser.cpp +++ b/src/core/file_browser.cpp @@ -67,15 +67,14 @@ fileBrowser::fileBrowser( const QString & _directories, const QString & _filter, const QString & _title, const QPixmap & _pm, - QWidget * _parent, engine * _engine ) : + QWidget * _parent ) : sideBarWidget( _title, _pm, _parent ), - engineObject( _engine ), m_contextMenuItem( NULL ), m_directories( _directories ), m_filter( _filter ) { setWindowTitle( tr( "Browser" ) ); - m_l = new listView( contentParent(), eng() ); + m_l = new listView( contentParent() ); addContentWidget( m_l ); #ifdef QT4 @@ -179,7 +178,7 @@ void fileBrowser::addItems( const QString & _path ) { // remove existing file-items delete m_l->findItem( cur_file, 0 ); - (void) new fileItem( m_l, cur_file, _path, eng() ); + (void) new fileItem( m_l, cur_file, _path ); } } @@ -195,7 +194,7 @@ void fileBrowser::addItems( const QString & _path ) if( item == NULL ) { (void) new directory( m_l, cur_file, _path, - m_filter, eng() ); + m_filter ); } else if( dynamic_cast( item ) != NULL ) { @@ -298,11 +297,11 @@ void fileBrowser::contextMenuRequest( QListViewItem * i, const QPoint &, int ) void fileBrowser::sendToActiveInstrumentTrack( void ) { - if( eng()->getMainWindow()->workspace() != NULL ) + if( engine::getMainWindow()->workspace() != NULL ) { // get all windows opened in the workspace QWidgetList pl = - eng()->getMainWindow()->workspace()->windowList( + engine::getMainWindow()->workspace()->windowList( #if QT_VERSION >= 0x030200 QWorkspace::StackingOrder #endif @@ -333,7 +332,7 @@ void fileBrowser::sendToActiveInstrumentTrack( void ) fileItem::SAMPLE_FILE ) { instrument * afp = ct->loadInstrument( - eng()->sampleExtensions() + engine::sampleExtensions() [m_contextMenuItem ->extension()] ); if( afp != NULL ) @@ -374,8 +373,9 @@ void fileBrowser::openInNewInstrumentTrack( trackContainer * _tc ) #ifdef LMMS_DEBUG assert( ct != NULL ); #endif - instrument * afp = ct->loadInstrument( eng()->sampleExtensions() - [m_contextMenuItem + instrument * afp = ct->loadInstrument( + engine::sampleExtensions() + [m_contextMenuItem ->extension()] ); if( afp != NULL ) { @@ -404,7 +404,7 @@ void fileBrowser::openInNewInstrumentTrack( trackContainer * _tc ) void fileBrowser::openInNewInstrumentTrackSE( void ) { - openInNewInstrumentTrack( eng()->getSongEditor() ); + openInNewInstrumentTrack( engine::getSongEditor() ); } @@ -412,7 +412,7 @@ void fileBrowser::openInNewInstrumentTrackSE( void ) void fileBrowser::openInNewInstrumentTrackBBE( void ) { - openInNewInstrumentTrack( eng()->getBBEditor() ); + openInNewInstrumentTrack( engine::getBBEditor() ); } @@ -422,9 +422,8 @@ void fileBrowser::openInNewInstrumentTrackBBE( void ) -listView::listView( QWidget * _parent, engine * _engine ) : +listView::listView( QWidget * _parent ) : Q3ListView( _parent ), - engineObject( _engine ), m_mousePressed( FALSE ), m_pressPos(), m_previewPlayHandle( NULL ) @@ -460,12 +459,12 @@ void listView::contentsMouseDoubleClickEvent( QMouseEvent * _me ) // they're likely drum-samples etc. instrumentTrack * it = dynamic_cast( track::create( track::INSTRUMENT_TRACK, - eng()->getBBEditor() ) ); + engine::getBBEditor() ) ); #ifdef LMMS_DEBUG assert( it != NULL ); #endif instrument * afp = it->loadInstrument( - eng()->sampleExtensions()[f->extension()] ); + engine::sampleExtensions()[f->extension()] ); if( afp != NULL ) { afp->setParameter( "samplefile", @@ -478,7 +477,7 @@ void listView::contentsMouseDoubleClickEvent( QMouseEvent * _me ) // presets are per default opened in bb-editor multimediaProject mmp( f->fullName() ); track * t = track::create( track::INSTRUMENT_TRACK, - eng()->getBBEditor() ); + engine::getBBEditor() ); instrumentTrack * it = dynamic_cast( t ); if( it != NULL ) @@ -491,9 +490,9 @@ void listView::contentsMouseDoubleClickEvent( QMouseEvent * _me ) } else if( f->type() == fileItem::PROJECT_FILE ) { - if( eng()->getSongEditor()->mayChangeProject() == TRUE ) + if( engine::getSongEditor()->mayChangeProject() ) { - eng()->getSongEditor()->loadProject( + engine::getSongEditor()->loadProject( f->fullName() ); } } @@ -531,7 +530,7 @@ void listView::contentsMousePressEvent( QMouseEvent * _me ) { if( m_previewPlayHandle != NULL ) { - eng()->getMixer()->removePlayHandle( + engine::getMixer()->removePlayHandle( m_previewPlayHandle ); m_previewPlayHandle = NULL; } @@ -549,7 +548,7 @@ void listView::contentsMousePressEvent( QMouseEvent * _me ) qApp->processEvents(); #endif samplePlayHandle * s = new samplePlayHandle( - f->fullName(), eng() ); + f->fullName() ); s->setDoneMayReturnTrue( FALSE ); m_previewPlayHandle = s; delete tf; @@ -557,11 +556,12 @@ void listView::contentsMousePressEvent( QMouseEvent * _me ) else if( f->type() == fileItem::PRESET_FILE ) { m_previewPlayHandle = new presetPreviewPlayHandle( - f->fullName(), eng() ); + f->fullName() ); } if( m_previewPlayHandle != NULL ) { - eng()->getMixer()->addPlayHandle( m_previewPlayHandle ); + engine::getMixer()->addPlayHandle( + m_previewPlayHandle ); } } } @@ -587,7 +587,7 @@ void listView::contentsMouseMoveEvent( QMouseEvent * _me ) f->fullName(), embed::getIconPixmap( "preset_file" ), - this, eng() ); + this ); break; case fileItem::SAMPLE_FILE: @@ -595,7 +595,7 @@ void listView::contentsMouseMoveEvent( QMouseEvent * _me ) f->fullName(), embed::getIconPixmap( "sound_file" ), - this, eng() ); + this ); break; case fileItem::MIDI_FILE: @@ -603,7 +603,7 @@ void listView::contentsMouseMoveEvent( QMouseEvent * _me ) f->fullName(), embed::getIconPixmap( "midi_file" ), - this, eng() ); + this ); break; default: @@ -629,14 +629,14 @@ void listView::contentsMouseReleaseEvent( QMouseEvent * _me ) { if( s->totalFrames() - s->framesDone() <= static_cast( - eng()->getMixer()->sampleRate() * 3 ) ) + engine::getMixer()->sampleRate() * 3 ) ) { s->setDoneMayReturnTrue( TRUE ); m_previewPlayHandle = NULL; return; } } - eng()->getMixer()->removePlayHandle( m_previewPlayHandle ); + engine::getMixer()->removePlayHandle( m_previewPlayHandle ); m_previewPlayHandle = NULL; } } @@ -653,10 +653,8 @@ QPixmap * directory::s_folderLockedPixmap = NULL; directory::directory( directory * _parent, const QString & _name, - const QString & _path, const QString & _filter, - engine * _engine ) : + const QString & _path, const QString & _filter ) : Q3ListViewItem( _parent, _name ), - engineObject( _engine ), m_p( _parent ), m_pix( NULL ), m_directories( _path ), @@ -669,10 +667,8 @@ directory::directory( directory * _parent, const QString & _name, directory::directory( Q3ListView * _parent, const QString & _name, - const QString & _path, const QString & _filter, - engine * _engine ) : + const QString & _path, const QString & _filter ) : Q3ListViewItem( _parent, _name ), - engineObject( _engine ), m_p( NULL ), m_pix( NULL ), m_directories( _path ), @@ -797,7 +793,7 @@ bool directory::addItems( const QString & _path ) #endif /*QDir::match( FILE_FILTER, cur_file )*/ ) { - (void) new fileItem( this, cur_file, _path, eng() ); + (void) new fileItem( this, cur_file, _path ); added_something = TRUE; } } @@ -814,7 +810,7 @@ bool directory::addItems( const QString & _path ) #endif cur_file, m_filter ) ) { - new directory( this, cur_file, _path, m_filter, eng() ); + new directory( this, cur_file, _path, m_filter ); added_something = TRUE; #if 0 if( firstChild() == NULL ) @@ -860,10 +856,8 @@ QPixmap * fileItem::s_unknownFilePixmap = NULL; fileItem::fileItem( Q3ListView * _parent, const QString & _name, - const QString & _path, - engine * _engine ) : + const QString & _path ) : Q3ListViewItem( _parent, _name ), - engineObject( _engine ), m_pix( NULL ), m_path( _path ) { @@ -876,10 +870,8 @@ fileItem::fileItem( Q3ListView * _parent, const QString & _name, fileItem::fileItem( Q3ListViewItem * _parent, const QString & _name, - const QString & _path, - engine * _engine ) : + const QString & _path ) : Q3ListViewItem( _parent, _name ), - engineObject( _engine ), m_pix( NULL ), m_path( _path ) { @@ -974,7 +966,7 @@ void fileItem::determineFileType( void ) { m_type = PRESET_FILE; } - else if( eng()->sampleExtensions().contains( ext ) ) + else if( engine::sampleExtensions().contains( ext ) ) { m_type = SAMPLE_FILE; } diff --git a/src/core/import_filter.cpp b/src/core/import_filter.cpp index af55eb9aa..e979e7f70 100644 --- a/src/core/import_filter.cpp +++ b/src/core/import_filter.cpp @@ -3,7 +3,7 @@ /* * import_filter.cpp - base-class for all import-filters (MIDI, FLP etc) * - * Copyright (c) 2006 Tobias Doerffel + * Copyright (c) 2006-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -26,6 +26,7 @@ #include "import_filter.h" +#include "engine.h" #include "track_container.h" #include "project_journal.h" @@ -43,9 +44,8 @@ importFilter::importFilter( const QString & _file_name, - const descriptor * _descriptor, - engine * _eng ) : - plugin( _descriptor, _eng ), + const descriptor * _descriptor ) : + plugin( _descriptor ), m_file( _file_name ) { } @@ -77,8 +77,8 @@ void importFilter::import( const QString & _file_to_import, ); // do not record changes while importing files - const bool j = _tc->eng()->getProjectJournal()->isJournalling(); - _tc->eng()->getProjectJournal()->setJournalling( FALSE ); + const bool j = engine::getProjectJournal()->isJournalling(); + engine::getProjectJournal()->setJournalling( FALSE ); for( vvector::iterator it = d.begin(); it != d.end(); ++it ) @@ -98,7 +98,7 @@ void importFilter::import( const QString & _file_to_import, } } - _tc->eng()->getProjectJournal()->setJournalling( j ); + engine::getProjectJournal()->setJournalling( j ); delete[] s; diff --git a/src/core/instrument.cpp b/src/core/instrument.cpp index 456542c7e..82585744c 100644 --- a/src/core/instrument.cpp +++ b/src/core/instrument.cpp @@ -3,7 +3,7 @@ /* * instrument.cpp - base-class for all instrument-plugins (synths, samplers etc) * - * Copyright (c) 2005-2006 Tobias Doerffel + * Copyright (c) 2005-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -33,7 +33,7 @@ instrument::instrument( instrumentTrack * _instrument_track, const descriptor * _descriptor ) : QWidget( _instrument_track->tabWidgetParent() ), - plugin( _descriptor, _instrument_track->eng() ), + plugin( _descriptor ), m_instrumentTrack( _instrument_track ), m_valid( TRUE ) { diff --git a/src/core/main.cpp b/src/core/main.cpp index 53b0cf0f4..e84c7cb03 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -52,6 +52,7 @@ #include "main_window.h" #include "embed.h" +#include "engine.h" #include "config_mgr.h" #include "export_project_dialog.h" #include "song_editor.h" @@ -230,32 +231,32 @@ int main( int argc, char * * argv ) Qt::white ); #endif - engine * main_engine = new engine(); + engine::init(); // we try to load given file if( file_to_load != "" ) { - main_engine->getSongEditor()->loadProject( file_to_load ); + engine::getSongEditor()->loadProject( file_to_load ); } else { - main_engine->getSongEditor()->createNewProject(); + engine::getSongEditor()->createNewProject(); } #ifndef QT4 - app.setMainWidget( main_engine->getMainWindow() ); + app.setMainWidget( engine::getMainWindow() ); #endif // MDI-mode? - if( main_engine->getMainWindow()->workspace() != NULL ) + if( engine::getMainWindow()->workspace() != NULL ) { // then maximize - main_engine->getMainWindow()->showMaximized(); + engine::getMainWindow()->showMaximized(); } else { // otherwise arrange at top-left edge of screen - main_engine->getMainWindow()->show(); - main_engine->getMainWindow()->move( 0, 0 ); - main_engine->getMainWindow()->resize( 200, 500 ); + engine::getMainWindow()->show(); + engine::getMainWindow()->move( 0, 0 ); + engine::getMainWindow()->resize( 200, 500 ); } @@ -267,8 +268,7 @@ int main( int argc, char * * argv ) { exportProjectDialog * e = new exportProjectDialog( file_to_render, - main_engine->getMainWindow(), - main_engine ); + engine::getMainWindow() ); e->show(); e->exportBtnClicked(); } diff --git a/src/core/main_window.cpp b/src/core/main_window.cpp index 2dc165e20..027128581 100644 --- a/src/core/main_window.cpp +++ b/src/core/main_window.cpp @@ -67,6 +67,7 @@ #include "song_editor.h" #include "piano_roll.h" #include "embed.h" +#include "engine.h" #include "about_dialog.h" #include "file_browser.h" #include "plugin_browser.h" @@ -90,13 +91,12 @@ extern int splash_alignment_flags; -mainWindow::mainWindow( engine * _engine ) : +mainWindow::mainWindow( void ) : QMainWindow( #ifndef QT4 0 , NULL, WDestructiveClose #endif ), - engineObject( _engine ), m_workspace( NULL ), m_templatesMenu( NULL ), m_tools_menu( NULL ) @@ -129,7 +129,7 @@ mainWindow::mainWindow( engine * _engine ) : #endif QString sample_filter; - vlist ext_keys = eng()->sampleExtensions().keys(); + vlist ext_keys = engine::sampleExtensions().keys(); for( vlist::iterator it = ext_keys.begin(); it != ext_keys.end(); ++it ) { @@ -138,39 +138,34 @@ mainWindow::mainWindow( engine * _engine ) : int id = 0; QString wdir = configManager::inst()->workingDir(); - side_bar->appendTab( new pluginBrowser( splitter, eng() ), ++id ); + side_bar->appendTab( new pluginBrowser( splitter ), ++id ); side_bar->appendTab( new fileBrowser( configManager::inst()->factoryProjectsDir() + "*" + configManager::inst()->userProjectsDir(), "*.mmp *.mmpz *.xml *.mid *.flp", tr( "My projects" ), embed::getIconPixmap( "project_file" ), - splitter, eng() ), - ++id ); + splitter ), ++id ); side_bar->appendTab( new fileBrowser( configManager::inst()->factorySamplesDir() + "*" + configManager::inst()->userSamplesDir(), sample_filter, tr( "My samples" ), embed::getIconPixmap( "sound_file" ), - splitter, eng() ), - ++id ); + splitter ), ++id ); side_bar->appendTab( new fileBrowser( configManager::inst()->factoryPresetsDir() + "*" + configManager::inst()->userPresetsDir(), "*.cs.xml", tr( "My presets" ), embed::getIconPixmap( "preset_file" ), - splitter, eng() ), - ++id ); + splitter ), ++id ); side_bar->appendTab( new fileBrowser( QDir::homePath(), "*", tr( "My home" ), embed::getIconPixmap( "home" ), - splitter, eng() ), - ++id ); + splitter ), ++id ); side_bar->appendTab( new fileBrowser( QDir::rootPath(), "*", tr( "Root directory" ), embed::getIconPixmap( "root" ), - splitter, eng() ), - ++id ); + splitter ), ++id ); if( no_mdi == FALSE ) { @@ -224,20 +219,20 @@ mainWindow::mainWindow( engine * _engine ) : mainWindow::~mainWindow() { /* // first make sure, there're no mixing/audio-device-threads any more - eng()->getMixer()->stopProcessing(); + engine::getMixer()->stopProcessing(); // destroy editors with all their children - delete eng()->getSongEditor(); - delete eng()->getBBEditor(); + delete engine::getSongEditor(); + delete engine::getBBEditor(); // destroy mixer - delete eng()->getMixer(); + delete engine::getMixer(); // destroy config-manager (which automatically saves config-file) */ - eng()->close(); + engine::destroy(); } @@ -305,7 +300,7 @@ void mainWindow::finalize( void ) toolButton * project_export = new toolButton( embed::getIconPixmap( "project_export" ), tr( "Export current project" ), - eng()->getSongEditor(), + engine::getSongEditor(), SLOT( exportProject() ), m_toolBar ); @@ -471,7 +466,7 @@ void mainWindow::finalize( void ) #endif project_menu->addAction( /*embed::getIconPixmap( "project_import" ),*/ tr( "Import file" ), - eng()->getSongEditor(), + engine::getSongEditor(), SLOT( importProject() ) ); #ifdef QT4 project_menu->addSeparator(); @@ -480,7 +475,7 @@ void mainWindow::finalize( void ) #endif project_menu->addAction( embed::getIconPixmap( "project_export" ), tr( "E&xport" ), - eng()->getSongEditor(), + engine::getSongEditor(), SLOT( exportProject() ), Qt::CTRL + Qt::Key_E ); #ifdef QT4 @@ -598,14 +593,14 @@ void mainWindow::finalize( void ) { configManager::inst()->setValue( "app", "configured", "1" ); // no, so show it that user can setup everything - setupDialog sd( eng() ); + setupDialog sd; sd.exec(); } // look whether mixer could use a audio-interface beside audioDummy - else if( eng()->getMixer()->audioDevName() == audioDummy::name() ) + else if( engine::getMixer()->audioDevName() == audioDummy::name() ) { // no, so we offer setup-dialog with audio-settings... - setupDialog sd( eng(), setupDialog::AUDIO_SETTINGS ); + setupDialog sd( setupDialog::AUDIO_SETTINGS ); sd.exec(); } } @@ -646,9 +641,9 @@ void mainWindow::addSpacingToToolBar( int _size ) void mainWindow::resetWindowTitle( const QString & _add ) { QString title = _add; - if( _add == "" && eng()->getSongEditor()->projectFileName() != "" ) + if( _add == "" && engine::getSongEditor()->projectFileName() != "" ) { - title = QFileInfo( eng()->getSongEditor()->projectFileName() + title = QFileInfo( engine::getSongEditor()->projectFileName() #ifdef QT4 ).completeBaseName(); #else @@ -717,9 +712,9 @@ void mainWindow::restoreWidgetState( QWidget * _w, const QDomElement & _de ) void mainWindow::createNewProject( void ) { - if( eng()->getSongEditor()->mayChangeProject() == TRUE ) + if( engine::getSongEditor()->mayChangeProject() == TRUE ) { - eng()->getSongEditor()->createNewProject(); + engine::getSongEditor()->createNewProject(); } } @@ -732,13 +727,13 @@ void mainWindow::createNewProjectFromTemplate( int _idx ) // TODO!!! #else if( m_templatesMenu != NULL && - eng()->getSongEditor()->mayChangeProject() == TRUE ) + engine::getSongEditor()->mayChangeProject() == TRUE ) { QString dir_base = m_templatesMenu->indexOf( _idx ) >= m_custom_templates_count ? configManager::inst()->factoryProjectsDir() : configManager::inst()->userProjectsDir(); - eng()->getSongEditor()->createNewProjectFromTemplate( + engine::getSongEditor()->createNewProjectFromTemplate( dir_base + "templates/" + m_templatesMenu->text( _idx ) + ".mpt" ); } @@ -750,7 +745,7 @@ void mainWindow::createNewProjectFromTemplate( int _idx ) void mainWindow::openProject( void ) { - if( eng()->getSongEditor()->mayChangeProject() == TRUE ) + if( engine::getSongEditor()->mayChangeProject() == TRUE ) { #ifdef QT4 QFileDialog ofd( this, tr( "Open project" ), "", @@ -766,7 +761,7 @@ void mainWindow::openProject( void ) if( ofd.exec () == QDialog::Accepted && !ofd.selectedFiles().isEmpty() ) { - eng()->getSongEditor()->loadProject( + engine::getSongEditor()->loadProject( ofd.selectedFiles()[0] ); } } @@ -777,13 +772,13 @@ void mainWindow::openProject( void ) bool mainWindow::saveProject( void ) { - if( eng()->getSongEditor()->projectFileName() == "" ) + if( engine::getSongEditor()->projectFileName() == "" ) { return( saveProjectAs() ); } else { - eng()->getSongEditor()->saveProject(); + engine::getSongEditor()->saveProject(); } return( TRUE ); } @@ -805,7 +800,7 @@ bool mainWindow::saveProjectAs( void ) sfd.setWindowTitle( tr( "Save project" ) ); #endif sfd.setFileMode( QFileDialog::AnyFile ); - QString f = eng()->getSongEditor()->projectFileName(); + QString f = engine::getSongEditor()->projectFileName(); if( f != "" ) { sfd.selectFile( QFileInfo( f ).fileName() ); @@ -829,9 +824,10 @@ bool mainWindow::saveProjectAs( void ) ) { #ifdef QT4 - eng()->getSongEditor()->saveProjectAs( sfd.selectedFiles()[0] ); + engine::getSongEditor()->saveProjectAs( + sfd.selectedFiles()[0] ); #else - eng()->getSongEditor()->saveProjectAs( sfd.selectedFile() ); + engine::getSongEditor()->saveProjectAs( sfd.selectedFile() ); #endif return( TRUE ); } @@ -843,7 +839,7 @@ bool mainWindow::saveProjectAs( void ) void mainWindow::showSettingsDialog( void ) { - setupDialog sd( eng() ); + setupDialog sd; sd.exec(); } @@ -877,7 +873,7 @@ void mainWindow::ladspaPluginBrowser( void ) // moc for Qt 3.x doesn't recognize preprocessor directives, // so we can't just block the whole thing out. #ifdef LADSPA_SUPPORT - ladspaBrowser lb( eng() ); + ladspaBrowser lb; lb.exec(); #endif } @@ -887,16 +883,16 @@ void mainWindow::ladspaPluginBrowser( void ) void mainWindow::toggleBBEditorWin( void ) { - if( eng()->getBBEditor()->isHidden() == TRUE || + if( engine::getBBEditor()->isHidden() == TRUE || ( m_workspace != NULL && - m_workspace->activeWindow() != eng()->getBBEditor() ) ) + m_workspace->activeWindow() != engine::getBBEditor() ) ) { - eng()->getBBEditor()->show(); - eng()->getBBEditor()->setFocus(); + engine::getBBEditor()->show(); + engine::getBBEditor()->setFocus(); } else { - eng()->getBBEditor()->hide(); + engine::getBBEditor()->hide(); } } @@ -905,16 +901,16 @@ void mainWindow::toggleBBEditorWin( void ) void mainWindow::toggleSongEditorWin( void ) { - if( eng()->getSongEditor()->isHidden() == TRUE || - ( m_workspace != NULL && - m_workspace->activeWindow() != eng()->getSongEditor() ) ) + if( engine::getSongEditor()->isHidden() == TRUE || + ( m_workspace != NULL && m_workspace->activeWindow() + != engine::getSongEditor() ) ) { - eng()->getSongEditor()->show(); - eng()->getSongEditor()->setFocus(); + engine::getSongEditor()->show(); + engine::getSongEditor()->setFocus(); } else { - eng()->getSongEditor()->hide(); + engine::getSongEditor()->hide(); } } @@ -923,16 +919,16 @@ void mainWindow::toggleSongEditorWin( void ) void mainWindow::toggleProjectNotesWin( void ) { - if( eng()->getProjectNotes()->isHidden() == TRUE || + if( engine::getProjectNotes()->isHidden() == TRUE || ( m_workspace != NULL && m_workspace->activeWindow() != - eng()->getProjectNotes() ) ) + engine::getProjectNotes() ) ) { - eng()->getProjectNotes()->show(); - eng()->getProjectNotes()->setFocus(); + engine::getProjectNotes()->show(); + engine::getProjectNotes()->setFocus(); } else { - eng()->getProjectNotes()->hide(); + engine::getProjectNotes()->hide(); } } @@ -941,16 +937,16 @@ void mainWindow::toggleProjectNotesWin( void ) void mainWindow::togglePianoRollWin( void ) { - if( eng()->getPianoRoll()->isHidden() == TRUE || - ( m_workspace != NULL && - m_workspace->activeWindow() != eng()->getPianoRoll() ) ) + if( engine::getPianoRoll()->isHidden() == TRUE || + ( m_workspace != NULL && m_workspace->activeWindow() + != engine::getPianoRoll() ) ) { - eng()->getPianoRoll()->show(); - eng()->getPianoRoll()->setFocus(); + engine::getPianoRoll()->show(); + engine::getPianoRoll()->setFocus(); } else { - eng()->getPianoRoll()->hide(); + engine::getPianoRoll()->hide(); } } @@ -959,16 +955,16 @@ void mainWindow::togglePianoRollWin( void ) void mainWindow::toggleAutomationEditorWin( void ) { - if( eng()->getAutomationEditor()->isHidden() == TRUE || + if( engine::getAutomationEditor()->isHidden() == TRUE || ( m_workspace != NULL && m_workspace->activeWindow() - != eng()->getAutomationEditor() ) ) + != engine::getAutomationEditor() ) ) { - eng()->getAutomationEditor()->show(); - eng()->getAutomationEditor()->setFocus(); + engine::getAutomationEditor()->show(); + engine::getAutomationEditor()->setFocus(); } else { - eng()->getAutomationEditor()->hide(); + engine::getAutomationEditor()->hide(); } } @@ -977,7 +973,7 @@ void mainWindow::toggleAutomationEditorWin( void ) void mainWindow::undo( void ) { - eng()->getProjectJournal()->undo(); + engine::getProjectJournal()->undo(); } @@ -985,7 +981,7 @@ void mainWindow::undo( void ) void mainWindow::redo( void ) { - eng()->getProjectJournal()->redo(); + engine::getProjectJournal()->redo(); } @@ -993,7 +989,7 @@ void mainWindow::redo( void ) void mainWindow::closeEvent( QCloseEvent * _ce ) { - if( eng()->getSongEditor()->mayChangeProject() == TRUE ) + if( engine::getSongEditor()->mayChangeProject() == TRUE ) { _ce->accept(); } diff --git a/src/core/meter_dialog.cpp b/src/core/meter_dialog.cpp index 929d30f93..c928c5b87 100644 --- a/src/core/meter_dialog.cpp +++ b/src/core/meter_dialog.cpp @@ -1,9 +1,9 @@ #ifndef SINGLE_SOURCE_COMPILE /* - * meter_dialog.cpp - diloag for entering meter settings + * meter_dialog.cpp - dialog for entering meter settings * - * Copyright (c) 2006 Danny McRae + * Copyright (c) 2006-2007 Danny McRae * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -53,9 +53,8 @@ meterDialog::meterDialog( QWidget * _parent, track * _track ): QWidget * num = new QWidget( this ); QHBoxLayout * num_layout = new QHBoxLayout( num ); num_layout->setSpacing( 10 ); - m_numerator = new lcdSpinBox( 1, 32, 2, num, - tr( "Meter Numerator" ), - _track->eng(), _track ); + m_numerator = new lcdSpinBox( 1, 32, 2, num, tr( "Meter Numerator" ), + _track ); connect( m_numerator, SIGNAL( valueChanged( int ) ), this, SIGNAL( numeratorChanged( int ) ) ); m_numerator->setValue( 4 ); @@ -71,7 +70,7 @@ meterDialog::meterDialog( QWidget * _parent, track * _track ): dem_layout->setSpacing( 10 ); m_denominator = new lcdSpinBox( 1, 32, 2, dem, tr( "Meter Denominator" ), - _track->eng(), _track ); + _track ); connect( m_denominator, SIGNAL( valueChanged( int ) ), this, SIGNAL( denominatorChanged( int ) ) ); m_denominator->setValue( 4 ); diff --git a/src/core/midi_tab_widget.cpp b/src/core/midi_tab_widget.cpp index db6955569..1e9f9446b 100644 --- a/src/core/midi_tab_widget.cpp +++ b/src/core/midi_tab_widget.cpp @@ -4,7 +4,7 @@ * midi_tab_widget.cpp - tab-widget in channel-track-window for setting up * MIDI-related stuff * - * Copyright (c) 2005-2006 Tobias Doerffel + * Copyright (c) 2005-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -63,7 +63,6 @@ midiTabWidget::midiTabWidget( instrumentTrack * _instrument_track, midiPort * _port ) : QWidget( _instrument_track->tabWidgetParent() ), - journallingObject( _instrument_track->eng() ), m_instrumentTrack( _instrument_track ), m_midiPort( _port ), m_readablePorts( NULL ), @@ -75,9 +74,9 @@ midiTabWidget::midiTabWidget( instrumentTrack * _instrument_track, m_inputChannelSpinBox = new lcdSpinBox( 0, MIDI_CHANNEL_COUNT, 3, - m_setupTabWidget, - tr( "Input channel" ), - eng(), _instrument_track ); + m_setupTabWidget, + tr( "Input channel" ), + _instrument_track ); m_inputChannelSpinBox->addTextForValue( 0, "---" ); m_inputChannelSpinBox->setValue( m_midiPort->inputChannel() + 1 ); m_inputChannelSpinBox->setLabel( tr( "CHANNEL" ) ); @@ -87,9 +86,9 @@ midiTabWidget::midiTabWidget( instrumentTrack * _instrument_track, inputChannelChanged( m_inputChannelSpinBox->value() ); m_outputChannelSpinBox = new lcdSpinBox( 1, MIDI_CHANNEL_COUNT, 3, - m_setupTabWidget, - tr( "Output channel" ), - eng(), _instrument_track ); + m_setupTabWidget, + tr( "Output channel" ), + _instrument_track ); m_outputChannelSpinBox->setValue( m_midiPort->outputChannel() + 1 ); //m_outputChannelSpinBox->addTextForValue( 0, "---" ); m_outputChannelSpinBox->setLabel( tr( "CHANNEL" ) ); @@ -102,7 +101,7 @@ midiTabWidget::midiTabWidget( instrumentTrack * _instrument_track, m_receiveCheckBox = new ledCheckBox( tr( "Receive MIDI-events" ), m_setupTabWidget, tr( "Receive MIDI-events" ), - eng(), _instrument_track ); + _instrument_track ); m_receiveCheckBox->move( 10, 34 ); connect( m_receiveCheckBox, SIGNAL( toggled( bool ) ), this, SLOT( midiPortModeToggled( bool ) ) ); @@ -113,7 +112,7 @@ midiTabWidget::midiTabWidget( instrumentTrack * _instrument_track, "for all input-events" ), m_setupTabWidget, tr( "Default input velocity" ), - eng(), _instrument_track ); + _instrument_track ); m_defaultVelocityInCheckBox->move( 28, 84 ); connect( m_defaultVelocityInCheckBox, SIGNAL( toggled( bool ) ), this, SLOT( defaultVelInChanged( bool ) ) ); @@ -122,7 +121,7 @@ midiTabWidget::midiTabWidget( instrumentTrack * _instrument_track, m_sendCheckBox = new ledCheckBox( tr( "Send MIDI-events" ), m_setupTabWidget, tr( "Send MIDI-events" ), - eng(), _instrument_track ); + _instrument_track ); m_sendCheckBox->move( 10, 114 ); connect( m_sendCheckBox, SIGNAL( toggled( bool ) ), this, SLOT( midiPortModeToggled( bool ) ) ); @@ -133,7 +132,7 @@ midiTabWidget::midiTabWidget( instrumentTrack * _instrument_track, "for all output-events" ), m_setupTabWidget, tr( "Default output velocity" ), - eng(), _instrument_track ); + _instrument_track ); m_defaultVelocityOutCheckBox->move( 28, 164 ); connect( m_defaultVelocityOutCheckBox, SIGNAL( toggled( bool ) ), this, SLOT( defaultVelOutChanged( bool ) ) ); @@ -147,7 +146,7 @@ midiTabWidget::midiTabWidget( instrumentTrack * _instrument_track, // when using with non-raw-clients we can provide buttons showing // our port-menus when being clicked - midiClient * mc = eng()->getMixer()->getMIDIClient(); + midiClient * mc = engine::getMixer()->getMIDIClient(); if( mc->isRaw() == FALSE ) { m_readablePorts = new QMenu( m_setupTabWidget ); @@ -374,7 +373,7 @@ void midiTabWidget::loadSettings( const QDomElement & _this ) void midiTabWidget::inputChannelChanged( int _new_chnl ) { m_midiPort->setInputChannel( _new_chnl - 1 ); - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); } @@ -383,7 +382,7 @@ void midiTabWidget::inputChannelChanged( int _new_chnl ) void midiTabWidget::outputChannelChanged( int _new_chnl ) { m_midiPort->setOutputChannel( _new_chnl - 1 ); - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); } @@ -465,7 +464,7 @@ void midiTabWidget::midiPortModeToggled( bool ) } #endif } - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); } @@ -497,7 +496,7 @@ void midiTabWidget::readablePortsChanged( void ) #endif m_readablePorts->clear(); - const QStringList & rp = eng()->getMixer()->getMIDIClient()-> + const QStringList & rp = engine::getMixer()->getMIDIClient()-> readablePorts(); // now insert new ports and restore selections for( QStringList::const_iterator it = rp.begin(); it != rp.end(); ++it ) @@ -549,7 +548,7 @@ void midiTabWidget::writeablePortsChanged( void ) #endif m_writeablePorts->clear(); - const QStringList & wp = eng()->getMixer()->getMIDIClient()-> + const QStringList & wp = engine::getMixer()->getMIDIClient()-> writeablePorts(); // now insert new ports and restore selections for( QStringList::const_iterator it = wp.begin(); it != wp.end(); ++it ) @@ -584,7 +583,7 @@ void midiTabWidget::activatedReadablePort( QAction * _item ) { m_receiveCheckBox->setChecked( TRUE ); } - eng()->getMixer()->getMIDIClient()->subscribeReadablePort( m_midiPort, + engine::getMixer()->getMIDIClient()->subscribeReadablePort( m_midiPort, _item->text(), !_item->isChecked() ); } @@ -600,7 +599,7 @@ void midiTabWidget::activatedWriteablePort( QAction * _item ) { m_sendCheckBox->setChecked( TRUE ); } - eng()->getMixer()->getMIDIClient()->subscribeWriteablePort( m_midiPort, + engine::getMixer()->getMIDIClient()->subscribeWriteablePort( m_midiPort, _item->text(), !_item->isChecked() ); } @@ -622,7 +621,7 @@ void midiTabWidget::activatedReadablePort( int _id ) } m_readablePorts->setItemChecked( _id, !m_readablePorts->isItemChecked( _id ) ); - eng()->getMixer()->getMIDIClient()->subscribeReadablePort( + engine::getMixer()->getMIDIClient()->subscribeReadablePort( m_midiPort, m_readablePorts->text( _id ), !m_readablePorts->isItemChecked( _id ) ); } @@ -641,7 +640,7 @@ void midiTabWidget::activatedWriteablePort( int _id ) } m_writeablePorts->setItemChecked( _id, !m_writeablePorts->isItemChecked( _id ) ); - eng()->getMixer()->getMIDIClient()->subscribeWriteablePort( + engine::getMixer()->getMIDIClient()->subscribeWriteablePort( m_midiPort, m_writeablePorts->text( _id ), !m_writeablePorts->isItemChecked( _id ) ); } diff --git a/src/core/mixer.cpp b/src/core/mixer.cpp index a45ffc6c1..d258151fa 100644 --- a/src/core/mixer.cpp +++ b/src/core/mixer.cpp @@ -3,7 +3,7 @@ /* * mixer.cpp - audio-device-independent mixer for LMMS * - * Copyright (c) 2004-2006 Tobias Doerffel + * Copyright (c) 2004-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -34,6 +34,7 @@ #include "envelope_and_lfo_widget.h" #include "buffer_allocator.h" #include "debug.h" +#include "engine.h" #include "config_mgr.h" #include "audio_port.h" #include "sample_play_handle.h" @@ -61,9 +62,7 @@ sample_rate_t SAMPLE_RATES[QUALITY_LEVELS] = { 44100, 88200 } ; -mixer::mixer( engine * _engine ) : - QObject(), - engineObject( _engine ), +mixer::mixer( void ) : m_framesPerAudioBuffer( DEFAULT_BUFFER_SIZE ), m_readBuf( NULL ), m_writeBuf( NULL ), @@ -81,12 +80,24 @@ mixer::mixer( engine * _engine ) : { m_framesPerAudioBuffer = configManager::inst()->value( "mixer", "framesperaudiobuffer" ).toInt(); + + if( m_framesPerAudioBuffer > DEFAULT_BUFFER_SIZE ) + { + m_fifo = new fifo( m_framesPerAudioBuffer + / DEFAULT_BUFFER_SIZE ); + m_framesPerAudioBuffer = DEFAULT_BUFFER_SIZE; + } + else + { + m_fifo = new fifo( 1 ); + } } else { configManager::inst()->setValue( "mixer", "framesperaudiobuffer", QString::number( m_framesPerAudioBuffer ) ); + m_fifo = new fifo( 1 ); } if( configManager::inst()->value( "mixer", "parallelizinglevel" @@ -113,6 +124,12 @@ mixer::mixer( engine * _engine ) : mixer::~mixer() { + while( m_fifo->available() ) + { + delete[] m_fifo->read(); + } + delete m_fifo; + delete m_audioDev; delete m_midiClient; @@ -136,6 +153,9 @@ void mixer::initDevices( void ) void mixer::startProcessing( void ) { + m_fifo_writer = new fifoWriter( this, m_fifo ); + m_fifo_writer->start(); + m_audioDev->startProcessing(); } @@ -144,6 +164,11 @@ void mixer::startProcessing( void ) void mixer::stopProcessing( void ) { + m_fifo_writer->finish(); + m_fifo_writer->wait( 1000 ); + m_fifo_writer->terminate(); + delete m_fifo_writer; + m_audioDev->stopProcessing(); } @@ -153,7 +178,7 @@ void mixer::stopProcessing( void ) bool mixer::criticalXRuns( void ) const { return( ( m_cpuLoad >= 99 && - eng()->getSongEditor()->realTimeTask() == TRUE ) ); + engine::getSongEditor()->realTimeTask() == TRUE ) ); } @@ -209,14 +234,13 @@ const surroundSampleFrame * mixer::renderNextBuffer( void ) static songEditor::playPos last_metro_pos = -1; - songEditor::playPos p = eng()->getSongEditor()->getPlayPos( + songEditor::playPos p = engine::getSongEditor()->getPlayPos( songEditor::PLAY_PATTERN ); - if( eng()->getSongEditor()->playMode() == songEditor::PLAY_PATTERN && - eng()->getPianoRoll()->isRecording() == TRUE && + if( engine::getSongEditor()->playMode() == songEditor::PLAY_PATTERN && + engine::getPianoRoll()->isRecording() == TRUE && p != last_metro_pos && p.getTact64th() % 16 == 0 ) { - addPlayHandle( new samplePlayHandle( "misc/metronome01.ogg", - eng() ) ); + addPlayHandle( new samplePlayHandle( "misc/metronome01.ogg" ) ); last_metro_pos = p; } @@ -334,7 +358,7 @@ const surroundSampleFrame * mixer::renderNextBuffer( void ) } } - eng()->getSongEditor()->processNextBuffer(); + engine::getSongEditor()->processNextBuffer(); bool more_effects = FALSE; for( vvector::iterator it = m_audioPorts.begin(); @@ -357,7 +381,7 @@ const surroundSampleFrame * mixer::renderNextBuffer( void ) m_mixMutex.unlock(); // and trigger LFOs - envelopeAndLFOWidget::triggerLFO( eng() ); + envelopeAndLFOWidget::triggerLFO(); const float new_cpu_load = timer.elapsed() / 10000.0f * sampleRate() / m_framesPerAudioBuffer; @@ -464,16 +488,14 @@ void FASTCALL mixer::bufferToPort( const sampleFrame * _buf, void mixer::setHighQuality( bool _hq_on ) { - // delete (= close) our audio-device - delete m_audioDev; + // don't delete the audio-device + stopProcessing(); // set new quality-level... m_qualityLevel = ( _hq_on == TRUE ) ? HIGH_QUALITY_LEVEL : DEFAULT_QUALITY_LEVEL; - // and re-open device - m_audioDev = tryAudioDevices(); - m_audioDev->startProcessing(); + startProcessing(); emit( sampleRateChanged() ); @@ -484,7 +506,7 @@ void mixer::setHighQuality( bool _hq_on ) void FASTCALL mixer::setAudioDevice( audioDevice * _dev, bool _hq ) { - m_audioDev->stopProcessing(); + stopProcessing(); m_oldAudioDev = m_audioDev; @@ -501,6 +523,8 @@ void FASTCALL mixer::setAudioDevice( audioDevice * _dev, bool _hq ) m_qualityLevel = _hq ? HIGH_QUALITY_LEVEL : DEFAULT_QUALITY_LEVEL; emit sampleRateChanged(); + + startProcessing(); } @@ -510,8 +534,9 @@ void mixer::restoreAudioDevice( void ) { if( m_oldAudioDev != NULL ) { - delete m_audioDev; // dtor automatically calls - // stopProcessing() + stopProcessing(); + delete m_audioDev; + m_audioDev = m_oldAudioDev; for( Uint8 qli = DEFAULT_QUALITY_LEVEL; qli < QUALITY_LEVELS; ++qli ) @@ -525,7 +550,7 @@ void mixer::restoreAudioDevice( void ) } } m_oldAudioDev = NULL; - m_audioDev->startProcessing(); + startProcessing(); } } @@ -640,7 +665,7 @@ midiClient * mixer::tryMIDIClients( void ) #ifdef ALSA_SUPPORT if( client_name == midiALSASeq::name() || client_name == "" ) { - midiALSASeq * malsas = new midiALSASeq( eng() ); + midiALSASeq * malsas = new midiALSASeq; if( malsas->isRunning() ) { m_midiClientName = midiALSASeq::name(); @@ -651,7 +676,7 @@ midiClient * mixer::tryMIDIClients( void ) if( client_name == midiALSARaw::name() || client_name == "" ) { - midiALSARaw * malsar = new midiALSARaw( eng() ); + midiALSARaw * malsar = new midiALSARaw; if( malsar->isRunning() ) { m_midiClientName = midiALSARaw::name(); @@ -664,7 +689,7 @@ midiClient * mixer::tryMIDIClients( void ) #ifdef OSS_SUPPORT if( client_name == midiOSS::name() || client_name == "" ) { - midiOSS * moss = new midiOSS( eng() ); + midiOSS * moss = new midiOSS; if( moss->isRunning() ) { m_midiClientName = midiOSS::name(); @@ -679,7 +704,7 @@ midiClient * mixer::tryMIDIClients( void ) m_midiClientName = midiDummy::name(); - return( new midiDummy( eng() ) ); + return( new midiDummy ); } @@ -779,6 +804,47 @@ void FASTCALL mixer::scaleClip( fpab_t _frame, ch_cnt_t _chnl ) } + + + + + + +mixer::fifoWriter::fifoWriter( mixer * _mixer, fifo * _fifo ) : + m_mixer( _mixer ), + m_fifo( _fifo ), + m_writing( TRUE ) +{ +} + + + + +void mixer::fifoWriter::finish( void ) +{ + m_writing = FALSE; +} + + + + +void mixer::fifoWriter::run( void ) +{ + while( m_writing ) + { + fpab_t frames = m_mixer->framesPerAudioBuffer(); + surroundSampleFrame * buffer = new surroundSampleFrame[frames]; + const surroundSampleFrame * b = m_mixer->renderNextBuffer(); + memcpy( buffer, b, frames * sizeof( surroundSampleFrame ) ); + m_fifo->write( buffer ); + } + + m_fifo->write( NULL ); +} + + + + #include "mixer.moc" diff --git a/src/core/name_label.cpp b/src/core/name_label.cpp index c8d6a02f6..55a6644e6 100644 --- a/src/core/name_label.cpp +++ b/src/core/name_label.cpp @@ -4,7 +4,7 @@ * name_label.cpp - implementation of class nameLabel, a label which * is renamable by double-clicking it * - * Copyright (c) 2004-2006 Tobias Doerffel + * Copyright (c) 2004-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -49,13 +49,12 @@ #include "bb_track.h" #include "gui_templates.h" #include "config_mgr.h" +#include "engine.h" -nameLabel::nameLabel( const QString & _initial_name, QWidget * _parent, - engine * _engine ) : +nameLabel::nameLabel( const QString & _initial_name, QWidget * _parent ) : QLabel( _initial_name, _parent ), - engineObject( _engine ), m_pixmap(), m_pixmapFile( "" ) { @@ -287,7 +286,7 @@ void nameLabel::paintEvent( QPaintEvent * ) p.setPen( QColor( 0, 224, 0 ) ); bbTrack * bbt = bbTrack::findBBTrack( - eng()->getBBEditor()->currentBB(), eng() ); + engine::getBBEditor()->currentBB() ); if( bbt != NULL && bbt->getTrackSettingsWidget() == dynamic_cast( parentWidget() ) ) { diff --git a/src/core/note.cpp b/src/core/note.cpp index 6a940322a..2e721e794 100644 --- a/src/core/note.cpp +++ b/src/core/note.cpp @@ -50,17 +50,15 @@ const float note::MAX_DETUNING = 4 * 12.0f; -note::note( engine * _engine, const midiTime & _length, const midiTime & _pos, +note::note( const midiTime & _length, const midiTime & _pos, tones _tone, octaves _octave, volume _volume, - panning _panning ) : - journallingObject( _engine ), + panning _panning, knob * _detuning ) : m_tone( C ), m_octave( DEFAULT_OCTAVE ), m_volume( DEFAULT_VOLUME ), m_panning( DEFAULT_PANNING ), m_length( _length ), - m_pos( _pos ), - m_detuning( NULL ) + m_pos( _pos ) { //saveJournallingState( FALSE ); setJournalling( FALSE ); @@ -70,7 +68,11 @@ note::note( engine * _engine, const midiTime & _length, const midiTime & _pos, setVolume( _volume ); setPanning( _panning ); - if( _engine ) + if( _detuning ) + { + setDetuning( _detuning ); + } + else { createDetuning(); } @@ -315,8 +317,8 @@ void note::createDetuning( void ) { m_detuning = new knob( knobDark_28, NULL, QObject::tr( "Note detuning" ), - eng(), NULL ); - m_detuning->initAutomationPattern( eng() ); + NULL ); + m_detuning->initAutomationPattern(); m_detuning->setData( 0 ); m_detuning->setRange( -MAX_DETUNING, MAX_DETUNING, 0.1f ); } diff --git a/src/core/note_play_handle.cpp b/src/core/note_play_handle.cpp index cce8817ce..ddf8f38c9 100644 --- a/src/core/note_play_handle.cpp +++ b/src/core/note_play_handle.cpp @@ -43,8 +43,8 @@ notePlayHandle::notePlayHandle( instrumentTrack * _it, const note & _n, const bool _arp_note ) : playHandle( NotePlayHandle ), - note( NULL, _n.length(), _n.pos(), _n.tone(), _n.octave(), - _n.getVolume(), _n.getPanning() ), + note( _n.length(), _n.pos(), _n.tone(), _n.octave(), + _n.getVolume(), _n.getPanning(), _n.detuning() ), m_pluginData( NULL ), m_filter( NULL ), m_instrumentTrack( _it ), @@ -62,9 +62,8 @@ notePlayHandle::notePlayHandle( instrumentTrack * _it, #if SINGERBOT_SUPPORT m_patternIndex( 0 ), #endif - m_orig_bpm( _it->eng()->getSongEditor()->getTempo() ) + m_orig_bpm( engine::getSongEditor()->getTempo() ) { - setDetuning( _n.detuning() ); if( detuning() ) { processMidiTime( pos() ); @@ -90,8 +89,8 @@ notePlayHandle::notePlayHandle( instrumentTrack * _it, (Uint16) ( ( getVolume() / 100.0f ) * ( m_instrumentTrack->getVolume() / 100.0f ) * 127 ), 0, 127 ) ), - midiTime::fromFrames( m_framesAhead, m_instrumentTrack - ->eng()->framesPerTact64th() ) ); + midiTime::fromFrames( m_framesAhead, + engine::framesPerTact64th() ) ); } @@ -137,9 +136,8 @@ void notePlayHandle::play( bool _try_parallelizing ) } if( m_released == FALSE && - m_totalFramesPlayed + - m_instrumentTrack->eng()->getMixer()->framesPerAudioBuffer() >= - m_frames ) + m_totalFramesPlayed + engine::getMixer()->framesPerAudioBuffer() + >= m_frames ) { noteOff( m_frames - m_totalFramesPlayed ); } @@ -149,8 +147,7 @@ void notePlayHandle::play( bool _try_parallelizing ) if( m_released == TRUE ) { - f_cnt_t todo = - m_instrumentTrack->eng()->getMixer()->framesPerAudioBuffer(); + f_cnt_t todo = engine::getMixer()->framesPerAudioBuffer(); // if this note is base-note for arpeggio, always set // m_releaseFramesToDo to bigger value than m_releaseFramesDone // because we do not allow notePlayHandle::done() to be true @@ -159,7 +156,7 @@ void notePlayHandle::play( bool _try_parallelizing ) if( arpBaseNote() == TRUE ) { m_releaseFramesToDo = m_releaseFramesDone + 2 * - m_instrumentTrack->eng()->getMixer()->framesPerAudioBuffer(); + engine::getMixer()->framesPerAudioBuffer(); } // look whether we have frames left to be done before release if( m_framesBeforeRelease ) @@ -167,7 +164,7 @@ void notePlayHandle::play( bool _try_parallelizing ) // yes, then look whether these samples can be played // within one audio-buffer if( m_framesBeforeRelease <= - m_instrumentTrack->eng()->getMixer()->framesPerAudioBuffer() ) + engine::getMixer()->framesPerAudioBuffer() ) { // yes, then we did less releaseFramesDone todo -= m_framesBeforeRelease; @@ -180,7 +177,7 @@ void notePlayHandle::play( bool _try_parallelizing ) // release-phase yet) todo = 0; m_framesBeforeRelease -= - m_instrumentTrack->eng()->getMixer()->framesPerAudioBuffer(); + engine::getMixer()->framesPerAudioBuffer(); } } // look whether we're in release-phase @@ -228,8 +225,7 @@ void notePlayHandle::play( bool _try_parallelizing ) } // update internal data - m_totalFramesPlayed += - m_instrumentTrack->eng()->getMixer()->framesPerAudioBuffer(); + m_totalFramesPlayed += engine::getMixer()->framesPerAudioBuffer(); } @@ -290,8 +286,7 @@ void notePlayHandle::noteOff( const f_cnt_t _s ) m_instrumentTrack->m_midiPort->outputChannel(), key(), 0 ), midiTime::fromFrames( m_framesBeforeRelease, - m_instrumentTrack->eng() - ->framesPerTact64th() ) ); + engine::framesPerTact64th() ) ); } else { @@ -354,8 +349,7 @@ void notePlayHandle::mute( void ) int notePlayHandle::index( void ) const { - const playHandleVector & phv = - m_instrumentTrack->eng()->getMixer()->playHandles(); + const playHandleVector & phv = engine::getMixer()->playHandles(); int idx = 0; for( constPlayHandleVector::const_iterator it = phv.begin(); it != phv.end(); ++it ) @@ -383,7 +377,7 @@ int notePlayHandle::index( void ) const constNotePlayHandleVector notePlayHandle::nphsOfInstrumentTrack( const instrumentTrack * _it, bool _all_ph ) { - const playHandleVector & phv = _it->eng()->getMixer()->playHandles(); + const playHandleVector & phv = engine::getMixer()->playHandles(); constNotePlayHandleVector cnphv; for( constPlayHandleVector::const_iterator it = phv.begin(); diff --git a/src/core/piano_roll.cpp b/src/core/piano_roll.cpp index f511de37e..b92dabe69 100644 --- a/src/core/piano_roll.cpp +++ b/src/core/piano_roll.cpp @@ -135,9 +135,8 @@ pianoRoll::pianoRollKeyTypes pianoRoll::prKeyOrder[] = const int DEFAULT_PR_PPT = KEY_LINE_HEIGHT * DEFAULT_STEPS_PER_TACT; -pianoRoll::pianoRoll( engine * _engine ) : - QWidget( _engine->getMainWindow()->workspace() ), - journallingObject( _engine ), +pianoRoll::pianoRoll( void ) : + QWidget( engine::getMainWindow()->workspace() ), m_paintPixmap(), m_pattern( NULL ), m_currentPosition(), @@ -198,15 +197,14 @@ pianoRoll::pianoRoll( engine * _engine ) : #ifdef QT4 // add us to workspace - eng()->getMainWindow()->workspace()->addWindow( this ); + engine::getMainWindow()->workspace()->addWindow( this ); #endif // add time-line m_timeLine = new timeLine( WHITE_KEY_WIDTH, 32, m_ppt, - eng()->getSongEditor()->getPlayPos( + engine::getSongEditor()->getPlayPos( songEditor::PLAY_PATTERN ), - m_currentPosition, this, - eng() ); + m_currentPosition, this ); connect( this, SIGNAL( positionChanged( const midiTime & ) ), m_timeLine, SLOT( updatePosition( const midiTime & ) ) ); connect( m_timeLine, SIGNAL( positionChanged( const midiTime & ) ), @@ -405,7 +403,7 @@ pianoRoll::pianoRoll( engine * _engine ) : zoom_lbl->setPixmap( embed::getIconPixmap( "zoom" ) ); // setup zooming-stuff - m_zoomingComboBox = new comboBox( m_toolBar, NULL, eng(), NULL ); + m_zoomingComboBox = new comboBox( m_toolBar, NULL, NULL ); m_zoomingComboBox->setFixedSize( 80, 22 ); for( int i = 0; i < 6; ++i ) { @@ -421,7 +419,7 @@ pianoRoll::pianoRoll( engine * _engine ) : QLabel * quantize_lbl = new QLabel( m_toolBar ); quantize_lbl->setPixmap( embed::getIconPixmap( "quantize" ) ); - m_quantizeComboBox = new comboBox( m_toolBar, NULL, eng(), NULL ); + m_quantizeComboBox = new comboBox( m_toolBar, NULL, NULL ); m_quantizeComboBox->setFixedSize( 60, 22 ); for( int i = 0; i < 7; ++i ) { @@ -434,7 +432,7 @@ pianoRoll::pianoRoll( engine * _engine ) : QLabel * note_len_lbl = new QLabel( m_toolBar ); note_len_lbl->setPixmap( embed::getIconPixmap( "note" ) ); - m_noteLenComboBox = new comboBox( m_toolBar, NULL, eng(), NULL ); + m_noteLenComboBox = new comboBox( m_toolBar, NULL, NULL ); m_noteLenComboBox->setFixedSize( 120, 22 ); m_noteLenComboBox->addItem( tr( "Last note" ), embed::getIconPixmap( "edit_draw" ) ); @@ -1186,7 +1184,7 @@ void pianoRoll::keyPressEvent( QKeyEvent * _ke ) break; case Qt::Key_Space: - if( eng()->getSongEditor()->playing() ) + if( engine::getSongEditor()->playing() ) { stop(); } @@ -1363,8 +1361,7 @@ void pianoRoll::mousePressEvent( QMouseEvent * _me ) midiTime note_pos( pos_tact_64th ); midiTime note_len( newNoteLen() ); - note new_note( eng(), - note_len, note_pos, + note new_note( note_len, note_pos, (tones)( key_num % NOTES_PER_OCTAVE ), (octaves)( key_num / @@ -1415,7 +1412,7 @@ void pianoRoll::mousePressEvent( QMouseEvent * _me ) QApplication::setOverrideCursor( c ); } - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); } else if( ( _me->button() == Qt::RightButton && m_editMode == DRAW ) || @@ -1435,7 +1432,7 @@ void pianoRoll::mousePressEvent( QMouseEvent * _me ) ( *it )->setLength( 0 ); m_pattern->update(); } - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); } } else if( _me->button() == Qt::LeftButton && @@ -1474,7 +1471,7 @@ void pianoRoll::mousePressEvent( QMouseEvent * _me ) m_action = MOVE_SELECTION; play_note = FALSE; - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); } else if( _me->button() == Qt::RightButton && m_editMode == MOVE ) @@ -1490,7 +1487,7 @@ void pianoRoll::mousePressEvent( QMouseEvent * _me ) // was there an action where should be played the note? if( play_note == TRUE && m_recording == FALSE && - eng()->getSongEditor()->playing() == FALSE ) + engine::getSongEditor()->playing() == FALSE ) { m_lastKey = key_num; m_pattern->getInstrumentTrack()->processInEvent( @@ -1579,7 +1576,7 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me ) m_action != SELECT_NOTES && m_action != MOVE_SELECTION && m_recording == FALSE && - eng()->getSongEditor()->playing() == FALSE ) + engine::getSongEditor()->playing() == FALSE ) { m_lastKey = key_num; m_pattern->getInstrumentTrack()->processInEvent( @@ -1662,7 +1659,7 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me ) m_pattern->update(); } - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); } else if( @@ -2116,7 +2113,7 @@ void pianoRoll::resizeEvent( QResizeEvent * ) } m_topBottomScroll->setValue( m_totalKeysToScroll - m_startKey ); - eng()->getSongEditor()->getPlayPos( songEditor::PLAY_PATTERN + engine::getSongEditor()->getPlayPos( songEditor::PLAY_PATTERN ).m_timeLine->setFixedWidth( width() ); m_toolBar->setFixedWidth( width() ); update(); @@ -2128,7 +2125,7 @@ void pianoRoll::resizeEvent( QResizeEvent * ) void pianoRoll::wheelEvent( QWheelEvent * _we ) { _we->accept(); - if( eng()->getMainWindow()->isCtrlPressed() == TRUE ) + if( engine::getMainWindow()->isCtrlPressed() == TRUE ) { if( _we->delta() > 0 ) { @@ -2148,7 +2145,7 @@ void pianoRoll::wheelEvent( QWheelEvent * _we ) m_timeLine->setPixelsPerTact( m_ppt ); update(); } - else if( eng()->getMainWindow()->isShiftPressed() ) + else if( engine::getMainWindow()->isShiftPressed() ) { m_leftRightScroll->setValue( m_leftRightScroll->value() - _we->delta() * 2 / 15 ); @@ -2194,31 +2191,31 @@ void pianoRoll::play( void ) return; } - if( eng()->getSongEditor()->playing() ) + if( engine::getSongEditor()->playing() ) { - if( eng()->getSongEditor()->playMode() != + if( engine::getSongEditor()->playMode() != songEditor::PLAY_PATTERN ) { - eng()->getSongEditor()->stop(); - eng()->getSongEditor()->playPattern( m_pattern ); + engine::getSongEditor()->stop(); + engine::getSongEditor()->playPattern( m_pattern ); m_playButton->setIcon( embed::getIconPixmap( "pause" ) ); } else { - eng()->getSongEditor()->pause(); + engine::getSongEditor()->pause(); m_playButton->setIcon( embed::getIconPixmap( "play" ) ); } } - else if( eng()->getSongEditor()->paused() ) + else if( engine::getSongEditor()->paused() ) { - eng()->getSongEditor()->resumeFromPause(); + engine::getSongEditor()->resumeFromPause(); m_playButton->setIcon( embed::getIconPixmap( "pause" ) ); } else { m_playButton->setIcon( embed::getIconPixmap( "pause" ) ); - eng()->getSongEditor()->playPattern( m_pattern ); + engine::getSongEditor()->playPattern( m_pattern ); } } @@ -2227,7 +2224,7 @@ void pianoRoll::play( void ) void pianoRoll::record( void ) { - if( eng()->getSongEditor()->playing() ) + if( engine::getSongEditor()->playing() ) { stop(); } @@ -2237,7 +2234,7 @@ void pianoRoll::record( void ) } m_recording = TRUE; - eng()->getSongEditor()->playPattern( m_pattern, FALSE ); + engine::getSongEditor()->playPattern( m_pattern, FALSE ); } @@ -2245,7 +2242,7 @@ void pianoRoll::record( void ) void pianoRoll::stop( void ) { - eng()->getSongEditor()->stop(); + engine::getSongEditor()->stop(); m_playButton->setIcon( embed::getIconPixmap( "play" ) ); m_playButton->update(); m_recording = FALSE; @@ -2259,7 +2256,7 @@ void pianoRoll::recordNote( const note & _n ) { if( m_recording == TRUE && validPattern() == TRUE ) { - note n( eng(), _n.length(), eng()->getSongEditor()->getPlayPos( + note n( _n.length(), engine::getSongEditor()->getPlayPos( songEditor::PLAY_PATTERN ) - _n.length(), _n.tone(), _n.octave(), _n.getVolume(), _n.getPanning() ); @@ -2272,7 +2269,7 @@ void pianoRoll::recordNote( const note & _n ) #ifndef QT4 qApp->unlock(); #endif - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); } } @@ -2500,7 +2497,7 @@ void pianoRoll::cutSelectedNotes( void ) if( selected_notes.empty() == FALSE ) { - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); midiTime start_pos( selected_notes.front()->pos().getTact(), 0 ); @@ -2519,7 +2516,7 @@ void pianoRoll::cutSelectedNotes( void ) } update(); - eng()->getSongEditor()->update(); + engine::getSongEditor()->update(); } @@ -2545,9 +2542,9 @@ void pianoRoll::pasteNotes( void ) // we only have to do the following lines if we pasted at // least one note... - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); update(); - eng()->getSongEditor()->update(); + engine::getSongEditor()->update(); } } @@ -2574,9 +2571,9 @@ void pianoRoll::deleteSelectedNotes( void ) if( update_after_delete == TRUE ) { - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); update(); - eng()->getSongEditor()->update(); + engine::getSongEditor()->update(); } } @@ -2585,8 +2582,8 @@ void pianoRoll::deleteSelectedNotes( void ) void pianoRoll::updatePosition( const midiTime & _t ) { - if( ( eng()->getSongEditor()->playing() && - eng()->getSongEditor()->playMode() == + if( ( engine::getSongEditor()->playing() && + engine::getSongEditor()->playMode() == songEditor::PLAY_PATTERN ) || m_scrollBack == TRUE ) { diff --git a/src/core/piano_widget.cpp b/src/core/piano_widget.cpp index 5cc12a268..150a52b30 100644 --- a/src/core/piano_widget.cpp +++ b/src/core/piano_widget.cpp @@ -4,7 +4,7 @@ * piano_widget.cpp - implementation of piano-widget used in channel-window * for testing channel * - * Copyright (c) 2004-2006 Tobias Doerffel + * Copyright (c) 2004-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -153,8 +153,7 @@ pianoWidget::pianoWidget( instrumentTrack * _parent ) : setBackgroundMode( Qt::NoBackground ); #endif - m_noteKnob = new knob( knobDark_28, NULL, tr ( "Base note" ), - _parent->eng(), _parent ); + m_noteKnob = new knob( knobDark_28, NULL, tr( "Base note" ), _parent ); m_noteKnob->setRange( 0, NOTES_PER_OCTAVE * OCTAVES - 1, 1.0f ); m_noteKnob->setInitValue( DEFAULT_OCTAVE * NOTES_PER_OCTAVE + A ); diff --git a/src/core/plugin.cpp b/src/core/plugin.cpp index 8e27dba14..90b70f67c 100644 --- a/src/core/plugin.cpp +++ b/src/core/plugin.cpp @@ -3,7 +3,7 @@ /* * plugin.cpp - implementation of plugin-class including plugin-loader * - * Copyright (c) 2005-2006 Tobias Doerffel + * Copyright (c) 2005-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -63,8 +63,7 @@ static plugin::descriptor dummy_plugin_descriptor = -plugin::plugin( const descriptor * _descriptor, engine * _engine ) : - journallingObject( _engine ), +plugin::plugin( const descriptor * _descriptor ) : m_descriptor( _descriptor ) { if( dummy_plugin_descriptor.logo == NULL ) diff --git a/src/core/plugin_browser.cpp b/src/core/plugin_browser.cpp index 89ab392b7..43dd4259c 100644 --- a/src/core/plugin_browser.cpp +++ b/src/core/plugin_browser.cpp @@ -3,7 +3,7 @@ /* * plugin_browser.cpp - implementation of the plugin-browser * - * Copyright (c) 2005-2006 Tobias Doerffel + * Copyright (c) 2005-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -52,10 +52,9 @@ -pluginBrowser::pluginBrowser( QWidget * _parent, engine * _engine ) : +pluginBrowser::pluginBrowser( QWidget * _parent ) : sideBarWidget( tr( "Instrument plugins" ), - embed::getIconPixmap( "plugins" ), _parent ), - engineObject( _engine ) + embed::getIconPixmap( "plugins" ), _parent ) { setWindowTitle( tr( "Plugin browser" ) ); m_view = new QWidget( contentParent() ); @@ -91,7 +90,7 @@ pluginBrowser::pluginBrowser( QWidget * _parent, engine * _engine ) : if( it->type == plugin::Instrument ) { pluginDescWidget * p = new pluginDescWidget( *it, - m_view, eng() ); + m_view ); p->show(); view_layout->addWidget( p ); } @@ -114,9 +113,8 @@ pluginBrowser::~pluginBrowser() pluginDescWidget::pluginDescWidget( const plugin::descriptor & _pd, - QWidget * _parent, engine * _engine ) : + QWidget * _parent ) : QWidget( _parent ), - engineObject( _engine ), m_updateTimer( this ), m_pluginDescriptor( _pd ), m_logo( *_pd.logo ), @@ -242,7 +240,7 @@ void pluginDescWidget::mousePressEvent( QMouseEvent * _me ) if( _me->button() == Qt::LeftButton ) { new stringPairDrag( "instrument", m_pluginDescriptor.name, - m_logo, this, eng() ); + m_logo, this ); leaveEvent( _me ); } } diff --git a/src/core/preset_preview_play_handle.cpp b/src/core/preset_preview_play_handle.cpp index 6c779c7ca..85a47568a 100644 --- a/src/core/preset_preview_play_handle.cpp +++ b/src/core/preset_preview_play_handle.cpp @@ -4,7 +4,7 @@ * preset_preview_play_handle.cpp - implementation of class * presetPreviewPlayHandle * - * Copyright (c) 2005-2006 Tobias Doerffel + * Copyright (c) 2005-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -55,8 +55,7 @@ class previewTrackContainer : public trackContainer { public: - previewTrackContainer( engine * _engine ) : - trackContainer( _engine ), + previewTrackContainer( void ) : m_previewInstrumentTrack( NULL ), m_previewNote( NULL ), m_dataMutex() @@ -119,58 +118,55 @@ private: } ; -QMap - presetPreviewPlayHandle::s_previewTCs; +previewTrackContainer * presetPreviewPlayHandle::s_previewTC; presetPreviewPlayHandle::presetPreviewPlayHandle( - const QString & _preset_file, - engine * _engine ) : + const QString & _preset_file ) : playHandle( PresetPreviewHandle ), - engineObject( _engine ), m_previewNote( NULL ) { - if( s_previewTCs.contains( _engine ) == FALSE ) + if( !s_previewTC ) { - s_previewTCs[_engine] = new previewTrackContainer( eng() ); + s_previewTC = new previewTrackContainer; } - previewTC()->lockData(); + s_previewTC->lockData(); - if( previewTC()->previewNote() != NULL ) + if( s_previewTC->previewNote() != NULL ) { - previewTC()->previewNote()->mute(); + s_previewTC->previewNote()->mute(); } - const bool j = eng()->getProjectJournal()->isJournalling(); - eng()->getProjectJournal()->setJournalling( FALSE ); + const bool j = engine::getProjectJournal()->isJournalling(); + engine::getProjectJournal()->setJournalling( FALSE ); multimediaProject mmp( _preset_file ); - previewTC()->previewInstrumentTrack()->loadTrackSpecificSettings( + s_previewTC->previewInstrumentTrack()->loadTrackSpecificSettings( mmp.content().firstChild().toElement() ); // preset also contains information about window-states etc. that's why // here we have to make sure that the instrument-track-window is hidden - previewTC()->previewInstrumentTrack()->hide(); + s_previewTC->previewInstrumentTrack()->hide(); // make sure, our preset-preview-track does not appear in any MIDI- // devices list, so just disable receiving/sending MIDI-events at all - previewTC()->previewInstrumentTrack()->m_midiPort->setMode( + s_previewTC->previewInstrumentTrack()->m_midiPort->setMode( midiPort::DUMMY ); // create note-play-handle for it m_previewNote = new notePlayHandle( - previewTC()->previewInstrumentTrack(), 0, + s_previewTC->previewInstrumentTrack(), 0, valueRanges::max, - note( NULL, 0, 0, static_cast( A ), + note( 0, 0, static_cast( A ), static_cast( DEFAULT_OCTAVE - 1 ), 100 ) ); - previewTC()->setPreviewNote( m_previewNote ); + s_previewTC->setPreviewNote( m_previewNote ); - previewTC()->unlockData(); - eng()->getProjectJournal()->setJournalling( j ); + s_previewTC->unlockData(); + engine::getProjectJournal()->setJournalling( j ); } @@ -178,15 +174,15 @@ presetPreviewPlayHandle::presetPreviewPlayHandle( presetPreviewPlayHandle::~presetPreviewPlayHandle() { - previewTC()->lockData(); + s_previewTC->lockData(); // not muted by other preset-preview-handle? if( m_previewNote->muted() == FALSE ) { // then set according state - previewTC()->setPreviewNote( NULL ); + s_previewTC->setPreviewNote( NULL ); } delete m_previewNote; - previewTC()->unlockData(); + s_previewTC->unlockData(); } @@ -208,13 +204,10 @@ bool presetPreviewPlayHandle::done( void ) const -void presetPreviewPlayHandle::cleanUp( engine * _engine ) +void presetPreviewPlayHandle::cleanUp( void ) { - if( s_previewTCs.contains( _engine ) == TRUE ) - { - delete s_previewTCs[_engine]; - s_previewTCs.remove( _engine ); - } + delete s_previewTC; + s_previewTC = NULL; } @@ -224,17 +217,13 @@ constNotePlayHandleVector presetPreviewPlayHandle::nphsOfInstrumentTrack( const instrumentTrack * _it ) { constNotePlayHandleVector cnphv; - if( s_previewTCs.contains( _it->eng() ) == TRUE ) + s_previewTC->lockData(); + if( s_previewTC->previewNote() != NULL && + s_previewTC->previewNote()->getInstrumentTrack() == _it ) { - previewTrackContainer * tc = s_previewTCs[_it->eng()]; - tc->lockData(); - if( tc->previewNote() != NULL && - tc->previewNote()->getInstrumentTrack() == _it ) - { - cnphv.push_back( tc->previewNote() ); - } - tc->unlockData(); + cnphv.push_back( s_previewTC->previewNote() ); } + s_previewTC->unlockData(); return( cnphv ); } diff --git a/src/core/sample_play_handle.cpp b/src/core/sample_play_handle.cpp index 0ffbab53e..9bac56cc6 100644 --- a/src/core/sample_play_handle.cpp +++ b/src/core/sample_play_handle.cpp @@ -36,14 +36,12 @@ -samplePlayHandle::samplePlayHandle( const QString & _sample_file, - engine * _engine ) : +samplePlayHandle::samplePlayHandle( const QString & _sample_file ) : playHandle( SamplePlayHandle ), - engineObject( _engine ), - m_sampleBuffer( new sampleBuffer( eng(), _sample_file ) ), + m_sampleBuffer( new sampleBuffer( _sample_file ) ), m_doneMayReturnTrue( TRUE ), m_frame( 0 ), - m_audioPort( new audioPort( "samplePlayHandle", eng() ) ), + m_audioPort( new audioPort( "samplePlayHandle" ) ), m_ownAudioPort( TRUE ), m_volume( 1.0f ), m_track( NULL ), @@ -56,11 +54,10 @@ samplePlayHandle::samplePlayHandle( const QString & _sample_file, samplePlayHandle::samplePlayHandle( sampleBuffer * _sample_buffer ) : playHandle( SamplePlayHandle ), - engineObject( _sample_buffer->eng() ), m_sampleBuffer( sharedObject::ref( _sample_buffer ) ), m_doneMayReturnTrue( TRUE ), m_frame( 0 ), - m_audioPort( new audioPort( "samplePlayHandle", eng() ) ), + m_audioPort( new audioPort( "samplePlayHandle" ) ), m_ownAudioPort( TRUE ), m_volume( 1.0f ), m_track( NULL ), @@ -73,7 +70,6 @@ samplePlayHandle::samplePlayHandle( sampleBuffer * _sample_buffer ) : samplePlayHandle::samplePlayHandle( sampleTCO * _tco ) : playHandle( SamplePlayHandle ), - engineObject( _tco->eng() ), m_sampleBuffer( sharedObject::ref( _tco->getSampleBuffer() ) ), m_doneMayReturnTrue( TRUE ), m_frame( 0 ), @@ -90,7 +86,6 @@ samplePlayHandle::samplePlayHandle( sampleTCO * _tco ) : samplePlayHandle::samplePlayHandle( pattern * _pattern ) : playHandle( SamplePlayHandle ), - engineObject( _pattern->eng() ), m_sampleBuffer( sharedObject::ref( _pattern->getFrozenPattern() ) ), m_doneMayReturnTrue( TRUE ), m_frame( 0 ), @@ -132,7 +127,7 @@ void samplePlayHandle::play( const fpab_t _frame_base, bool ) return; } - const fpab_t frames = eng()->getMixer()->framesPerAudioBuffer() + const fpab_t frames = engine::getMixer()->framesPerAudioBuffer() - _frame_base; if( !( m_track && m_track->muted() ) && !( m_bbTrack && m_bbTrack->muted() ) ) @@ -145,7 +140,7 @@ void samplePlayHandle::play( const fpab_t _frame_base, bool ) #endif } } ; m_sampleBuffer->play( buf, &m_state, frames ); - eng()->getMixer()->bufferToPort( buf, frames, _frame_base, v, + engine::getMixer()->bufferToPort( buf, frames, _frame_base, v, m_audioPort ); bufferAllocator::free( buf ); @@ -167,7 +162,9 @@ bool samplePlayHandle::done( void ) const f_cnt_t samplePlayHandle::totalFrames( void ) const { - return( m_sampleBuffer->endFrame() - m_sampleBuffer->startFrame() ); + return( ( m_sampleBuffer->endFrame() - m_sampleBuffer->startFrame() ) * + ( engine::getMixer()->sampleRate() / + SAMPLE_RATES[DEFAULT_QUALITY_LEVEL] ) ); } diff --git a/src/core/setup_dialog.cpp b/src/core/setup_dialog.cpp index 467fd4dcc..a697a3198 100644 --- a/src/core/setup_dialog.cpp +++ b/src/core/setup_dialog.cpp @@ -58,6 +58,7 @@ #include "tab_widget.h" #include "gui_templates.h" #include "mixer.h" +#include "project_journal.h" #include "config_mgr.h" #include "embed.h" #include "debug.h" @@ -98,10 +99,9 @@ inline void labelWidget( QWidget * _w, const QString & _txt ) -setupDialog::setupDialog( engine * _engine, configTabs _tab_to_open ) : - QDialog(), - engineObject( _engine ), - m_bufferSize( eng()->getMixer()->framesPerAudioBuffer() ), +setupDialog::setupDialog( configTabs _tab_to_open ) : + m_bufferSize( configManager::inst()->value( "mixer", + "framesperaudiobuffer" ).toInt() ), m_disableToolTips( configManager::inst()->value( "tooltips", "disabled" ).toInt() ), m_classicalKnobUsability( configManager::inst()->value( "knobs", @@ -135,6 +135,8 @@ setupDialog::setupDialog( engine * _engine, configTabs _tab_to_open ) : setWindowTitle( tr( "Setup LMMS" ) ); setModal( TRUE ); + engine::getProjectJournal()->setJournalling( FALSE ); + QVBoxLayout * vlayout = new QVBoxLayout( this ); vlayout->setSpacing( 0 ); vlayout->setMargin( 0 ); @@ -170,10 +172,10 @@ setupDialog::setupDialog( engine * _engine, configTabs _tab_to_open ) : #else m_bufSizeSlider->setMinimum( 1 ); m_bufSizeSlider->setMaximum( 256 ); - m_bufSizeSlider->setLineStep( 4 ); + m_bufSizeSlider->setLineStep( 8 ); m_bufSizeSlider->setTickmarks( QSlider::Below ); #endif - m_bufSizeSlider->setPageStep( 4 ); + m_bufSizeSlider->setPageStep( 8 ); m_bufSizeSlider->setTickInterval( 8 ); m_bufSizeSlider->setGeometry( 10, 16, 340, 18 ); m_bufSizeSlider->setValue( m_bufferSize / 64 ); @@ -205,7 +207,7 @@ setupDialog::setupDialog( engine * _engine, configTabs _tab_to_open ) : ledCheckBox * disable_tooltips = new ledCheckBox( tr( "Disable tooltips (no spurious " "interrupts while playing)" ), - misc_tw, NULL, NULL, NULL ); + misc_tw, NULL, NULL ); disable_tooltips->move( 10, 18 ); disable_tooltips->setChecked( m_disableToolTips ); connect( disable_tooltips, SIGNAL( toggled( bool ) ), @@ -216,7 +218,7 @@ setupDialog::setupDialog( engine * _engine, configTabs _tab_to_open ) : tr( "Classical knob usability (move " "cursor around knob to change " "value)" ), - misc_tw, NULL, NULL, NULL ); + misc_tw, NULL, NULL ); classical_knob_usability->move( 10, 36 ); classical_knob_usability->setChecked( m_classicalKnobUsability ); connect( classical_knob_usability, SIGNAL( toggled( bool ) ), @@ -225,7 +227,7 @@ setupDialog::setupDialog( engine * _engine, configTabs _tab_to_open ) : ledCheckBox * gimp_like_windows = new ledCheckBox( tr( "GIMP-like windows (no MDI)" ), - misc_tw, NULL, NULL, NULL ); + misc_tw, NULL, NULL ); gimp_like_windows->move( 10, 54 ); gimp_like_windows->setChecked( m_gimpLikeWindows ); connect( gimp_like_windows, SIGNAL( toggled( bool ) ), @@ -234,7 +236,7 @@ setupDialog::setupDialog( engine * _engine, configTabs _tab_to_open ) : ledCheckBox * no_wizard = new ledCheckBox( tr( "Do not show wizard after up-/downgrade" ), - misc_tw, NULL, NULL, NULL ); + misc_tw, NULL, NULL ); no_wizard->move( 10, 72 ); no_wizard->setChecked( m_noWizard ); connect( no_wizard, SIGNAL( toggled( bool ) ), @@ -243,17 +245,16 @@ setupDialog::setupDialog( engine * _engine, configTabs _tab_to_open ) : ledCheckBox * no_msg = new ledCheckBox( tr( "Do not show message after " - "closing this dialog" ), - misc_tw, NULL, NULL, NULL ); + "closing this dialog" ), + misc_tw, NULL, NULL ); no_msg->move( 10, 90 ); no_msg->setChecked( m_noMsgAfterSetup ); connect( no_msg, SIGNAL( toggled( bool ) ), this, SLOT( toggleNoMsgAfterSetup( bool ) ) ); - ledCheckBox * dbv = new ledCheckBox( - tr( "Display volume as dbV " ), - misc_tw, NULL, NULL, NULL ); + ledCheckBox * dbv = new ledCheckBox( tr( "Display volume as dbV " ), + misc_tw, NULL, NULL ); dbv->move( 10, 108 ); dbv->setChecked( m_displaydBV ); connect( dbv, SIGNAL( toggled( bool ) ), @@ -262,7 +263,7 @@ setupDialog::setupDialog( engine * _engine, configTabs _tab_to_open ) : ledCheckBox * no_mmpz = new ledCheckBox( tr( "Do not compress project files per default" ), - misc_tw, NULL, NULL, NULL ); + misc_tw, NULL, NULL ); no_mmpz->move( 10, 126 ); no_mmpz->setChecked( m_noMMPZ ); connect( no_mmpz, SIGNAL( toggled( bool ) ), @@ -436,7 +437,7 @@ setupDialog::setupDialog( engine * _engine, configTabs _tab_to_open ) : ledCheckBox * disable_ch_act_ind = new ledCheckBox( tr( "Disable channel activity indicators" ), - ui_fx_tw, NULL, NULL, NULL ); + ui_fx_tw, NULL, NULL ); disable_ch_act_ind->move( 10, 20 ); disable_ch_act_ind->setChecked( m_disableChActInd ); connect( disable_ch_act_ind, SIGNAL( toggled( bool ) ), @@ -445,7 +446,7 @@ setupDialog::setupDialog( engine * _engine, configTabs _tab_to_open ) : ledCheckBox * manual_ch_piano = new ledCheckBox( tr( "Only press keys on channel-piano manually" ), - ui_fx_tw, NULL, NULL, NULL ); + ui_fx_tw, NULL, NULL ); manual_ch_piano->move( 10, 40 ); manual_ch_piano->setChecked( m_manualChPiano ); connect( manual_ch_piano, SIGNAL( toggled( bool ) ), @@ -461,7 +462,7 @@ setupDialog::setupDialog( engine * _engine, configTabs _tab_to_open ) : smp_supp_tw ); par_level_lbl->move( 10, 15 ); lcdSpinBox * par_level = new lcdSpinBox( 1, 16, 2, smp_supp_tw, NULL, - NULL, NULL ); + NULL ); par_level->setValue( m_parLevel ); connect( par_level, SIGNAL( valueChanged( int ) ), this, SLOT( setParallelizingLevel( int ) ) ); @@ -571,12 +572,12 @@ setupDialog::setupDialog( engine * _engine, configTabs _tab_to_open ) : } #ifdef QT4 m_audioInterfaces->setCurrentIndex( m_audioInterfaces->findText( - tr( eng()->getMixer()->audioDevName() ) ) ); + tr( engine::getMixer()->audioDevName() ) ) ); #else m_audioInterfaces->setCurrentText( - tr( eng()->getMixer()->audioDevName() ) ); + tr( engine::getMixer()->audioDevName() ) ); #endif - m_audioIfaceSetupWidgets[eng()->getMixer()->audioDevName()]->show(); + m_audioIfaceSetupWidgets[engine::getMixer()->audioDevName()]->show(); connect( m_audioInterfaces, SIGNAL( activated( const QString & ) ), this, SLOT( audioInterfaceChanged( const QString & ) ) ); @@ -658,12 +659,12 @@ setupDialog::setupDialog( engine * _engine, configTabs _tab_to_open ) : #ifdef QT4 m_midiInterfaces->setCurrentIndex( m_midiInterfaces->findText( - tr( eng()->getMixer()->midiClientName() ) ) ); + tr( engine::getMixer()->midiClientName() ) ) ); #else m_midiInterfaces->setCurrentText( - tr( eng()->getMixer()->midiClientName() ) ); + tr( engine::getMixer()->midiClientName() ) ); #endif - m_midiIfaceSetupWidgets[eng()->getMixer()->midiClientName()]->show(); + m_midiIfaceSetupWidgets[engine::getMixer()->midiClientName()]->show(); connect( m_midiInterfaces, SIGNAL( activated( const QString & ) ), this, SLOT( midiInterfaceChanged( const QString & ) ) ); @@ -739,6 +740,7 @@ setupDialog::setupDialog( engine * _engine, configTabs _tab_to_open ) : setupDialog::~setupDialog() { + engine::getProjectJournal()->setJournalling( TRUE ); } @@ -822,6 +824,21 @@ void setupDialog::accept( void ) void setupDialog::setBufferSize( int _value ) { + const int step = DEFAULT_BUFFER_SIZE / 64; + if( _value > step && _value % step ) + { + int mod_value = _value % step; + if( mod_value < step / 2 ) + { + m_bufSizeSlider->setValue( _value - mod_value ); + } + else + { + m_bufSizeSlider->setValue( _value + step - mod_value ); + } + return; + } + if( m_bufSizeSlider->value() != _value ) { m_bufSizeSlider->setValue( _value ); @@ -831,7 +848,7 @@ void setupDialog::setBufferSize( int _value ) m_bufSizeLbl->setText( tr( "Frames: %1\nLatency: %2 ms" ).arg( m_bufferSize ).arg( 1000.0f * m_bufferSize / - eng()->getMixer()->sampleRate(), + engine::getMixer()->sampleRate(), 0, 'f', 1 ) ); } diff --git a/src/core/song_editor.cpp b/src/core/song_editor.cpp index 2523f1d29..8cc6e2d9d 100644 --- a/src/core/song_editor.cpp +++ b/src/core/song_editor.cpp @@ -102,8 +102,7 @@ -songEditor::songEditor( engine * _engine ) : - trackContainer( _engine ), +songEditor::songEditor( void ) : m_fileName( "" ), m_oldFileName( "" ), m_exporting( FALSE ), @@ -121,7 +120,7 @@ songEditor::songEditor( engine * _engine ) : setWindowIcon( embed::getIconPixmap( "songeditor" ) ); QWidget * w = ( parentWidget() != NULL ) ? parentWidget() : this; - if( eng()->getMainWindow()->workspace() != NULL ) + if( engine::getMainWindow()->workspace() != NULL ) { resize( 680, 300 ); w->move( 10, 10 ); @@ -147,7 +146,7 @@ songEditor::songEditor( engine * _engine ) : timeLine * tl = new timeLine( TRACK_OP_WIDTH + DEFAULT_SETTINGS_WIDGET_WIDTH, 32, pixelsPerTact(), m_playPos[PLAY_SONG], - m_currentPosition, cw, eng() ); + m_currentPosition, cw ); connect( this, SIGNAL( positionChanged( const midiTime & ) ), m_playPos[PLAY_SONG].m_timeLine, SLOT( updatePosition( const midiTime & ) ) ); @@ -157,12 +156,12 @@ songEditor::songEditor( engine * _engine ) : m_automation_track = track::create( track::AUTOMATION_TRACK, this ); // add some essential widgets to global tool-bar - QWidget * tb = eng()->getMainWindow()->toolBar(); + QWidget * tb = engine::getMainWindow()->toolBar(); - eng()->getMainWindow()->addSpacingToToolBar( 10 ); + engine::getMainWindow()->addSpacingToToolBar( 10 ); m_bpmSpinBox = new lcdSpinBox( MIN_BPM, MAX_BPM, 3, tb, tr( "Tempo" ), - eng(), m_automation_track ); + m_automation_track ); m_bpmSpinBox->setLabel( tr( "TEMPO/BPM" ) ); connect( m_bpmSpinBox, SIGNAL( valueChanged( int ) ), this, SLOT( setTempo( int ) ) ); @@ -182,32 +181,33 @@ songEditor::songEditor( engine * _engine ) : "should be played within a minute (or how many tacts " "should be played within four minutes)." ) ); - int col = eng()->getMainWindow()->addWidgetToToolBar( m_bpmSpinBox, 0 ); + int col = engine::getMainWindow()->addWidgetToToolBar( m_bpmSpinBox, + 0 ); toolButton * hq_btn = new toolButton( embed::getIconPixmap( "hq_mode" ), tr( "High quality mode" ), NULL, NULL, tb ); hq_btn->setCheckable( TRUE ); - connect( hq_btn, SIGNAL( toggled( bool ) ), eng()->getMixer(), + connect( hq_btn, SIGNAL( toggled( bool ) ), engine::getMixer(), SLOT( setHighQuality( bool ) ) ); hq_btn->setFixedWidth( 42 ); - eng()->getMainWindow()->addWidgetToToolBar( hq_btn, 1, col ); + engine::getMainWindow()->addWidgetToToolBar( hq_btn, 1, col ); toolButton * cp_btn = new toolButton( embed::getIconPixmap( "auto_limit" ), tr( "Auto limiter" ), NULL, NULL, tb ); cp_btn->setCheckable( TRUE ); - connect( cp_btn, SIGNAL( toggled( bool ) ), eng()->getMixer(), + connect( cp_btn, SIGNAL( toggled( bool ) ), engine::getMixer(), SLOT( setClipScaling( bool ) ) ); cp_btn->setFixedWidth( 30 ); - eng()->getMainWindow()->addWidgetToToolBar( cp_btn, 1, col + 1 ); + engine::getMainWindow()->addWidgetToToolBar( cp_btn, 1, col + 1 ); - eng()->getMainWindow()->addSpacingToToolBar( 10 ); + engine::getMainWindow()->addSpacingToToolBar( 10 ); - connect( eng()->getMixer(), SIGNAL( sampleRateChanged() ), this, + connect( engine::getMixer(), SIGNAL( sampleRateChanged() ), this, SLOT( updateFramesPerTact64th() ) ); @@ -216,7 +216,7 @@ songEditor::songEditor( engine * _engine ) : master_vol_lbl->setPixmap( embed::getIconPixmap( "master_volume" ) ); m_masterVolumeSlider = new automatableSlider( tb, tr( "Master volume" ), - eng(), m_automation_track ); + m_automation_track ); m_masterVolumeSlider->setOrientation( Qt::Vertical ); m_masterVolumeSlider->setRange( 0, 200 ); m_masterVolumeSlider->setPageStep( 1 ); @@ -243,18 +243,18 @@ songEditor::songEditor( engine * _engine ) : m_mvsStatus->setTitle( tr( "Master volume" ) ); m_mvsStatus->setPixmap( embed::getIconPixmap( "master_volume" ) ); - eng()->getMainWindow()->addWidgetToToolBar( master_vol_lbl ); - eng()->getMainWindow()->addWidgetToToolBar( m_masterVolumeSlider ); + engine::getMainWindow()->addWidgetToToolBar( master_vol_lbl ); + engine::getMainWindow()->addWidgetToToolBar( m_masterVolumeSlider ); - eng()->getMainWindow()->addSpacingToToolBar( 10 ); + engine::getMainWindow()->addSpacingToToolBar( 10 ); QLabel * master_pitch_lbl = new QLabel( tb ); master_pitch_lbl->setPixmap( embed::getIconPixmap( "master_pitch" ) ); master_pitch_lbl->setFixedHeight( 64 ); m_masterPitchSlider = new automatableSlider( tb, tr( "Master pitch" ), - eng(), m_automation_track ); + m_automation_track ); m_masterPitchSlider->setOrientation( Qt::Vertical ); m_masterPitchSlider->setRange( -12, 12 ); m_masterPitchSlider->setPageStep( 1 ); @@ -280,10 +280,10 @@ songEditor::songEditor( engine * _engine ) : m_mpsStatus->setTitle( tr( "Master pitch" ) ); m_mpsStatus->setPixmap( embed::getIconPixmap( "master_pitch" ) ); - eng()->getMainWindow()->addWidgetToToolBar( master_pitch_lbl ); - eng()->getMainWindow()->addWidgetToToolBar( m_masterPitchSlider ); + engine::getMainWindow()->addWidgetToToolBar( master_pitch_lbl ); + engine::getMainWindow()->addWidgetToToolBar( m_masterPitchSlider ); - eng()->getMainWindow()->addSpacingToToolBar( 10 ); + engine::getMainWindow()->addSpacingToToolBar( 10 ); // create widget for visualization- and cpu-load-widget QWidget * vc_w = new QWidget( tb ); @@ -293,12 +293,12 @@ songEditor::songEditor( engine * _engine ) : //vcw_layout->addStretch(); vcw_layout->addWidget( new visualizationWidget( - embed::getIconPixmap( "output_graph" ), vc_w, eng() ) ); + embed::getIconPixmap( "output_graph" ), vc_w ) ); - vcw_layout->addWidget( new cpuloadWidget( vc_w, eng() ) ); + vcw_layout->addWidget( new cpuloadWidget( vc_w ) ); vcw_layout->addStretch(); - eng()->getMainWindow()->addWidgetToToolBar( vc_w ); + engine::getMainWindow()->addWidgetToToolBar( vc_w ); // create own toolbar @@ -399,7 +399,7 @@ songEditor::songEditor( engine * _engine ) : zoom_lbl->setPixmap( embed::getIconPixmap( "zoom" ) ); // setup zooming-stuff - m_zoomingComboBox = new comboBox( m_toolBar, NULL, eng(), NULL ); + m_zoomingComboBox = new comboBox( m_toolBar, NULL, NULL ); m_zoomingComboBox->setFixedSize( 80, 22 ); m_zoomingComboBox->move( 580, 4 ); for( int i = 0; i < 7; ++i ) @@ -516,13 +516,13 @@ void songEditor::resizeEvent( QResizeEvent * _re ) void songEditor::keyPressEvent( QKeyEvent * _ke ) { if( /*_ke->modifiers() & Qt::ShiftModifier*/ - eng()->getMainWindow()->isShiftPressed() == TRUE && + engine::getMainWindow()->isShiftPressed() == TRUE && _ke->key() == Qt::Key_Insert ) { insertBar(); } else if(/* _ke->modifiers() & Qt::ShiftModifier &&*/ - eng()->getMainWindow()->isShiftPressed() == TRUE && + engine::getMainWindow()->isShiftPressed() == TRUE && _ke->key() == Qt::Key_Delete ) { removeBar(); @@ -583,7 +583,7 @@ void songEditor::scrolled( int _new_pos ) void songEditor::wheelEvent( QWheelEvent * _we ) { - if( eng()->getMainWindow()->isCtrlPressed() == TRUE ) + if( engine::getMainWindow()->isCtrlPressed() == TRUE ) { if( _we->delta() > 0 ) { @@ -605,7 +605,7 @@ void songEditor::wheelEvent( QWheelEvent * _we ) // and make sure, all TCO's are resized and relocated realignTracks( TRUE ); } - else if( eng()->getMainWindow()->isShiftPressed() == TRUE ) + else if( engine::getMainWindow()->isShiftPressed() == TRUE ) { m_leftRightScroll->setValue( m_leftRightScroll->value() - _we->delta() / 30 ); @@ -634,7 +634,7 @@ void songEditor::masterVolumeChanged( int _new_val ) QPoint( m_masterVolumeSlider->width() + 2, -2 ) ); m_mvsStatus->setVisibilityTimeOut( 1000 ); } - eng()->getMixer()->setMasterGain( _new_val / 100.0f ); + engine::getMixer()->setMasterGain( _new_val / 100.0f ); } @@ -756,7 +756,7 @@ void songEditor::zoomingChanged( const QString & _zfac ) void songEditor::setTempo( int _new_bpm ) { - playHandleVector & phv = eng()->getMixer()->playHandles(); + playHandleVector & phv = engine::getMixer()->playHandles(); for( playHandleVector::iterator it = phv.begin(); it != phv.end(); ++it ) { @@ -768,7 +768,7 @@ void songEditor::setTempo( int _new_bpm ) } m_bpmSpinBox->setInitValue( _new_bpm ); - eng()->updateFramesPerTact64th(); + engine::updateFramesPerTact64th(); emit tempoChanged( _new_bpm ); } @@ -847,7 +847,7 @@ void songEditor::doActions( void ) updateTimeLinePosition(); // remove all note-play-handles that are active - eng()->getMixer()->clear(); + engine::getMixer()->clear(); break; } @@ -935,7 +935,7 @@ void songEditor::processNextBuffer( void ) // at song-start we have to reset the LFOs if( m_playPos[PLAY_SONG] == 0 ) { - envelopeAndLFOWidget::resetLFO( eng() ); + envelopeAndLFOWidget::resetLFO(); } break; @@ -944,11 +944,10 @@ void songEditor::processNextBuffer( void ) break; case PLAY_BB: - if( eng()->getBBEditor()->numOfBBs() > 0 ) + if( engine::getBBEditor()->numOfBBs() > 0 ) { - tco_num = eng()->getBBEditor()->currentBB(); - tv.push_back( bbTrack::findBBTrack( tco_num, - eng() ) ); + tco_num = engine::getBBEditor()->currentBB(); + tv.push_back( bbTrack::findBBTrack( tco_num ) ); } break; @@ -990,11 +989,12 @@ void songEditor::processNextBuffer( void ) } f_cnt_t total_frames_played = 0; - float frames_per_tact64th = eng()->framesPerTact64th(); + float frames_per_tact64th = engine::framesPerTact64th(); - while( total_frames_played < eng()->getMixer()->framesPerAudioBuffer() ) + while( total_frames_played + < engine::getMixer()->framesPerAudioBuffer() ) { - f_cnt_t played_frames = eng()->getMixer() + f_cnt_t played_frames = engine::getMixer() ->framesPerAudioBuffer() - total_frames_played; float current_frame = m_playPos[m_playMode].currentFrame(); @@ -1016,7 +1016,7 @@ void songEditor::processNextBuffer( void ) // or to loop back to first tact if( m_playMode == PLAY_BB ) { - max_tact = eng()->getBBEditor() + max_tact = engine::getBBEditor() ->lengthOfCurrentBB(); } else if( m_playMode == PLAY_PATTERN && @@ -1129,7 +1129,7 @@ void songEditor::play( void ) if( m_playMode != PLAY_SONG ) { // make sure, bb-editor updates/resets it play-button - eng()->getBBEditor()->stop(); + engine::getBBEditor()->stop(); //pianoRoll::inst()->stop(); } else @@ -1374,7 +1374,7 @@ bool songEditor::mayChangeProject( void ) #else information #endif - ( eng()->getMainWindow(), + ( engine::getMainWindow(), tr( "Project not saved" ), tr( "The current project was " "modified since last " @@ -1395,12 +1395,12 @@ bool songEditor::mayChangeProject( void ) QMessageBox::Yes, QMessageBox::No, QMessageBox::Cancel, - eng()->getMainWindow() ); + engine::getMainWindow() ); int answer = mb.exec(); if( answer == QMessageBox::Yes ) { - return( eng()->getMainWindow()->saveProject() ); + return( engine::getMainWindow()->saveProject() ); } else if( answer == QMessageBox::No ) { @@ -1415,7 +1415,7 @@ bool songEditor::mayChangeProject( void ) void songEditor::clearProject( void ) { - eng()->getProjectJournal()->setJournalling( FALSE ); + engine::getProjectJournal()->setJournalling( FALSE ); if( m_playing ) { @@ -1427,8 +1427,8 @@ void songEditor::clearProject( void ) // make sure all running notes are cleared, otherwise the whole // thing will end up in a SIGSEGV... - eng()->getMixer()->clear( TRUE ); - while( eng()->getMixer()->haveNoRunningNotes() == FALSE ) + engine::getMixer()->clear( TRUE ); + while( engine::getMixer()->haveNoRunningNotes() == FALSE ) { #ifdef QT4 QApplication::processEvents( QEventLoop::AllEvents ); @@ -1439,19 +1439,19 @@ void songEditor::clearProject( void ) clearAllTracks(); - eng()->getAutomationEditor()->setCurrentPattern( NULL ); + engine::getAutomationEditor()->setCurrentPattern( NULL ); m_bpmSpinBox->getAutomationPattern()->clear(); m_masterVolumeSlider->clearAutomationValues(); m_masterPitchSlider->clearAutomationValues(); - eng()->getBBEditor()->clearAllTracks(); + engine::getBBEditor()->clearAllTracks(); - eng()->getProjectNotes()->clear(); + engine::getProjectNotes()->clear(); - eng()->getProjectJournal()->clearInvalidJournallingObjects(); - eng()->getProjectJournal()->clearJournal(); + engine::getProjectJournal()->clearInvalidJournallingObjects(); + engine::getProjectJournal()->clearJournal(); - eng()->getProjectJournal()->setJournalling( TRUE ); + engine::getProjectJournal()->setJournalling( TRUE ); } @@ -1479,14 +1479,14 @@ void songEditor::createNewProject( void ) clearProject(); - eng()->getProjectJournal()->setJournalling( FALSE ); + engine::getProjectJournal()->setJournalling( FALSE ); track * t; t = track::create( track::INSTRUMENT_TRACK, this ); dynamic_cast< instrumentTrack * >( t )->loadInstrument( "tripleoscillator" ); track::create( track::SAMPLE_TRACK, this ); - t = track::create( track::INSTRUMENT_TRACK, eng()->getBBEditor() ); + t = track::create( track::INSTRUMENT_TRACK, engine::getBBEditor() ); dynamic_cast< instrumentTrack * >( t )->loadInstrument( "tripleoscillator" ); track::create( track::BB_TRACK, this ); @@ -1501,9 +1501,9 @@ void songEditor::createNewProject( void ) m_modified = FALSE; - eng()->getMainWindow()->resetWindowTitle( "" ); + engine::getMainWindow()->resetWindowTitle( "" ); - eng()->getProjectJournal()->setJournalling( TRUE ); + engine::getProjectJournal()->setJournalling( TRUE ); } @@ -1527,7 +1527,7 @@ void FASTCALL songEditor::loadProject( const QString & _file_name ) { clearProject(); - eng()->getProjectJournal()->setJournalling( FALSE ); + engine::getProjectJournal()->setJournalling( FALSE ); m_fileName = _file_name; m_oldFileName = _file_name; @@ -1600,21 +1600,21 @@ void FASTCALL songEditor::loadProject( const QString & _file_name ) restoreState( node.toElement() ); } else if( node.nodeName() == - eng()->getPianoRoll()->nodeName() ) + engine::getPianoRoll()->nodeName() ) { - eng()->getPianoRoll()->restoreState( + engine::getPianoRoll()->restoreState( node.toElement() ); } else if( node.nodeName() == - eng()->getAutomationEditor()->nodeName() ) + engine::getAutomationEditor()->nodeName() ) { - eng()->getAutomationEditor()->restoreState( + engine::getAutomationEditor()->restoreState( node.toElement() ); } else if( node.nodeName() == - eng()->getProjectNotes()->nodeName() ) + engine::getProjectNotes()->nodeName() ) { - ( (journallingObject *)( eng()-> + ( (journallingObject *)( engine:: getProjectNotes() ) )-> restoreState( node.toElement() ); } @@ -1633,9 +1633,9 @@ void FASTCALL songEditor::loadProject( const QString & _file_name ) m_loadingProject = FALSE; - eng()->getMainWindow()->resetWindowTitle( "" ); + engine::getMainWindow()->resetWindowTitle( "" ); - eng()->getProjectJournal()->setJournalling( TRUE ); + engine::getProjectJournal()->setJournalling( TRUE ); } @@ -1653,9 +1653,9 @@ bool songEditor::saveProject( void ) ( (journallingObject *)( this ) )->saveState( mmp, mmp.content() ); - eng()->getPianoRoll()->saveState( mmp, mmp.content() ); - eng()->getAutomationEditor()->saveState( mmp, mmp.content() ); - ( (journallingObject *)( eng()->getProjectNotes() ) )->saveState( mmp, + engine::getPianoRoll()->saveState( mmp, mmp.content() ); + engine::getAutomationEditor()->saveState( mmp, mmp.content() ); + ( (journallingObject *)( engine::getProjectNotes() ) )->saveState( mmp, mmp.content() ); m_playPos[PLAY_SONG].m_timeLine->saveState( mmp, mmp.content() ); @@ -1669,7 +1669,7 @@ bool songEditor::saveProject( void ) ).arg( m_fileName ), embed::getIconPixmap( "project_save", 24, 24 ), 2000 ); - eng()->getMainWindow()->resetWindowTitle( "" ); + engine::getMainWindow()->resetWindowTitle( "" ); } else { @@ -1739,7 +1739,7 @@ void songEditor::exportProject( void ) } base_filename += fileEncodeDevices[0].m_extension; - QFileDialog efd( eng()->getMainWindow() ); + QFileDialog efd( engine::getMainWindow() ); efd.setFileMode( QFileDialog::AnyFile ); int idx = 0; @@ -1777,7 +1777,7 @@ void songEditor::exportProject( void ) const QString export_file_name = efd.selectedFile(); #endif if( QFileInfo( export_file_name ).exists() == TRUE && - QMessageBox::warning( eng()->getMainWindow(), + QMessageBox::warning( engine::getMainWindow(), tr( "File already exists" ), tr( "The file \"%1\" already " "exists. Do you want " @@ -1793,7 +1793,7 @@ void songEditor::exportProject( void ) return; } exportProjectDialog epd( export_file_name, - eng()->getMainWindow(), eng() ); + engine::getMainWindow() ); epd.exec(); } } @@ -1803,7 +1803,7 @@ void songEditor::exportProject( void ) void songEditor::updateFramesPerTact64th( void ) { - eng()->updateFramesPerTact64th(); + engine::updateFramesPerTact64th(); } diff --git a/src/core/surround_area.cpp b/src/core/surround_area.cpp index 0ab78cfc6..57fa42668 100644 --- a/src/core/surround_area.cpp +++ b/src/core/surround_area.cpp @@ -4,7 +4,7 @@ * surround_area.cpp - a widget for setting position of a channel + * calculation of volume for each speaker * - * Copyright (c) 2004-2006 Tobias Doerffel + * Copyright (c) 2004-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -75,7 +75,7 @@ QPixmap * surroundArea::s_backgroundArtwork = NULL; surroundArea::surroundArea( QWidget * _parent, const QString & _name, - engine * _engine, track * _track ) : + track * _track ) : QWidget( _parent #ifndef QT4 , _name.ascii() @@ -84,12 +84,12 @@ surroundArea::surroundArea( QWidget * _parent, const QString & _name, m_sndSrcPos( QPoint() ) { m_position_x = new knob( knobDark_28, NULL, tr ( "Surround area X" ), - _engine, _track ); + _track ); m_position_x->setRange( -SURROUND_AREA_SIZE, SURROUND_AREA_SIZE, 1.0f ); m_position_x->setInitValue( 0.0f ); m_position_y = new knob( knobDark_28, NULL, tr ( "Surround area Y" ), - _engine, _track ); + _track ); m_position_y->setRange( -SURROUND_AREA_SIZE, SURROUND_AREA_SIZE, 1.0f ); m_position_y->setInitValue( 0.0f ); diff --git a/src/core/timeline.cpp b/src/core/timeline.cpp index d068a9540..bb721b177 100644 --- a/src/core/timeline.cpp +++ b/src/core/timeline.cpp @@ -3,7 +3,7 @@ /* * timeline.cpp - class timeLine, representing a time-line with position marker * - * Copyright (c) 2004-2006 Tobias Doerffel + * Copyright (c) 2004-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -49,6 +49,7 @@ #include "timeline.h" #include "embed.h" +#include "engine.h" #include "templates.h" #include "nstate_button.h" #include "main_window.h" @@ -64,9 +65,8 @@ QPixmap * timeLine::s_loopPointDisabledPixmap = NULL; timeLine::timeLine( const int _xoff, const int _yoff, const float _ppt, songEditor::playPos & _pos, const midiTime & _begin, - QWidget * _parent, engine * _engine ) : + QWidget * _parent ) : QWidget( _parent ), - journallingObject( _engine ), m_autoScroll( AUTOSCROLL_ENABLED ), m_loopPoints( LOOP_POINTS_DISABLED ), m_behaviourAtStop( BACK_TO_ZERO ), @@ -361,7 +361,7 @@ void timeLine::mouseMoveEvent( QMouseEvent * _me ) case MOVE_LOOP_END: { const Uint8 i = m_action - MOVE_LOOP_BEGIN; - if( eng()->getMainWindow()->isCtrlPressed() == TRUE ) + if( engine::getMainWindow()->isCtrlPressed() == TRUE ) { // no ctrl-press-hint when having ctrl pressed delete m_hint; diff --git a/src/core/tool.cpp b/src/core/tool.cpp index 2eb8c8ba0..9aa4d1874 100644 --- a/src/core/tool.cpp +++ b/src/core/tool.cpp @@ -3,7 +3,7 @@ /* * tool.cpp - base class for all tool plugins (graphs, extensions, etc) * - * Copyright (c) 2006 Javier Serrano Polo + * Copyright (c) 2006-2007 Javier Serrano Polo * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -33,7 +33,7 @@ tool::tool( mainWindow * _window, const descriptor * _descriptor ) : QWidget( _window->workspace() ), - plugin( _descriptor, _window->eng() ) + plugin( _descriptor ) { setWindowTitle( _descriptor->public_name ); setWindowIcon( *_descriptor->logo ); diff --git a/src/core/track.cpp b/src/core/track.cpp index d1c5b8cea..de6fb5527 100644 --- a/src/core/track.cpp +++ b/src/core/track.cpp @@ -4,7 +4,7 @@ * track.cpp - implementation of classes concerning tracks -> neccessary for * all track-like objects (beat/bassline, sample-track...) * - * Copyright (c) 2004-2006 Tobias Doerffel + * Copyright (c) 2004-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -90,7 +90,6 @@ trackContentObject::trackContentObject( track * _track ) : , Qt::WDestructiveClose #endif ), - journallingObject( _track->eng() ), m_track( _track ), m_startPosition(), m_length(), @@ -147,7 +146,7 @@ void trackContentObject::movePosition( const midiTime & _pos ) { if( m_startPosition != _pos ) { - //eng()->getSongEditor()->setModified(); + //engine::getSongEditor()->setModified(); addJournalEntry( journalEntry( MOVE, m_startPosition - _pos ) ); m_startPosition = _pos; } @@ -164,7 +163,7 @@ void trackContentObject::changeLength( const midiTime & _length ) { if( m_length != _length ) { - //eng()->getSongEditor()->setModified(); + //engine::getSongEditor()->setModified(); addJournalEntry( journalEntry( RESIZE, m_length - _length ) ); m_length = _length; } @@ -231,7 +230,7 @@ void trackContentObject::mousePressEvent( QMouseEvent * _me ) // if rubberband is active, we can be selected if( m_track->getTrackContainer()->rubberBandActive() == FALSE ) { - if( eng()->getMainWindow()->isCtrlPressed() == TRUE ) + if( engine::getMainWindow()->isCtrlPressed() == TRUE ) { setSelected( !isSelected() ); } @@ -247,13 +246,13 @@ void trackContentObject::mousePressEvent( QMouseEvent * _me ) } return; } - else if( eng()->getMainWindow()->isShiftPressed() == TRUE ) + else if( engine::getMainWindow()->isShiftPressed() == TRUE ) { // add/remove object to/from selection selectableObject::mousePressEvent( _me ); } else if( _me->button() == Qt::LeftButton && - eng()->getMainWindow()->isCtrlPressed() == TRUE ) + engine::getMainWindow()->isCtrlPressed() == TRUE ) { // start drag-action multimediaProject mmp( multimediaProject::DRAG_N_DROP_DATA ); @@ -270,11 +269,10 @@ void trackContentObject::mousePressEvent( QMouseEvent * _me ) convertToImage().smoothScale( s ); #endif new stringPairDrag( QString( "tco_%1" ).arg( m_track->type() ), - mmp.toString(), thumbnail, this, - eng() ); + mmp.toString(), thumbnail, this ); } else if( _me->button() == Qt::LeftButton && - /* eng()->getMainWindow()->isShiftPressed() == FALSE &&*/ + /* engine::getMainWindow()->isShiftPressed() == FALSE &&*/ fixedTCOs() == FALSE ) { // move or resize @@ -315,7 +313,7 @@ void trackContentObject::mousePressEvent( QMouseEvent * _me ) } else if( _me->button() == Qt::MidButton ) { - if( eng()->getMainWindow()->isCtrlPressed() ) + if( engine::getMainWindow()->isCtrlPressed() ) { toggleMute(); } @@ -332,7 +330,7 @@ void trackContentObject::mousePressEvent( QMouseEvent * _me ) void trackContentObject::mouseMoveEvent( QMouseEvent * _me ) { - if( eng()->getMainWindow()->isCtrlPressed() == TRUE ) + if( engine::getMainWindow()->isCtrlPressed() == TRUE ) { delete m_hint; m_hint = NULL; @@ -345,7 +343,7 @@ void trackContentObject::mouseMoveEvent( QMouseEvent * _me ) midiTime t = tMax( 0, (Sint32) m_track->getTrackContainer()-> currentPosition() + static_cast( x * 64 / ppt ) ); - if( eng()->getMainWindow()->isCtrlPressed() == + if( engine::getMainWindow()->isCtrlPressed() == FALSE && _me->button() == Qt::NoButton ) { t = t.toNearestTact(); @@ -393,7 +391,7 @@ void trackContentObject::mouseMoveEvent( QMouseEvent * _me ) { midiTime t = tMax( 64, static_cast( _me->x() * 64 / ppt ) ); - if( eng()->getMainWindow()->isCtrlPressed() == + if( engine::getMainWindow()->isCtrlPressed() == FALSE && _me->button() == Qt::NoButton ) { t = t.toNearestTact(); @@ -594,7 +592,6 @@ void trackContentObject::setAutoResizeEnabled( bool _e ) // =========================================================================== trackContentWidget::trackContentWidget( trackWidget * _parent ) : QWidget( _parent ), - journallingObject( _parent->eng() ), m_trackWidget( _parent ) { #ifdef QT4 @@ -654,7 +651,7 @@ trackContentObject * trackContentWidget::addTCO( trackContentObject * _tco ) m_trackWidget->changePosition(); _tco->restoreJournallingState(); - //eng()->getSongEditor()->setModified(); + //engine::getSongEditor()->setModified(); return( _tco ); // just for convenience } @@ -690,7 +687,7 @@ void trackContentWidget::removeTCO( trackContentObject * _tco, } m_trackContentObjects.erase( it ); - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); } } @@ -830,7 +827,7 @@ void trackContentWidget::mousePressEvent( QMouseEvent * _me ) { QWidget::mousePressEvent( _me ); } - else if( eng()->getMainWindow()->isShiftPressed() == TRUE ) + else if( engine::getMainWindow()->isShiftPressed() == TRUE ) { QWidget::mousePressEvent( _me ); } @@ -898,8 +895,9 @@ void trackContentWidget::undoStep( journalEntry & _je ) { QMap map = _je.data().toMap(); trackContentObject * tco = -dynamic_cast( - eng()->getProjectJournal()->getJournallingObject( map["id"].toInt() ) ); + dynamic_cast( + engine::getProjectJournal()->getJournallingObject( + map["id"].toInt() ) ); assert( tco != NULL ); multimediaProject mmp( multimediaProject::JOURNAL_DATA ); @@ -997,7 +995,7 @@ trackOperationsWidget::trackOperationsWidget( trackWidget * _parent ) : toolTip::add( m_trackOps, tr( "Actions for this track" ) ); - m_muteBtn = new pixmapButton( this, tr( "Mute" ), m_trackWidget->eng(), + m_muteBtn = new pixmapButton( this, tr( "Mute" ), m_trackWidget->getTrack() ); m_muteBtn->setActiveGraphic( embed::getIconPixmap( "mute_on" ) ); m_muteBtn->setInactiveGraphic( embed::getIconPixmap( "mute_off" ) ); @@ -1026,7 +1024,7 @@ trackOperationsWidget::trackOperationsWidget( trackWidget * _parent ) : if( inBBEditor() ) { - connect( _parent->eng()->getBBEditor(), + connect( engine::getBBEditor(), SIGNAL( positionChanged( const midiTime & ) ), this, SLOT( update() ) ); } @@ -1053,7 +1051,7 @@ bool trackOperationsWidget::muted( void ) const void trackOperationsWidget::mousePressEvent( QMouseEvent * _me ) { if( _me->button() == Qt::LeftButton && - m_trackWidget->eng()->getMainWindow()->isCtrlPressed() == TRUE && + engine::getMainWindow()->isCtrlPressed() == TRUE && m_trackWidget->getTrack()->type() != track::BB_TRACK ) { multimediaProject mmp( multimediaProject::DRAG_N_DROP_DATA ); @@ -1062,7 +1060,7 @@ void trackOperationsWidget::mousePressEvent( QMouseEvent * _me ) m_trackWidget->getTrack()->type() ), mmp.toString(), QPixmap::grabWidget( &m_trackWidget->getTrackSettingsWidget() ), - this, m_trackWidget->eng() ); + this ); } else if( _me->button() == Qt::LeftButton ) { @@ -1252,8 +1250,7 @@ void trackOperationsWidget::disableAutomation( void ) bbTrack * trackOperationsWidget::currentBBTrack( void ) { - engine * eng = m_trackWidget->eng(); - return( bbTrack::findBBTrack( eng->getBBEditor()->currentBB(), eng ) ); + return( bbTrack::findBBTrack( engine::getBBEditor()->currentBB() ) ); } @@ -1262,7 +1259,7 @@ bbTrack * trackOperationsWidget::currentBBTrack( void ) bool trackOperationsWidget::inBBEditor( void ) { return( m_trackWidget->getTrack()->getTrackContainer() - == m_trackWidget->eng()->getBBEditor() ); + == engine::getBBEditor() ); } @@ -1276,7 +1273,6 @@ bool trackOperationsWidget::inBBEditor( void ) trackWidget::trackWidget( track * _track, QWidget * _parent ) : QWidget( _parent ), - journallingObject( _track->eng() ), m_track( _track ), m_trackOperationsWidget( this ), m_trackSettingsWidget( this ), @@ -1452,7 +1448,7 @@ void trackWidget::mousePressEvent( QMouseEvent * _me ) } else if( _me->button() == Qt::LeftButton ) { - if( eng()->getMainWindow()->isShiftPressed() == TRUE ) + if( engine::getMainWindow()->isShiftPressed() == TRUE ) { m_action = RESIZE_TRACK; QCursor::setPos( mapToGlobal( QPoint( _me->x(), @@ -1593,7 +1589,6 @@ midiTime trackWidget::endPosition( const midiTime & _pos_start ) // =========================================================================== track::track( trackContainer * _tc, bool _create_widget ) : - journallingObject( _tc->eng() ), m_trackContainer( _tc ), m_trackWidget( NULL ) { @@ -1611,9 +1606,10 @@ track::track( trackContainer * _tc, bool _create_widget ) : track::~track() { - if( m_trackContainer == eng()->getBBEditor() && eng()->getSongEditor() ) + if( m_trackContainer == engine::getBBEditor() + && engine::getSongEditor() ) { - trackVector tracks = eng()->getSongEditor()->tracks(); + trackVector tracks = engine::getSongEditor()->tracks(); for( trackVector::iterator it = tracks.begin(); it != tracks.end(); ++it ) { @@ -1653,7 +1649,7 @@ track * track::create( trackTypes _tt, trackContainer * _tc ) { // while adding track, pause mixer for not getting into any trouble // because of track being not created completely so far - _tc->eng()->getMixer()->pause(); + engine::getMixer()->pause(); track * t = NULL; @@ -1673,7 +1669,7 @@ track * track::create( trackTypes _tt, trackContainer * _tc ) #endif // allow mixer to continue - _tc->eng()->getMixer()->play(); + engine::getMixer()->play(); return( t ); } diff --git a/src/core/track_container.cpp b/src/core/track_container.cpp index b528306ef..6150d9dc4 100644 --- a/src/core/track_container.cpp +++ b/src/core/track_container.cpp @@ -63,15 +63,15 @@ #include "rubberband.h" #include "project_journal.h" #include "debug.h" +#include "file_browser.h" -trackContainer::trackContainer( engine * _engine ) : - QMainWindow( _engine->getMainWindow()->workspace() +trackContainer::trackContainer( void ) : + QMainWindow( engine::getMainWindow()->workspace() #ifdef QT3 , 0, Qt::WStyle_Title #endif ), - journallingObject( _engine ), m_currentPosition( 0, 0 ), m_scrollArea( new scrollArea( this ) ), m_ppt( DEFAULT_PIXELS_PER_TACT ), @@ -79,9 +79,9 @@ trackContainer::trackContainer( engine * _engine ) : m_origin() { #ifdef QT4 - if( eng()->getMainWindow()->workspace() != NULL ) + if( engine::getMainWindow()->workspace() != NULL ) { - eng()->getMainWindow()->workspace()->addWindow( this ); + engine::getMainWindow()->workspace()->addWindow( this ); } #endif @@ -96,14 +96,14 @@ trackContainer::trackContainer( engine * _engine ) : trackContainer::~trackContainer() { - eng()->getProjectJournal()->setJournalling( FALSE ); + engine::getProjectJournal()->setJournalling( FALSE ); while( m_trackWidgets.size() ) { removeTrack( m_trackWidgets.front()->getTrack() ); } - eng()->getProjectJournal()->setJournalling( TRUE ); + engine::getProjectJournal()->setJournalling( TRUE ); } @@ -197,9 +197,9 @@ void trackContainer::loadSettings( const QDomElement & _this ) void trackContainer::cloneTrack( track * _track ) { - eng()->getMixer()->pause(); + engine::getMixer()->pause(); track::clone( _track ); - eng()->getMixer()->play(); + engine::getMixer()->play(); } @@ -237,7 +237,7 @@ void trackContainer::removeTrack( track * _track ) map["state"] = mmp.toString(); addJournalEntry( journalEntry( REMOVE_TRACK, map ) ); - eng()->getMixer()->pause(); + engine::getMixer()->pause(); #ifndef QT4 m_scrollArea->removeChild( _track->getTrackWidget() ); #endif @@ -245,12 +245,12 @@ void trackContainer::removeTrack( track * _track ) delete _track; - eng()->getMixer()->play(); + engine::getMixer()->play(); realignTracks(); - if( eng()->getSongEditor() ) + if( engine::getSongEditor() ) { - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); } } } @@ -446,8 +446,9 @@ void trackContainer::undoStep( journalEntry & _je ) { QMap map = _je.data().toMap(); track * tr = -dynamic_cast( - eng()->getProjectJournal()->getJournallingObject( map["id"].toInt() ) ); + dynamic_cast( + engine::getProjectJournal()->getJournallingObject( + map["id"].toInt() ) ); assert( tr != NULL ); multimediaProject mmp( multimediaProject::JOURNAL_DATA ); @@ -521,7 +522,10 @@ void trackContainer::dropEvent( QDropEvent * _de ) instrumentTrack * it = dynamic_cast( track::create( track::INSTRUMENT_TRACK, this ) ); - instrument * i = it->loadInstrument( "audiofileprocessor" ); + QString iname = type == "sampledata" ? "audiofileprocessor" : + engine::sampleExtensions()[fileItem::extension( + value )]; + instrument * i = it->loadInstrument( iname ); i->setParameter( type, value ); it->toggledInstrumentTrackButton( TRUE ); _de->accept(); diff --git a/src/lib/journalling_object.cpp b/src/lib/journalling_object.cpp index 49e8f0e1e..931c47a96 100644 --- a/src/lib/journalling_object.cpp +++ b/src/lib/journalling_object.cpp @@ -3,7 +3,7 @@ /* * journalling_object.cpp - implementation of journalling-object related stuff * - * Copyright (c) 2006 Tobias Doerffel + * Copyright (c) 2006-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -28,6 +28,7 @@ #include "journalling_object.h" #include "project_journal.h" #include "base64.h" +#include "engine.h" #include "qt3support.h" @@ -43,10 +44,8 @@ -journallingObject::journallingObject( engine * _engine ) : - engineObject( _engine ), - m_id( ( eng() != NULL ) ? eng()->getProjectJournal()->allocID( this ) : - 0 ), +journallingObject::journallingObject( void ) : + m_id( engine::getProjectJournal()->allocID( this ) ), m_journalEntries(), m_currentJournalEntry( m_journalEntries.end() ), m_journalling( TRUE ) @@ -58,9 +57,9 @@ journallingObject::journallingObject( engine * _engine ) : journallingObject::~journallingObject() { - if( eng() && eng()->getProjectJournal() ) + if( engine::getProjectJournal() ) { - eng()->getProjectJournal()->freeID( id() ); + engine::getProjectJournal()->freeID( id() ); } } @@ -140,15 +139,13 @@ void journallingObject::restoreState( const QDomElement & _this ) void journallingObject::addJournalEntry( const journalEntry & _je ) { - if( !( eng() == NULL || - eng()->getProjectJournal()->isJournalling() == FALSE || - isJournalling() == FALSE ) ) + if( engine::getProjectJournal()->isJournalling() && isJournalling() ) { m_journalEntries.erase( m_currentJournalEntry, m_journalEntries.end() ); m_journalEntries.push_back( _je ); m_currentJournalEntry = m_journalEntries.end(); - eng()->getProjectJournal()->journalEntryAdded( id() ); + engine::getProjectJournal()->journalEntryAdded( id() ); } } @@ -199,8 +196,8 @@ void journallingObject::loadJournal( const QDomElement & _this ) if( id() != new_id ) { - eng()->getProjectJournal()->forgetAboutID( id() ); - eng()->getProjectJournal()->reallocID( new_id, this ); + engine::getProjectJournal()->forgetAboutID( id() ); + engine::getProjectJournal()->reallocID( new_id, this ); m_id = new_id; } diff --git a/src/lib/mmp.cpp b/src/lib/mmp.cpp index d556ed4ea..b4379c318 100644 --- a/src/lib/mmp.cpp +++ b/src/lib/mmp.cpp @@ -3,7 +3,7 @@ /* * mmp.cpp - implementation of class multimediaProject * - * Copyright (c) 2004-2006 Tobias Doerffel + * Copyright (c) 2004-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -74,7 +74,7 @@ multimediaProject::multimediaProject( projectTypes _project_type ) : m_head(), m_type( _project_type ) { - QDomElement root = createElement( "multimediaproject" ); + QDomElement root = createElement( "multimedia-project" ); root.setAttribute( "version", MMP_VERSION_STRING ); root.setAttribute( "type", typeName( _project_type ) ); root.setAttribute( "creator", "Linux MultiMedia Studio (LMMS)" ); diff --git a/src/lib/oscillator.cpp b/src/lib/oscillator.cpp index ed9e5bb4d..7529675c4 100644 --- a/src/lib/oscillator.cpp +++ b/src/lib/oscillator.cpp @@ -3,7 +3,7 @@ /* * oscillator.cpp - implementation of powerful oscillator-class * - * Copyright (c) 2004-2006 Tobias Doerffel + * Copyright (c) 2004-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -94,136 +94,217 @@ void oscillator::update( sampleFrame * _ab, const fpab_t _frames, -// if we have no sub-osc, we can't do any modulation... just get our samples void oscillator::updateNoSub( sampleFrame * _ab, const fpab_t _frames, - const ch_cnt_t _chnl ) -{ - recalcPhase(); - float osc_coeff = *m_freq * *m_detuning; - - for( fpab_t frame = 0; frame < _frames; ++frame ) - { - _ab[frame][_chnl] = getSample( m_phase ) * *m_volume; - m_phase += osc_coeff; - } -} - - -// do pm by using sub-osc as modulator -void oscillator::updatePM( sampleFrame * _ab, const fpab_t _frames, - const ch_cnt_t _chnl ) -{ - m_subOsc->update( _ab, _frames, _chnl ); - recalcPhase(); - const float osc_coeff = *m_freq * *m_detuning; - - for( fpab_t frame = 0; frame < _frames; ++frame ) - { - _ab[frame][_chnl] = getSample( m_phase + _ab[frame][_chnl] ) - * *m_volume; - m_phase += osc_coeff; - } -} - - -// do am by using sub-osc as modulator -void oscillator::updateAM( sampleFrame * _ab, const fpab_t _frames, - const ch_cnt_t _chnl ) -{ - m_subOsc->update( _ab, _frames, _chnl ); - recalcPhase(); - const float osc_coeff = *m_freq * *m_detuning; - - for( fpab_t frame = 0; frame < _frames; ++frame ) - { - _ab[frame][_chnl] *= getSample( m_phase ) * *m_volume; - m_phase += osc_coeff; - } -} - - -// do mix by using sub-osc as mix-sample -void oscillator::updateMix( sampleFrame * _ab, const fpab_t _frames, - const ch_cnt_t _chnl ) -{ - m_subOsc->update( _ab, _frames, _chnl ); - recalcPhase(); - const float osc_coeff = *m_freq * *m_detuning; - - for( fpab_t frame = 0; frame < _frames; ++frame ) - { - _ab[frame][_chnl] += getSample( m_phase ) * *m_volume; - m_phase += osc_coeff; - } -} - - -// sync with sub-osc (every time sub-osc starts new period, we also start new -// period) -void oscillator::updateSync( sampleFrame * _ab, const fpab_t _frames, - const ch_cnt_t _chnl ) -{ - const float sub_osc_coeff = m_subOsc->syncInit( _ab, _frames, _chnl ); - recalcPhase(); - const float osc_coeff = *m_freq * *m_detuning; - - for( fpab_t frame = 0; frame < _frames ; ++frame ) - { - if( m_subOsc->syncOk( sub_osc_coeff ) ) - { - m_phase = m_phaseOffset; - } - _ab[frame][_chnl] = getSample( m_phase ) * *m_volume; - m_phase += osc_coeff; - } -} - - - - -// do fm by using sub-osc as modulator -void oscillator::updateFM( sampleFrame * _ab, const fpab_t _frames, - const ch_cnt_t _chnl ) -{ - m_subOsc->update( _ab, _frames, _chnl ); - recalcPhase(); - const float osc_coeff = *m_freq * *m_detuning; - - for( fpab_t frame = 0; frame < _frames; ++frame ) - { - m_phase += _ab[frame][_chnl]; - _ab[frame][_chnl] = getSample( m_phase ) * *m_volume; - m_phase += osc_coeff; - } -} - - - - -inline sample_t oscillator::getSample( const float _sample ) + const ch_cnt_t _chnl ) { switch( *m_waveShape ) { case SIN_WAVE: - return( sinSample( _sample ) ); - case TRIANGLE_WAVE: - return( triangleSample( _sample ) ); - case SAW_WAVE: - return( sawSample( _sample ) ); - case SQUARE_WAVE: - return( squareSample( _sample ) ); - case MOOG_SAW_WAVE: - return( moogSawSample( _sample ) ); - case EXP_WAVE: - return( expSample( _sample ) ); - case WHITE_NOISE_WAVE: - return( noiseSample( _sample ) ); - case USER_DEF_WAVE: - return( userWaveSample( _sample ) ); default: - return( sinSample( _sample ) ); + updateNoSub( _ab, _frames, _chnl ); + break; + case TRIANGLE_WAVE: + updateNoSub( _ab, _frames, _chnl ); + break; + case SAW_WAVE: + updateNoSub( _ab, _frames, _chnl ); + break; + case SQUARE_WAVE: + updateNoSub( _ab, _frames, _chnl ); + break; + case MOOG_SAW_WAVE: + updateNoSub( _ab, _frames, _chnl ); + break; + case EXP_WAVE: + updateNoSub( _ab, _frames, _chnl ); + break; + case WHITE_NOISE_WAVE: + updateNoSub( _ab, _frames, _chnl ); + break; + case USER_DEF_WAVE: + updateNoSub( _ab, _frames, _chnl ); + break; } +} + + + +void oscillator::updatePM( sampleFrame * _ab, const fpab_t _frames, + const ch_cnt_t _chnl ) +{ + switch( *m_waveShape ) + { + case SIN_WAVE: + default: + updatePM( _ab, _frames, _chnl ); + break; + case TRIANGLE_WAVE: + updatePM( _ab, _frames, _chnl ); + break; + case SAW_WAVE: + updatePM( _ab, _frames, _chnl ); + break; + case SQUARE_WAVE: + updatePM( _ab, _frames, _chnl ); + break; + case MOOG_SAW_WAVE: + updatePM( _ab, _frames, _chnl ); + break; + case EXP_WAVE: + updatePM( _ab, _frames, _chnl ); + break; + case WHITE_NOISE_WAVE: + updatePM( _ab, _frames, _chnl ); + break; + case USER_DEF_WAVE: + updatePM( _ab, _frames, _chnl ); + break; + } +} + + + + +void oscillator::updateAM( sampleFrame * _ab, const fpab_t _frames, + const ch_cnt_t _chnl ) +{ + switch( *m_waveShape ) + { + case SIN_WAVE: + default: + updateAM( _ab, _frames, _chnl ); + break; + case TRIANGLE_WAVE: + updateAM( _ab, _frames, _chnl ); + break; + case SAW_WAVE: + updateAM( _ab, _frames, _chnl ); + break; + case SQUARE_WAVE: + updateAM( _ab, _frames, _chnl ); + break; + case MOOG_SAW_WAVE: + updateAM( _ab, _frames, _chnl ); + break; + case EXP_WAVE: + updateAM( _ab, _frames, _chnl ); + break; + case WHITE_NOISE_WAVE: + updateAM( _ab, _frames, _chnl ); + break; + case USER_DEF_WAVE: + updateAM( _ab, _frames, _chnl ); + break; + } +} + + + + +void oscillator::updateMix( sampleFrame * _ab, const fpab_t _frames, + const ch_cnt_t _chnl ) +{ + switch( *m_waveShape ) + { + case SIN_WAVE: + default: + updateMix( _ab, _frames, _chnl ); + break; + case TRIANGLE_WAVE: + updateMix( _ab, _frames, _chnl ); + break; + case SAW_WAVE: + updateMix( _ab, _frames, _chnl ); + break; + case SQUARE_WAVE: + updateMix( _ab, _frames, _chnl ); + break; + case MOOG_SAW_WAVE: + updateMix( _ab, _frames, _chnl ); + break; + case EXP_WAVE: + updateMix( _ab, _frames, _chnl ); + break; + case WHITE_NOISE_WAVE: + updateMix( _ab, _frames, _chnl ); + break; + case USER_DEF_WAVE: + updateMix( _ab, _frames, _chnl ); + break; + } +} + + + + +void oscillator::updateSync( sampleFrame * _ab, const fpab_t _frames, + const ch_cnt_t _chnl ) +{ + switch( *m_waveShape ) + { + case SIN_WAVE: + default: + updateSync( _ab, _frames, _chnl ); + break; + case TRIANGLE_WAVE: + updateSync( _ab, _frames, _chnl ); + break; + case SAW_WAVE: + updateSync( _ab, _frames, _chnl ); + break; + case SQUARE_WAVE: + updateSync( _ab, _frames, _chnl ); + break; + case MOOG_SAW_WAVE: + updateSync( _ab, _frames, _chnl ); + break; + case EXP_WAVE: + updateSync( _ab, _frames, _chnl ); + break; + case WHITE_NOISE_WAVE: + updateSync( _ab, _frames, _chnl ); + break; + case USER_DEF_WAVE: + updateSync( _ab, _frames, _chnl ); + break; + } +} + + + + +void oscillator::updateFM( sampleFrame * _ab, const fpab_t _frames, + const ch_cnt_t _chnl ) +{ + switch( *m_waveShape ) + { + case SIN_WAVE: + default: + updateFM( _ab, _frames, _chnl ); + break; + case TRIANGLE_WAVE: + updateFM( _ab, _frames, _chnl ); + break; + case SAW_WAVE: + updateFM( _ab, _frames, _chnl ); + break; + case SQUARE_WAVE: + updateFM( _ab, _frames, _chnl ); + break; + case MOOG_SAW_WAVE: + updateFM( _ab, _frames, _chnl ); + break; + case EXP_WAVE: + updateFM( _ab, _frames, _chnl ); + break; + case WHITE_NOISE_WAVE: + updateFM( _ab, _frames, _chnl ); + break; + case USER_DEF_WAVE: + updateFM( _ab, _frames, _chnl ); + break; + } } @@ -266,4 +347,207 @@ float oscillator::syncInit( sampleFrame * _ab, const fpab_t _frames, return( *m_freq * *m_detuning ); } + + + +// if we have no sub-osc, we can't do any modulation... just get our samples +template +void oscillator::updateNoSub( sampleFrame * _ab, const fpab_t _frames, + const ch_cnt_t _chnl ) +{ + recalcPhase(); + float osc_coeff = *m_freq * *m_detuning; + + for( fpab_t frame = 0; frame < _frames; ++frame ) + { + _ab[frame][_chnl] = getSample( m_phase ) * *m_volume; + m_phase += osc_coeff; + } +} + + + + +// do pm by using sub-osc as modulator +template +void oscillator::updatePM( sampleFrame * _ab, const fpab_t _frames, + const ch_cnt_t _chnl ) +{ + m_subOsc->update( _ab, _frames, _chnl ); + recalcPhase(); + const float osc_coeff = *m_freq * *m_detuning; + + for( fpab_t frame = 0; frame < _frames; ++frame ) + { + _ab[frame][_chnl] = getSample( m_phase + _ab[frame][_chnl] ) + * *m_volume; + m_phase += osc_coeff; + } +} + + + + +// do am by using sub-osc as modulator +template +void oscillator::updateAM( sampleFrame * _ab, const fpab_t _frames, + const ch_cnt_t _chnl ) +{ + m_subOsc->update( _ab, _frames, _chnl ); + recalcPhase(); + const float osc_coeff = *m_freq * *m_detuning; + + for( fpab_t frame = 0; frame < _frames; ++frame ) + { + _ab[frame][_chnl] *= getSample( m_phase ) * *m_volume; + m_phase += osc_coeff; + } +} + + + + +// do mix by using sub-osc as mix-sample +template +void oscillator::updateMix( sampleFrame * _ab, const fpab_t _frames, + const ch_cnt_t _chnl ) +{ + m_subOsc->update( _ab, _frames, _chnl ); + recalcPhase(); + const float osc_coeff = *m_freq * *m_detuning; + + for( fpab_t frame = 0; frame < _frames; ++frame ) + { + _ab[frame][_chnl] += getSample( m_phase ) * *m_volume; + m_phase += osc_coeff; + } +} + + + + +// sync with sub-osc (every time sub-osc starts new period, we also start new +// period) +template +void oscillator::updateSync( sampleFrame * _ab, const fpab_t _frames, + const ch_cnt_t _chnl ) +{ + const float sub_osc_coeff = m_subOsc->syncInit( _ab, _frames, _chnl ); + recalcPhase(); + const float osc_coeff = *m_freq * *m_detuning; + + for( fpab_t frame = 0; frame < _frames ; ++frame ) + { + if( m_subOsc->syncOk( sub_osc_coeff ) ) + { + m_phase = m_phaseOffset; + } + _ab[frame][_chnl] = getSample( m_phase ) * *m_volume; + m_phase += osc_coeff; + } +} + + + + +// do fm by using sub-osc as modulator +template +void oscillator::updateFM( sampleFrame * _ab, const fpab_t _frames, + const ch_cnt_t _chnl ) +{ + m_subOsc->update( _ab, _frames, _chnl ); + recalcPhase(); + const float osc_coeff = *m_freq * *m_detuning; + + for( fpab_t frame = 0; frame < _frames; ++frame ) + { + m_phase += _ab[frame][_chnl]; + _ab[frame][_chnl] = getSample( m_phase ) * *m_volume; + m_phase += osc_coeff; + } +} + + + + +template<> +inline sample_t oscillator::getSample( + const float _sample ) +{ + return( sinSample( _sample ) ); +} + + + + +template<> +inline sample_t oscillator::getSample( + const float _sample ) +{ + return( triangleSample( _sample ) ); +} + + + + +template<> +inline sample_t oscillator::getSample( + const float _sample ) +{ + return( sawSample( _sample ) ); +} + + + + +template<> +inline sample_t oscillator::getSample( + const float _sample ) +{ + return( squareSample( _sample ) ); +} + + + + +template<> +inline sample_t oscillator::getSample( + const float _sample ) +{ + return( moogSawSample( _sample ) ); +} + + + + +template<> +inline sample_t oscillator::getSample( + const float _sample ) +{ + return( expSample( _sample ) ); +} + + + + +template<> +inline sample_t oscillator::getSample( + const float _sample ) +{ + return( noiseSample( _sample ) ); +} + + + + +template<> +inline sample_t oscillator::getSample( + const float _sample ) +{ + return( userWaveSample( _sample ) ); +} + + + + #endif diff --git a/src/lib/project_journal.cpp b/src/lib/project_journal.cpp index 2ad49bc29..d7d36636c 100644 --- a/src/lib/project_journal.cpp +++ b/src/lib/project_journal.cpp @@ -3,7 +3,7 @@ /* * project_journal.cpp - implementation of project-journal * - * Copyright (c) 2006 Tobias Doerffel + * Copyright (c) 2006-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -28,6 +28,7 @@ #include #include "project_journal.h" +#include "engine.h" #include "journalling_object.h" #include "song_editor.h" @@ -37,8 +38,7 @@ -projectJournal::projectJournal( engine * _engine ) : - engineObject( _engine ), +projectJournal::projectJournal( void ) : m_joIDs(), m_journalEntries(), m_currentJournalEntry( m_journalEntries.end() ) @@ -68,7 +68,7 @@ void projectJournal::undo( void ) ( jo = m_joIDs[*--m_currentJournalEntry] ) != NULL ) { jo->undo(); - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); } } @@ -89,7 +89,7 @@ void projectJournal::redo( void ) ( jo = m_joIDs[*m_currentJournalEntry++] ) != NULL ) { jo->redo(); - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); } } @@ -101,7 +101,7 @@ void projectJournal::journalEntryAdded( const jo_id_t _id ) m_journalEntries.erase( m_currentJournalEntry, m_journalEntries.end() ); m_journalEntries.push_back( _id ); m_currentJournalEntry = m_journalEntries.end(); - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); printf("history size: %d\n", m_journalEntries.size() ); } diff --git a/src/lib/sample_buffer.cpp b/src/lib/sample_buffer.cpp index 86a0e94b5..35c4d319c 100644 --- a/src/lib/sample_buffer.cpp +++ b/src/lib/sample_buffer.cpp @@ -86,6 +86,7 @@ #include "templates.h" #include "config_mgr.h" #include "endian_handling.h" +#include "engine.h" #include "base64.h" #include "debug.h" @@ -100,10 +101,8 @@ -sampleBuffer::sampleBuffer( engine * _engine, const QString & _audio_file, +sampleBuffer::sampleBuffer( const QString & _audio_file, bool _is_base64_data ) : - QObject(), - engineObject( _engine ), m_audioFile( ( _is_base64_data == TRUE ) ? "" : _audio_file ), m_origData( NULL ), m_origFrames( 0 ), @@ -116,6 +115,7 @@ sampleBuffer::sampleBuffer( engine * _engine, const QString & _audio_file, m_amplification( 1.0f ), m_reversed( FALSE ), m_frequency( BASE_FREQ ), + m_sample_rate( SAMPLE_RATES[DEFAULT_QUALITY_LEVEL] ), m_dataMutex(), m_sample_fragment( NULL ) { @@ -136,10 +136,7 @@ sampleBuffer::sampleBuffer( engine * _engine, const QString & _audio_file, -sampleBuffer::sampleBuffer( const sampleFrame * _data, const f_cnt_t _frames, - engine * _engine ) : - QObject(), - engineObject( _engine ), +sampleBuffer::sampleBuffer( const sampleFrame * _data, const f_cnt_t _frames ) : m_audioFile( "" ), m_origData( NULL ), m_origFrames( 0 ), @@ -152,6 +149,7 @@ sampleBuffer::sampleBuffer( const sampleFrame * _data, const f_cnt_t _frames, m_amplification( 1.0f ), m_reversed( FALSE ), m_frequency( BASE_FREQ ), + m_sample_rate( SAMPLE_RATES[DEFAULT_QUALITY_LEVEL] ), m_dataMutex(), m_sample_fragment( NULL ) { @@ -171,9 +169,7 @@ sampleBuffer::sampleBuffer( const sampleFrame * _data, const f_cnt_t _frames, -sampleBuffer::sampleBuffer( const f_cnt_t _frames, engine * _engine ) : - QObject(), - engineObject( _engine ), +sampleBuffer::sampleBuffer( const f_cnt_t _frames ) : m_audioFile( "" ), m_origData( NULL ), m_origFrames( 0 ), @@ -186,6 +182,7 @@ sampleBuffer::sampleBuffer( const f_cnt_t _frames, engine * _engine ) : m_amplification( 1.0f ), m_reversed( FALSE ), m_frequency( BASE_FREQ ), + m_sample_rate( SAMPLE_RATES[DEFAULT_QUALITY_LEVEL] ), m_dataMutex(), m_sample_fragment( NULL ) { @@ -623,14 +620,15 @@ bool FASTCALL sampleBuffer::play( sampleFrame * _ab, handleState * _state, const float _freq, const bool _looped ) { - eng()->getMixer()->clearAudioBuffer( _ab, _frames ); + engine::getMixer()->clearAudioBuffer( _ab, _frames ); if( m_data == NULL || m_frames == 0 || m_endFrame == 0 || _frames == 0 ) { return( FALSE ); } - const double freq_factor = (double) _freq / (double) m_frequency; + const double freq_factor = (double) _freq / (double) m_frequency + * m_sample_rate / engine::getMixer()->sampleRate(); // calculate how many frames we have in requested pitch const f_cnt_t total_frames_for_current_pitch = static_cast( ( @@ -691,7 +689,7 @@ bool FASTCALL sampleBuffer::play( sampleFrame * _ab, handleState * _state, // foo = f2; // check whether we have to change pitch... - if( _freq != m_frequency || _state->m_varying_pitch ) + if( freq_factor != 1.0 || _state->m_varying_pitch ) { #ifdef HAVE_SAMPLERATE_H // Generate output @@ -725,7 +723,7 @@ bool FASTCALL sampleBuffer::play( sampleFrame * _ab, handleState * _state, #else f_cnt_t src_frame_base = 0; // check whether we're in high-quality-mode - if( eng()->getMixer()->highQuality() == TRUE ) + if( engine::getMixer()->highQuality() == TRUE ) { // we are, so let's use cubic interpolation... for( f_cnt_t frame = 0; frame < frames_to_process; @@ -1130,7 +1128,7 @@ QString & sampleBuffer::toBase64( QString & _dst ) const /* 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, - eng()->getMixer()->sampleRate() ); + engine::getMixer()->sampleRate() ); QBuffer ba_writer; #ifdef QT4 ba_writer.open( QBuffer::WriteOnly ); @@ -1191,12 +1189,11 @@ QString & sampleBuffer::toBase64( QString & _dst ) const sampleBuffer * sampleBuffer::resample( sampleFrame * _data, const f_cnt_t _frames, const sample_rate_t _src_sr, - const sample_rate_t _dst_sr, - engine * _engine ) + const sample_rate_t _dst_sr ) { const f_cnt_t dst_frames = static_cast( _frames / (float) _src_sr * (float) _dst_sr ); - sampleBuffer * dst_sb = new sampleBuffer( dst_frames, _engine ); + sampleBuffer * dst_sb = new sampleBuffer( dst_frames ); sampleFrame * dst_buf = dst_sb->m_origData; #ifdef HAVE_SAMPLERATE_H // yeah, libsamplerate, let's rock with sinc-interpolation! @@ -1521,7 +1518,7 @@ sampleBuffer::handleState::handleState( bool _varying_pitch ) : #ifdef HAVE_SAMPLERATE_H int error; if( ( m_resampling_data = src_new(/* - ( eng()->getMixer()->highQuality() == TRUE ) ? + ( engine::getMixer()->highQuality() == TRUE ) ? SRC_SINC_FASTEST :*/ SRC_LINEAR, DEFAULT_CHANNELS, &error ) ) == NULL ) diff --git a/src/lib/string_pair_drag.cpp b/src/lib/string_pair_drag.cpp index 498ccfe62..3b8de04c8 100644 --- a/src/lib/string_pair_drag.cpp +++ b/src/lib/string_pair_drag.cpp @@ -5,7 +5,7 @@ * for drag'n'drop of string-pairs and which is the base * for all drag'n'drop-actions within LMMS * - * Copyright (c) 2005-2006 Tobias Doerffel + * Copyright (c) 2005-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -28,6 +28,7 @@ #include "string_pair_drag.h" +#include "engine.h" #include "main_window.h" #ifdef QT4 @@ -40,20 +41,18 @@ stringPairDrag::stringPairDrag( const QString & _key, const QString & _value, - const QPixmap & _icon, QWidget * _w, - engine * _engine ) : + const QPixmap & _icon, QWidget * _w ) : #ifdef QT4 - QDrag( _w ), + QDrag( _w ) #else - QStoredDrag( "lmms/stringpair", _w ), + QStoredDrag( mimeType(), _w ) #endif - engineObject( _engine ) { setPixmap( _icon ); QString txt = _key + ":" + _value; #ifdef QT4 QMimeData * m = new QMimeData(); - m->setData( "lmms/stringpair", txt.toAscii() ); + m->setData( mimeType(), txt.toAscii() ); setMimeData( m ); start( Qt::IgnoreAction ); #else @@ -69,7 +68,7 @@ stringPairDrag::~stringPairDrag() { // during a drag, we might have lost key-press-events, so reset // modifiers of main-win - eng()->getMainWindow()->clearKeyModifiers(); + engine::getMainWindow()->clearKeyModifiers(); // TODO: do we have to delete anything??? } @@ -80,11 +79,11 @@ bool stringPairDrag::processDragEnterEvent( QDragEnterEvent * _dee, const QString & _allowed_keys ) { #ifdef QT4 - if( !_dee->mimeData()->hasFormat( "lmms/stringpair" ) ) + if( !_dee->mimeData()->hasFormat( mimeType() ) ) { return( FALSE ); } - QString txt = _dee->mimeData()->data( "lmms/stringpair" ); + QString txt = _dee->mimeData()->data( mimeType() ); if( _allowed_keys.split( ',' ).contains( txt.section( ':', 0, 0 ) ) ) { _dee->acceptProposedAction(); @@ -93,7 +92,7 @@ bool stringPairDrag::processDragEnterEvent( QDragEnterEvent * _dee, _dee->ignore(); return( FALSE ); #else - QString txt = _dee->encodedData( "lmms/stringpair" ); + QString txt = _dee->encodedData( mimeType() ); bool accepted = QStringList::split( ',', _allowed_keys ).contains( txt.section( ':', 0, 0 ) ); _dee->accept( accepted ); @@ -107,10 +106,10 @@ bool stringPairDrag::processDragEnterEvent( QDragEnterEvent * _dee, QString stringPairDrag::decodeKey( QDropEvent * _de ) { #ifdef QT4 - return( QString( _de->mimeData()->data( "lmms/stringpair" + return( QString( _de->mimeData()->data( mimeType() ) ).section( ':', 0, 0 ) ); #else - return( QString( _de->encodedData( "lmms/stringpair" ) ).section( + return( QString( _de->encodedData( mimeType() ) ).section( ':', 0, 0 ) ); #endif } @@ -121,10 +120,10 @@ QString stringPairDrag::decodeKey( QDropEvent * _de ) QString stringPairDrag::decodeValue( QDropEvent * _de ) { #ifdef QT4 - return( QString( _de->mimeData()->data( "lmms/stringpair" + return( QString( _de->mimeData()->data( mimeType() ) ).section( ':', 1, -1 ) ); #else - return( QString( _de->encodedData( "lmms/stringpair" ) ).section( + return( QString( _de->encodedData( mimeType() ) ).section( ':', 1, -1 ) ); #endif } diff --git a/src/midi/midi_alsa_raw.cpp b/src/midi/midi_alsa_raw.cpp index 4067bc440..4216d7edd 100644 --- a/src/midi/midi_alsa_raw.cpp +++ b/src/midi/midi_alsa_raw.cpp @@ -3,7 +3,7 @@ /* * midi_alsa_raw.cpp - midi-client for RawMIDI via ALSA * - * Copyright (c) 2005-2006 Tobias Doerffel + * Copyright (c) 2005-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -49,9 +49,7 @@ #ifdef ALSA_SUPPORT -midiALSARaw::midiALSARaw( engine * _engine ) : - midiClientRaw( _engine ), - QThread(), +midiALSARaw::midiALSARaw( void ) : m_inputp( &m_input ), m_outputp( &m_output ), m_quit( FALSE ) diff --git a/src/midi/midi_alsa_seq.cpp b/src/midi/midi_alsa_seq.cpp index 948787678..6e26d00f4 100644 --- a/src/midi/midi_alsa_seq.cpp +++ b/src/midi/midi_alsa_seq.cpp @@ -3,7 +3,7 @@ /* * midi_alsa_seq.cpp - ALSA-sequencer-client * - * Copyright (c) 2005-2006 Tobias Doerffel + * Copyright (c) 2005-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -43,6 +43,7 @@ #include "midi_alsa_seq.h" #include "config_mgr.h" +#include "engine.h" #include "gui_templates.h" #include "song_editor.h" #include "midi_port.h" @@ -52,18 +53,11 @@ #ifdef ALSA_SUPPORT -midiALSASeq::midiALSASeq( engine * _engine ) : -#ifndef QT4 - QObject(), -#endif - midiClient( _engine ), - QThread(), +midiALSASeq::midiALSASeq( void ) : m_seqHandle( NULL ), m_queueID( -1 ), m_quit( FALSE ), - m_portListUpdateTimer( this ), - m_readablePorts(), - m_writeablePorts() + m_portListUpdateTimer( this ) { int err; if( ( err = snd_seq_open( &m_seqHandle, @@ -84,13 +78,13 @@ midiALSASeq::midiALSASeq( engine * _engine ) : snd_seq_queue_tempo_t * tempo; snd_seq_queue_tempo_alloca( &tempo ); snd_seq_queue_tempo_set_tempo( tempo, 6000000 / - eng()->getSongEditor()->getTempo() ); + engine::getSongEditor()->getTempo() ); snd_seq_queue_tempo_set_ppq( tempo, 16 ); snd_seq_set_queue_tempo( m_seqHandle, m_queueID, tempo ); snd_seq_start_queue( m_seqHandle, m_queueID, NULL ); - changeQueueTempo( eng()->getSongEditor()->getTempo() ); - connect( eng()->getSongEditor(), SIGNAL( tempoChanged( bpm_t ) ), + changeQueueTempo( engine::getSongEditor()->getTempo() ); + connect( engine::getSongEditor(), SIGNAL( tempoChanged( bpm_t ) ), this, SLOT( changeQueueTempo( bpm_t ) ) ); // initial list-update diff --git a/src/midi/midi_client.cpp b/src/midi/midi_client.cpp index 22b753396..7294c0dce 100644 --- a/src/midi/midi_client.cpp +++ b/src/midi/midi_client.cpp @@ -3,7 +3,7 @@ /* * midi_client.cpp - base-class for MIDI-clients like ALSA-sequencer-client * - * Copyright (c) 2005-2006 Tobias Doerffel + * Copyright (c) 2005-2007 Tobias Doerffel * This file partly contains code from Fluidsynth, Peter Hanappe * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net @@ -40,8 +40,7 @@ -midiClient::midiClient( engine * _engine ) : - engineObject( _engine ) +midiClient::midiClient( void ) { } @@ -130,8 +129,7 @@ void midiClient::subscribeWriteablePort( midiPort * , const QString & , bool) -midiClientRaw::midiClientRaw( engine * _engine ) : - midiClient( _engine ) +midiClientRaw::midiClientRaw( void ) { } diff --git a/src/midi/midi_oss.cpp b/src/midi/midi_oss.cpp index 75cf2ec74..a525a754d 100644 --- a/src/midi/midi_oss.cpp +++ b/src/midi/midi_oss.cpp @@ -3,7 +3,7 @@ /* * midi_oss.cpp - OSS-raw-midi-client * - * Copyright (c) 2005-2006 Tobias Doerffel + * Copyright (c) 2005-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -55,9 +55,7 @@ -midiOSS::midiOSS( engine * _engine ) : - midiClientRaw( _engine ), - QThread(), +midiOSS::midiOSS( void ) : m_midiDev( probeDevice() ), m_quit( FALSE ) { diff --git a/src/tracks/automation_pattern.cpp b/src/tracks/automation_pattern.cpp index 65867b5cc..b6a974e26 100644 --- a/src/tracks/automation_pattern.cpp +++ b/src/tracks/automation_pattern.cpp @@ -4,7 +4,7 @@ * automation_pattern.cpp - implementation of class automationPattern which * holds dynamic values * - * Copyright (c) 2006 Javier Serrano Polo + * Copyright (c) 2006-2007 Javier Serrano Polo * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -43,12 +43,12 @@ #include "automation_pattern.h" #include "templates.h" #include "automation_editor.h" +#include "engine.h" automationPattern::automationPattern( track * _track, levelObject * _object ) : - journallingObject( _track->eng() ), m_track( _track ), m_object( _object ), m_update_first( TRUE ) @@ -59,21 +59,7 @@ automationPattern::automationPattern( track * _track, levelObject * _object ) : -automationPattern::automationPattern( engine * _engine, - levelObject * _object ) : - journallingObject( _engine ), - m_track( NULL ), - m_object( _object ), - m_update_first( TRUE ) -{ - init(); -} - - - - automationPattern::automationPattern( const automationPattern & _pat_to_copy ) : - journallingObject( _pat_to_copy.m_track->eng() ), m_track( _pat_to_copy.m_track ), m_object( _pat_to_copy.m_object ), m_update_first( _pat_to_copy.m_update_first ) @@ -92,7 +78,6 @@ automationPattern::automationPattern( const automationPattern & _pat_to_copy ) : automationPattern::automationPattern( const automationPattern & _pat_to_copy, levelObject * _object ) : - journallingObject( _pat_to_copy.m_track->eng() ), m_track( _pat_to_copy.m_track ), m_object( _object ), m_update_first( _pat_to_copy.m_update_first ) @@ -116,10 +101,10 @@ automationPattern::~automationPattern() m_track->removeAutomationPattern( this ); } - if( eng()->getAutomationEditor() - && eng()->getAutomationEditor()->currentPattern() == this ) + if( engine::getAutomationEditor() + && engine::getAutomationEditor()->currentPattern() == this ) { - eng()->getAutomationEditor()->setCurrentPattern( NULL ); + engine::getAutomationEditor()->setCurrentPattern( NULL ); } } @@ -163,7 +148,7 @@ midiTime automationPattern::putValue( const midiTime & _time, const int _value, { midiTime new_time = _quant_pos ? note::quantized( _time, - eng()->getAutomationEditor()->quantization() ) : + engine::getAutomationEditor()->quantization() ) : _time; m_time_map[-new_time] = _value; @@ -188,9 +173,9 @@ void automationPattern::removeValue( const midiTime & _time ) void automationPattern::clear( void ) { m_time_map.clear(); - if( eng()->getAutomationEditor()->currentPattern() == this ) + if( engine::getAutomationEditor()->currentPattern() == this ) { - eng()->getAutomationEditor()->update(); + engine::getAutomationEditor()->update(); } } @@ -244,9 +229,9 @@ void automationPattern::loadSettings( const QDomElement & _this ) void automationPattern::openInAutomationEditor( void ) { - eng()->getAutomationEditor()->setCurrentPattern( this ); - eng()->getAutomationEditor()->show(); - eng()->getAutomationEditor()->setFocus(); + engine::getAutomationEditor()->setCurrentPattern( this ); + engine::getAutomationEditor()->show(); + engine::getAutomationEditor()->setFocus(); } diff --git a/src/tracks/bb_track.cpp b/src/tracks/bb_track.cpp index 29dc46e10..b1dc77869 100644 --- a/src/tracks/bb_track.cpp +++ b/src/tracks/bb_track.cpp @@ -50,6 +50,7 @@ #include "gui_templates.h" #include "name_label.h" #include "embed.h" +#include "engine.h" #include "rename_dialog.h" #include "templates.h" @@ -68,7 +69,7 @@ bbTCO::bbTCO( track * _track, const QColor & _c ) : #ifndef QT4 setBackgroundMode( Qt::NoBackground ); #endif - tact t = eng()->getBBEditor()->lengthOfBB( + tact t = engine::getBBEditor()->lengthOfBB( bbTrack::numOfBBTrack( getTrack() ) ); if( t > 0 ) { @@ -165,7 +166,7 @@ void bbTCO::paintEvent( QPaintEvent * ) } #endif - tact t = eng()->getBBEditor()->lengthOfBB( bbTrack::numOfBBTrack( + tact t = engine::getBBEditor()->lengthOfBB( bbTrack::numOfBBTrack( getTrack() ) ); if( length() > 64 && t > 0 ) { @@ -248,10 +249,10 @@ void bbTCO::loadSettings( const QDomElement & _this ) void bbTCO::openInBBEditor( bool ) { - eng()->getBBEditor()->setCurrentBB( bbTrack::numOfBBTrack( + engine::getBBEditor()->setCurrentBB( bbTrack::numOfBBTrack( getTrack() ) ); - eng()->getBBEditor()->show(); - eng()->getBBEditor()->setFocus(); + engine::getBBEditor()->show(); + engine::getBBEditor()->setFocus(); } @@ -296,7 +297,7 @@ void bbTCO::changeColor( void ) if( isSelected() ) { vvector selected = - eng()->getSongEditor()->selectedObjects(); + engine::getSongEditor()->selectedObjects(); for( vvector::iterator it = selected.begin(); it != selected.end(); ++it ) @@ -322,7 +323,7 @@ void bbTCO::setColor( QColor _new_color ) if( _new_color != m_color ) { m_color = _new_color; - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); update(); } } @@ -343,7 +344,7 @@ bbTrack::bbTrack( trackContainer * _tc ) : s_infoMap[this] = bbNum; m_trackLabel = new nameLabel( tr( "Beat/Baseline %1" ).arg( bbNum ), - getTrackSettingsWidget(), eng() ); + getTrackSettingsWidget() ); m_trackLabel->setPixmap( embed::getIconPixmap( "bb_track" ) ); m_trackLabel->setGeometry( 1, 1, DEFAULT_SETTINGS_WIDGET_WIDTH - 2, 29 ); @@ -351,13 +352,13 @@ bbTrack::bbTrack( trackContainer * _tc ) : connect( m_trackLabel, SIGNAL( clicked() ), this, SLOT( clickedTrackLabel() ) ); connect( m_trackLabel, SIGNAL( nameChanged() ), - eng()->getBBEditor(), SLOT( updateComboBox() ) ); + engine::getBBEditor(), SLOT( updateComboBox() ) ); connect( m_trackLabel, SIGNAL( pixmapChanged() ), - eng()->getBBEditor(), SLOT( updateComboBox() ) ); + engine::getBBEditor(), SLOT( updateComboBox() ) ); - eng()->getBBEditor()->setCurrentBB( bbNum ); - eng()->getBBEditor()->updateComboBox(); + engine::getBBEditor()->setCurrentBB( bbNum ); + engine::getBBEditor()->updateComboBox(); _tc->updateAfterTrackAdd(); } @@ -368,7 +369,7 @@ bbTrack::bbTrack( trackContainer * _tc ) : bbTrack::~bbTrack() { csize bb = s_infoMap[this]; - eng()->getBBEditor()->removeBB( bb ); + engine::getBBEditor()->removeBB( bb ); for( infoMap::iterator it = s_infoMap.begin(); it != s_infoMap.end(); ++it ) { @@ -385,7 +386,7 @@ bbTrack::~bbTrack() #endif } s_infoMap.remove( this ); - eng()->getBBEditor()->updateComboBox(); + engine::getBBEditor()->updateComboBox(); } @@ -408,14 +409,14 @@ bool FASTCALL bbTrack::play( const midiTime & _start, if( _tco_num >= 0 ) { - return( eng()->getBBEditor()->play( _start, _frames, + return( engine::getBBEditor()->play( _start, _frames, _frame_base, s_infoMap[this] ) ); } vlist tcos; getTCOsInRange( tcos, _start, _start + static_cast( _frames / - eng()->framesPerTact64th() ) ); + engine::framesPerTact64th() ) ); if ( tcos.size() == 0 ) { @@ -436,7 +437,7 @@ bool FASTCALL bbTrack::play( const midiTime & _start, } if( _start - lastPosition < lastLen ) { - return( eng()->getBBEditor()->play( _start - lastPosition, + return( engine::getBBEditor()->play( _start - lastPosition, _frames, _frame_base, s_infoMap[this] ) ); @@ -474,17 +475,17 @@ void bbTrack::saveTrackSpecificSettings( QDomDocument & _doc, _this.setAttribute( "name", m_trackLabel->text() ); _this.setAttribute( "icon", m_trackLabel->pixmapFile() ); /* _this.setAttribute( "current", s_infoMap[this] == - eng()->getBBEditor()->currentBB() );*/ + engine::getBBEditor()->currentBB() );*/ if( s_infoMap[this] == 0 && _this.parentNode().parentNode().nodeName() != "clone" && _this.parentNode().nodeName() != "journaldata" ) { - ( (journallingObject *)( eng()->getBBEditor() ) )->saveState( + ( (journallingObject *)( engine::getBBEditor() ) )->saveState( _doc, _this ); } int track_num = 0; - trackVector tracks = eng()->getBBEditor()->tracks(); + trackVector tracks = engine::getBBEditor()->tracks(); for( trackVector::iterator it = tracks.begin(); it != tracks.end(); ++it, ++track_num ) { @@ -508,12 +509,12 @@ void bbTrack::loadTrackSpecificSettings( const QDomElement & _this ) { m_trackLabel->setPixmapFile( _this.attribute( "icon" ) ); } - eng()->getBBEditor()->updateComboBox(); + engine::getBBEditor()->updateComboBox(); QDomNode node = _this.namedItem( trackContainer::classNodeName() ); if( node.isElement() ) { - ( (journallingObject *)( eng()->getBBEditor() ) )->restoreState( + ( (journallingObject *)engine::getBBEditor() )->restoreState( node.toElement() ); } /* doesn't work yet because bbTrack-ctor also sets current bb so if @@ -521,10 +522,10 @@ void bbTrack::loadTrackSpecificSettings( const QDomElement & _this ) help at all.... if( _this.attribute( "current" ).toInt() ) { - eng()->getBBEditor()->setCurrentBB( s_infoMap[this] ); + engine::getBBEditor()->setCurrentBB( s_infoMap[this] ); }*/ - trackVector tracks = eng()->getBBEditor()->tracks(); + trackVector tracks = engine::getBBEditor()->tracks(); node = _this.firstChild(); while( !node.isNull() ) { @@ -542,15 +543,15 @@ void bbTrack::loadTrackSpecificSettings( const QDomElement & _this ) // return pointer to bbTrack specified by _bb_num -bbTrack * bbTrack::findBBTrack( csize _bb_num, engine * _engine ) +bbTrack * bbTrack::findBBTrack( csize _bb_num ) { for( infoMap::iterator it = s_infoMap.begin(); it != s_infoMap.end(); ++it ) { #ifdef QT4 - if( it.value() == _bb_num && it.key()->eng() == _engine ) + if( it.value() == _bb_num ) #else - if( it.data() == _bb_num && it.key()->eng() == _engine ) + if( it.data() == _bb_num ) #endif { return( it.key() ); @@ -581,9 +582,8 @@ void bbTrack::swapBBTracks( track * _track1, track * _track2 ) if( t1 != NULL && t2 != NULL ) { qSwap( s_infoMap[t1], s_infoMap[t2] ); - _track1->eng()->getBBEditor()->swapBB( s_infoMap[t1], - s_infoMap[t2] ); - _track1->eng()->getBBEditor()->setCurrentBB( s_infoMap[t1] ); + engine::getBBEditor()->swapBB( s_infoMap[t1], s_infoMap[t2] ); + engine::getBBEditor()->setCurrentBB( s_infoMap[t1] ); } } @@ -592,8 +592,8 @@ void bbTrack::swapBBTracks( track * _track1, track * _track2 ) void bbTrack::clickedTrackLabel( void ) { - eng()->getBBEditor()->setCurrentBB( s_infoMap[this] ); - eng()->getBBEditor()->show(); + engine::getBBEditor()->setCurrentBB( s_infoMap[this] ); + engine::getBBEditor()->show(); } diff --git a/src/tracks/instrument_track.cpp b/src/tracks/instrument_track.cpp index 72649c7e1..f241720d8 100644 --- a/src/tracks/instrument_track.cpp +++ b/src/tracks/instrument_track.cpp @@ -112,13 +112,13 @@ const int PIANO_HEIGHT = 84; instrumentTrack::instrumentTrack( trackContainer * _tc ) : - QWidget( _tc->eng()->getMainWindow()->workspace() ), + QWidget( engine::getMainWindow()->workspace() ), track( _tc ), midiEventProcessor(), m_trackType( INSTRUMENT_TRACK ), - m_midiPort( eng()->getMixer()->getMIDIClient()->addPort( this, + m_midiPort( engine::getMixer()->getMIDIClient()->addPort( this, tr( "unnamed_channel" ) ) ), - m_audioPort( new audioPort( tr( "unnamed_channel" ), eng() ) ), + m_audioPort( new audioPort( tr( "unnamed_channel" ) ) ), m_notes(), m_notesMutex(), m_baseTone( A ), @@ -141,7 +141,7 @@ instrumentTrack::instrumentTrack( trackContainer * _tc ) : #ifdef QT4 - eng()->getMainWindow()->workspace()->addWindow( this ); + engine::getMainWindow()->workspace()->addWindow( this ); #endif setAcceptDrops( TRUE ); @@ -153,7 +153,7 @@ instrumentTrack::instrumentTrack( trackContainer * _tc ) : // creation of widgets for track-settings-widget m_tswVolumeKnob = new volumeKnob( knobSmall_17, getTrackSettingsWidget(), - tr( "Channel volume" ), eng(), this ); + tr( "Channel volume" ), this ); m_tswVolumeKnob->setRange( MIN_VOLUME, MAX_VOLUME, 1.0f ); m_tswVolumeKnob->setInitValue( DEFAULT_VOLUME ); m_tswVolumeKnob->setHintText( tr( "Channel volume:" ) + " ", "%" ); @@ -224,7 +224,7 @@ instrumentTrack::instrumentTrack( trackContainer * _tc ) : // setup volume-knob m_volumeKnob = new volumeKnob( knobBright_26, m_generalSettingsWidget, - tr( "Channel volume" ), eng(), this ); + tr( "Channel volume" ), this ); m_volumeKnob->move( 10, 44 ); m_volumeKnob->setRange( MIN_VOLUME, MAX_VOLUME, 1.0f ); m_volumeKnob->setInitValue( DEFAULT_VOLUME ); @@ -244,7 +244,7 @@ instrumentTrack::instrumentTrack( trackContainer * _tc ) : // setup surround-area m_surroundArea = new surroundArea( m_generalSettingsWidget, - tr( "Surround area" ), eng(), this ); + tr( "Surround area" ), this ); m_surroundArea->move( 20 + m_volumeKnob->width(), 38 ); m_surroundArea->show(); #ifdef QT4 @@ -265,7 +265,7 @@ instrumentTrack::instrumentTrack( trackContainer * _tc ) : MAX_EFFECT_CHANNEL, 2, m_generalSettingsWidget, tr( "FX channel" ), - eng(), this ); + this ); m_effectChannelNumber->setInitValue( DEFAULT_EFFECT_CHANNEL ); m_effectChannelNumber->setLabel( tr( "FX CHNL" ) ); m_effectChannelNumber->move( m_surroundArea->x() + @@ -394,7 +394,7 @@ instrumentTrack::~instrumentTrack() { invalidateAllMyNPH(); delete m_audioPort; - eng()->getMixer()->getMIDIClient()->removePort( m_midiPort ); + engine::getMixer()->getMIDIClient()->removePort( m_midiPort ); } @@ -524,7 +524,7 @@ void instrumentTrack::midiConfigChanged( bool ) float instrumentTrack::frequency( notePlayHandle * _n ) const { float pitch = (float)( _n->tone() - m_baseTone + - eng()->getSongEditor()->masterPitch() ) / 12.0f + + engine::getSongEditor()->masterPitch() ) / 12.0f + (float)( _n->octave() - m_baseOctave ); if( _n->detuning() ) { @@ -593,10 +593,10 @@ void instrumentTrack::processAudioBuffer( sampleFrame * _buf, // last time we're called for current note? if( ( _n->actualReleaseFramesToDo() == 0 && _n->totalFramesPlayed() + - eng()->getMixer()->framesPerAudioBuffer() >= + engine::getMixer()->framesPerAudioBuffer() >= _n->frames() ) || ( _n->released() && _n->releaseFramesDone() + - eng()->getMixer()->framesPerAudioBuffer() >= + engine::getMixer()->framesPerAudioBuffer() >= _n->actualReleaseFramesToDo() ) ) { // then do a soft fade-out at the end to avoid clicks @@ -616,7 +616,7 @@ void instrumentTrack::processAudioBuffer( sampleFrame * _buf, volumeVector v = m_surroundArea->getVolumeVector( v_scale ); - eng()->getMixer()->bufferToPort( _buf, _frames, + engine::getMixer()->bufferToPort( _buf, _frames, ( _n != NULL ) ? _n->framesAhead() : 0, v, m_audioPort ); } @@ -650,7 +650,7 @@ void instrumentTrack::processInEvent( const midiEvent & _me, notePlayHandle * nph = new notePlayHandle( this, _time.frames( - eng()->framesPerTact64th() ), + engine::framesPerTact64th() ), valueRanges::max, n ); // as mixer::addPlayHandle() might // delete note (when running into @@ -659,7 +659,7 @@ void instrumentTrack::processInEvent( const midiEvent & _me, // this mutex, we have to unlock // it here temporarily m_notesMutex.unlock(); - if( eng()->getMixer()->addPlayHandle( + if( engine::getMixer()->addPlayHandle( nph ) ) { m_notesMutex.lock(); @@ -680,10 +680,10 @@ void instrumentTrack::processInEvent( const midiEvent & _me, // to all slots connected to signal noteDone() // this is for example needed by piano-roll for // recording notes into a pattern - note done_note( NULL, + note done_note( midiTime( static_cast( n->totalFramesPlayed() / - eng()->framesPerTact64th() ) ), + engine::framesPerTact64th() ) ), 0, n->tone(), n->octave(), n->getVolume(), n->getPanning() ); n->noteOff(); @@ -817,9 +817,9 @@ void instrumentTrack::deleteNotePluginData( notePlayHandle * _n ) // Notes deleted when keys still pressed if( m_notes[_n->key()] == _n ) { - note done_note( NULL, midiTime( static_cast( + note done_note( midiTime( static_cast( _n->totalFramesPlayed() / - eng()->framesPerTact64th() ) ), + engine::framesPerTact64th() ) ), 0, _n->tone(), _n->octave(), _n->getVolume(), _n->getPanning() ); _n->noteOff(); @@ -904,7 +904,7 @@ void instrumentTrack::setBaseNote( Uint32 _new_note, bool _modified ) setBaseOctave( (octaves)( _new_note / NOTES_PER_OCTAVE ) ); if( _modified ) { - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); } emit baseNoteChanged(); } @@ -937,7 +937,7 @@ void instrumentTrack::setBaseOctave( octaves _new_octave ) int instrumentTrack::masterKey( notePlayHandle * _n ) const { int key = baseTone() + baseOctave() * NOTES_PER_OCTAVE + - eng()->getSongEditor()->masterPitch(); + engine::getSongEditor()->masterPitch(); return( tLimit( _n->key() - ( key - A - DEFAULT_OCTAVE * NOTES_PER_OCTAVE ), 0, NOTES ) ); } @@ -950,7 +950,7 @@ bool FASTCALL instrumentTrack::play( const midiTime & _start, const f_cnt_t _frame_base, Sint16 _tco_num ) { - float frames_per_tact64th = eng()->framesPerTact64th(); + float frames_per_tact64th = engine::framesPerTact64th(); vlist tcos; bbTrack * bb_track; @@ -958,7 +958,7 @@ bool FASTCALL instrumentTrack::play( const midiTime & _start, { trackContentObject * tco = getTCO( _tco_num ); tcos.push_back( tco ); - bb_track = bbTrack::findBBTrack( _tco_num, eng() ); + bb_track = bbTrack::findBBTrack( _tco_num ); if( !( bb_track->automationDisabled( this ) || dynamic_cast( tco )->empty() ) ) { @@ -1002,7 +1002,7 @@ bool FASTCALL instrumentTrack::play( const midiTime & _start, cur_start -= p->startPosition(); } if( p->frozen() && - eng()->getSongEditor()->exporting() == FALSE ) + engine::getSongEditor()->exporting() == FALSE ) { if( cur_start > 0 ) { @@ -1022,7 +1022,7 @@ bool FASTCALL instrumentTrack::play( const midiTime & _start, else { // send it to the mixer - eng()->getMixer()->addPlayHandle( handle ); + engine::getMixer()->addPlayHandle( handle ); } played_a_note = TRUE; continue; @@ -1100,7 +1100,7 @@ bool FASTCALL instrumentTrack::play( const midiTime & _start, { // no, then insert it into // play-handle-vector of mixer - eng()->getMixer()->addPlayHandle( + engine::getMixer()->addPlayHandle( note_play_handle ); } else @@ -1256,7 +1256,7 @@ instrument * instrumentTrack::loadInstrument( const QString & _plugin_name ) void instrumentTrack::surroundAreaPosChanged( const QPoint & _p ) { setSurroundAreaPos( _p ); - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); } @@ -1265,7 +1265,7 @@ void instrumentTrack::surroundAreaPosChanged( const QPoint & _p ) void instrumentTrack::textChanged( const QString & _new_name ) { setName( _new_name ); - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); } @@ -1324,7 +1324,7 @@ void instrumentTrack::dropEvent( QDropEvent * _de ) if( type == "instrument" ) { loadInstrument( value ); - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); _de->accept(); } else if( type == "presetfile" ) @@ -1332,7 +1332,7 @@ void instrumentTrack::dropEvent( QDropEvent * _de ) multimediaProject mmp( value ); loadTrackSpecificSettings( mmp.content().firstChild(). toElement() ); - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); _de->accept(); } } @@ -1356,7 +1356,7 @@ void instrumentTrack::invalidateAllMyNPH( void ) // invalidate all note-play-handles linked to this channel m_processHandles.clear(); - eng()->getMixer()->checkValidityOfPlayHandles(); + engine::getMixer()->checkValidityOfPlayHandles(); m_trackType = INSTRUMENT_TRACK; } diff --git a/src/tracks/pattern.cpp b/src/tracks/pattern.cpp index a1715a28b..434901cc7 100644 --- a/src/tracks/pattern.cpp +++ b/src/tracks/pattern.cpp @@ -126,16 +126,16 @@ pattern::pattern( const pattern & _pat_to_copy ) : pattern::~pattern() { - if( eng()->getPianoRoll()->currentPattern() == this ) + if( engine::getPianoRoll()->currentPattern() == this ) { - eng()->getPianoRoll()->setCurrentPattern( NULL ); + engine::getPianoRoll()->setCurrentPattern( NULL ); // we have to have the song-editor to stop playing if it played // us before - if( eng()->getSongEditor()->playing() && - eng()->getSongEditor()->playMode() == + if( engine::getSongEditor()->playing() && + engine::getSongEditor()->playMode() == songEditor::PLAY_PATTERN ) { - eng()->getSongEditor()->playPattern( NULL ); + engine::getSongEditor()->playPattern( NULL ); } } @@ -248,7 +248,7 @@ note * pattern::addNote( const note & _new_note, const bool _quant_pos ) note * new_note = new note( _new_note ); if( _quant_pos ) { - new_note->quantizePos( eng()->getPianoRoll()->quantization() ); + new_note->quantizePos( engine::getPianoRoll()->quantization() ); } if( m_notes.size() == 0 || m_notes.back()->pos() <= new_note->pos() ) @@ -335,9 +335,9 @@ void pattern::clearNotes( void ) m_notes.clear(); checkType(); update(); - if( eng()->getPianoRoll()->currentPattern() == this ) + if( engine::getPianoRoll()->currentPattern() == this ) { - eng()->getPianoRoll()->update(); + engine::getPianoRoll()->update(); } } @@ -460,7 +460,7 @@ void pattern::loadSettings( const QDomElement & _this ) if( node.isElement() && !node.toElement().attribute( "metadata" ).toInt() ) { - note * n = new note( eng() ); + note * n = new note; n->restoreState( node.toElement() ); m_notes.push_back( n ); } @@ -505,9 +505,9 @@ void pattern::openInPianoRoll( void ) void pattern::openInPianoRoll( bool ) { - eng()->getPianoRoll()->setCurrentPattern( this ); - eng()->getPianoRoll()->show(); - eng()->getPianoRoll()->setFocus(); + engine::getPianoRoll()->setCurrentPattern( this ); + engine::getPianoRoll()->show(); + engine::getPianoRoll()->setFocus(); } @@ -541,7 +541,7 @@ void pattern::changeName( void ) void pattern::freeze( void ) { - if( eng()->getSongEditor()->playing() ) + if( engine::getSongEditor()->playing() ) { QMessageBox::information( 0, tr( "Cannot freeze pattern" ), tr( "The pattern currently " @@ -804,21 +804,21 @@ void pattern::mousePressEvent( QMouseEvent * _me ) { n->setLength( -64 ); } - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); update(); - if( eng()->getPianoRoll()->currentPattern() == this ) + if( engine::getPianoRoll()->currentPattern() == this ) { - eng()->getPianoRoll()->update(); + engine::getPianoRoll()->update(); } } else if( m_frozenPattern != NULL && _me->button() == Qt::LeftButton && - eng()->getMainWindow()->isShiftPressed() == TRUE ) + engine::getMainWindow()->isShiftPressed() == TRUE ) { QString s; new stringPairDrag( "sampledata", m_frozenPattern->toBase64( s ), - embed::getIconPixmap( "freeze" ), - this, eng() ); + embed::getIconPixmap( "freeze" ), + this ); } else { @@ -868,11 +868,11 @@ void pattern::wheelEvent( QWheelEvent * _we ) n->setLength( 0 ); } } - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); update(); - if( eng()->getPianoRoll()->currentPattern() == this ) + if( engine::getPianoRoll()->currentPattern() == this ) { - eng()->getPianoRoll()->update(); + engine::getPianoRoll()->update(); } _we->accept(); } @@ -1151,7 +1151,7 @@ void pattern::ensureBeatNotes( void ) } if( found == FALSE ) { - addNote( note( eng(), midiTime( 0 ), midiTime( i * + addNote( note( midiTime( 0 ), midiTime( i * BEATS_PER_TACT ) ) ); } } @@ -1162,9 +1162,9 @@ void pattern::ensureBeatNotes( void ) void pattern::updateBBTrack( void ) { - if( getTrack()->getTrackContainer() == eng()->getBBEditor() ) + if( getTrack()->getTrackContainer() == engine::getBBEditor() ) { - eng()->getBBEditor()->updateBBTrack( this ); + engine::getBBEditor()->updateBBTrack( this ); } } @@ -1294,8 +1294,6 @@ void patternFreezeStatusDialog::updateProgress( void ) patternFreezeThread::patternFreezeThread( pattern * _pattern ) : - QThread(), - engineObject( _pattern->eng() ), m_pattern( _pattern ) { // create status-dialog @@ -1327,15 +1325,15 @@ void patternFreezeThread::run( void ) // mixer::restoreAudioDevice(...) deletes old audio-dev and thus // audioSampleRecorder would be destroyed two times... audioSampleRecorder * freeze_recorder = new audioSampleRecorder( - eng()->getMixer()->sampleRate(), + engine::getMixer()->sampleRate(), DEFAULT_CHANNELS, b, - eng()->getMixer() ); - eng()->getMixer()->setAudioDevice( freeze_recorder, - eng()->getMixer()->highQuality() ); + engine::getMixer() ); + engine::getMixer()->setAudioDevice( freeze_recorder, + engine::getMixer()->highQuality() ); // prepare stuff for playing correct things later - eng()->getSongEditor()->playPattern( m_pattern, FALSE ); - songEditor::playPos & ppp = eng()->getSongEditor()->getPlayPos( + engine::getSongEditor()->playPattern( m_pattern, FALSE ); + songEditor::playPos & ppp = engine::getSongEditor()->getPlayPos( songEditor::PLAY_PATTERN ); ppp.setTact( 0 ); ppp.setTact64th( 0 ); @@ -1358,7 +1356,7 @@ void patternFreezeThread::run( void ) m_pattern->m_freezing = FALSE; // reset song-editor settings - eng()->getSongEditor()->stop(); + engine::getSongEditor()->stop(); ppp.m_timeLineUpdate = TRUE; // create final sample-buffer if freezing was successful @@ -1373,7 +1371,7 @@ void patternFreezeThread::run( void ) bufferAllocator::disableAutoCleanup( FALSE ); // restore original audio-device - eng()->getMixer()->restoreAudioDevice(); + engine::getMixer()->restoreAudioDevice(); m_statusDlg->setProgress( -1 ); // we're finished diff --git a/src/tracks/sample_track.cpp b/src/tracks/sample_track.cpp index ad94311b9..c58c22301 100644 --- a/src/tracks/sample_track.cpp +++ b/src/tracks/sample_track.cpp @@ -4,7 +4,7 @@ * sample_track.cpp - implementation of class sampleTrack, a track which * provides arrangement of samples * - * Copyright (c) 2005-2006 Tobias Doerffel + * Copyright (c) 2005-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -60,7 +60,7 @@ sampleTCO::sampleTCO( track * _track ) : trackContentObject( _track ), - m_sampleBuffer( new sampleBuffer( eng() ) ) + m_sampleBuffer( new sampleBuffer ) { #ifndef QT4 setBackgroundMode( Qt::NoBackground ); @@ -72,7 +72,7 @@ sampleTCO::sampleTCO( track * _track ) : // we need to receive bpm-change-events, because then we have to // change length of this TCO - connect( eng()->getSongEditor(), SIGNAL( tempoChanged( bpm_t ) ), this, + connect( engine::getSongEditor(), SIGNAL( tempoChanged( bpm_t ) ), this, SLOT( updateLength( bpm_t ) ) ); } @@ -150,7 +150,7 @@ void sampleTCO::dropEvent( QDropEvent * _de ) { m_sampleBuffer->loadFromBase64( stringPairDrag::decodeValue( _de ) ); - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); updateLength(); update(); _de->accept(); @@ -170,7 +170,7 @@ void sampleTCO::mouseDoubleClickEvent( QMouseEvent * ) if( af != "" && af != m_sampleBuffer->audioFile() ) { setSampleFile( af ); - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); } } @@ -243,7 +243,7 @@ void sampleTCO::paintEvent( QPaintEvent * _pe ) midiTime sampleTCO::getSampleLength( void ) const { return( static_cast( m_sampleBuffer->frames() / - eng()->framesPerTact64th() ) ); + engine::framesPerTact64th() ) ); } @@ -351,7 +351,7 @@ void sampleTCOSettingsDialog::setSampleFile( const QString & _f ) { m_fileLbl->setText( _f ); m_sampleTCO->setSampleFile( _f ); - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); } */ @@ -361,22 +361,22 @@ void sampleTCOSettingsDialog::setSampleFile( const QString & _f ) sampleTrack::sampleTrack( trackContainer * _tc ) : track( _tc ), - m_audioPort( new audioPort( tr( "Sample track" ), eng() ) ) + m_audioPort( new audioPort( tr( "Sample track" ) ) ) { getTrackWidget()->setFixedHeight( 32 ); m_trackLabel = new effectLabel( tr( "Sample track" ), - getTrackSettingsWidget(), eng(), this ); + getTrackSettingsWidget(), this ); #if 0 m_trackLabel = new nameLabel( tr( "Sample track" ), - getTrackSettingsWidget(), eng() ); + getTrackSettingsWidget() ); m_trackLabel->setPixmap( embed::getIconPixmap( "sample_track" ) ); #endif m_trackLabel->setGeometry( 26, 1, DEFAULT_SETTINGS_WIDGET_WIDTH-2, 29 ); m_trackLabel->show(); m_volumeKnob = new volumeKnob( knobSmall_17, getTrackSettingsWidget(), - tr( "Channel volume" ), eng(), this ); + tr( "Channel volume" ), this ); m_volumeKnob->setRange( MIN_VOLUME, MAX_VOLUME, 1.0f ); m_volumeKnob->setInitValue( DEFAULT_VOLUME ); m_volumeKnob->setHintText( tr( "Channel volume:" ) + " ", "%" ); @@ -451,7 +451,7 @@ bool FASTCALL sampleTrack::play( const midiTime & _start, else { // send it to the mixer - eng()->getMixer()->addPlayHandle( handle ); + engine::getMixer()->addPlayHandle( handle ); } played_a_note = TRUE; } diff --git a/src/widgets/automatable_button.cpp b/src/widgets/automatable_button.cpp index 85e189177..9f6dcfac9 100644 --- a/src/widgets/automatable_button.cpp +++ b/src/widgets/automatable_button.cpp @@ -4,7 +4,7 @@ * automatable_button.cpp - implementation of class automatableButton and * automatableButtonGroup * - * Copyright (c) 2006 Tobias Doerffel + * Copyright (c) 2006-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -50,13 +50,13 @@ automatableButton::automatableButton( QWidget * _parent, const QString & _name, - engine * _engine, track * _track ) : + track * _track ) : QWidget( _parent #ifndef QT4 , _name.ascii() #endif ), - autoObj( _engine, _track, FALSE, FALSE, TRUE ), + autoObj( _track, FALSE, FALSE, TRUE ), m_group( NULL ), m_checkable( FALSE ) { @@ -205,14 +205,14 @@ void automatableButton::setValue( const bool _on ) automatableButtonGroup::automatableButtonGroup( QWidget * _parent, - const QString & _name, - engine * _engine, track * _track ) : + const QString & _name, + track * _track ) : QWidget( _parent #ifndef QT4 , _name.ascii() #endif ), - automatableObject( _engine, _track ) + automatableObject( _track ) { hide(); if( _track != NULL ) diff --git a/src/widgets/automatable_slider.cpp b/src/widgets/automatable_slider.cpp index 41e7a3277..9be9b5b7e 100644 --- a/src/widgets/automatable_slider.cpp +++ b/src/widgets/automatable_slider.cpp @@ -3,7 +3,7 @@ /* * automatable_slider.cpp - implementation of class automatableSlider * - * Copyright (c) 2006 Javier Serrano Polo + * Copyright (c) 2006-2007 Javier Serrano Polo * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -48,7 +48,7 @@ automatableSlider::automatableSlider( QWidget * _parent, const QString & _name, - engine * _engine, class track * _track ) : + class track * _track ) : QSlider( _parent #ifndef QT4 , _name.ascii() @@ -56,7 +56,7 @@ automatableSlider::automatableSlider( QWidget * _parent, const QString & _name, ), m_show_status( FALSE ) { - m_knob = new knob( knobDark_28, NULL, _name, _engine, _track ); + m_knob = new knob( knobDark_28, NULL, _name, _track ); #ifdef QT4 setAccessibleName( _name ); diff --git a/src/widgets/combobox.cpp b/src/widgets/combobox.cpp index e51539021..6b602567d 100644 --- a/src/widgets/combobox.cpp +++ b/src/widgets/combobox.cpp @@ -3,7 +3,7 @@ /* * combobox.cpp - implementation of LMMS-combobox * - * Copyright (c) 2006 Tobias Doerffel + * Copyright (c) 2006-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -58,14 +58,13 @@ QPixmap * comboBox::s_arrow = NULL; const int CB_ARROW_BTN_WIDTH = 20; -comboBox::comboBox( QWidget * _parent, const QString & _name, engine * _engine, - track * _track ) : +comboBox::comboBox( QWidget * _parent, const QString & _name, track * _track ) : QWidget( _parent #ifndef QT4 , _name.ascii() #endif ), - automatableObject( _engine, _track ), + automatableObject( _track ), m_menu( this ), m_pressed( FALSE ) { diff --git a/src/widgets/cpuload_widget.cpp b/src/widgets/cpuload_widget.cpp index a99b7ce4e..133f1ba6f 100644 --- a/src/widgets/cpuload_widget.cpp +++ b/src/widgets/cpuload_widget.cpp @@ -4,7 +4,7 @@ * cpuload_widget.cpp - widget for displaying CPU-load (partly based on * Hydrogen's CPU-load-widget) * - * Copyright (c) 2005-2006 Tobias Doerffel + * Copyright (c) 2005-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -41,12 +41,12 @@ #include "cpuload_widget.h" #include "embed.h" +#include "engine.h" #include "mixer.h" -cpuloadWidget::cpuloadWidget( QWidget * _parent, engine * _engine ) : +cpuloadWidget::cpuloadWidget( QWidget * _parent ) : QWidget( _parent ), - engineObject( _engine ), m_currentLoad( 0 ), m_temp(), m_background( embed::getIconPixmap( "cpuload_bg" ) ), @@ -106,7 +106,7 @@ void cpuloadWidget::paintEvent( QPaintEvent * ) void cpuloadWidget::updateCpuLoad() { // smooth load-values a bit - Uint8 new_load = ( m_currentLoad + eng()->getMixer()->cpuLoad() ) / 2; + Uint8 new_load = ( m_currentLoad + engine::getMixer()->cpuLoad() ) / 2; if( new_load != m_currentLoad ) { m_currentLoad = new_load; diff --git a/src/widgets/effect_label.cpp b/src/widgets/effect_label.cpp index 8b76a69ab..6f5532863 100644 --- a/src/widgets/effect_label.cpp +++ b/src/widgets/effect_label.cpp @@ -4,7 +4,7 @@ * effect_label.cpp - a label which is renamable by double-clicking it and * offers access to an effect rack * - * Copyright (c) 2006 Danny McRae + * Copyright (c) 2006-2007 Danny McRae * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -38,12 +38,9 @@ #endif -effectLabel::effectLabel( const QString & _initial_name, - QWidget * _parent, - engine * _engine, - sampleTrack * _track ) : +effectLabel::effectLabel( const QString & _initial_name, QWidget * _parent, + sampleTrack * _track ) : QWidget( _parent ), - journallingObject( _engine ), m_track( _track ), m_show( TRUE ) { @@ -59,7 +56,7 @@ effectLabel::effectLabel( const QString & _initial_name, m_label->setFont( pointSize<8>( f ) ); m_label->setGeometry( 38, 1, 200, 28 ); - m_effWidget = new effectTabWidget( eng()->getMainWindow()->workspace(), + m_effWidget = new effectTabWidget( engine::getMainWindow()->workspace(), m_track, m_track->getAudioPort() ); m_effWidget->setFixedSize( 240, 242 ); diff --git a/src/widgets/group_box.cpp b/src/widgets/group_box.cpp index 0872bb409..a8804d231 100644 --- a/src/widgets/group_box.cpp +++ b/src/widgets/group_box.cpp @@ -3,7 +3,7 @@ /* * group_box.cpp - groupbox for LMMS * - * Copyright (c) 2005-2006 Tobias Doerffel + * Copyright (c) 2005-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -58,9 +58,8 @@ QPixmap * groupBox::s_ledBg = NULL; groupBox::groupBox( const QString & _caption, QWidget * _parent, - engine * _engine, track * _track ) : + track * _track ) : QWidget( _parent ), - engineObject( _engine ), m_caption( _caption ), m_origHeight( height() ), m_animating( FALSE ) @@ -77,7 +76,7 @@ groupBox::groupBox( const QString & _caption, QWidget * _parent, updatePixmap(); - m_led = new pixmapButton( this, _caption, eng(), _track ); + m_led = new pixmapButton( this, _caption, _track ); m_led->setCheckable( TRUE ); m_led->move( 2, 3 ); m_led->setActiveGraphic( embed::getIconPixmap( "led_green" ) ); diff --git a/src/widgets/knob.cpp b/src/widgets/knob.cpp index fe16a0500..75b5a94e9 100644 --- a/src/widgets/knob.cpp +++ b/src/widgets/knob.cpp @@ -86,13 +86,13 @@ textFloat * knob::s_textFloat = NULL; knob::knob( int _knob_num, QWidget * _parent, const QString & _name, - engine * _engine, track * _track ) : + track * _track ) : QWidget( _parent #ifndef QT4 , _name.ascii() #endif ), - autoObj( _engine, _track ), + autoObj( _track ), m_mouseOffset( 0.0f ), m_buttonPressed( FALSE ), m_hintTextBeforeValue( "" ), @@ -138,9 +138,9 @@ knob::~knob() { /* // make sure pointer to this knob isn't used anymore in active // midi-device-class - if( eng()->getMixer()->getMIDIClient()->pitchBendKnob() == this ) + if( engine::getMixer()->getMIDIClient()->pitchBendKnob() == this ) { - eng()->getMixer()->getMIDIClient()->setPitchBendKnob( NULL ); + engine::getMixer()->getMIDIClient()->setPitchBendKnob( NULL ); }*/ } @@ -289,7 +289,7 @@ float knob::getValue( const QPoint & _p ) } return( new_value ); } - if( eng()->getMainWindow()->isShiftPressed() ) + if( engine::getMainWindow()->isShiftPressed() ) { return( ( _p.y() - m_origMousePos.y() ) * step() ); } @@ -429,8 +429,8 @@ void knob::dropEvent( QDropEvent * _de ) void knob::mousePressEvent( QMouseEvent * _me ) { if( _me->button() == Qt::LeftButton && - eng()->getMainWindow()->isCtrlPressed() == FALSE && - eng()->getMainWindow()->isShiftPressed() == FALSE ) + engine::getMainWindow()->isCtrlPressed() == FALSE && + engine::getMainWindow()->isShiftPressed() == FALSE ) { prepareJournalEntryFromOldVal(); @@ -459,21 +459,21 @@ void knob::mousePressEvent( QMouseEvent * _me ) m_buttonPressed = TRUE; } else if( _me->button() == Qt::LeftButton && - eng()->getMainWindow()->isCtrlPressed() == TRUE/* && - eng()->getMainWindow()->isShiftPressed() == FALSE*/ ) + engine::getMainWindow()->isCtrlPressed() == TRUE/* && + engine::getMainWindow()->isShiftPressed() == FALSE*/ ) { new stringPairDrag( "float_value", QString::number( value() ), - QPixmap(), this, eng() ); + QPixmap(), this ); } else if( _me->button() == Qt::LeftButton && -/* eng()->getMainWindow()->isCtrlPressed() == TRUE &&*/ - eng()->getMainWindow()->isShiftPressed() == TRUE ) +/* engine::getMainWindow()->isCtrlPressed() == TRUE &&*/ + engine::getMainWindow()->isShiftPressed() == TRUE ) { /* this pointer was casted to uint, * compile time error on 64 bit systems */ new stringPairDrag( "link_object", QString::number( (ulong) this ), - QPixmap(), this, eng() ); + QPixmap(), this ); } else if( _me->button() == Qt::MidButton ) { @@ -734,7 +734,7 @@ void knob::enterValue( void ) void knob::connectToMidiDevice( void ) { - //eng()->getMixer()->getMIDIDevice()->setPitchBendKnob( this ); + //engine::getMixer()->getMIDIDevice()->setPitchBendKnob( this ); } diff --git a/src/widgets/lcd_spinbox.cpp b/src/widgets/lcd_spinbox.cpp index 78aa2259e..85ddcafd8 100644 --- a/src/widgets/lcd_spinbox.cpp +++ b/src/widgets/lcd_spinbox.cpp @@ -3,7 +3,7 @@ /* * lcd_spinbox.cpp - class lcdSpinBox, an improved QLCDNumber * - * Copyright (c) 2005-2006 Tobias Doerffel + * Copyright (c) 2005-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -52,14 +52,14 @@ lcdSpinBox::lcdSpinBox( int _min, int _max, int _num_digits, QWidget * _parent, - const QString & _name, - engine * _engine, track * _track ) : + const QString & _name, + track * _track ) : QWidget( _parent #ifndef QT4 , _name.ascii() #endif ), - autoObj( _engine, _track, 0, _min, _max ), + autoObj( _track, 0, _min, _max ), m_label( NULL ), m_origMousePos() { diff --git a/src/widgets/led_checkbox.cpp b/src/widgets/led_checkbox.cpp index 14ca5c888..8fb2a9565 100644 --- a/src/widgets/led_checkbox.cpp +++ b/src/widgets/led_checkbox.cpp @@ -3,7 +3,7 @@ /* * led_checkbox.cpp - class ledCheckBox, an improved QCheckBox * - * Copyright (c) 2005-2006 Tobias Doerffel + * Copyright (c) 2005-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -55,10 +55,9 @@ static const QString names[ledCheckBox::TOTAL_COLORS] = ledCheckBox::ledCheckBox( const QString & _text, QWidget * _parent, - const QString & _name, - engine * _engine, track * _track, + const QString & _name, track * _track, ledColors _color ) : - automatableButton( _parent, _name, _engine, _track ), + automatableButton( _parent, _name, _track ), m_text( _text ) { setCheckable( TRUE ); diff --git a/src/widgets/pixmap_button.cpp b/src/widgets/pixmap_button.cpp index af7538aa2..0979e8b39 100644 --- a/src/widgets/pixmap_button.cpp +++ b/src/widgets/pixmap_button.cpp @@ -4,7 +4,7 @@ * pixmap_button.cpp - implementation of pixmap-button (often used as "themed" * checkboxes/radiobuttons etc) * - * Copyright (c) 2004-2006 Tobias Doerffel + * Copyright (c) 2004-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -46,8 +46,8 @@ pixmapButton::pixmapButton( QWidget * _parent, const QString & _name, - engine * _engine, track * _track ) : - automatableButton( _parent, _name, _engine, _track ), + track * _track ) : + automatableButton( _parent, _name, _track ), m_activePixmap(), m_inactivePixmap(), m_bgPixmap() diff --git a/src/widgets/project_notes.cpp b/src/widgets/project_notes.cpp index 70023a702..c545576f1 100644 --- a/src/widgets/project_notes.cpp +++ b/src/widgets/project_notes.cpp @@ -3,7 +3,7 @@ /* * project_notes.cpp - implementation of project-notes-editor * - * Copyright (c) 2005-2006 Tobias Doerffel + * Copyright (c) 2005-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -68,21 +68,21 @@ #include "project_notes.h" #include "embed.h" +#include "engine.h" #include "main_window.h" #include "song_editor.h" -projectNotes::projectNotes( engine * _engine ) : - QMainWindow( _engine->getMainWindow()->workspace() +projectNotes::projectNotes( void ) : + QMainWindow( engine::getMainWindow()->workspace() #ifndef QT4 , 0, Qt::WStyle_Title #endif - ), - journallingObject( _engine ) + ) { #ifdef QT4 - eng()->getMainWindow()->workspace()->addWindow( this ); + engine::getMainWindow()->workspace()->addWindow( this ); #endif m_edit = new QTextEdit( this ); @@ -104,7 +104,7 @@ projectNotes::projectNotes( engine * _engine ) : connect( m_edit, SIGNAL( currentAlignmentChanged( int ) ), this, SLOT( alignmentChanged( int ) ) ); connect( m_edit, SIGNAL( textChanged() ), - eng()->getSongEditor(), SLOT( setModified() ) ); + engine::getSongEditor(), SLOT( setModified() ) ); setupActions(); @@ -115,7 +115,7 @@ projectNotes::projectNotes( engine * _engine ) : resize( 300, 200 ); QWidget * w = ( parentWidget() != NULL ) ? parentWidget() : this; - if( eng()->getMainWindow()->workspace() != NULL ) + if( engine::getMainWindow()->workspace() != NULL ) { w->move( 700, 10 ); } @@ -438,7 +438,7 @@ void projectNotes::setupActions() void projectNotes::textBold() { m_edit->setFontWeight( m_actionTextBold->isChecked() ); - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); } @@ -447,7 +447,7 @@ void projectNotes::textBold() void projectNotes::textUnderline() { m_edit->setFontUnderline( m_actionTextUnderline->isChecked() ); - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); } @@ -456,7 +456,7 @@ void projectNotes::textUnderline() void projectNotes::textItalic() { m_edit->setFontItalic( m_actionTextItalic->isChecked() ); - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); } @@ -466,7 +466,7 @@ void projectNotes::textFamily( const QString & _f ) { m_edit->setFontFamily( _f ); m_edit->viewport()->setFocus(); - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); } @@ -476,7 +476,7 @@ void projectNotes::textSize( const QString & _p ) { m_edit->setFontPointSize( _p.toInt() ); m_edit->viewport()->setFocus(); - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); } @@ -532,7 +532,7 @@ void projectNotes::fontChanged( const QFont & _f ) m_actionTextBold->setChecked( _f.bold() ); m_actionTextItalic->setChecked( _f.italic() ); m_actionTextUnderline->setChecked( _f.underline() ); - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); } @@ -547,7 +547,7 @@ void projectNotes::colorChanged( const QColor & _c ) #else m_actionTextColor->setIconSet( pix ); #endif - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); } @@ -575,7 +575,7 @@ void projectNotes::alignmentChanged( int _a ) { m_actionAlignJustify->setChecked( TRUE ); } - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); } diff --git a/src/widgets/rack_plugin.cpp b/src/widgets/rack_plugin.cpp index ad19bca03..cfdd239fa 100644 --- a/src/widgets/rack_plugin.cpp +++ b/src/widgets/rack_plugin.cpp @@ -4,7 +4,7 @@ * effect_tab_widget.cpp - tab-widget in channel-track-window for setting up * effects * - * Copyright (c) 2006 Danny McRae + * Copyright (c) 2006-2007 Danny McRae * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -68,7 +68,6 @@ rackPlugin::rackPlugin( QWidget * _parent, track * _track, audioPort * _port ) : QWidget( _parent ), - journallingObject( _track->eng() ), m_effect( _eff ), m_track( _track ), m_port( _port ), @@ -90,7 +89,7 @@ rackPlugin::rackPlugin( QWidget * _parent, #endif m_bypass = new ledCheckBox( "", this, tr( "Turn the effect off" ), - eng(), m_track ); + m_track ); connect( m_bypass, SIGNAL( toggled( bool ) ), this, SLOT( bypassed( bool ) ) ); toolTip::add( m_bypass, tr( "On/Off" ) ); @@ -104,8 +103,8 @@ rackPlugin::rackPlugin( QWidget * _parent, tr( "Toggles the effect on or off." ) ); - m_wetDry = new knob( knobBright_26, this, - tr( "Wet/Dry mix" ), eng(), m_track ); + m_wetDry = new knob( knobBright_26, this, tr( "Wet/Dry mix" ), + m_track ); connect( m_wetDry, SIGNAL( valueChanged( float ) ), this, SLOT( setWetDry( float ) ) ); m_wetDry->setLabel( tr( "W/D" ) ); @@ -123,7 +122,7 @@ rackPlugin::rackPlugin( QWidget * _parent, "shows up in the output." ) ); m_autoQuit = new tempoSyncKnob( knobBright_26, this, tr( "Decay" ), - eng(), m_track ); + m_track ); connect( m_autoQuit, SIGNAL( valueChanged( float ) ), this, SLOT( setAutoQuit( float ) ) ); m_autoQuit->setLabel( tr( "Decay" ) ); @@ -141,7 +140,7 @@ rackPlugin::rackPlugin( QWidget * _parent, "plugin stops processing. Smaller values will reduce the CPU overhead but " "run the risk of clipping the tail on delay effects." ) ); - m_gate = new knob( knobBright_26, this, tr( "Gate" ), eng(), m_track ); + m_gate = new knob( knobBright_26, this, tr( "Gate" ), m_track ); connect( m_wetDry, SIGNAL( valueChanged( float ) ), this, SLOT( setGate( float ) ) ); m_gate->setLabel( tr( "Gate" ) ); @@ -183,10 +182,10 @@ rackPlugin::rackPlugin( QWidget * _parent, #endif m_controlView = m_effect->createControlDialog( m_track ); -/* eng()->getMainWindow()->workspace(), +/* engine::getMainWindow()->workspace(), new ControlDialog( - eng()->getMainWindow()->workspace(), - m_effect, eng(), m_track );*/ + engine::getMainWindow()->workspace(), + m_effect, m_track );*/ connect( m_controlView, SIGNAL( closed() ), this, SLOT( closeEffects() ) ); m_controlView->hide(); @@ -276,9 +275,9 @@ void rackPlugin::setWetDry( float _value ) void rackPlugin::setAutoQuit( float _value ) { - float samples = eng()->getMixer()->sampleRate() * _value / 1000.0f; + float samples = engine::getMixer()->sampleRate() * _value / 1000.0f; Uint32 buffers = 1 + ( static_cast( samples ) / - eng()->getMixer()->framesPerAudioBuffer() ); + engine::getMixer()->framesPerAudioBuffer() ); m_effect->setTimeout( buffers ); } diff --git a/src/widgets/rack_view.cpp b/src/widgets/rack_view.cpp index 48d8cca33..8719d2859 100644 --- a/src/widgets/rack_view.cpp +++ b/src/widgets/rack_view.cpp @@ -3,7 +3,7 @@ /* * rack_view.cpp - provides the display for the rackInsert instances * - * Copyright (c) 2006 Danny McRae + * Copyright (c) 2006-2007 Danny McRae * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -39,12 +39,8 @@ #include "rack_view.h" -rackView::rackView( QWidget * _parent, - engine * _engine, - track * _track, - audioPort * _port ): +rackView::rackView( QWidget * _parent, track * _track, audioPort * _port ) : QWidget( _parent ), - journallingObject( _engine ), m_track( _track ), m_port( _port ) { @@ -250,15 +246,11 @@ void FASTCALL rackView::loadSettings( const QDomElement & _this ) { QDomElement cn = node.toElement(); const QString name = cn.attribute( "name" ); - effect::constructionData cd = - { - eng(), - // we have this really convenient key-ctor - // which takes a QString and decodes the - // base64-data inside :-) - effectKey( cn.attribute( "key" ) ) - } ; - addEffect(effect::instantiate( name, cd ) ); + // we have this really convenient key-ctor + // which takes a QString and decodes the + // base64-data inside :-) + effectKey key( cn.attribute( "key" ) ); + addEffect( effect::instantiate( name, &key ) ); // TODO: somehow detect if effect is sub-plugin-capable // but couldn't load sub-plugin with requsted key if( node.isElement() ) diff --git a/src/widgets/tempo_sync_knob.cpp b/src/widgets/tempo_sync_knob.cpp index e94c141f7..c6ccd1041 100644 --- a/src/widgets/tempo_sync_knob.cpp +++ b/src/widgets/tempo_sync_knob.cpp @@ -3,8 +3,8 @@ /* * tempo_sync_knob.cpp - adds bpm to ms conversion for knob class * - * Copyright (c) 2005 Danny McRae - * Copyright (c) 2005-2006 Tobias Doerffel + * Copyright (c) 2005-2007 Danny McRae + * Copyright (c) 2005-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -53,19 +53,19 @@ tempoSyncKnob::tempoSyncKnob( int _knob_num, QWidget * _parent, - const QString & _name, - engine * _engine, track * _track, - float _scale ) : - knob( _knob_num, _parent, _name, _engine, _track ), + const QString & _name, + track * _track, + float _scale ) : + knob( _knob_num, _parent, _name, _track ), m_tempoSyncMode( NO_SYNC ), m_scale( _scale ), m_tempoSyncIcon( embed::getIconPixmap( "tempo_sync" ) ), m_tempoSyncDescription( tr( "Tempo Sync" ) ), m_tempoLastSyncMode( NO_SYNC ) { - connect( eng()->getSongEditor(), SIGNAL( tempoChanged( bpm_t ) ), + connect( engine::getSongEditor(), SIGNAL( tempoChanged( bpm_t ) ), this, SLOT( calculateTempoSyncTime( bpm_t ) ) ); - m_custom = new meterDialog( eng()->getMainWindow()->workspace(), + m_custom = new meterDialog( engine::getMainWindow()->workspace(), _track ); m_custom->hide(); m_custom->setWindowTitle( "Meter" ); @@ -110,7 +110,7 @@ void tempoSyncKnob::contextMenuEvent( QContextMenuEvent * ) this, SLOT( pasteValue() ) ); contextMenu.addSeparator(); - float limit = 60000.0f / ( eng()->getSongEditor()->getTempo() * + float limit = 60000.0f / ( engine::getSongEditor()->getTempo() * m_scale ); #ifdef QT4 @@ -261,7 +261,7 @@ void tempoSyncKnob::contextMenuEvent( QContextMenuEvent * ) void tempoSyncKnob::mouseMoveEvent( QMouseEvent * _me ) { m_tempoSyncMode = NO_SYNC; - calculateTempoSyncTime( eng()->getSongEditor()->getTempo() ); + calculateTempoSyncTime( engine::getSongEditor()->getTempo() ); knob::mouseMoveEvent( _me ); } @@ -272,7 +272,7 @@ void tempoSyncKnob::wheelEvent( QWheelEvent * _we ) { knob::wheelEvent( _we ); m_tempoSyncMode = NO_SYNC; - calculateTempoSyncTime( eng()->getSongEditor()->getTempo() ); + calculateTempoSyncTime( engine::getSongEditor()->getTempo() ); } @@ -295,7 +295,7 @@ void tempoSyncKnob::setTempoSync( QAction * ) { } void tempoSyncKnob::setTempoSync( int _note_type ) { setSyncMode( ( tempoSyncMode ) _note_type ); - eng()->getSongEditor()->setModified(); + engine::getSongEditor()->setModified(); } @@ -473,7 +473,7 @@ void tempoSyncKnob::setSyncMode( tempoSyncMode _new_mode ) this, SLOT( updateCustom( int ) ) ); } } - calculateTempoSyncTime( eng()->getSongEditor()->getTempo() ); + calculateTempoSyncTime( engine::getSongEditor()->getTempo() ); } @@ -490,7 +490,7 @@ float tempoSyncKnob::getScale( void ) void tempoSyncKnob::setScale( float _new_scale ) { m_scale = _new_scale; - calculateTempoSyncTime( eng()->getSongEditor()->getTempo() ); + calculateTempoSyncTime( engine::getSongEditor()->getTempo() ); emit scaleChanged( _new_scale ); } diff --git a/src/widgets/visualization_widget.cpp b/src/widgets/visualization_widget.cpp index a933ef6e0..d5fb9f8f8 100644 --- a/src/widgets/visualization_widget.cpp +++ b/src/widgets/visualization_widget.cpp @@ -3,7 +3,7 @@ /* * visualization_widget.cpp - widget for visualization of sound-data * - * Copyright (c) 2005-2006 Tobias Doerffel + * Copyright (c) 2005-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -45,6 +45,7 @@ #include "visualization_widget.h" #include "embed.h" +#include "engine.h" #include "buffer_allocator.h" #include "templates.h" #include "tooltip.h" @@ -55,10 +56,8 @@ const int UPDATE_TIME = 1000 / 20; // 20 fps visualizationWidget::visualizationWidget( const QPixmap & _bg, QWidget * _p, - engine * _engine, visualizationTypes _vtype ) : QWidget( _p ), - engineObject( _engine ), s_background( _bg ), m_enabled( TRUE ) { @@ -68,10 +67,10 @@ visualizationWidget::visualizationWidget( const QPixmap & _bg, QWidget * _p, setFixedSize( s_background.width(), s_background.height() ); - const fpab_t frames = eng()->getMixer()->framesPerAudioBuffer(); + const fpab_t frames = engine::getMixer()->framesPerAudioBuffer(); m_buffer = bufferAllocator::alloc( frames ); - eng()->getMixer()->clearAudioBuffer( m_buffer, frames ); + engine::getMixer()->clearAudioBuffer( m_buffer, frames ); m_updateTimer = new QTimer( this ); @@ -81,7 +80,7 @@ visualizationWidget::visualizationWidget( const QPixmap & _bg, QWidget * _p, m_updateTimer->start( UPDATE_TIME ); } - connect( eng()->getMixer(), SIGNAL( nextAudioBuffer( + connect( engine::getMixer(), SIGNAL( nextAudioBuffer( const surroundSampleFrame *, int ) ), this, SLOT( setAudioBuffer( const surroundSampleFrame *, int ) ) ); @@ -125,7 +124,7 @@ void visualizationWidget::paintEvent( QPaintEvent * ) if( m_enabled == TRUE ) { - float master_output = eng()->getMixer()->masterGain(); + float master_output = engine::getMixer()->masterGain(); Uint16 w = width()-4; float half_h = -( height() - 6 ) / 3.0 * master_output - 1; Uint16 x_base = 2; @@ -140,7 +139,8 @@ void visualizationWidget::paintEvent( QPaintEvent * ) float max_level = 0.0; - const fpab_t frames = eng()->getMixer()->framesPerAudioBuffer(); + const fpab_t frames = + engine::getMixer()->framesPerAudioBuffer(); // analyse wave-stream for max-level for( fpab_t frame = 0; frame < frames; ++frame ) diff --git a/src/widgets/volume_knob.cpp b/src/widgets/volume_knob.cpp index 5ffcd6dc0..f49dc2f02 100644 --- a/src/widgets/volume_knob.cpp +++ b/src/widgets/volume_knob.cpp @@ -4,7 +4,7 @@ * volume_knob.cpp - defines a knob that display it's value as either a * percentage or in dbV. * - * Copyright (c) 2006 Danny McRae + * Copyright (c) 2006-2007 Danny McRae * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -49,8 +49,8 @@ volumeKnob::volumeKnob( int _knob_num, QWidget * _parent, const QString & _name, - engine * _engine, track * _track ) : - knob( _knob_num, _parent, _name, _engine, _track ) + track * _track ) : + knob( _knob_num, _parent, _name, _track ) { } @@ -68,7 +68,7 @@ volumeKnob::~volumeKnob() void volumeKnob::mousePressEvent( QMouseEvent * _me ) { if( _me->button() == Qt::LeftButton && - eng()->getMainWindow()->isCtrlPressed() == FALSE ) + engine::getMainWindow()->isCtrlPressed() == FALSE ) { prepareJournalEntryFromOldVal(); @@ -108,10 +108,10 @@ void volumeKnob::mousePressEvent( QMouseEvent * _me ) m_buttonPressed = TRUE; } else if( _me->button() == Qt::LeftButton && - eng()->getMainWindow()->isCtrlPressed() == TRUE ) + engine::getMainWindow()->isCtrlPressed() == TRUE ) { new stringPairDrag( "float_value", QString::number( value() ), - QPixmap(), this, eng() ); + QPixmap(), this ); } else if( _me->button() == Qt::MidButton ) {