Skip to content

Commit 173750b

Browse files
committed
add default pads for a new kit
1 parent b2393c1 commit 173750b

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

src/redux/actions.js

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { KitModel } from "../redux/models";
2-
import { Actions } from '../util/const'
1+
import { KitModel, PadModel } from "../redux/models";
2+
import { Actions, MidiMap } from '../util/const'
33
import { openKitFileDialog, openDriveDirectoryDialog, openSampleFileDialog} from "../util/fileDialog";
44
import { getGlobalStateFromDirectory} from "../util/globalState";
55
import { getKitAndPadsFromFile } from "../util/kitFile";
@@ -119,7 +119,28 @@ export function loadKitDetails(kitId) {
119119
export function loadNewKit() {
120120
return (dispatch, getState) => {
121121
let state = getState();
122-
var kit = KitModel(state.drive.kitPath, null, true, false, true);
122+
123+
// create a default set of samples
124+
let pads = {};
125+
126+
Object.keys(MidiMap).forEach((padType) => {
127+
let midiNote = MidiMap[padType][1];
128+
let pad = PadModel.getPad(padType)
129+
pad.midiNote = midiNote;
130+
pads[pad.id] = pad;
131+
});
132+
133+
var kit = KitModel(
134+
state.drive.kitPath,
135+
null,
136+
true,
137+
false,
138+
true,
139+
"",
140+
Object.keys(pads)
141+
);
142+
143+
dispatch({ type: Actions.ADD_PADS, pads: pads });
123144
dispatch({ type: Actions.ADD_KIT, kit: kit });
124145
dispatch({ type: Actions.SET_SELECTED_KIT_ID, kitId: kit.id });
125146
dispatch({ type: Actions.SET_ACTIVE_KIT_ID, kitId: kit.id });

0 commit comments

Comments
 (0)