-AudioEditor exists, loading files without audio.cfg file now possibe as user asked for beat info
parent
ad8016ddf4
commit
f7aec84cf1
|
@ -247,7 +247,7 @@ int ClipSelector::handle(int event)
|
|||
Fl_Menu_Item rclick_menu[] =
|
||||
{
|
||||
{ "Load" },
|
||||
{ "Bars", 0, 0, 0, FL_SUBMENU },
|
||||
{ "Beats", 0, 0, 0, FL_SUBMENU },
|
||||
{"1 "},
|
||||
{"2"},
|
||||
{"4"},
|
||||
|
|
|
@ -132,7 +132,14 @@ int DiskReader::loadSample( int track, int scene, string path )
|
|||
// FIXME: Cancel = no load sample?
|
||||
gui->getAudioEditor()->show( ab, true );
|
||||
while ( gui->getAudioEditor()->shown() ) Fl::wait();
|
||||
LUPPP_WARN("finished show() " );
|
||||
|
||||
// handle "cancel" return
|
||||
if ( ab->getBeats() == -1 )
|
||||
{
|
||||
LUPPP_WARN("cancel clicked, deleting audiobuffer" );
|
||||
delete ab;
|
||||
return LUPPP_RETURN_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
#include "gaudioeditor.hxx"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "config.hxx"
|
||||
|
||||
#include "audiobuffer.hxx"
|
||||
|
@ -10,17 +12,52 @@
|
|||
#include "avtk/avtk_button.h"
|
||||
|
||||
|
||||
void oneCB (Fl_Widget*,void* data) { ((AudioEditor*)data)->setBeatsAndQuit( 1 ); }
|
||||
void twoCB (Fl_Widget*,void* data) { ((AudioEditor*)data)->setBeatsAndQuit( 2 ); }
|
||||
void fourCB (Fl_Widget*,void* data) { ((AudioEditor*)data)->setBeatsAndQuit( 4 ); }
|
||||
void eightCB (Fl_Widget*,void* data) { ((AudioEditor*)data)->setBeatsAndQuit( 8 ); }
|
||||
void sixteenCB (Fl_Widget*,void* data) { ((AudioEditor*)data)->setBeatsAndQuit( 16); }
|
||||
void thirtyTwoCB(Fl_Widget*,void* data) { ((AudioEditor*)data)->setBeatsAndQuit( 32); }
|
||||
void sixtyfourCB(Fl_Widget*,void* data) { ((AudioEditor*)data)->setBeatsAndQuit( 64); }
|
||||
|
||||
void cancelCB(Fl_Widget*,void* data)
|
||||
{
|
||||
printf("button, beats = 4\n");
|
||||
AudioEditor* ae = (AudioEditor*) data;
|
||||
ae->setBeatsAndQuit( -1 );
|
||||
}
|
||||
|
||||
AudioEditor::AudioEditor()
|
||||
{
|
||||
window = new Fl_Double_Window(500,230,"Audio Editor");
|
||||
window = new Fl_Double_Window(450,200,"Audio Editor : Beats?");
|
||||
waveform = new Avtk::Waveform(5, 5, 450, 150, "Waveform");
|
||||
cancel = new Avtk::Button(360, 160, 80,30, "Cancel");
|
||||
|
||||
const char* names[] = {
|
||||
"1","2","4","8","16","32","64"
|
||||
};
|
||||
|
||||
for(int i = 0; i < 7; i++)
|
||||
{
|
||||
stringstream s;
|
||||
s << i;
|
||||
beatButtons[i] = new Avtk::Button(5 + i * 50, 160, 40,30, strdup(names[i]) );
|
||||
}
|
||||
window->end();
|
||||
|
||||
beatButtons[0]->callback( oneCB , this);
|
||||
beatButtons[1]->callback( twoCB , this);
|
||||
beatButtons[2]->callback( fourCB , this);
|
||||
beatButtons[3]->callback( eightCB , this);
|
||||
beatButtons[4]->callback( sixteenCB , this);
|
||||
beatButtons[5]->callback( thirtyTwoCB, this);
|
||||
beatButtons[6]->callback( sixtyfourCB, this);
|
||||
|
||||
cancel->callback( cancelCB, this );
|
||||
}
|
||||
|
||||
void AudioEditor::show( AudioBuffer* buf, bool modal )
|
||||
{
|
||||
|
||||
|
||||
ab = buf;
|
||||
|
||||
if ( !ab )
|
||||
|
@ -33,12 +70,24 @@ void AudioEditor::show( AudioBuffer* buf, bool modal )
|
|||
waveform->setData( &tmp[0], tmp.size() );
|
||||
}
|
||||
|
||||
|
||||
window->set_modal();
|
||||
|
||||
window->show();
|
||||
}
|
||||
|
||||
void AudioEditor::setBeatsAndQuit(int beats)
|
||||
{
|
||||
ab->setBeats(beats);
|
||||
window->hide();
|
||||
}
|
||||
|
||||
/*
|
||||
AudioBuffer* AudioEditor::getAudioBuffer()
|
||||
{
|
||||
return ab;
|
||||
}
|
||||
*/
|
||||
|
||||
bool AudioEditor::shown()
|
||||
{
|
||||
return window->shown();
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
class AudioBuffer;
|
||||
namespace Avtk {
|
||||
class Waveform;
|
||||
class Button;
|
||||
}
|
||||
|
||||
class AudioEditor
|
||||
|
@ -22,11 +23,17 @@ class AudioEditor
|
|||
|
||||
/// returns true if the editor window is shown
|
||||
bool shown();
|
||||
|
||||
void setBeatsAndQuit( int beats );
|
||||
|
||||
//AudioBuffer* getAudioBuffer();
|
||||
|
||||
private:
|
||||
// GUI elements
|
||||
Fl_Double_Window* window;
|
||||
Avtk::Waveform* waveform;
|
||||
Avtk::Button* cancel;
|
||||
Avtk::Button* beatButtons[7];
|
||||
|
||||
// Contents
|
||||
AudioBuffer* ab;
|
||||
|
|
Loading…
Reference in New Issue