-Clip names shown in GUI when files loaded

This commit is contained in:
Harry van Haaren 2013-12-09 01:03:00 +00:00
parent e84a39357f
commit 7f96d72d77
4 changed files with 31 additions and 4 deletions

View file

@ -49,7 +49,7 @@ class AudioBuffer
numBeats = 0; numBeats = 0;
audioFrames = 0; audioFrames = 0;
memset( name, 0, sizeof(char)*20 ); memset( name, 0, sizeof(char)*20 );
sprintf( name, "%i", ID ); //sprintf( name, "%i", ID );
} }
/// this function is used for "resizing" an exisiting buffer, and should /// this function is used for "resizing" an exisiting buffer, and should
@ -77,6 +77,11 @@ class AudioBuffer
memcpy( name, n, sizeof(char)* 20 ); memcpy( name, n, sizeof(char)* 20 );
} }
char* getName()
{
return name;
}
int getBeats() int getBeats()
{ {
return numBeats; return numBeats;

View file

@ -214,7 +214,10 @@ void ClipSelector::draw()
cairo_move_to( cr, x + clipHeight + 5, drawY + textHeight ); cairo_move_to( cr, x + clipHeight + 5, drawY + textHeight );
cairo_set_source_rgba( cr, 255 / 255.f, 255 / 255.f , 255 / 255.f , 0.9 ); cairo_set_source_rgba( cr, 255 / 255.f, 255 / 255.f , 255 / 255.f , 0.9 );
cairo_set_font_size( cr, 11 ); cairo_set_font_size( cr, 11 );
cairo_show_text( cr, clips[i].getName().c_str() );
std::string tmp = clips[i].getName().substr(0,8);
cairo_show_text( cr, tmp.c_str() );
// special indicator? // special indicator?
if ( i == special ) if ( i == special )

View file

@ -91,6 +91,9 @@ int DiskReader::loadPreferences()
LUPPP_NOTE("No default controllers active."); LUPPP_NOTE("No default controllers active.");
} }
cJSON_Delete( preferencesJson ); cJSON_Delete( preferencesJson );
delete[] sampleString; delete[] sampleString;
} }
@ -174,7 +177,10 @@ int DiskReader::loadSample( int track, int scene, string path )
data.end_of_input = 0; data.end_of_input = 0;
data.src_ratio = resampleRatio; data.src_ratio = resampleRatio;
int ret = src_simple ( &data, SRC_SINC_FASTEST, 1 );
// FIXME: ADD FEATURE: Config option for resampling quality on load?
int ret = src_simple ( &data, SRC_LINEAR, 1 );
//int ret = src_simple ( &data, SRC_SINC_FASTEST, 1 );
LUPPP_NOTE("%s%i%s%i", "Resampling finished, from ", data.input_frames_used, " to ", data.output_frames_gen ); LUPPP_NOTE("%s%i%s%i", "Resampling finished, from ", data.input_frames_used, " to ", data.output_frames_gen );
@ -276,16 +282,29 @@ int DiskReader::loadSample( int track, int scene, string path )
else else
{ {
LUPPP_NOTE("AudioBuffer set %i beats.", ab->getBeats() ); LUPPP_NOTE("AudioBuffer set %i beats.", ab->getBeats() );
std::string name = path;
int i = name.find_last_of('/') + 1;
std::string sub = name.substr( i );
ab->setName( sub.c_str() );
loadableBuffer = true; loadableBuffer = true;
} }
} }
if ( loadableBuffer ) if ( loadableBuffer )
{ {
std::string n = ab->getName();
// write audioBuffer to DSP // write audioBuffer to DSP
EventLooperLoad e = EventLooperLoad( track, scene, ab ); EventLooperLoad e = EventLooperLoad( track, scene, ab );
writeToDspRingbuffer( &e ); writeToDspRingbuffer( &e );
// now write audiobuffer name to GUI on track, scene
gui->getTrack( track )->getClipSelector()->clipName( scene, n );
char* tmp = strdup( path.c_str() ); char* tmp = strdup( path.c_str() );
lastLoadedSamplePath = dirname( tmp ); lastLoadedSamplePath = dirname( tmp );
free(tmp); free(tmp);

View file

@ -97,7 +97,7 @@ int main(int argc, char** argv)
// setup the testing Gui / JACK: Jack first, then GUI // setup the testing Gui / JACK: Jack first, then GUI
Jack::setup("LupppTEST"); Jack::setup("LupppTEST");
gui = new Gui(argv[0]); gui = new Gui( argv[0] );
// test offline functionality // test offline functionality
testResult += gui->getDiskReader()->runTests(); testResult += gui->getDiskReader()->runTests();