Skip to content

Commit

Permalink
psuh
Browse files Browse the repository at this point in the history
  • Loading branch information
ABunchOfWhales committed Mar 5, 2014
1 parent 2962868 commit 7f70bfb
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 77 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ file (GLOB prodatum_SOURCES *.C)
add_executable (prodatum ${prodatum_SOURCES})

if(WIN32)
ADD_DEFINITIONS(-DWIN32 -Wall -Wno-char-subscripts -Wno-write-strings)
ADD_DEFINITIONS(-DWIN32 -Wall -W -Wno-char-subscripts -Wno-write-strings)
set(CMAKE_EXE_LINKER_FLAGS "-mwindows -m32 -static-libgcc -static-libstdc++")
set(ADDITIONAL_LIBRARIES winmm ole32 uuid comctl32 wsock32)
endif(WIN32)

if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
ADD_DEFINITIONS(-DOSX -DUSE_MLOCK -Wall -Wno-char-subscripts -Wno-write-strings)
ADD_DEFINITIONS(-DOSX -DUSE_MLOCK -Wall -W -Wno-char-subscripts -Wno-write-strings)
set(ADDITIONAL_LIBRARIES "-framework Carbon -framework ApplicationServices -framework CoreMIDI -framework CoreAudio")
endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")

IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
ADD_DEFINITIONS(-DUSE_MLOCK -D__linux -Wall -Wno-char-subscripts -Wno-write-strings)
ADD_DEFINITIONS(-DUSE_MLOCK -D__linux -Wall -W -Wno-char-subscripts -Wno-write-strings)
set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++")
set(ADDITIONAL_LIBRARIES X11 Xft fontconfig Xinerama asound pthread)
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
Expand Down
6 changes: 3 additions & 3 deletions data.C
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,10 @@ int Preset_Dump::set_value(int id, int value, int layer)
{
parameter current = undo_s.front();
if (current.id != id || current.layer != layer)
add_undo(id, value, layer);
add_undo(id, layer);
}
else
add_undo(id, value, layer);
add_undo(id, layer);
}
// for names, only one byte is used per character...
data[offset] = value % 128;
Expand Down Expand Up @@ -663,7 +663,7 @@ void Preset_Dump::copy(int type, int src, int dst)
}
}

