mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-16 08:34:10 +02:00
Move AudioIOBase::mPlaybackSchedule up into AudioIoCallback
This commit is contained in:
parent
d92a68f076
commit
9a66255013
@ -2587,6 +2587,16 @@ finished:
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double AudioIO::GetStreamTime()
|
||||||
|
{
|
||||||
|
// Track time readout for the main thread
|
||||||
|
|
||||||
|
if( !IsStreamActive() )
|
||||||
|
return BAD_STREAM_TIME;
|
||||||
|
|
||||||
|
return mPlaybackSchedule.NormalizeTrackTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
|
@ -576,6 +576,7 @@ protected:
|
|||||||
double Consumer( size_t nSamples, double rate );
|
double Consumer( size_t nSamples, double rate );
|
||||||
} mTimeQueue;
|
} mTimeQueue;
|
||||||
|
|
||||||
|
PlaybackSchedule mPlaybackSchedule;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AUDACITY_DLL_API AudioIO final
|
class AUDACITY_DLL_API AudioIO final
|
||||||
@ -715,6 +716,14 @@ public:
|
|||||||
* and playing is true if one or more channels are being played. */
|
* and playing is true if one or more channels are being played. */
|
||||||
double GetBestRate(bool capturing, bool playing, double sampleRate);
|
double GetBestRate(bool capturing, bool playing, double sampleRate);
|
||||||
|
|
||||||
|
/** \brief During playback, the track time most recently played
|
||||||
|
*
|
||||||
|
* When playing looped, this will start from t0 again,
|
||||||
|
* too. So the returned time should be always between
|
||||||
|
* t0 and t1
|
||||||
|
*/
|
||||||
|
double GetStreamTime();
|
||||||
|
|
||||||
friend class AudioThread;
|
friend class AudioThread;
|
||||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||||
friend class MidiThread;
|
friend class MidiThread;
|
||||||
|
@ -500,16 +500,6 @@ double AudioIOBase::PlaybackSchedule::NormalizeTrackTime() const
|
|||||||
return absoluteTime;
|
return absoluteTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
double AudioIOBase::GetStreamTime()
|
|
||||||
{
|
|
||||||
// Track time readout for the main thread
|
|
||||||
|
|
||||||
if( !IsStreamActive() )
|
|
||||||
return BAD_STREAM_TIME;
|
|
||||||
|
|
||||||
return mPlaybackSchedule.NormalizeTrackTime();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<long> AudioIOBase::GetSupportedPlaybackRates(int devIndex, double rate)
|
std::vector<long> AudioIOBase::GetSupportedPlaybackRates(int devIndex, double rate)
|
||||||
{
|
{
|
||||||
if (devIndex == -1)
|
if (devIndex == -1)
|
||||||
|
@ -195,14 +195,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
static int GetOptimalSupportedSampleRate();
|
static int GetOptimalSupportedSampleRate();
|
||||||
|
|
||||||
/** \brief During playback, the track time most recently played
|
|
||||||
*
|
|
||||||
* When playing looped, this will start from t0 again,
|
|
||||||
* too. So the returned time should be always between
|
|
||||||
* t0 and t1
|
|
||||||
*/
|
|
||||||
double GetStreamTime();
|
|
||||||
|
|
||||||
/** \brief Array of common audio sample rates
|
/** \brief Array of common audio sample rates
|
||||||
*
|
*
|
||||||
* These are the rates we will always support, regardless of hardware support
|
* These are the rates we will always support, regardless of hardware support
|
||||||
@ -454,7 +446,7 @@ protected:
|
|||||||
|
|
||||||
void RealTimeRestart();
|
void RealTimeRestart();
|
||||||
|
|
||||||
} mPlaybackSchedule;
|
};
|
||||||
|
|
||||||
/** \brief get the index of the supplied (named) recording device, or the
|
/** \brief get the index of the supplied (named) recording device, or the
|
||||||
* device selected in the preferences if none given.
|
* device selected in the preferences if none given.
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
#include "LyricsWindow.h"
|
#include "LyricsWindow.h"
|
||||||
#include "Lyrics.h"
|
#include "Lyrics.h"
|
||||||
#include "AudioIOBase.h"
|
#include "AudioIO.h"
|
||||||
#include "CommonCommandFlags.h"
|
#include "CommonCommandFlags.h"
|
||||||
#include "prefs/GUISettings.h" // for RTL_WORKAROUND
|
#include "prefs/GUISettings.h" // for RTL_WORKAROUND
|
||||||
#include "Project.h"
|
#include "Project.h"
|
||||||
@ -160,7 +160,7 @@ void LyricsWindow::OnTimer(wxCommandEvent &event)
|
|||||||
{
|
{
|
||||||
if (ProjectAudioIO::Get( *mProject ).IsAudioActive())
|
if (ProjectAudioIO::Get( *mProject ).IsAudioActive())
|
||||||
{
|
{
|
||||||
auto gAudioIO = AudioIOBase::Get();
|
auto gAudioIO = AudioIO::Get();
|
||||||
GetLyricsPanel()->Update(gAudioIO->GetStreamTime());
|
GetLyricsPanel()->Update(gAudioIO->GetStreamTime());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1353,7 +1353,7 @@ void MixerBoard::OnTimer(wxCommandEvent &event)
|
|||||||
// audacityAudioCallback where it calls gAudioIO->mOutputMeter->UpdateDisplay().
|
// audacityAudioCallback where it calls gAudioIO->mOutputMeter->UpdateDisplay().
|
||||||
if (ProjectAudioIO::Get( *mProject ).IsAudioActive())
|
if (ProjectAudioIO::Get( *mProject ).IsAudioActive())
|
||||||
{
|
{
|
||||||
auto gAudioIO = AudioIOBase::Get();
|
auto gAudioIO = AudioIO::Get();
|
||||||
UpdateMeters(
|
UpdateMeters(
|
||||||
gAudioIO->GetStreamTime(),
|
gAudioIO->GetStreamTime(),
|
||||||
(ProjectAudioManager::Get( *mProject ).GetLastPlayMode()
|
(ProjectAudioManager::Get( *mProject ).GetLastPlayMode()
|
||||||
|
@ -1075,7 +1075,7 @@ bool ProjectAudioManager::DoPlayStopSelect( bool click, bool shift )
|
|||||||
auto token = ProjectAudioIO::Get( project ).GetAudioIOToken();
|
auto token = ProjectAudioIO::Get( project ).GetAudioIOToken();
|
||||||
auto &viewInfo = ViewInfo::Get( project );
|
auto &viewInfo = ViewInfo::Get( project );
|
||||||
auto &selection = viewInfo.selectedRegion;
|
auto &selection = viewInfo.selectedRegion;
|
||||||
auto gAudioIO = AudioIOBase::Get();
|
auto gAudioIO = AudioIO::Get();
|
||||||
|
|
||||||
//If busy, stop playing, make sure everything is unpaused.
|
//If busy, stop playing, make sure everything is unpaused.
|
||||||
if (scrubber.HasMark() ||
|
if (scrubber.HasMark() ||
|
||||||
|
@ -13,6 +13,7 @@ Paul Licameli split from AudacityProject.cpp
|
|||||||
|
|
||||||
|
|
||||||
#include "AllThemeResources.h"
|
#include "AllThemeResources.h"
|
||||||
|
#include "AudioIO.h"
|
||||||
#include "Menus.h"
|
#include "Menus.h"
|
||||||
#include "Project.h"
|
#include "Project.h"
|
||||||
#include "ProjectAudioIO.h"
|
#include "ProjectAudioIO.h"
|
||||||
@ -1670,7 +1671,7 @@ void ProjectWindow::PlaybackScroller::OnTimer(wxCommandEvent &event)
|
|||||||
// Let other listeners get the notification
|
// Let other listeners get the notification
|
||||||
event.Skip();
|
event.Skip();
|
||||||
|
|
||||||
auto gAudioIO = AudioIOBase::Get();
|
auto gAudioIO = AudioIO::Get();
|
||||||
mRecentStreamTime = gAudioIO->GetStreamTime();
|
mRecentStreamTime = gAudioIO->GetStreamTime();
|
||||||
|
|
||||||
auto cleanup = finally([&]{
|
auto cleanup = finally([&]{
|
||||||
@ -1724,7 +1725,7 @@ void ProjectWindow::ZoomInByFactor( double ZoomFactor )
|
|||||||
auto &project = mProject;
|
auto &project = mProject;
|
||||||
auto &viewInfo = ViewInfo::Get( project );
|
auto &viewInfo = ViewInfo::Get( project );
|
||||||
|
|
||||||
auto gAudioIO = AudioIOBase::Get();
|
auto gAudioIO = AudioIO::Get();
|
||||||
// LLL: Handling positioning differently when audio is
|
// LLL: Handling positioning differently when audio is
|
||||||
// actively playing. Don't do this if paused.
|
// actively playing. Don't do this if paused.
|
||||||
if (gAudioIO->IsStreamActive(
|
if (gAudioIO->IsStreamActive(
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include "../AudioIOBase.h"
|
#include "../AudioIO.h"
|
||||||
#include "../Clipboard.h"
|
#include "../Clipboard.h"
|
||||||
#include "../CommonCommandFlags.h"
|
#include "../CommonCommandFlags.h"
|
||||||
#include "../LabelTrack.h"
|
#include "../LabelTrack.h"
|
||||||
@ -302,7 +302,7 @@ void OnAddLabelPlaying(const CommandContext &context)
|
|||||||
auto &project = context.project;
|
auto &project = context.project;
|
||||||
auto token = ProjectAudioIO::Get( project ).GetAudioIOToken();
|
auto token = ProjectAudioIO::Get( project ).GetAudioIOToken();
|
||||||
|
|
||||||
auto gAudioIO = AudioIOBase::Get();
|
auto gAudioIO = AudioIO::Get();
|
||||||
if (token > 0 &&
|
if (token > 0 &&
|
||||||
gAudioIO->IsStreamActive(token)) {
|
gAudioIO->IsStreamActive(token)) {
|
||||||
double indicator = gAudioIO->GetStreamTime();
|
double indicator = gAudioIO->GetStreamTime();
|
||||||
|
@ -504,7 +504,7 @@ void OnSetLeftSelection(const CommandContext &context)
|
|||||||
auto &window = GetProjectFrame( project );
|
auto &window = GetProjectFrame( project );
|
||||||
|
|
||||||
bool bSelChanged = false;
|
bool bSelChanged = false;
|
||||||
auto gAudioIO = AudioIOBase::Get();
|
auto gAudioIO = AudioIO::Get();
|
||||||
if ((token > 0) && gAudioIO->IsStreamActive(token))
|
if ((token > 0) && gAudioIO->IsStreamActive(token))
|
||||||
{
|
{
|
||||||
double indicator = gAudioIO->GetStreamTime();
|
double indicator = gAudioIO->GetStreamTime();
|
||||||
@ -543,7 +543,7 @@ void OnSetRightSelection(const CommandContext &context)
|
|||||||
auto &window = GetProjectFrame( project );
|
auto &window = GetProjectFrame( project );
|
||||||
|
|
||||||
bool bSelChanged = false;
|
bool bSelChanged = false;
|
||||||
auto gAudioIO = AudioIOBase::Get();
|
auto gAudioIO = AudioIO::Get();
|
||||||
if ((token > 0) && gAudioIO->IsStreamActive(token))
|
if ((token > 0) && gAudioIO->IsStreamActive(token))
|
||||||
{
|
{
|
||||||
double indicator = gAudioIO->GetStreamTime();
|
double indicator = gAudioIO->GetStreamTime();
|
||||||
|
@ -51,7 +51,7 @@ with changes in the SelectionBar.
|
|||||||
#include <wx/statline.h>
|
#include <wx/statline.h>
|
||||||
|
|
||||||
|
|
||||||
#include "../AudioIOBase.h"
|
#include "../AudioIO.h"
|
||||||
#include "../AColor.h"
|
#include "../AColor.h"
|
||||||
#include "../KeyboardCapture.h"
|
#include "../KeyboardCapture.h"
|
||||||
#include "../Prefs.h"
|
#include "../Prefs.h"
|
||||||
@ -599,7 +599,7 @@ void SelectionBar::OnIdle( wxIdleEvent &evt )
|
|||||||
|
|
||||||
auto &projectAudioIO = ProjectAudioIO::Get( project );
|
auto &projectAudioIO = ProjectAudioIO::Get( project );
|
||||||
if ( projectAudioIO.IsAudioActive() ){
|
if ( projectAudioIO.IsAudioActive() ){
|
||||||
auto gAudioIO = AudioIOBase::Get();
|
auto gAudioIO = AudioIO::Get();
|
||||||
audioTime = gAudioIO->GetStreamTime();
|
audioTime = gAudioIO->GetStreamTime();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -362,7 +362,7 @@ void TimeToolBar::OnIdle(wxIdleEvent &evt)
|
|||||||
|
|
||||||
auto &projectAudioIO = ProjectAudioIO::Get(mProject);
|
auto &projectAudioIO = ProjectAudioIO::Get(mProject);
|
||||||
if (projectAudioIO.IsAudioActive()) {
|
if (projectAudioIO.IsAudioActive()) {
|
||||||
auto gAudioIO = AudioIOBase::Get();
|
auto gAudioIO = AudioIO::Get();
|
||||||
audioTime = gAudioIO->GetStreamTime();
|
audioTime = gAudioIO->GetStreamTime();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1139,7 +1139,7 @@ void Scrubber::DoKeyboardScrub(bool backwards, bool keyUp)
|
|||||||
if (keyUp) {
|
if (keyUp) {
|
||||||
auto &scrubber = Scrubber::Get(project);
|
auto &scrubber = Scrubber::Get(project);
|
||||||
if (scrubber.IsKeyboardScrubbing() && scrubber.IsBackwards() == backwards) {
|
if (scrubber.IsKeyboardScrubbing() && scrubber.IsBackwards() == backwards) {
|
||||||
auto gAudioIO = AudioIOBase::Get();
|
auto gAudioIO = AudioIO::Get();
|
||||||
auto time = gAudioIO->GetStreamTime();
|
auto time = gAudioIO->GetStreamTime();
|
||||||
auto &viewInfo = ViewInfo::Get(project);
|
auto &viewInfo = ViewInfo::Get(project);
|
||||||
auto &selection = viewInfo.selectedRegion;
|
auto &selection = viewInfo.selectedRegion;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user