summaryrefslogtreecommitdiffstats
path: root/src/sound/AlsaDriver.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-02 22:38:52 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-02 22:38:52 +0000
commit458efa7b0c935cbaafa2791021a5f8f7241aa876 (patch)
tree624583f2873febe23770bee3fa94b5c24bd59f4f /src/sound/AlsaDriver.cpp
parent747037b72944ae2c02962b7c5c96e0a7f8852e38 (diff)
downloadrosegarden-458efa7b0c935cbaafa2791021a5f8f7241aa876.tar.gz
rosegarden-458efa7b0c935cbaafa2791021a5f8f7241aa876.zip
Initial TQt4 port of Rosegarden
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/rosegarden@1230242 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/sound/AlsaDriver.cpp')
-rw-r--r--src/sound/AlsaDriver.cpp148
1 files changed, 74 insertions, 74 deletions
diff --git a/src/sound/AlsaDriver.cpp b/src/sound/AlsaDriver.cpp
index 16a152b..176b90b 100644
--- a/src/sound/AlsaDriver.cpp
+++ b/src/sound/AlsaDriver.cpp
@@ -223,7 +223,7 @@ AlsaDriver::getSystemInfo()
}
void
-AlsaDriver::showQueueStatus(int queue)
+AlsaDriver::showQueuetqStatus(int queue)
{
int err, idx, min, max;
snd_seq_queue_status_t *status;
@@ -347,13 +347,13 @@ AlsaDriver::getAutoTimer(bool &wantTimerChecks)
{
Audit audit;
- // Look for the apparent best-choice timer.
+ // Look for the aptqparent best-choice timer.
if (m_timers.empty())
return "";
// The system RTC timer ought to be good, but it doesn't look like
- // a very safe choice -- we've seen some system lockups apparently
+ // a very safe choice -- we've seen some system lockups aptqparently
// connected with use of this timer on 2.6 kernels. So we avoid
// using that as an auto option.
@@ -705,7 +705,7 @@ AlsaDriver::generateInstruments()
DeviceId ssiDeviceId = getSpareDeviceId();
- if (m_driverStatus & AUDIO_OK) {
+ if (m_drivertqStatus & AUDIO_OK) {
for (int i = 0; i < count; ++i) {
sprintf(number, " #%d", i + 1);
std::string name = "Synth plugin" + std::string(number);
@@ -743,7 +743,7 @@ AlsaDriver::generateInstruments()
DeviceId audioDeviceId = getSpareDeviceId();
- if (m_driverStatus & AUDIO_OK)
+ if (m_drivertqStatus & AUDIO_OK)
{
for (int channel = 0; channel < audioCount; ++channel) {
sprintf(number, " #%d", channel + 1);
@@ -973,11 +973,11 @@ AlsaDriver::createMidiDevice(AlsaPortDescription *port,
if (TQString(deviceName).startsWith("Anonymous MIDI device ")) {
portName = TQString("out %1")
- .arg(m_outputPorts.size() + 1);
+ .tqarg(m_outputPorts.size() + 1);
} else {
portName = TQString("out %1 - %2")
- .arg(m_outputPorts.size() + 1)
- .arg(deviceName);
+ .tqarg(m_outputPorts.size() + 1)
+ .tqarg(deviceName);
}
int outputPort = checkAlsaError(snd_seq_create_simple_port
@@ -1154,7 +1154,7 @@ AlsaDriver::renameDevice(DeviceId id, TQString name)
snd_seq_get_port_info(m_midiHandle, i->second, pinfo);
TQString oldName = snd_seq_port_info_get_name(pinfo);
- int sep = oldName.find(" - ");
+ int sep = oldName.tqfind(" - ");
TQString newName;
@@ -1168,13 +1168,13 @@ AlsaDriver::renameDevice(DeviceId id, TQString name)
newName = oldName.left(sep + 3) + name;
}
- snd_seq_port_info_set_name(pinfo, newName.data());
+ snd_seq_port_info_set_name(pinfo, newName.ascii());
checkAlsaError(snd_seq_set_port_info(m_midiHandle, i->second, pinfo),
"renameDevice");
for (unsigned int i = 0; i < m_devices.size(); ++i) {
if (m_devices[i]->getId() == id) {
- m_devices[i]->setName(newName.data());
+ m_devices[i]->setName(newName.ascii());
break;
}
}
@@ -1225,7 +1225,7 @@ AlsaDriver::getConnections(Device::DeviceType type,
return count;
}
-QString
+TQString
AlsaDriver::getConnection(Device::DeviceType type,
MidiDevice::DeviceDirection direction,
unsigned int connectionNo)
@@ -1253,7 +1253,7 @@ AlsaDriver::setConnectionToDevice(MappedDevice &device, TQString connection)
{
ClientPortPair pair( -1, -1);
if (connection && connection != "") {
- pair = getPortByName(connection.data());
+ pair = getPortByName(connection.ascii());
}
setConnectionToDevice(device, connection, pair);
}
@@ -1263,7 +1263,7 @@ AlsaDriver::setConnectionToDevice(MappedDevice &device, TQString connection,
const ClientPortPair &pair)
{
TQString prevConnection = device.getConnection().c_str();
- device.setConnection(connection.data());
+ device.setConnection(connection.ascii());
if (device.getDirection() == MidiDevice::Play) {
@@ -1272,7 +1272,7 @@ AlsaDriver::setConnectionToDevice(MappedDevice &device, TQString connection,
if (j != m_outputPorts.end()) {
if (prevConnection != "") {
- ClientPortPair prevPair = getPortByName(prevConnection.data());
+ ClientPortPair prevPair = getPortByName(prevConnection.ascii());
if (prevPair.first >= 0 && prevPair.second >= 0) {
std::cerr << "Disconnecting my port " << j->second << " from " << prevPair.first << ":" << prevPair.second << " on reconnection" << std::endl;
@@ -1286,7 +1286,7 @@ AlsaDriver::setConnectionToDevice(MappedDevice &device, TQString connection,
for (MappedDeviceList::iterator k = m_devices.begin();
k != m_devices.end(); ++k) {
if ((*k)->getId() != device.getId()) {
- if ((*k)->getConnection() == prevConnection.data()) {
+ if ((*k)->getConnection() == prevConnection.ascii()) {
foundElsewhere = true;
break;
}
@@ -1323,7 +1323,7 @@ void
AlsaDriver::setConnection(DeviceId id, TQString connection)
{
Audit audit;
- ClientPortPair port(getPortByName(connection.data()));
+ ClientPortPair port(getPortByName(connection.ascii()));
if (port.first != -1 && port.second != -1) {
@@ -1349,7 +1349,7 @@ void
AlsaDriver::setPlausibleConnection(DeviceId id, TQString idealConnection)
{
Audit audit;
- ClientPortPair port(getPortByName(idealConnection.data()));
+ ClientPortPair port(getPortByName(idealConnection.ascii()));
audit << "AlsaDriver::setPlausibleConnection: connection like "
<< idealConnection << " requested for device " << id << std::endl;
@@ -1383,20 +1383,20 @@ AlsaDriver::setPlausibleConnection(DeviceId id, TQString idealConnection)
// of the requested string.
int client = -1;
- int colon = idealConnection.find(":");
+ int colon = idealConnection.tqfind(":");
if (colon >= 0)
client = idealConnection.left(colon).toInt();
int portNo = -1;
if (client > 0) {
TQString remainder = idealConnection.mid(colon + 1);
- int space = remainder.find(" ");
+ int space = remainder.tqfind(" ");
if (space >= 0)
portNo = remainder.left(space).toInt();
}
- int firstSpace = idealConnection.find(" ");
- int endOfText = idealConnection.find(TQRegExp("[^\\w ]"), firstSpace);
+ int firstSpace = idealConnection.tqfind(" ");
+ int endOfText = idealConnection.tqfind(TQRegExp("[^\\w ]"), firstSpace);
TQString text;
if (endOfText < 2) {
@@ -1448,7 +1448,7 @@ AlsaDriver::setPlausibleConnection(DeviceId id, TQString idealConnection)
}
if (testName && text != "" &&
- !TQString(port->m_name.c_str()).contains(text))
+ !TQString(port->m_name.c_str()).tqcontains(text))
continue;
if (testUsed) {
@@ -1507,7 +1507,7 @@ AlsaDriver::checkTimerSync(size_t frames)
#ifdef HAVE_LIBJACK
if (!m_jackDriver || !m_queueRunning || frames == 0 ||
- (getMTCStatus() == TRANSPORT_SLAVE)) {
+ (getMTCtqStatus() == TRANSPORT_SLAVE)) {
m_firstTimerCheck = true;
return ;
}
@@ -1587,7 +1587,7 @@ AlsaDriver::getTimers()
return m_timers.size() + 1; // one extra for auto
}
-QString
+TQString
AlsaDriver::getTimer(unsigned int n)
{
if (n == 0)
@@ -1596,7 +1596,7 @@ AlsaDriver::getTimer(unsigned int n)
return m_timers[n -1].name.c_str();
}
-QString
+TQString
AlsaDriver::getCurrentTimer()
{
return m_currentTimer.c_str();
@@ -1612,7 +1612,7 @@ AlsaDriver::setCurrentTimer(TQString timer)
std::cerr << "AlsaDriver::setCurrentTimer(" << timer << ")" << std::endl;
- std::string name(timer.data());
+ std::string name(timer.ascii());
if (name == AUTO_TIMER_NAME) {
name = getAutoTimer(m_doTimerChecks);
@@ -1817,7 +1817,7 @@ AlsaDriver::initialiseMidi()
// Modify status with MIDI success
//
- m_driverStatus |= MIDI_OK;
+ m_drivertqStatus |= MIDI_OK;
generateTimerList();
setCurrentTimer(AUTO_TIMER_NAME);
@@ -1851,7 +1851,7 @@ AlsaDriver::initialiseAudio()
m_jackDriver = new JackDriver(this);
if (m_jackDriver->isOK()) {
- m_driverStatus |= AUDIO_OK;
+ m_drivertqStatus |= AUDIO_OK;
} else {
delete m_jackDriver;
m_jackDriver = 0;
@@ -1876,19 +1876,19 @@ AlsaDriver::initialisePlayback(const RealTime &position)
m_mtcSigmaE = 0;
m_mtcSigmaC = 0;
- if (getMMCStatus() == TRANSPORT_MASTER) {
+ if (getMMCtqStatus() == TRANSPORT_MASTER) {
sendMMC(127, MIDI_MMC_PLAY, true, "");
m_eat_mtc = 0;
}
- if (getMTCStatus() == TRANSPORT_MASTER) {
+ if (getMTCtqStatus() == TRANSPORT_MASTER) {
insertMTCFullFrame(position);
}
// If MIDI Sync is enabled then adjust for the MIDI Clock to
// synchronise the sequencer with the clock.
//
- if (getMIDISyncStatus() == TRANSPORT_MASTER) {
+ if (getMIDISynctqStatus() == TRANSPORT_MASTER) {
// Send the Song Position Pointer for MIDI CLOCK positioning
//
// Get time from current alsa time to start of alsa timing -
@@ -1935,11 +1935,11 @@ AlsaDriver::stopPlayback()
std::cerr << "\n\nAlsaDriver - stopPlayback" << std::endl;
#endif
- if (getMIDISyncStatus() == TRANSPORT_MASTER) {
+ if (getMIDISynctqStatus() == TRANSPORT_MASTER) {
sendSystemDirect(SND_SEQ_EVENT_STOP, NULL);
}
- if (getMMCStatus() == TRANSPORT_MASTER) {
+ if (getMMCtqStatus() == TRANSPORT_MASTER) {
sendMMC(127, MIDI_MMC_STOP, true, "");
//<VN> need to throw away the next MTC event
m_eat_mtc = 3;
@@ -1992,7 +1992,7 @@ AlsaDriver::punchOut()
#ifdef HAVE_LIBJACK
// Close any recording file
- if (m_recordStatus == RECORD_ON) {
+ if (m_recordtqStatus == RECORD_ON) {
for (InstrumentSet::const_iterator i = m_recordingInstruments.begin();
i != m_recordingInstruments.end(); ++i) {
@@ -2037,8 +2037,8 @@ AlsaDriver::punchOut()
// Change recorded state if any set
//
- if (m_recordStatus == RECORD_ON)
- m_recordStatus = RECORD_OFF;
+ if (m_recordtqStatus == RECORD_ON)
+ m_recordtqStatus = RECORD_OFF;
m_recordingInstruments.clear();
}
@@ -2050,12 +2050,12 @@ AlsaDriver::resetPlayback(const RealTime &oldPosition, const RealTime &position)
std::cerr << "\n\nAlsaDriver - resetPlayback(" << oldPosition << "," << position << ")" << std::endl;
#endif
- if (getMMCStatus() == TRANSPORT_MASTER) {
+ if (getMMCtqStatus() == TRANSPORT_MASTER) {
unsigned char t_sec = (unsigned char) position.sec % 60;
unsigned char t_min = (unsigned char) (position.sec / 60) % 60;
unsigned char t_hrs = (unsigned char) (position.sec / 3600);
-#define STUPID_BROKEN_EQUIPMENT
-#ifdef STUPID_BROKEN_EQUIPMENT
+#define STUPID_BROKEN_ETQUIPMENT
+#ifdef STUPID_BROKEN_ETQUIPMENT
// Some recorders assume you are talking in 30fps...
unsigned char t_frm = (unsigned char) (position.nsec / 33333333U);
unsigned char t_sbf = (unsigned char) ((position.nsec / 333333U) % 100U);
@@ -2135,7 +2135,7 @@ AlsaDriver::resetPlayback(const RealTime &oldPosition, const RealTime &position)
snd_seq_remove_events_set_condition(info, SND_SEQ_REMOVE_OUTPUT);
snd_seq_remove_events(m_midiHandle, info);
- if (getMTCStatus() == TRANSPORT_MASTER) {
+ if (getMTCtqStatus() == TRANSPORT_MASTER) {
m_mtcFirstTime = -1;
m_mtcSigmaE = 0;
m_mtcSigmaC = 0;
@@ -2718,8 +2718,8 @@ AlsaDriver::getMappedComposition()
case SND_SEQ_EVENT_QFRAME:
if (fromController)
continue;
- if (getMTCStatus() == TRANSPORT_SLAVE) {
- handleMTCQFrame(event->data.control.value, eventTime);
+ if (getMTCtqStatus() == TRANSPORT_SLAVE) {
+ handleMTCTQFrame(event->data.control.value, eventTime);
}
break;
@@ -2733,7 +2733,7 @@ AlsaDriver::getMappedComposition()
break;
case SND_SEQ_EVENT_START:
- if ((getMIDISyncStatus() == TRANSPORT_SLAVE) && !isPlaying()) {
+ if ((getMIDISynctqStatus() == TRANSPORT_SLAVE) && !isPlaying()) {
ExternalTransport *transport = getExternalTransportControl();
if (transport) {
transport->transportJump(ExternalTransport::TransportStopAtTime,
@@ -2749,7 +2749,7 @@ AlsaDriver::getMappedComposition()
break;
case SND_SEQ_EVENT_CONTINUE:
- if ((getMIDISyncStatus() == TRANSPORT_SLAVE) && !isPlaying()) {
+ if ((getMIDISynctqStatus() == TRANSPORT_SLAVE) && !isPlaying()) {
ExternalTransport *transport = getExternalTransportControl();
if (transport) {
transport->transportChange(ExternalTransport::TransportPlay);
@@ -2763,7 +2763,7 @@ AlsaDriver::getMappedComposition()
break;
case SND_SEQ_EVENT_STOP:
- if ((getMIDISyncStatus() == TRANSPORT_SLAVE) && isPlaying()) {
+ if ((getMIDISynctqStatus() == TRANSPORT_SLAVE) && isPlaying()) {
ExternalTransport *transport = getExternalTransportControl();
if (transport) {
transport->transportChange(ExternalTransport::TransportStop);
@@ -2819,7 +2819,7 @@ AlsaDriver::getMappedComposition()
}
}
- if (getMTCStatus() == TRANSPORT_SLAVE && isPlaying()) {
+ if (getMTCtqStatus() == TRANSPORT_SLAVE && isPlaying()) {
#ifdef MTC_DEBUG
std::cerr << "seq time is " << getSequencerTime() << ", last MTC receive "
<< m_mtcLastReceive << ", first time " << m_mtcFirstTime << std::endl;
@@ -2844,9 +2844,9 @@ AlsaDriver::getMappedComposition()
static int lock_count = 0;
void
-AlsaDriver::handleMTCQFrame(unsigned int data_byte, RealTime the_time)
+AlsaDriver::handleMTCTQFrame(unsigned int data_byte, RealTime the_time)
{
- if (getMTCStatus() != TRANSPORT_SLAVE)
+ if (getMTCtqStatus() != TRANSPORT_SLAVE)
return ;
switch (data_byte & 0xF0) {
@@ -3059,7 +3059,7 @@ AlsaDriver::insertMTCFullFrame(RealTime time)
}
void
-AlsaDriver::insertMTCQFrames(RealTime sliceStart, RealTime sliceEnd)
+AlsaDriver::insertMTCTQFrames(RealTime sliceStart, RealTime sliceEnd)
{
if (sliceStart == RealTime::zeroTime && sliceEnd == RealTime::zeroTime) {
// not a real slice
@@ -3073,7 +3073,7 @@ AlsaDriver::insertMTCQFrames(RealTime sliceStart, RealTime sliceEnd)
#ifdef MTC_DEBUG
- std::cout << "AlsaDriver::insertMTCQFrames(" << sliceStart << ","
+ std::cout << "AlsaDriver::insertMTCTQFrames(" << sliceStart << ","
<< sliceEnd << "): first time " << m_mtcFirstTime << std::endl;
#endif
@@ -3147,7 +3147,7 @@ AlsaDriver::insertMTCQFrames(RealTime sliceStart, RealTime sliceEnd)
snd_seq_ev_schedule_real(&event, m_queue, 0, &atime);
checkAlsaError(snd_seq_event_output(m_midiHandle, &event),
- "insertMTCQFrames sending qframe event");
+ "insertMTCTQFrames sending qframe event");
if (++type == 8) {
m_mtcFrames += 2;
@@ -3172,7 +3172,7 @@ AlsaDriver::insertMTCQFrames(RealTime sliceStart, RealTime sliceEnd)
bool
AlsaDriver::testForMTCSysex(const snd_seq_event_t *event)
{
- if (getMTCStatus() != TRANSPORT_SLAVE)
+ if (getMTCtqStatus() != TRANSPORT_SLAVE)
return false;
// At this point, and possibly for the foreseeable future, the only
@@ -3344,7 +3344,7 @@ AlsaDriver::tweakSkewForMTC(int factor)
bool
AlsaDriver::testForMMCSysex(const snd_seq_event_t *event)
{
- if (getMMCStatus() != TRANSPORT_SLAVE)
+ if (getMMCtqStatus() != TRANSPORT_SLAVE)
return false;
if (event->data.ext.len != 6)
@@ -3764,8 +3764,8 @@ AlsaDriver::processMidiOut(const MappedComposition &mC,
processNotesOff(sliceEnd - m_playStartPosition + m_alsaPlayStartTime, now);
- if (getMTCStatus() == TRANSPORT_MASTER) {
- insertMTCQFrames(sliceStart, sliceEnd);
+ if (getMTCtqStatus() == TRANSPORT_MASTER) {
+ insertMTCTQFrames(sliceStart, sliceEnd);
}
if (m_queueRunning) {
@@ -4009,7 +4009,7 @@ AlsaDriver::processEventsOut(const MappedComposition &mC,
// we're really rolling.
m_playing = true;
- if (getMTCStatus() == TRANSPORT_SLAVE) {
+ if (getMTCtqStatus() == TRANSPORT_SLAVE) {
tweakSkewForMTC(0);
}
}
@@ -4155,7 +4155,7 @@ AlsaDriver::processEventsOut(const MappedComposition &mC,
<< std::endl;
#endif
- setMIDISyncStatus(TRANSPORT_OFF);
+ setMIDISynctqStatus(TRANSPORT_OFF);
break;
case 1:
@@ -4167,7 +4167,7 @@ AlsaDriver::processEventsOut(const MappedComposition &mC,
<< std::endl;
#endif
- setMIDISyncStatus(TRANSPORT_MASTER);
+ setMIDISynctqStatus(TRANSPORT_MASTER);
break;
case 2:
@@ -4179,7 +4179,7 @@ AlsaDriver::processEventsOut(const MappedComposition &mC,
<< std::endl;
#endif
- setMIDISyncStatus(TRANSPORT_SLAVE);
+ setMIDISynctqStatus(TRANSPORT_SLAVE);
break;
}
}
@@ -4274,7 +4274,7 @@ AlsaDriver::processEventsOut(const MappedComposition &mC,
<< std::endl;
#endif
- setMMCStatus(TRANSPORT_MASTER);
+ setMMCtqStatus(TRANSPORT_MASTER);
break;
case 2:
@@ -4285,7 +4285,7 @@ AlsaDriver::processEventsOut(const MappedComposition &mC,
<< std::endl;
#endif
- setMMCStatus(TRANSPORT_SLAVE);
+ setMMCtqStatus(TRANSPORT_SLAVE);
break;
case 0:
@@ -4297,7 +4297,7 @@ AlsaDriver::processEventsOut(const MappedComposition &mC,
<< std::endl;
#endif
- setMMCStatus(TRANSPORT_OFF);
+ setMMCtqStatus(TRANSPORT_OFF);
break;
}
}
@@ -4312,7 +4312,7 @@ AlsaDriver::processEventsOut(const MappedComposition &mC,
<< std::endl;
#endif
- setMTCStatus(TRANSPORT_MASTER);
+ setMTCtqStatus(TRANSPORT_MASTER);
tweakSkewForMTC(0);
m_mtcFirstTime = -1;
break;
@@ -4325,7 +4325,7 @@ AlsaDriver::processEventsOut(const MappedComposition &mC,
<< std::endl;
#endif
- setMTCStatus(TRANSPORT_SLAVE);
+ setMTCtqStatus(TRANSPORT_SLAVE);
m_mtcFirstTime = -1;
break;
@@ -4338,7 +4338,7 @@ AlsaDriver::processEventsOut(const MappedComposition &mC,
<< std::endl;
#endif
- setMTCStatus(TRANSPORT_OFF);
+ setMTCtqStatus(TRANSPORT_OFF);
m_mtcFirstTime = -1;
break;
}
@@ -4477,15 +4477,15 @@ AlsaDriver::processEventsOut(const MappedComposition &mC,
}
bool
-AlsaDriver::record(RecordStatus recordStatus,
+AlsaDriver::record(RecordtqStatus recordtqStatus,
const std::vector<InstrumentId> *armedInstruments,
const std::vector<TQString> *audioFileNames)
{
m_recordingInstruments.clear();
- if (recordStatus == RECORD_ON) {
+ if (recordtqStatus == RECORD_ON) {
// start recording
- m_recordStatus = RECORD_ON;
+ m_recordtqStatus = RECORD_ON;
m_alsaRecordStartTime = RealTime::zeroTime;
unsigned int audioCount = 0;
@@ -4516,13 +4516,13 @@ AlsaDriver::record(RecordStatus recordStatus,
#ifdef HAVE_LIBJACK
if (m_jackDriver &&
- m_jackDriver->openRecordFile(id, fileName.data())) {
+ m_jackDriver->openRecordFile(id, fileName.ascii())) {
good = true;
}
#endif
if (!good) {
- m_recordStatus = RECORD_OFF;
+ m_recordtqStatus = RECORD_OFF;
std::cerr << "AlsaDriver::record: No JACK driver, or JACK driver failed to prepare for recording audio" << std::endl;
return false;
}
@@ -4532,8 +4532,8 @@ AlsaDriver::record(RecordStatus recordStatus,
}
}
} else
- if (recordStatus == RECORD_OFF) {
- m_recordStatus = RECORD_OFF;
+ if (recordtqStatus == RECORD_OFF) {
+ m_recordtqStatus = RECORD_OFF;
}
#ifdef DEBUG_ALSA
else {
@@ -5254,7 +5254,7 @@ AlsaDriver::scavengePlugins()
}
-QString
+TQString
AlsaDriver::getStatusLog()
{
return TQString::fromUtf8(Audit::getAudit().c_str());