work in progress
git-svn-id: https://svn.code.sf.net/p/pianobooster/code/trunk@73 ba081f5d-443b-49a7-ac4b-446c3f91f371
This commit is contained in:
parent
1cda5c60e1
commit
e6c21b417c
|
@ -30,7 +30,7 @@
|
|||
|
||||
#define OPTION_DEBUG_BAR 0
|
||||
#if OPTION_DEBUG_BAR
|
||||
#define ppDEBUG_BAR(args) ppDebug args
|
||||
#define ppDEBUG_BAR(args) ppLogDebug args
|
||||
#else
|
||||
#define ppDEBUG_BAR(args)
|
||||
#endif
|
||||
|
|
|
@ -200,3 +200,20 @@ SET_TARGET_PROPERTIES(pianobooster PROPERTIES LINK_FLAGS "-mwindows")
|
|||
IF (USE_PCH)
|
||||
ADD_PRECOMPILED_HEADER( pianobooster ${CMAKE_CURRENT_SOURCE_DIR}/precompile/precompile.h )
|
||||
ENDIF (USE_PCH)
|
||||
|
||||
|
||||
INSTALL( FILES pianobooster.desktop DESTINATION share/applications )
|
||||
INSTALL(TARGETS pianobooster RUNTIME DESTINATION bin)
|
||||
#INSTALL( index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en SUBDIR kmidimon )
|
||||
|
||||
#INSTALL( FILES standards.ins DESTINATION ${DATA_INSTALL_DIR}/pianobooster
|
||||
|
||||
INSTALL ( FILES images/pianobooster.png DESTINATION share/pixmaps )
|
||||
|
||||
|
||||
#/usr/games/pianobooster
|
||||
#/usr/share/pixmaps/pianobooster.png
|
||||
#/usr/share/applications/pianobooster.desktop
|
||||
#/usr/share/doc/pianobooster/changelog.gz
|
||||
#/usr/share/doc/pianobooster/copyright
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ int Cfg::m_appY;
|
|||
int Cfg::m_appWidth;
|
||||
int Cfg::m_appHeight;
|
||||
bool Cfg::experimentalTempo = false;
|
||||
bool Cfg::experimentalSwapInterval = false;
|
||||
int Cfg::experimentalSwapInterval = -1;
|
||||
|
||||
const int Cfg::m_playZoneEarly = 25; // Was 25
|
||||
const int Cfg::m_playZoneLate = 25;
|
||||
|
|
|
@ -137,7 +137,7 @@ public:
|
|||
static bool smallScreen;
|
||||
static bool quickStart;
|
||||
static bool experimentalTempo;
|
||||
static bool experimentalSwapInterval;
|
||||
static int experimentalSwapInterval;
|
||||
|
||||
private:
|
||||
static float m_staveEndX;
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
#define OPTION_DEBUG_CONDUCTOR 0
|
||||
#if OPTION_DEBUG_CONDUCTOR
|
||||
#define ppDEBUG_CONDUCTOR(args) ppDebug args
|
||||
#define ppDEBUG_CONDUCTOR(args) ppLogDebug args
|
||||
#else
|
||||
#define ppDEBUG_CONDUCTOR(args)
|
||||
#endif
|
||||
|
@ -818,7 +818,7 @@ void CConductor::realTimeEngine(int mSecTicks)
|
|||
else if (type == MIDI_PB_timeSignature)
|
||||
{
|
||||
m_bar.setTimeSig(m_nextMidiEvent.data1(), m_nextMidiEvent.data2());
|
||||
ppDebug("Midi Time Signature %d/%d", m_nextMidiEvent.data1(),m_nextMidiEvent.data2());
|
||||
ppLogDebug("Midi Time Signature %d/%d", m_nextMidiEvent.data1(),m_nextMidiEvent.data2());
|
||||
|
||||
}
|
||||
else if ( type != MIDI_NONE ) // this marks the end of the piece of music
|
||||
|
@ -845,7 +845,7 @@ void CConductor::realTimeEngine(int mSecTicks)
|
|||
if (m_savedNoteOffQueue->space()>0)
|
||||
m_savedNoteOffQueue->push(m_nextMidiEvent);
|
||||
else
|
||||
ppDebug("Warning the m_savedNoteOffQueue is full");
|
||||
ppLogDebug("Warning the m_savedNoteOffQueue is full");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -42,7 +42,7 @@ void CDraw::oneLine(float x1, float y1, float x2, float y2)
|
|||
glVertex2f ((x1),(y1));
|
||||
glVertex2f ((x2),(y2));
|
||||
glEnd();
|
||||
//ppTrace("oneLine %f %f %f %f", x1, y1, x2, y2);
|
||||
//ppLogTrace("oneLine %f %f %f %f", x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
void CDraw::drawStaveExtentsion(CSymbol symbol, float x, int noteWidth, bool playable)
|
||||
|
@ -269,9 +269,18 @@ void CDraw::checkAccidental(CSymbol symbol, float x, float y)
|
|||
|
||||
accidental = symbol.getStavePos().getAccidental();
|
||||
|
||||
if (symbol.getAccidentalModifer() == PB_ACCIDENTAL_MODIFER_suppress_accidental)
|
||||
|
||||
if (symbol.getAccidentalModifer() == PB_ACCIDENTAL_MODIFER_suppress)
|
||||
accidental = 0; // Suppress the accidental if it is the same bar
|
||||
|
||||
if (symbol.getAccidentalModifer() == PB_ACCIDENTAL_MODIFER_force)
|
||||
{
|
||||
// Force the display of an accidental including naturals if it is the same bar
|
||||
accidental = CStavePos::midiNote2Name(symbol.getNote()).accidental;
|
||||
if (accidental == 0)
|
||||
accidental = 2;
|
||||
}
|
||||
|
||||
if (accidental != 0)
|
||||
{
|
||||
//drColour (Cfg::lineColour());
|
||||
|
@ -409,7 +418,7 @@ void CDraw::drawSymbol(CSymbol symbol, float x, float y)
|
|||
break;
|
||||
|
||||
case PB_SYMBOL_note:
|
||||
//ppTrace("PB_SYMBOL_note x %f y %f", x, y);
|
||||
//ppLogTrace("PB_SYMBOL_note x %f y %f", x, y);
|
||||
if (!CChord::isNotePlayable(symbol.getNote(), 0))
|
||||
{
|
||||
colour = Cfg::noteColourDim();
|
||||
|
|
|
@ -53,7 +53,7 @@ CGLView::CGLView(Window* parent, CSettings* settings)
|
|||
m_score = new CScore(m_settings);
|
||||
m_midiTicks = 0;
|
||||
m_scrollTicks = 0;
|
||||
m_cfg_openGlOptimise = false;
|
||||
m_cfg_openGlOptimise = true;
|
||||
}
|
||||
|
||||
CGLView::~CGLView()
|
||||
|
|
|
@ -48,6 +48,7 @@ void GuiPreferencesDialog::init(CSong* song, CSettings* settings, CGLView * glVi
|
|||
videoOptimiseCheck->setChecked(m_glView->m_cfg_openGlOptimise);
|
||||
timingMarkersCheck->setChecked(m_song->cfg_timingMarkersFlag);
|
||||
showNoteNamesCheck->setChecked(m_settings->isNoteNamesEnabled());
|
||||
courtesyAccidentalsCheck->setChecked(m_settings->displayCourtesyAccidentals());
|
||||
followStopPointCombo->addItem("Automatic (Recommended)");
|
||||
followStopPointCombo->addItem("On the Beat");
|
||||
followStopPointCombo->addItem("After the Beat");
|
||||
|
@ -61,8 +62,10 @@ void GuiPreferencesDialog::accept()
|
|||
m_song->cfg_timingMarkersFlag = timingMarkersCheck->isChecked();
|
||||
m_settings->setValue("score/timingMarkers", m_song->cfg_timingMarkersFlag );
|
||||
m_settings->setNoteNamesEnabled( showNoteNamesCheck->isChecked());
|
||||
m_settings->setCourtesyAccidentals( courtesyAccidentalsCheck->isChecked());
|
||||
m_song->cfg_stopPointMode = static_cast<stopPointMode_t> (followStopPointCombo->currentIndex());
|
||||
m_settings->setValue("score/stopPointMode", m_song->cfg_stopPointMode );
|
||||
m_song->refreshScroll();
|
||||
|
||||
this->QDialog::accept();
|
||||
}
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>332</width>
|
||||
<height>239</height>
|
||||
<width>362</width>
|
||||
<height>267</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
|
@ -21,7 +21,7 @@
|
|||
<layout class="QVBoxLayout" name="verticalLayout_3" >
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout" >
|
||||
<item row="1" column="0" >
|
||||
<item row="2" column="0" >
|
||||
<widget class="QCheckBox" name="timingMarkersCheck" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Maximum" >
|
||||
|
@ -34,14 +34,14 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<item row="3" column="0" >
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<string>Follow stop point:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" >
|
||||
<item row="3" column="1" >
|
||||
<widget class="QComboBox" name="followStopPointCombo" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
|
||||
|
@ -51,13 +51,13 @@
|
|||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>150</width>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<item row="2" column="1" >
|
||||
<spacer name="horizontalSpacer" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
|
@ -90,6 +90,13 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QCheckBox" name="courtesyAccidentalsCheck" >
|
||||
<property name="text" >
|
||||
<string>Courtesy Accidentals</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
|
@ -53,8 +53,8 @@ void GuiSidePanel::init(CSong* songObj, CTrackList* trackList, GuiTopBar* topBar
|
|||
|
||||
followYouRadio->setChecked(true);
|
||||
bothHandsRadio->setChecked(true);
|
||||
printf("left%d",leftHandRadio->isChecked());
|
||||
printf("both%d",bothHandsRadio->isChecked());
|
||||
ppLogTrace("left %d ",leftHandRadio->isChecked()); // fixme
|
||||
ppLogTrace("both %d ",bothHandsRadio->isChecked());
|
||||
|
||||
boostSlider->setMinimum(-100);
|
||||
boostSlider->setMaximum(100);
|
||||
|
|
|
@ -176,7 +176,7 @@ void CMidiDeviceFluidSynth::playMidiEvent(const CMidiEvent & event)
|
|||
|
||||
case MIDI_CONTROL_CHANGE: //CONTROL_CHANGE:
|
||||
fluid_synth_cc(m_synth, channel, event.data1(), event.data2());
|
||||
//ppTrace("MIDI_CONTROL_CHANGE %d %d %d", channel, event.data1(), event.data2()); //fixme
|
||||
//ppLogTrace("MIDI_CONTROL_CHANGE %d %d %d", channel, event.data1(), event.data2()); //fixme
|
||||
break;
|
||||
|
||||
case MIDI_PROGRAM_CHANGE: //PROGRAM_CHANGE:
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "MidiFile.h"
|
||||
|
||||
int CMidiFile::m_ppqn = DEFAULT_PPQN;
|
||||
|
@ -87,11 +89,15 @@ void CMidiFile::openMidiFile(string filename)
|
|||
m_file.open(filename.c_str(), ios_base::in | ios_base::binary);
|
||||
if (m_file.fail() == true)
|
||||
{
|
||||
ppError("Cannot open \"%s\"", filename.c_str());
|
||||
QMessageBox::warning(0, "Midi File Error",
|
||||
"Cannot open \"" + QString(filename.c_str()) + "\"");
|
||||
midiError(SMF_CANNOT_OPEN_FILE);
|
||||
return;
|
||||
}
|
||||
rewind();
|
||||
if (getMidiError() != SMF_NO_ERROR)
|
||||
QMessageBox::warning(0, "Midi File Error",
|
||||
"Midi file\"" + QString(filename.c_str()) + "\" is corrupted");
|
||||
}
|
||||
|
||||
void CMidiFile::rewind()
|
||||
|
@ -110,13 +116,13 @@ void CMidiFile::rewind()
|
|||
if (ntrks == 0)
|
||||
{
|
||||
midiError(SMF_CORRUPTED_MIDI_FILE);
|
||||
ppError("Zero tracks in SMF file");
|
||||
ppLogError("Zero tracks in SMF file");
|
||||
return;
|
||||
}
|
||||
if (ntrks > arraySize(m_tracks))
|
||||
{
|
||||
midiError(SMF_ERROR_TOO_MANY_TRACK);
|
||||
ppError("Too many tracks in SMF file");
|
||||
ppLogError("Too many tracks in SMF file");
|
||||
return;
|
||||
}
|
||||
for (trk = 0; trk < arraySize(m_tracks); trk++)
|
||||
|
@ -134,8 +140,11 @@ void CMidiFile::rewind()
|
|||
trackLength = m_tracks[trk]->init();
|
||||
m_tracks[trk]->decodeTrack();
|
||||
if (m_tracks[trk]->failed())
|
||||
break;
|
||||
{
|
||||
midiError(m_tracks[trk]->getMidiError());
|
||||
|
||||
break;
|
||||
}
|
||||
//now move onto the next track
|
||||
filePos += trackLength;
|
||||
m_file.seekg (filePos, ios::beg);
|
||||
|
|
|
@ -65,6 +65,7 @@ public:
|
|||
QString getSongTitle() {return m_songTitle;}
|
||||
|
||||
void setLogLevel(int level){CMidiTrack::setLogLevel(level);}
|
||||
midiErrors_t getMidiError() { return m_midiError;}
|
||||
|
||||
private:
|
||||
bool checkMidiEventFromStream(int streamIdx);
|
||||
|
|
|
@ -29,8 +29,9 @@
|
|||
#include <stdarg.h>
|
||||
#include "MidiTrack.h"
|
||||
#include "Util.h"
|
||||
#include "StavePosition.h"
|
||||
|
||||
#define OPTION_DEBUG_TRACK 1//fixme 0
|
||||
#define OPTION_DEBUG_TRACK 0
|
||||
#if OPTION_DEBUG_TRACK
|
||||
#define ppDEBUG_TRACK(args) ppDebugTrack args
|
||||
#else
|
||||
|
@ -64,7 +65,7 @@ dword_t CMidiTrack::init()
|
|||
{
|
||||
if (m_file.get() !="MTrk"[i] )
|
||||
{
|
||||
ppError("No valid Midi tracks");
|
||||
ppLogError("No valid Midi tracks");
|
||||
errorFail(SMF_CORRUPTED_MIDI_FILE);
|
||||
return 0;
|
||||
}
|
||||
|
@ -111,7 +112,7 @@ string CMidiTrack::readTextEvent()
|
|||
length = readVarLen();
|
||||
if (length >= 100)
|
||||
{
|
||||
ppError("Text Event too large %d", length);
|
||||
ppLogError("Text Event too large %d", length);
|
||||
errorFail(SMF_END_OF_FILE);
|
||||
return text;
|
||||
}
|
||||
|
@ -227,6 +228,8 @@ void CMidiTrack::readKeySignatureEvent()
|
|||
event.metaEvent(readDelaTime(), MIDI_PB_keySignature, keySig, majorKey);
|
||||
m_trackEventQueue->push(event);
|
||||
ppDEBUG_TRACK((4,"Key Signature %d maj/min %d", keySig, majorKey));
|
||||
if (CStavePos::getKeySignature() == NOT_USED)
|
||||
CStavePos::setKeySignature(event.data1(), event.data2());
|
||||
}
|
||||
|
||||
|
||||
|
@ -476,7 +479,7 @@ void CMidiTrack::decodeTrack()
|
|||
break;
|
||||
if (m_trackEventQueue->space() <= 1)
|
||||
{
|
||||
ppError("Out of Space");
|
||||
ppLogError("Out of Space");
|
||||
break;
|
||||
}
|
||||
decodeMidiEvent();
|
||||
|
|
|
@ -87,6 +87,7 @@ public:
|
|||
dword_t init();
|
||||
void decodeTrack();
|
||||
bool failed() { return (m_midiError != SMF_NO_ERROR) ? true : false;}
|
||||
midiErrors_t getMidiError() { return m_midiError;}
|
||||
|
||||
int length() {return m_trackEventQueue->length();}
|
||||
CMidiEvent pop() {return m_trackEventQueue->pop();}
|
||||
|
@ -102,7 +103,7 @@ private:
|
|||
{
|
||||
m_midiError = error;
|
||||
if (m_midiError != SMF_NO_ERROR)
|
||||
ppError("Midi error %d", m_midiError);
|
||||
ppLogError("Midi error %d", m_midiError);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,15 @@
|
|||
#include "Notation.h"
|
||||
#include "Cfg.h"
|
||||
|
||||
|
||||
#define OPTION_DEBUG_NOTATION 0
|
||||
#if OPTION_DEBUG_NOTATION
|
||||
#define ppDEBUG_NOTATION(args) ppLogDebug args
|
||||
#else
|
||||
#define ppDEBUG_NOTATION(args)
|
||||
#endif
|
||||
|
||||
|
||||
#define MERGESLOT_NOTE_INDEX 0
|
||||
#define MERGESLOT_BEATMARK_INDEX 1
|
||||
|
||||
|
@ -90,6 +99,8 @@ void CSlot::analyse()
|
|||
}
|
||||
}
|
||||
|
||||
bool CNotation::m_cfg_displayCourtesyAccidentals = false;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CSlot CNotation::nextBeatMarker()
|
||||
|
@ -142,26 +153,51 @@ int CNotation::nextMergeSlot()
|
|||
|
||||
accidentalModifer_t CNotation::detectSuppressedNatural(int note)
|
||||
{
|
||||
accidentalModifer_t modifer = PB_ACCIDENTAL_MODIFER_noChange;
|
||||
|
||||
if (note <= 0 || note +1 >= MAX_MIDI_NOTES)
|
||||
return modifer;
|
||||
return PB_ACCIDENTAL_MODIFER_noChange;
|
||||
|
||||
accidentalModifer_t modifer = PB_ACCIDENTAL_MODIFER_noChange;
|
||||
|
||||
while (m_earlyBarChangeDelta >= m_bar.getBarLength())
|
||||
{
|
||||
m_earlyBarChangeDelta -= m_bar.getBarLength();
|
||||
m_earlyBarChangeCounter++;
|
||||
}
|
||||
//int accidental = CStavePos::getStaveAccidental(note);
|
||||
|
||||
CNoteState * pNoteState = &m_noteState[note];
|
||||
CNoteState * pBackLink = pNoteState->getBackLink();
|
||||
|
||||
int direction = -CStavePos::getStaveAccidentalDirection(note);
|
||||
ppDEBUG_NOTATION(("Note %d %d %d", note, direction, pBackLink));
|
||||
// check if this note has occured in this bar before
|
||||
if (m_noteState[note].getBarChange() == m_earlyBarChangeCounter)
|
||||
modifer = PB_ACCIDENTAL_MODIFER_suppress_accidental;
|
||||
/*
|
||||
if (m_noteState[note + 1].getBarChange() == m_earlyBarChangeCounter)
|
||||
modifer = PB_ACCIDENTAL_MODIFER_above;
|
||||
if (m_noteState[note - 1].getBarChange() == m_earlyBarChangeCounter)
|
||||
modifer = PB_ACCIDENTAL_MODIFER_below;*/
|
||||
m_noteState[note].setBarChange(m_earlyBarChangeCounter);
|
||||
if (pNoteState->getBarChange() == m_earlyBarChangeCounter)
|
||||
{
|
||||
if (pBackLink)
|
||||
{
|
||||
ppDEBUG_NOTATION(("Force %d", note));
|
||||
modifer = PB_ACCIDENTAL_MODIFER_force;
|
||||
}
|
||||
else if (direction != 0 && m_cfg_displayCourtesyAccidentals == false)
|
||||
{
|
||||
ppDEBUG_NOTATION(("Supress %d %d", note, direction));
|
||||
modifer = PB_ACCIDENTAL_MODIFER_suppress;
|
||||
}
|
||||
}
|
||||
|
||||
if (direction != 0)
|
||||
{
|
||||
// we are display a accidental so force the note above (or below) to display
|
||||
m_noteState[note + direction].setBackLink(pNoteState); // point back to this note
|
||||
m_noteState[note + direction].setBarChange(m_earlyBarChangeCounter);
|
||||
ppDEBUG_NOTATION(("setting backlink %d %d", note + direction, direction));
|
||||
}
|
||||
if (pBackLink)
|
||||
{
|
||||
pNoteState->setBackLink(0);
|
||||
pBackLink->setBarChange(-1); // this prevents further suppression on the origianl note
|
||||
}
|
||||
|
||||
pNoteState->setBarChange(m_earlyBarChangeCounter);
|
||||
return modifer;
|
||||
}
|
||||
|
||||
|
|
|
@ -139,19 +139,24 @@ public:
|
|||
}
|
||||
void clear()
|
||||
{
|
||||
m_barChangeCounter = 0;
|
||||
m_barChangeCounter = -1;
|
||||
m_accidentalState = PB_ACCIDENTAL_MODIFER_noChange;
|
||||
m_noteLength = 0;
|
||||
m_backLink = 0;
|
||||
}
|
||||
void setBarChange(int value){m_barChangeCounter = value;}
|
||||
int getBarChange(){return m_barChangeCounter;}
|
||||
void setAccidentalState(accidentalModifer_t value){m_accidentalState = value;}
|
||||
accidentalModifer_t setAccidentalState(){return m_accidentalState;}
|
||||
accidentalModifer_t getAccidentalState(){return m_accidentalState;}
|
||||
void setBackLink(CNoteState * link){m_backLink = link;}
|
||||
CNoteState * getBackLink(){return m_backLink;}
|
||||
|
||||
|
||||
private:
|
||||
int m_barChangeCounter;
|
||||
accidentalModifer_t m_accidentalState;
|
||||
int m_noteLength; // Used to determine the note length
|
||||
CNoteState* m_backLink;
|
||||
};
|
||||
|
||||
// Define a chord
|
||||
|
@ -178,7 +183,11 @@ public:
|
|||
CSlot nextSlot();
|
||||
void midiEventInsert(CMidiEvent event);
|
||||
|
||||
int midiEventSpace() { return m_midiInputQueue->space();};
|
||||
int midiEventSpace() { return m_midiInputQueue->space();}
|
||||
|
||||
static void setCourtesyAccidentals(bool setting){m_cfg_displayCourtesyAccidentals = setting;}
|
||||
static bool displayCourtesyAccidentals(){return m_cfg_displayCourtesyAccidentals; }
|
||||
|
||||
|
||||
private:
|
||||
CSlot nextBeatMarker();
|
||||
|
@ -200,6 +209,7 @@ private:
|
|||
CFindChord m_findScrollerChord;
|
||||
CBar m_bar;
|
||||
CNoteState m_noteState[MAX_MIDI_NOTES];
|
||||
static bool m_cfg_displayCourtesyAccidentals;
|
||||
};
|
||||
|
||||
#endif // __NOTATION_H__
|
||||
|
|
|
@ -32,6 +32,7 @@ int main(int argc, char *argv[])
|
|||
"This system does not support OpenGL which is needed to run Piano Booster.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
Window window;
|
||||
window.show();
|
||||
return app.exec();
|
||||
|
|
|
@ -30,16 +30,6 @@
|
|||
|
||||
Window::Window()
|
||||
{
|
||||
decodeCommandLine();
|
||||
|
||||
if (Cfg::experimentalSwapInterval)
|
||||
{
|
||||
QGLFormat fmt;
|
||||
fmt.setSwapInterval(100);
|
||||
int value = fmt.swapInterval();
|
||||
ppLogInfo("Open GL Swap Interval %d", value);
|
||||
QGLFormat::setDefaultFormat(fmt);
|
||||
}
|
||||
|
||||
|
||||
QCoreApplication::setOrganizationName("PianoBooster");
|
||||
|
@ -49,6 +39,18 @@ Window::Window()
|
|||
setWindowIcon(QIcon(":/images/Logo32x32.png"));
|
||||
setWindowTitle(tr("Piano Booster"));
|
||||
|
||||
decodeCommandLine();
|
||||
|
||||
if (Cfg::experimentalSwapInterval != -1)
|
||||
{
|
||||
QGLFormat fmt;
|
||||
fmt.setSwapInterval(Cfg::experimentalSwapInterval);
|
||||
int value = fmt.swapInterval();
|
||||
ppLogInfo("Open GL Swap Interval %d", value);
|
||||
QGLFormat::setDefaultFormat(fmt);
|
||||
}
|
||||
|
||||
|
||||
m_glWidget = new CGLView(this, m_settings);
|
||||
|
||||
m_song = m_glWidget->getSongObject();
|
||||
|
@ -71,13 +73,6 @@ Window::Window()
|
|||
m_song->init(m_score, m_settings);
|
||||
m_glWidget->init();
|
||||
|
||||
/* fixme
|
||||
// Set up gl display format
|
||||
QGLFormat format = m_glWidget->format();
|
||||
format.setSwapInterval(100);
|
||||
m_glWidget->setFormat(format);
|
||||
*/
|
||||
|
||||
m_sidePanel->init(m_song, m_song->getTrackList(), m_topBar);
|
||||
m_topBar->init(m_song, m_song->getTrackList());
|
||||
createActions();
|
||||
|
@ -143,30 +138,78 @@ void Window::displayUsage()
|
|||
fprintf(stderr, " -v: Displays version number and then exits\n");
|
||||
}
|
||||
|
||||
int Window::decodeIntegerParam(QString arg, int defaultParam)
|
||||
{
|
||||
int n = arg.lastIndexOf('=');
|
||||
if (n == -1 || (n + 1) >= arg.size())
|
||||
return defaultParam;
|
||||
bool ok;
|
||||
int value = arg.mid(n+1).toInt(&ok);
|
||||
if (ok)
|
||||
return value;
|
||||
return defaultParam;
|
||||
}
|
||||
|
||||
void Window::decodeMidiFileArg(QString arg)
|
||||
{
|
||||
|
||||
QFileInfo fileInfo(arg);
|
||||
|
||||
if (fileInfo.exists())
|
||||
{
|
||||
bool vaildMidiFile = true;
|
||||
QFile file(fileInfo.absoluteFilePath());
|
||||
if (!file.open(QIODevice::ReadOnly))
|
||||
vaildMidiFile = false;
|
||||
else
|
||||
{
|
||||
QByteArray bytes = file.read(4);
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
if (bytes[i] !="MThd"[i] )
|
||||
vaildMidiFile = false;
|
||||
}
|
||||
file.close();
|
||||
}
|
||||
if (vaildMidiFile == true)
|
||||
m_settings->setValue("CurrentSong", fileInfo.absoluteFilePath());
|
||||
else
|
||||
ppLogError("Not a valid MIDI file \"%s\"\n", qPrintable(fileInfo.absoluteFilePath()) );
|
||||
}
|
||||
else
|
||||
{
|
||||
ppLogError("Cannot Open \"%s\"\n", qPrintable(fileInfo.absoluteFilePath()) );
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
void Window::decodeCommandLine()
|
||||
{
|
||||
bool hasMidiFile = false;
|
||||
QStringList argList = QCoreApplication::arguments();
|
||||
QString arg;
|
||||
for (int i = 0; i < argList.size(); ++i)
|
||||
{
|
||||
if (argList.at(i).startsWith("-"))
|
||||
arg = argList[i];
|
||||
if (arg.startsWith("-"))
|
||||
{
|
||||
if (argList.at(i).startsWith("-d"))
|
||||
if (arg.startsWith("-d"))
|
||||
Cfg::logLevel++;
|
||||
else if (argList.at(i).startsWith("-s"))
|
||||
else if (arg.startsWith("-s"))
|
||||
Cfg::smallScreen = true;
|
||||
else if (argList.at(i).startsWith("-q"))
|
||||
else if (arg.startsWith("-q"))
|
||||
Cfg::quickStart = true;
|
||||
else if (argList.at(i).startsWith("-X1"))
|
||||
else if (arg.startsWith("-X1"))
|
||||
Cfg::experimentalTempo = true;
|
||||
else if (argList.at(i).startsWith("-X2"))
|
||||
Cfg::experimentalSwapInterval = true;
|
||||
else if (arg.startsWith("-Xswap"))
|
||||
Cfg::experimentalSwapInterval = decodeIntegerParam(arg, 100);
|
||||
|
||||
else if (argList.at(i).startsWith("-h") || argList.at(i).startsWith("-?") ||argList.at(i).startsWith("--help"))
|
||||
else if (arg.startsWith("-h") || arg.startsWith("-?") ||arg.startsWith("--help"))
|
||||
{
|
||||
displayUsage();
|
||||
exit(0);
|
||||
}
|
||||
else if (argList.at(i).startsWith("-v"))
|
||||
else if (arg.startsWith("-v"))
|
||||
{
|
||||
fprintf(stderr, "pianobooster Version " PB_VERSION"\n");
|
||||
exit(0);
|
||||
|
@ -178,6 +221,14 @@ void Window::decodeCommandLine()
|
|||
exit(0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( hasMidiFile == false && i > 0)
|
||||
{
|
||||
hasMidiFile = true;
|
||||
decodeMidiFileArg(arg);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -117,6 +117,9 @@ protected:
|
|||
|
||||
private:
|
||||
void decodeCommandLine();
|
||||
int decodeIntegerParam(QString arg, int defaultParam);
|
||||
void decodeMidiFileArg(QString arg);
|
||||
|
||||
void displayUsage();
|
||||
void createActions();
|
||||
void createMenus();
|
||||
|
|
|
@ -51,7 +51,7 @@ void CScroll::compileSlot(CSlotDisplayList info)
|
|||
for (i=0; i < info.length(); i++)
|
||||
{
|
||||
stavePos.notePos(info.getSymbol(i).getHand(), info.getSymbol(i).getNote());
|
||||
//ppTrace ("compileSlot len %d id %2d next %2d time %2d type %2d note %2d", info.length(), info.m_displayListId,
|
||||
//ppLogTrace ("compileSlot len %d id %2d next %2d time %2d type %2d note %2d", info.length(), info.m_displayListId,
|
||||
//info.m_nextDisplayListId, info.getDeltaTime(), info.getSymbol(i).getType(), info.getSymbol(i).getNote());
|
||||
|
||||
drawSymbol(info.getSymbol(i), 0.0, stavePos.getPosYRelative()); // we add this back when drawing this symbol
|
||||
|
@ -134,7 +134,7 @@ void CScroll::removeSlots()
|
|||
|
||||
m_deltaTail += info.getDeltaTime() * SPEED_ADJUST_FACTOR;
|
||||
|
||||
//ppTrace("Remove slot id %2d time %2d type %2d note %2d", info.m_displayListId, info.getDeltaTime(), info.getSymbol(0).getType(), info.getSymbol(0).getNote());
|
||||
//ppLogTrace("Remove slot id %2d time %2d type %2d note %2d", info.m_displayListId, info.getDeltaTime(), info.getSymbol(0).getType(), info.getSymbol(0).getNote());
|
||||
|
||||
if (info.m_displayListId)
|
||||
glDeleteLists( info.m_displayListId, 1);
|
||||
|
|
|
@ -61,7 +61,8 @@ CSettings::CSettings(QWidget *mainWindow) : QSettings(CSettings::IniFormat, CSet
|
|||
// It is all done in the initialisation list
|
||||
|
||||
m_advancedMode = false;
|
||||
m_noteNamesEnabled = value("score/noteNames", false ).toBool();
|
||||
m_noteNamesEnabled = value("score/noteNames", true ).toBool();
|
||||
CNotation::setCourtesyAccidentals(value("score/courtesyAccidentals", false ).toBool());
|
||||
}
|
||||
|
||||
void CSettings::init(CSong* song, GuiSidePanel* sidePanel, GuiTopBar* topBar)
|
||||
|
@ -77,6 +78,10 @@ void CSettings::setNoteNamesEnabled(bool value) {
|
|||
setValue("score/noteNames", value );
|
||||
}
|
||||
|
||||
void CSettings::setCourtesyAccidentals(bool value) {
|
||||
CNotation::setCourtesyAccidentals(value);
|
||||
setValue("score/courtesyAccidentals", value );
|
||||
}
|
||||
|
||||
// Open a document if it exists or else create it (also delete an duplicates
|
||||
QDomElement CSettings::openDomElement(QDomElement parent, const QString & elementName, const QString & attributeName)
|
||||
|
@ -186,7 +191,7 @@ void CSettings::loadXmlFile()
|
|||
if (file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
if (!m_domDocument.setContent(&file)) {
|
||||
ppError("Cannot setContent on XLM file");
|
||||
ppLogError("Cannot setContent on XLM file");
|
||||
}
|
||||
file.close();
|
||||
}
|
||||
|
@ -214,7 +219,7 @@ void CSettings::saveXmlFile()
|
|||
QFile file(m_bookPath + getCurrentBookName() + '/' + "pb.cfg");
|
||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
|
||||
{
|
||||
ppError("Cannot save xml file %s", qPrintable(file.fileName()));
|
||||
ppLogError("Cannot save xml file %s", qPrintable(file.fileName()));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <QSettings>
|
||||
#include <QDomDocument>
|
||||
#include "Song.h"
|
||||
#include "Notation.h"
|
||||
|
||||
class GuiSidePanel;
|
||||
class GuiTopBar;
|
||||
|
@ -45,9 +46,11 @@ public:
|
|||
|
||||
/// returns true if the users wants to see the note names
|
||||
bool isNoteNamesEnabled() { return m_noteNamesEnabled; }
|
||||
bool displayCourtesyAccidentals() { return CNotation::displayCourtesyAccidentals(); }
|
||||
|
||||
/// Saves in the .ini file whether the user wants to show the note names
|
||||
void setNoteNamesEnabled(bool value);
|
||||
void setCourtesyAccidentals(bool value);
|
||||
void setAdvancedMode(bool value) { m_advancedMode = value;}
|
||||
|
||||
/// returns true if the users wants to see the note names
|
||||
|
|
|
@ -202,7 +202,7 @@ eventBits_t CSong::task(int ticks)
|
|||
// Read the next events
|
||||
CMidiEvent event = m_midiFile->readMidiEvent();
|
||||
|
||||
//ppTrace("Song event delta %d type 0x%x chan %d Note %d", event.deltaTime(), event.type(), event.channel(), event.note());
|
||||
//ppLogTrace("Song event delta %d type 0x%x chan %d Note %d", event.deltaTime(), event.type(), event.channel(), event.note());
|
||||
|
||||
// Find the next chord
|
||||
if (m_findChord.findChord(event, getActiveChannel(), PB_PART_both) == true)
|
||||
|
|
|
@ -56,7 +56,7 @@ void CStavePos::notePos(whichPart_t hand, int midiNote)
|
|||
|
||||
m_staveIndex += (midiNote/semitonesInAnOctive)*notesInAnOctive - notesInAnOctive*5 ;
|
||||
m_accidental = lookUpItem->accidental;
|
||||
//ppTrace("chan %d Note %2d - %2d (%d %d %d),\n", midiNote, m_staveIndex, m_accidental,
|
||||
//ppLogTrace("chan %d Note %2d - %2d (%d %d %d),\n", midiNote, m_staveIndex, m_accidental,
|
||||
//index%semitonesInAnOctive, lookUpItem->pianoNote, (midiNote/semitonesInAnOctive)*notesInAnOctive);
|
||||
}
|
||||
|
||||
|
|
|
@ -39,6 +39,8 @@ typedef struct {
|
|||
int accidental;
|
||||
} staveLookup_t;
|
||||
|
||||
#define NOT_USED 0x7fffffff
|
||||
|
||||
#define MAX_STAVE_INDEX 16
|
||||
#define MIN_STAVE_INDEX -16
|
||||
|
||||
|
@ -124,11 +126,24 @@ public:
|
|||
static const staveLookup_t* getstaveLookupTable(int key);
|
||||
|
||||
// do we show a sharp or a flat for this key signature
|
||||
// returns 0 = none, 1=sharp, -1 =flat, 2=natural (# Key) , -2=natural (b Key)
|
||||
static int getStaveAccidental(int midiNote)
|
||||
{
|
||||
return m_staveLookUpTable[midiNote%12].accidental;
|
||||
}
|
||||
|
||||
// returns 0 = none, 1=above, -1 =below, (a natural is either above or below)
|
||||
static int getStaveAccidentalDirection(int midiNote)
|
||||
{
|
||||
int accidentalDirection = getStaveAccidental(midiNote);
|
||||
if (accidentalDirection == 2) // A natural so change to above
|
||||
accidentalDirection = 1;
|
||||
else if (accidentalDirection == -2) // A natural so change to below
|
||||
accidentalDirection = -1;
|
||||
|
||||
return accidentalDirection;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
// fixme TODO This could be improved as the calculations could a done in the constructor
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include "Cfg.h"
|
||||
#include "StavePosition.h"
|
||||
|
||||
#define NOT_USED 0x7fffffff
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
@ -55,8 +54,8 @@ typedef enum
|
|||
|
||||
typedef enum {
|
||||
PB_ACCIDENTAL_MODIFER_noChange,
|
||||
PB_ACCIDENTAL_MODIFER_suppress_accidental,
|
||||
PB_ACCIDENTAL_MODIFER_force_natural
|
||||
PB_ACCIDENTAL_MODIFER_suppress,
|
||||
PB_ACCIDENTAL_MODIFER_force // force a natural/accidental to be played
|
||||
} accidentalModifer_t;
|
||||
|
||||
#define BEAT_MARKER_OFFSET 20 // used to ensure that beat markers are drawn under the note by drawing them early
|
||||
|
|
|
@ -93,7 +93,7 @@ void ppLogWarn(const char *msg, ...)
|
|||
fputc('\n', stdout);
|
||||
}
|
||||
|
||||
void ppTrace(const char *msg, ...)
|
||||
void ppLogTrace(const char *msg, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
|
@ -106,7 +106,7 @@ void ppTrace(const char *msg, ...)
|
|||
}
|
||||
|
||||
|
||||
void ppDebug( const char *msg, ...)
|
||||
void ppLogDebug( const char *msg, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
|
@ -117,11 +117,11 @@ void ppDebug( const char *msg, ...)
|
|||
fputc('\n', stdout);
|
||||
}
|
||||
|
||||
void ppError(const char *msg, ...)
|
||||
void ppLogError(const char *msg, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
fputs("Error: ", stdout);
|
||||
fputs("ERROR: ", stdout);
|
||||
va_start(ap, msg);
|
||||
vfprintf(stdout, msg, ap);
|
||||
va_end(ap);
|
||||
|
|
|
@ -45,7 +45,7 @@ typedef unsigned char byte;
|
|||
|
||||
#define arraySize(a) (sizeof(a)/sizeof(a[0])) /* Returns (at compile time) the number of elements in an array */
|
||||
|
||||
#define ppDEBUG(args) ppDebug args
|
||||
#define ppDEBUG(args) ppLogDebug args
|
||||
|
||||
|
||||
|
||||
|
@ -58,12 +58,12 @@ typedef enum
|
|||
} logLevel_t;
|
||||
|
||||
void fatal(const char *msg, ...);
|
||||
void ppTrace(const char *msg, ...);
|
||||
void ppDebug(const char *msg, ...);
|
||||
void ppError(const char *msg, ...);
|
||||
void ppLogTrace(const char *msg, ...);
|
||||
void ppLogDebug(const char *msg, ...);
|
||||
void ppLog(logLevel_t level, const char *msg, ...);
|
||||
void ppLogInfo(const char *msg, ...);
|
||||
void ppLogWarn(const char *msg, ...);
|
||||
void ppLogError(const char *msg, ...);
|
||||
void ppTiming(const char *msg, ...);
|
||||
|
||||
#define SPEED_ADJUST_FACTOR 1000
|
||||
|
|
|
@ -71,7 +71,7 @@ OBJECTS_DIR = tmp
|
|||
|
||||
win32 {
|
||||
DEFINES += __WINDOWS_MM__ _WIN32
|
||||
LIBS += $${FLUIDSYNTH_INPLACE_DIR}/src/.libs/libfluidsynth.dll.a libwinmm
|
||||
LIBS += libwinmm
|
||||
}
|
||||
|
||||
unix {
|
||||
|
@ -90,7 +90,8 @@ USE_FLUIDSYNTH {
|
|||
}
|
||||
message(fluidsynth FLUIDSYNTH_INPLACE_DIR = $${FLUIDSYNTH_INPLACE_DIR})
|
||||
INCLUDEPATH += $${FLUIDSYNTH_INPLACE_DIR}/include/
|
||||
LIBS += $${FLUIDSYNTH_INPLACE_DIR}/src/.libs/libfluidsynth.a
|
||||
win32:LIBS += $${FLUIDSYNTH_INPLACE_DIR}/src/.libs/libfluidsynth.dll.a
|
||||
unix:LIBS += $${FLUIDSYNTH_INPLACE_DIR}/src/.libs/libfluidsynth.a
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user