-Load sample remembers location, updated Special colour / Rclick menu layout

This commit is contained in:
Harry van Haaren 2013-12-04 14:46:44 +00:00
parent 211df0fa0f
commit 60decf79ba
7 changed files with 32 additions and 9 deletions

View file

@ -222,7 +222,7 @@ void ClipSelector::draw()
if ( i == special )
{
cairo_rectangle( cr, x+2, drawY, clipWidth -1, clipHeight - 3 );
cairo_set_source_rgba(cr, 1.0, 0.408, 0.0, alpha);
cairo_set_source_rgba(cr, 0.0, 153 / 255.f, 1.0, alpha);
cairo_stroke( cr );
}
@ -285,7 +285,8 @@ int ClipSelector::handle(int event)
Fl_Menu_Item rclick_menu[] =
{
{ "Load" },
{ "Beats", 0, 0, 0, FL_SUBMENU },
{ "Special"},
{ "Beats", 0, 0, 0, FL_SUBMENU | FL_MENU_DIVIDER },
{"1 "},
{"2"},
{"4"},
@ -296,8 +297,7 @@ int ClipSelector::handle(int event)
{0},
//{ "Record" },
{ "Use as tempo" },
{ "Special select"},
{ "Rename" },
{ "Rename", 0, 0, 0, FL_MENU_DIVIDER},
{ "Clear" },
{ 0 }
};
@ -337,7 +337,7 @@ int ClipSelector::handle(int event)
EventLooperUseAsTempo e (ID, clipNum);
writeToDspRingbuffer( &e );
}
else if ( strcmp(m->label(), "Special select") == 0 )
else if ( strcmp(m->label(), "Special") == 0 )
{
//printf("special selected %i, %i\n", ID, clipNum );
EventGridSelectNewChosen e( ID, clipNum);

View file

@ -14,7 +14,7 @@ void ControllerUpdater::registerController( Controller* controller )
if (!controller)
LUPPP_ERROR("Register Controller passed NULL controller!");
LUPPP_NOTE("Registering controller %s", controller->getName().c_str() );
//LUPPP_NOTE("Registering controller %s", controller->getName().c_str() );
// store the controller instance
c.push_back( controller );

View file

@ -26,6 +26,8 @@ using namespace std;
DiskReader::DiskReader()
{
// FIXME: could use a config item of sample location?
lastLoadedSamplePath = getenv("HOME");
}
int DiskReader::loadPreferences()
@ -266,6 +268,10 @@ int DiskReader::loadSample( int track, int scene, string path )
// write audioBuffer to DSP
EventLooperLoad e = EventLooperLoad( track, scene, ab );
writeToDspRingbuffer( &e );
char* tmp = strdup( path.c_str() );
lastLoadedSamplePath = dirname( tmp );
free(tmp);
}
else
{
@ -277,6 +283,11 @@ int DiskReader::loadSample( int track, int scene, string path )
}
std::string DiskReader::getLastLoadedSamplePath()
{
return lastLoadedSamplePath;
}
int DiskReader::readSession( std::string path )
{
cout << "DiskReader::readSession() " << path << endl;

View file

@ -30,6 +30,7 @@ class DiskReader
/// loads a sample into a new AudioBuffer, returning the buffer
int loadSample( int track, int scene, std::string path );
std::string getLastLoadedSamplePath();
/// reads a session from disk, parsing and restoring state
int readSession( std::string path );
@ -51,6 +52,9 @@ class DiskReader
// ui show editor
int showAudioEditor(AudioBuffer* );
// sample load dialog
std::string lastLoadedSamplePath;
};
#endif // LUPPP_DISK_READER_H

View file

@ -157,7 +157,7 @@ static void selectLoadController(Fl_Widget* w, void* data)
if ( strcmp( path.c_str(), "" ) == 0 )
return;
LUPPP_NOTE("%s","ADD Controller cb");
//LUPPP_NOTE("%s","ADD Controller cb");
GenericMIDI* c = new GenericMIDI( path );
if ( c->status() == Controller::CONTROLLER_OK )

View file

@ -246,7 +246,10 @@ void Gui::selectLoadSample( int track, int scene )
fnfc.title("Pick a file");
fnfc.type(Fl_Native_File_Chooser::BROWSE_FILE);
fnfc.filter("Wav\t*.wav");
fnfc.directory( getenv("HOME") ); // default directory to use
std::string defLoadPath = gui->getDiskReader()->getLastLoadedSamplePath();
fnfc.directory( defLoadPath.c_str() ); // default directory to use
// Show native chooser
switch ( fnfc.show() ) {
case -1: printf("ERROR: %s\n", fnfc.errmsg()); break; // ERROR

View file

@ -108,10 +108,12 @@ void LooperClip::load( AudioBuffer* ab )
// set the endpoint to the buffer's size
_recordhead = _buffer->getData().size();
#ifdef DEBUG_BUFFER
char buffer [50];
sprintf (buffer, "LC::load() t %i, s %i, aF %i",track, scene, int(_buffer->getAudioFrames()) );
EventGuiPrint e( buffer );
writeToGuiRingbuffer( &e );
#endif
}
void LooperClip::setRequestedBuffer( AudioBuffer* ab )
@ -155,7 +157,10 @@ void LooperClip::recieveSaveBuffer( AudioBuffer* saveBuffer )
}
else
{
LUPPP_ERROR("LooperClip @ %i, %i could not save, save buffer too small!", track, scene);
char buffer [50];
sprintf (buffer, "LC:: %i, s: can't save, buf too small",track, scene );
EventGuiPrint e( buffer );
writeToGuiRingbuffer( &e );
Stately::error("");
}
}