void gdBrowser::__cb_load_sample() { if (browser->text(browser->value()) == NULL) return; int res = glue_loadChannel((SampleChannel*) ch, browser->get_selected_item(), browser->path_obj->value()); if (res == SAMPLE_LOADED_OK) { do_callback(); mainWin->delSubWindow(WID_SAMPLE_EDITOR); // if editor is open } else if (res == SAMPLE_NOT_VALID) gdAlert("This is not a valid WAVE file."); else if (res == SAMPLE_MULTICHANNEL) gdAlert("Multichannel samples not supported."); else if (res == SAMPLE_WRONG_BIT) gdAlert("This sample has an\nunsupported bit-depth (> 32 bit)."); else if (res == SAMPLE_WRONG_ENDIAN) gdAlert("This sample has a wrong\nbyte order (not little-endian)."); else if (res == SAMPLE_WRONG_FORMAT) gdAlert("This sample is encoded in\nan unsupported audio format."); else if (res == SAMPLE_READ_ERROR) gdAlert("Unable to read this sample."); else if (res == SAMPLE_PATH_TOO_LONG) gdAlert("File path too long."); else gdAlert("Unknown error."); }
int gSampleChannelButton::handle(int e) { int ret = gClick::handle(e); switch (e) { case FL_DND_ENTER: case FL_DND_DRAG: case FL_DND_RELEASE: { ret = 1; break; } case FL_PASTE: { gSampleChannel *gch = (gSampleChannel*) parent(); SampleChannel *ch = gch->ch; int result = glue_loadChannel(ch, gTrim(gStripFileUrl(Fl::event_text())).c_str()); if (result != SAMPLE_LOADED_OK) mainWin->keyboard->printChannelMessage(result); ret = 1; break; } } return ret; }