Cleaned up libmidi. See the log message
from the libmidi source for details. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1820 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
a4e33e10fa
commit
173d0cd769
@ -1,89 +1,126 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef _MIDI_H_
|
||||
#define _MIDI_H_
|
||||
|
||||
#ifndef _MIDI_H
|
||||
#define _MIDI_H
|
||||
|
||||
#include <BeBuild.h>
|
||||
#include <MidiDefs.h>
|
||||
#include <OS.h>
|
||||
|
||||
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
|
||||
|
||||
|
@ -1,33 +1,50 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef _MIDI_DEFS_H_
|
||||
#define _MIDI_DEFS_H_
|
||||
|
||||
#ifndef _MIDI_DEFS_H
|
||||
#define _MIDI_DEFS_H
|
||||
|
||||
#include <OS.h>
|
||||
#include <Errors.h>
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/* System time converted to int milliseconds */
|
||||
|
||||
#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 {
|
||||
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,6 +52,7 @@ typedef unsigned char uchar;
|
||||
#ifndef _MIDI_CONSTANTS_
|
||||
#define _MIDI_CONSTANTS_
|
||||
|
||||
/* Channel Message Masks*/
|
||||
const uchar B_NOTE_OFF = 0x80;
|
||||
const uchar B_NOTE_ON = 0x90;
|
||||
const uchar B_KEY_PRESSURE = 0xa0;
|
||||
@ -43,6 +61,7 @@ const uchar B_PROGRAM_CHANGE = 0xc0;
|
||||
const uchar B_CHANNEL_PRESSURE = 0xd0;
|
||||
const uchar B_PITCH_BEND = 0xe0;
|
||||
|
||||
/* System Messages*/
|
||||
const uchar B_SYS_EX_START = 0xf0;
|
||||
const uchar B_MIDI_TIME_CODE = 0xf1;
|
||||
const uchar B_SONG_POSITION = 0xf2;
|
||||
@ -57,13 +76,14 @@ const uchar B_STOP = 0xfc;
|
||||
const uchar B_ACTIVE_SENSING = 0xfe;
|
||||
const uchar B_SYSTEM_RESET = 0xff;
|
||||
|
||||
/* 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;
|
||||
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;
|
||||
@ -96,9 +116,13 @@ const uchar B_POLY_MODE_ON = 0x7f;
|
||||
|
||||
const uchar B_TEMPO_CHANGE = 0x51;
|
||||
|
||||
#endif
|
||||
#endif // _MIDI_CONSTANTS_
|
||||
|
||||
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_
|
||||
|
@ -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(const char* name = NULL);
|
||||
~BMidiPort();
|
||||
|
||||
status_t InitCheck() const;
|
||||
status_t Open(const char *name);
|
||||
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,
|
||||
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 NoteOn(uchar channel,
|
||||
uchar note,
|
||||
uchar velocity,
|
||||
uint32 time = B_NOW);
|
||||
virtual void ProgramChange(
|
||||
uchar channel, uchar programNumber, uint32 time = B_NOW);
|
||||
|
||||
virtual void KeyPressure(uchar channel,
|
||||
uchar note,
|
||||
uchar pressure,
|
||||
uint32 time = B_NOW);
|
||||
virtual void ChannelPressure(
|
||||
uchar channel, uchar pressure, uint32 time = B_NOW);
|
||||
|
||||
virtual void ControlChange(uchar channel,
|
||||
uchar controlNumber,
|
||||
uchar controlValue,
|
||||
uint32 time = B_NOW);
|
||||
virtual void PitchBend(
|
||||
uchar channel, uchar lsb, uchar msb, uint32 time = B_NOW);
|
||||
|
||||
virtual void ProgramChange(uchar channel,
|
||||
uchar programNumber,
|
||||
uint32 time = B_NOW);
|
||||
virtual void SystemExclusive(
|
||||
void* data, size_t dataLength, uint32 time = B_NOW);
|
||||
|
||||
virtual void ChannelPressure(uchar channel,
|
||||
uchar pressure,
|
||||
uint32 time = B_NOW);
|
||||
virtual void SystemCommon(
|
||||
uchar status, uchar data0, uchar data2, uint32 time = B_NOW);
|
||||
|
||||
virtual void PitchBend(uchar channel,
|
||||
uchar lsb,
|
||||
uchar msb,
|
||||
uint32 time = B_NOW);
|
||||
virtual void SystemRealTime(uchar status, 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 SystemRealTime(uchar statusByte, 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);
|
||||
|
||||
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);
|
||||
|
||||
ssize_t Read(void* buffer, size_t numBytes) const;
|
||||
ssize_t Write(void* buffer, size_t numBytes, uint32 time) const;
|
||||
|
||||
void ScanDevices();
|
||||
|
||||
BMidiProducer *remote_source;
|
||||
BMidiConsumer *remote_sink;
|
||||
// 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;
|
||||
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;
|
||||
};
|
||||
|
||||
/*------------------------------------------------------------*/
|
||||
#endif // _MIDI_PORT_H
|
||||
|
||||
#endif
|
||||
|
@ -1,76 +1,91 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef _MIDI_STORE_H_
|
||||
#define _MIDI_STORE_H_
|
||||
|
||||
#ifndef _MIDI_STORE_H
|
||||
#define _MIDI_STORE_H
|
||||
|
||||
#include <BeBuild.h>
|
||||
#include <Midi.h>
|
||||
#include <List.h>
|
||||
|
||||
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);
|
||||
|
||||
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
|
||||
|
||||
|
@ -1,97 +1,73 @@
|
||||
/*******************************************************************************
|
||||
/
|
||||
/ 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 <BeBuild.h>
|
||||
#endif
|
||||
#include <Midi.h>
|
||||
#include <Synth.h>
|
||||
#include <MidiDefs.h>
|
||||
|
||||
|
||||
class BMidiSynth : public BMidi
|
||||
{
|
||||
public:
|
||||
BMidiSynth();
|
||||
virtual ~BMidiSynth();
|
||||
|
||||
|
||||
status_t EnableInput(bool enable, bool loadInstruments);
|
||||
bool IsInputEnabled(void) const;
|
||||
|
||||
/* set volume. You can overdrive by passing values larger than 1.0*/
|
||||
/* 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)*/
|
||||
/* (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)*/
|
||||
/* Mute and unmute channels (0 to 15) */
|
||||
void MuteChannel(int16 channel, bool do_mute);
|
||||
void GetMuteMap(char *pChannels) const;
|
||||
void GetMuteMap(char* pChannels) const;
|
||||
|
||||
void SoloChannel(int16 channel, bool do_solo);
|
||||
void GetSoloMap(char *pChannels) const;
|
||||
void GetSoloMap(char* pChannels) const;
|
||||
|
||||
/* Use these functions to drive the synth engine directly*/
|
||||
/* 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);
|
||||
|
||||
/* get current midi tick in microseconds*/
|
||||
/* 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,
|
||||
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 NoteOn(uchar channel,
|
||||
uchar note,
|
||||
uchar velocity,
|
||||
uint32 time = B_NOW);
|
||||
virtual void ProgramChange(
|
||||
uchar channel, uchar programNumber, uint32 time = B_NOW);
|
||||
|
||||
virtual void KeyPressure(uchar channel,
|
||||
uchar note,
|
||||
uchar pressure,
|
||||
uint32 time = B_NOW);
|
||||
virtual void ChannelPressure(
|
||||
uchar channel, uchar pressure, uint32 time = B_NOW);
|
||||
|
||||
virtual void ControlChange(uchar channel,
|
||||
uchar controlNumber,
|
||||
uchar controlValue,
|
||||
uint32 time = B_NOW);
|
||||
virtual void PitchBend(
|
||||
uchar channel, uchar lsb, uchar msb, 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 AllNotesOff(bool controlOnly, uint32 time = B_NOW);
|
||||
virtual void AllNotesOff(bool controlOnly, uint32 time = B_NOW);
|
||||
|
||||
protected:
|
||||
void* fSongVariables;
|
||||
@ -100,16 +76,18 @@ protected:
|
||||
|
||||
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();
|
||||
|
||||
bool fInputEnabled;
|
||||
uint32 _reserved[4];
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // _MIDI_SYNTH_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 <BeBuild.h>
|
||||
#endif
|
||||
#include <MidiSynth.h>
|
||||
#include <Entry.h>
|
||||
|
||||
typedef void (*synth_file_hook)(int32 arg);
|
||||
|
||||
|
||||
class BMidiSynthFile : public BMidiSynth
|
||||
{
|
||||
public:
|
||||
BMidiSynthFile();
|
||||
~BMidiSynthFile();
|
||||
|
||||
status_t LoadFile(const entry_ref *midi_entry_ref);
|
||||
status_t LoadFile(const entry_ref* midi_entry_ref);
|
||||
void UnloadFile(void);
|
||||
|
||||
virtual status_t Start(void);
|
||||
virtual void Stop(void);
|
||||
|
||||
void Fade(void);
|
||||
|
||||
void Pause(void);
|
||||
void Resume(void);
|
||||
|
||||
/* get ticks in microseconds of length of song*/
|
||||
/* get ticks in microseconds of length of song */
|
||||
int32 Duration(void) const;
|
||||
/* set the current playback position of song in microseconds*/
|
||||
|
||||
/* set the current playback position of song in microseconds */
|
||||
int32 Position(int32 ticks) const;
|
||||
/* get the current playback position of a song in microseconds*/
|
||||
|
||||
/* get the current playback position of a song in microseconds */
|
||||
int32 Seek();
|
||||
|
||||
/* get the patches required to play this song*/
|
||||
status_t GetPatches(int16 *pArray768, int16 *pReturnedCount) const;
|
||||
/* get the patches required to play this song */
|
||||
status_t GetPatches(int16* pArray768, int16* pReturnedCount) const;
|
||||
|
||||
/* Set a call back when song is done*/
|
||||
/* Set a call back when song is done */
|
||||
void SetFileHook(synth_file_hook pSongHook, int32 arg);
|
||||
/* poll to see if song is done*/
|
||||
|
||||
/* poll to see if song is done */
|
||||
bool IsFinished(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*/
|
||||
/* 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);
|
||||
|
||||
|
||||
/* sets tempo in beats per minute*/
|
||||
/* sets tempo in beats per minute */
|
||||
void SetTempo(int32 newTempoBPM);
|
||||
/* returns tempo in beats per minute*/
|
||||
|
||||
/* returns tempo in beats per minute */
|
||||
int32 Tempo(void) const;
|
||||
|
||||
/* pass true to loop song, false to not loop*/
|
||||
/* pass true to loop song, false to not loop */
|
||||
void EnableLooping(bool loop);
|
||||
|
||||
/* Mute and unmute tracks (0 to 64)*/
|
||||
/* Mute and unmute tracks (0 to 64) */
|
||||
void MuteTrack(int16 track, bool do_mute);
|
||||
void GetMuteMap(char *pTracks) const;
|
||||
void GetMuteMap(char* pTracks) const;
|
||||
|
||||
void SoloTrack(int16 track, bool do_solo);
|
||||
void GetSoloMap(char *pTracks) const;
|
||||
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];
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // _MIDI_SYNTH_FILE
|
||||
|
||||
|
@ -1,43 +1,64 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef _MIDI_TEXT_H_
|
||||
#define _MIDI_TEXT_H_
|
||||
|
||||
#ifndef _MIDI_TEXT_H
|
||||
#define _MIDI_TEXT_H
|
||||
|
||||
#include <BeBuild.h>
|
||||
#include <Midi.h>
|
||||
#include <stdio.h>
|
||||
|
||||
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
|
||||
|
||||
|
@ -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 <BeBuild.h>
|
||||
#endif
|
||||
#include <Entry.h>
|
||||
|
||||
typedef void (*sample_exit_hook)(int32 arg);
|
||||
@ -25,8 +14,9 @@ public:
|
||||
BSamples();
|
||||
virtual ~BSamples();
|
||||
|
||||
/* start a sample playing*/
|
||||
void Start(void * sampleData, /* pointer to audio data*/
|
||||
/* 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*/
|
||||
@ -39,7 +29,7 @@ public:
|
||||
sample_loop_hook pLoopContinueProc,
|
||||
sample_exit_hook pDoneProc);
|
||||
|
||||
/* currently paused*/
|
||||
/* currently paused */
|
||||
bool IsPaused(void) const;
|
||||
void Pause(void);
|
||||
void Resume(void);
|
||||
@ -49,23 +39,22 @@ public:
|
||||
void SetVolume(double newVolume);
|
||||
double Volume(void) const;
|
||||
|
||||
|
||||
void SetSamplingRate(double newRate);
|
||||
double SamplingRate(void) const;
|
||||
|
||||
void SetPlacement(double stereoPosition);
|
||||
|
||||
/* Set the stereo position (-1.0 left to +1.0 right, 0 is middle)*/
|
||||
/* 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*/
|
||||
/* 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;
|
||||
@ -73,4 +62,5 @@ virtual void _ReservedSamples3();
|
||||
uint32 _reserved[4];
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // _SAMPLES_H
|
||||
|
||||
|
@ -1,19 +1,8 @@
|
||||
/*******************************************************************************
|
||||
/
|
||||
/ 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 <BeBuild.h>
|
||||
#endif
|
||||
#include <Entry.h>
|
||||
#include <MidiDefs.h>
|
||||
#include <OS.h>
|
||||
@ -23,7 +12,8 @@ typedef enum interpolation_mode
|
||||
B_DROP_SAMPLE = 0,
|
||||
B_2_POINT_INTERPOLATION,
|
||||
B_LINEAR_INTERPOLATION
|
||||
} interpolation_mode;
|
||||
}
|
||||
interpolation_mode;
|
||||
|
||||
typedef enum reverb_mode
|
||||
{
|
||||
@ -33,34 +23,30 @@ 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(entry_ref* instrumentsFile);
|
||||
status_t LoadSynthData(synth_mode synth);
|
||||
synth_mode SynthMode(void);
|
||||
|
||||
void Unload(void);
|
||||
bool IsLoaded(void) const;
|
||||
|
||||
/* change audio modes*/
|
||||
/* change audio modes */
|
||||
status_t SetSamplingRate(int32 sample_rate);
|
||||
int32 SamplingRate() const;
|
||||
|
||||
@ -73,47 +59,47 @@ virtual ~BSynth();
|
||||
status_t EnableReverb(bool reverb_enabled);
|
||||
bool IsReverbEnabled() const;
|
||||
|
||||
/* change voice allocation*/
|
||||
status_t SetVoiceLimits(int16 maxSynthVoices,
|
||||
int16 maxSampleVoices,
|
||||
/* 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*/
|
||||
/* 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*/
|
||||
/* 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);
|
||||
|
||||
/* reengage to audio output streams*/
|
||||
void Resume(void);
|
||||
|
||||
/* Set a call back on controller events*/
|
||||
void SetControllerHook(int16 controller,
|
||||
synth_controller_hook cback);
|
||||
void SetControllerHook(int16 controller, synth_controller_hook cback);
|
||||
|
||||
int32 CountClients(void) const;
|
||||
|
||||
private:
|
||||
private:
|
||||
|
||||
virtual void _ReservedSynth1();
|
||||
virtual void _ReservedSynth2();
|
||||
virtual void _ReservedSynth3();
|
||||
virtual void _ReservedSynth4();
|
||||
virtual void _ReservedSynth1();
|
||||
virtual void _ReservedSynth2();
|
||||
virtual void _ReservedSynth3();
|
||||
virtual void _ReservedSynth4();
|
||||
|
||||
friend BMidiSynth;
|
||||
friend BMidiSynthFile;
|
||||
@ -121,7 +107,7 @@ virtual void _ReservedSynth4();
|
||||
int32 fClientCount;
|
||||
void _init();
|
||||
status_t _do_load(synth_mode synth);
|
||||
status_t _load_insts(entry_ref *ref);
|
||||
status_t _load_insts(entry_ref* ref);
|
||||
synth_mode fMode;
|
||||
int16 fMaxSynthVox;
|
||||
int16 fMaxSampleVox;
|
||||
@ -135,7 +121,7 @@ virtual void _ReservedSynth4();
|
||||
uint32 _reserved[4];
|
||||
};
|
||||
|
||||
extern _IMPEXP_MIDI BSynth *be_synth;
|
||||
extern _IMPEXP_MIDI BSynth* be_synth;
|
||||
|
||||
#endif // _SYNTH_H
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user