mirror of
https://github.com/microtherion/VocalEasel.git
synced 2024-12-22 11:14:00 +00:00
Restart play when at end
This commit is contained in:
parent
b68fc2dd5a
commit
74cb6433b4
|
@ -588,6 +588,8 @@
|
|||
VLSoundOut::Instance()->SetPlayRate(playRate = 1.0f);
|
||||
if (!nowPlaying)
|
||||
[self play:sender];
|
||||
else if (VLSoundOut::Instance()->AtEnd())
|
||||
VLSoundOut::Instance()->SetTime(0);
|
||||
break;
|
||||
case 1: // Fwd
|
||||
case -1: // Rew
|
||||
|
@ -604,6 +606,8 @@
|
|||
VLSoundOut::Instance()->SetPlayRate(playRate*tempoRate);
|
||||
break;
|
||||
case -2: // To Start
|
||||
if (playRate < 0)
|
||||
VLSoundOut::Instance()->SetPlayRate(playRate = -playRate);
|
||||
VLSoundOut::Instance()->SetTime(0);
|
||||
break;
|
||||
case 2: // To End
|
||||
|
|
|
@ -29,6 +29,7 @@ public:
|
|||
virtual void PlaySequence(MusicSequence music);
|
||||
virtual void Stop(bool pause);
|
||||
virtual bool Playing();
|
||||
virtual bool AtEnd();
|
||||
virtual void SetPlayRate(float rate);
|
||||
virtual void SetTime(MusicTimeStamp time);
|
||||
|
||||
|
@ -218,7 +219,6 @@ void VLAUSoundOut::SetPlayRate(float rate)
|
|||
|
||||
void VLAUSoundOut::SetTime(MusicTimeStamp time)
|
||||
{
|
||||
SetPlayRate(1.0f);
|
||||
MusicPlayerSetTime(fPlayer, time);
|
||||
}
|
||||
|
||||
|
@ -238,6 +238,13 @@ bool VLAUSoundOut::Playing()
|
|||
return fRunning;
|
||||
}
|
||||
|
||||
bool VLAUSoundOut::AtEnd()
|
||||
{
|
||||
MusicTimeStamp time;
|
||||
|
||||
return !MusicPlayerGetTime(fPlayer, &time) && time >= fMusicLength;
|
||||
}
|
||||
|
||||
void VLAUSoundOut::PlayNote(const VLNote & note)
|
||||
{
|
||||
Play(¬e.fPitch);
|
||||
|
|
|
@ -41,6 +41,7 @@ public:
|
|||
virtual void PlaySequence(MusicSequence music) = 0;
|
||||
virtual void Stop(bool pause=true) = 0;
|
||||
virtual bool Playing() = 0;
|
||||
virtual bool AtEnd() = 0;
|
||||
virtual void SetPlayRate(float rate) = 0;
|
||||
virtual void SetTime(MusicTimeStamp time) = 0;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user