-Clip names shown in GUI when files loaded

main
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;
audioFrames = 0;
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
@ -77,6 +77,11 @@ class AudioBuffer
memcpy( name, n, sizeof(char)* 20 );
}
char* getName()
{
return name;
}
int getBeats()
{
return numBeats;

View File

@ -214,7 +214,10 @@ void ClipSelector::draw()
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_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?
if ( i == special )

View File

@ -91,6 +91,9 @@ int DiskReader::loadPreferences()
LUPPP_NOTE("No default controllers active.");
}
cJSON_Delete( preferencesJson );
delete[] sampleString;
}
@ -174,7 +177,10 @@ int DiskReader::loadSample( int track, int scene, string path )
data.end_of_input = 0;
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 );
@ -276,16 +282,29 @@ int DiskReader::loadSample( int track, int scene, string path )
else
{
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;
}
}
if ( loadableBuffer )
{
std::string n = ab->getName();
// write audioBuffer to DSP
EventLooperLoad e = EventLooperLoad( track, scene, ab );
writeToDspRingbuffer( &e );
// now write audiobuffer name to GUI on track, scene
gui->getTrack( track )->getClipSelector()->clipName( scene, n );
char* tmp = strdup( path.c_str() );
lastLoadedSamplePath = dirname( tmp );
free(tmp);

View File

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