~ubuntu-branches/ubuntu/oneiric/muse/oneiric

« back to all changes in this revision

Viewing changes to synti/stk/stkgui.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Kobras
  • Date: 2002-04-23 17:28:23 UTC
  • Revision ID: james.westby@ubuntu.com-20020423172823-w8yplzr81a759xa3
Tags: upstream-0.5.2
ImportĀ upstreamĀ versionĀ 0.5.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//=========================================================
 
2
//  MusE
 
3
//  Linux Music Editor
 
4
//  $Id: stkgui.cpp,v 1.1 2002/01/30 12:08:39 muse Exp $
 
5
//
 
6
//    This is a simple GUI implemented with QT for
 
7
//    stk software synthesizer.
 
8
//
 
9
//  (C) Copyright 2001 Werner Schweer (ws@seh.de)
 
10
//=========================================================
 
11
 
 
12
#include <unistd.h>
 
13
#include <stdlib.h>
 
14
 
 
15
#include <qapplication.h>
 
16
#include <qsocketnotifier.h>
 
17
#include "stkgui.h"
 
18
 
 
19
QString homeDir;
 
20
QString instanceName;
 
21
 
 
22
//---------------------------------------------------------
 
23
//   StkGui
 
24
//---------------------------------------------------------
 
25
 
 
26
StkGui::StkGui()
 
27
   : StkGuiBase(0, "stkgui", WType_TopLevel | WDestructiveClose),
 
28
     MidiRawIn()
 
29
      {
 
30
      QSocketNotifier* s = new QSocketNotifier(0, QSocketNotifier::Read);
 
31
      connect(s, SIGNAL(activated(int)), SLOT(readStdin(int)));
 
32
      }
 
33
 
 
34
//---------------------------------------------------------
 
35
//   readStdin
 
36
//---------------------------------------------------------
 
37
 
 
38
void StkGui::readStdin(int fd)
 
39
      {
 
40
      unsigned char buffer[128];
 
41
      int n = ::read(fd, buffer, 128);
 
42
      dataInput(buffer, n);
 
43
      }
 
44
 
 
45
void StkGui::sysexReceived(const unsigned char*, int)
 
46
      {
 
47
      }
 
48
 
 
49
void StkGui::eventReceived(int, int, int)
 
50
      {
 
51
      }
 
52
 
 
53
//---------------------------------------------------------
 
54
//   main
 
55
//---------------------------------------------------------
 
56
 
 
57
int main(int argc, char* argv[])
 
58
      {
 
59
      homeDir = argv[0];
 
60
      instanceName = argv[1];
 
61
 
 
62
      if (homeDir[0] != '/')
 
63
            homeDir = ".";
 
64
 
 
65
      QApplication app(argc, argv, true);
 
66
      QWidget* w = new StkGui;
 
67
      if (argc > 1)
 
68
            w->setCaption(instanceName);
 
69
      w->show();
 
70
      app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));
 
71
      qApp->exec();
 
72
      }
 
73