~ubuntu-branches/ubuntu/breezy/muse/breezy

« back to all changes in this revision

Viewing changes to synti/iiwu/iiwugui.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Kobras
  • Date: 2004-02-07 15:18:22 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040207151822-es27xxkzbcxkebjm
Tags: 0.6.3-1
* New upstream version.
* Added patches:
  + [10_alsa_init_fix] New, from upstream CVS.
    Initialize direction variable when setting Alsa parameters.
  + [10_canvas_translation_fix] New, from upstream CVS.
    Do not translate tooltips twice in canvas popup.
  + [10_checkbox_fix] New, from upstream CVS.
    Use proper set/test methods on metronome checkboxes.
  + [10_html_doc_cleanup] New.
    Fix links and HTML errors in documentation.
  + [20_allow_system_timer] New.
    The new upstream version fails by default if the real-time clock
    could not be accessed (usually the case when not running suid-root).
    This patch reverts the old behaviour of falling back to the more
    inaccurate system timer.
* Updated patches:
  + [11_PIC_fixes_fixup] Rediffed.
* Removed patches:
  + [20_no_atomic_asm] Merged upstream.
* debian/compat: Splice out debhelper compatibility level from rules file.
* debian/control: Build-depend on latest jack release by default.
  Closes: #228788
* debian/control: Bump standards version.
* debian/control: Use auto-generated debconf dependency via misc:Depends.
* debian/control: Minor tweaks to the long description.
* debian/control: Tighten fluidsynth build dependency to sane version.
* debian/muse.doc-base: New. Register HTML documentation with doc-base.
* debian/templates: Tiny rewording, and typo fix.
* debian/templates, debian/po/*: Switch to po-debconf for translations.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
//=========================================================
2
 
//  MusE
3
 
//  Linux Music Editor
4
 
//  $Id: iiwugui.cpp,v 1.2 2002/02/01 17:55:39 bob Exp $
5
 
//
6
 
//    This is a simple GUI implemented with QT for
7
 
//    iiwu software synthesizer.
8
 
//
9
 
//  (C) Copyright 2001 Werner Schweer (ws@seh.de)
10
 
//=========================================================
11
 
 
12
 
#include <unistd.h>
13
 
#include <stdlib.h>
14
 
#include "iiwugui.h"
15
 
#include <qapplication.h>
16
 
#include <qpixmap.h>
17
 
#include <qlayout.h>
18
 
#include <qlabel.h>
19
 
#include <qlineedit.h>
20
 
#include <qtoolbutton.h>
21
 
#include <qpushbutton.h>
22
 
#include <qfiledialog.h>
23
 
#include <qmessagebox.h>
24
 
#include <qsocketnotifier.h>
25
 
 
26
 
/*
27
 
      The interface to the software synthesizer is implemented
28
 
      as a pipe connected from stdout of this gui process to
29
 
      MusE. MusE redirects the received input to the iiwu software
30
 
      synthesizer midi device.
31
 
 
32
 
      In short communication to the synt takes place as
33
 
      midi commands written to stdout.
34
 
 
35
 
      All special handling of the synth is done via
36
 
      sysex midi commands.
37
 
*/
38
 
 
39
 
//---------------------------------------------------------
40
 
//   IIWUGui
41
 
//---------------------------------------------------------
42
 
 
43
 
IIWUGui::IIWUGui()
44
 
   : IIWUGuiBase(0, "iiwugui", WType_TopLevel | WDestructiveClose)
45
 
      {
46
 
      QSocketNotifier* s = new QSocketNotifier(0, QSocketNotifier::Read);
47
 
      connect(s, SIGNAL(activated(int)), SLOT(readStdin(int)));
48
 
 
49
 
      connect(fdialogButton, SIGNAL(clicked()), SLOT(soundFontFileDialog()));
50
 
      connect(loadButton, SIGNAL(clicked()), SLOT(loadFont()));
51
 
      }
52
 
 
53
 
//---------------------------------------------------------
54
 
//   readStdin
55
 
//---------------------------------------------------------
56
 
 
57
 
void IIWUGui::readStdin(int fd)
58
 
      {
59
 
      char buffer[128];
60
 
      int n = ::read(fd, buffer, 128);
61
 
      printf("IIWU GUI: read %d Bytes from STDIN\n", n);
62
 
      }
63
 
 
64
 
//---------------------------------------------------------
65
 
//   loadFont
66
 
//    sysex f0 7c 00 01 name f7
67
 
//---------------------------------------------------------
68
 
 
69
 
void IIWUGui::loadFont()
70
 
      {
71
 
      if (!pathEntry->text().isEmpty()) {
72
 
            QFileInfo fi(pathEntry->text());
73
 
            if (!fi.exists()) {
74
 
                  QString s = "SoundFont " + pathEntry->text() + " does not exists";
75
 
                  QMessageBox::critical(this, "IIWU: open Soundfile", s);
76
 
                  return;
77
 
                  }
78
 
 
79
 
            fputc(0xf0, stdout);
80
 
            fputc(0x7c, stdout);    // MusE soft synthesizer
81
 
            fputc(0x00, stdout);    // iiwu
82
 
            fputc(0x01, stdout);    // load sound font
83
 
            const char* path = pathEntry->text().latin1();
84
 
            fputs(path, stdout);
85
 
            fputc(0xf7, stdout);
86
 
            fflush(stdout);
87
 
            }
88
 
      }
89
 
 
90
 
//---------------------------------------------------------
91
 
//   soundFontFileDialog
92
 
//---------------------------------------------------------
93
 
 
94
 
void IIWUGui::soundFontFileDialog()
95
 
      {
96
 
      QString s = QFileDialog::getOpenFileName(QString::null, "*.[Ss][Ff]2", this);
97
 
      if (!s.isEmpty()) {
98
 
            pathEntry->setText(s);
99
 
            }
100
 
      }
101
 
 
102
 
//---------------------------------------------------------
103
 
//   closeEvent
104
 
//---------------------------------------------------------
105
 
 
106
 
void IIWUGui::closeEvent(QCloseEvent* ce)
107
 
      {
108
 
      ce->accept();
109
 
      exit(0);
110
 
      }
111
 
 
112
 
//---------------------------------------------------------
113
 
//   main
114
 
//---------------------------------------------------------
115
 
 
116
 
int main(int argc, char* argv[])
117
 
      {
118
 
      QApplication app(argc, argv, true);
119
 
      QWidget* w = new IIWUGui;
120
 
      if (argc > 1)
121
 
            w->setCaption(argv[1]);
122
 
      w->show();
123
 
      app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));
124
 
      qApp->exec();
125
 
      }
126