GUI: implement clear
This commit is contained in:
parent
e414056f2d
commit
521b311692
3 changed files with 96 additions and 1 deletions
|
|
@ -19,21 +19,57 @@
|
|||
|
||||
#include "song.h"
|
||||
|
||||
void DivSong::clearSongData() {
|
||||
for (int i=0; i<DIV_MAX_CHANS; i++) {
|
||||
pat[i].wipePatterns();
|
||||
}
|
||||
|
||||
memset(orders.ord,0,DIV_MAX_CHANS*256);
|
||||
ordersLen=1;
|
||||
}
|
||||
|
||||
void DivSong::clearInstruments() {
|
||||
for (DivInstrument* i: ins) {
|
||||
delete i;
|
||||
}
|
||||
ins.clear();
|
||||
insLen=0;
|
||||
}
|
||||
|
||||
void DivSong::clearWavetables() {
|
||||
for (DivWavetable* i: wave) {
|
||||
delete i;
|
||||
}
|
||||
wave.clear();
|
||||
waveLen=0;
|
||||
}
|
||||
|
||||
void DivSong::clearSamples() {
|
||||
for (DivSample* i: sample) {
|
||||
delete i;
|
||||
}
|
||||
sample.clear();
|
||||
sampleLen=0;
|
||||
}
|
||||
|
||||
void DivSong::unload() {
|
||||
for (DivInstrument* i: ins) {
|
||||
delete i;
|
||||
}
|
||||
ins.clear();
|
||||
insLen=0;
|
||||
|
||||
for (DivWavetable* i: wave) {
|
||||
delete i;
|
||||
}
|
||||
wave.clear();
|
||||
waveLen=0;
|
||||
|
||||
for (DivSample* i: sample) {
|
||||
delete i;
|
||||
}
|
||||
sample.clear();
|
||||
sampleLen=0;
|
||||
|
||||
for (int i=0; i<DIV_MAX_CHANS; i++) {
|
||||
pat[i].wipePatterns();
|
||||
|
|
|
|||
|
|
@ -339,6 +339,27 @@ struct DivSong {
|
|||
DivWavetable nullWave;
|
||||
DivSample nullSample;
|
||||
|
||||
/**
|
||||
* clear orders and patterns.
|
||||
*/
|
||||
void clearSongData();
|
||||
|
||||
/**
|
||||
* clear instruments.
|
||||
*/
|
||||
void clearInstruments();
|
||||
|
||||
/**
|
||||
* clear wavetables.
|
||||
*/
|
||||
void clearWavetables();
|
||||
|
||||
/**
|
||||
* clear samples.
|
||||
*/
|
||||
void clearSamples();
|
||||
|
||||
|
||||
/**
|
||||
* unloads the song, freeing all memory associated with it.
|
||||
* use before destroying the object.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue