Browse files

restored load methods in midi_bind, the AU uses them independently of…

… the engine. the engine can still do it the new way. added macconfigure script
  • Loading branch information...
1 parent 1d9bc01 commit 8ddf4c733f19f7b4e12675f63b4563b253691f33 @essej committed May 17, 2012
Showing with 55 additions and 53 deletions.
  1. +3 −0 macconfigure
  2. +50 −50 src/midi_bind.cpp
  3. +2 −3 src/midi_bind.hpp
View
3 macconfigure
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/opt/local/lib/pkgconfig:/usr/lib/pkgconfig CC="gcc-4.0 -m32" CXX="g++-4.0 -m32" ./configure --prefix=/usr/local --with-wxconfig-path=/Users/jesse/src/wxMac-2.8.7/wx-config --with-macosx-sdk --with-macosx-min-version=10.4
View
100 src/midi_bind.cpp
@@ -194,56 +194,56 @@ MidiBindings::clear_bindings ()
}
// Moved to engine for easier access to initial values for toggle
-//bool
-//MidiBindings::load_bindings (string filename, bool append)
-//{
-// //FILE * bindfile = 0;
-// ifstream bindfile;
-//
-// bindfile.open(filename.c_str(), ios::in);
-//
-// if (!bindfile.is_open()) {
-// cerr << "sooperlooper warning: could not open for reading: " << filename << endl;
-// return false;
-// }
-// // todo: look for is in systemwide and ~/.sooperlooper/bindings/
-//
-//
-// return load_bindings (bindfile, append);
-//}
-//
-//bool
-//MidiBindings::load_bindings (std::istream & instream, bool append)
-//{
-// char line[200];
-//
-//
-// if (!append) {
-// clear_bindings();
-// }
-//
-// while ( ! instream.eof())
-// //while (fgets (line, sizeof(line), bindfile) != NULL)
-//
-// {
-// instream.getline (line, sizeof(line));
-//
-// // ignore empty lines and # lines
-// if (line[0] == '\n' || line[0] == '#' || line[0] == '\0') {
-// continue;
-// }
-//
-// MidiBindInfo info;
-//
-// if (!info.unserialize(line)) {
-// continue;
-// }
-//
-// add_binding (info);
-// }
-//
-// return true;
-//}
+bool
+MidiBindings::load_bindings (string filename, bool append)
+{
+ //FILE * bindfile = 0;
+ ifstream bindfile;
+
+ bindfile.open(filename.c_str(), ios::in);
+
+ if (!bindfile.is_open()) {
+ cerr << "sooperlooper warning: could not open for reading: " << filename << endl;
+ return false;
+ }
+ // todo: look for is in systemwide and ~/.sooperlooper/bindings/
+
+
+ return load_bindings (bindfile, append);
+}
+
+bool
+MidiBindings::load_bindings (std::istream & instream, bool append)
+{
+ char line[200];
+
+
+ if (!append) {
+ clear_bindings();
+ }
+
+ while ( ! instream.eof())
+ //while (fgets (line, sizeof(line), bindfile) != NULL)
+
+ {
+ instream.getline (line, sizeof(line));
+
+ // ignore empty lines and # lines
+ if (line[0] == '\n' || line[0] == '#' || line[0] == '\0') {
+ continue;
+ }
+
+ MidiBindInfo info;
+
+ if (!info.unserialize(line)) {
+ continue;
+ }
+
+ add_binding (info);
+ }
+
+ return true;
+}
bool MidiBindings::save_bindings (string filename)
{
View
5 src/midi_bind.hpp
@@ -104,9 +104,8 @@ class MidiBindings
void clear_bindings ();
- // Moved to engine for easier access to initial values for toggle
- //bool load_bindings (std::string filename, bool append=false);
- //bool load_bindings (std::istream & instream, bool append=false);
+ bool load_bindings (std::string filename, bool append=false);
+ bool load_bindings (std::istream & instream, bool append=false);
bool save_bindings (std::string filename);
bool save_bindings (std::ostream & outstream);

1 comment on commit 8ddf4c7

@kasbah
Collaborator

I guess that means initial values for toggle will still be a problem in the AU...

Please sign in to comment.