mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-26 08:27:43 +01:00
prevent double registration of ALSA sequencer MIDI ports
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@4074 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
5d0fbaeae7
commit
4d6bfdabdb
3 changed files with 75 additions and 28 deletions
|
|
@ -859,17 +859,8 @@ CrossfadeEditor::build_presets ()
|
|||
|
||||
/* FADE OUT */
|
||||
|
||||
p = new Preset ("Constant Power", "crossfade_in_constant");
|
||||
p = new Preset ("Linear (-6dB)", "crossfade_in_dipped");
|
||||
p->push_back (PresetPoint (0, 0));
|
||||
|
||||
#ifdef OLD_CONSTANT_XFADE
|
||||
p->push_back (PresetPoint (0.0737327, 0.308333));
|
||||
p->push_back (PresetPoint (0.246544, 0.658333));
|
||||
p->push_back (PresetPoint (0.470046, 0.886111));
|
||||
p->push_back (PresetPoint (0.652074, 0.972222));
|
||||
p->push_back (PresetPoint (0.771889, 0.988889));
|
||||
p->push_back (PresetPoint (1, 1));
|
||||
#else
|
||||
p->push_back (PresetPoint (0.000000, 0.000000));
|
||||
p->push_back (PresetPoint (0.166667, 0.166366));
|
||||
p->push_back (PresetPoint (0.333333, 0.332853));
|
||||
|
|
@ -877,24 +868,40 @@ CrossfadeEditor::build_presets ()
|
|||
p->push_back (PresetPoint (0.666667, 0.666186));
|
||||
p->push_back (PresetPoint (0.833333, 0.833033));
|
||||
p->push_back (PresetPoint (1.000000, 1.000000));
|
||||
#endif
|
||||
|
||||
fade_in_presets->push_back (p);
|
||||
|
||||
p = new Preset ("S-curve", "crossfade_in_default");
|
||||
#ifdef OTHER_S
|
||||
p->push_back (PresetPoint (0, 0));
|
||||
p->push_back (PresetPoint (0.1, 0.01));
|
||||
p->push_back (PresetPoint (0.2, 0.03));
|
||||
p->push_back (PresetPoint (0.8, 0.97));
|
||||
p->push_back (PresetPoint (0.9, 0.99));
|
||||
p->push_back (PresetPoint (1, 1));
|
||||
#endif
|
||||
|
||||
p->push_back (PresetPoint (0.0, 0.0));
|
||||
p->push_back (PresetPoint (0.0625 , 0.222));
|
||||
p->push_back (PresetPoint (0.1875 , 0.444));
|
||||
p->push_back (PresetPoint (0.8125 , 0.555));
|
||||
p->push_back (PresetPoint (0.875 , 0.777));
|
||||
p->push_back (PresetPoint (1.0 , 1.0));
|
||||
|
||||
fade_in_presets->push_back (p);
|
||||
|
||||
|
||||
// p = new Preset ("linin.xpm");
|
||||
p = new Preset ("Linear", "crossfade_in_dipped");
|
||||
p->push_back (PresetPoint (0, 0));
|
||||
p->push_back (PresetPoint (1, 1));
|
||||
p = new Preset ("Constant Power (-3dB)", "crossfade_in_constant");
|
||||
|
||||
p->push_back (PresetPoint (0.000000, 0.000000));
|
||||
p->push_back (PresetPoint (0.166667, 0.282192));
|
||||
p->push_back (PresetPoint (0.333333, 0.518174));
|
||||
p->push_back (PresetPoint (0.500000, 0.707946));
|
||||
p->push_back (PresetPoint (0.666667, 0.851507));
|
||||
p->push_back (PresetPoint (0.833333, 0.948859));
|
||||
p->push_back (PresetPoint (1.000000, 1.000000));
|
||||
|
||||
fade_in_presets->push_back (p);
|
||||
|
||||
if (!Profile->get_sae()) {
|
||||
|
|
@ -937,16 +944,8 @@ CrossfadeEditor::build_presets ()
|
|||
/* FADE OUT */
|
||||
|
||||
// p = new Preset ("regout.xpm");
|
||||
p = new Preset ("Constant Power", "crossfade_out_constant");
|
||||
p = new Preset ("Linear (-6dB cut)", "crossfade_out_dipped");
|
||||
p->push_back (PresetPoint (0, 1));
|
||||
#ifdef OLD_CONSTANT_XFADE
|
||||
p->push_back (PresetPoint (0.228111, 0.988889));
|
||||
p->push_back (PresetPoint (0.347926, 0.972222));
|
||||
p->push_back (PresetPoint (0.529954, 0.886111));
|
||||
p->push_back (PresetPoint (0.753456, 0.658333));
|
||||
p->push_back (PresetPoint (0.9262673, 0.308333));
|
||||
p->push_back (PresetPoint (1, 0));
|
||||
#else
|
||||
p->push_back (PresetPoint (0.000000, 1.000000));
|
||||
p->push_back (PresetPoint (0.166667, 0.833033));
|
||||
p->push_back (PresetPoint (0.333333, 0.666186));
|
||||
|
|
@ -954,8 +953,6 @@ CrossfadeEditor::build_presets ()
|
|||
p->push_back (PresetPoint (0.666667, 0.332853));
|
||||
p->push_back (PresetPoint (0.833333, 0.166366));
|
||||
p->push_back (PresetPoint (1.000000, 0.000000));
|
||||
|
||||
#endif
|
||||
fade_out_presets->push_back (p);
|
||||
|
||||
p = new Preset ("S-Curve", "crossfade_out_default");
|
||||
|
|
@ -968,9 +965,14 @@ CrossfadeEditor::build_presets ()
|
|||
fade_out_presets->push_back (p);
|
||||
|
||||
// p = new Preset ("linout.xpm");
|
||||
p = new Preset ("Linear", "crossfade_out_dipped");
|
||||
p->push_back (PresetPoint (0, 1));
|
||||
p->push_back (PresetPoint (1, 0));
|
||||
p = new Preset ("Constant Power (-3dB cut)", "crossfade_out_constant");
|
||||
p->push_back (PresetPoint (0.000000, 1.000000));
|
||||
p->push_back (PresetPoint (0.166667, 0.948859));
|
||||
p->push_back (PresetPoint (0.333333, 0.851507));
|
||||
p->push_back (PresetPoint (0.500000, 0.707946));
|
||||
p->push_back (PresetPoint (0.666667, 0.518174));
|
||||
p->push_back (PresetPoint (0.833333, 0.282192));
|
||||
p->push_back (PresetPoint (1.000000, 0.000000));
|
||||
fade_out_presets->push_back (p);
|
||||
|
||||
if (!Profile->get_sae()) {
|
||||
|
|
|
|||
|
|
@ -171,6 +171,8 @@ ALSA_SequencerMidiPort::create_ports (const Port::Descriptor& desc)
|
|||
caps |= SND_SEQ_PORT_CAP_WRITE | SND_SEQ_PORT_CAP_SUBS_WRITE;
|
||||
if (desc.mode == O_RDONLY || desc.mode == O_RDWR)
|
||||
caps |= SND_SEQ_PORT_CAP_READ | SND_SEQ_PORT_CAP_SUBS_READ;
|
||||
|
||||
cerr << "Create ALSA MIDI port for " << desc.tag << endl;
|
||||
|
||||
if (0 <= (err = snd_seq_create_simple_port (seq, desc.tag.c_str(), caps,
|
||||
(SND_SEQ_PORT_TYPE_MIDI_GENERIC|
|
||||
|
|
@ -312,6 +314,8 @@ ALSA_SequencerMidiPort::get_connections (vector<SequencerPortAddress>& connectio
|
|||
while (snd_seq_query_port_subscribers(seq, subs) >= 0) {
|
||||
|
||||
seq_addr = *snd_seq_query_subscribe_get_addr (subs);
|
||||
|
||||
cerr << _tagname << " is connected to " << seq_addr.client << "/" << seq_addr.port << endl;
|
||||
|
||||
connections.push_back (SequencerPortAddress (seq_addr.client,
|
||||
seq_addr.port));
|
||||
|
|
|
|||
|
|
@ -71,6 +71,47 @@ Manager::add_port (const XMLNode& node)
|
|||
PortMap::iterator existing;
|
||||
pair<string, Port *> newpair;
|
||||
|
||||
/* do not allow multiple ports with the same tag. if attempted, just return the existing
|
||||
port with the same tag. XXX this is really caused by the mess of setup_midi() being
|
||||
called twice in Ardour, once in the global init() function and once after the user RC file
|
||||
has been loaded (there may be extra ports in it).
|
||||
*/
|
||||
|
||||
if ((existing = ports_by_tag.find (desc.tag)) != ports_by_tag.end()) {
|
||||
|
||||
port = (*existing).second;
|
||||
|
||||
if (port->mode() == desc.mode) {
|
||||
|
||||
/* Same mode - reuse the port, and just
|
||||
create a new tag entry.
|
||||
*/
|
||||
|
||||
newpair.first = desc.tag;
|
||||
newpair.second = port;
|
||||
|
||||
ports_by_tag.insert (newpair);
|
||||
return port;
|
||||
}
|
||||
|
||||
/* If the existing is duplex, and this request
|
||||
is not, then fail, because most drivers won't
|
||||
allow opening twice with duplex and non-duplex
|
||||
operation.
|
||||
*/
|
||||
|
||||
if ((desc.mode == O_RDWR && port->mode() != O_RDWR) ||
|
||||
(desc.mode != O_RDWR && port->mode() == O_RDWR)) {
|
||||
error << "MIDIManager: port tagged \""
|
||||
<< desc.tag
|
||||
<< "\" cannot be opened duplex and non-duplex"
|
||||
<< endmsg;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* modes must be different or complementary */
|
||||
}
|
||||
|
||||
if (!PortFactory::ignore_duplicate_devices (desc.type)) {
|
||||
|
||||
if ((existing = ports_by_device.find (desc.device)) != ports_by_device.end()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue