2008-06-02 17:41:35 -04:00
|
|
|
/*
|
2015-10-04 14:51:05 -04:00
|
|
|
* Copyright (C) 2006 Paul Davis
|
2008-06-02 17:41:35 -04:00
|
|
|
* Copyright (C) 2007 Michael Taht
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
2015-10-04 14:51:05 -04:00
|
|
|
*
|
2008-06-02 17:41:35 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <algorithm>
|
|
|
|
#include <cmath>
|
|
|
|
|
|
|
|
#define __STDC_FORMAT_MACROS
|
|
|
|
#include <inttypes.h>
|
|
|
|
#include <float.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include <errno.h>
|
2009-10-29 20:21:40 -04:00
|
|
|
#include "ardour/route.h"
|
|
|
|
#include "ardour/audio_track.h"
|
|
|
|
#include "ardour/session.h"
|
|
|
|
#include "ardour/location.h"
|
|
|
|
#include "ardour/dB.h"
|
2008-06-02 17:41:35 -04:00
|
|
|
|
|
|
|
using namespace ARDOUR;
|
|
|
|
using namespace std;
|
|
|
|
using namespace sigc;
|
|
|
|
using namespace PBD;
|
|
|
|
|
2016-07-14 14:44:52 -04:00
|
|
|
#include "pbd/i18n.h"
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2009-10-29 20:21:40 -04:00
|
|
|
#include "pbd/abstract_ui.cc"
|
2008-06-02 17:41:35 -04:00
|
|
|
|
|
|
|
#include "tranzport_control_protocol.h"
|
|
|
|
|
|
|
|
|
|
|
|
// FIXME: How to handle multiple tranzports in a system?
|
|
|
|
|
|
|
|
XMLNode&
|
2022-04-06 23:56:32 -04:00
|
|
|
TranzportControlProtocol::get_state () const
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
2013-12-21 15:30:43 -05:00
|
|
|
return ControlProtocol::get_state();
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
TranzportControlProtocol::set_state (const XMLNode& node)
|
|
|
|
{
|
|
|
|
cout << "TranzportControlProtocol::set_state: active " << _active << endl;
|
|
|
|
int retval = 0;
|
|
|
|
|
|
|
|
// I think I want to make these strings rather than numbers
|
2015-10-05 10:17:49 -04:00
|
|
|
#if 0
|
2008-06-02 17:41:35 -04:00
|
|
|
// fetch current display mode
|
|
|
|
if ( node.property( X_("display_mode") ) != 0 )
|
|
|
|
{
|
|
|
|
string display = node.property( X_("display_mode") )->value();
|
|
|
|
try
|
|
|
|
{
|
|
|
|
set_active( true );
|
|
|
|
int32_t new_display = atoi( display.c_str() );
|
|
|
|
if ( display_mode != new_display ) display_mode = (DisplayMode)new_display;
|
|
|
|
}
|
|
|
|
catch ( exception & e )
|
|
|
|
{
|
|
|
|
cout << "exception in TranzportControlProtocol::set_state: " << e.what() << endl;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( node.property( X_("wheel_mode") ) != 0 )
|
|
|
|
{
|
|
|
|
string wheel = node.property( X_("wheel_mode") )->value();
|
|
|
|
try
|
|
|
|
{
|
|
|
|
int32_t new_wheel = atoi( wheel.c_str() );
|
|
|
|
if ( wheel_mode != new_wheel ) wheel_mode = (WheelMode) new_wheel;
|
|
|
|
}
|
|
|
|
catch ( exception & e )
|
|
|
|
{
|
|
|
|
cout << "exception in TranzportControlProtocol::set_state: " << e.what() << endl;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// fetch current bling mode
|
|
|
|
if ( node.property( X_("bling") ) != 0 )
|
|
|
|
{
|
|
|
|
string bling = node.property( X_("bling_mode") )->value();
|
|
|
|
try
|
|
|
|
{
|
|
|
|
int32_t new_bling = atoi( bling.c_str() );
|
|
|
|
if ( bling_mode != new_bling ) bling_mode = (BlingMode) new_bling;
|
|
|
|
}
|
|
|
|
catch ( exception & e )
|
|
|
|
{
|
|
|
|
cout << "exception in TranzportControlProtocol::set_state: " << e.what() << endl;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
2015-10-04 14:51:05 -04:00
|
|
|
#endif
|
2008-06-02 17:41:35 -04:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// These are intended for the day we have more options for tranzport modes
|
|
|
|
// And perhaps we could load up sessions this way, too
|
|
|
|
|
|
|
|
int
|
2015-10-04 14:51:05 -04:00
|
|
|
TranzportControlProtocol::save (char *name)
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
|
|
|
// Presently unimplemented
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2015-10-04 14:51:05 -04:00
|
|
|
TranzportControlProtocol::load (char *name)
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
|
|
|
// Presently unimplemented
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2015-10-04 14:51:05 -04:00
|
|
|
TranzportControlProtocol::save_config (char *name)
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
|
|
|
// Presently unimplemented
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2015-10-04 14:51:05 -04:00
|
|
|
TranzportControlProtocol::load_config (char *name)
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
|
|
|
// Presently unimplemented
|
|
|
|
return 0;
|
|
|
|
}
|