diff --git a/headers/os/midi/Midi.h b/headers/os/midi/Midi.h index 17783bc3e6..ae4a024a50 100644 --- a/headers/os/midi/Midi.h +++ b/headers/os/midi/Midi.h @@ -1,89 +1,126 @@ -//----------------------------------------------------------------------------- -#ifndef _MIDI_H_ -#define _MIDI_H_ +#ifndef _MIDI_H +#define _MIDI_H + +#include #include #include class BMidiEvent; class BList; -class BMidi { +class BMidi +{ public: BMidi(); virtual ~BMidi(); - virtual void NoteOff(uchar channel, uchar note, - uchar velocity, uint32 time = B_NOW); - virtual void NoteOn(uchar channel, uchar note, - uchar velocity, uint32 time = B_NOW); - virtual void KeyPressure(uchar channel, uchar note, - uchar pressure, uint32 time = B_NOW); - virtual void ControlChange(uchar channel, uchar control_number, - uchar control_value, uint32 time = B_NOW); - virtual void ProgramChange(uchar channel, uchar program_number, + virtual void NoteOff( + uchar channel, uchar note, uchar velocity, uint32 time = B_NOW); + + virtual void NoteOn( + uchar channel, uchar note, uchar velocity, uint32 time = B_NOW); + + virtual void KeyPressure( + uchar channel, uchar note, uchar pressure, uint32 time = B_NOW); + + virtual void ControlChange( + uchar channel, uchar controlNumber, uchar controlValue, uint32 time = B_NOW); - virtual void ChannelPressure(uchar channel, uchar pressure, - uint32 time = B_NOW); - virtual void PitchBend(uchar channel, uchar lsb, - uchar msb, uint32 time = B_NOW); - virtual void SystemExclusive(void * data, size_t data_length, - uint32 time = B_NOW); - virtual void SystemCommon(uchar status_byte, uchar data1, - uchar data2, uint32 time = B_NOW); - virtual void SystemRealTime(uchar status_byte, uint32 time = B_NOW); - virtual void TempoChange(int32 beats_per_minute, uint32 time = B_NOW); - virtual void AllNotesOff(bool just_channel = true, uint32 time = B_NOW); + + virtual void ProgramChange( + uchar channel, uchar programNumber, uint32 time = B_NOW); + + virtual void ChannelPressure( + uchar channel, uchar pressure, uint32 time = B_NOW); + + virtual void PitchBend( + uchar channel, uchar lsb, uchar msb, uint32 time = B_NOW); + + virtual void SystemExclusive( + void* data, size_t dataLength, uint32 time = B_NOW); + + virtual void SystemCommon( + uchar status, uchar data1, uchar data2, uint32 time = B_NOW); + + virtual void SystemRealTime(uchar status, uint32 time = B_NOW); + + virtual void TempoChange(int32 beatsPerMinute, uint32 time = B_NOW); + + virtual void AllNotesOff(bool justChannel = true, uint32 time = B_NOW); virtual status_t Start(); virtual void Stop(); - bool IsRunning() const; - void Connect(BMidi * to_object); - void Disconnect(BMidi * from_object); - bool IsConnected(BMidi * to_object) const; - BList * Connections() const; + + void Connect(BMidi* toObject); + void Disconnect(BMidi* fromObject); + bool IsConnected(BMidi* toObject) const; + BList* Connections() const; + void SnoozeUntil(uint32 time) const; protected: - void SprayNoteOff(uchar channel, uchar note, - uchar velocity, uint32 time) const; - void SprayNoteOn(uchar channel, uchar note, - uchar velocity, uint32 time) const; - void SprayKeyPressure(uchar channel, uchar note, - uchar pressure, uint32 time) const; - void SprayControlChange(uchar channel, uchar control_number, - uchar control_value, uint32 time) const; - void SprayProgramChange(uchar channel, uchar program_number, + + void SprayNoteOff( + uchar channel, uchar note, uchar velocity, uint32 time) const; + + void SprayNoteOn( + uchar channel, uchar note, uchar velocity, uint32 time) const; + + void SprayKeyPressure( + uchar channel, uchar note, uchar pressure, uint32 time) const; + + void SprayControlChange( + uchar channel, uchar controlNumber, uchar controlValue, uint32 time) const; - void SprayChannelPressure(uchar channel, uchar pressure, - uint32 time) const; - void SprayPitchBend(uchar channel, uchar lsb, - uchar msb, uint32 time) const; - void SpraySystemExclusive(void * data, size_t data_length, - uint32 time) const; - void SpraySystemCommon(uchar status_byte, uchar data1, - uchar data2, uint32 time) const; - void SpraySystemRealTime(uchar status_byte, uint32 time) const; - void SprayTempoChange(int32 beats_per_minute, uint32 time) const; + + void SprayProgramChange( + uchar channel, uchar programNumber, uint32 time) const; + + void SprayChannelPressure( + uchar channel, uchar pressure, uint32 time) const; + + void SprayPitchBend( + uchar channel, uchar lsb, uchar msb, uint32 time) const; + + void SpraySystemExclusive( + void* data, size_t dataLength, uint32 time = B_NOW) const; + + void SpraySystemCommon( + uchar status, uchar data1, uchar data2, uint32 time) const; + + void SpraySystemRealTime(uchar status, uint32 time) const; + + void SprayTempoChange(int32 beatsPerMinute, uint32 time) const; bool KeepRunning(); private: - virtual void Run(); - void _Inflow(); - void _SprayEvent(BMidiEvent *) const; - static int32 _RunThread(void * data); - static int32 _InflowThread(void * data); -private: - BList * _con_list; - thread_id _run_thread_id; - thread_id _inflow_thread_id; - port_id _inflow_port; - bool _is_running; - bool _is_inflowing; - bool _keep_running; + friend class BMidiStore; + + virtual void _ReservedMidi1(); + virtual void _ReservedMidi2(); + virtual void _ReservedMidi3(); + + static int32 RunThread(void* data); + static int32 InflowThread(void* data); + + virtual void Run(); + void Inflow(); + + void SprayMidiEvent(BMidiEvent* event) const; + + BList* connections; + thread_id runThread; + thread_id inflowThread; + port_id inflowPort; + bool isRunning; + bool inflowAlive; + + uint32 _reserved[5]; }; -#endif //_MIDI_H_ +#endif // _MIDI_H + diff --git a/headers/os/midi/MidiDefs.h b/headers/os/midi/MidiDefs.h index 360b6b42bd..e7f0f4bb84 100644 --- a/headers/os/midi/MidiDefs.h +++ b/headers/os/midi/MidiDefs.h @@ -1,33 +1,50 @@ -//----------------------------------------------------------------------------- -#ifndef _MIDI_DEFS_H_ -#define _MIDI_DEFS_H_ + +#ifndef _MIDI_DEFS_H +#define _MIDI_DEFS_H #include #include -#define B_NOW ((uint32)(system_time()/1000)) +//------------------------------------------------------------------------------ -#define B_SYNTH_DIRECTORY B_BEOS_ETC_DIRECTORY -#define B_BIG_SYNTH_FILE "synth/big_synth.sy" -#define B_LITTLE_SYNTH_FILE "synth/little_synth.sy" +/* System time converted to int milliseconds */ -typedef enum synth_mode { +#define B_NOW ((uint32)(system_time()/1000)) + +//------------------------------------------------------------------------------ + +/* Synthesizer things */ + +#define B_SYNTH_DIRECTORY B_BEOS_ETC_DIRECTORY +#define B_BIG_SYNTH_FILE "synth/big_synth.sy" +#define B_LITTLE_SYNTH_FILE "synth/little_synth.sy" + +typedef enum synth_mode +{ B_NO_SYNTH, B_BIG_SYNTH, B_LITTLE_SYNTH, B_DEFAULT_SYNTH, - B_SAMPLES_ONLY, -} synth_mode; + B_SAMPLES_ONLY +} +synth_mode; -enum { +//------------------------------------------------------------------------------ + +/* Need to move these into Errors.h */ + +enum +{ B_BAD_INSTRUMENT = B_MIDI_ERROR_BASE + 0x100, B_BAD_MIDI_DATA, B_ALREADY_PAUSED, B_ALREADY_RESUMED, B_NO_SONG_PLAYING, - B_TOO_MANY_SONGS_PLAYING, + B_TOO_MANY_SONGS_PLAYING }; +//------------------------------------------------------------------------------ + #ifndef uchar typedef unsigned char uchar; #endif @@ -35,70 +52,77 @@ typedef unsigned char uchar; #ifndef _MIDI_CONSTANTS_ #define _MIDI_CONSTANTS_ -const uchar B_NOTE_OFF = 0x80; -const uchar B_NOTE_ON = 0x90; -const uchar B_KEY_PRESSURE = 0xa0; -const uchar B_CONTROL_CHANGE = 0xb0; -const uchar B_PROGRAM_CHANGE = 0xc0; -const uchar B_CHANNEL_PRESSURE = 0xd0; -const uchar B_PITCH_BEND = 0xe0; +/* Channel Message Masks*/ +const uchar B_NOTE_OFF = 0x80; +const uchar B_NOTE_ON = 0x90; +const uchar B_KEY_PRESSURE = 0xa0; +const uchar B_CONTROL_CHANGE = 0xb0; +const uchar B_PROGRAM_CHANGE = 0xc0; +const uchar B_CHANNEL_PRESSURE = 0xd0; +const uchar B_PITCH_BEND = 0xe0; -const uchar B_SYS_EX_START = 0xf0; -const uchar B_MIDI_TIME_CODE = 0xf1; -const uchar B_SONG_POSITION = 0xf2; -const uchar B_SONG_SELECT = 0xf3; -const uchar B_CABLE_MESSAGE = 0xf5; -const uchar B_TUNE_REQUEST = 0xf6; -const uchar B_SYS_EX_END = 0xf7; -const uchar B_TIMING_CLOCK = 0xf8; -const uchar B_START = 0xfa; -const uchar B_CONTINUE = 0xfb; -const uchar B_STOP = 0xfc; -const uchar B_ACTIVE_SENSING = 0xfe; -const uchar B_SYSTEM_RESET = 0xff; +/* System Messages*/ +const uchar B_SYS_EX_START = 0xf0; +const uchar B_MIDI_TIME_CODE = 0xf1; +const uchar B_SONG_POSITION = 0xf2; +const uchar B_SONG_SELECT = 0xf3; +const uchar B_CABLE_MESSAGE = 0xf5; +const uchar B_TUNE_REQUEST = 0xf6; +const uchar B_SYS_EX_END = 0xf7; +const uchar B_TIMING_CLOCK = 0xf8; +const uchar B_START = 0xfa; +const uchar B_CONTINUE = 0xfb; +const uchar B_STOP = 0xfc; +const uchar B_ACTIVE_SENSING = 0xfe; +const uchar B_SYSTEM_RESET = 0xff; -const uchar B_MODULATION = 0x01; -const uchar B_BREATH_CONTROLLER = 0x02; -const uchar B_FOOT_CONTROLLER = 0x04; -const uchar B_PORTAMENTO_TIME = 0x05; -const uchar B_DATA_ENTRY = 0x06; -const uchar B_MAIN_VOLUME = 0x07; -const uchar B_MIDI_BALANCE = 0x08; -const uchar B_PAN = 0x0a; -const uchar B_EXPRESSION_CTRL = 0x0b; -const uchar B_GENERAL_CTRL_1 = 0x10; -const uchar B_GENERAL_CTRL_2 = 0x11; -const uchar B_GENERAL_CTRL_3 = 0x12; -const uchar B_GENERAL_CTRL_4 = 0x13; -const uchar B_SUSTAIN_PEDAL = 0x40; -const uchar B_PORTAMENTO = 0x41; -const uchar B_SOSTENUTO = 0x42; -const uchar B_SOFT_PEDAL = 0x43; -const uchar B_HOLD_2 = 0x45; -const uchar B_GENERAL_CTRL_5 = 0x50; -const uchar B_GENERAL_CTRL_6 = 0x51; -const uchar B_GENERAL_CTRL_7 = 0x52; -const uchar B_GENERAL_CTRL_8 = 0x53; -const uchar B_EFFECTS_DEPTH = 0x5b; -const uchar B_TREMOLO_DEPTH = 0x5c; -const uchar B_CHORUS_DEPTH = 0x5d; -const uchar B_CELESTE_DEPTH = 0x5e; -const uchar B_PHASER_DEPTH = 0x5f; -const uchar B_DATA_INCREMENT = 0x60; -const uchar B_DATA_DECREMENT = 0x61; +/* Controller Numbers*/ +const uchar B_MODULATION = 0x01; +const uchar B_BREATH_CONTROLLER = 0x02; +const uchar B_FOOT_CONTROLLER = 0x04; +const uchar B_PORTAMENTO_TIME = 0x05; +const uchar B_DATA_ENTRY = 0x06; +const uchar B_MAIN_VOLUME = 0x07; +const uchar B_MIDI_BALANCE = 0x08; /* used to be B_BALANCE */ +const uchar B_PAN = 0x0a; +const uchar B_EXPRESSION_CTRL = 0x0b; +const uchar B_GENERAL_CTRL_1 = 0x10; +const uchar B_GENERAL_CTRL_2 = 0x11; +const uchar B_GENERAL_CTRL_3 = 0x12; +const uchar B_GENERAL_CTRL_4 = 0x13; +const uchar B_SUSTAIN_PEDAL = 0x40; +const uchar B_PORTAMENTO = 0x41; +const uchar B_SOSTENUTO = 0x42; +const uchar B_SOFT_PEDAL = 0x43; +const uchar B_HOLD_2 = 0x45; +const uchar B_GENERAL_CTRL_5 = 0x50; +const uchar B_GENERAL_CTRL_6 = 0x51; +const uchar B_GENERAL_CTRL_7 = 0x52; +const uchar B_GENERAL_CTRL_8 = 0x53; +const uchar B_EFFECTS_DEPTH = 0x5b; +const uchar B_TREMOLO_DEPTH = 0x5c; +const uchar B_CHORUS_DEPTH = 0x5d; +const uchar B_CELESTE_DEPTH = 0x5e; +const uchar B_PHASER_DEPTH = 0x5f; +const uchar B_DATA_INCREMENT = 0x60; +const uchar B_DATA_DECREMENT = 0x61; const uchar B_RESET_ALL_CONTROLLERS = 0x79; -const uchar B_LOCAL_CONTROL = 0x7a; -const uchar B_ALL_NOTES_OFF = 0x7b; -const uchar B_OMNI_MODE_OFF = 0x7c; -const uchar B_OMNI_MODE_ON = 0x7d; -const uchar B_MONO_MODE_ON = 0x7e; -const uchar B_POLY_MODE_ON = 0x7f; +const uchar B_LOCAL_CONTROL = 0x7a; +const uchar B_ALL_NOTES_OFF = 0x7b; +const uchar B_OMNI_MODE_OFF = 0x7c; +const uchar B_OMNI_MODE_ON = 0x7d; +const uchar B_MONO_MODE_ON = 0x7e; +const uchar B_POLY_MODE_ON = 0x7f; + +const uchar B_TEMPO_CHANGE = 0x51; -const uchar B_TEMPO_CHANGE = 0x51; +#endif // _MIDI_CONSTANTS_ -#endif +//------------------------------------------------------------------------------ -typedef enum midi_axe { +typedef enum midi_axe +{ + /* Pianos */ B_ACOUSTIC_GRAND=0, B_BRIGHT_GRAND, B_ELECTRIC_GRAND, @@ -107,6 +131,8 @@ typedef enum midi_axe { B_ELECTRIC_PIANO_2, B_HARPSICHORD, B_CLAVICHORD, + + /* Tuned Idiophones */ B_CELESTA, B_GLOCKENSPIEL, B_MUSIC_BOX, @@ -115,6 +141,8 @@ typedef enum midi_axe { B_XYLOPHONE, B_TUBULAR_BELLS, B_DULCIMER, + + /* Organs */ B_DRAWBAR_ORGAN, B_PERCUSSIVE_ORGAN, B_ROCK_ORGAN, @@ -123,6 +151,8 @@ typedef enum midi_axe { B_ACCORDION, B_HARMONICA, B_TANGO_ACCORDION, + + /* Guitars */ B_ACOUSTIC_GUITAR_NYLON, B_ACOUSTIC_GUITAR_STEEL, B_ELECTRIC_GUITAR_JAZZ, @@ -131,6 +161,8 @@ typedef enum midi_axe { B_OVERDRIVEN_GUITAR, B_DISTORTION_GUITAR, B_GUITAR_HARMONICS, + + /* Basses */ B_ACOUSTIC_BASS, B_ELECTRIC_BASS_FINGER, B_ELECTRIC_BASS_PICK, @@ -139,6 +171,8 @@ typedef enum midi_axe { B_SLAP_BASS_2, B_SYNTH_BASS_1, B_SYNTH_BASS_2, + + /* Strings */ B_VIOLIN, B_VIOLA, B_CELLO, @@ -147,6 +181,8 @@ typedef enum midi_axe { B_PIZZICATO_STRINGS, B_ORCHESTRAL_STRINGS, B_TIMPANI, + + /* Ensemble strings and voices */ B_STRING_ENSEMBLE_1, B_STRING_ENSEMBLE_2, B_SYNTH_STRINGS_1, @@ -155,6 +191,8 @@ typedef enum midi_axe { B_VOICE_OOH, B_SYNTH_VOICE, B_ORCHESTRA_HIT, + + /* Brass */ B_TRUMPET, B_TROMBONE, B_TUBA, @@ -163,6 +201,8 @@ typedef enum midi_axe { B_BRASS_SECTION, B_SYNTH_BRASS_1, B_SYNTH_BRASS_2, + + /* Reeds */ B_SOPRANO_SAX, B_ALTO_SAX, B_TENOR_SAX, @@ -171,6 +211,8 @@ typedef enum midi_axe { B_ENGLISH_HORN, B_BASSOON, B_CLARINET, + + /* Pipes */ B_PICCOLO, B_FLUTE, B_RECORDER, @@ -179,6 +221,8 @@ typedef enum midi_axe { B_SHAKUHACHI, B_WHISTLE, B_OCARINA, + + /* Synth Leads*/ B_LEAD_1, B_SQUARE_WAVE = B_LEAD_1, B_LEAD_2, @@ -195,6 +239,8 @@ typedef enum midi_axe { B_FIFTHS = B_LEAD_7, B_LEAD_8, B_BASS_LEAD = B_LEAD_8, + + /* Synth Pads */ B_PAD_1, B_NEW_AGE = B_PAD_1, B_PAD_2, @@ -211,6 +257,8 @@ typedef enum midi_axe { B_HALO = B_PAD_7, B_PAD_8, B_SWEEP = B_PAD_8, + + /* Effects */ B_FX_1, B_FX_2, B_FX_3, @@ -219,6 +267,8 @@ typedef enum midi_axe { B_FX_6, B_FX_7, B_FX_8, + + /* Ethnic */ B_SITAR, B_BANJO, B_SHAMISEN, @@ -227,6 +277,8 @@ typedef enum midi_axe { B_BAGPIPE, B_FIDDLE, B_SHANAI, + + /* Percussion */ B_TINKLE_BELL, B_AGOGO, B_STEEL_DRUMS, @@ -235,6 +287,8 @@ typedef enum midi_axe { B_MELODIC_TOM, B_SYNTH_DRUM, B_REVERSE_CYMBAL, + + /* Sound Effects */ B_FRET_NOISE, B_BREATH_NOISE, B_SEASHORE, @@ -243,6 +297,8 @@ typedef enum midi_axe { B_HELICOPTER, B_APPLAUSE, B_GUNSHOT -} midi_axe; +} +midi_axe; + +#endif // _MIDI_DEFS_H -#endif //_MIDI_DEFS_H_ diff --git a/headers/os/midi/MidiPort.h b/headers/os/midi/MidiPort.h index 0b107d319b..e7e26c2b03 100644 --- a/headers/os/midi/MidiPort.h +++ b/headers/os/midi/MidiPort.h @@ -1,12 +1,3 @@ -/******************************************************************************* -/ -/ File: MidiPort.h -/ -/ Description: Interface to MIDI hardware ports. -/ -/ Copyright 1993-98, Be Incorporated, All Rights Reserved. -/ -*******************************************************************************/ #ifndef _MIDI_PORT_H #define _MIDI_PORT_H @@ -16,103 +7,87 @@ class BMidiLocalProducer; class BMidiPortConsumer; -/*------------------------------------------------------------*/ - -class BMidiPort : public BMidi { - +class BMidiPort : public BMidi +{ public: - BMidiPort(const char *name=NULL); - ~BMidiPort(); + BMidiPort(const char* name = NULL); + ~BMidiPort(); - status_t InitCheck() const; - status_t Open(const char *name); - void Close(); + status_t InitCheck() const; + status_t Open(const char* name); + void Close(); - const char * PortName() const; + const char* PortName() const; -virtual void NoteOff(uchar channel, - uchar note, - uchar velocity, - uint32 time = B_NOW); + virtual void NoteOff( + uchar channel, uchar note, uchar velocity, uint32 time = B_NOW); -virtual void NoteOn(uchar channel, - uchar note, - uchar velocity, - uint32 time = B_NOW); + virtual void NoteOn( + uchar channel, uchar note, uchar velocity, uint32 time = B_NOW); -virtual void KeyPressure(uchar channel, - uchar note, - uchar pressure, - uint32 time = B_NOW); + virtual void KeyPressure( + uchar channel, uchar note, uchar pressure, uint32 time = B_NOW); -virtual void ControlChange(uchar channel, - uchar controlNumber, - uchar controlValue, - uint32 time = B_NOW); + virtual void ControlChange( + uchar channel, uchar controlNumber, uchar controlValue, + uint32 time = B_NOW); -virtual void ProgramChange(uchar channel, - uchar programNumber, - uint32 time = B_NOW); + virtual void ProgramChange( + uchar channel, uchar programNumber, uint32 time = B_NOW); -virtual void ChannelPressure(uchar channel, - uchar pressure, - uint32 time = B_NOW); + virtual void ChannelPressure( + uchar channel, uchar pressure, uint32 time = B_NOW); -virtual void PitchBend(uchar channel, - uchar lsb, - uchar msb, - uint32 time = B_NOW); + virtual void PitchBend( + uchar channel, uchar lsb, uchar msb, uint32 time = B_NOW); -virtual void SystemExclusive(void* data, - size_t dataLength, - uint32 time = B_NOW); + virtual void SystemExclusive( + void* data, size_t dataLength, uint32 time = B_NOW); -virtual void SystemCommon(uchar statusByte, - uchar data1, - uchar data2, - uint32 time = B_NOW); + virtual void SystemCommon( + uchar status, uchar data0, uchar data2, uint32 time = B_NOW); -virtual void SystemRealTime(uchar statusByte, uint32 time = B_NOW); + virtual void SystemRealTime(uchar status, uint32 time = B_NOW); -virtual status_t Start(); -virtual void Stop(); + virtual status_t Start(); + virtual void Stop(); - int32 CountDevices(); - status_t GetDeviceName(int32 n, char * name, - size_t bufSize = B_OS_NAME_LENGTH); + int32 CountDevices(); + status_t GetDeviceName( + int32 n, char* name, size_t bufSize = B_OS_NAME_LENGTH); private: -typedef BMidi _inherited; + typedef BMidi _inherited; -virtual void _ReservedMidiPort1(); -virtual void _ReservedMidiPort2(); -virtual void _ReservedMidiPort3(); + virtual void _ReservedMidiPort1(); + virtual void _ReservedMidiPort2(); + virtual void _ReservedMidiPort3(); -virtual void Run(); -friend class BMidiPortConsumer; + virtual void Run(); + friend class BMidiPortConsumer; - void Dispatch(const unsigned char * buffer, size_t size, bigtime_t when); - ssize_t Read(void *buffer, size_t numBytes) const; - ssize_t Write(void *buffer, size_t numBytes, uint32 time) const; + void Dispatch( + const unsigned char* buffer, size_t size, bigtime_t when); - void ScanDevices(); + ssize_t Read(void* buffer, size_t numBytes) const; + ssize_t Write(void* buffer, size_t numBytes, uint32 time) const; - BMidiProducer *remote_source; - BMidiConsumer *remote_sink; + void ScanDevices(); + + // used to glue us to the new midi kit + BMidiProducer* remote_source; + BMidiConsumer* remote_sink; + BMidiLocalProducer* local_source; + BMidiPortConsumer* local_sink; - char* fName; - status_t fCStatus; - BList * _fDevices; - uint8 _m_prev_cmd; - bool _m_enhanced; - uint8 _m_reserved[2]; - - // used to glue us to the new midi kit - BMidiLocalProducer *local_source; - BMidiPortConsumer *local_sink; + char* fName; + status_t fCStatus; + BList* _fDevices; + uint8 _m_prev_cmd; + bool _m_enhanced; + uint8 _m_reserved[2]; }; -/*------------------------------------------------------------*/ +#endif // _MIDI_PORT_H -#endif diff --git a/headers/os/midi/MidiStore.h b/headers/os/midi/MidiStore.h index 9c16a068e1..f5ab7c9850 100644 --- a/headers/os/midi/MidiStore.h +++ b/headers/os/midi/MidiStore.h @@ -1,76 +1,91 @@ -//----------------------------------------------------------------------------- -#ifndef _MIDI_STORE_H_ -#define _MIDI_STORE_H_ +#ifndef _MIDI_STORE_H +#define _MIDI_STORE_H + +#include #include -#include struct entry_ref; + class BMidiEvent; -class BFile; +class BList; -class BMidiStore : public BMidi { +class BMidiStore : public BMidi +{ public: -BMidiStore(); -virtual ~BMidiStore(); + BMidiStore(); + virtual ~BMidiStore(); - virtual void NoteOff(uchar channel, uchar note, - uchar velocity, uint32 time = B_NOW); - virtual void NoteOn(uchar channel, uchar note, - uchar velocity, uint32 time = B_NOW); - virtual void KeyPressure(uchar channel, uchar note, - uchar pressure, uint32 time = B_NOW); - virtual void ControlChange(uchar channel, uchar control_number, - uchar control_value, uint32 time = B_NOW); - virtual void ProgramChange(uchar channel, uchar program_number, - uint32 time = B_NOW); - virtual void ChannelPressure(uchar channel, uchar pressure, - uint32 time = B_NOW); - virtual void PitchBend(uchar channel, uchar lsb, - uchar msb, uint32 time = B_NOW); - virtual void SystemExclusive(void * data, size_t data_length, - uint32 time = B_NOW); - virtual void SystemCommon(uchar status_byte, uchar data1, - uchar data2, uint32 time = B_NOW); - virtual void SystemRealTime(uchar status_byte, uint32 time = B_NOW); - virtual void TempoChange(int32 beats_per_minute, uint32 time = B_NOW); - virtual void AllNotesOff(bool just_channel = true, uint32 time = B_NOW); + virtual void NoteOff( + uchar channel, uchar note, uchar velocity, uint32 time = B_NOW); - status_t Import(const entry_ref * ref); - status_t Export(const entry_ref * ref, int32 format); + virtual void NoteOn( + uchar channel, uchar note, uchar velocity, uint32 time = B_NOW); + + virtual void KeyPressure( + uchar channel, uchar note, uchar pressure, uint32 time = B_NOW); + + virtual void ControlChange( + uchar channel, uchar controlNumber, uchar controlValue, + uint32 time = B_NOW); + + virtual void ProgramChange( + uchar channel, uchar programNumber, uint32 time = B_NOW); + + virtual void ChannelPressure( + uchar channel, uchar pressure, uint32 time = B_NOW); + + virtual void PitchBend( + uchar channel, uchar lsb, uchar msb, uint32 time = B_NOW); + + virtual void SystemExclusive( + void* data, size_t dataLength, uint32 time = B_NOW); + + virtual void SystemCommon( + uchar status, uchar data1, uchar data2, uint32 time = B_NOW); + + virtual void SystemRealTime(uchar status, uint32 time = B_NOW); + + virtual void TempoChange(int32 beatsPerMinute, uint32 time = B_NOW); + + virtual void AllNotesOff(bool justChannel = true, uint32 time = B_NOW); + + status_t Import(const entry_ref* ref); + status_t Export(const entry_ref* ref, int32 format); void SortEvents(bool force = false); uint32 CountEvents() const; + uint32 CurrentEvent() const; - void SetCurrentEvent(uint32 event_number); - uint32 DeltaOfEvent(uint32 event_number) const; + void SetCurrentEvent(uint32 eventNumber); + + uint32 DeltaOfEvent(uint32 eventNumber) const; uint32 EventAtDelta(uint32 time) const; - uint32 BeginTime() const; - void SetTempo(int32 beats_per_minute); + + uint32 BeginTime() const; + + void SetTempo(int32 beatsPerMinute); int32 Tempo() const; private: - virtual void Run(); - void _RunThread(); - uint8* _DecodeTrack(uint8 *); - void _DecodeFormat0Tracks(uint8 *, uint16, uint32); - void _DecodeFormat1Tracks(uint8 *, uint16, uint32); - void _DecodeFormat2Tracks(uint8 *, uint16, uint32); - void _EncodeFormat0Tracks(uint8 *); - void _EncodeFormat1Tracks(uint8 *); - void _EncodeFormat2Tracks(uint8 *); - void _ReadEvent(uint8, uint8 **, uint8 *, BMidiEvent *); - void _WriteEvent(BMidiEvent *); - uint32 _ReadVarLength(uint8 **, uint8 *); - void _WriteVarLength(uint32); - static int _CompareEvents(const void *, const void *); -private: - BList * _evt_list; - uint32 _tempo; - uint32 _cur_evt; - uint32 _start_time; - uint32 _ticks_per_beat; + virtual void _ReservedMidiStore1(); + virtual void _ReservedMidiStore2(); + + virtual void Run(); + + BMidiEvent* EventAt(uint32 index) const; + + static int CompareEvents(const void* event1, const void* event2); + + BList* events; + uint32 tempo; + uint32 curEvent; + uint32 startTime; + uint32 ticksPerBeat; + + uint32 _reserved[21]; }; -#endif _MIDI_STORE_H_ +#endif // _MIDI_STORE_H + diff --git a/headers/os/midi/MidiSynth.h b/headers/os/midi/MidiSynth.h index 19f3f0e0b2..ea1e249208 100644 --- a/headers/os/midi/MidiSynth.h +++ b/headers/os/midi/MidiSynth.h @@ -1,115 +1,93 @@ -/******************************************************************************* -/ -/ File: MidiSynth.h -/ -/ Description: Midi object that talks to the General MIDI synthesizer. -/ -/ Copyright 1993-98, Be Incorporated, All Rights Reserved. -/ -*******************************************************************************/ #ifndef _MIDI_SYNTH_H #define _MIDI_SYNTH_H -#ifndef _BE_BUILD_H #include -#endif #include #include #include - class BMidiSynth : public BMidi { public: - BMidiSynth(); - virtual ~BMidiSynth(); + BMidiSynth(); + virtual ~BMidiSynth(); + status_t EnableInput(bool enable, bool loadInstruments); + bool IsInputEnabled(void) const; - status_t EnableInput(bool enable, bool loadInstruments); - bool IsInputEnabled(void) const; - - /* set volume. You can overdrive by passing values larger than 1.0*/ - void SetVolume(double volume); - double Volume(void) const; + /* set volume. You can overdrive by passing values larger than 1.0 */ + void SetVolume(double volume); + double Volume(void) const; /* set note offset in semi tones */ - /* (12 is down an octave, -12 is up an octave)*/ - void SetTransposition(int16 offset); - int16 Transposition(void) const; + /* (12 is down an octave, -12 is up an octave) */ + void SetTransposition(int16 offset); + int16 Transposition(void) const; - /* Mute and unmute channels (0 to 15)*/ - void MuteChannel(int16 channel, bool do_mute); - void GetMuteMap(char *pChannels) const; + /* Mute and unmute channels (0 to 15) */ + void MuteChannel(int16 channel, bool do_mute); + void GetMuteMap(char* pChannels) const; - void SoloChannel(int16 channel, bool do_solo); - void GetSoloMap(char *pChannels) const; + void SoloChannel(int16 channel, bool do_solo); + void GetSoloMap(char* pChannels) const; - /* Use these functions to drive the synth engine directly*/ - status_t LoadInstrument(int16 instrument); - status_t UnloadInstrument(int16 instrument); - status_t RemapInstrument(int16 from, int16 to); + /* Use these functions to drive the synth engine directly */ + status_t LoadInstrument(int16 instrument); + status_t UnloadInstrument(int16 instrument); + status_t RemapInstrument(int16 from, int16 to); - void FlushInstrumentCache(bool startStopCache); + void FlushInstrumentCache(bool startStopCache); - /* get current midi tick in microseconds*/ - uint32 Tick(void) const; + /* get current midi tick in microseconds */ + uint32 Tick(void) const; - /* The channel variable is 1 to 16. Channel 10 is percussion for example.*/ - /* The programNumber variable is a number from 0-127*/ + /* The channel variable is 1 to 16. Channel 10 is percussion for example. */ + /* The programNumber variable is a number from 0-127 */ -virtual void NoteOff(uchar channel, - uchar note, - uchar velocity, - uint32 time = B_NOW); + virtual void NoteOff( + uchar channel, uchar note, uchar velocity, uint32 time = B_NOW); -virtual void NoteOn(uchar channel, - uchar note, - uchar velocity, - uint32 time = B_NOW); + virtual void NoteOn( + uchar channel, uchar note, uchar velocity, uint32 time = B_NOW); -virtual void KeyPressure(uchar channel, - uchar note, - uchar pressure, - uint32 time = B_NOW); + virtual void KeyPressure( + uchar channel, uchar note, uchar pressure, uint32 time = B_NOW); -virtual void ControlChange(uchar channel, - uchar controlNumber, - uchar controlValue, - uint32 time = B_NOW); + virtual void ControlChange( + uchar channel, uchar controlNumber, uchar controlValue, + uint32 time = B_NOW); -virtual void ProgramChange(uchar channel, - uchar programNumber, - uint32 time = B_NOW); + virtual void ProgramChange( + uchar channel, uchar programNumber, uint32 time = B_NOW); -virtual void ChannelPressure(uchar channel, - uchar pressure, - uint32 time = B_NOW); + virtual void ChannelPressure( + uchar channel, uchar pressure, uint32 time = B_NOW); -virtual void PitchBend(uchar channel, - uchar lsb, - uchar msb, - uint32 time = B_NOW); + virtual void PitchBend( + uchar channel, uchar lsb, uchar msb, uint32 time = B_NOW); -virtual void AllNotesOff(bool controlOnly, uint32 time = B_NOW); + virtual void AllNotesOff(bool controlOnly, uint32 time = B_NOW); protected: - void* fSongVariables; - void* fPerformanceVariables; - bool fMidiQueue; + void* fSongVariables; + void* fPerformanceVariables; + bool fMidiQueue; private: -virtual void _ReservedMidiSynth1(); -virtual void _ReservedMidiSynth2(); -virtual void _ReservedMidiSynth3(); -virtual void _ReservedMidiSynth4(); + virtual void _ReservedMidiSynth1(); + virtual void _ReservedMidiSynth2(); + virtual void _ReservedMidiSynth3(); + virtual void _ReservedMidiSynth4(); -friend class BSynth; + friend class BSynth; + + virtual void Run(); - virtual void Run(); bool fInputEnabled; - uint32 _reserved[4]; + uint32 _reserved[4]; }; -#endif +#endif // _MIDI_SYNTH_H + diff --git a/headers/os/midi/MidiSynthFile.h b/headers/os/midi/MidiSynthFile.h index 27d2b9cd78..e0186f3412 100644 --- a/headers/os/midi/MidiSynthFile.h +++ b/headers/os/midi/MidiSynthFile.h @@ -1,86 +1,77 @@ -/******************************************************************************* -/ -/ File: MidiSynthFile.h -/ -/ Description: Send a MIDI file to the synthesizer. -/ -/ Copyright 1993-98, Be Incorporated, All Rights Reserved. -/ -*******************************************************************************/ #ifndef _MIDI_SYNTH_FILE_H #define _MIDI_SYNTH_FILE_H -#ifndef _BE_BUILD_H #include -#endif #include #include typedef void (*synth_file_hook)(int32 arg); - class BMidiSynthFile : public BMidiSynth { public: - BMidiSynthFile(); - ~BMidiSynthFile(); + BMidiSynthFile(); + ~BMidiSynthFile(); - status_t LoadFile(const entry_ref *midi_entry_ref); - void UnloadFile(void); + status_t LoadFile(const entry_ref* midi_entry_ref); + void UnloadFile(void); - virtual status_t Start(void); - virtual void Stop(void); + virtual status_t Start(void); + virtual void Stop(void); - void Fade(void); + void Fade(void); + void Pause(void); + void Resume(void); - void Pause(void); - void Resume(void); + /* get ticks in microseconds of length of song */ + int32 Duration(void) const; - /* get ticks in microseconds of length of song*/ - int32 Duration(void) const; - /* set the current playback position of song in microseconds*/ - int32 Position(int32 ticks) const; - /* get the current playback position of a song in microseconds*/ - int32 Seek(); + /* set the current playback position of song in microseconds */ + int32 Position(int32 ticks) const; - /* get the patches required to play this song*/ - status_t GetPatches(int16 *pArray768, int16 *pReturnedCount) const; + /* get the current playback position of a song in microseconds */ + int32 Seek(); - /* Set a call back when song is done*/ - void SetFileHook(synth_file_hook pSongHook, int32 arg); - /* poll to see if song is done*/ - bool IsFinished(void) const; + /* get the patches required to play this song */ + status_t GetPatches(int16* pArray768, int16* pReturnedCount) const; - /* set song master tempo. (1.0 uses songs encoded tempo, 2.0 will play*/ - /* song twice as fast, and 0.5 will play song half as fast*/ - void ScaleTempoBy(double tempoFactor); + /* Set a call back when song is done */ + void SetFileHook(synth_file_hook pSongHook, int32 arg); + /* poll to see if song is done */ + bool IsFinished(void) const; - /* sets tempo in beats per minute*/ - void SetTempo(int32 newTempoBPM); - /* returns tempo in beats per minute*/ - int32 Tempo(void) const; + /* set song master tempo. (1.0 uses songs encoded tempo, 2.0 will play */ + /* song twice as fast, and 0.5 will play song half as fast */ + void ScaleTempoBy(double tempoFactor); - /* pass true to loop song, false to not loop*/ - void EnableLooping(bool loop); + /* sets tempo in beats per minute */ + void SetTempo(int32 newTempoBPM); - /* Mute and unmute tracks (0 to 64)*/ - void MuteTrack(int16 track, bool do_mute); - void GetMuteMap(char *pTracks) const; + /* returns tempo in beats per minute */ + int32 Tempo(void) const; - void SoloTrack(int16 track, bool do_solo); - void GetSoloMap(char *pTracks) const; + /* pass true to loop song, false to not loop */ + void EnableLooping(bool loop); + + /* Mute and unmute tracks (0 to 64) */ + void MuteTrack(int16 track, bool do_mute); + void GetMuteMap(char* pTracks) const; + + void SoloTrack(int16 track, bool do_solo); + void GetSoloMap(char* pTracks) const; private: -virtual void _ReservedMidiSynthFile1(); -virtual void _ReservedMidiSynthFile2(); -virtual void _ReservedMidiSynthFile3(); + virtual void _ReservedMidiSynthFile1(); + virtual void _ReservedMidiSynthFile2(); + virtual void _ReservedMidiSynthFile3(); -friend class BSynth; + friend class BSynth; - uint32 _reserved[4]; + uint32 _reserved[4]; }; -#endif +#endif // _MIDI_SYNTH_FILE + diff --git a/headers/os/midi/MidiText.h b/headers/os/midi/MidiText.h index 18588f89a2..1eac8ff5c8 100644 --- a/headers/os/midi/MidiText.h +++ b/headers/os/midi/MidiText.h @@ -1,43 +1,64 @@ -//----------------------------------------------------------------------------- -#ifndef _MIDI_TEXT_H_ -#define _MIDI_TEXT_H_ +#ifndef _MIDI_TEXT_H +#define _MIDI_TEXT_H + +#include #include +#include -class BMidiText : public BMidi { +class BMidiText : public BMidi +{ public: BMidiText(); virtual ~BMidiText(); - virtual void NoteOff(uchar channel, uchar note, - uchar velocity, uint32 time = B_NOW); - virtual void NoteOn(uchar channel, uchar note, - uchar velocity, uint32 time = B_NOW); - virtual void KeyPressure(uchar channel, uchar note, - uchar pressure, uint32 time = B_NOW); - virtual void ControlChange(uchar channel, uchar control_number, - uchar control_value, uint32 time = B_NOW); - virtual void ProgramChange(uchar channel, uchar program_number, + virtual void NoteOff( + uchar channel, uchar note, uchar velocity, uint32 time = B_NOW); + + virtual void NoteOn( + uchar channel, uchar note, uchar velocity, uint32 time = B_NOW); + + virtual void KeyPressure( + uchar channel, uchar note, uchar pressure, uint32 time = B_NOW); + + virtual void ControlChange( + uchar channel, uchar controlNumber, uchar controlValue, uint32 time = B_NOW); - virtual void ChannelPressure(uchar channel, uchar pressure, - uint32 time = B_NOW); - virtual void PitchBend(uchar channel, uchar lsb, - uchar msb, uint32 time = B_NOW); - virtual void SystemExclusive(void * data, size_t data_length, - uint32 time = B_NOW); - virtual void SystemCommon(uchar status_byte, uchar data1, - uchar data2, uint32 time = B_NOW); - virtual void SystemRealTime(uchar status_byte, uint32 time = B_NOW); - virtual void TempoChange(int32 beats_per_minute, uint32 time = B_NOW); - virtual void AllNotesOff(bool just_channel = true, uint32 time = B_NOW); + + virtual void ProgramChange( + uchar channel, uchar programNumber, uint32 time = B_NOW); + + virtual void ChannelPressure( + uchar channel, uchar pressure, uint32 time = B_NOW); + + virtual void PitchBend( + uchar channel, uchar lsb, uchar msb, uint32 time = B_NOW); + + virtual void SystemExclusive( + void* data, size_t dataLength, uint32 time = B_NOW); + + virtual void SystemCommon( + uchar status, uchar data1, uchar data2, uint32 time = B_NOW); + + virtual void SystemRealTime(uchar status, uint32 time = B_NOW); + + virtual void TempoChange(int32 beatsPerMinute, uint32 time = B_NOW); + + virtual void AllNotesOff(bool justChannel = true, uint32 time = B_NOW); void ResetTimer(bool start = false); private: - int32 _start_time; -private: - void _PrintTime(); + virtual void _ReservedMidiText1(); + + virtual void Run(); + + void WaitAndPrint(uint32 time); + + int32 startTime; + uint32 _reserved[4]; }; -#endif _MIDI_TEXT_H_ +#endif // _MIDI_TEXT_H + diff --git a/headers/os/midi/Samples.h b/headers/os/midi/Samples.h index 2bd7d9b9c5..a04a4c505b 100644 --- a/headers/os/midi/Samples.h +++ b/headers/os/midi/Samples.h @@ -1,19 +1,8 @@ -/******************************************************************************* -/ -/ File: Samples.h -/ -/ Description: Sound effects. -/ -/ Copyright 1993-98, Be Incorporated, All Rights Reserved. -/ -*******************************************************************************/ #ifndef _SAMPLES_H #define _SAMPLES_H -#ifndef _BE_BUILD_H #include -#endif #include typedef void (*sample_exit_hook)(int32 arg); @@ -22,55 +11,56 @@ typedef bool (*sample_loop_hook)(int32 arg); class BSamples { public: - BSamples(); - virtual ~BSamples(); + BSamples(); + virtual ~BSamples(); -/* start a sample playing*/ - void Start(void * sampleData, /* pointer to audio data*/ - int32 frames, /* number of frames*/ - int16 bytes_per_sample, /* btyes per sample 1 or 2*/ - int16 channel_count, /* mono or stereo 1 or 2*/ - double pitch, /* floating sample rate*/ - int32 loopStart, /* loop start in frames*/ - int32 loopEnd, /* loop end in frames*/ - double sampleVolume, /* sample volume*/ - double stereoPosition, /* stereo placement*/ - int32 hook_arg, /* hook argument*/ - sample_loop_hook pLoopContinueProc, - sample_exit_hook pDoneProc); + /* start a sample playing */ + void Start( + void* sampleData, /* pointer to audio data*/ + int32 frames, /* number of frames*/ + int16 bytes_per_sample, /* btyes per sample 1 or 2*/ + int16 channel_count, /* mono or stereo 1 or 2*/ + double pitch, /* floating sample rate*/ + int32 loopStart, /* loop start in frames*/ + int32 loopEnd, /* loop end in frames*/ + double sampleVolume, /* sample volume*/ + double stereoPosition, /* stereo placement*/ + int32 hook_arg, /* hook argument*/ + sample_loop_hook pLoopContinueProc, + sample_exit_hook pDoneProc); - /* currently paused*/ - bool IsPaused(void) const; - void Pause(void); - void Resume(void); - void Stop(void); - bool IsPlaying(void) const; + /* currently paused */ + bool IsPaused(void) const; + void Pause(void); + void Resume(void); + void Stop(void); + bool IsPlaying(void) const; - void SetVolume(double newVolume); - double Volume(void) const; + void SetVolume(double newVolume); + double Volume(void) const; + void SetSamplingRate(double newRate); + double SamplingRate(void) const; - void SetSamplingRate(double newRate); - double SamplingRate(void) const; + void SetPlacement(double stereoPosition); - void SetPlacement(double stereoPosition); + /* Set the stereo position (-1.0 left to +1.0 right, 0 is middle) */ + double Placement(void) const; - /* Set the stereo position (-1.0 left to +1.0 right, 0 is middle)*/ - double Placement(void) const; - - /* Enable/Disable reverb on this particular IgorSound*/ - void EnableReverb(bool useReverb); + /* Enable/Disable reverb on this particular IgorSound */ + void EnableReverb(bool useReverb); private: -virtual void _ReservedSamples1(); -virtual void _ReservedSamples2(); -virtual void _ReservedSamples3(); + virtual void _ReservedSamples1(); + virtual void _ReservedSamples2(); + virtual void _ReservedSamples3(); - int32 fReference; - double fPauseVariable; - void* fFileVariables; - uint32 _reserved[4]; + int32 fReference; + double fPauseVariable; + void* fFileVariables; + uint32 _reserved[4]; }; -#endif +#endif // _SAMPLES_H + diff --git a/headers/os/midi/Synth.h b/headers/os/midi/Synth.h index dce84404ee..fdaade4da2 100644 --- a/headers/os/midi/Synth.h +++ b/headers/os/midi/Synth.h @@ -1,29 +1,19 @@ -/******************************************************************************* -/ -/ File: Synth.h -/ -/ Description: Interface to the General MIDI synthesizer. -/ -/ Copyright 1993-98, Be Incorporated, All Rights Reserved. -/ -*******************************************************************************/ #ifndef _SYNTH_H #define _SYNTH_H -#ifndef _BE_BUILD_H #include -#endif #include #include #include typedef enum interpolation_mode { - B_DROP_SAMPLE = 0, - B_2_POINT_INTERPOLATION, - B_LINEAR_INTERPOLATION - } interpolation_mode; + B_DROP_SAMPLE = 0, + B_2_POINT_INTERPOLATION, + B_LINEAR_INTERPOLATION +} +interpolation_mode; typedef enum reverb_mode { @@ -33,109 +23,105 @@ typedef enum reverb_mode B_REVERB_BALLROOM, B_REVERB_CAVERN, B_REVERB_DUNGEON - } reverb_mode; +} +reverb_mode; + +typedef void (*synth_controller_hook) ( + int16 channel, int16 controller, int16 value); -typedef void (*synth_controller_hook) (int16 channel, - int16 controller, - int16 value); class BMidiSynth; class BMidiSynthFile; class BSynth { - public: +public: BSynth(); BSynth(synth_mode synth); + virtual ~BSynth(); -#if !_PR3_COMPATIBLE_ -virtual ~BSynth(); -#else - ~BSynth(); -#endif - - status_t LoadSynthData(entry_ref *instrumentsFile); - status_t LoadSynthData(synth_mode synth); + status_t LoadSynthData(entry_ref* instrumentsFile); + status_t LoadSynthData(synth_mode synth); synth_mode SynthMode(void); - void Unload(void); - bool IsLoaded(void) const; - - /* change audio modes*/ - status_t SetSamplingRate(int32 sample_rate); - int32 SamplingRate() const; - - status_t SetInterpolation(interpolation_mode interp_mode); + void Unload(void); + bool IsLoaded(void) const; + + /* change audio modes */ + status_t SetSamplingRate(int32 sample_rate); + int32 SamplingRate() const; + + status_t SetInterpolation(interpolation_mode interp_mode); interpolation_mode Interpolation() const; - - void SetReverb(reverb_mode rev_mode); - reverb_mode Reverb() const; - - status_t EnableReverb(bool reverb_enabled); - bool IsReverbEnabled() const; - - /* change voice allocation*/ - status_t SetVoiceLimits(int16 maxSynthVoices, - int16 maxSampleVoices, - int16 limiterThreshhold); - - int16 MaxSynthVoices(void) const; - int16 MaxSampleVoices(void) const; - int16 LimiterThreshhold(void) const; - - /* get and set the master mix volume. A volume level of 1.0*/ - /* is normal, and volume level of 4.0 will overdrive 4 times*/ - void SetSynthVolume(double theVolume); - double SynthVolume(void) const; - - void SetSampleVolume(double theVolume); - double SampleVolume(void) const; - - /* display feedback information*/ + + void SetReverb(reverb_mode rev_mode); + reverb_mode Reverb() const; + + status_t EnableReverb(bool reverb_enabled); + bool IsReverbEnabled() const; + + /* change voice allocation */ + status_t SetVoiceLimits( + int16 maxSynthVoices, int16 maxSampleVoices, + int16 limiterThreshhold); + + int16 MaxSynthVoices(void) const; + int16 MaxSampleVoices(void) const; + int16 LimiterThreshhold(void) const; + + /* get and set the master mix volume. A volume level of 1.0 */ + /* is normal, and volume level of 4.0 will overdrive 4 times */ + void SetSynthVolume(double theVolume); + double SynthVolume(void) const; + + void SetSampleVolume(double theVolume); + double SampleVolume(void) const; + + /* display feedback information */ /* This will return the number of 16-bit samples stored into the pLeft*/ /* and pRight arrays. Usually 1024. This returns the current data*/ /* points being sent to the hardware.*/ - status_t GetAudio(int16 *pLeft, int16 *pRight, - int32 max_samples) const; - + status_t GetAudio( + int16* pLeft, int16* pRight, int32 max_samples) const; + /* disengage from audio output streams*/ - void Pause(void); + void Pause(void); + /* reengage to audio output streams*/ - void Resume(void); - + void Resume(void); + /* Set a call back on controller events*/ - void SetControllerHook(int16 controller, - synth_controller_hook cback); - - int32 CountClients(void) const; + void SetControllerHook(int16 controller, synth_controller_hook cback); - private: + int32 CountClients(void) const; -virtual void _ReservedSynth1(); -virtual void _ReservedSynth2(); -virtual void _ReservedSynth3(); -virtual void _ReservedSynth4(); +private: + + virtual void _ReservedSynth1(); + virtual void _ReservedSynth2(); + virtual void _ReservedSynth3(); + virtual void _ReservedSynth4(); friend BMidiSynth; friend BMidiSynthFile; - int32 fClientCount; + int32 fClientCount; void _init(); status_t _do_load(synth_mode synth); - status_t _load_insts(entry_ref *ref); - synth_mode fMode; - int16 fMaxSynthVox; - int16 fMaxSampleVox; - int16 fLimiter; - - int32 fSRate; - interpolation_mode fInterp; - int32 fModifiers; - reverb_mode fReverb; - sem_id fSetupLock; - uint32 _reserved[4]; + status_t _load_insts(entry_ref* ref); + synth_mode fMode; + int16 fMaxSynthVox; + int16 fMaxSampleVox; + int16 fLimiter; + + int32 fSRate; + interpolation_mode fInterp; + int32 fModifiers; + reverb_mode fReverb; + sem_id fSetupLock; + uint32 _reserved[4]; }; -extern _IMPEXP_MIDI BSynth *be_synth; +extern _IMPEXP_MIDI BSynth* be_synth; +#endif // _SYNTH_H -#endif