⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.cpp

📁 LINUX下的混音软件
💻 CPP
📖 第 1 页 / 共 3 页
字号:
// -*- c-basic-offset: 4 -*-/*    Rosegarden    A sequencer and musical notation editor.     This program is Copyright 2000-2007        Guillaume Laurent   <glaurent@telegraph-road.org>,        Chris Cannam        <cannam@all-day-breakfast.com>,        Richard Bown        <bownie@bownie.com>     The moral right of the authors to claim authorship of this work    has been asserted.     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.  See the file    COPYING included with this distribution for more information.*/#include <qtimer.h>#include <kapplication.h>#include <sys/time.h>#include "base/RealTime.h"#include <kcmdlineargs.h>#include <kaboutdata.h>#include <klocale.h>#include <dcopclient.h>#include <kconfig.h>#include <kmessagebox.h>#include <kstddirs.h>#include <ktip.h>#include <kprocess.h>#include <kglobalsettings.h>#include "document/ConfigGroups.h"#include "misc/Strings.h"#include "misc/Debug.h"#include "gui/application/RosegardenGUIApp.h"#include "document/RosegardenGUIDoc.h"#include "gui/kdeext/KStartupLogo.h"#include "gui/application/RosegardenApplication.h"#include "gui/application/RosegardenDCOP.h"#include "gui/kdeext/klearlook.h"using namespace Rosegarden;/*! \mainpage Rosegarden global design Rosegarden is split into 3 main parts: \section base Base The base library holds all of the fundamental "music handling"structures, of which the primary ones are Event, Segment, Track,Instrument and Composition.  It also contains a selection of utilityand helper classes of a kind that is not specific to any particularGUI.  Everything here is part of the Rosegarden namespace, and thereare no dependencies on KDE or Qt (although it uses the STL heavily). The keyword for the basic structures in use is "flexibility".  OurEvent objects can be extended arbitrarily for the convenience of GUIor performance code without having to change their declaration ormodify anything in the base library.  And most of our assumptionsabout the use of the container classes can be violated withoutdisastrous side-effects. \subsection musicstructs Music Structures  - \link Event Event\endlink is the basic musical element.  It's more or less a    generalization of the MIDI event.  Each note or rest, each key    change or tempo change, is an event: there's no "note class" or    "rest class" as such, they are simply represented by events whose    type happens to be "note" or "rest".    Each Event has a type code, absolute time (the moment at which the    Event starts, relative only to the start of the Composition) and    duration (usually non-zero only for notes and rests), together    with an arbitrary set of named and typed properties that can be    assigned and queried dynamically by other parts of the    application.  So, for example, a note event is likely to have an    integer property called "pitch", and probably a "velocity", as    well as potentially many others -- but this is not fixed anywhere,    and there's no definition of what exactly a note is: client code    is simply expected to ignore any unrecognised events or properties    and to cope if properties that should be there are not.  - \link Segment Segment\endlink is a series of consecutive Events found on the same Track,    automatically ordered by their absolute time.  It's the usual    container for Events.  A Segment has a starting time that can be    changed, and a duration that is based solely on the end time of    the last Event it contains.  Note that in order to facilitate    musical notation editing, we explicitly store silences as series    of rest Events; thus a Segment really should contain no gaps    between its Events.  (This isn't checked anywhere and nothing will    break very badly if there are gaps, but notation won't quite work    correctly.)  - \link Track Track \endlink is much the same thing as on a mixing table, usually    assigned to an instrument, a voice, etc.  Although a Track is not    a container of Events and is not strictly a container of Segments    either, it is referred to by a set of Segments that are therefore    mutually associated with the same instruments and parameters.  In    GUI terms, the Track is a horizontal row on the main Rosegarden    window, whereas a Segment is a single blue box within that row, of    which there may be any number.  - \link Instrument Instrument \endlink corresponds broadly to a MIDI or Audio channel, and is    the destination for a performed Event.  Each Track is mapped to a    single Instrument (although many Tracks may have the same    Instrument), and the Instrument is indicated in the header at the    left of the Track's row in the GUI.  - \link Composition Composition\endlink is the container for the entire piece of music.  It    consists of a set of Segments, together with a set of Tracks that    the Segments may or may not be associated with, a set of    Instruments, and some information about time signature and tempo    changes.  (The latter are not stored in Segments; they are only    stored in the top-level Composition.  You can't have differing    time signatures or tempos in different Segments.)  Any code that    wants to know about the locations of bar lines, or request    real-time calculations based on tempo changes, talks to the    Composition.  See also docs/data_struct/units.txt for an explanation of the units weuse for time and pitch values.  See docs/discussion/names.txt for somename-related discussion.  See docs/code/creating_events.txt for anexplanation of how to create new Events and add properties to them. The base directory also contains various music-related helper classes:  - The NotationTypes.[Ch] files contain classes that help with    creating and manipulating events.  It's very important to realise    that these classes are not the events themselves: although there    is a Note class in this file, and a TimeSignature class, and Clef    and Key classes, instances of these are rarely stored anywhere.    Instead they're created on-the-fly in order to do calculation    related to note durations or time signatures or whatever, and they    contain getAsEvent() methods that may be used when an event for    storage is required.  But the class of a stored event is always    simply Event.     The NotationTypes classes also define important constants for the    names of common properties in Events.  For example, the Note class    contains Note::EventType, which is the type of a note Event, and    Note::EventRestType, the type of a rest Event; and Key contains    Key::EventType, the type of a key change Event, KeyPropertyName,    the name of the property that defines the key change, and a set    of the valid strings for key changes.  - BaseProperties.[Ch] contains a set of "standard"-ish Event    property names that are not basic enough to go in NotationTypes.  - \link SegmentNotationHelper SegmentNotationHelper\endlink    and \link SegmentPerformanceHelper SegmentPerformanceHelper\endlink    do tasks that    may be useful to notation-type code and performer code    respectively.  For example, SegmentNotationHelper is used to    manage rests when inserting and deleting notes in a score editor,    and to create beamed groups and suchlike; SegmentPerformanceHelper    generally does calculations involving real performance time of    notes (taking into account tied notes, tuplets and tempo changes).    These two lightweight helper classes are also usually constructed    on-the-fly for use on the events in a given Segment and then    discarded after use.  - \link Quantizer Quantizer\endlink is used to quantize event timings and set quantized    timing properties on those events.  Note that quantization is    non-destructive, as it takes advantage of the ability to set new    Event properties to simply assign the quantized values as separate    properties from the original absolute time and duration.  \section gui GUI The GUI directory builds into a KDE/Qt application. Like most KDEapplications, it follows a document/view model. The document (classRosegardenGUIDoc, which wraps a Composition) can have several views(class RosegardenGUIView), although at the moment only a single one isused. This view is the TrackEditor, which shows all the Composition'sSegments organized in Tracks. Each Segment can be edited in two ways:notation (score) or matrix (piano roll). All editor views are derived from EditView. An EditView is the classdealing with the edition per se of the events. It uses severalcomponents:  - Layout classes, horizontal and vertical: these are the classes    which determine the x and y coordinates of the graphic items    representing the events (notes or piano-roll rectangles).  They    are derived from the LayoutEngine base-class in the base library.  - Tools, which implement each editing function at the GUI (such as    insert, erase, cut and paste). These are the tools which appear on    the EditView's toolbar.  - Toolbox, which is a simple string => tool map.  - Commands, which are the fundamental implementations of editing    operations (both menu functions and tool operations) subclassed    from KDE's Command and used for undo and redo.  - a canvas view.  Although this isn't a part of the EditView's    definition, both of the existing edit views (notation and matrix)    use one, because they both use a QCanvas to represent data.  - LinedStaff, a staff with lines.  Like the canvas view, this isn't    part of the EditView definition, but both views use one.  There are currently two editor views:  - NotationView, with accompanying classes NotationHLayout,    NotationVLayout, NotationStaff, and all the classes in the    notationtool and notationcommands files.  These are also closely    associated with the NotePixmapFactory and NoteFont classes, which    are used to generate notes from component pixmap files.  - MatrixView, with accompanying classes MatrixHLayout,    MatrixVLayout, MatrixStaff and other classes in the matrixview    files. The editing process works as follows: [NOTE : in the following, we're talking both about events as UI eventsor user events (mouse button clicks, mouse move, keystrokes, etc...)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -