mirror of
https://github.com/vale981/openAV-Luppp
synced 2025-03-05 09:01:39 -05:00
-Fixed loading issue in DiskReader
This commit is contained in:
parent
4841c365e4
commit
d0e5951bfc
2 changed files with 36 additions and 18 deletions
|
@ -73,7 +73,7 @@ int DiskReader::loadPreferences()
|
|||
}
|
||||
|
||||
cJSON_Delete( preferencesJson );
|
||||
free ( sampleString );
|
||||
delete[] sampleString;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -84,6 +84,27 @@ int DiskReader::loadPreferences()
|
|||
return LUPPP_RETURN_OK;
|
||||
}
|
||||
|
||||
int DiskReader::showAudioEditor(AudioBuffer* ab)
|
||||
{
|
||||
while ( ab->getBeats() == 0 )
|
||||
{
|
||||
// FIXME: Cancel = no load sample?
|
||||
gui->getAudioEditor()->show( ab, true );
|
||||
|
||||
while ( gui->getAudioEditor()->shown() ) Fl::wait();
|
||||
|
||||
// handle "cancel" return
|
||||
if ( ab->getBeats() == -1 )
|
||||
{
|
||||
LUPPP_WARN("cancel clicked, deleting audiobuffer" );
|
||||
return LUPPP_RETURN_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
return LUPPP_RETURN_OK;
|
||||
}
|
||||
|
||||
|
||||
int DiskReader::loadSample( int track, int scene, string path )
|
||||
{
|
||||
/// load the sample
|
||||
|
@ -176,6 +197,11 @@ int DiskReader::loadSample( int track, int scene, string path )
|
|||
else
|
||||
{
|
||||
cout << "Warning: audio.cfg has no entry for beats." << endl;
|
||||
int error = showAudioEditor( ab );
|
||||
if ( error == LUPPP_RETURN_ERROR )
|
||||
{
|
||||
delete ab;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON_Delete( audioJson );
|
||||
|
@ -184,24 +210,13 @@ int DiskReader::loadSample( int track, int scene, string path )
|
|||
}
|
||||
else
|
||||
{
|
||||
|
||||
while ( ab->getBeats() == 0 )
|
||||
// this means there's no audio.cfg file found for the sample: show the user
|
||||
// the file, and ask what the intended beat number is, and load the AudioBuffer
|
||||
LUPPP_WARN("%s %s","Empty or no audio.cfg found at ",base.str().c_str() );
|
||||
int error = showAudioEditor( ab );
|
||||
if ( error == LUPPP_RETURN_ERROR )
|
||||
{
|
||||
// this means there's no audio.cfg file found for the sample: show the user
|
||||
// the file, and ask what the intended beat number is, and load the AudioBuffer
|
||||
LUPPP_WARN("%s %s","Empty or no audio.cfg found at ",base.str().c_str() );
|
||||
|
||||
// FIXME: Cancel = no load sample?
|
||||
gui->getAudioEditor()->show( ab, true );
|
||||
while ( gui->getAudioEditor()->shown() ) Fl::wait();
|
||||
|
||||
// handle "cancel" return
|
||||
if ( ab->getBeats() == -1 )
|
||||
{
|
||||
LUPPP_WARN("cancel clicked, deleting audiobuffer" );
|
||||
delete ab;
|
||||
return LUPPP_RETURN_OK;
|
||||
}
|
||||
delete ab;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -48,6 +48,9 @@ class DiskReader
|
|||
int readTracks();
|
||||
int readMaster();
|
||||
int readScenes(int t, cJSON* track);
|
||||
|
||||
// ui show editor
|
||||
int showAudioEditor(AudioBuffer* );
|
||||
};
|
||||
|
||||
#endif // LUPPP_DISK_READER_H
|
||||
|
|
Loading…
Add table
Reference in a new issue