[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Traverso-commit] traverso/src core/Song.cpp core/Song.h core/Tra...
From: |
Remon Sijrier |
Subject: |
[Traverso-commit] traverso/src core/Song.cpp core/Song.h core/Tra... |
Date: |
Fri, 12 Oct 2007 08:52:14 +0000 |
CVSROOT: /sources/traverso
Module name: traverso
Changes by: Remon Sijrier <r_sijrier> 07/10/12 08:52:14
Modified files:
src/core : Song.cpp Song.h Track.cpp Track.h
src/engine : AudioDevice.cpp AudioDevice.h
AudioDeviceThread.cpp
Log message:
* revert playback bus selection for Tracks, need to rethink this the
solution, it sometimes make Traverso crash when changing the audiodevice
parameters
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Song.cpp?cvsroot=traverso&r1=1.145&r2=1.146
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Song.h?cvsroot=traverso&r1=1.69&r2=1.70
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Track.cpp?cvsroot=traverso&r1=1.68&r2=1.69
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Track.h?cvsroot=traverso&r1=1.32&r2=1.33
http://cvs.savannah.gnu.org/viewcvs/traverso/src/engine/AudioDevice.cpp?cvsroot=traverso&r1=1.40&r2=1.41
http://cvs.savannah.gnu.org/viewcvs/traverso/src/engine/AudioDevice.h?cvsroot=traverso&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/traverso/src/engine/AudioDeviceThread.cpp?cvsroot=traverso&r1=1.19&r2=1.20
Patches:
Index: core/Song.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/Song.cpp,v
retrieving revision 1.145
retrieving revision 1.146
diff -u -b -r1.145 -r1.146
--- core/Song.cpp 10 Oct 2007 16:41:57 -0000 1.145
+++ core/Song.cpp 12 Oct 2007 08:52:13 -0000 1.146
@@ -111,6 +111,7 @@
delete [] gainbuffer;
delete m_diskio;
+ delete m_masterOut;
delete m_renderBus;
delete m_hs;
delete m_audiodeviceClient;
@@ -130,6 +131,7 @@
connect(this, SIGNAL(seekStart()), m_diskio, SLOT(seek()),
Qt::QueuedConnection);
connect(this, SIGNAL(prepareRecording()), this,
SLOT(prepare_recording()));
connect(&audiodevice(), SIGNAL(clientRemoved(Client*)), this, SLOT
(audiodevice_client_removed(Client*)));
+ connect(&audiodevice(), SIGNAL(started()), this,
SLOT(audiodevice_started()));
connect(&audiodevice(), SIGNAL(driverParamsChanged()), this,
SLOT(audiodevice_params_changed()), Qt::DirectConnection);
connect(m_diskio, SIGNAL(seekFinished()), this, SLOT(seek_finished()),
Qt::QueuedConnection);
connect (m_diskio, SIGNAL(readSourceBufferUnderRun()), this,
SLOT(handle_diskio_readbuffer_underrun()));
@@ -137,12 +139,8 @@
connect(this, SIGNAL(transferStarted()), m_diskio, SLOT(start_io()));
connect(this, SIGNAL(transferStopped()), m_diskio, SLOT(stop_io()));
- m_playBackBus = 0;
- m_masterOut = 0;
- // Not entirely true, but this assigns the playback bus!
- assign_buses();
-
mixdown = gainbuffer = 0;
+ m_masterOut = new AudioBus("Master Out", 2);
m_renderBus = new AudioBus("Render Bus", 2);
resize_buffer(false, audiodevice().get_buffer_size());
m_hs = new QUndoStack(pm().get_undogroup());
@@ -151,6 +149,8 @@
set_context_item( m_acmanager );
+ m_playBackBus = audiodevice().get_playback_bus("Playback 1");
+
m_transport = m_stopTransport = m_resumeTransport = m_readyToRecord =
false;
snaplist = new SnapList(this);
workSnap = new Snappable();
@@ -770,14 +770,10 @@
return 0;
}
- for (int chan=0; chan<m_masterOut->get_channel_count(); ++chan) {
- Mixer::apply_gain_to_buffer(m_masterOut->get_buffer(chan,
nframes), nframes, get_gain());
- }
-
// Mix the result into the AudioDevice "physical" buffers
if (m_playBackBus) {
- Mixer::mix_buffers_no_gain(m_playBackBus->get_buffer(0,
nframes), m_masterOut->get_buffer(0, nframes), nframes);
- Mixer::mix_buffers_no_gain(m_playBackBus->get_buffer(1,
nframes), m_masterOut->get_buffer(1, nframes), nframes);
+ Mixer::mix_buffers_with_gain(m_playBackBus->get_buffer(0,
nframes), m_masterOut->get_buffer(0, nframes), nframes, get_gain());
+ Mixer::mix_buffers_with_gain(m_playBackBus->get_buffer(1,
nframes), m_masterOut->get_buffer(1, nframes), nframes, get_gain());
m_pluginChain->process_post_fader(m_masterOut, nframes);
}
@@ -941,25 +937,8 @@
}
}
-void Song::assign_buses()
-{
- if (m_masterOut) {
-// m_masterOut->set_monitor_peaks(false);
- }
- m_playBackBus = audiodevice().get_playback_bus("Playback 1");
- m_masterOut = audiodevice().get_playback_bus("Master Out");
- if (m_masterOut) {
- m_masterOut->set_monitor_peaks(true);
- }
- foreach(Track* track, m_tracks) {
- track->assign_buses();
- }
-}
-
void Song::audiodevice_params_changed()
{
- assign_buses();
-
resize_buffer(true, audiodevice().get_buffer_size());
// The samplerate possibly has been changed, this initiates
@@ -1042,6 +1021,11 @@
}
}
+void Song::audiodevice_started( )
+{
+ m_playBackBus = audiodevice().get_playback_bus("Playback 1");
+}
+
const TimeRef& Song::get_last_location() const
{
return m_acmanager->get_last_location();
@@ -1350,3 +1334,4 @@
}
+// eof
Index: core/Song.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/Song.h,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -b -r1.69 -r1.70
--- core/Song.h 8 Oct 2007 20:46:48 -0000 1.69
+++ core/Song.h 12 Oct 2007 08:52:13 -0000 1.70
@@ -209,7 +209,6 @@
void start_seek();
void start_transport_rolling(bool realtime);
void stop_transport_rolling();
- void assign_buses();
void resize_buffer(bool updateArmStatus, nframes_t size);
@@ -220,6 +219,7 @@
public slots :
void seek_finished();
void audiodevice_client_removed(Client* );
+ void audiodevice_started();
void audiodevice_params_changed();
void set_gain(float gain);
Index: core/Track.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/Track.cpp,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -b -r1.68 -r1.69
--- core/Track.cpp 10 Oct 2007 16:41:57 -0000 1.68
+++ core/Track.cpp 12 Oct 2007 08:52:13 -0000 1.69
@@ -52,11 +52,10 @@
m_sortIndex = -1;
m_id = create_id();
- init();
+ busIn = "Capture 1";
+ busOut = "MasterOut";
- m_busInName = "Capture 1";
- m_busOutName = "Master Out";
- set_bus_out(m_busOutName);
+ init();
}
Track::Track( Song * song, const QDomNode node)
@@ -81,8 +80,7 @@
m_pluginChain = new PluginChain(this, m_song);
m_fader = m_pluginChain->get_fader();
m_fader->set_gain(1.0);
- m_captureRightChannel = m_captureLeftChannel = m_playbackRightChannel =
m_playbackLeftChannel = true;
- m_outBus = 0;
+ m_captureRightChannel = m_captureLeftChannel = true;
}
QDomNode Track::get_state( QDomDocument doc, bool istemplate)
@@ -99,12 +97,10 @@
node.setAttribute("height", m_height);
node.setAttribute("sortindex", m_sortIndex);
node.setAttribute("numtakes", numtakes);
- node.setAttribute("InBus", m_busInName.data());
- node.setAttribute("OutBus", m_busOutName.data());
+ node.setAttribute("InBus", busIn.data());
+ node.setAttribute("OutBus", busOut.data());
node.setAttribute("CaptureLeftChannel", m_captureLeftChannel);
node.setAttribute("CaptureRightChannel", m_captureRightChannel);
- node.setAttribute("PlaybackLeftChannel", m_playbackLeftChannel);
- node.setAttribute("PlaybackRightChannel", m_playbackRightChannel);
if (! istemplate ) {
QDomNode clips = doc.createElement("Clips");
@@ -153,17 +149,10 @@
numtakes = e.attribute( "numtakes", "").toInt();
m_captureRightChannel = e.attribute("CaptureRightChannel", "1").toInt();
m_captureLeftChannel = e.attribute("CaptureLeftChannel", "1").toInt();
- m_playbackRightChannel = e.attribute("PlaybackRightChannel",
"1").toInt();
- m_playbackLeftChannel = e.attribute("PlaybackLeftChannel",
"1").toInt();
-
// never ever allow both to be 0 at the same time!
if ( ! (m_captureRightChannel || m_captureLeftChannel) ) {
m_captureRightChannel = m_captureLeftChannel = 1;
}
- // never ever allow both to be 0 at the same time!
- if ( ! (m_playbackRightChannel || m_playbackLeftChannel) ) {
- m_playbackRightChannel = m_playbackLeftChannel = 1;
- }
QDomElement ClipsNode = node.firstChildElement("Clips");
if (!ClipsNode.isNull()) {
@@ -253,7 +242,7 @@
{
PENTER;
set_armed(true);
- AudioBus* bus = audiodevice().get_capture_bus(m_busInName);
+ AudioBus* bus = audiodevice().get_capture_bus(busIn);
if (bus) {
bus->set_monitor_peaks(true);
}
@@ -265,7 +254,7 @@
{
PENTER;
set_armed(false);
- AudioBus* bus = audiodevice().get_capture_bus(m_busInName);
+ AudioBus* bus = audiodevice().get_capture_bus(busIn);
if (bus) {
bus->set_monitor_peaks(false);
}
@@ -277,7 +266,7 @@
bool wasArmed=isArmed;
if (isArmed)
disarm();
- m_busInName=bus;
+ busIn=bus;
if (wasArmed) {
arm();
}
@@ -287,39 +276,10 @@
void Track::set_bus_out(QByteArray bus)
{
- PENTER;
- AudioBus* newbus = audiodevice().get_playback_bus(bus);
- if (newbus) {
- newbus->set_monitor_peaks(true);
- } else {
- info().warning(tr("Track: Cannot assign OutBus to %1, it does
not exist!").arg(bus.data()));
- }
-
- if (m_outBus && !(m_busOutName.data() == QString("Out Bus"))) {
- m_outBus->set_monitor_peaks(false);
- }
-
- m_busOutName=bus;
-
- if (m_song->is_transport_rolling()) {
- THREAD_SAVE_INVOKE(this, newbus,
private_assign_out_bus(AudioBus*));
- } else {
- private_assign_out_bus(newbus);
- }
-
+ busOut=bus;
emit outBusChanged();
}
-void Track::private_assign_out_bus(AudioBus* bus)
-{
- PENTER;
- m_outBus = bus;
- // fallback to master out if bus does not exist!
- if (!m_outBus) {
- m_outBus = m_song->get_master_out();
- }
-}
-
bool Track::is_solo()
{
return isSolo;
@@ -360,7 +320,7 @@
clip->set_track(this);
clip->set_track_start_location(m_song->get_transport_location());
- if (clip->init_recording(m_busInName) < 0) {
+ if (clip->init_recording(busIn) < 0) {
PERROR("Could not create AudioClip to record to!");
resources_manager()->destroy_clip(clip);
return 0;
@@ -498,7 +458,7 @@
processResult |= m_pluginChain->process_post_fader(bus, nframes);
for (int i=0; i<bus->get_channel_count(); ++i) {
- Mixer::mix_buffers_no_gain(m_outBus->get_buffer(i, nframes),
bus->get_buffer(i, nframes), nframes);
+
Mixer::mix_buffers_no_gain(m_song->get_master_out()->get_buffer(i, nframes),
bus->get_buffer(i, nframes), nframes);
}
return processResult;
@@ -606,19 +566,5 @@
emit inBusChanged();
}
-void Track::set_playback_right_channel(bool play)
-{
- m_playbackRightChannel = play;
- emit outBusChanged();
-}
-
-void Track::set_playback_left_channel(bool play)
-{
- m_playbackLeftChannel = play;
- emit outBusChanged();
-}
+// eof
-void Track::assign_buses( )
-{
- set_bus_out(m_busOutName);
-}
Index: core/Track.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/Track.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- core/Track.h 8 Oct 2007 20:46:49 -0000 1.32
+++ core/Track.h 12 Oct 2007 08:52:13 -0000 1.33
@@ -38,7 +38,6 @@
class Song;
class PluginChain;
class Plugin;
-class AudioBus;
class Track : public ContextItem
{
@@ -70,8 +69,8 @@
AudioClip* get_clip_after(const TimeRef& pos);
AudioClip* get_clip_before(const TimeRef& pos);
void get_render_range(TimeRef& startlocation, TimeRef& endlocation);
- QString get_bus_in() const {return m_busInName;}
- QString get_bus_out() const{return m_busOutName;}
+ QString get_bus_in() const {return busIn;}
+ QString get_bus_out() const{return busOut;}
int get_height() const {return m_height;}
float get_pan() const {return m_pan;}
Song* get_song() const {return m_song;}
@@ -95,8 +94,6 @@
void set_height(int h);
void set_capture_left_channel(bool capture);
void set_capture_right_channel(bool capture);
- void set_playback_right_channel(bool play);
- void set_playback_left_channel(bool play);
int set_state( const QDomNode& node );
@@ -105,27 +102,29 @@
bool is_muted_by_solo();
bool is_solo();
bool armed();
- bool capture_left_channel() {return m_captureLeftChannel;}
- bool capture_right_channel() {return m_captureRightChannel;}
- bool playback_left_channel() {return m_playbackLeftChannel;}
- bool playback_right_channel() {return m_playbackRightChannel;}
+ bool capture_left_channel()
+ {
+ return m_captureLeftChannel;
+ }
+ bool capture_right_channel()
+ {
+ return m_captureRightChannel;
+ }
// End bool functions
int process(nframes_t nframes);
- void assign_buses();
private :
Song* m_song;
AudioClipList audioClipList;
PluginChain* m_pluginChain;
- AudioBus* m_outBus;
GainEnvelope* m_fader;
float m_pan;
int numtakes;
- QByteArray m_busInName;
- QByteArray m_busOutName;
+ QByteArray busIn;
+ QByteArray busOut;
QString m_name;
@@ -138,8 +137,6 @@
bool mutedBySolo;
bool m_captureLeftChannel;
bool m_captureRightChannel;
- bool m_playbackRightChannel;
- bool m_playbackLeftChannel;
void set_armed(bool armed);
void init();
@@ -172,7 +169,6 @@
private slots:
void private_add_clip(AudioClip* clip);
void private_remove_clip(AudioClip* clip);
- void private_assign_out_bus(AudioBus* bus);
};
Index: engine/AudioDevice.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/engine/AudioDevice.cpp,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -b -r1.40 -r1.41
--- engine/AudioDevice.cpp 8 Oct 2007 20:46:49 -0000 1.40
+++ engine/AudioDevice.cpp 12 Oct 2007 08:52:13 -0000 1.41
@@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-$Id: AudioDevice.cpp,v 1.40 2007/10/08 20:46:49 r_sijrier Exp $
+$Id: AudioDevice.cpp,v 1.41 2007/10/12 08:52:13 r_sijrier Exp $
*/
#include "AudioDevice.h"
@@ -117,7 +117,7 @@
AudioBus* playbackBus =
audiodevice().get_playback_bus("Playback 1");
// Just copy the captured audio to the playback buses.
- for (int i=0; i<m_captureBuses->get_channel_count(); ++i) {
+ for (int i=0; i<captureBuses->get_channel_count(); ++i) {
memcpy(captureBus->get_channel(i)->get_buffer(nframes),
playbackBus->get_channel(i)->get_buffer(nframes), nframes);
}
@@ -141,8 +141,8 @@
AudioDevice::AudioDevice()
{
m_runAudioThread = false;
- m_driver = 0;
- m_audioThread = 0;
+ driver = 0;
+ audioThread = 0;
m_bufferSize = 1024;
m_xrunCount = 0;
m_cpuTime = new RingBufferNPT<trav_time_t>(4096);
@@ -151,19 +151,19 @@
#if defined (JACK_SUPPORT)
if (libjack_is_present) {
- m_availableDrivers << "Jack";
+ availableDrivers << "Jack";
}
#endif
#if defined (ALSA_SUPPORT)
- m_availableDrivers << "ALSA";
+ availableDrivers << "ALSA";
#endif
#if defined (PORTAUDIO_SUPPORT)
- m_availableDrivers << "PortAudio";
+ availableDrivers << "PortAudio";
#endif
- m_availableDrivers << "Null Driver";
+ availableDrivers << "Null Driver";
// tsar is a singleton, so initialization is done on first tsar() call
// Tsar makes use of a QTimer to cleanup the processed events.
@@ -185,8 +185,8 @@
shutdown();
- if (m_audioThread) {
- delete m_audioThread;
+ if (audioThread) {
+ delete audioThread;
}
delete m_cpuTime;
@@ -196,18 +196,18 @@
void AudioDevice::free_memory()
{
- foreach(AudioBus* bus, m_captureBuses) {
+ foreach(AudioBus* bus, captureBuses) {
delete bus;
}
- foreach(AudioBus* bus, m_playbackBuses) {
+ foreach(AudioBus* bus, playbackBuses) {
delete bus;
}
- m_captureChannels.clear();
- m_playbackChannels.clear();
- m_captureBuses.clear();
- m_playbackBuses.clear();
+ captureChannels.clear();
+ playbackChannels.clear();
+ captureBuses.clear();
+ playbackBuses.clear();
}
/**
@@ -260,18 +260,18 @@
int AudioDevice::run_one_cycle( nframes_t nframes, float )
{
- if (m_driver->read(nframes) < 0) {
+ if (driver->read(nframes) < 0) {
qDebug("driver read failed!");
return -1;
}
- for (int i=0; i<m_clients.size(); ++i) {
- if (m_clients.at(i)->process(nframes) < 0) {
+ for (int i=0; i<clients.size(); ++i) {
+ if (clients.at(i)->process(nframes) < 0) {
// ?
}
}
- if (m_driver->write(nframes) < 0) {
+ if (driver->write(nframes) < 0) {
qDebug("driver write failed!");
return -1;
}
@@ -280,16 +280,6 @@
return 0;
}
-void AudioDevice::post_process( )
-{
- foreach(AudioBus* bus, m_virtualPlaybackBuses) {
- if (bus->is_monitoring_peaks()) {
- bus->monitor_peaks();
- }
- }
- tsar().process_events();
-}
-
void AudioDevice::delay( float )
{
}
@@ -300,7 +290,7 @@
*/
uint AudioDevice::capture_buses_count( ) const
{
- return m_captureChannels.size();
+ return captureChannels.size();
}
/**
@@ -309,11 +299,11 @@
*/
uint AudioDevice::playback_buses_count( ) const
{
- return m_playbackChannels.size();
+ return playbackChannels.size();
}
/**
- * This function is used to initialize the AudioDevice's m_audioThread with
the supplied
+ * This function is used to initialize the AudioDevice's audioThread with the
supplied
* rate, bufferSize and driver type. In case the AudioDevice allready was
configured,
* it will stop the AudioDeviceThread and emits the stopped() signal,
* re-inits the AlsaDriver with the new paramaters, when succesfull emits the
driverParamsChanged() signal,
@@ -343,17 +333,12 @@
return;
}
- m_driver->attach();
+ driver->attach();
setup_buses();
emit driverParamsChanged();
- // It could be possible that one of our clients used Tsar to get/set
AudioBuses
- // after the driverParamsChanged() signal, so we have to process those
events first
- // before restarting!
- tsar().process_events();
-
m_runAudioThread = 1;
if ((driverType == "ALSA") || (driverType == "Null Driver")) {
@@ -361,25 +346,25 @@
printf("Starting AudioDeviceThread..... ");
- if (!m_audioThread) {
- m_audioThread = new AudioDeviceThread(this);
+ if (!audioThread) {
+ audioThread = new AudioDeviceThread(this);
}
// m_cycleStartTime/EndTime are set before/after the first
cycle.
- // to avoid a "100%" cpu usage value during m_audioThread
startup, set the
+ // to avoid a "100%" cpu usage value during audioThread
startup, set the
// m_cycleStartTime here!
m_cycleStartTime = get_microseconds();
// When the audiothread fails for some reason we catch it in
audiothread_finished()
// by connecting the finished signal of the audio thread!
- connect(m_audioThread, SIGNAL(finished()), this,
SLOT(audiothread_finished()));
+ connect(audioThread, SIGNAL(finished()), this,
SLOT(audiothread_finished()));
// Start the audio thread, the driver->start() will be called
from there!!
- m_audioThread->start();
+ audioThread->start();
// It appears this check is a little silly because it always
returns true
// this close after calling the QThread::start() function :-(
- if (m_audioThread->isRunning()) {
+ if (audioThread->isRunning()) {
printf("Running!\n");
}
}
@@ -389,19 +374,19 @@
if (libjack_is_present) {
if (driverType == "Jack") {
- if (m_driver->start() == -1) {
+ if (driver->start() == -1) {
// jack driver failed to start, fallback to
Null Driver:
set_parameters(rate, bufferSize, "Null Driver");
}
- connect(&m_jackShutDownChecker, SIGNAL(timeout()),
this, SLOT(check_jack_shutdown()));
- m_jackShutDownChecker.start(500);
+ connect(&jackShutDownChecker, SIGNAL(timeout()), this,
SLOT(check_jack_shutdown()));
+ jackShutDownChecker.start(500);
}
}
#endif
if (driverType == "PortAudio") {
- if (m_driver->start() == -1) {
+ if (driver->start() == -1) {
// PortAudio driver failed to start, fallback to Null
Driver:
set_parameters(rate, bufferSize, "Null Driver");
}
@@ -416,11 +401,11 @@
#if defined (JACK_SUPPORT)
if (libjack_is_present) {
if (driverType == "Jack") {
- m_driver = new JackDriver(this, m_rate, m_bufferSize);
- if (m_driver->setup(capture, playback) < 0) {
+ driver = new JackDriver(this, m_rate, m_bufferSize);
+ if (driver->setup(capture, playback) < 0) {
info().warning(tr("Audiodevice: Failed to
create the Jack Driver"));
- delete m_driver;
- m_driver = 0;
+ delete driver;
+ driver = 0;
return -1;
}
m_driverType = driverType;
@@ -431,11 +416,11 @@
#if defined (ALSA_SUPPORT)
if (driverType == "ALSA") {
- m_driver = new AlsaDriver(this, m_rate, m_bufferSize);
- if (m_driver->setup(capture,playback, cardDevice) < 0) {
+ driver = new AlsaDriver(this, m_rate, m_bufferSize);
+ if (driver->setup(capture,playback, cardDevice) < 0) {
info().warning(tr("Audiodevice: Failed to create the
ALSA Driver"));
- delete m_driver;
- m_driver = 0;
+ delete driver;
+ driver = 0;
return -1;
}
m_driverType = driverType;
@@ -445,11 +430,11 @@
#if defined (PORTAUDIO_SUPPORT)
if (driverType == "PortAudio") {
- m_driver = new PADriver(this, m_rate, m_bufferSize);
- if (m_driver->setup(capture, playback, cardDevice) < 0) {
+ driver = new PADriver(this, m_rate, m_bufferSize);
+ if (driver->setup(capture, playback, cardDevice) < 0) {
info().warning(tr("Audiodevice: Failed to create the
PortAudio Driver"));
- delete m_driver;
- m_driver = 0;
+ delete driver;
+ driver = 0;
return -1;
}
m_driverType = driverType;
@@ -459,7 +444,7 @@
if (driverType == "Null Driver") {
printf("Creating Null Driver...\n");
- m_driver = new Driver(this, m_rate, m_bufferSize);
+ driver = new Driver(this, m_rate, m_bufferSize);
m_driverType = driverType;
return 1;
}
@@ -471,14 +456,14 @@
AudioChannel* AudioDevice::register_capture_channel(const QByteArray&
chanName, const QString& audioType, int flags, uint , uint channel )
{
AudioChannel* chan = new AudioChannel(chanName, audioType, flags,
channel);
- m_captureChannels.insert(chanName, chan);
+ captureChannels.insert(chanName, chan);
return chan;
}
AudioChannel* AudioDevice::register_playback_channel(const QByteArray&
chanName, const QString& audioType, int flags, uint , uint channel )
{
AudioChannel* chan = new AudioChannel(chanName, audioType, flags,
channel);
- m_playbackChannels.insert(chanName, chan);
+ playbackChannels.insert(chanName, chan);
return chan;
}
@@ -502,23 +487,23 @@
m_runAudioThread = 0;
- if (m_audioThread) {
- disconnect(m_audioThread, SIGNAL(finished()), this,
SLOT(audiothread_finished()));
+ if (audioThread) {
+ disconnect(audioThread, SIGNAL(finished()), this,
SLOT(audiothread_finished()));
- // Wait until the m_audioThread has finished execution. One
second
+ // Wait until the audioThread has finished execution. One second
// should do, if it's still running then, the thread must have
gone wild or something....
- if (m_audioThread->isRunning()) {
+ if (audioThread->isRunning()) {
printf("Starting to shutdown AudioThread..\n");
- r = m_audioThread->wait(1000);
+ r = audioThread->wait(1000);
printf("AudioDeviceThread finished, stopping driver\n");
}
}
- if (m_driver) {
- m_driver->stop();
- delete m_driver;
- m_driver = 0;
+ if (driver) {
+ driver->stop();
+ delete driver;
+ driver = 0;
}
free_memory();
@@ -536,10 +521,9 @@
QStringList AudioDevice::get_capture_buses_names( ) const
{
QStringList names;
- foreach(AudioBus* bus, m_captureBuses) {
+ foreach(AudioBus* bus, captureBuses) {
names.append(bus->get_name());
}
- names.sort();
return names;
}
@@ -553,13 +537,9 @@
QStringList AudioDevice::get_playback_buses_names( ) const
{
QStringList names;
- foreach(AudioBus* bus, m_playbackBuses) {
- names.append(bus->get_name());
- }
- foreach(AudioBus* bus, m_virtualPlaybackBuses) {
+ foreach(AudioBus* bus, playbackBuses) {
names.append(bus->get_name());
}
- names.sort();
return names;
}
@@ -568,33 +548,25 @@
int number = 1;
QByteArray name;
- for (int i=1; i <= m_captureChannels.size();) {
+ for (int i=1; i <= captureChannels.size();) {
name = "Capture " + QByteArray::number(number++);
AudioBus* bus = new AudioBus(name);
-
bus->add_channel(m_captureChannels.value("capture_"+QByteArray::number(i++)));
-
bus->add_channel(m_captureChannels.value("capture_"+QByteArray::number(i++)));
- m_captureBuses.insert(name, bus);
+
bus->add_channel(captureChannels.value("capture_"+QByteArray::number(i++)));
+
bus->add_channel(captureChannels.value("capture_"+QByteArray::number(i++)));
+ captureBuses.insert(name, bus);
}
-// PWARN("Capture buses count is: %d", m_captureBuses.size());
+// PWARN("Capture buses count is: %d", captureBuses.size());
number = 1;
- for (int i=1; i <= m_playbackChannels.size();) {
+ for (int i=1; i <= playbackChannels.size();) {
name = "Playback " + QByteArray::number(number++);
AudioBus* bus = new AudioBus(name);
-
bus->add_channel(m_playbackChannels.value("playback_"+QByteArray::number(i++)));
-
bus->add_channel(m_playbackChannels.value("playback_"+QByteArray::number(i++)));
- m_playbackBuses.insert(name, bus);
- }
-
- // This virtual bus is highly likely used all the time, so we create it
beforehand
- create_virtual_playback_bus("Master Out", 2);
-
- foreach(AudioBus* bus, m_virtualPlaybackBuses) {
- bus->set_buffer_size(m_bufferSize);
+
bus->add_channel(playbackChannels.value("playback_"+QByteArray::number(i++)));
+
bus->add_channel(playbackChannels.value("playback_"+QByteArray::number(i++)));
+ playbackBuses.insert(name, bus);
}
-
-// PWARN("Playback buses count is: %d", m_playbackBuses.size());
+// PWARN("Playback buses count is: %d", playbackBuses.size());
}
/**
@@ -622,8 +594,8 @@
*/
QString AudioDevice::get_device_name( ) const
{
- if (m_driver)
- return m_driver->get_device_name();
+ if (driver)
+ return driver->get_device_name();
return tr("No Device Configured");
}
@@ -633,8 +605,8 @@
*/
QString AudioDevice::get_device_longname( ) const
{
- if (m_driver)
- return m_driver->get_device_longname();
+ if (driver)
+ return driver->get_device_longname();
return tr("No Device Configured");
}
@@ -644,7 +616,7 @@
*/
QStringList AudioDevice::get_available_drivers( ) const
{
- return m_availableDrivers;
+ return availableDrivers;
}
/**
@@ -664,13 +636,13 @@
{
#if defined (JACK_SUPPORT)
if (libjack_is_present)
- if (m_driver && m_driverType == "Jack")
- return ((JackDriver*)m_driver)->get_cpu_load();
+ if (driver && m_driverType == "Jack")
+ return ((JackDriver*)driver)->get_cpu_load();
#endif
#if defined (PORTAUDIO_SUPPORT)
- if (m_driver && m_driverType == "PortAudio")
- return ((PADriver*)m_driver)->get_cpu_load();
+ if (driver && m_driverType == "PortAudio")
+ return ((PADriver*)driver)->get_cpu_load();
#endif
@@ -691,18 +663,23 @@
return result;
}
+void AudioDevice::post_process( )
+{
+ tsar().process_events();
+}
+
void AudioDevice::private_add_client(Client* client)
{
// printf("Adding client %s\n", client->m_name.toAscii().data());
- m_clients.append(client);
+ clients.append(client);
}
void AudioDevice::private_remove_client(Client* client)
{
- int index = m_clients.indexOf(client);
+ int index = clients.indexOf(client);
if (index >= 0) {
- m_clients.removeAt( index );
+ clients.removeAt( index );
}
// printf("Removing client %s\n", client->m_name.toAscii().data());
@@ -731,7 +708,7 @@
void AudioDevice::mili_sleep(int msec)
{
- m_audioThread->mili_sleep(msec);
+ audioThread->mili_sleep(msec);
}
@@ -760,14 +737,14 @@
void AudioDevice::check_jack_shutdown()
{
if (libjack_is_present) {
- JackDriver* jackdriver = qobject_cast<JackDriver*>(m_driver);
+ JackDriver* jackdriver = qobject_cast<JackDriver*>(driver);
if (jackdriver) {
if ( ! jackdriver->is_jack_running()) {
- m_jackShutDownChecker.stop();
+ jackShutDownChecker.stop();
printf("jack shutdown detected\n");
info().critical(tr("The Jack server has been
shutdown!"));
- delete m_driver;
- m_driver = 0;
+ delete driver;
+ driver = 0;
set_parameters(44100, m_bufferSize, "Null
Driver");
}
}
@@ -792,8 +769,8 @@
#endif
int result = 0;
- for (int i=0; i<m_clients.size(); ++i) {
- result = m_clients.at(i)->transport_control(state);
+ for (int i=0; i<clients.size(); ++i) {
+ result = clients.at(i)->transport_control(state);
}
return result;
}
@@ -865,7 +842,7 @@
JackDriver* AudioDevice::slaved_jack_driver()
{
if (libjack_is_present) {
- JackDriver* jackdriver = qobject_cast<JackDriver*>(m_driver);
+ JackDriver* jackdriver = qobject_cast<JackDriver*>(driver);
if (jackdriver && jackdriver->is_slave()) {
return jackdriver;
}
@@ -875,23 +852,5 @@
}
#endif
-AudioBus* AudioDevice::create_virtual_playback_bus(QByteArray name, int
channelcount)
-{
- AudioBus* bus = m_virtualPlaybackBuses.value(name);
-
- if (! bus) {
- bus = new AudioBus(name, channelcount);
- bus->set_buffer_size(m_bufferSize);
- m_virtualPlaybackBuses.insert(name, bus);
- }
-
- return bus;
-}
-
-AudioBus * AudioDevice::get_playback_bus(QByteArray name) const
-{
- AudioBus* bus = m_playbackBuses.value(name);
- if (!bus) bus = m_virtualPlaybackBuses.value(name);
- return bus;
-}
+//eof
Index: engine/AudioDevice.h
===================================================================
RCS file: /sources/traverso/traverso/src/engine/AudioDevice.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- engine/AudioDevice.h 8 Oct 2007 20:46:49 -0000 1.21
+++ engine/AudioDevice.h 12 Oct 2007 08:52:13 -0000 1.22
@@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-$Id: AudioDevice.h,v 1.21 2007/10/08 20:46:49 r_sijrier Exp $
+$Id: AudioDevice.h,v 1.22 2007/10/12 08:52:13 r_sijrier Exp $
*/
#ifndef AUDIODEVICE_H
@@ -71,7 +71,10 @@
* @param name The name of the Playback Bus
* @return An AudioBus if one exists with name \a name, 0 on failure
*/
- AudioBus* get_playback_bus(QByteArray name) const;
+ AudioBus* get_playback_bus(QByteArray name) const
+ {
+ return playbackBuses.value(name);
+ }
/**
* Get the Capture AudioBus instance with name \a name.
@@ -83,12 +86,11 @@
* @param name The name of the Capture Bus
* @return An AudioBus if one exists with name \a name, 0 on failure
*/
- AudioBus* get_capture_bus(QByteArray name) const {
- return m_captureBuses.value(name);
+ AudioBus* get_capture_bus(QByteArray name) const
+ {
+ return captureBuses.value(name);
}
- AudioBus* create_virtual_playback_bus(QByteArray name, int
channelcount);
-
QStringList get_capture_buses_names() const;
QStringList get_playback_buses_names() const;
@@ -137,19 +139,17 @@
friend class AudioDeviceThread;
- Driver* m_driver;
- AudioDeviceThread* m_audioThread;
- QList<Client *> m_clients;
- QHash<QByteArray, AudioChannel* > m_playbackChannels;
- QHash<QByteArray, AudioChannel* > m_captureChannels;
- QHash<QByteArray, AudioBus* > m_playbackBuses;
- QHash<QByteArray, AudioBus* > m_captureBuses;
- QHash<QByteArray, AudioBus* > m_virtualPlaybackBuses;
- QStringList m_availableDrivers;
+ Driver* driver;
+ AudioDeviceThread* audioThread;
+ QList<Client *> clients;
+ QHash<QByteArray, AudioChannel* > playbackChannels;
+ QHash<QByteArray, AudioChannel* > captureChannels;
+ QHash<QByteArray, AudioBus* > playbackBuses;
+ QHash<QByteArray, AudioBus* > captureBuses;
+ QStringList availableDrivers;
QTimer m_xrunResetTimer;
-
#if defined (JACK_SUPPORT)
- QTimer m_jackShutDownChecker;
+ QTimer jackShutDownChecker;
JackDriver* slaved_jack_driver();
friend class JackDriver;
#endif
@@ -196,7 +196,7 @@
Driver* get_driver() const
{
- return m_driver;
+ return driver;
}
void mili_sleep(int msec);
Index: engine/AudioDeviceThread.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/engine/AudioDeviceThread.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- engine/AudioDeviceThread.cpp 8 Oct 2007 20:46:49 -0000 1.19
+++ engine/AudioDeviceThread.cpp 12 Oct 2007 08:52:13 -0000 1.20
@@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-$Id: AudioDeviceThread.cpp,v 1.19 2007/10/08 20:46:49 r_sijrier Exp $
+$Id: AudioDeviceThread.cpp,v 1.20 2007/10/12 08:52:13 r_sijrier Exp $
*/
#include "AudioDeviceThread.h"
@@ -101,7 +101,7 @@
become_realtime(m_realTime);
- if (m_device->m_driver->start() < 0) {
+ if (m_device->driver->start() < 0) {
watchdog.terminate();
watchdog.wait();
return;