Non reinvents the DAW. Powerful enough to form a complete studio, fast and light enough to run on low-end hardware like the eeePC or Raspberry Pi, and so reliable that it can be used live https://non.tuxfamily.org/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

828 lines
19KB

  1. /*******************************************************************************/
  2. /* Copyright (C) 2009 Jonathan Moore Liles */
  3. /* */
  4. /* This program is free software; you can redistribute it and/or modify it */
  5. /* under the terms of the GNU General Public License as published by the */
  6. /* Free Software Foundation; either version 2 of the License, or (at your */
  7. /* option) any later version. */
  8. /* */
  9. /* This program is distributed in the hope that it will be useful, but WITHOUT */
  10. /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
  11. /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */
  12. /* more details. */
  13. /* */
  14. /* You should have received a copy of the GNU General Public License along */
  15. /* with This program; see the file COPYING. If not,write to the Free Software */
  16. /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  17. /*******************************************************************************/
  18. /* This is the main mixer group. It contains and manages Mixer_Strips. */
  19. #include "const.h"
  20. #include "Mixer.H"
  21. #include "Mixer_Strip.H"
  22. #include <FL/Fl_Pack.H>
  23. #include <FL/Fl_Scroll.H>
  24. #include <FL/Fl_Menu_Bar.H>
  25. #include <FL/fl_ask.H>
  26. #include <FL/Fl.H>
  27. #include <FL/New_Project_Dialog.H>
  28. #include "Engine/Engine.H"
  29. #include <FL/Fl_Flowpack.H>
  30. #include "Project.H"
  31. #include <FL/Fl_Menu_Settings.H>
  32. #include <FL/About_Dialog.H>
  33. #include <FL/Fl_File_Chooser.H>
  34. #include <FL/Fl_Theme_Chooser.H>
  35. #include <FL/Fl_Value_SliderX.H>
  36. #include "file.h"
  37. #include <string.h>
  38. #include "debug.h"
  39. #include <unistd.h>
  40. #include <sys/types.h>
  41. #include "OSC/Endpoint.H"
  42. #include <lo/lo.h>
  43. const double STATUS_UPDATE_FREQ = 0.2f;
  44. extern char *user_config_dir;
  45. extern char *instance_name;
  46. #include "debug.h"
  47. #include "NSM.H"
  48. extern NSM_Client *nsm;
  49. /* static void update_cb( void *v ) { */
  50. /* Fl::repeat_timeout( STATUS_UPDATE_FREQ, update_cb, v ); */
  51. /* ((Mixer*)v)->update(); */
  52. /* } */
  53. /************************/
  54. /* OSC Message Handlers */
  55. /************************/
  56. #undef OSC_REPLY_OK
  57. #undef OSC_REPLY_ERR
  58. #undef OSC_REPLY
  59. #define OSC_REPLY_OK() ((OSC::Endpoint*)user_data)->send( lo_message_get_source( msg ), path, 0, "OK" )
  60. #define OSC_REPLY( value ) ((OSC::Endpoint*)user_data)->send( lo_message_get_source( msg ), path, value )
  61. #define OSC_REPLY_ERR(errcode, value) ((OSC::Endpoint*)user_data)->send( lo_message_get_source( msg ), path,errcode, value )
  62. #define OSC_ENDPOINT() ((OSC::Endpoint*)user_data)
  63. static int osc_add_strip ( const char *path, const char *, lo_arg **, int , lo_message msg, void *user_data )
  64. {
  65. OSC_DMSG();
  66. Fl::lock();
  67. ((Mixer*)(OSC_ENDPOINT())->owner)->command_add_strip();
  68. Fl::unlock();
  69. OSC_REPLY_OK();
  70. return 0;
  71. }
  72. int
  73. Mixer::osc_non_hello ( const char *, const char *, lo_arg **, int , lo_message msg, void * )
  74. {
  75. mixer->handle_hello( msg );
  76. return 0;
  77. }
  78. void
  79. Mixer::handle_hello ( lo_message msg )
  80. {
  81. int argc = lo_message_get_argc( msg );
  82. lo_arg **argv = lo_message_get_argv( msg );
  83. if ( argc >= 4 )
  84. {
  85. const char *url = &argv[0]->s;
  86. const char *name = &argv[1]->s;
  87. const char *version = &argv[2]->s;
  88. const char *id = &argv[3]->s;
  89. MESSAGE( "Got hello from NON peer %s (%s) @ %s with ID \"%s\"", name, version, url, id );
  90. mixer->osc_endpoint->handle_hello( id, url );
  91. }
  92. }
  93. void
  94. Mixer::say_hello ( void )
  95. {
  96. lo_message m = lo_message_new();
  97. lo_message_add( m, "sssss",
  98. "/non/hello",
  99. osc_endpoint->url(),
  100. APP_NAME,
  101. VERSION,
  102. instance_name );
  103. nsm->broadcast( m );
  104. lo_message_free( m );
  105. }
  106. static
  107. Fl_Menu_Item *
  108. find_item( Fl_Menu_ *menu, const char *path )
  109. {
  110. return const_cast<Fl_Menu_Item*>(menu->find_item( path ));
  111. }
  112. void
  113. Mixer::sm_active ( bool b )
  114. {
  115. sm_blinker->value( b );
  116. sm_blinker->tooltip( nsm->session_manager_name() );
  117. if ( b )
  118. {
  119. find_item( menubar, "&Project/&Open" )->deactivate();
  120. find_item( menubar, "&Project/&New" )->deactivate();
  121. }
  122. }
  123. void
  124. Mixer::redraw_windows ( void )
  125. {
  126. window()->redraw();
  127. if ( Fl::first_window() )
  128. for ( Fl_Window *w = Fl::first_window(); ( w = Fl::next_window( w ) ); )
  129. w->redraw();
  130. }
  131. void Mixer::command_new ( void )
  132. {
  133. DMESSAGE( "New project" );
  134. char *default_path;
  135. read_line( user_config_dir, "default_path", &default_path );
  136. char *path = new_project_chooser( &default_path );
  137. if ( path )
  138. {
  139. if ( ! Project::create( path, NULL ) )
  140. fl_alert( "Error creating project!" );
  141. free( path );
  142. }
  143. load_project_settings();
  144. update_menu();
  145. if ( default_path )
  146. {
  147. write_line( user_config_dir, "default_path", default_path );
  148. free( default_path );
  149. }
  150. }
  151. void Mixer::cb_menu(Fl_Widget* o) {
  152. Fl_Menu_Bar *menu = (Fl_Menu_Bar*)o;
  153. /* const Fl_Menu_Item *mi = &menu->menu()[menu->value()]; */
  154. char picked[256];
  155. // const char *picked = menu->text();
  156. menu->item_pathname( picked, sizeof( picked ) );
  157. DMESSAGE( "Picked %s", picked );
  158. if (! strcmp( picked, "&Project/&New") )
  159. {
  160. command_new();
  161. }
  162. else if (! strcmp( picked, "&Project/&Open" ) )
  163. {
  164. char *path = NULL;
  165. // read_line( user_config_dir, "default_path", &path );
  166. const char *name = fl_dir_chooser( "Open Project", path );
  167. free( path );
  168. mixer->hide();
  169. if ( int err = Project::open( name ) )
  170. {
  171. fl_alert( "Error opening project: %s", Project::errstr( err ) );
  172. }
  173. update_menu();
  174. mixer->show();
  175. }
  176. else if (! strcmp( picked, "&Project/&Save" ) )
  177. {
  178. command_save();
  179. }
  180. else if (! strcmp( picked, "&Project/&Quit") )
  181. {
  182. command_quit();
  183. }
  184. else if ( !strcmp( picked, "&Mixer/&Add Strip" ) )
  185. {
  186. command_add_strip();
  187. }
  188. else if ( !strcmp( picked, "&Mixer/Add &N Strips" ) )
  189. {
  190. const char *s = fl_input( "Enter number of strips to add" );
  191. if ( s )
  192. {
  193. for ( int i = atoi( s ); i > 0; i-- )
  194. command_add_strip();
  195. }
  196. }
  197. else if ( !strcmp( picked, "&Mixer/&Import Strip" ) )
  198. {
  199. const char *s = fl_file_chooser( "Export strip to filename:", "*.strip", NULL, 0 );
  200. if ( s )
  201. {
  202. if (! Mixer_Strip::import_strip( s ) )
  203. fl_alert( "%s", "Failed to import strip!" );
  204. }
  205. }
  206. else if (! strcmp( picked, "&Project/Se&ttings/&Rows/One") )
  207. {
  208. rows( 1 );
  209. }
  210. else if (! strcmp( picked, "&Project/Se&ttings/&Rows/Two") )
  211. {
  212. rows( 2 );
  213. }
  214. else if (! strcmp( picked, "&Project/Se&ttings/&Rows/Three") )
  215. {
  216. rows( 3 );
  217. }
  218. else if (! strcmp( picked, "&Project/Se&ttings/Make Default") )
  219. {
  220. save_default_project_settings();
  221. }
  222. else if (! strcmp( picked, "&View/&Theme") )
  223. {
  224. fl_theme_chooser();
  225. }
  226. else if ( ! strcmp( picked, "&Help/&About" ) )
  227. {
  228. About_Dialog ab( PIXMAP_PATH "/non-mixer/icon-256x256.png" );
  229. ab.logo_box->label( VERSION );
  230. ab.title->label( "Non Mixer" );
  231. ab.copyright->label( "Copyright (C) 2008-2013 Jonathan Moore Liles" );
  232. ab.credits->label(
  233. "Non Mixer was written from scratch by\n"
  234. "Jonathan Moore Liles for his own use\n"
  235. "(see the manual).\n"
  236. "\n"
  237. "Nobody planned. Nobody helped.\n"
  238. "You can help now by donating time, money,\n"
  239. "and/or replacing the rest of Linux Audio\n"
  240. "with fast, light, reliable alternatives.\n" );
  241. ab.website_url->label( "http://non.tuxfamily.org" );
  242. ab.run();
  243. }
  244. else if ( !strcmp( picked, "&Help/&Manual" ))
  245. {
  246. char *pat;
  247. asprintf( &pat, "file://%s.html", DOCUMENT_PATH "/non-mixer/MANUAL" );
  248. open_url( pat );
  249. free( pat );
  250. }
  251. }
  252. void Mixer::cb_menu(Fl_Widget* o, void* v) {
  253. ((Mixer*)(v))->cb_menu(o);
  254. }
  255. static void
  256. progress_cb ( int p, void *v )
  257. {
  258. static int oldp = 0;
  259. if ( p != oldp )
  260. {
  261. oldp = p;
  262. if ( nsm )
  263. {
  264. nsm->progress( p / 100.0f );
  265. }
  266. Fl::check();
  267. }
  268. }
  269. void
  270. Mixer::save_default_project_settings ( void )
  271. {
  272. char path[256];
  273. snprintf( path, sizeof( path ), "%s/%s", user_config_dir, ".default_project_settings" );
  274. ((Fl_Menu_Settings*)menubar)->dump( menubar->find_item( "&Project/Se&ttings" ), path );
  275. }
  276. void
  277. Mixer::load_default_project_settings ( void )
  278. {
  279. char path[256];
  280. snprintf( path, sizeof( path ), "%s/%s", user_config_dir, ".default_project_settings" );
  281. ((Fl_Menu_Settings*)menubar)->load( menubar->find_item( "&Project/Se&ttings" ), path );
  282. }
  283. void
  284. Mixer::reset_project_settings ( void )
  285. {
  286. rows(1);
  287. load_default_project_settings();
  288. }
  289. void
  290. Mixer::save_project_settings ( void )
  291. {
  292. if ( ! Project::open() )
  293. return;
  294. ((Fl_Menu_Settings*)menubar)->dump( menubar->find_item( "&Project/Se&ttings" ), "options" );
  295. }
  296. void
  297. Mixer::load_project_settings ( void )
  298. {
  299. reset_project_settings();
  300. if ( Project::open() )
  301. ((Fl_Menu_Settings*)menubar)->load( menubar->find_item( "&Project/Se&ttings" ), "options" );
  302. update_menu();
  303. }
  304. Mixer::Mixer ( int X, int Y, int W, int H, const char *L ) :
  305. Fl_Group( X, Y, W, H, L )
  306. {
  307. Loggable::dirty_callback( &Mixer::handle_dirty, this );
  308. Loggable::progress_callback( progress_cb, NULL );
  309. _rows = 1;
  310. box( FL_FLAT_BOX );
  311. labelsize( 96 );
  312. { Fl_Group *o = new Fl_Group( X, Y, W, 24 );
  313. { Fl_Menu_Bar *o = menubar = new Fl_Menu_Bar( X, Y, W, 24 );
  314. o->add( "&Project/&New" );
  315. o->add( "&Project/&Open" );
  316. o->add( "&Project/Se&ttings/&Rows/One", '1', 0, 0, FL_MENU_RADIO | FL_MENU_VALUE );
  317. o->add( "&Project/Se&ttings/&Rows/Two", '2', 0, 0, FL_MENU_RADIO );
  318. o->add( "&Project/Se&ttings/&Rows/Three", '3', 0, 0, FL_MENU_RADIO );
  319. o->add( "&Project/Se&ttings/Make Default", 0,0,0);
  320. o->add( "&Project/&Save", FL_CTRL + 's', 0, 0 );
  321. o->add( "&Project/&Quit", FL_CTRL + 'q', 0, 0 );
  322. o->add( "&Mixer/&Add Strip", 'a', 0, 0 );
  323. o->add( "&Mixer/Add &N Strips" );
  324. o->add( "&Mixer/&Import Strip" );
  325. o->add( "&View/&Theme", 0, 0, 0 );
  326. o->add( "&Help/&Manual" );
  327. o->add( "&Help/&About" );
  328. o->callback( cb_menu, this );
  329. }
  330. { Fl_Box *o = project_name = new Fl_Box( X + 150, Y, W, 24 );
  331. o->labelfont( FL_HELVETICA_ITALIC );
  332. o->label( 0 );
  333. o->align( FL_ALIGN_INSIDE | FL_ALIGN_CENTER );
  334. o->labeltype( FL_SHADOW_LABEL );
  335. Fl_Group::current()->resizable( o );
  336. }
  337. { sm_blinker = new Fl_Button( ( X + W) - 37, Y + 4, 35, 15, "SM");
  338. sm_blinker->box(FL_ROUNDED_BOX);
  339. sm_blinker->down_box(FL_ROUNDED_BOX);
  340. sm_blinker->color(FL_DARK2);
  341. sm_blinker->selection_color((Fl_Color)93);
  342. sm_blinker->labeltype(FL_NORMAL_LABEL);
  343. sm_blinker->labelfont(3);
  344. sm_blinker->labelsize(14);
  345. sm_blinker->labelcolor(FL_DARK3);
  346. sm_blinker->align(Fl_Align(FL_ALIGN_CENTER));
  347. sm_blinker->when(FL_WHEN_RELEASE);
  348. sm_blinker->deactivate();
  349. } // Fl_Blink_Button* sm_blinker
  350. o->end();
  351. }
  352. { Fl_Scroll *o = scroll = new Fl_Scroll( X, Y + 24, W, H - 24 );
  353. o->box( FL_FLAT_BOX );
  354. // o->type( Fl_Scroll::HORIZONTAL_ALWAYS );
  355. // o->box( Fl_Scroll::BOTH );
  356. {
  357. Fl_Flowpack *o = mixer_strips = new Fl_Flowpack( X, Y + 24, W, H - 18 - 24 );
  358. // label( "Non-Mixer" );
  359. align( (Fl_Align)(FL_ALIGN_CENTER | FL_ALIGN_INSIDE) );
  360. o->box( FL_FLAT_BOX );
  361. o->type( Fl_Pack::HORIZONTAL );
  362. o->hspacing( 2 );
  363. o->vspacing( 2 );
  364. o->end();
  365. Fl_Group::current()->resizable( o );
  366. }
  367. o->end();
  368. Fl_Group::current()->resizable( o );
  369. }
  370. end();
  371. // Fl::add_timeout( STATUS_UPDATE_FREQ, update_cb, this );
  372. update_menu();
  373. load_options();
  374. }
  375. int
  376. Mixer::init_osc ( const char *osc_port )
  377. {
  378. osc_endpoint = new OSC::Endpoint();
  379. if ( int r = osc_endpoint->init( LO_UDP, osc_port ) )
  380. return r;
  381. osc_endpoint->owner = this;
  382. printf( "OSC=%s\n", osc_endpoint->url() );
  383. osc_endpoint->add_method( "/non/hello", "ssss", &Mixer::osc_non_hello, osc_endpoint, "" );
  384. //
  385. osc_endpoint->add_method( "/non/mixer/add_strip", "", osc_add_strip, osc_endpoint, "" );
  386. osc_endpoint->start();
  387. return 0;
  388. }
  389. Mixer::~Mixer ( )
  390. {
  391. DMESSAGE( "Destroying mixer" );
  392. save_options();
  393. /* FIXME: teardown */
  394. mixer_strips->clear();
  395. }
  396. void Mixer::resize ( int X, int Y, int W, int H )
  397. {
  398. Fl_Group::resize( X, Y, W, H );
  399. mixer_strips->resize( X, Y + 24, W, H - 18 - 24 );
  400. scroll->resize( X, Y + 24, W, H - 24 );
  401. rows( _rows );
  402. }
  403. void Mixer::add ( Mixer_Strip *ms )
  404. {
  405. MESSAGE( "Add mixer strip \"%s\"", ms->name() );
  406. mixer_strips->add( ms );
  407. ms->take_focus();
  408. rows( _rows );
  409. // scroll->redraw();
  410. }
  411. void
  412. Mixer::quit ( void )
  413. {
  414. /* TODO: save project? */
  415. while ( Fl::first_window() ) Fl::first_window()->hide();
  416. }
  417. void
  418. Mixer::insert ( Mixer_Strip *ms, Mixer_Strip *before )
  419. {
  420. mixer_strips->remove( ms );
  421. mixer_strips->insert( *ms, before );
  422. scroll->redraw();
  423. }
  424. void
  425. Mixer::insert ( Mixer_Strip *ms, int i )
  426. {
  427. Mixer_Strip *before = (Mixer_Strip*)mixer_strips->child( i );
  428. insert( ms, before);
  429. }
  430. void
  431. Mixer::move_left ( Mixer_Strip *ms )
  432. {
  433. int i = mixer_strips->find( ms );
  434. if ( i > 0 )
  435. insert( ms, i - 1 );
  436. }
  437. void
  438. Mixer::move_right ( Mixer_Strip *ms )
  439. {
  440. int i = mixer_strips->find( ms );
  441. if ( i < mixer_strips->children() - 1 )
  442. insert( ms, i + 2 );
  443. }
  444. void Mixer::remove ( Mixer_Strip *ms )
  445. {
  446. MESSAGE( "Remove mixer strip \"%s\"", ms->name() );
  447. mixer_strips->remove( ms );
  448. if ( parent() )
  449. parent()->redraw();
  450. }
  451. Mixer_Strip *
  452. Mixer::event_inside ( void )
  453. {
  454. for ( int i = mixer_strips->children(); i--; )
  455. if ( Fl::event_inside( mixer_strips->child(i) ) )
  456. return (Mixer_Strip*)mixer_strips->child(i);
  457. return NULL;
  458. }
  459. bool
  460. Mixer::contains ( Mixer_Strip *ms )
  461. {
  462. return ms->parent() == mixer_strips;
  463. }
  464. /* set the ideal number of rows... All may not actually fit. */
  465. void
  466. Mixer::rows ( int ideal_rows )
  467. {
  468. int sh;
  469. int actual_rows = 1;
  470. if ( ideal_rows > 1 )
  471. {
  472. sh = (scroll->h() / ideal_rows ) - (mixer_strips->vspacing() * (ideal_rows - 1));
  473. mixer_strips->flow( true );
  474. if ( sh < Mixer_Strip::min_h() )
  475. {
  476. int can_fit = ( scroll->h() - 18 ) / Mixer_Strip::min_h();
  477. actual_rows = can_fit > 0 ? can_fit : 1;
  478. }
  479. else
  480. actual_rows = ideal_rows;
  481. }
  482. else
  483. actual_rows = 1;
  484. if ( 1 == actual_rows )
  485. {
  486. sh = (scroll->h() - 18);
  487. mixer_strips->flow( false );
  488. actual_rows = 1;
  489. }
  490. int tw = 0;
  491. for ( int i = 0; i < mixer_strips->children(); ++i )
  492. {
  493. Mixer_Strip *t = (Mixer_Strip*)mixer_strips->child( i );
  494. t->size( t->w(), sh );
  495. tw += t->w() + mixer_strips->hspacing();
  496. }
  497. if ( actual_rows > 1 )
  498. mixer_strips->size( scroll->w() - 18, mixer_strips->h() );
  499. else
  500. mixer_strips->size( tw, mixer_strips->h() );
  501. _rows = ideal_rows;
  502. scroll->redraw();
  503. }
  504. /** retrun a pointer to the track named /name/, or NULL if no track is named /name/ */
  505. Mixer_Strip *
  506. Mixer::track_by_name ( const char *name )
  507. {
  508. for ( int i = mixer_strips->children(); i-- ; )
  509. {
  510. Mixer_Strip *t = (Mixer_Strip*)mixer_strips->child( i );
  511. if ( ! strcmp( name, t->name() ) )
  512. return t;
  513. }
  514. return NULL;
  515. }
  516. /** return a malloc'd string representing a unique name for a new track */
  517. char *
  518. Mixer::get_unique_track_name ( const char *name )
  519. {
  520. char pat[256];
  521. strcpy( pat, name );
  522. for ( int i = 1; track_by_name( pat ); ++i )
  523. snprintf( pat, sizeof( pat ), "%s.%d", name, i );
  524. return strdup( pat );
  525. }
  526. void
  527. Mixer::handle_dirty ( int d, void *v )
  528. {
  529. //Mixer *m = (Mixer*)v;
  530. if ( !nsm )
  531. return;
  532. if ( d == 1 )
  533. nsm->is_dirty();
  534. else if ( d == 0 )
  535. nsm->is_clean();
  536. }
  537. void
  538. Mixer::snapshot ( void )
  539. {
  540. for ( int i = 0; i < mixer_strips->children(); ++i )
  541. ((Mixer_Strip*)mixer_strips->child( i ))->log_children();
  542. }
  543. void
  544. Mixer::new_strip ( void )
  545. {
  546. add( new Mixer_Strip( get_unique_track_name( "Unnamed" ) ) );
  547. }
  548. bool
  549. Mixer::save ( void )
  550. {
  551. MESSAGE( "Saving state" );
  552. Loggable::snapshot_callback( &Mixer::snapshot, this );
  553. Loggable::snapshot( "snapshot" );
  554. return true;
  555. }
  556. static const char options_filename[] = "options";
  557. void
  558. Mixer::load_options ( void )
  559. {
  560. // save options
  561. /* char *path; */
  562. /* asprintf( &path, "%s/options", user_config_dir ); */
  563. /* ((Fl_Menu_Settings*)menubar)->load( menubar->find_item( "&Options" ), path ); */
  564. /* free( path ); */
  565. }
  566. void
  567. Mixer::save_options ( void )
  568. {
  569. /* char *path; */
  570. /* asprintf( &path, "%s/%s", user_config_dir, options_filename ); */
  571. /* ((Fl_Menu_Settings*)menubar)->dump( menubar->find_item( "&Options" ), path ); */
  572. /* free( path ); */
  573. }
  574. void
  575. Mixer::update_menu ( void )
  576. {
  577. project_name->label( Project::name() );
  578. }
  579. /************/
  580. /* Commands */
  581. /************/
  582. bool
  583. Mixer::command_save ( void )
  584. {
  585. if ( ! Project::open() )
  586. {
  587. command_new();
  588. update_menu();
  589. }
  590. save_project_settings();
  591. return Project::save();
  592. }
  593. bool
  594. Mixer::command_load ( const char *path, const char *display_name )
  595. {
  596. mixer->deactivate();
  597. if ( Project::open( path ) )
  598. {
  599. // fl_alert( "Error opening project specified on commandline: %s", Project::errstr( err ) );
  600. return false;
  601. }
  602. if ( display_name )
  603. Project::name( display_name );
  604. load_project_settings();
  605. update_menu();
  606. mixer->activate();
  607. return true;
  608. }
  609. bool
  610. Mixer::command_new ( const char *path, const char *display_name )
  611. {
  612. if ( ! Project::create( path, "" ) )
  613. return false;
  614. if ( display_name )
  615. Project::name( display_name );
  616. load_project_settings();
  617. update_menu();
  618. return true;
  619. // fl_alert( "Error creating project!" );
  620. }
  621. void
  622. Mixer::command_quit ( void )
  623. {
  624. if ( Loggable::dirty() )
  625. {
  626. int i = fl_choice( "There have been changes since the last save. Quitting now will discard them", "Discard", "Cancel", NULL );
  627. if ( i != 0 )
  628. return;
  629. }
  630. quit();
  631. }
  632. /* */
  633. void
  634. Mixer::command_add_strip ( void )
  635. {
  636. new_strip();
  637. }