|
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' |
3 | 3 | import { openKitFileDialog, openDriveDirectoryDialog, openSampleFileDialog} from "../util/fileDialog";
|
4 | 4 | import { getGlobalStateFromDirectory} from "../util/globalState";
|
5 | 5 | import { getKitAndPadsFromFile } from "../util/kitFile";
|
@@ -119,7 +119,28 @@ export function loadKitDetails(kitId) {
|
119 | 119 | export function loadNewKit() {
|
120 | 120 | return (dispatch, getState) => {
|
121 | 121 | 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 }); |
123 | 144 | dispatch({ type: Actions.ADD_KIT, kit: kit });
|
124 | 145 | dispatch({ type: Actions.SET_SELECTED_KIT_ID, kitId: kit.id });
|
125 | 146 | dispatch({ type: Actions.SET_ACTIVE_KIT_ID, kitId: kit.id });
|
|
0 commit comments