1 /* 2 * Copyright (C) 2019-2020 Rerrah 3 * 4 * Permission is hereby granted, free of charge, to any person 5 * obtaining a copy of this software and associated documentation 6 * files (the "Software"), to deal in the Software without 7 * restriction, including without limitation the rights to use, 8 * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 * copies of the Software, and to permit persons to whom the 10 * Software is furnished to do so, subject to the following 11 * conditions: 12 * 13 * The above copyright notice and this permission notice shall be 14 * included in all copies or substantial portions of the Software. 15 * 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 * OTHER DEALINGS IN THE SOFTWARE. 24 */ 25 26 #pragma once 27 28 #include <vector> 29 #include "gd3_tag.hpp" 30 #include "s98_tag.hpp" 31 #include "binary_container.hpp" 32 33 class ExportHandler 34 { 35 public: 36 static void writeVgm(BinaryContainer& container, int target, std::vector<uint8_t> samples, uint32_t clock, uint32_t rate, 37 bool loopFlag, uint32_t loopPoint, uint32_t loopSamples, uint32_t totalSamples, 38 bool gd3TagEnabled, GD3Tag tag); 39 static void writeS98(BinaryContainer& container, int target, std::vector<uint8_t> samples, uint32_t clock, uint32_t rate, 40 bool loopFlag, uint32_t loopPoint, bool tagEnabled, S98Tag tag); 41 42 private: 43 ExportHandler(); 44 }; 45 46 enum ExportTargetFlag 47 { 48 /* target bits 0-3 : FM type */ 49 Export_NoneFm = 0, 50 Export_YM2608 = 1, 51 Export_YM2612 = 2, 52 Export_YM2203 = 4, 53 Export_FmMask = Export_NoneFm|Export_YM2608|Export_YM2612|Export_YM2203, 54 /* target bit 4-5 : SSG type */ 55 Export_InternalSsg = 0, 56 Export_AY8910Psg = 16, 57 Export_YM2149Psg = 32, 58 Export_SsgMask = Export_InternalSsg|Export_AY8910Psg|Export_YM2149Psg, 59 }; 60