1 /* 2 * sample.h -- Midi Wavetable Processing library 3 * 4 * Copyright (C) WildMIDI Developers 2001-2016 5 * 6 * This file is part of WildMIDI. 7 * 8 * WildMIDI is free software: you can redistribute and/or modify the player 9 * under the terms of the GNU General Public License and you can redistribute 10 * and/or modify the library under the terms of the GNU Lesser General Public 11 * License as published by the Free Software Foundation, either version 3 of 12 * the licenses, or(at your option) any later version. 13 * 14 * WildMIDI is distributed in the hope that it will be useful, but WITHOUT 15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License and 17 * the GNU Lesser General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License and the 20 * GNU Lesser General Public License along with WildMIDI. If not, see 21 * <http://www.gnu.org/licenses/>. 22 */ 23 24 #ifndef __SAMPLE_H 25 #define __SAMPLE_H 26 27 #define SAMPLE_16BIT 0x01 28 #define SAMPLE_UNSIGNED 0x02 29 #define SAMPLE_LOOP 0x04 30 #define SAMPLE_PINGPONG 0x08 31 #define SAMPLE_REVERSE 0x10 32 #define SAMPLE_SUSTAIN 0x20 33 #define SAMPLE_ENVELOPE 0x40 34 #define SAMPLE_CLAMPED 0x80 35 36 #ifdef DEBUG_SAMPLES 37 #define SAMPLE_CONVERT_DEBUG(dx) printf("\r%s\n",dx) 38 #else 39 #define SAMPLE_CONVERT_DEBUG(dx) 40 #endif 41 42 struct _patch; 43 struct _mdi; 44 45 struct _sample { 46 uint32_t data_length; 47 uint32_t loop_start; 48 uint32_t loop_end; 49 uint32_t loop_size; 50 uint8_t loop_fraction; 51 uint16_t rate; 52 uint32_t freq_low; 53 uint32_t freq_high; 54 uint32_t freq_root; 55 uint8_t modes; 56 int32_t env_rate[7]; 57 int32_t env_target[7]; 58 uint32_t inc_div; 59 int16_t *data; 60 struct _sample *next; 61 62 uint32_t note_off_decay; 63 }; 64 65 extern int _WM_fix_release; 66 extern int _WM_auto_amp; 67 extern int _WM_auto_amp_with_amp; 68 69 extern struct _sample *_WM_get_sample_data(struct _patch *sample_patch, uint32_t freq); 70 extern int _WM_load_sample(struct _patch *sample_patch); 71 extern uint32_t _WM_get_decay_samples(struct _mdi * mdi, uint8_t channel, uint8_t note); 72 73 #endif /* __SAMPLE_H */ 74