/[svn]/gigedit/trunk/src/plugin/linuxsamplerplugin.cpp
ViewVC logotype

Diff of /gigedit/trunk/src/plugin/linuxsamplerplugin.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2689 by schoenebeck, Sun Jan 4 17:19:19 2015 UTC revision 3068 by schoenebeck, Mon Jan 2 22:13:01 2017 UTC
# Line 1  Line 1 
1  /*  /*
2   * Copyright (C) 2007 - 2015 Andreas Persson   * Copyright (C) 2007 - 2017 Andreas Persson
3   *   *
4   * This program is free software; you can redistribute it and/or   * This program is free software; you can redistribute it and/or
5   * modify it under the terms of the GNU General Public License as   * modify it under the terms of the GNU General Public License as
# Line 19  Line 19 
19    
20  #include "linuxsamplerplugin.h"  #include "linuxsamplerplugin.h"
21    
22  #include <linuxsampler/plugins/InstrumentEditorFactory.h>  #ifdef LIBLINUXSAMPLER_HEADER_FILE
23  #include <linuxsampler/engines/Engine.h>  # include LIBLINUXSAMPLER_HEADER_FILE(plugins/InstrumentEditorFactory.h)
24  #include <linuxsampler/engines/EngineChannel.h>  # include LIBLINUXSAMPLER_HEADER_FILE(engines/Engine.h)
25    # include LIBLINUXSAMPLER_HEADER_FILE(engines/EngineChannel.h)
26    #else
27    # include <linuxsampler/plugins/InstrumentEditorFactory.h>
28    # include <linuxsampler/engines/Engine.h>
29    # include <linuxsampler/engines/EngineChannel.h>
30    #endif
31    
32  #include "../gigedit/gigedit.h"  #include "../gigedit/gigedit.h"
33  #include "../gigedit/global.h"  #include "../gigedit/global.h"
34    
# Line 36  LinuxSamplerPlugin::LinuxSamplerPlugin() Line 43  LinuxSamplerPlugin::LinuxSamplerPlugin()
43  }  }
44    
45  LinuxSamplerPlugin::~LinuxSamplerPlugin() {  LinuxSamplerPlugin::~LinuxSamplerPlugin() {
46      if (pApp) delete (GigEdit*) pApp;      if (pApp) delete static_cast<GigEdit*>(pApp);
47  }  }
48    
49  int LinuxSamplerPlugin::Main(void* pInstrument, String sTypeName, String sTypeVersion, void* /*pUserData*/) {  int LinuxSamplerPlugin::Main(void* pInstrument, String sTypeName, String sTypeVersion, void* /*pUserData*/) {
# Line 46  int LinuxSamplerPlugin::Main(void* pInst Line 53  int LinuxSamplerPlugin::Main(void* pInst
53  int LinuxSamplerPlugin::Main(void* pInstrument, String sTypeName, String sTypeVersion) {  int LinuxSamplerPlugin::Main(void* pInstrument, String sTypeName, String sTypeVersion) {
54      std::cout << "Entered Gigedit Main() loop :)\n" << std::flush;      std::cout << "Entered Gigedit Main() loop :)\n" << std::flush;
55      gig::Instrument* pGigInstr = static_cast<gig::Instrument*>(pInstrument);      gig::Instrument* pGigInstr = static_cast<gig::Instrument*>(pInstrument);
56      GigEdit* app = (GigEdit*) pApp;      GigEdit* app = static_cast<GigEdit*>(pApp);
57    
58      // connect notification signals      // connect notification signals
59      app->signal_file_structure_to_be_changed().connect(      app->signal_file_structure_to_be_changed().connect(
# Line 124  int LinuxSamplerPlugin::Main(void* pInst Line 131  int LinuxSamplerPlugin::Main(void* pInst
131      app->signal_switch_sampler_instrument().connect(      app->signal_switch_sampler_instrument().connect(
132          sigc::mem_fun(*this, &LinuxSamplerPlugin::__requestSamplerToSwitchInstrument)          sigc::mem_fun(*this, &LinuxSamplerPlugin::__requestSamplerToSwitchInstrument)
133      );      );
134        app->signal_script_to_be_changed.connect(
135            sigc::bind(
136                sigc::mem_fun(
137                    *this, &LinuxSamplerPlugin::NotifyDataStructureToBeChanged
138                ),
139                "gig::Script"
140            )
141        );
142        app->signal_script_changed.connect(
143            sigc::bind(
144                sigc::mem_fun(
145                    *this, &LinuxSamplerPlugin::NotifyDataStructureChanged
146                ),
147                "gig::Script"
148            )
149        );
150    
151      // register a timeout job to gigedit's main loop, so we can poll the      // register a timeout job to gigedit's main loop, so we can poll the
152      // the sampler periodically for MIDI events (I HOPE it works on all      // the sampler periodically for MIDI events (I HOPE it works on all
# Line 142  int LinuxSamplerPlugin::Main(void* pInst Line 165  int LinuxSamplerPlugin::Main(void* pInst
165    
166  bool LinuxSamplerPlugin::__onPollPeriod() {  bool LinuxSamplerPlugin::__onPollPeriod() {
167      #if HAVE_LINUXSAMPLER_VIRTUAL_MIDI_DEVICE      #if HAVE_LINUXSAMPLER_VIRTUAL_MIDI_DEVICE
168      GigEdit* app = (GigEdit*) pApp;      GigEdit* app = static_cast<GigEdit*>(pApp);
169      if (!NotesChanged()) return true;      if (!NotesChanged()) return true;
170      for (int iKey = 0; iKey < 128; iKey++)      for (int iKey = 0; iKey < 128; iKey++)
171          if (NoteChanged(iKey))          if (NoteChanged(iKey))
# Line 160  void LinuxSamplerPlugin::__onSamplesToBe Line 183  void LinuxSamplerPlugin::__onSamplesToBe
183      std::set<void*> samples;      std::set<void*> samples;
184      for (      for (
185          std::list<gig::Sample*>::iterator iter = lSamples.begin();          std::list<gig::Sample*>::iterator iter = lSamples.begin();
186          iter != lSamples.end(); iter++          iter != lSamples.end(); ++iter
187      ) samples.insert((void*)*iter);      ) samples.insert((void*)*iter);
188      // finally send notification to sampler      // finally send notification to sampler
189      NotifySamplesToBeRemoved(samples);      NotifySamplesToBeRemoved(samples);

Legend:
Removed from v.2689  
changed lines
  Added in v.3068

  ViewVC Help
Powered by ViewVC