wavelength 1.0.0
Loading...
Searching...
No Matches
synth.h
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4#include <vector>
5
6#include "os/string.h"
7#include "os/system.h"
10
11#ifdef VIDEO_STANDARD_PAL
19inline const char *LanguageSoundFxPath(const char *pszFile) {
20 if (SystemLanguageIsEnglish()) {
21 return FormatString("SoundFX/%s", pszFile);
22 }
23 return FormatString("SoundFX/%s/%s", GetSystemLanguage(), pszFile);
24}
25#endif
26
36class Synth {
37public:
47 static void Create();
48
55 static void Destroy();
56
62 virtual int Init() = 0;
63
69 virtual int Terminate() = 0;
70
79 virtual void ResetSpu();
80
87 virtual ~Synth();
88
98 virtual int SendPackedMessage(unsigned int nPacked) = 0;
99
109 virtual int
110 SendMessage(unsigned char nByte0, unsigned char nByte1, unsigned char nByte2, int nByte3) = 0;
111
122 virtual int Unsupported();
123
129 virtual void UpdateTime() = 0;
130
138 virtual int Poll() = 0;
139
150
160 virtual void SetStream(StreamPlayer *pStream);
161
172 virtual void SendStreamData(const void *pData, int nSize);
173
183 virtual int GetStreamStatus();
184
194 virtual int GetStreamFormat(int *pnRate, int *pnBlock) = 0;
195
206 virtual int Partition(const std::vector<int> &blocks) = 0;
207
216 virtual int GetBankBlockCount(const String &file) = 0;
217
226 virtual bool IsBankLoaded(unsigned short nSlot) = 0;
227
238 virtual int IsBankPresent(unsigned short nSlot);
239
250 virtual int LoadBank(unsigned short nSlot, const String &file, bool bSkipPending) = 0;
251
260 virtual int UnloadBank(unsigned short nSlot) = 0;
261
271 virtual void SetSurround(bool bSurround);
272
282 virtual void SetMono(bool bMono);
283
294 virtual void SetLag(float fLag);
295
305 virtual float GetLag();
306
317 virtual void SetSoftFxSweep(float fPosition);
318
329 virtual void SetSoftFxModulation(float fValue);
330
340 virtual void SetSoftFxFilter(const SoftFxFilter &filter);
341
349 virtual int EnableSoftFx() = 0;
350
358 virtual int DisableSoftFx() = 0;
359
370 virtual void SetOutputLevel(float fLevel);
371
381 virtual float GetOutputLevel();
382
394 virtual void SetSoftFxInput(int nInput);
395
405 virtual void SetBusToCoreFx(int nOn);
406
417 virtual void SetBusToSoftFx(int nOn);
418
425 virtual void VirtualSlot35();
426
436 virtual void SendMessages(const std::vector<unsigned int> &messages);
437
439 typedef void (*Callback)(int nArg);
440
451 virtual void QueueCallback(Callback pfnCallback, int nArg);
452};
453
460extern std::unique_ptr<Synth> TheSynth;
Stream of sound data read from a file and handed to the sound output a run at a time.
Definition streamplayer.h:13
Growable text buffer that is also a PrnStream.
Definition string.h:19
The MIDI synthesiser that drives the SPU2 voices.
Definition synth.h:19
virtual void SetStream(StreamPlayer *pStream)
Vtable slot 11.
virtual int SendPackedMessage(unsigned int nPacked)=0
Vtable slot 5.
virtual void SetBusToSoftFx(int nOn)
Vtable slot 34.
virtual void UpdateTime()=0
Vtable slot 8.
virtual int SendMessage(unsigned char nByte0, unsigned char nByte1, unsigned char nByte2, int nByte3)=0
Vtable slot 6.
virtual int DisableSoftFx()=0
Vtable slot 29.
virtual void SetOutputLevel(float fLevel)
Vtable slot 30.
virtual int EnableSoftFx()=0
Vtable slot 28.
virtual void SetSoftFxModulation(float fValue)
Vtable slot 26.
virtual int Init()=0
Vtable slot 1.
virtual void SetSoftFxFilter(const SoftFxFilter &filter)
Vtable slot 27.
virtual StreamPlayer * GetStream()
Vtable slot 10.
virtual void SetLag(float fLag)
Vtable slot 23.
virtual void QueueCallback(Callback pfnCallback, int nArg)
Vtable slot 37.
virtual float GetOutputLevel()
Vtable slot 31.
virtual void SetMono(bool bMono)
Vtable slot 22.
virtual int Terminate()=0
Vtable slot 2.
virtual int IsBankPresent(unsigned short nSlot)
Vtable slot 18.
virtual int Unsupported()
Vtable slot 7.
virtual int UnloadBank(unsigned short nSlot)=0
Vtable slot 20.
virtual void VirtualSlot35()
Vtable slot 35.
virtual int GetBankBlockCount(const String &file)=0
Vtable slot 16.
virtual int GetStreamFormat(int *pnRate, int *pnBlock)=0
Vtable slot 14, pure in this class.
virtual ~Synth()
Vtable slot 4.
virtual void SetSoftFxSweep(float fPosition)
Vtable slot 25.
virtual int GetStreamStatus()
Vtable slot 13.
virtual int Partition(const std::vector< int > &blocks)=0
Vtable slot 15.
static void Destroy()
Terminate TheSynth, destroy it, and clear the pointer.
virtual void SetSoftFxInput(int nInput)
Vtable slot 32.
void(* Callback)(int nArg)
Routine a queued callback job calls with its argument.
Definition synth.h:439
virtual void SetSurround(bool bSurround)
Vtable slot 21.
virtual void SendStreamData(const void *pData, int nSize)
Vtable slot 12.
virtual void SetBusToCoreFx(int nOn)
Vtable slot 33.
virtual void SendMessages(const std::vector< unsigned int > &messages)
Vtable slot 36.
static void Create()
Build TheSynth and initialise it.
virtual int LoadBank(unsigned short nSlot, const String &file, bool bSkipPending)=0
Vtable slot 19.
virtual bool IsBankLoaded(unsigned short nSlot)=0
Vtable slot 17.
virtual void ResetSpu()
Vtable slot 3.
virtual float GetLag()
Vtable slot 24.
virtual int Poll()=0
Vtable slot 9.
const char * FormatString(const char *pszFormat,...)
Format text into one shared buffer and return it.
Settings of the software effect, read from the filter entry of the first effect bus.
Definition softfxfilter.h:9
std::unique_ptr< Synth > TheSynth
The sound output Synth::Create() built, or null.
const char * GetSystemLanguage()
Report the language the console is set to.