void Preset_Dump::add_undo(int id, int value, int layer)
void Preset_Dump::add_undo(int id, int layer)
{
if (disable_add_undo)
return;
Expand Down
2 changes: 1 addition & 1 deletion data.H
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class Preset_Dump
/// redo stack
std::deque<parameter> redo_s;
/// push undo parameter on stack
void add_undo(int id, int value, int layer);
void add_undo(int id, int layer);
void update_ui_from_xdo(int id, int value, int layer) const;
/**
* maps parameter IDs to offset values in the dump
Expand Down
40 changes: 20 additions & 20 deletions midi.C
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ static void process_midi_in(void*)
ui->init_log->append("\nprocess_midi_in: Received unrecognized e-mu sysex:\n");
char* __buffer = (char*) malloc(len * sizeof(char));
for (unsigned int i = 0; i < len; i++)
snprintf(__buffer + i, 1, "%x", (int) sysex + i);
snprintf(__buffer + i, 1, "%x", *(sysex + i));
ui->init_log->append(__buffer);
ui->init_log->append("\n");
free(__buffer);
Expand Down Expand Up @@ -416,7 +416,7 @@ static void process_midi_in(void*)
ui->init_log->append("\nprocess_midi_in: Received unknown sysex:\n");
char* __buffer = (char*) malloc(len * sizeof(char));
for (unsigned int i = 0; i < len; i++)
snprintf(__buffer + i, 1, "%x", (int) sysex + i);
snprintf(__buffer + i, 1, "%x", *(sysex + i));
ui->init_log->append(__buffer);
ui->init_log->append("\n");
free(__buffer);
Expand Down Expand Up @@ -535,15 +535,15 @@ static void process_midi_in(void*)
// log midi events
if (cfg->get_cfg_option(CFG_LOG_EVENTS_IN))
{
char buf[30];
snprintf(buf, 30, "\nIE.%lu::%02X%02X%02X", ++count_events, event[0], event[1], event[2]);
ui->logbuf->append(buf);
char _b[30];
snprintf(_b, 30, "\nIE.%lu::%02X%02X%02X", ++count_events, event[0], event[1], event[2]);
ui->logbuf->append(_b);
}
}
}
#ifndef __linux
if (timer_running)
Fl::repeat_timeout(.01, process_midi_in);
Fl::repeat_timeout(.01, process_midi_in);
#endif
}

Expand All @@ -562,7 +562,7 @@ MIDI::MIDI()
port_thru = 0;
#ifdef __linux
if (pipe(p) == -1)
fprintf(stderr, "*** Could not open pipe\n%s", strerror(errno));
fprintf(stderr, "*** Could not open pipe\n%s", strerror(errno));
#endif
read_buffer = jack_ringbuffer_create(RINGBUFFER_READ);
write_buffer = jack_ringbuffer_create(RINGBUFFER_WRITE);
Expand Down Expand Up @@ -971,7 +971,7 @@ void MIDI::write_event(int status, int value1, int value2, int channel) const
if (cfg->get_cfg_option(CFG_LOG_EVENTS_OUT))
{
char buf[30];
snprintf(buf, 30, "\nOE.%lu::%02x%02x%02x", ++count, stat, value1, value2);
snprintf(buf, 30, "\nOE.%lu::%02x%02x%02x", ++count, stat, v1, v2);
ui->logbuf->append(buf);
}
}
Expand All @@ -981,18 +981,18 @@ void MIDI::ack(int packet) const
pmesg("MIDI::ack(packet: %d) \n", packet);
unsigned char l = packet % 128;
unsigned char m = packet / 128;
unsigned char ack[] =
unsigned char a[] =
{ 0xf0, 0x18, 0x0f, midi_device_id, 0x55, 0x7f, l, m, 0xf7 };
write_sysex(ack, 9);
write_sysex(a, 9);
}
void MIDI::nak(int packet) const
{
pmesg("MIDI::nak(packet: %d) \n", packet);
unsigned char l = packet % 128;
unsigned char m = packet / 128;
unsigned char nak[] =
unsigned char n[] =
{ 0xf0, 0x18, 0x0f, midi_device_id, 0x55, 0x7e, l, m, 0xf7 };
write_sysex(nak, 9);
write_sysex(n, 9);
}

void MIDI::eof() const
Expand Down Expand Up @@ -1119,18 +1119,18 @@ void MIDI::copy(int cmd, int src, int dst, int src_l, int dst_l, int rom_id) con
{
unsigned char s_l = src_l & 0xff;
unsigned char d_l = dst_l & 0xff;
unsigned char copy[] =
unsigned char cm[] =
{ 0xf0, 0x18, 0x0f, midi_device_id, 0x55, c, srcl, srcm, s_l, 0, dstl, dstm, d_l, 0, rl, rm, 0xf7 };
write_sysex(copy, 17);
write_sysex(cm, 17);
}
// layer independent
else
{
if (cmd == 0x2c) // copy setup
{
unsigned char copy[] =
unsigned char cm[] =
{ 0xf0, 0x18, 0x0f, midi_device_id, 0x55, c, srcl, srcm, dstl, dstm, 0xf7 };
write_sysex(copy, 11);
write_sysex(cm, 11);
// set device id to our chosen device id
// so it will respond to our requests
edit_parameter_value(388, midi_device_id);
Expand All @@ -1139,9 +1139,9 @@ void MIDI::copy(int cmd, int src, int dst, int src_l, int dst_l, int rom_id) con
}
else
{
unsigned char copy[] =
unsigned char cm[] =
{ 0xf0, 0x18, 0x0f, midi_device_id, 0x55, c, srcl, srcm, dstl, dstm, rl, rm, 0xf7 };
write_sysex(copy, 13);
write_sysex(cm, 13);
}
}
}
Expand Down Expand Up @@ -1185,9 +1185,9 @@ void MIDI::randomize() const
{ 0xf0, 0x18, 0x0f, midi_device_id, 0x55, 0x72, 0x7f, 0x7f, 0, 0, b1l, b1m, b2l, b2m, 0xf7 };
write_sysex(seedr, 15);
}
unsigned char randomize[] =
unsigned char r[] =
{ 0xf0, 0x18, 0x0f, midi_device_id, 0x55, 0x71, 0x7f, 0x7f, 0, 0, 0xf7 };
write_sysex(randomize, 11);
write_sysex(r, 11);
mysleep(200);
request_preset_dump(-1, 0);
}
12 changes: 6 additions & 6 deletions prodatum.C
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ void PD_UI::select(int l)
l = prev;
}
((Fl_Button*) selector->child(l))->setonly();
Fl::flush();
prev = selected;
if (l == 5)
{
Expand Down Expand Up @@ -805,15 +806,14 @@ void PD_UI::Reset(char user_data, char rom_data)
dirent **files;
int num_files = fl_filename_list(config_dir, &files);
char buf[PATH_MAX];
int f_size = 20;
char f[f_size];
char f[20];
int deleted = 0;
if (user_data >= 0)
{
if (user_data == 127) // delete all user data
snprintf(f, f_size, "n_???_0_*");
snprintf(f, 20, "n_???_0_*");
else
snprintf(f, f_size, "n_???_0_%d", user_data);
snprintf(f, 20, "n_???_0_%d", user_data);
for (int i = 0; i < num_files; i++)
{
if (fl_filename_match(files[i]->d_name, f))
Expand All @@ -840,9 +840,9 @@ void PD_UI::Reset(char user_data, char rom_data)
if (rom_data >= 1)
{
if (rom_data == 1) // delete all rom data
snprintf(f, f_size, "n_???_[123456789]*");
snprintf(f, 20, "n_???_[123456789]*");
else
snprintf(f, f_size, "n_???_%d", rom_data);
snprintf(f, 20, "n_???_%d", rom_data);
for (int i = 0; i < num_files; i++)
{
if (fl_filename_match(files[i]->d_name, f))
Expand Down
8 changes: 4 additions & 4 deletions pxk.C
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,7 @@ void PXK::incoming_inquiry_data(const unsigned char* data, int len)
}
}

char PXK::get_rom_index(char id) const
unsigned char PXK::get_rom_index(char id) const
{
if (id == 0)
return 0;
Expand All @@ -831,7 +831,7 @@ char PXK::get_rom_index(char id) const
return 3;
if (rom_index[4] == id)
return 4;
return -1;
return 5;
}

void PXK::incoming_hardware_config(const unsigned char* data, int len)
Expand Down Expand Up @@ -1153,7 +1153,7 @@ void PXK::incoming_generic_name(const unsigned char* data)
return;
}
int rom_id = data[9] + 128 * data[10];
if (get_rom_index(rom_id) == -1)
if (get_rom_index(rom_id) == 5)
{
pmesg("*** ROM %d does not exist\n", data[9] + 128 * data[10]);
display_status("*** Received unknown name type.");
Expand Down Expand Up @@ -1219,7 +1219,7 @@ void PXK::incoming_arp_dump(const unsigned char* data, int len)
return;
}
int rom_id = data[len - 3] + 128 * data[len - 2];
if (get_rom_index(rom_id) != -1)
if (get_rom_index(rom_id) != 5)
{
rom[get_rom_index(rom_id)]->set_name(ARP, number, data + 14);
++init_progress;
Expand Down
2 changes: 1 addition & 1 deletion pxk.H
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ private:
public:
ROM* rom[5];
unsigned char roms; // number of roms
char get_rom_index(char) const;
unsigned char get_rom_index(char) const;

/*
* preset specific
Expand Down
2 changes: 1 addition & 1 deletion ringbuffer.C
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jack_ringbuffer_create (size_t sz)

rb = (jack_ringbuffer_t*) malloc (sizeof (jack_ringbuffer_t));

for (power_of_two = 1; 1 << power_of_two < sz; power_of_two++);
for (power_of_two = 1; 1 << power_of_two < (int) sz; power_of_two++);

rb->size = 1 << power_of_two;
rb->size_mask = rb->size;
Expand Down
Loading

0 comments on commit 7f70bfb

Please sign in to comment.