|
From: Tapio V. <aa...@us...> - 2011-01-31 14:38:00
|
Module: editor
Branch: master
Commit: bbb8af2a5233ad239624b8aa051ea48e64257338
Author: Tapio Vierros <tap...@gm...>
Date: Mon Jan 31 16:14:50 2011 +0200
Now edited notes can be exported.
---
editorapp.cc | 3 +++
notegraphwidget.cc | 17 +++++++++++++++++
notegraphwidget.hh | 1 +
3 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/editorapp.cc b/editorapp.cc
index 585c1a0..12d189d 100644
--- a/editorapp.cc
+++ b/editorapp.cc
@@ -315,6 +315,7 @@ void EditorApp::on_actionSingStarXML_triggered()
{
QString path = QFileDialog::getExistingDirectory(this, tr("Export SingStar XML"), QDir::homePath());
if (!path.isNull()) {
+ song->insertVocalTrack(TrackName::LEAD_VOCAL, noteGraph->getVocalTrack());
try { SingStarXMLWriter(*song.data(), path); }
catch (const std::exception& e) {
QMessageBox::critical(this, tr("Error exporting song!"), e.what());
@@ -326,6 +327,7 @@ void EditorApp::on_actionUltraStarTXT_triggered()
{
QString path = QFileDialog::getExistingDirectory(this, tr("Export UltraStar TXT"), QDir::homePath());
if (!path.isNull()) {
+ song->insertVocalTrack(TrackName::LEAD_VOCAL, noteGraph->getVocalTrack());
try { UltraStarTXTWriter(*song.data(), path); }
catch (const std::exception& e) {
QMessageBox::critical(this, tr("Error exporting song!"), e.what());
@@ -337,6 +339,7 @@ void EditorApp::on_actionFoFMIDI_triggered()
{
QString path = QFileDialog::getExistingDirectory(this, tr("Export FoF MIDI"), QDir::homePath());
if (!path.isNull()) {
+ song->insertVocalTrack(TrackName::LEAD_VOCAL, noteGraph->getVocalTrack());
try { FoFMIDIWriter(*song.data(), path); }
catch (const std::exception& e) {
QMessageBox::critical(this, tr("Error exporting song!"), e.what());
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index 172274b..bd551e7 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -10,6 +10,7 @@
#include <cmath>
#include "notelabel.hh"
#include "notegraphwidget.hh"
+#include "song.hh"
#include "util.hh"
@@ -595,6 +596,22 @@ int NoteGraphWidget::n2px(int note) const { return PitchVis::note2px(note) - m_n
int NoteGraphWidget::px2n(int px) const { return PitchVis::px2note(px + m_noteHalfHeight); }
+VocalTrack NoteGraphWidget::getVocalTrack() const
+{
+ VocalTrack track(TrackName::LEAD_VOCAL);
+ Notes& notes = track.notes;
+ if (!m_notes.isEmpty()) {
+ for (int i = 0; i < m_notes.size(); ++i) {
+ notes.push_back(m_notes[i]->note());
+ track.noteMin = std::min(notes.back().note, track.noteMin);
+ track.noteMax = std::max(notes.back().note, track.noteMin);
+ }
+ track.beginTime = notes.front().begin;
+ track.endTime = notes.back().end;
+ }
+ return track;
+}
+
QString NoteGraphWidget::dumpLyrics() const
{
QString lyrics;
diff --git a/notegraphwidget.hh b/notegraphwidget.hh
index eedaf14..7ef5ba5 100644
--- a/notegraphwidget.hh
+++ b/notegraphwidget.hh
@@ -61,6 +61,7 @@ public:
int px2n(int px) const;
int h() const { return m_pitch->height; }
+ VocalTrack getVocalTrack() const;
QString dumpLyrics() const;
public slots:
|