2006-01-16 22:02:54 +01:00
|
|
|
// Copyright (c) 2005, Rodrigo Braz Monteiro
|
2010-12-08 04:36:10 +01:00
|
|
|
// Copyright (c) 2009-2010, Niels Martin Hansen
|
2006-01-16 22:02:54 +01:00
|
|
|
// All rights reserved.
|
|
|
|
//
|
|
|
|
// Redistribution and use in source and binary forms, with or without
|
|
|
|
// modification, are permitted provided that the following conditions are met:
|
|
|
|
//
|
|
|
|
// * Redistributions of source code must retain the above copyright notice,
|
|
|
|
// this list of conditions and the following disclaimer.
|
|
|
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
// this list of conditions and the following disclaimer in the documentation
|
|
|
|
// and/or other materials provided with the distribution.
|
|
|
|
// * Neither the name of the Aegisub Group nor the names of its contributors
|
|
|
|
// may be used to endorse or promote products derived from this software
|
|
|
|
// without specific prior written permission.
|
|
|
|
//
|
|
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
|
|
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
// POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
//
|
2009-07-29 07:43:02 +02:00
|
|
|
// Aegisub Project http://www.aegisub.org/
|
|
|
|
|
|
|
|
/// @file audio_display.h
|
|
|
|
/// @see audio_display.cpp
|
|
|
|
/// @ingroup audio_ui
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2013-06-08 06:19:40 +02:00
|
|
|
#include <cstdint>
|
2012-11-28 16:28:18 +01:00
|
|
|
#include <deque>
|
2012-11-19 06:10:36 +01:00
|
|
|
#include <map>
|
2013-06-08 06:19:40 +02:00
|
|
|
#include <memory>
|
2009-09-11 04:36:34 +02:00
|
|
|
|
2011-07-30 01:16:55 +02:00
|
|
|
#include <wx/gdicmn.h>
|
|
|
|
#include <wx/string.h>
|
2012-05-01 04:50:03 +02:00
|
|
|
#include <wx/timer.h>
|
2009-09-11 04:36:34 +02:00
|
|
|
#include <wx/window.h>
|
|
|
|
|
2010-12-31 22:02:42 +01:00
|
|
|
#include <libaegisub/signal.h>
|
2010-12-08 04:36:10 +01:00
|
|
|
|
2011-07-30 01:16:55 +02:00
|
|
|
namespace agi { struct Context; }
|
2010-12-08 04:36:10 +01:00
|
|
|
|
2012-02-02 00:59:12 +01:00
|
|
|
class AudioController;
|
2010-12-08 04:36:10 +01:00
|
|
|
class AudioRenderer;
|
2011-09-15 07:16:18 +02:00
|
|
|
class AudioRendererBitmapProvider;
|
2010-08-03 00:14:11 +02:00
|
|
|
class AudioKaraoke;
|
2010-08-02 08:31:38 +02:00
|
|
|
class AudioProvider;
|
2012-02-02 00:59:12 +01:00
|
|
|
class TimeRange;
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2010-12-08 04:36:10 +01:00
|
|
|
// Helper classes used in implementation of the audio display
|
|
|
|
class AudioDisplayScrollbar;
|
|
|
|
class AudioDisplayTimeline;
|
|
|
|
class AudioDisplaySelection;
|
2011-12-28 22:26:48 +01:00
|
|
|
class AudioMarkerInteractionObject;
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2010-12-08 04:36:10 +01:00
|
|
|
/// @class AudioDisplayInteractionObject
|
|
|
|
/// @brief Interface for objects on the audio display that can respond to mouse events
|
|
|
|
class AudioDisplayInteractionObject {
|
|
|
|
public:
|
|
|
|
/// @brief The user is interacting with the object using the mouse
|
|
|
|
/// @param event Mouse event data
|
|
|
|
/// @return True to take mouse capture, false to release mouse capture
|
|
|
|
///
|
|
|
|
/// Assuming no object has the mouse capture, the audio display uses other methods
|
2010-12-08 09:09:05 +01:00
|
|
|
/// in the object implementing this interface to determine whether a mouse event
|
2010-12-08 04:36:10 +01:00
|
|
|
/// should go to the object. If the mouse event goes to the object, this method
|
|
|
|
/// is called.
|
|
|
|
///
|
|
|
|
/// If this method returns true, the audio display takes the mouse capture and
|
|
|
|
/// stores a pointer to the AudioDisplayInteractionObject interface for the object
|
|
|
|
/// and redirects the next mouse event to that object.
|
|
|
|
///
|
|
|
|
/// If the object that has the mouse capture returns false from this method, the
|
|
|
|
/// capture is released and regular processing is done for the next event.
|
|
|
|
///
|
|
|
|
/// If the object does not have mouse capture and returns false from this method,
|
|
|
|
/// no capture is taken or released and regular processing is done for the next
|
|
|
|
/// mouse event.
|
|
|
|
virtual bool OnMouseEvent(wxMouseEvent &event) = 0;
|
|
|
|
|
|
|
|
/// @brief Destructor
|
|
|
|
///
|
|
|
|
/// Empty virtual destructor for the cases that need it.
|
|
|
|
virtual ~AudioDisplayInteractionObject() { }
|
|
|
|
};
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
|
2010-12-08 04:36:10 +01:00
|
|
|
/// @class AudioDisplay
|
|
|
|
/// @brief Primary view/UI for interaction with audio timing
|
|
|
|
///
|
|
|
|
/// The audio display is the common view that allows the user to interact with the active
|
|
|
|
/// timing controller. The audio display also renders audio according to the audio controller
|
|
|
|
/// and the timing controller, using an audio renderer instance.
|
2010-12-08 09:09:16 +01:00
|
|
|
class AudioDisplay: public wxWindow {
|
2011-11-18 23:57:54 +01:00
|
|
|
agi::signal::Connection audio_open_connection;
|
2011-11-18 23:56:45 +01:00
|
|
|
|
2012-11-28 16:28:18 +01:00
|
|
|
std::deque<agi::signal::Connection> connections;
|
2011-07-30 01:16:55 +02:00
|
|
|
agi::Context *context;
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2010-12-08 04:36:10 +01:00
|
|
|
/// The audio renderer manager
|
2013-06-08 06:19:40 +02:00
|
|
|
std::unique_ptr<AudioRenderer> audio_renderer;
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2011-09-15 07:16:18 +02:00
|
|
|
/// The current audio renderer
|
2013-06-08 06:19:40 +02:00
|
|
|
std::unique_ptr<AudioRendererBitmapProvider> audio_renderer_provider;
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2010-12-08 04:36:10 +01:00
|
|
|
/// The controller managing us
|
|
|
|
AudioController *controller;
|
2008-11-14 02:21:17 +01:00
|
|
|
|
2010-12-08 04:36:10 +01:00
|
|
|
/// Scrollbar helper object
|
2013-06-08 06:19:40 +02:00
|
|
|
std::unique_ptr<AudioDisplayScrollbar> scrollbar;
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2010-12-08 04:36:10 +01:00
|
|
|
/// Timeline helper object
|
2013-06-08 06:19:40 +02:00
|
|
|
std::unique_ptr<AudioDisplayTimeline> timeline;
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2011-12-28 22:26:48 +01:00
|
|
|
/// The interaction object for the last-dragged audio marker
|
2013-06-08 06:19:40 +02:00
|
|
|
std::unique_ptr<AudioMarkerInteractionObject> audio_marker;
|
2011-12-28 22:26:48 +01:00
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2010-12-08 04:36:10 +01:00
|
|
|
/// Current object on display being dragged, if any
|
2013-12-12 01:29:48 +01:00
|
|
|
AudioDisplayInteractionObject *dragged_object = nullptr;
|
2010-12-08 04:36:10 +01:00
|
|
|
/// Change the dragged object and update mouse capture
|
|
|
|
void SetDraggedObject(AudioDisplayInteractionObject *new_obj);
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
|
2012-05-01 04:50:03 +02:00
|
|
|
/// Timer for scrolling when markers are dragged out of the displayed area
|
|
|
|
wxTimer scroll_timer;
|
|
|
|
|
2010-12-08 09:09:11 +01:00
|
|
|
/// Leftmost pixel in the virtual audio image being displayed
|
2013-12-12 01:29:48 +01:00
|
|
|
int scroll_left = 0;
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2010-12-08 04:36:10 +01:00
|
|
|
/// Total width of the audio in pixels
|
2013-12-12 01:29:48 +01:00
|
|
|
int pixel_audio_width = 0;
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2012-02-02 00:58:58 +01:00
|
|
|
/// Horizontal zoom measured in millisecond per pixels
|
2013-12-12 01:29:48 +01:00
|
|
|
double ms_per_pixel = 0.;
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2010-12-08 04:36:10 +01:00
|
|
|
/// Amplitude scaling ("vertical zoom") as a factor, 1.0 is neutral
|
2013-12-12 01:29:48 +01:00
|
|
|
float scale_amplitude = 1.f;
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2010-12-08 04:36:10 +01:00
|
|
|
/// Top of the main audio area in pixels
|
2013-12-12 01:29:48 +01:00
|
|
|
int audio_top = 0;
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2010-12-08 04:36:10 +01:00
|
|
|
/// Height of main audio area in pixels
|
2013-12-12 01:29:48 +01:00
|
|
|
int audio_height = 0;
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2011-11-18 23:56:45 +01:00
|
|
|
/// Width of the audio marker feet in pixels
|
|
|
|
static const int foot_size = 6;
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2010-12-08 04:36:10 +01:00
|
|
|
/// Zoom level given as a number, see SetZoomLevel for details
|
|
|
|
int zoom_level;
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2010-12-08 04:36:10 +01:00
|
|
|
/// Absolute pixel position of the tracking cursor (mouse or playback)
|
2013-12-12 01:29:48 +01:00
|
|
|
int track_cursor_pos = -1;
|
2010-12-08 04:36:10 +01:00
|
|
|
/// Label to show by track cursor
|
|
|
|
wxString track_cursor_label;
|
|
|
|
/// Bounding rectangle last drawn track cursor label
|
|
|
|
wxRect track_cursor_label_rect;
|
|
|
|
/// @brief Move the tracking cursor
|
|
|
|
/// @param new_pos New absolute pixel position of the tracking cursor
|
|
|
|
/// @param show_time Display timestamp by the tracking cursor?
|
|
|
|
void SetTrackCursor(int new_pos, bool show_time);
|
|
|
|
/// @brief Remove the tracking cursor from the display
|
|
|
|
void RemoveTrackCursor();
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2011-11-18 23:56:45 +01:00
|
|
|
/// Previous style ranges for optimizing redraw when ranges change
|
2012-02-02 00:58:58 +01:00
|
|
|
std::map<int, int> style_ranges;
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2010-12-08 09:09:11 +01:00
|
|
|
/// @brief Reload all rendering settings from Options and reset caches
|
|
|
|
///
|
|
|
|
/// This can be called if some rendering quality settings have been changed
|
|
|
|
/// in Options and need to be reloaded to take effect.
|
|
|
|
void ReloadRenderingSettings();
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2012-02-02 00:58:58 +01:00
|
|
|
/// Paint the audio data for a time range
|
2012-01-08 02:36:58 +01:00
|
|
|
/// @param dc DC to paint to
|
2012-02-02 00:58:58 +01:00
|
|
|
/// @param updtime Time range to repaint
|
2012-01-08 02:36:58 +01:00
|
|
|
/// @param updrect Pixel range to repaint
|
2012-02-02 00:58:58 +01:00
|
|
|
void PaintAudio(wxDC &dc, TimeRange updtime, wxRect updrect);
|
2012-01-08 02:36:58 +01:00
|
|
|
|
2012-02-02 00:58:58 +01:00
|
|
|
/// Paint the markers in a time range
|
2012-01-08 02:36:58 +01:00
|
|
|
/// @param dc DC to paint to
|
2012-02-02 00:58:58 +01:00
|
|
|
/// @param updtime Time range to repaint
|
|
|
|
void PaintMarkers(wxDC &dc, TimeRange updtime);
|
2012-01-08 02:36:58 +01:00
|
|
|
|
|
|
|
/// Draw a single foot for a marker
|
|
|
|
/// @param dc DC to paint to
|
|
|
|
/// @param marker_x Position of the marker whose foot is being painted in pixels
|
|
|
|
/// @param dir -1 for left, 1 for right
|
|
|
|
void PaintFoot(wxDC &dc, int marker_x, int dir);
|
|
|
|
|
2012-02-02 00:58:58 +01:00
|
|
|
/// Paint the labels in a time range
|
2012-01-08 02:36:58 +01:00
|
|
|
/// @param dc DC to paint to
|
2012-02-02 00:58:58 +01:00
|
|
|
/// @param updtime Time range to repaint
|
|
|
|
void PaintLabels(wxDC &dc, TimeRange updtime);
|
2012-01-08 02:36:58 +01:00
|
|
|
|
|
|
|
/// Paint the track cursor
|
|
|
|
/// @param dc DC to paint to
|
|
|
|
void PaintTrackCursor(wxDC &dc);
|
|
|
|
|
2012-10-02 16:40:50 +02:00
|
|
|
/// Forward the mouse event to the appropriate child control, if any
|
|
|
|
/// @return Was the mouse event forwarded somewhere?
|
|
|
|
bool ForwardMouseEvent(wxMouseEvent &event);
|
|
|
|
|
2010-12-08 04:36:10 +01:00
|
|
|
/// wxWidgets paint event
|
2006-01-16 22:02:54 +01:00
|
|
|
void OnPaint(wxPaintEvent &event);
|
2010-12-08 04:36:10 +01:00
|
|
|
/// wxWidgets mouse input event
|
2007-01-07 05:44:11 +01:00
|
|
|
void OnMouseEvent(wxMouseEvent &event);
|
2010-12-08 04:36:10 +01:00
|
|
|
/// wxWidgets control size changed event
|
2006-01-16 22:02:54 +01:00
|
|
|
void OnSize(wxSizeEvent &event);
|
2010-12-08 04:36:10 +01:00
|
|
|
/// wxWidgets input focus changed event
|
|
|
|
void OnFocus(wxFocusEvent &event);
|
2011-01-18 00:54:05 +01:00
|
|
|
/// wxWidgets keypress event
|
|
|
|
void OnKeyDown(wxKeyEvent& event);
|
2012-05-01 04:50:03 +02:00
|
|
|
void OnScrollTimer(wxTimerEvent &event);
|
2012-10-02 16:40:50 +02:00
|
|
|
void OnMouseEnter(wxMouseEvent&);
|
|
|
|
void OnMouseLeave(wxMouseEvent&);
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2010-12-08 04:36:10 +01:00
|
|
|
// AudioControllerAudioEventListener implementation
|
2011-09-15 07:16:18 +02:00
|
|
|
void OnAudioOpen(AudioProvider *provider);
|
2012-02-02 00:58:58 +01:00
|
|
|
void OnPlaybackPosition(int ms_position);
|
2011-09-15 07:16:18 +02:00
|
|
|
void OnSelectionChanged();
|
2011-11-18 23:56:45 +01:00
|
|
|
void OnStyleRangesChanged();
|
2012-02-02 00:59:12 +01:00
|
|
|
void OnTimingController();
|
2010-12-30 23:19:12 +01:00
|
|
|
void OnMarkerMoved();
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2010-12-08 04:36:10 +01:00
|
|
|
public:
|
2011-07-30 01:16:55 +02:00
|
|
|
AudioDisplay(wxWindow *parent, AudioController *controller, agi::Context *context);
|
2010-12-08 04:36:10 +01:00
|
|
|
~AudioDisplay();
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2010-12-08 04:36:10 +01:00
|
|
|
/// @brief Scroll the audio display
|
|
|
|
/// @param pixel_amount Number of pixels to scroll the view
|
|
|
|
///
|
|
|
|
/// A positive amount moves the display to the right, making later parts of the audio visible.
|
|
|
|
void ScrollBy(int pixel_amount);
|
|
|
|
|
|
|
|
/// @brief Scroll the audio display
|
|
|
|
/// @param pixel_position Absolute pixel to put at left edge of the audio display
|
|
|
|
void ScrollPixelToLeft(int pixel_position);
|
|
|
|
|
|
|
|
/// @brief Scroll the audio display
|
2012-02-02 00:58:58 +01:00
|
|
|
/// @param range Time range to ensure is in view
|
2010-12-08 04:36:10 +01:00
|
|
|
///
|
2012-02-02 00:58:58 +01:00
|
|
|
/// If the entire range is already visible inside the display, nothing is
|
|
|
|
/// scrolled. If just one of the two endpoints is visible, the display is
|
|
|
|
/// scrolled such that the visible endpoint stays in view but more of the
|
|
|
|
/// rest of the range becomes visible.
|
2010-12-08 04:36:10 +01:00
|
|
|
///
|
2012-02-02 00:58:58 +01:00
|
|
|
/// If the entire range fits inside the display, the display is centered
|
|
|
|
/// over the range. For this calculation, the display is considered
|
|
|
|
/// smaller by some margins, see below.
|
2010-12-08 04:36:10 +01:00
|
|
|
///
|
2012-02-02 00:58:58 +01:00
|
|
|
/// If the range does not fit within the display with margins subtracted,
|
|
|
|
/// the start of the range is ensured visible and as much of the rest of
|
|
|
|
/// the range is brought into view.
|
2010-12-08 04:36:10 +01:00
|
|
|
///
|
2012-02-02 00:58:58 +01:00
|
|
|
/// For the purpose of this function, a 5 percent margin is assumed at each
|
|
|
|
/// end of the audio display such that a range endpoint that is ensured to
|
|
|
|
/// be in view never gets closer to the edge of the display than the
|
|
|
|
/// margin. The edge that is not ensured to be in view might be outside of
|
|
|
|
/// view or might be closer to the display edge than the
|
2010-12-08 04:36:10 +01:00
|
|
|
/// margin.
|
2012-02-02 00:58:58 +01:00
|
|
|
void ScrollTimeRangeInView(const TimeRange &range);
|
2010-12-08 04:36:10 +01:00
|
|
|
|
|
|
|
|
|
|
|
/// @brief Change the zoom level
|
|
|
|
/// @param new_zoom_level The new zoom level to use
|
|
|
|
///
|
2012-02-02 00:58:58 +01:00
|
|
|
/// A zoom level of 0 is the default zoom level, all other levels are based
|
|
|
|
/// on this. Negative zoom levels zoom out, positive zoom in.
|
2010-12-08 04:36:10 +01:00
|
|
|
///
|
2012-02-02 00:58:58 +01:00
|
|
|
/// The zoom levels generally go from +30 to -30. It is possible to zoom in
|
|
|
|
/// more than +30.
|
2010-12-08 04:36:10 +01:00
|
|
|
void SetZoomLevel(int new_zoom_level);
|
|
|
|
|
|
|
|
/// @brief Get the zoom level
|
|
|
|
/// @return The zoom level
|
|
|
|
///
|
|
|
|
/// See SetZoomLevel for a description of zoom levels.
|
2012-10-02 16:25:29 +02:00
|
|
|
int GetZoomLevel() const { return zoom_level; }
|
2010-12-08 04:36:10 +01:00
|
|
|
|
|
|
|
/// @brief Get a textual description of a zoom level
|
|
|
|
/// @param level The zoom level to describe
|
|
|
|
/// @return A translated string describing a zoom level
|
|
|
|
///
|
|
|
|
/// The zoom level description can tell the user details about how much audio is
|
|
|
|
/// actually displayed.
|
|
|
|
wxString GetZoomLevelDescription(int level) const;
|
|
|
|
|
|
|
|
/// @brief Get the zoom factor in percent for a zoom level
|
|
|
|
/// @param level The zoom level to get the factor of
|
|
|
|
/// @return The zoom factor in percent
|
|
|
|
///
|
|
|
|
/// Positive: 125, 150, 175, 200, 225, ...
|
|
|
|
///
|
|
|
|
/// Negative: 90, 80, 70, 60, 50, 45, 40, 35, 30, 25, 20, 19, 18, 17, ..., 1
|
|
|
|
///
|
|
|
|
/// Too negative numbers get clamped.
|
|
|
|
static int GetZoomLevelFactor(int level);
|
|
|
|
|
|
|
|
/// @brief Set amplitude scale factor
|
|
|
|
/// @param scale New amplitude scale factor, 1.0 is no scaling
|
|
|
|
void SetAmplitudeScale(float scale);
|
|
|
|
|
2012-02-02 00:58:58 +01:00
|
|
|
/// Get a time in milliseconds from an X coordinate relative to current scroll
|
|
|
|
int TimeFromRelativeX(int x) const { return int((scroll_left + x) * ms_per_pixel); }
|
|
|
|
/// Get a time in milliseconds from an absolute X coordinate
|
|
|
|
int TimeFromAbsoluteX(int x) const { return int(x * ms_per_pixel); }
|
|
|
|
/// Get an X coordinate relative to the current scroll from a time in milliseconds
|
|
|
|
int RelativeXFromTime(int ms) const { return int(ms / ms_per_pixel) - scroll_left; }
|
|
|
|
/// Get an absolute X coordinate from a time in milliseconds
|
|
|
|
int AbsoluteXFromTime(int ms) const { return int(ms / ms_per_pixel); }
|
2006-01-16 22:02:54 +01:00
|
|
|
};
|