libmsx
C library for MSX
Loading...
Searching...
No Matches
snd_sound.h
Go to the documentation of this file.
1// -*- coding: utf-8-unix -*-
2/*
3 * Copyright (c) 2021-2024 Daishi Mori (mori0091)
4 *
5 * This software is released under the MIT License.\n
6 * See https://github.com/mori0091/libmsx/blob/main/LICENSE
7 *
8 * GitHub libmsx project\n
9 * https://github.com/mori0091/libmsx
10 */
17#ifndef SND_SOUND_H_
18#define SND_SOUND_H_
19
20#include <stdbool.h>
21#include <stdint.h>
22#include <stddef.h>
23
24#include "snd_i_table.h"
25#include "snd_p_table.h"
26
44
55typedef struct snd_Music snd_Music;
56
60typedef struct snd_Track snd_Track;
61
66
72
79typedef struct snd_Pattern snd_Pattern;
80
89#define vec(T) \
90 struct vec_ ## T { \
91 vec_fields(T); \
92 }
93
102#define vec_fields(T) \
103 \
104 const size_t length; \
105 \
106 const T * data
107
123
161struct snd_Music {
167 const uint8_t format_version;
171 const uint8_t replayRate;
172 // ---------------------------------------------------------------------
182 const uint8_t initialSpeed;
184 const uint8_t isLoop;
186 const uint8_t loopToIndex;
187};
188
192struct snd_Track {
193 vec_fields(uint8_t);
194};
195
200 vec_fields(uint8_t);
201};
202
208 vec_fields(uint8_t);
209};
210
218 uint8_t height;
219 struct {
220 uint8_t speedTrack;
221 uint8_t eventTrack;
223 struct {
224 uint8_t track;
225 int16_t detune;
227};
228
229#undef vec
230#undef vec_fields
231
234#endif // SND_SOUND_H_
const uint8_t replayRate
Default player frequency that author expecting, in [Hz].
Definition snd_sound.h:171
struct snd_Pattern::@1 channels[3]
struct snd_Music::vec_snd_Track tracks
struct snd_Music::vec_snd_EventTrack eventTracks
const uint8_t loopToIndex
pattern index of the beggining of loop.
Definition snd_sound.h:186
struct snd_Pattern::@0 specialChannels
struct snd_SoundAssets::vec_snd_Instrument instruments
struct snd_Music::vec_snd_SpeedTrack speedTracks
struct snd_Music::vec_snd_Pattern patterns
const uint8_t format_version
Version number of this data format to be used for future compatibility.
Definition snd_sound.h:167
const uint8_t isLoop
true if loopback to the loopToIndex at the end of music.
Definition snd_sound.h:184
struct snd_SoundAssets::vec_snd_PeriodBend periodBendTables
struct snd_SoundAssets::vec_snd_PitchBend pitchBendTables
struct snd_SoundAssets::vec_snd_Music musics
uint8_t height
Number of effective lines of track(s).
Definition snd_sound.h:218
const uint8_t initialSpeed
default wait count per line [tick].
Definition snd_sound.h:182
#define vec(T)
Define a type generic vector (as named struct).
Definition snd_sound.h:89
Instrument (timbre) table.
Definition snd_i_table.h:64
Container of a music data.
Definition snd_sound.h:161
A track pattern, that corresponds to a sub-score of a music.
Definition snd_sound.h:217
Container of list of musics, instruments, arpeggio tables, and period tables.
Definition snd_sound.h:117
Pitch bend table.
Definition snd_p_table.h:56
Instrument data type for SNDDRV.
Pitch-bend table data type for SNDDRV.
A special track to control event trigger of tracks.
Definition snd_sound.h:207
vec_fields(uint8_t)
A special track to control speed of tracks.
Definition snd_sound.h:199
vec_fields(uint8_t)
A fragment of single channel music score.
Definition snd_sound.h:192
vec_fields(uint8_t)