kwave
18.07.70
|
#include <SonagramWindow.h>
Public Slots | |
void | close () |
void | save () |
void | load () |
void | toSignal () |
void | setName (const QString &name) |
void | setColorMode (int mode) |
void | cursorPosChanged (const QPoint pos) |
void | setPoints (unsigned int points) |
void | setRate (double rate) |
Public Member Functions | |
SonagramWindow (QWidget *parent, const QString &name) | |
virtual | ~SonagramWindow () |
void | setImage (QImage image) |
void | setOverView (const QImage &image) |
void | insertSlice (const unsigned int slice_nr, const QByteArray &slice) |
Protected Member Functions | |
void | updateScaleWidgets () |
void | adjustBrightness () |
void | translatePixels2TF (const QPoint p, double *ms, double *f) |
Private Slots | |
void | refresh_view () |
Private Attributes | |
QLabel * | m_status_time |
QLabel * | m_status_freq |
QLabel * | m_status_ampl |
QImage | m_image |
int | m_color_mode |
Kwave::ImageView * | m_view |
Kwave::ImageView * | m_overview |
unsigned int | m_points |
double | m_rate |
Kwave::ScaleWidget * | m_xscale |
Kwave::ScaleWidget * | m_yscale |
QTimer | m_refresh_timer |
unsigned int | m_histogram [256] |
Window for displaying a sonagram with scale, status bar and a small menu.
Definition at line 43 of file SonagramWindow.h.
Kwave::SonagramWindow::SonagramWindow | ( | QWidget * | parent, |
const QString & | name | ||
) |
Constructor.
parent | the parent widget |
name | reference to the initial name of the signal (used for setting the window title, might be an empty string) |
Definition at line 85 of file SonagramWindow.cpp.
References _, background, close(), Kwave::connect(), cursorPosChanged(), m_histogram, m_overview, m_refresh_timer, m_status_ampl, m_status_freq, m_status_time, m_view, m_xscale, m_yscale, refresh_view(), save(), setName(), Kwave::ScaleWidget::sizeHint(), and SONAGRAM_OVERVIEW_HEIGHT.
|
virtual |
|
protected |
adjust the brightness so that the color space is optimally used and the user doesn't just see a white image
Definition at line 349 of file SonagramWindow.cpp.
References COLOR_CUTOFF_RATIO, m_color_mode, m_histogram, m_image, and Kwave::toUint().
Referenced by refresh_view().
|
slot |
closes the sonagram window
Definition at line 214 of file SonagramWindow.cpp.
Referenced by SonagramWindow().
|
slot |
Used to update the display of the current position of the cursor. Position is given in coordinates of the QImage.
pos | current cursor position |
Definition at line 527 of file SonagramWindow.cpp.
References m_image, m_points, m_rate, m_status_ampl, m_status_freq, m_status_time, Kwave::ms2string(), Kwave::toInt(), and translatePixels2TF().
Referenced by SonagramWindow().
void Kwave::SonagramWindow::insertSlice | ( | const unsigned int | slice_nr, |
const QByteArray & | slice | ||
) |
Inserts a slice into the current image. If the slice contains more data than fits into the image, the remaining rest will be ignored, if less data is present, it will be filled with 0xFF. The previous content of the image slice will be cleared or updated in all cases.
slice_nr | index of the slice (horizontal position) [0..n-1] |
slice | array with the byte data |
Definition at line 308 of file SonagramWindow.cpp.
References m_histogram, m_image, m_refresh_timer, m_view, and REFRESH_DELAY.
Referenced by Kwave::SonagramPlugin::insertSlice().
|
slot |
|
privateslot |
refreshes the image, connected to m_refresh_timer
Definition at line 394 of file SonagramWindow.cpp.
References adjustBrightness(), m_image, m_view, and Kwave::ImageView::setImage().
Referenced by setImage(), and SonagramWindow().
|
slot |
not implemented yet
Definition at line 220 of file SonagramWindow.cpp.
References _, m_image, Kwave::FileDialog::SaveFile, and Kwave::FileDialog::selectedUrl().
Referenced by SonagramWindow().
|
slot |
Sets a new color mode. If the mode is different from the current one, the image will be automatically refreshed.
Definition at line 506 of file SonagramWindow.cpp.
References m_color_mode, m_image, and setImage().
Referenced by Kwave::SonagramPlugin::start().
void Kwave::SonagramWindow::setImage | ( | QImage | image | ) |
Sets a new sonagram image to display.
image | the bitmap with the sonagram |
Definition at line 279 of file SonagramWindow.cpp.
References m_histogram, m_image, m_view, and refresh_view().
Referenced by Kwave::SonagramPlugin::createNewImage(), setColorMode(), and Kwave::SonagramPlugin::start().
|
slot |
Sets the name of the signal / title of the window
name | the name of the signal |
Definition at line 518 of file SonagramWindow.cpp.
Referenced by SonagramWindow().
void Kwave::SonagramWindow::setOverView | ( | const QImage & | image | ) |
Sets a new overview bitmap for the signal space
Definition at line 302 of file SonagramWindow.cpp.
References m_overview, and Kwave::ImageView::setImage().
Referenced by Kwave::SonagramPlugin::refreshOverview().
|
slot |
sets information about the number of fft points (needed for translating cursor coordinates into time)
points | the number of fft points [1...] |
Definition at line 562 of file SonagramWindow.cpp.
References m_points, and updateScaleWidgets().
Referenced by Kwave::SonagramPlugin::start().
|
slot |
sets information about the sample rate (needed for translating cursor coordinates into time
rate | sample rate in samples per second |
Definition at line 569 of file SonagramWindow.cpp.
References m_rate, and updateScaleWidgets().
Referenced by Kwave::SonagramPlugin::start().
|
slot |
not implemented yet
Definition at line 403 of file SonagramWindow.cpp.
|
protected |
Translates pixel coordinates relative to the lower left corner of the QImage into time and frequency coordinates of the signal. This requires a valid sample rate to be set, otherwise the time coordinate will be returned as zero.
p | a QPoint with the pixel position, upper left is 0/0 |
ms | pointer to a double that receives the time coordinate in milliseconds (can be 0 to ignore) |
f | pointer to a double that receives the frequency coordinate (can be 0 to ignore) |
Definition at line 466 of file SonagramWindow.cpp.
References m_points, and m_rate.
Referenced by cursorPosChanged(), and updateScaleWidgets().
|
protected |
updates the scale widgets
Definition at line 489 of file SonagramWindow.cpp.
References m_image, m_xscale, m_yscale, Kwave::ScaleWidget::setMinMax(), Kwave::toInt(), and translatePixels2TF().
Referenced by setPoints(), and setRate().
|
private |
the color mode to be used. Currently only 0 (black/white) and 1 (rainbow colors) are used.
Definition at line 177 of file SonagramWindow.h.
Referenced by adjustBrightness(), and setColorMode().
|
private |
histogram of color indices, used for auto-contrast
Definition at line 201 of file SonagramWindow.h.
Referenced by adjustBrightness(), insertSlice(), setImage(), and SonagramWindow().
|
private |
the QImage to be displayed
Definition at line 171 of file SonagramWindow.h.
Referenced by adjustBrightness(), cursorPosChanged(), insertSlice(), refresh_view(), save(), setColorMode(), setImage(), and updateScaleWidgets().
|
private |
short overview over the signal
Definition at line 183 of file SonagramWindow.h.
Referenced by setOverView(), and SonagramWindow().
|
private |
number of fft points
Definition at line 186 of file SonagramWindow.h.
Referenced by cursorPosChanged(), setPoints(), and translatePixels2TF().
|
private |
sample rate, needed for translating pixel coordinates
Definition at line 189 of file SonagramWindow.h.
Referenced by cursorPosChanged(), setRate(), and translatePixels2TF().
|
private |
timer used for refreshing the view from time to time
Definition at line 198 of file SonagramWindow.h.
Referenced by insertSlice(), and SonagramWindow().
|
private |
status bar label for amplitude
Definition at line 168 of file SonagramWindow.h.
Referenced by cursorPosChanged(), and SonagramWindow().
|
private |
status bar label for frequency
Definition at line 165 of file SonagramWindow.h.
Referenced by cursorPosChanged(), and SonagramWindow().
|
private |
status bar label for time
Definition at line 162 of file SonagramWindow.h.
Referenced by cursorPosChanged(), and SonagramWindow().
|
private |
an ImageView to display the m_image and fit it into our window
Definition at line 180 of file SonagramWindow.h.
Referenced by insertSlice(), refresh_view(), setImage(), and SonagramWindow().
|
private |
widget for the scale on the time (x) axis
Definition at line 192 of file SonagramWindow.h.
Referenced by SonagramWindow(), and updateScaleWidgets().
|
private |
widget for the scale on the frequency (y) axis
Definition at line 195 of file SonagramWindow.h.
Referenced by SonagramWindow(), and updateScaleWidgets().