On Tue, Sep 3, 2013 at 9:40 PM,  <[email protected]> wrote:
> Hi James,
>
> i had a look at that issue, but i stopped looking into your patch when i
> couldn't reproduce the problem :-/ I will try to reproduce it on my
> linux machine (last time i used OS X) and i will see if i can make sense
> of it.

OK. Here is my step by step instructions to reproduce (I can't see why
it wouldn't occur on OS X):

1: create a new song with 12 repeats of pattern 1
2: Ensure BPM set to 120 for bar 1, create BPM change to 80 at bar 5,
and back to 120 at bar 9.
3: click onto song mode
4: click on bar 6, press play, then stop (you might notice it starts
at the wrong place)
5: Click on bar 11, press play - notice that transport starts at bar 4!

The problem seems to be related to the GUI not being aware of BPM
changes, whereas the song engine is..

> If you still have that patch, just send it to this
> list or put it on gist (https://gist.github.com/). Or, if you have the
> time and knowledge, create a git pull request.

I have attached the patch. The naming is probably not right, but it does work.

I am afraid I don't have time to work out git just yet :(

James
diff --git a/src/core/include/hydrogen/hydrogen.h 
b/src/core/include/hydrogen/hydrogen.h
index dd3c7cb..f386cd0 100644
--- a/src/core/include/hydrogen/hydrogen.h
+++ b/src/core/include/hydrogen/hydrogen.h
@@ -107,6 +107,7 @@ public:
        PatternList * getNextPatterns();
 
        int getPatternPos();
+       int getPatternPos_GUI();
        void setPatternPos( int pos );
 
        void triggerRelocateDuringPlay();
diff --git a/src/core/src/hydrogen.cpp b/src/core/src/hydrogen.cpp
index 62c5e3d..178bbf5 100644
--- a/src/core/src/hydrogen.cpp
+++ b/src/core/src/hydrogen.cpp
@@ -148,6 +148,7 @@ bool m_bDeleteNextPattern;          ///< Delete the next 
pattern from the list.
 
 PatternList* m_pPlayingPatterns;
 int m_nSongPos;                                ///< Is the position inside the 
song
+int stopped_song_pos = -1;
 
 int m_nSelectedPatternNumber;
 int m_nSelectedInstrumentNumber;
@@ -643,10 +644,11 @@ inline void audioEngine_process_transport()
 
                          switch ( m_pAudioDriver->m_transport.m_status ) {
                          case TransportInfo::ROLLING:
-
+                                        stopped_song_pos = -1;
                                         if ( m_audioEngineState == STATE_READY 
) {
                                                        audioEngine_start( 
false, nNewFrames ); // no engine lock
                                         }
+                                        
 
                                         if ( m_pSong->__bpm != 
m_pAudioDriver->m_transport.m_nBPM ) {
                                                        ___INFOLOG(
@@ -2419,13 +2421,20 @@ void Hydrogen::sequencer_setNextPattern( int pos, bool 
appendPattern, bool delet
 
 
 
+int Hydrogen::getPatternPos_GUI()
+{
+          if (stopped_song_pos > -1) {
+                  return stopped_song_pos;
+          }
+          else {return m_nSongPos;}
+}
+
 int Hydrogen::getPatternPos()
 {
           return m_nSongPos;
 }
 
 
-
 void Hydrogen::restartDrivers()
 {
           audioEngine_restartAudioDrivers();
@@ -2832,7 +2841,7 @@ void Hydrogen::setPatternPos( int pos )
                          //            m_nSongPos = findPatternInTick( 
totalTick,
                          //                                            
m_pSong->is_loop_enabled(),
                          //                                            &dummy 
);
-                         m_nSongPos = pos;
+                         stopped_song_pos = pos;
                          m_nPatternTickPosition = 0;
           }
           m_pAudioDriver->locate(
diff --git a/src/gui/src/SongEditor/SongEditor.cpp 
b/src/gui/src/SongEditor/SongEditor.cpp
index 717db18..4e4e72e 100644
--- a/src/gui/src/SongEditor/SongEditor.cpp
+++ b/src/gui/src/SongEditor/SongEditor.cpp
@@ -2028,7 +2028,7 @@ void SongEditorPositionRuler::paintEvent( QPaintEvent *ev 
)
        
        Hydrogen *H = Hydrogen::get_instance();
 
-       float fPos = H->getPatternPos();
+       float fPos = H->getPatternPos_GUI();
        int pIPos = Preferences::get_instance()->getPunchInPos();
        int pOPos = Preferences::get_instance()->getPunchOutPos();
 
------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
Hydrogen-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hydrogen-devel

Reply via email to