mirror of
https://github.com/Relintai/sfw.git
synced 2025-04-21 01:11:16 +02:00
Removed the midi api.
This commit is contained in:
parent
f2f89ddd9a
commit
679ef20c53
@ -1,59 +1,6 @@
|
|||||||
// @fixme: really shutdown audio & related threads before quitting. ma_dr_wav crashes.
|
// @fixme: really shutdown audio & related threads before quitting. ma_dr_wav crashes.
|
||||||
|
|
||||||
|
|
||||||
#if is(win32) && !is(gcc)
|
|
||||||
#include <windows.h>
|
|
||||||
#include <mmeapi.h> // midi
|
|
||||||
static HMIDIOUT midi_out_handle = 0;
|
|
||||||
#elif is(osx)
|
|
||||||
static AudioUnit midi_out_handle = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void midi_init() {
|
|
||||||
#if is(win32) && !is(gcc)
|
|
||||||
if( midiOutGetNumDevs() != 0 ) {
|
|
||||||
midiOutOpen(&midi_out_handle, 0, 0, 0, 0);
|
|
||||||
}
|
|
||||||
#elif is(osx)
|
|
||||||
AUGraph graph;
|
|
||||||
AUNode outputNode, mixerNode, dlsNode;
|
|
||||||
NewAUGraph(&graph);
|
|
||||||
AudioComponentDescription output = {'auou','ahal','appl',0,0};
|
|
||||||
AUGraphAddNode(graph, &output, &outputNode);
|
|
||||||
AUGraphOpen(graph);
|
|
||||||
AUGraphInitialize(graph);
|
|
||||||
AUGraphStart(graph);
|
|
||||||
AudioComponentDescription dls = {'aumu','dls ','appl',0,0};
|
|
||||||
AUGraphAddNode(graph, &dls, &dlsNode);
|
|
||||||
AUGraphNodeInfo(graph, dlsNode, NULL, &midi_out_handle);
|
|
||||||
AudioComponentDescription mixer = {'aumx','smxr','appl',0,0};
|
|
||||||
AUGraphAddNode(graph, &mixer, &mixerNode);
|
|
||||||
AUGraphConnectNodeInput(graph,mixerNode,0,outputNode,0);
|
|
||||||
AUGraphConnectNodeInput(graph,dlsNode,0,mixerNode,0);
|
|
||||||
AUGraphUpdate(graph,NULL);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
static void midi_quit() {
|
|
||||||
#if is(win32) && !is(gcc)
|
|
||||||
if (midi_out_handle) midiOutClose(midi_out_handle);
|
|
||||||
#endif
|
|
||||||
// @fixme: osx
|
|
||||||
// https://developer.apple.com/library/archive/samplecode/PlaySoftMIDI/Listings/main_cpp.html#//apple_ref/doc/uid/DTS40008635-main_cpp-DontLinkElementID_4
|
|
||||||
}
|
|
||||||
|
|
||||||
void midi_send(unsigned midi_msg) {
|
|
||||||
#if is(win32) && !is(gcc)
|
|
||||||
if( midi_out_handle ) {
|
|
||||||
midiOutShortMsg(midi_out_handle, midi_msg);
|
|
||||||
}
|
|
||||||
#elif is(osx)
|
|
||||||
if( midi_out_handle ) {
|
|
||||||
MusicDeviceMIDIEvent(midi_out_handle, (midi_msg) & 0xFF, (midi_msg >> 8) & 0xFF, (midi_msg >> 16) & 0xFF, 0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// encapsulate ma_dr_wav,ma_dr_mp3,stbvorbis and some buffer with the sts_mixer_stream_t
|
// encapsulate ma_dr_wav,ma_dr_mp3,stbvorbis and some buffer with the sts_mixer_stream_t
|
||||||
enum { UNK, WAV, OGG, MP1, MP3 };
|
enum { UNK, WAV, OGG, MP1, MP3 };
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
//--STRIP
|
||||||
|
#ifndef AUDIO_H
|
||||||
|
#define AUDIO_H
|
||||||
|
//--STRIP
|
||||||
|
|
||||||
|
//--STRIP
|
||||||
|
#include "object/object.h"
|
||||||
|
#include "object/reference.h"
|
||||||
|
//--STRIP
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// audio framework
|
// audio framework
|
||||||
// - rlyeh, public domain
|
// - rlyeh, public domain
|
||||||
@ -8,16 +18,14 @@
|
|||||||
// @todo: destroystream() if( ss->type == MOD ) jar_mod_unload(&ss->mod);
|
// @todo: destroystream() if( ss->type == MOD ) jar_mod_unload(&ss->mod);
|
||||||
// @todo: destroystream() if( ss->type == XM && ss->xm ) jar_xm_free_context(ss->xm);
|
// @todo: destroystream() if( ss->type == XM && ss->xm ) jar_xm_free_context(ss->xm);
|
||||||
|
|
||||||
// midi interface
|
|
||||||
|
|
||||||
void midi_send(unsigned midi_msg);
|
|
||||||
|
|
||||||
// audio interface
|
// audio interface
|
||||||
|
|
||||||
typedef struct audio_handle* audio_t;
|
typedef struct audio_handle* audio_t;
|
||||||
|
|
||||||
audio_t audio_clip( const char *pathfile );
|
audio_t audio_clip( const char *pathfile );
|
||||||
audio_t audio_stream( const char *pathfile );
|
audio_t audio_stream( const char *pathfile );
|
||||||
|
|
||||||
|
|
||||||
int audio_play( audio_t s, int flags );
|
int audio_play( audio_t s, int flags );
|
||||||
int audio_play_gain( audio_t a, int flags, float gain/*0*/ );
|
int audio_play_gain( audio_t a, int flags, float gain/*0*/ );
|
||||||
int audio_play_gain_pitch( audio_t a, int flags, float gain, float pitch/*1*/ );
|
int audio_play_gain_pitch( audio_t a, int flags, float gain, float pitch/*1*/ );
|
||||||
@ -56,3 +64,8 @@ enum AUDIO_FLAGS {
|
|||||||
};
|
};
|
||||||
|
|
||||||
int audio_queue( const void *samples, int num_samples, int flags );
|
int audio_queue( const void *samples, int num_samples, int flags );
|
||||||
|
|
||||||
|
|
||||||
|
//--STRIP
|
||||||
|
#endif
|
||||||
|
//--STRIP
|
||||||
|
Loading…
Reference in New Issue
Block a user