add experimental VGAT4 sound support
This commit is contained in:
parent
1ec8b17d0e
commit
8dee01b44f
67 changed files with 1173 additions and 752 deletions
|
|
@ -68,8 +68,6 @@ static Channel chan[6] = {
|
||||||
volatile bool playing = false;
|
volatile bool playing = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void snd_Reset(void)
|
static void snd_Reset(void)
|
||||||
{
|
{
|
||||||
#ifndef CUSTOM_SND
|
#ifndef CUSTOM_SND
|
||||||
|
|
@ -91,21 +89,21 @@ static void snd_Reset(void)
|
||||||
|
|
||||||
#ifdef CUSTOM_SND
|
#ifdef CUSTOM_SND
|
||||||
extern "C" {
|
extern "C" {
|
||||||
void POKEYSND_Process(void *sndbuffer, int sndn);
|
void SND_Process(void *sndbuffer, int sndn);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void snd_Mixer(short * stream, int len )
|
|
||||||
|
FASTRUN void AudioPlaySystem::snd_Mixer(short * stream, int len )
|
||||||
{
|
{
|
||||||
if (playing)
|
if (playing)
|
||||||
{
|
{
|
||||||
#ifdef CUSTOM_SND
|
#ifdef CUSTOM_SND
|
||||||
POKEYSND_Process((void*)stream, len);
|
SND_Process((void*)stream, len);
|
||||||
#else
|
#else
|
||||||
int i;
|
int i;
|
||||||
long s;
|
long s;
|
||||||
len = len >> 1;
|
len = len >> 1;
|
||||||
|
|
||||||
short v0=chan[0].vol;
|
short v0=chan[0].vol;
|
||||||
short v1=chan[1].vol;
|
short v1=chan[1].vol;
|
||||||
short v2=chan[2].vol;
|
short v2=chan[2].vol;
|
||||||
|
|
@ -135,14 +133,14 @@ static void snd_Mixer(short * stream, int len )
|
||||||
|
|
||||||
void AudioPlaySystem::begin(void)
|
void AudioPlaySystem::begin(void)
|
||||||
{
|
{
|
||||||
//emu_printf("AudioPlaySystem constructor");
|
|
||||||
this->reset();
|
this->reset();
|
||||||
//setSampleParameters(CLOCKFREQ, SAMPLERATE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioPlaySystem::start(void)
|
void AudioPlaySystem::start(void)
|
||||||
{
|
{
|
||||||
//emu_printf("allocating sound buf");
|
#ifndef HAS_T4_VGA
|
||||||
|
AudioMemory(16);
|
||||||
|
#endif
|
||||||
playing = true;
|
playing = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -166,6 +164,7 @@ bool AudioPlaySystem::isPlaying(void)
|
||||||
return playing;
|
return playing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
void AudioPlaySystem::update(void) {
|
void AudioPlaySystem::update(void) {
|
||||||
audio_block_t *block;
|
audio_block_t *block;
|
||||||
|
|
||||||
|
|
@ -182,6 +181,7 @@ void AudioPlaySystem::update(void) {
|
||||||
transmit(block);
|
transmit(block);
|
||||||
release(block);
|
release(block);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void AudioPlaySystem::sound(int C, int F, int V) {
|
void AudioPlaySystem::sound(int C, int F, int V) {
|
||||||
#ifndef CUSTOM_SND
|
#ifndef CUSTOM_SND
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,12 @@
|
||||||
|
|
||||||
#ifdef HAS_SND
|
#ifdef HAS_SND
|
||||||
|
|
||||||
|
#include "platform_config.h"
|
||||||
|
|
||||||
|
#undef HAS_T4_VGA // To force using Audio library!!
|
||||||
|
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
|
|
||||||
#include <Audio.h>
|
#include <Audio.h>
|
||||||
|
|
||||||
class AudioPlaySystem : public AudioStream
|
class AudioPlaySystem : public AudioStream
|
||||||
|
|
@ -21,8 +27,28 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void update(void);
|
virtual void update(void);
|
||||||
|
static void snd_Mixer(short * stream, int len );
|
||||||
|
};
|
||||||
|
|
||||||
|
#else
|
||||||
|
class AudioPlaySystem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AudioPlaySystem(void) { };
|
||||||
|
void begin(void);
|
||||||
|
void setSampleParameters(float clockfreq, float samplerate);
|
||||||
|
void reset(void);
|
||||||
|
void start(void);
|
||||||
|
void stop(void);
|
||||||
|
bool isPlaying(void);
|
||||||
|
void sound(int C, int F, int V);
|
||||||
|
void buzz(int size, int val);
|
||||||
|
void step(void);
|
||||||
|
static void snd_Mixer(short * stream, int len );
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -362,7 +362,7 @@ void POKEYSND_SetMzQuality(int quality) /* specially for win32, perhaps not need
|
||||||
mz_quality = quality;
|
mz_quality = quality;
|
||||||
}
|
}
|
||||||
|
|
||||||
void POKEYSND_Process(void *sndbuffer, int sndn)
|
void SND_Process(void *sndbuffer, int sndn)
|
||||||
{
|
{
|
||||||
POKEYSND_Process_ptr(sndbuffer, sndn);
|
POKEYSND_Process_ptr(sndbuffer, sndn);
|
||||||
#if defined(PBI_XLD) || defined (VOICEBOX)
|
#if defined(PBI_XLD) || defined (VOICEBOX)
|
||||||
|
|
|
||||||
|
|
@ -202,7 +202,7 @@ void * emu_LineBuffer(int line)
|
||||||
void setup() {
|
void setup() {
|
||||||
|
|
||||||
#ifdef HAS_T4_VGA
|
#ifdef HAS_T4_VGA
|
||||||
tft.begin(VGA_MODE_352x240);
|
tft.begin(VGA_MODE_320x240);
|
||||||
// NVIC_SET_PRIORITY(IRQ_QTIMER3, 0);
|
// NVIC_SET_PRIORITY(IRQ_QTIMER3, 0);
|
||||||
#else
|
#else
|
||||||
tft.begin();
|
tft.begin();
|
||||||
|
|
@ -273,32 +273,31 @@ void loop(void)
|
||||||
|
|
||||||
#ifdef HAS_SND
|
#ifdef HAS_SND
|
||||||
|
|
||||||
#include <Audio.h>
|
|
||||||
#include "AudioPlaySystem.h"
|
#include "AudioPlaySystem.h"
|
||||||
|
|
||||||
AudioPlaySystem mymixer;
|
AudioPlaySystem mymixer;
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
|
#include <Audio.h>
|
||||||
#if defined(__IMXRT1052__) || defined(__IMXRT1062__)
|
#if defined(__IMXRT1052__) || defined(__IMXRT1062__)
|
||||||
#ifdef HAS_T4_VGA
|
//AudioOutputMQS mqs;
|
||||||
|
//AudioConnection patchCord9(mymixer, 0, mqs, 1);
|
||||||
AudioOutputI2S i2s1;
|
AudioOutputI2S i2s1;
|
||||||
AudioConnection patchCord8(mymixer, 0, i2s1, 0);
|
AudioConnection patchCord8(mymixer, 0, i2s1, 0);
|
||||||
AudioConnection patchCord9(mymixer, 0, i2s1, 1);
|
AudioConnection patchCord9(mymixer, 0, i2s1, 1);
|
||||||
AudioControlSGTL5000 sgtl5000_1;
|
AudioControlSGTL5000 sgtl5000_1;
|
||||||
#else
|
#else
|
||||||
AudioOutputMQS mqs;
|
|
||||||
AudioConnection patchCord9(mymixer, 0, mqs, 1);
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
AudioOutputAnalog dac1;
|
AudioOutputAnalog dac1;
|
||||||
AudioConnection patchCord1(mymixer, dac1);
|
AudioConnection patchCord1(mymixer, dac1);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
void emu_sndInit() {
|
void emu_sndInit() {
|
||||||
Serial.println("sound init");
|
Serial.println("sound init");
|
||||||
#ifdef HAS_T4_VGA
|
#ifdef HAS_T4_VGA
|
||||||
sgtl5000_1.enable();
|
tft.begin_audio(256, mymixer.snd_Mixer);
|
||||||
sgtl5000_1.volume(0.6);
|
// sgtl5000_1.enable();
|
||||||
|
// sgtl5000_1.volume(0.6);
|
||||||
#endif
|
#endif
|
||||||
AudioMemory(16);
|
|
||||||
mymixer.start();
|
mymixer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -68,8 +68,6 @@ static Channel chan[6] = {
|
||||||
volatile bool playing = false;
|
volatile bool playing = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void snd_Reset(void)
|
static void snd_Reset(void)
|
||||||
{
|
{
|
||||||
#ifndef CUSTOM_SND
|
#ifndef CUSTOM_SND
|
||||||
|
|
@ -95,7 +93,8 @@ void SND_Process(void *sndbuffer, int sndn);
|
||||||
//}
|
//}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void snd_Mixer(short * stream, int len )
|
|
||||||
|
FASTRUN void AudioPlaySystem::snd_Mixer(short * stream, int len )
|
||||||
{
|
{
|
||||||
if (playing)
|
if (playing)
|
||||||
{
|
{
|
||||||
|
|
@ -105,7 +104,6 @@ static void snd_Mixer(short * stream, int len )
|
||||||
int i;
|
int i;
|
||||||
long s;
|
long s;
|
||||||
len = len >> 1;
|
len = len >> 1;
|
||||||
|
|
||||||
short v0=chan[0].vol;
|
short v0=chan[0].vol;
|
||||||
short v1=chan[1].vol;
|
short v1=chan[1].vol;
|
||||||
short v2=chan[2].vol;
|
short v2=chan[2].vol;
|
||||||
|
|
@ -135,14 +133,14 @@ static void snd_Mixer(short * stream, int len )
|
||||||
|
|
||||||
void AudioPlaySystem::begin(void)
|
void AudioPlaySystem::begin(void)
|
||||||
{
|
{
|
||||||
//emu_printf("AudioPlaySystem constructor");
|
|
||||||
this->reset();
|
this->reset();
|
||||||
//setSampleParameters(CLOCKFREQ, SAMPLERATE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioPlaySystem::start(void)
|
void AudioPlaySystem::start(void)
|
||||||
{
|
{
|
||||||
//emu_printf("allocating sound buf");
|
#ifndef HAS_T4_VGA
|
||||||
|
AudioMemory(16);
|
||||||
|
#endif
|
||||||
playing = true;
|
playing = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -166,6 +164,7 @@ bool AudioPlaySystem::isPlaying(void)
|
||||||
return playing;
|
return playing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
void AudioPlaySystem::update(void) {
|
void AudioPlaySystem::update(void) {
|
||||||
audio_block_t *block;
|
audio_block_t *block;
|
||||||
|
|
||||||
|
|
@ -182,6 +181,7 @@ void AudioPlaySystem::update(void) {
|
||||||
transmit(block);
|
transmit(block);
|
||||||
release(block);
|
release(block);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void AudioPlaySystem::sound(int C, int F, int V) {
|
void AudioPlaySystem::sound(int C, int F, int V) {
|
||||||
#ifndef CUSTOM_SND
|
#ifndef CUSTOM_SND
|
||||||
|
|
@ -195,4 +195,3 @@ void AudioPlaySystem::sound(int C, int F, int V) {
|
||||||
void AudioPlaySystem::step(void) {
|
void AudioPlaySystem::step(void) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,12 @@
|
||||||
|
|
||||||
#ifdef HAS_SND
|
#ifdef HAS_SND
|
||||||
|
|
||||||
|
#include "platform_config.h"
|
||||||
|
|
||||||
|
//#undef HAS_T4_VGA // To force using Audio library!!
|
||||||
|
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
|
|
||||||
#include <Audio.h>
|
#include <Audio.h>
|
||||||
|
|
||||||
class AudioPlaySystem : public AudioStream
|
class AudioPlaySystem : public AudioStream
|
||||||
|
|
@ -21,8 +27,28 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void update(void);
|
virtual void update(void);
|
||||||
|
static void snd_Mixer(short * stream, int len );
|
||||||
|
};
|
||||||
|
|
||||||
|
#else
|
||||||
|
class AudioPlaySystem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AudioPlaySystem(void) { };
|
||||||
|
void begin(void);
|
||||||
|
void setSampleParameters(float clockfreq, float samplerate);
|
||||||
|
void reset(void);
|
||||||
|
void start(void);
|
||||||
|
void stop(void);
|
||||||
|
bool isPlaying(void);
|
||||||
|
void sound(int C, int F, int V);
|
||||||
|
void buzz(int size, int val);
|
||||||
|
void step(void);
|
||||||
|
static void snd_Mixer(short * stream, int len );
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
//#define INVX 1
|
//#define INVX 1
|
||||||
//#define INVY 1
|
//#define INVY 1
|
||||||
//#define HAS_SND 1
|
#define HAS_SND 1
|
||||||
#define HAS_USBKEY 1
|
#define HAS_USBKEY 1
|
||||||
//#define HAS_I2CKBD 1
|
//#define HAS_I2CKBD 1
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -275,31 +275,33 @@ void loop(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAS_SND
|
#ifdef HAS_SND
|
||||||
|
|
||||||
#include <Audio.h>
|
|
||||||
#include "AudioPlaySystem.h"
|
#include "AudioPlaySystem.h"
|
||||||
|
|
||||||
AudioPlaySystem mymixer;
|
AudioPlaySystem mymixer;
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
|
#include <Audio.h>
|
||||||
#if defined(__IMXRT1052__) || defined(__IMXRT1062__)
|
#if defined(__IMXRT1052__) || defined(__IMXRT1062__)
|
||||||
#ifdef HAS_T4_VGA
|
//AudioOutputMQS mqs;
|
||||||
|
//AudioConnection patchCord9(mymixer, 0, mqs, 1);
|
||||||
AudioOutputI2S i2s1;
|
AudioOutputI2S i2s1;
|
||||||
AudioConnection patchCord8(mymixer, 0, i2s1, 0);
|
AudioConnection patchCord8(mymixer, 0, i2s1, 0);
|
||||||
AudioConnection patchCord9(mymixer, 0, i2s1, 1);
|
AudioConnection patchCord9(mymixer, 0, i2s1, 1);
|
||||||
AudioControlSGTL5000 sgtl5000_1;
|
AudioControlSGTL5000 sgtl5000_1;
|
||||||
#else
|
#else
|
||||||
AudioOutputMQS mqs;
|
|
||||||
AudioConnection patchCord9(mymixer, 0, mqs, 1);
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
AudioOutputAnalog dac1;
|
AudioOutputAnalog dac1;
|
||||||
AudioConnection patchCord1(mymixer, dac1);
|
AudioConnection patchCord1(mymixer, dac1);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
void emu_sndInit() {
|
void emu_sndInit() {
|
||||||
Serial.println("sound init");
|
Serial.println("sound init");
|
||||||
AudioMemory(16);
|
#ifdef HAS_T4_VGA
|
||||||
|
tft.begin_audio(256, mymixer.snd_Mixer);
|
||||||
|
// sgtl5000_1.enable();
|
||||||
|
// sgtl5000_1.volume(0.6);
|
||||||
|
#endif
|
||||||
mymixer.start();
|
mymixer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,8 +68,6 @@ static Channel chan[6] = {
|
||||||
volatile bool playing = false;
|
volatile bool playing = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void snd_Reset(void)
|
static void snd_Reset(void)
|
||||||
{
|
{
|
||||||
#ifndef CUSTOM_SND
|
#ifndef CUSTOM_SND
|
||||||
|
|
@ -91,21 +89,21 @@ static void snd_Reset(void)
|
||||||
|
|
||||||
#ifdef CUSTOM_SND
|
#ifdef CUSTOM_SND
|
||||||
extern "C" {
|
extern "C" {
|
||||||
void POKEYSND_Process(void *sndbuffer, int sndn);
|
void SND_Process(void *sndbuffer, int sndn);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void snd_Mixer(short * stream, int len )
|
|
||||||
|
FASTRUN void AudioPlaySystem::snd_Mixer(short * stream, int len )
|
||||||
{
|
{
|
||||||
if (playing)
|
if (playing)
|
||||||
{
|
{
|
||||||
#ifdef CUSTOM_SND
|
#ifdef CUSTOM_SND
|
||||||
POKEYSND_Process((void*)stream, len);
|
SND_Process((void*)stream, len);
|
||||||
#else
|
#else
|
||||||
int i;
|
int i;
|
||||||
long s;
|
long s;
|
||||||
len = len >> 1;
|
len = len >> 1;
|
||||||
|
|
||||||
short v0=chan[0].vol;
|
short v0=chan[0].vol;
|
||||||
short v1=chan[1].vol;
|
short v1=chan[1].vol;
|
||||||
short v2=chan[2].vol;
|
short v2=chan[2].vol;
|
||||||
|
|
@ -135,14 +133,14 @@ static void snd_Mixer(short * stream, int len )
|
||||||
|
|
||||||
void AudioPlaySystem::begin(void)
|
void AudioPlaySystem::begin(void)
|
||||||
{
|
{
|
||||||
//emu_printf("AudioPlaySystem constructor");
|
|
||||||
this->reset();
|
this->reset();
|
||||||
//setSampleParameters(CLOCKFREQ, SAMPLERATE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioPlaySystem::start(void)
|
void AudioPlaySystem::start(void)
|
||||||
{
|
{
|
||||||
//emu_printf("allocating sound buf");
|
#ifndef HAS_T4_VGA
|
||||||
|
AudioMemory(16);
|
||||||
|
#endif
|
||||||
playing = true;
|
playing = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -166,6 +164,7 @@ bool AudioPlaySystem::isPlaying(void)
|
||||||
return playing;
|
return playing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
void AudioPlaySystem::update(void) {
|
void AudioPlaySystem::update(void) {
|
||||||
audio_block_t *block;
|
audio_block_t *block;
|
||||||
|
|
||||||
|
|
@ -182,6 +181,7 @@ void AudioPlaySystem::update(void) {
|
||||||
transmit(block);
|
transmit(block);
|
||||||
release(block);
|
release(block);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void AudioPlaySystem::sound(int C, int F, int V) {
|
void AudioPlaySystem::sound(int C, int F, int V) {
|
||||||
#ifndef CUSTOM_SND
|
#ifndef CUSTOM_SND
|
||||||
|
|
@ -195,4 +195,3 @@ void AudioPlaySystem::sound(int C, int F, int V) {
|
||||||
void AudioPlaySystem::step(void) {
|
void AudioPlaySystem::step(void) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,12 @@
|
||||||
|
|
||||||
#ifdef HAS_SND
|
#ifdef HAS_SND
|
||||||
|
|
||||||
|
#include "platform_config.h"
|
||||||
|
|
||||||
|
//#undef HAS_T4_VGA // To force using Audio library!!
|
||||||
|
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
|
|
||||||
#include <Audio.h>
|
#include <Audio.h>
|
||||||
|
|
||||||
class AudioPlaySystem : public AudioStream
|
class AudioPlaySystem : public AudioStream
|
||||||
|
|
@ -21,8 +27,28 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void update(void);
|
virtual void update(void);
|
||||||
|
static void snd_Mixer(short * stream, int len );
|
||||||
|
};
|
||||||
|
|
||||||
|
#else
|
||||||
|
class AudioPlaySystem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AudioPlaySystem(void) { };
|
||||||
|
void begin(void);
|
||||||
|
void setSampleParameters(float clockfreq, float samplerate);
|
||||||
|
void reset(void);
|
||||||
|
void start(void);
|
||||||
|
void stop(void);
|
||||||
|
bool isPlaying(void);
|
||||||
|
void sound(int C, int F, int V);
|
||||||
|
void buzz(int size, int val);
|
||||||
|
void step(void);
|
||||||
|
static void snd_Mixer(short * stream, int len );
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
//#define OLD_LAYOUT 1
|
//#define OLD_LAYOUT 1
|
||||||
#define HAS_T4_VGA 1
|
#define HAS_T4_VGA 1
|
||||||
|
|
||||||
//#define HAS_SND 1
|
#define HAS_SND 1
|
||||||
//#define INVX 1
|
//#define INVX 1
|
||||||
//#define INVY 1
|
//#define INVY 1
|
||||||
#define HAS_USBKEY 1
|
#define HAS_USBKEY 1
|
||||||
|
|
|
||||||
|
|
@ -362,7 +362,7 @@ void POKEYSND_SetMzQuality(int quality) /* specially for win32, perhaps not need
|
||||||
mz_quality = quality;
|
mz_quality = quality;
|
||||||
}
|
}
|
||||||
|
|
||||||
void POKEYSND_Process(void *sndbuffer, int sndn)
|
void SND_Process(void *sndbuffer, int sndn)
|
||||||
{
|
{
|
||||||
POKEYSND_Process_ptr(sndbuffer, sndn);
|
POKEYSND_Process_ptr(sndbuffer, sndn);
|
||||||
#if defined(PBI_XLD) || defined (VOICEBOX)
|
#if defined(PBI_XLD) || defined (VOICEBOX)
|
||||||
|
|
|
||||||
|
|
@ -202,7 +202,7 @@ void * emu_LineBuffer(int line)
|
||||||
void setup() {
|
void setup() {
|
||||||
|
|
||||||
#ifdef HAS_T4_VGA
|
#ifdef HAS_T4_VGA
|
||||||
tft.begin(VGA_MODE_352x240);
|
tft.begin(VGA_MODE_320x240);
|
||||||
// NVIC_SET_PRIORITY(IRQ_QTIMER3, 255);
|
// NVIC_SET_PRIORITY(IRQ_QTIMER3, 255);
|
||||||
#else
|
#else
|
||||||
tft.begin();
|
tft.begin();
|
||||||
|
|
@ -269,36 +269,33 @@ void loop(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAS_SND
|
#ifdef HAS_SND
|
||||||
|
|
||||||
#include <Audio.h>
|
|
||||||
#include "AudioPlaySystem.h"
|
#include "AudioPlaySystem.h"
|
||||||
|
|
||||||
AudioPlaySystem mymixer;
|
AudioPlaySystem mymixer;
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
|
#include <Audio.h>
|
||||||
#if defined(__IMXRT1052__) || defined(__IMXRT1062__)
|
#if defined(__IMXRT1052__) || defined(__IMXRT1062__)
|
||||||
#ifdef HAS_T4_VGA
|
//AudioOutputMQS mqs;
|
||||||
|
//AudioConnection patchCord9(mymixer, 0, mqs, 1);
|
||||||
AudioOutputI2S i2s1;
|
AudioOutputI2S i2s1;
|
||||||
AudioConnection patchCord8(mymixer, 0, i2s1, 0);
|
AudioConnection patchCord8(mymixer, 0, i2s1, 0);
|
||||||
AudioConnection patchCord9(mymixer, 0, i2s1, 1);
|
AudioConnection patchCord9(mymixer, 0, i2s1, 1);
|
||||||
AudioControlSGTL5000 sgtl5000_1;
|
AudioControlSGTL5000 sgtl5000_1;
|
||||||
#else
|
#else
|
||||||
AudioOutputMQS mqs;
|
|
||||||
AudioConnection patchCord9(mymixer, 0, mqs, 1);
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
AudioOutputAnalog dac1;
|
AudioOutputAnalog dac1;
|
||||||
AudioConnection patchCord1(mymixer, dac1);
|
AudioConnection patchCord1(mymixer, dac1);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
void emu_sndInit() {
|
void emu_sndInit() {
|
||||||
Serial.println("sound init");
|
Serial.println("sound init");
|
||||||
#ifdef HAS_T4_VGA
|
#ifdef HAS_T4_VGA
|
||||||
|
tft.begin_audio(256, mymixer.snd_Mixer);
|
||||||
// sgtl5000_1.enable();
|
// sgtl5000_1.enable();
|
||||||
// sgtl5000_1.volume(0.6);
|
// sgtl5000_1.volume(0.6);
|
||||||
#endif
|
#endif
|
||||||
AudioMemory(16);
|
|
||||||
mymixer.start();
|
mymixer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,8 +68,6 @@ static Channel chan[6] = {
|
||||||
volatile bool playing = false;
|
volatile bool playing = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void snd_Reset(void)
|
static void snd_Reset(void)
|
||||||
{
|
{
|
||||||
#ifndef CUSTOM_SND
|
#ifndef CUSTOM_SND
|
||||||
|
|
@ -95,7 +93,8 @@ void SND_Process(void *sndbuffer, int sndn);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void snd_Mixer(short * stream, int len )
|
|
||||||
|
FASTRUN void AudioPlaySystem::snd_Mixer(short * stream, int len )
|
||||||
{
|
{
|
||||||
if (playing)
|
if (playing)
|
||||||
{
|
{
|
||||||
|
|
@ -105,7 +104,6 @@ static void snd_Mixer(short * stream, int len )
|
||||||
int i;
|
int i;
|
||||||
long s;
|
long s;
|
||||||
len = len >> 1;
|
len = len >> 1;
|
||||||
|
|
||||||
short v0=chan[0].vol;
|
short v0=chan[0].vol;
|
||||||
short v1=chan[1].vol;
|
short v1=chan[1].vol;
|
||||||
short v2=chan[2].vol;
|
short v2=chan[2].vol;
|
||||||
|
|
@ -135,14 +133,14 @@ static void snd_Mixer(short * stream, int len )
|
||||||
|
|
||||||
void AudioPlaySystem::begin(void)
|
void AudioPlaySystem::begin(void)
|
||||||
{
|
{
|
||||||
//emu_printf("AudioPlaySystem constructor");
|
|
||||||
this->reset();
|
this->reset();
|
||||||
//setSampleParameters(CLOCKFREQ, SAMPLERATE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioPlaySystem::start(void)
|
void AudioPlaySystem::start(void)
|
||||||
{
|
{
|
||||||
//emu_printf("allocating sound buf");
|
#ifndef HAS_T4_VGA
|
||||||
|
AudioMemory(16);
|
||||||
|
#endif
|
||||||
playing = true;
|
playing = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -166,6 +164,7 @@ bool AudioPlaySystem::isPlaying(void)
|
||||||
return playing;
|
return playing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
void AudioPlaySystem::update(void) {
|
void AudioPlaySystem::update(void) {
|
||||||
audio_block_t *block;
|
audio_block_t *block;
|
||||||
|
|
||||||
|
|
@ -182,6 +181,7 @@ void AudioPlaySystem::update(void) {
|
||||||
transmit(block);
|
transmit(block);
|
||||||
release(block);
|
release(block);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void AudioPlaySystem::sound(int C, int F, int V) {
|
void AudioPlaySystem::sound(int C, int F, int V) {
|
||||||
#ifndef CUSTOM_SND
|
#ifndef CUSTOM_SND
|
||||||
|
|
@ -195,4 +195,3 @@ void AudioPlaySystem::sound(int C, int F, int V) {
|
||||||
void AudioPlaySystem::step(void) {
|
void AudioPlaySystem::step(void) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,12 @@
|
||||||
|
|
||||||
#ifdef HAS_SND
|
#ifdef HAS_SND
|
||||||
|
|
||||||
|
#include "platform_config.h"
|
||||||
|
|
||||||
|
//#undef HAS_T4_VGA // To force using Audio library!!
|
||||||
|
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
|
|
||||||
#include <Audio.h>
|
#include <Audio.h>
|
||||||
|
|
||||||
class AudioPlaySystem : public AudioStream
|
class AudioPlaySystem : public AudioStream
|
||||||
|
|
@ -21,8 +27,28 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void update(void);
|
virtual void update(void);
|
||||||
|
static void snd_Mixer(short * stream, int len );
|
||||||
|
};
|
||||||
|
|
||||||
|
#else
|
||||||
|
class AudioPlaySystem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AudioPlaySystem(void) { };
|
||||||
|
void begin(void);
|
||||||
|
void setSampleParameters(float clockfreq, float samplerate);
|
||||||
|
void reset(void);
|
||||||
|
void start(void);
|
||||||
|
void stop(void);
|
||||||
|
bool isPlaying(void);
|
||||||
|
void sound(int C, int F, int V);
|
||||||
|
void buzz(int size, int val);
|
||||||
|
void step(void);
|
||||||
|
static void snd_Mixer(short * stream, int len );
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
//#define OLD_LAYOUT 1
|
//#define OLD_LAYOUT 1
|
||||||
#define HAS_T4_VGA 1
|
#define HAS_T4_VGA 1
|
||||||
|
|
||||||
//#define HAS_SND 1
|
#define HAS_SND 1
|
||||||
//#define INVX 1
|
//#define INVX 1
|
||||||
//#define INVY 1
|
//#define INVY 1
|
||||||
#define HAS_USBKEY 1
|
#define HAS_USBKEY 1
|
||||||
|
|
|
||||||
|
|
@ -203,7 +203,7 @@ void * emu_LineBuffer(int line)
|
||||||
void setup() {
|
void setup() {
|
||||||
|
|
||||||
#ifdef HAS_T4_VGA
|
#ifdef HAS_T4_VGA
|
||||||
tft.begin(VGA_MODE_352x240);
|
tft.begin(VGA_MODE_320x240);
|
||||||
// NVIC_SET_PRIORITY(IRQ_QTIMER3, 0);
|
// NVIC_SET_PRIORITY(IRQ_QTIMER3, 0);
|
||||||
#else
|
#else
|
||||||
tft.begin();
|
tft.begin();
|
||||||
|
|
@ -271,35 +271,33 @@ void loop(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAS_SND
|
#ifdef HAS_SND
|
||||||
|
|
||||||
#include <Audio.h>
|
|
||||||
#include "AudioPlaySystem.h"
|
#include "AudioPlaySystem.h"
|
||||||
|
|
||||||
AudioPlaySystem mymixer;
|
AudioPlaySystem mymixer;
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
|
#include <Audio.h>
|
||||||
#if defined(__IMXRT1052__) || defined(__IMXRT1062__)
|
#if defined(__IMXRT1052__) || defined(__IMXRT1062__)
|
||||||
#ifdef HAS_T4_VGA
|
//AudioOutputMQS mqs;
|
||||||
|
//AudioConnection patchCord9(mymixer, 0, mqs, 1);
|
||||||
AudioOutputI2S i2s1;
|
AudioOutputI2S i2s1;
|
||||||
AudioConnection patchCord8(mymixer, 0, i2s1, 0);
|
AudioConnection patchCord8(mymixer, 0, i2s1, 0);
|
||||||
AudioConnection patchCord9(mymixer, 0, i2s1, 1);
|
AudioConnection patchCord9(mymixer, 0, i2s1, 1);
|
||||||
AudioControlSGTL5000 sgtl5000_1;
|
AudioControlSGTL5000 sgtl5000_1;
|
||||||
#else
|
#else
|
||||||
AudioOutputMQS mqs;
|
|
||||||
AudioConnection patchCord9(mymixer, 0, mqs, 1);
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
AudioOutputAnalog dac1;
|
AudioOutputAnalog dac1;
|
||||||
AudioConnection patchCord1(mymixer, dac1);
|
AudioConnection patchCord1(mymixer, dac1);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
void emu_sndInit() {
|
void emu_sndInit() {
|
||||||
Serial.println("sound init");
|
Serial.println("sound init");
|
||||||
#ifdef HAS_T4_VGA
|
#ifdef HAS_T4_VGA
|
||||||
sgtl5000_1.enable();
|
tft.begin_audio(256, mymixer.snd_Mixer);
|
||||||
sgtl5000_1.volume(0.6);
|
// sgtl5000_1.enable();
|
||||||
|
// sgtl5000_1.volume(0.6);
|
||||||
#endif
|
#endif
|
||||||
AudioMemory(16);
|
|
||||||
mymixer.start();
|
mymixer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
BIN
MCUME_teensy/teensycolem/.DS_Store
vendored
Normal file
BIN
MCUME_teensy/teensycolem/.DS_Store
vendored
Normal file
Binary file not shown.
|
|
@ -68,8 +68,6 @@ static Channel chan[6] = {
|
||||||
volatile bool playing = false;
|
volatile bool playing = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void snd_Reset(void)
|
static void snd_Reset(void)
|
||||||
{
|
{
|
||||||
#ifndef CUSTOM_SND
|
#ifndef CUSTOM_SND
|
||||||
|
|
@ -90,12 +88,13 @@ static void snd_Reset(void)
|
||||||
|
|
||||||
|
|
||||||
#ifdef CUSTOM_SND
|
#ifdef CUSTOM_SND
|
||||||
extern "C" {
|
//extern "C" {
|
||||||
void SND_Process(void *sndbuffer, int sndn);
|
void SND_Process(void *sndbuffer, int sndn);
|
||||||
}
|
//}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void snd_Mixer(short * stream, int len )
|
|
||||||
|
FASTRUN void AudioPlaySystem::snd_Mixer(short * stream, int len )
|
||||||
{
|
{
|
||||||
if (playing)
|
if (playing)
|
||||||
{
|
{
|
||||||
|
|
@ -105,7 +104,6 @@ static void snd_Mixer(short * stream, int len )
|
||||||
int i;
|
int i;
|
||||||
long s;
|
long s;
|
||||||
len = len >> 1;
|
len = len >> 1;
|
||||||
|
|
||||||
short v0=chan[0].vol;
|
short v0=chan[0].vol;
|
||||||
short v1=chan[1].vol;
|
short v1=chan[1].vol;
|
||||||
short v2=chan[2].vol;
|
short v2=chan[2].vol;
|
||||||
|
|
@ -135,14 +133,14 @@ static void snd_Mixer(short * stream, int len )
|
||||||
|
|
||||||
void AudioPlaySystem::begin(void)
|
void AudioPlaySystem::begin(void)
|
||||||
{
|
{
|
||||||
//emu_printf("AudioPlaySystem constructor");
|
|
||||||
this->reset();
|
this->reset();
|
||||||
//setSampleParameters(CLOCKFREQ, SAMPLERATE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioPlaySystem::start(void)
|
void AudioPlaySystem::start(void)
|
||||||
{
|
{
|
||||||
//emu_printf("allocating sound buf");
|
#ifndef HAS_T4_VGA
|
||||||
|
AudioMemory(16);
|
||||||
|
#endif
|
||||||
playing = true;
|
playing = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -166,6 +164,7 @@ bool AudioPlaySystem::isPlaying(void)
|
||||||
return playing;
|
return playing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
void AudioPlaySystem::update(void) {
|
void AudioPlaySystem::update(void) {
|
||||||
audio_block_t *block;
|
audio_block_t *block;
|
||||||
|
|
||||||
|
|
@ -182,6 +181,7 @@ void AudioPlaySystem::update(void) {
|
||||||
transmit(block);
|
transmit(block);
|
||||||
release(block);
|
release(block);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void AudioPlaySystem::sound(int C, int F, int V) {
|
void AudioPlaySystem::sound(int C, int F, int V) {
|
||||||
#ifndef CUSTOM_SND
|
#ifndef CUSTOM_SND
|
||||||
|
|
@ -195,4 +195,3 @@ void AudioPlaySystem::sound(int C, int F, int V) {
|
||||||
void AudioPlaySystem::step(void) {
|
void AudioPlaySystem::step(void) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,12 @@
|
||||||
|
|
||||||
#ifdef HAS_SND
|
#ifdef HAS_SND
|
||||||
|
|
||||||
|
#include "platform_config.h"
|
||||||
|
|
||||||
|
//#undef HAS_T4_VGA // To force using Audio library!!
|
||||||
|
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
|
|
||||||
#include <Audio.h>
|
#include <Audio.h>
|
||||||
|
|
||||||
class AudioPlaySystem : public AudioStream
|
class AudioPlaySystem : public AudioStream
|
||||||
|
|
@ -21,8 +27,28 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void update(void);
|
virtual void update(void);
|
||||||
|
static void snd_Mixer(short * stream, int len );
|
||||||
|
};
|
||||||
|
|
||||||
|
#else
|
||||||
|
class AudioPlaySystem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AudioPlaySystem(void) { };
|
||||||
|
void begin(void);
|
||||||
|
void setSampleParameters(float clockfreq, float samplerate);
|
||||||
|
void reset(void);
|
||||||
|
void start(void);
|
||||||
|
void stop(void);
|
||||||
|
bool isPlaying(void);
|
||||||
|
void sound(int C, int F, int V);
|
||||||
|
void buzz(int size, int val);
|
||||||
|
void step(void);
|
||||||
|
static void snd_Mixer(short * stream, int len );
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -201,7 +201,7 @@ int coc_Start(char * Cartridge)
|
||||||
snd_Reset();
|
snd_Reset();
|
||||||
#endif
|
#endif
|
||||||
#ifdef SOUND_PRESENT
|
#ifdef SOUND_PRESENT
|
||||||
snd_Open(22050, 2, 4096/*16384*/,(void*)snd_Mixer);
|
snd_Open(44100/*22050*/, 2, 4096/*16384*/,(void*)snd_Mixer);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Initialize VDP registers */
|
/* Initialize VDP registers */
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
//#define OLD_LAYOUT 1
|
//#define OLD_LAYOUT 1
|
||||||
#define HAS_T4_VGA 1
|
#define HAS_T4_VGA 1
|
||||||
|
|
||||||
//#define HAS_SND 1
|
#define HAS_SND 1
|
||||||
//#define INVX 1
|
//#define INVX 1
|
||||||
//#define INVY 1
|
//#define INVY 1
|
||||||
#define HAS_USBKEY 1
|
#define HAS_USBKEY 1
|
||||||
|
|
|
||||||
|
|
@ -270,35 +270,33 @@ void loop(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAS_SND
|
#ifdef HAS_SND
|
||||||
|
|
||||||
#include <Audio.h>
|
|
||||||
#include "AudioPlaySystem.h"
|
#include "AudioPlaySystem.h"
|
||||||
|
|
||||||
AudioPlaySystem mymixer;
|
AudioPlaySystem mymixer;
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
|
#include <Audio.h>
|
||||||
#if defined(__IMXRT1052__) || defined(__IMXRT1062__)
|
#if defined(__IMXRT1052__) || defined(__IMXRT1062__)
|
||||||
#ifdef HAS_T4_VGA
|
//AudioOutputMQS mqs;
|
||||||
|
//AudioConnection patchCord9(mymixer, 0, mqs, 1);
|
||||||
AudioOutputI2S i2s1;
|
AudioOutputI2S i2s1;
|
||||||
AudioConnection patchCord8(mymixer, 0, i2s1, 0);
|
AudioConnection patchCord8(mymixer, 0, i2s1, 0);
|
||||||
AudioConnection patchCord9(mymixer, 0, i2s1, 1);
|
AudioConnection patchCord9(mymixer, 0, i2s1, 1);
|
||||||
AudioControlSGTL5000 sgtl5000_1;
|
AudioControlSGTL5000 sgtl5000_1;
|
||||||
#else
|
#else
|
||||||
AudioOutputMQS mqs;
|
|
||||||
AudioConnection patchCord9(mymixer, 0, mqs, 1);
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
AudioOutputAnalog dac1;
|
AudioOutputAnalog dac1;
|
||||||
AudioConnection patchCord1(mymixer, dac1);
|
AudioConnection patchCord1(mymixer, dac1);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
void emu_sndInit() {
|
void emu_sndInit() {
|
||||||
Serial.println("sound init");
|
Serial.println("sound init");
|
||||||
#ifdef HAS_T4_VGA
|
#ifdef HAS_T4_VGA
|
||||||
sgtl5000_1.enable();
|
tft.begin_audio(256, mymixer.snd_Mixer);
|
||||||
sgtl5000_1.volume(0.6);
|
// sgtl5000_1.enable();
|
||||||
|
// sgtl5000_1.volume(0.6);
|
||||||
#endif
|
#endif
|
||||||
AudioMemory(16);
|
|
||||||
mymixer.start();
|
mymixer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,9 +68,7 @@ static Channel chan[6] = {
|
||||||
volatile bool playing = false;
|
volatile bool playing = false;
|
||||||
|
|
||||||
|
|
||||||
|
static void snd_Reset(void)
|
||||||
|
|
||||||
PROGMEM static void snd_Reset(void)
|
|
||||||
{
|
{
|
||||||
#ifndef CUSTOM_SND
|
#ifndef CUSTOM_SND
|
||||||
chan[0].vol = 0;
|
chan[0].vol = 0;
|
||||||
|
|
@ -90,10 +88,13 @@ PROGMEM static void snd_Reset(void)
|
||||||
|
|
||||||
|
|
||||||
#ifdef CUSTOM_SND
|
#ifdef CUSTOM_SND
|
||||||
|
//extern "C" {
|
||||||
void SND_Process(void *sndbuffer, int sndn);
|
void SND_Process(void *sndbuffer, int sndn);
|
||||||
|
//}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PROGMEM static void snd_Mixer(short * stream, int len )
|
|
||||||
|
FASTRUN void AudioPlaySystem::snd_Mixer(short * stream, int len )
|
||||||
{
|
{
|
||||||
if (playing)
|
if (playing)
|
||||||
{
|
{
|
||||||
|
|
@ -103,7 +104,6 @@ PROGMEM static void snd_Mixer(short * stream, int len )
|
||||||
int i;
|
int i;
|
||||||
long s;
|
long s;
|
||||||
len = len >> 1;
|
len = len >> 1;
|
||||||
|
|
||||||
short v0=chan[0].vol;
|
short v0=chan[0].vol;
|
||||||
short v1=chan[1].vol;
|
short v1=chan[1].vol;
|
||||||
short v2=chan[2].vol;
|
short v2=chan[2].vol;
|
||||||
|
|
@ -131,40 +131,41 @@ PROGMEM static void snd_Mixer(short * stream, int len )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::begin(void)
|
void AudioPlaySystem::begin(void)
|
||||||
{
|
{
|
||||||
//emu_printf("AudioPlaySystem constructor");
|
|
||||||
this->reset();
|
this->reset();
|
||||||
setSampleParameters(CLOCKFREQ, SAMPLERATE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::start(void)
|
void AudioPlaySystem::start(void)
|
||||||
{
|
{
|
||||||
//emu_printf("allocating sound buf");
|
#ifndef HAS_T4_VGA
|
||||||
|
AudioMemory(16);
|
||||||
|
#endif
|
||||||
playing = true;
|
playing = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) {
|
void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) {
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::reset(void)
|
void AudioPlaySystem::reset(void)
|
||||||
{
|
{
|
||||||
snd_Reset();
|
snd_Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::stop(void)
|
void AudioPlaySystem::stop(void)
|
||||||
{
|
{
|
||||||
//__disable_irq();
|
//__disable_irq();
|
||||||
playing = false;
|
playing = false;
|
||||||
//__enable_irq();
|
//__enable_irq();
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM bool AudioPlaySystem::isPlaying(void)
|
bool AudioPlaySystem::isPlaying(void)
|
||||||
{
|
{
|
||||||
return playing;
|
return playing;
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::update(void) {
|
#ifndef HAS_T4_VGA
|
||||||
|
void AudioPlaySystem::update(void) {
|
||||||
audio_block_t *block;
|
audio_block_t *block;
|
||||||
|
|
||||||
// only update if we're playing
|
// only update if we're playing
|
||||||
|
|
@ -180,8 +181,9 @@ PROGMEM void AudioPlaySystem::update(void) {
|
||||||
transmit(block);
|
transmit(block);
|
||||||
release(block);
|
release(block);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::sound(int C, int F, int V) {
|
void AudioPlaySystem::sound(int C, int F, int V) {
|
||||||
#ifndef CUSTOM_SND
|
#ifndef CUSTOM_SND
|
||||||
if (C < 6) {
|
if (C < 6) {
|
||||||
chan[C].vol = V;
|
chan[C].vol = V;
|
||||||
|
|
@ -190,7 +192,6 @@ PROGMEM void AudioPlaySystem::sound(int C, int F, int V) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::step(void) {
|
void AudioPlaySystem::step(void) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,12 @@
|
||||||
|
|
||||||
#ifdef HAS_SND
|
#ifdef HAS_SND
|
||||||
|
|
||||||
|
#include "platform_config.h"
|
||||||
|
|
||||||
|
#undef HAS_T4_VGA // To force using Audio library!!
|
||||||
|
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
|
|
||||||
#include <Audio.h>
|
#include <Audio.h>
|
||||||
|
|
||||||
class AudioPlaySystem : public AudioStream
|
class AudioPlaySystem : public AudioStream
|
||||||
|
|
@ -21,8 +27,28 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void update(void);
|
virtual void update(void);
|
||||||
|
static void snd_Mixer(short * stream, int len );
|
||||||
|
};
|
||||||
|
|
||||||
|
#else
|
||||||
|
class AudioPlaySystem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AudioPlaySystem(void) { };
|
||||||
|
void begin(void);
|
||||||
|
void setSampleParameters(float clockfreq, float samplerate);
|
||||||
|
void reset(void);
|
||||||
|
void start(void);
|
||||||
|
void stop(void);
|
||||||
|
bool isPlaying(void);
|
||||||
|
void sound(int C, int F, int V);
|
||||||
|
void buzz(int size, int val);
|
||||||
|
void step(void);
|
||||||
|
static void snd_Mixer(short * stream, int len );
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
#define HAS_T41 1
|
#define HAS_T41 1
|
||||||
#define HAS_T4_VGA 1
|
#define HAS_T4_VGA 1
|
||||||
|
|
||||||
//#define HAS_SND 1
|
#define HAS_SND 1
|
||||||
//#define INVX 1
|
//#define INVX 1
|
||||||
//#define INVY 1
|
//#define INVY 1
|
||||||
#define HAS_USBKEY 1
|
#define HAS_USBKEY 1
|
||||||
|
|
|
||||||
|
|
@ -210,6 +210,7 @@ void setup() {
|
||||||
myTimer.begin(vblCount, 20000); //to run every 20ms
|
myTimer.begin(vblCount, 20000); //to run every 20ms
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ****************************************************
|
// ****************************************************
|
||||||
// the loop() method runs continuously
|
// the loop() method runs continuously
|
||||||
// ****************************************************
|
// ****************************************************
|
||||||
|
|
@ -267,36 +268,33 @@ void loop(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAS_SND
|
#ifdef HAS_SND
|
||||||
|
|
||||||
#include <Audio.h>
|
|
||||||
#include "AudioPlaySystem.h"
|
#include "AudioPlaySystem.h"
|
||||||
|
|
||||||
AudioPlaySystem mymixer;
|
AudioPlaySystem mymixer;
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
|
#include <Audio.h>
|
||||||
#if defined(__IMXRT1052__) || defined(__IMXRT1062__)
|
#if defined(__IMXRT1052__) || defined(__IMXRT1062__)
|
||||||
#ifdef HAS_T4_VGA
|
//AudioOutputMQS mqs;
|
||||||
|
//AudioConnection patchCord9(mymixer, 0, mqs, 1);
|
||||||
AudioOutputI2S i2s1;
|
AudioOutputI2S i2s1;
|
||||||
AudioConnection patchCord8(mymixer, 0, i2s1, 0);
|
AudioConnection patchCord8(mymixer, 0, i2s1, 0);
|
||||||
AudioConnection patchCord9(mymixer, 0, i2s1, 1);
|
AudioConnection patchCord9(mymixer, 0, i2s1, 1);
|
||||||
AudioControlSGTL5000 sgtl5000_1;
|
AudioControlSGTL5000 sgtl5000_1;
|
||||||
#else
|
#else
|
||||||
AudioOutputMQS mqs;
|
|
||||||
AudioConnection patchCord9(mymixer, 0, mqs, 1);
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
AudioOutputAnalog dac1;
|
AudioOutputAnalog dac1;
|
||||||
AudioConnection patchCord1(mymixer, dac1);
|
AudioConnection patchCord1(mymixer, dac1);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
void emu_sndInit() {
|
void emu_sndInit() {
|
||||||
Serial.println("sound init");
|
Serial.println("sound init");
|
||||||
#ifdef HAS_T4_VGA
|
#ifdef HAS_T4_VGA
|
||||||
sgtl5000_1.enable();
|
tft.begin_audio(256, mymixer.snd_Mixer);
|
||||||
sgtl5000_1.volume(0.6);
|
// sgtl5000_1.enable();
|
||||||
|
// sgtl5000_1.volume(0.6);
|
||||||
#endif
|
#endif
|
||||||
AudioMemory(16);
|
|
||||||
mymixer.start();
|
mymixer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,9 +68,7 @@ static Channel chan[6] = {
|
||||||
volatile bool playing = false;
|
volatile bool playing = false;
|
||||||
|
|
||||||
|
|
||||||
|
static void snd_Reset(void)
|
||||||
|
|
||||||
PROGMEM static void snd_Reset(void)
|
|
||||||
{
|
{
|
||||||
#ifndef CUSTOM_SND
|
#ifndef CUSTOM_SND
|
||||||
chan[0].vol = 0;
|
chan[0].vol = 0;
|
||||||
|
|
@ -90,10 +88,13 @@ PROGMEM static void snd_Reset(void)
|
||||||
|
|
||||||
|
|
||||||
#ifdef CUSTOM_SND
|
#ifdef CUSTOM_SND
|
||||||
|
//extern "C" {
|
||||||
void SND_Process(void *sndbuffer, int sndn);
|
void SND_Process(void *sndbuffer, int sndn);
|
||||||
|
//}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PROGMEM static void snd_Mixer(short * stream, int len )
|
|
||||||
|
FASTRUN void AudioPlaySystem::snd_Mixer(short * stream, int len )
|
||||||
{
|
{
|
||||||
if (playing)
|
if (playing)
|
||||||
{
|
{
|
||||||
|
|
@ -103,7 +104,6 @@ PROGMEM static void snd_Mixer(short * stream, int len )
|
||||||
int i;
|
int i;
|
||||||
long s;
|
long s;
|
||||||
len = len >> 1;
|
len = len >> 1;
|
||||||
|
|
||||||
short v0=chan[0].vol;
|
short v0=chan[0].vol;
|
||||||
short v1=chan[1].vol;
|
short v1=chan[1].vol;
|
||||||
short v2=chan[2].vol;
|
short v2=chan[2].vol;
|
||||||
|
|
@ -131,40 +131,41 @@ PROGMEM static void snd_Mixer(short * stream, int len )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::begin(void)
|
void AudioPlaySystem::begin(void)
|
||||||
{
|
{
|
||||||
//emu_printf("AudioPlaySystem constructor");
|
|
||||||
this->reset();
|
this->reset();
|
||||||
setSampleParameters(CLOCKFREQ, SAMPLERATE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::start(void)
|
void AudioPlaySystem::start(void)
|
||||||
{
|
{
|
||||||
//emu_printf("allocating sound buf");
|
#ifndef HAS_T4_VGA
|
||||||
|
AudioMemory(16);
|
||||||
|
#endif
|
||||||
playing = true;
|
playing = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) {
|
void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) {
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::reset(void)
|
void AudioPlaySystem::reset(void)
|
||||||
{
|
{
|
||||||
snd_Reset();
|
snd_Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::stop(void)
|
void AudioPlaySystem::stop(void)
|
||||||
{
|
{
|
||||||
//__disable_irq();
|
//__disable_irq();
|
||||||
playing = false;
|
playing = false;
|
||||||
//__enable_irq();
|
//__enable_irq();
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM bool AudioPlaySystem::isPlaying(void)
|
bool AudioPlaySystem::isPlaying(void)
|
||||||
{
|
{
|
||||||
return playing;
|
return playing;
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::update(void) {
|
#ifndef HAS_T4_VGA
|
||||||
|
void AudioPlaySystem::update(void) {
|
||||||
audio_block_t *block;
|
audio_block_t *block;
|
||||||
|
|
||||||
// only update if we're playing
|
// only update if we're playing
|
||||||
|
|
@ -180,8 +181,9 @@ PROGMEM void AudioPlaySystem::update(void) {
|
||||||
transmit(block);
|
transmit(block);
|
||||||
release(block);
|
release(block);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::sound(int C, int F, int V) {
|
void AudioPlaySystem::sound(int C, int F, int V) {
|
||||||
#ifndef CUSTOM_SND
|
#ifndef CUSTOM_SND
|
||||||
if (C < 6) {
|
if (C < 6) {
|
||||||
chan[C].vol = V;
|
chan[C].vol = V;
|
||||||
|
|
@ -190,7 +192,6 @@ PROGMEM void AudioPlaySystem::sound(int C, int F, int V) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::step(void) {
|
void AudioPlaySystem::step(void) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,12 @@
|
||||||
|
|
||||||
#ifdef HAS_SND
|
#ifdef HAS_SND
|
||||||
|
|
||||||
|
#include "platform_config.h"
|
||||||
|
|
||||||
|
//#undef HAS_T4_VGA // To force using Audio library!!
|
||||||
|
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
|
|
||||||
#include <Audio.h>
|
#include <Audio.h>
|
||||||
|
|
||||||
class AudioPlaySystem : public AudioStream
|
class AudioPlaySystem : public AudioStream
|
||||||
|
|
@ -21,8 +27,28 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void update(void);
|
virtual void update(void);
|
||||||
|
static void snd_Mixer(short * stream, int len );
|
||||||
|
};
|
||||||
|
|
||||||
|
#else
|
||||||
|
class AudioPlaySystem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AudioPlaySystem(void) { };
|
||||||
|
void begin(void);
|
||||||
|
void setSampleParameters(float clockfreq, float samplerate);
|
||||||
|
void reset(void);
|
||||||
|
void start(void);
|
||||||
|
void stop(void);
|
||||||
|
bool isPlaying(void);
|
||||||
|
void sound(int C, int F, int V);
|
||||||
|
void buzz(int size, int val);
|
||||||
|
void step(void);
|
||||||
|
static void snd_Mixer(short * stream, int len );
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -277,31 +277,33 @@ void loop(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAS_SND
|
#ifdef HAS_SND
|
||||||
|
|
||||||
#include <Audio.h>
|
|
||||||
#include "AudioPlaySystem.h"
|
#include "AudioPlaySystem.h"
|
||||||
|
|
||||||
AudioPlaySystem mymixer;
|
AudioPlaySystem mymixer;
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
|
#include <Audio.h>
|
||||||
#if defined(__IMXRT1052__) || defined(__IMXRT1062__)
|
#if defined(__IMXRT1052__) || defined(__IMXRT1062__)
|
||||||
#ifdef HAS_T4_VGA
|
//AudioOutputMQS mqs;
|
||||||
|
//AudioConnection patchCord9(mymixer, 0, mqs, 1);
|
||||||
AudioOutputI2S i2s1;
|
AudioOutputI2S i2s1;
|
||||||
AudioConnection patchCord8(mymixer, 0, i2s1, 0);
|
AudioConnection patchCord8(mymixer, 0, i2s1, 0);
|
||||||
AudioConnection patchCord9(mymixer, 0, i2s1, 1);
|
AudioConnection patchCord9(mymixer, 0, i2s1, 1);
|
||||||
AudioControlSGTL5000 sgtl5000_1;
|
AudioControlSGTL5000 sgtl5000_1;
|
||||||
#else
|
#else
|
||||||
AudioOutputMQS mqs;
|
|
||||||
AudioConnection patchCord9(mymixer, 0, mqs, 1);
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
AudioOutputAnalog dac1;
|
AudioOutputAnalog dac1;
|
||||||
AudioConnection patchCord1(mymixer, dac1);
|
AudioConnection patchCord1(mymixer, dac1);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
void emu_sndInit() {
|
void emu_sndInit() {
|
||||||
Serial.println("sound init");
|
Serial.println("sound init");
|
||||||
AudioMemory(16);
|
#ifdef HAS_T4_VGA
|
||||||
|
tft.begin_audio(256, mymixer.snd_Mixer);
|
||||||
|
// sgtl5000_1.enable();
|
||||||
|
// sgtl5000_1.volume(0.6);
|
||||||
|
#endif
|
||||||
mymixer.start();
|
mymixer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,9 +68,7 @@ static Channel chan[6] = {
|
||||||
volatile bool playing = false;
|
volatile bool playing = false;
|
||||||
|
|
||||||
|
|
||||||
|
static void snd_Reset(void)
|
||||||
|
|
||||||
PROGMEM static void snd_Reset(void)
|
|
||||||
{
|
{
|
||||||
#ifndef CUSTOM_SND
|
#ifndef CUSTOM_SND
|
||||||
chan[0].vol = 0;
|
chan[0].vol = 0;
|
||||||
|
|
@ -95,7 +93,8 @@ void SND_Process(void *sndbuffer, int sndn);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PROGMEM static void snd_Mixer(short * stream, int len )
|
|
||||||
|
FASTRUN void AudioPlaySystem::snd_Mixer(short * stream, int len )
|
||||||
{
|
{
|
||||||
if (playing)
|
if (playing)
|
||||||
{
|
{
|
||||||
|
|
@ -105,7 +104,6 @@ PROGMEM static void snd_Mixer(short * stream, int len )
|
||||||
int i;
|
int i;
|
||||||
long s;
|
long s;
|
||||||
len = len >> 1;
|
len = len >> 1;
|
||||||
|
|
||||||
short v0=chan[0].vol;
|
short v0=chan[0].vol;
|
||||||
short v1=chan[1].vol;
|
short v1=chan[1].vol;
|
||||||
short v2=chan[2].vol;
|
short v2=chan[2].vol;
|
||||||
|
|
@ -133,40 +131,41 @@ PROGMEM static void snd_Mixer(short * stream, int len )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::begin(void)
|
void AudioPlaySystem::begin(void)
|
||||||
{
|
{
|
||||||
//emu_printf("AudioPlaySystem constructor");
|
|
||||||
this->reset();
|
this->reset();
|
||||||
setSampleParameters(CLOCKFREQ, SAMPLERATE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::start(void)
|
void AudioPlaySystem::start(void)
|
||||||
{
|
{
|
||||||
//emu_printf("allocating sound buf");
|
#ifndef HAS_T4_VGA
|
||||||
|
AudioMemory(16);
|
||||||
|
#endif
|
||||||
playing = true;
|
playing = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) {
|
void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) {
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::reset(void)
|
void AudioPlaySystem::reset(void)
|
||||||
{
|
{
|
||||||
snd_Reset();
|
snd_Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::stop(void)
|
void AudioPlaySystem::stop(void)
|
||||||
{
|
{
|
||||||
//__disable_irq();
|
//__disable_irq();
|
||||||
playing = false;
|
playing = false;
|
||||||
//__enable_irq();
|
//__enable_irq();
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM bool AudioPlaySystem::isPlaying(void)
|
bool AudioPlaySystem::isPlaying(void)
|
||||||
{
|
{
|
||||||
return playing;
|
return playing;
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::update(void) {
|
#ifndef HAS_T4_VGA
|
||||||
|
void AudioPlaySystem::update(void) {
|
||||||
audio_block_t *block;
|
audio_block_t *block;
|
||||||
|
|
||||||
// only update if we're playing
|
// only update if we're playing
|
||||||
|
|
@ -182,8 +181,9 @@ PROGMEM void AudioPlaySystem::update(void) {
|
||||||
transmit(block);
|
transmit(block);
|
||||||
release(block);
|
release(block);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::sound(int C, int F, int V) {
|
void AudioPlaySystem::sound(int C, int F, int V) {
|
||||||
#ifndef CUSTOM_SND
|
#ifndef CUSTOM_SND
|
||||||
if (C < 6) {
|
if (C < 6) {
|
||||||
chan[C].vol = V;
|
chan[C].vol = V;
|
||||||
|
|
@ -192,7 +192,6 @@ PROGMEM void AudioPlaySystem::sound(int C, int F, int V) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::step(void) {
|
void AudioPlaySystem::step(void) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,12 @@
|
||||||
|
|
||||||
#ifdef HAS_SND
|
#ifdef HAS_SND
|
||||||
|
|
||||||
|
#include "platform_config.h"
|
||||||
|
|
||||||
|
#undef HAS_T4_VGA // To force using Audio library!!
|
||||||
|
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
|
|
||||||
#include <Audio.h>
|
#include <Audio.h>
|
||||||
|
|
||||||
class AudioPlaySystem : public AudioStream
|
class AudioPlaySystem : public AudioStream
|
||||||
|
|
@ -21,8 +27,28 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void update(void);
|
virtual void update(void);
|
||||||
|
static void snd_Mixer(short * stream, int len );
|
||||||
|
};
|
||||||
|
|
||||||
|
#else
|
||||||
|
class AudioPlaySystem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AudioPlaySystem(void) { };
|
||||||
|
void begin(void);
|
||||||
|
void setSampleParameters(float clockfreq, float samplerate);
|
||||||
|
void reset(void);
|
||||||
|
void start(void);
|
||||||
|
void stop(void);
|
||||||
|
bool isPlaying(void);
|
||||||
|
void sound(int C, int F, int V);
|
||||||
|
void buzz(int size, int val);
|
||||||
|
void step(void);
|
||||||
|
static void snd_Mixer(short * stream, int len );
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -207,7 +207,7 @@ void setup() {
|
||||||
|
|
||||||
#ifdef HAS_T4_VGA
|
#ifdef HAS_T4_VGA
|
||||||
tft.begin(VGA_MODE_320x240);
|
tft.begin(VGA_MODE_320x240);
|
||||||
NVIC_SET_PRIORITY(IRQ_QTIMER3, 0);
|
//NVIC_SET_PRIORITY(IRQ_QTIMER3, 0);
|
||||||
#else
|
#else
|
||||||
tft.begin();
|
tft.begin();
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -282,28 +282,31 @@ void loop(void)
|
||||||
|
|
||||||
#ifdef HAS_SND
|
#ifdef HAS_SND
|
||||||
|
|
||||||
#include <Audio.h>
|
|
||||||
#include "AudioPlaySystem.h"
|
#include "AudioPlaySystem.h"
|
||||||
|
|
||||||
AudioPlaySystem mymixer;
|
AudioPlaySystem mymixer;
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
|
#include <Audio.h>
|
||||||
#if defined(__IMXRT1052__) || defined(__IMXRT1062__)
|
#if defined(__IMXRT1052__) || defined(__IMXRT1062__)
|
||||||
#ifdef HAS_T4_VGA
|
//AudioOutputMQS mqs;
|
||||||
|
//AudioConnection patchCord9(mymixer, 0, mqs, 1);
|
||||||
AudioOutputI2S i2s1;
|
AudioOutputI2S i2s1;
|
||||||
AudioConnection patchCord8(mymixer, 0, i2s1, 0);
|
AudioConnection patchCord8(mymixer, 0, i2s1, 0);
|
||||||
AudioConnection patchCord9(mymixer, 0, i2s1, 1);
|
AudioConnection patchCord9(mymixer, 0, i2s1, 1);
|
||||||
AudioControlSGTL5000 sgtl5000_1;
|
AudioControlSGTL5000 sgtl5000_1;
|
||||||
#else
|
#else
|
||||||
AudioOutputMQS mqs;
|
|
||||||
AudioConnection patchCord9(mymixer, 0, mqs, 1);
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
AudioOutputAnalog dac1;
|
AudioOutputAnalog dac1;
|
||||||
AudioConnection patchCord1(mymixer, dac1);
|
AudioConnection patchCord1(mymixer, dac1);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
void emu_sndInit() {
|
void emu_sndInit() {
|
||||||
Serial.println("sound init");
|
Serial.println("sound init");
|
||||||
AudioMemory(16);
|
#ifdef HAS_T4_VGA
|
||||||
|
tft.begin_audio(256, mymixer.snd_Mixer);
|
||||||
|
// sgtl5000_1.enable();
|
||||||
|
// sgtl5000_1.volume(0.6);
|
||||||
|
#endif
|
||||||
mymixer.start();
|
mymixer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,8 +68,6 @@ static Channel chan[6] = {
|
||||||
volatile bool playing = false;
|
volatile bool playing = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void snd_Reset(void)
|
static void snd_Reset(void)
|
||||||
{
|
{
|
||||||
#ifndef CUSTOM_SND
|
#ifndef CUSTOM_SND
|
||||||
|
|
@ -95,7 +93,8 @@ void SND_Process(void *sndbuffer, int sndn);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void snd_Mixer(short * stream, int len )
|
|
||||||
|
FASTRUN void AudioPlaySystem::snd_Mixer(short * stream, int len )
|
||||||
{
|
{
|
||||||
if (playing)
|
if (playing)
|
||||||
{
|
{
|
||||||
|
|
@ -105,7 +104,6 @@ static void snd_Mixer(short * stream, int len )
|
||||||
int i;
|
int i;
|
||||||
long s;
|
long s;
|
||||||
len = len >> 1;
|
len = len >> 1;
|
||||||
|
|
||||||
short v0=chan[0].vol;
|
short v0=chan[0].vol;
|
||||||
short v1=chan[1].vol;
|
short v1=chan[1].vol;
|
||||||
short v2=chan[2].vol;
|
short v2=chan[2].vol;
|
||||||
|
|
@ -135,14 +133,14 @@ static void snd_Mixer(short * stream, int len )
|
||||||
|
|
||||||
void AudioPlaySystem::begin(void)
|
void AudioPlaySystem::begin(void)
|
||||||
{
|
{
|
||||||
//emu_printf("AudioPlaySystem constructor");
|
|
||||||
this->reset();
|
this->reset();
|
||||||
//setSampleParameters(CLOCKFREQ, SAMPLERATE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioPlaySystem::start(void)
|
void AudioPlaySystem::start(void)
|
||||||
{
|
{
|
||||||
//emu_printf("allocating sound buf");
|
#ifndef HAS_T4_VGA
|
||||||
|
AudioMemory(16);
|
||||||
|
#endif
|
||||||
playing = true;
|
playing = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -166,6 +164,7 @@ bool AudioPlaySystem::isPlaying(void)
|
||||||
return playing;
|
return playing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
void AudioPlaySystem::update(void) {
|
void AudioPlaySystem::update(void) {
|
||||||
audio_block_t *block;
|
audio_block_t *block;
|
||||||
|
|
||||||
|
|
@ -182,6 +181,7 @@ void AudioPlaySystem::update(void) {
|
||||||
transmit(block);
|
transmit(block);
|
||||||
release(block);
|
release(block);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void AudioPlaySystem::sound(int C, int F, int V) {
|
void AudioPlaySystem::sound(int C, int F, int V) {
|
||||||
#ifndef CUSTOM_SND
|
#ifndef CUSTOM_SND
|
||||||
|
|
@ -195,4 +195,3 @@ void AudioPlaySystem::sound(int C, int F, int V) {
|
||||||
void AudioPlaySystem::step(void) {
|
void AudioPlaySystem::step(void) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,12 @@
|
||||||
|
|
||||||
#ifdef HAS_SND
|
#ifdef HAS_SND
|
||||||
|
|
||||||
|
#include "platform_config.h"
|
||||||
|
|
||||||
|
//#undef HAS_T4_VGA // To force using Audio library!!
|
||||||
|
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
|
|
||||||
#include <Audio.h>
|
#include <Audio.h>
|
||||||
|
|
||||||
class AudioPlaySystem : public AudioStream
|
class AudioPlaySystem : public AudioStream
|
||||||
|
|
@ -21,8 +27,28 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void update(void);
|
virtual void update(void);
|
||||||
|
static void snd_Mixer(short * stream, int len );
|
||||||
|
};
|
||||||
|
|
||||||
|
#else
|
||||||
|
class AudioPlaySystem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AudioPlaySystem(void) { };
|
||||||
|
void begin(void);
|
||||||
|
void setSampleParameters(float clockfreq, float samplerate);
|
||||||
|
void reset(void);
|
||||||
|
void start(void);
|
||||||
|
void stop(void);
|
||||||
|
bool isPlaying(void);
|
||||||
|
void sound(int C, int F, int V);
|
||||||
|
void buzz(int size, int val);
|
||||||
|
void step(void);
|
||||||
|
static void snd_Mixer(short * stream, int len );
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
//#define OLD_LAYOUT 1
|
//#define OLD_LAYOUT 1
|
||||||
#define HAS_T4_VGA 1
|
#define HAS_T4_VGA 1
|
||||||
|
|
||||||
//#define HAS_SND 1
|
#define HAS_SND 1
|
||||||
//#define INVX 1
|
//#define INVX 1
|
||||||
//#define INVY 1
|
//#define INVY 1
|
||||||
#define HAS_USBKEY 1
|
#define HAS_USBKEY 1
|
||||||
|
|
|
||||||
|
|
@ -274,32 +274,31 @@ void loop(void)
|
||||||
|
|
||||||
#ifdef HAS_SND
|
#ifdef HAS_SND
|
||||||
|
|
||||||
#include <Audio.h>
|
|
||||||
#include "AudioPlaySystem.h"
|
#include "AudioPlaySystem.h"
|
||||||
|
|
||||||
AudioPlaySystem mymixer;
|
AudioPlaySystem mymixer;
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
|
#include <Audio.h>
|
||||||
#if defined(__IMXRT1052__) || defined(__IMXRT1062__)
|
#if defined(__IMXRT1052__) || defined(__IMXRT1062__)
|
||||||
#ifdef HAS_T4_VGA
|
//AudioOutputMQS mqs;
|
||||||
|
//AudioConnection patchCord9(mymixer, 0, mqs, 1);
|
||||||
AudioOutputI2S i2s1;
|
AudioOutputI2S i2s1;
|
||||||
AudioConnection patchCord8(mymixer, 0, i2s1, 0);
|
AudioConnection patchCord8(mymixer, 0, i2s1, 0);
|
||||||
AudioConnection patchCord9(mymixer, 0, i2s1, 1);
|
AudioConnection patchCord9(mymixer, 0, i2s1, 1);
|
||||||
AudioControlSGTL5000 sgtl5000_1;
|
AudioControlSGTL5000 sgtl5000_1;
|
||||||
#else
|
#else
|
||||||
AudioOutputMQS mqs;
|
|
||||||
AudioConnection patchCord9(mymixer, 0, mqs, 1);
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
AudioOutputAnalog dac1;
|
AudioOutputAnalog dac1;
|
||||||
AudioConnection patchCord1(mymixer, dac1);
|
AudioConnection patchCord1(mymixer, dac1);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
void emu_sndInit() {
|
void emu_sndInit() {
|
||||||
Serial.println("sound init");
|
Serial.println("sound init");
|
||||||
#ifdef HAS_T4_VGA
|
#ifdef HAS_T4_VGA
|
||||||
sgtl5000_1.enable();
|
tft.begin_audio(256, mymixer.snd_Mixer);
|
||||||
sgtl5000_1.volume(0.6);
|
// sgtl5000_1.enable();
|
||||||
|
// sgtl5000_1.volume(0.6);
|
||||||
#endif
|
#endif
|
||||||
AudioMemory(16);
|
|
||||||
mymixer.start();
|
mymixer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,8 +68,6 @@ static Channel chan[6] = {
|
||||||
volatile bool playing = false;
|
volatile bool playing = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void snd_Reset(void)
|
static void snd_Reset(void)
|
||||||
{
|
{
|
||||||
#ifndef CUSTOM_SND
|
#ifndef CUSTOM_SND
|
||||||
|
|
@ -90,12 +88,13 @@ static void snd_Reset(void)
|
||||||
|
|
||||||
|
|
||||||
#ifdef CUSTOM_SND
|
#ifdef CUSTOM_SND
|
||||||
extern "C" {
|
//extern "C" {
|
||||||
void SND_Process(void *sndbuffer, int sndn);
|
void SND_Process(void *sndbuffer, int sndn);
|
||||||
}
|
//}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void snd_Mixer(short * stream, int len )
|
|
||||||
|
FASTRUN void AudioPlaySystem::snd_Mixer(short * stream, int len )
|
||||||
{
|
{
|
||||||
if (playing)
|
if (playing)
|
||||||
{
|
{
|
||||||
|
|
@ -105,7 +104,6 @@ static void snd_Mixer(short * stream, int len )
|
||||||
int i;
|
int i;
|
||||||
long s;
|
long s;
|
||||||
len = len >> 1;
|
len = len >> 1;
|
||||||
|
|
||||||
short v0=chan[0].vol;
|
short v0=chan[0].vol;
|
||||||
short v1=chan[1].vol;
|
short v1=chan[1].vol;
|
||||||
short v2=chan[2].vol;
|
short v2=chan[2].vol;
|
||||||
|
|
@ -135,14 +133,14 @@ static void snd_Mixer(short * stream, int len )
|
||||||
|
|
||||||
void AudioPlaySystem::begin(void)
|
void AudioPlaySystem::begin(void)
|
||||||
{
|
{
|
||||||
//emu_printf("AudioPlaySystem constructor");
|
|
||||||
this->reset();
|
this->reset();
|
||||||
//setSampleParameters(CLOCKFREQ, SAMPLERATE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioPlaySystem::start(void)
|
void AudioPlaySystem::start(void)
|
||||||
{
|
{
|
||||||
//emu_printf("allocating sound buf");
|
#ifndef HAS_T4_VGA
|
||||||
|
AudioMemory(16);
|
||||||
|
#endif
|
||||||
playing = true;
|
playing = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -166,6 +164,7 @@ bool AudioPlaySystem::isPlaying(void)
|
||||||
return playing;
|
return playing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
void AudioPlaySystem::update(void) {
|
void AudioPlaySystem::update(void) {
|
||||||
audio_block_t *block;
|
audio_block_t *block;
|
||||||
|
|
||||||
|
|
@ -182,6 +181,7 @@ void AudioPlaySystem::update(void) {
|
||||||
transmit(block);
|
transmit(block);
|
||||||
release(block);
|
release(block);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void AudioPlaySystem::sound(int C, int F, int V) {
|
void AudioPlaySystem::sound(int C, int F, int V) {
|
||||||
#ifndef CUSTOM_SND
|
#ifndef CUSTOM_SND
|
||||||
|
|
@ -195,4 +195,3 @@ void AudioPlaySystem::sound(int C, int F, int V) {
|
||||||
void AudioPlaySystem::step(void) {
|
void AudioPlaySystem::step(void) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,12 @@
|
||||||
|
|
||||||
#ifdef HAS_SND
|
#ifdef HAS_SND
|
||||||
|
|
||||||
|
#include "platform_config.h"
|
||||||
|
|
||||||
|
//#undef HAS_T4_VGA // To force using Audio library!!
|
||||||
|
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
|
|
||||||
#include <Audio.h>
|
#include <Audio.h>
|
||||||
|
|
||||||
class AudioPlaySystem : public AudioStream
|
class AudioPlaySystem : public AudioStream
|
||||||
|
|
@ -21,8 +27,28 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void update(void);
|
virtual void update(void);
|
||||||
|
static void snd_Mixer(short * stream, int len );
|
||||||
|
};
|
||||||
|
|
||||||
|
#else
|
||||||
|
class AudioPlaySystem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AudioPlaySystem(void) { };
|
||||||
|
void begin(void);
|
||||||
|
void setSampleParameters(float clockfreq, float samplerate);
|
||||||
|
void reset(void);
|
||||||
|
void start(void);
|
||||||
|
void stop(void);
|
||||||
|
bool isPlaying(void);
|
||||||
|
void sound(int C, int F, int V);
|
||||||
|
void buzz(int size, int val);
|
||||||
|
void step(void);
|
||||||
|
static void snd_Mixer(short * stream, int len );
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -273,32 +273,31 @@ void loop(void)
|
||||||
|
|
||||||
#ifdef HAS_SND
|
#ifdef HAS_SND
|
||||||
|
|
||||||
#include <Audio.h>
|
|
||||||
#include "AudioPlaySystem.h"
|
#include "AudioPlaySystem.h"
|
||||||
|
|
||||||
AudioPlaySystem mymixer;
|
AudioPlaySystem mymixer;
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
|
#include <Audio.h>
|
||||||
#if defined(__IMXRT1052__) || defined(__IMXRT1062__)
|
#if defined(__IMXRT1052__) || defined(__IMXRT1062__)
|
||||||
#ifdef HAS_T4_VGA
|
//AudioOutputMQS mqs;
|
||||||
|
//AudioConnection patchCord9(mymixer, 0, mqs, 1);
|
||||||
AudioOutputI2S i2s1;
|
AudioOutputI2S i2s1;
|
||||||
AudioConnection patchCord8(mymixer, 0, i2s1, 0);
|
AudioConnection patchCord8(mymixer, 0, i2s1, 0);
|
||||||
AudioConnection patchCord9(mymixer, 0, i2s1, 1);
|
AudioConnection patchCord9(mymixer, 0, i2s1, 1);
|
||||||
AudioControlSGTL5000 sgtl5000_1;
|
AudioControlSGTL5000 sgtl5000_1;
|
||||||
#else
|
#else
|
||||||
AudioOutputMQS mqs;
|
|
||||||
AudioConnection patchCord9(mymixer, 0, mqs, 1);
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
AudioOutputAnalog dac1;
|
AudioOutputAnalog dac1;
|
||||||
AudioConnection patchCord1(mymixer, dac1);
|
AudioConnection patchCord1(mymixer, dac1);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
void emu_sndInit() {
|
void emu_sndInit() {
|
||||||
Serial.println("sound init");
|
Serial.println("sound init");
|
||||||
#ifdef HAS_T4_VGA
|
#ifdef HAS_T4_VGA
|
||||||
sgtl5000_1.enable();
|
tft.begin_audio(256, mymixer.snd_Mixer);
|
||||||
sgtl5000_1.volume(0.6);
|
// sgtl5000_1.enable();
|
||||||
|
// sgtl5000_1.volume(0.6);
|
||||||
#endif
|
#endif
|
||||||
AudioMemory(16);
|
|
||||||
mymixer.start();
|
mymixer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,9 +68,7 @@ static Channel chan[6] = {
|
||||||
volatile bool playing = false;
|
volatile bool playing = false;
|
||||||
|
|
||||||
|
|
||||||
|
static void snd_Reset(void)
|
||||||
|
|
||||||
PROGMEM static void snd_Reset(void)
|
|
||||||
{
|
{
|
||||||
#ifndef CUSTOM_SND
|
#ifndef CUSTOM_SND
|
||||||
chan[0].vol = 0;
|
chan[0].vol = 0;
|
||||||
|
|
@ -90,10 +88,13 @@ PROGMEM static void snd_Reset(void)
|
||||||
|
|
||||||
|
|
||||||
#ifdef CUSTOM_SND
|
#ifdef CUSTOM_SND
|
||||||
|
//extern "C" {
|
||||||
void SND_Process(void *sndbuffer, int sndn);
|
void SND_Process(void *sndbuffer, int sndn);
|
||||||
|
//}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PROGMEM static void snd_Mixer(short * stream, int len )
|
|
||||||
|
FASTRUN void AudioPlaySystem::snd_Mixer(short * stream, int len )
|
||||||
{
|
{
|
||||||
if (playing)
|
if (playing)
|
||||||
{
|
{
|
||||||
|
|
@ -103,7 +104,6 @@ PROGMEM static void snd_Mixer(short * stream, int len )
|
||||||
int i;
|
int i;
|
||||||
long s;
|
long s;
|
||||||
len = len >> 1;
|
len = len >> 1;
|
||||||
|
|
||||||
short v0=chan[0].vol;
|
short v0=chan[0].vol;
|
||||||
short v1=chan[1].vol;
|
short v1=chan[1].vol;
|
||||||
short v2=chan[2].vol;
|
short v2=chan[2].vol;
|
||||||
|
|
@ -131,40 +131,41 @@ PROGMEM static void snd_Mixer(short * stream, int len )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::begin(void)
|
void AudioPlaySystem::begin(void)
|
||||||
{
|
{
|
||||||
//emu_printf("AudioPlaySystem constructor");
|
|
||||||
this->reset();
|
this->reset();
|
||||||
setSampleParameters(CLOCKFREQ, SAMPLERATE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::start(void)
|
void AudioPlaySystem::start(void)
|
||||||
{
|
{
|
||||||
//emu_printf("allocating sound buf");
|
#ifndef HAS_T4_VGA
|
||||||
|
AudioMemory(16);
|
||||||
|
#endif
|
||||||
playing = true;
|
playing = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) {
|
void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) {
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::reset(void)
|
void AudioPlaySystem::reset(void)
|
||||||
{
|
{
|
||||||
snd_Reset();
|
snd_Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::stop(void)
|
void AudioPlaySystem::stop(void)
|
||||||
{
|
{
|
||||||
//__disable_irq();
|
//__disable_irq();
|
||||||
playing = false;
|
playing = false;
|
||||||
//__enable_irq();
|
//__enable_irq();
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM bool AudioPlaySystem::isPlaying(void)
|
bool AudioPlaySystem::isPlaying(void)
|
||||||
{
|
{
|
||||||
return playing;
|
return playing;
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::update(void) {
|
#ifndef HAS_T4_VGA
|
||||||
|
void AudioPlaySystem::update(void) {
|
||||||
audio_block_t *block;
|
audio_block_t *block;
|
||||||
|
|
||||||
// only update if we're playing
|
// only update if we're playing
|
||||||
|
|
@ -180,8 +181,9 @@ PROGMEM void AudioPlaySystem::update(void) {
|
||||||
transmit(block);
|
transmit(block);
|
||||||
release(block);
|
release(block);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::sound(int C, int F, int V) {
|
void AudioPlaySystem::sound(int C, int F, int V) {
|
||||||
#ifndef CUSTOM_SND
|
#ifndef CUSTOM_SND
|
||||||
if (C < 6) {
|
if (C < 6) {
|
||||||
chan[C].vol = V;
|
chan[C].vol = V;
|
||||||
|
|
@ -190,7 +192,6 @@ PROGMEM void AudioPlaySystem::sound(int C, int F, int V) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::step(void) {
|
void AudioPlaySystem::step(void) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,12 @@
|
||||||
|
|
||||||
#ifdef HAS_SND
|
#ifdef HAS_SND
|
||||||
|
|
||||||
|
#include "platform_config.h"
|
||||||
|
|
||||||
|
#undef HAS_T4_VGA // To force using Audio library!!
|
||||||
|
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
|
|
||||||
#include <Audio.h>
|
#include <Audio.h>
|
||||||
|
|
||||||
class AudioPlaySystem : public AudioStream
|
class AudioPlaySystem : public AudioStream
|
||||||
|
|
@ -21,8 +27,28 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void update(void);
|
virtual void update(void);
|
||||||
|
static void snd_Mixer(short * stream, int len );
|
||||||
|
};
|
||||||
|
|
||||||
|
#else
|
||||||
|
class AudioPlaySystem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AudioPlaySystem(void) { };
|
||||||
|
void begin(void);
|
||||||
|
void setSampleParameters(float clockfreq, float samplerate);
|
||||||
|
void reset(void);
|
||||||
|
void start(void);
|
||||||
|
void stop(void);
|
||||||
|
bool isPlaying(void);
|
||||||
|
void sound(int C, int F, int V);
|
||||||
|
void buzz(int size, int val);
|
||||||
|
void step(void);
|
||||||
|
static void snd_Mixer(short * stream, int len );
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
#define HAS_T41 1
|
#define HAS_T41 1
|
||||||
#define HAS_T4_VGA 1
|
#define HAS_T4_VGA 1
|
||||||
|
|
||||||
//#define HAS_SND 1
|
#define HAS_SND 1
|
||||||
//#define INVX 1
|
//#define INVX 1
|
||||||
//#define INVY 1
|
//#define INVY 1
|
||||||
#define HAS_USBKEY 1
|
#define HAS_USBKEY 1
|
||||||
|
|
|
||||||
|
|
@ -270,32 +270,31 @@ void loop(void)
|
||||||
|
|
||||||
#ifdef HAS_SND
|
#ifdef HAS_SND
|
||||||
|
|
||||||
#include <Audio.h>
|
|
||||||
#include "AudioPlaySystem.h"
|
#include "AudioPlaySystem.h"
|
||||||
|
|
||||||
AudioPlaySystem mymixer;
|
AudioPlaySystem mymixer;
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
|
#include <Audio.h>
|
||||||
#if defined(__IMXRT1052__) || defined(__IMXRT1062__)
|
#if defined(__IMXRT1052__) || defined(__IMXRT1062__)
|
||||||
#ifdef HAS_T4_VGA
|
//AudioOutputMQS mqs;
|
||||||
|
//AudioConnection patchCord9(mymixer, 0, mqs, 1);
|
||||||
AudioOutputI2S i2s1;
|
AudioOutputI2S i2s1;
|
||||||
AudioConnection patchCord8(mymixer, 0, i2s1, 0);
|
AudioConnection patchCord8(mymixer, 0, i2s1, 0);
|
||||||
AudioConnection patchCord9(mymixer, 0, i2s1, 1);
|
AudioConnection patchCord9(mymixer, 0, i2s1, 1);
|
||||||
AudioControlSGTL5000 sgtl5000_1;
|
AudioControlSGTL5000 sgtl5000_1;
|
||||||
#else
|
#else
|
||||||
AudioOutputMQS mqs;
|
|
||||||
AudioConnection patchCord9(mymixer, 0, mqs, 1);
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
AudioOutputAnalog dac1;
|
AudioOutputAnalog dac1;
|
||||||
AudioConnection patchCord1(mymixer, dac1);
|
AudioConnection patchCord1(mymixer, dac1);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
void emu_sndInit() {
|
void emu_sndInit() {
|
||||||
Serial.println("sound init");
|
Serial.println("sound init");
|
||||||
#ifdef HAS_T4_VGA
|
#ifdef HAS_T4_VGA
|
||||||
sgtl5000_1.enable();
|
tft.begin_audio(256, mymixer.snd_Mixer);
|
||||||
sgtl5000_1.volume(0.6);
|
// sgtl5000_1.enable();
|
||||||
|
// sgtl5000_1.volume(0.6);
|
||||||
#endif
|
#endif
|
||||||
AudioMemory(16);
|
|
||||||
mymixer.start();
|
mymixer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,9 +68,7 @@ static Channel chan[6] = {
|
||||||
volatile bool playing = false;
|
volatile bool playing = false;
|
||||||
|
|
||||||
|
|
||||||
|
static void snd_Reset(void)
|
||||||
|
|
||||||
PROGMEM static void snd_Reset(void)
|
|
||||||
{
|
{
|
||||||
#ifndef CUSTOM_SND
|
#ifndef CUSTOM_SND
|
||||||
chan[0].vol = 0;
|
chan[0].vol = 0;
|
||||||
|
|
@ -90,10 +88,13 @@ PROGMEM static void snd_Reset(void)
|
||||||
|
|
||||||
|
|
||||||
#ifdef CUSTOM_SND
|
#ifdef CUSTOM_SND
|
||||||
|
//extern "C" {
|
||||||
void SND_Process(void *sndbuffer, int sndn);
|
void SND_Process(void *sndbuffer, int sndn);
|
||||||
|
//}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PROGMEM static void snd_Mixer(short * stream, int len )
|
|
||||||
|
FASTRUN void AudioPlaySystem::snd_Mixer(short * stream, int len )
|
||||||
{
|
{
|
||||||
if (playing)
|
if (playing)
|
||||||
{
|
{
|
||||||
|
|
@ -103,7 +104,6 @@ PROGMEM static void snd_Mixer(short * stream, int len )
|
||||||
int i;
|
int i;
|
||||||
long s;
|
long s;
|
||||||
len = len >> 1;
|
len = len >> 1;
|
||||||
|
|
||||||
short v0=chan[0].vol;
|
short v0=chan[0].vol;
|
||||||
short v1=chan[1].vol;
|
short v1=chan[1].vol;
|
||||||
short v2=chan[2].vol;
|
short v2=chan[2].vol;
|
||||||
|
|
@ -131,40 +131,41 @@ PROGMEM static void snd_Mixer(short * stream, int len )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::begin(void)
|
void AudioPlaySystem::begin(void)
|
||||||
{
|
{
|
||||||
//emu_printf("AudioPlaySystem constructor");
|
|
||||||
this->reset();
|
this->reset();
|
||||||
setSampleParameters(CLOCKFREQ, SAMPLERATE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::start(void)
|
void AudioPlaySystem::start(void)
|
||||||
{
|
{
|
||||||
//emu_printf("allocating sound buf");
|
#ifndef HAS_T4_VGA
|
||||||
|
AudioMemory(16);
|
||||||
|
#endif
|
||||||
playing = true;
|
playing = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) {
|
void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) {
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::reset(void)
|
void AudioPlaySystem::reset(void)
|
||||||
{
|
{
|
||||||
snd_Reset();
|
snd_Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::stop(void)
|
void AudioPlaySystem::stop(void)
|
||||||
{
|
{
|
||||||
//__disable_irq();
|
//__disable_irq();
|
||||||
playing = false;
|
playing = false;
|
||||||
//__enable_irq();
|
//__enable_irq();
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM bool AudioPlaySystem::isPlaying(void)
|
bool AudioPlaySystem::isPlaying(void)
|
||||||
{
|
{
|
||||||
return playing;
|
return playing;
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::update(void) {
|
#ifndef HAS_T4_VGA
|
||||||
|
void AudioPlaySystem::update(void) {
|
||||||
audio_block_t *block;
|
audio_block_t *block;
|
||||||
|
|
||||||
// only update if we're playing
|
// only update if we're playing
|
||||||
|
|
@ -180,8 +181,9 @@ PROGMEM void AudioPlaySystem::update(void) {
|
||||||
transmit(block);
|
transmit(block);
|
||||||
release(block);
|
release(block);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::sound(int C, int F, int V) {
|
void AudioPlaySystem::sound(int C, int F, int V) {
|
||||||
#ifndef CUSTOM_SND
|
#ifndef CUSTOM_SND
|
||||||
if (C < 6) {
|
if (C < 6) {
|
||||||
chan[C].vol = V;
|
chan[C].vol = V;
|
||||||
|
|
@ -190,7 +192,6 @@ PROGMEM void AudioPlaySystem::sound(int C, int F, int V) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::step(void) {
|
void AudioPlaySystem::step(void) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,12 @@
|
||||||
|
|
||||||
#ifdef HAS_SND
|
#ifdef HAS_SND
|
||||||
|
|
||||||
|
#include "platform_config.h"
|
||||||
|
|
||||||
|
//#undef HAS_T4_VGA // To force using Audio library!!
|
||||||
|
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
|
|
||||||
#include <Audio.h>
|
#include <Audio.h>
|
||||||
|
|
||||||
class AudioPlaySystem : public AudioStream
|
class AudioPlaySystem : public AudioStream
|
||||||
|
|
@ -21,8 +27,28 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void update(void);
|
virtual void update(void);
|
||||||
|
static void snd_Mixer(short * stream, int len );
|
||||||
|
};
|
||||||
|
|
||||||
|
#else
|
||||||
|
class AudioPlaySystem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AudioPlaySystem(void) { };
|
||||||
|
void begin(void);
|
||||||
|
void setSampleParameters(float clockfreq, float samplerate);
|
||||||
|
void reset(void);
|
||||||
|
void start(void);
|
||||||
|
void stop(void);
|
||||||
|
bool isPlaying(void);
|
||||||
|
void sound(int C, int F, int V);
|
||||||
|
void buzz(int size, int val);
|
||||||
|
void step(void);
|
||||||
|
static void snd_Mixer(short * stream, int len );
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
#define HAS_T41 1
|
#define HAS_T41 1
|
||||||
#define HAS_T4_VGA 1
|
#define HAS_T4_VGA 1
|
||||||
|
|
||||||
//#define HAS_SND 1
|
#define HAS_SND 1
|
||||||
//#define INVX 1
|
//#define INVX 1
|
||||||
//#define INVY 1
|
//#define INVY 1
|
||||||
#define HAS_USBKEY 1
|
#define HAS_USBKEY 1
|
||||||
|
|
|
||||||
|
|
@ -277,31 +277,33 @@ void loop(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAS_SND
|
#ifdef HAS_SND
|
||||||
|
|
||||||
#include <Audio.h>
|
|
||||||
#include "AudioPlaySystem.h"
|
#include "AudioPlaySystem.h"
|
||||||
|
|
||||||
AudioPlaySystem mymixer;
|
AudioPlaySystem mymixer;
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
|
#include <Audio.h>
|
||||||
#if defined(__IMXRT1052__) || defined(__IMXRT1062__)
|
#if defined(__IMXRT1052__) || defined(__IMXRT1062__)
|
||||||
#ifdef HAS_T4_VGA
|
//AudioOutputMQS mqs;
|
||||||
|
//AudioConnection patchCord9(mymixer, 0, mqs, 1);
|
||||||
AudioOutputI2S i2s1;
|
AudioOutputI2S i2s1;
|
||||||
AudioConnection patchCord8(mymixer, 0, i2s1, 0);
|
AudioConnection patchCord8(mymixer, 0, i2s1, 0);
|
||||||
AudioConnection patchCord9(mymixer, 0, i2s1, 1);
|
AudioConnection patchCord9(mymixer, 0, i2s1, 1);
|
||||||
AudioControlSGTL5000 sgtl5000_1;
|
AudioControlSGTL5000 sgtl5000_1;
|
||||||
#else
|
#else
|
||||||
AudioOutputMQS mqs;
|
|
||||||
AudioConnection patchCord9(mymixer, 0, mqs, 1);
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
AudioOutputAnalog dac1;
|
AudioOutputAnalog dac1;
|
||||||
AudioConnection patchCord1(mymixer, dac1);
|
AudioConnection patchCord1(mymixer, dac1);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
void emu_sndInit() {
|
void emu_sndInit() {
|
||||||
Serial.println("sound init");
|
Serial.println("sound init");
|
||||||
AudioMemory(16);
|
#ifdef HAS_T4_VGA
|
||||||
|
tft.begin_audio(256, mymixer.snd_Mixer);
|
||||||
|
// sgtl5000_1.enable();
|
||||||
|
// sgtl5000_1.volume(0.6);
|
||||||
|
#endif
|
||||||
mymixer.start();
|
mymixer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
BIN
MCUME_teensy/teensyspeccy/.DS_Store
vendored
Normal file
BIN
MCUME_teensy/teensyspeccy/.DS_Store
vendored
Normal file
Binary file not shown.
|
|
@ -68,8 +68,6 @@ static Channel chan[6] = {
|
||||||
volatile bool playing = false;
|
volatile bool playing = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void snd_Reset(void)
|
static void snd_Reset(void)
|
||||||
{
|
{
|
||||||
#ifndef CUSTOM_SND
|
#ifndef CUSTOM_SND
|
||||||
|
|
@ -90,12 +88,13 @@ static void snd_Reset(void)
|
||||||
|
|
||||||
|
|
||||||
#ifdef CUSTOM_SND
|
#ifdef CUSTOM_SND
|
||||||
extern "C" {
|
//extern "C" {
|
||||||
void SND_Process(void *sndbuffer, int sndn);
|
void SND_Process(void *sndbuffer, int sndn);
|
||||||
}
|
//}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void snd_Mixer(short * stream, int len )
|
|
||||||
|
FASTRUN void AudioPlaySystem::snd_Mixer(short * stream, int len )
|
||||||
{
|
{
|
||||||
if (playing)
|
if (playing)
|
||||||
{
|
{
|
||||||
|
|
@ -105,7 +104,6 @@ static void snd_Mixer(short * stream, int len )
|
||||||
int i;
|
int i;
|
||||||
long s;
|
long s;
|
||||||
len = len >> 1;
|
len = len >> 1;
|
||||||
|
|
||||||
short v0=chan[0].vol;
|
short v0=chan[0].vol;
|
||||||
short v1=chan[1].vol;
|
short v1=chan[1].vol;
|
||||||
short v2=chan[2].vol;
|
short v2=chan[2].vol;
|
||||||
|
|
@ -135,14 +133,14 @@ static void snd_Mixer(short * stream, int len )
|
||||||
|
|
||||||
void AudioPlaySystem::begin(void)
|
void AudioPlaySystem::begin(void)
|
||||||
{
|
{
|
||||||
//emu_printf("AudioPlaySystem constructor");
|
|
||||||
this->reset();
|
this->reset();
|
||||||
//setSampleParameters(CLOCKFREQ, SAMPLERATE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioPlaySystem::start(void)
|
void AudioPlaySystem::start(void)
|
||||||
{
|
{
|
||||||
//emu_printf("allocating sound buf");
|
#ifndef HAS_T4_VGA
|
||||||
|
AudioMemory(16);
|
||||||
|
#endif
|
||||||
playing = true;
|
playing = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -166,6 +164,7 @@ bool AudioPlaySystem::isPlaying(void)
|
||||||
return playing;
|
return playing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
void AudioPlaySystem::update(void) {
|
void AudioPlaySystem::update(void) {
|
||||||
audio_block_t *block;
|
audio_block_t *block;
|
||||||
|
|
||||||
|
|
@ -182,6 +181,7 @@ void AudioPlaySystem::update(void) {
|
||||||
transmit(block);
|
transmit(block);
|
||||||
release(block);
|
release(block);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void AudioPlaySystem::sound(int C, int F, int V) {
|
void AudioPlaySystem::sound(int C, int F, int V) {
|
||||||
#ifndef CUSTOM_SND
|
#ifndef CUSTOM_SND
|
||||||
|
|
@ -198,4 +198,3 @@ void AudioPlaySystem::step(void) {
|
||||||
void AudioPlaySystem::buzz(int size, int val) {
|
void AudioPlaySystem::buzz(int size, int val) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,12 @@
|
||||||
|
|
||||||
#ifdef HAS_SND
|
#ifdef HAS_SND
|
||||||
|
|
||||||
|
#include "platform_config.h"
|
||||||
|
|
||||||
|
//#undef HAS_T4_VGA // To force using Audio library!!
|
||||||
|
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
|
|
||||||
#include <Audio.h>
|
#include <Audio.h>
|
||||||
|
|
||||||
class AudioPlaySystem : public AudioStream
|
class AudioPlaySystem : public AudioStream
|
||||||
|
|
@ -21,8 +27,28 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void update(void);
|
virtual void update(void);
|
||||||
|
static void snd_Mixer(short * stream, int len );
|
||||||
|
};
|
||||||
|
|
||||||
|
#else
|
||||||
|
class AudioPlaySystem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AudioPlaySystem(void) { };
|
||||||
|
void begin(void);
|
||||||
|
void setSampleParameters(float clockfreq, float samplerate);
|
||||||
|
void reset(void);
|
||||||
|
void start(void);
|
||||||
|
void stop(void);
|
||||||
|
bool isPlaying(void);
|
||||||
|
void sound(int C, int F, int V);
|
||||||
|
void buzz(int size, int val);
|
||||||
|
void step(void);
|
||||||
|
static void snd_Mixer(short * stream, int len );
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
//#define OLD_LAYOUT 1
|
//#define OLD_LAYOUT 1
|
||||||
#define HAS_T4_VGA 1
|
#define HAS_T4_VGA 1
|
||||||
|
|
||||||
//#define HAS_SND 1
|
#define HAS_SND 1
|
||||||
//#define INVX 1
|
//#define INVX 1
|
||||||
//#define INVY 1
|
//#define INVY 1
|
||||||
#define HAS_USBKEY 1
|
#define HAS_USBKEY 1
|
||||||
|
|
|
||||||
|
|
@ -273,32 +273,31 @@ void loop(void)
|
||||||
|
|
||||||
#ifdef HAS_SND
|
#ifdef HAS_SND
|
||||||
|
|
||||||
#include <Audio.h>
|
|
||||||
#include "AudioPlaySystem.h"
|
#include "AudioPlaySystem.h"
|
||||||
|
|
||||||
AudioPlaySystem mymixer;
|
AudioPlaySystem mymixer;
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
|
#include <Audio.h>
|
||||||
#if defined(__IMXRT1052__) || defined(__IMXRT1062__)
|
#if defined(__IMXRT1052__) || defined(__IMXRT1062__)
|
||||||
#ifdef HAS_T4_VGA
|
//AudioOutputMQS mqs;
|
||||||
|
//AudioConnection patchCord9(mymixer, 0, mqs, 1);
|
||||||
AudioOutputI2S i2s1;
|
AudioOutputI2S i2s1;
|
||||||
AudioConnection patchCord8(mymixer, 0, i2s1, 0);
|
AudioConnection patchCord8(mymixer, 0, i2s1, 0);
|
||||||
AudioConnection patchCord9(mymixer, 0, i2s1, 1);
|
AudioConnection patchCord9(mymixer, 0, i2s1, 1);
|
||||||
AudioControlSGTL5000 sgtl5000_1;
|
AudioControlSGTL5000 sgtl5000_1;
|
||||||
#else
|
#else
|
||||||
AudioOutputMQS mqs;
|
|
||||||
AudioConnection patchCord9(mymixer, 0, mqs, 1);
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
AudioOutputAnalog dac1;
|
AudioOutputAnalog dac1;
|
||||||
AudioConnection patchCord1(mymixer, dac1);
|
AudioConnection patchCord1(mymixer, dac1);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
void emu_sndInit() {
|
void emu_sndInit() {
|
||||||
Serial.println("sound init");
|
Serial.println("sound init");
|
||||||
#ifdef HAS_T4_VGA
|
#ifdef HAS_T4_VGA
|
||||||
sgtl5000_1.enable();
|
tft.begin_audio(256, mymixer.snd_Mixer);
|
||||||
sgtl5000_1.volume(0.6);
|
// sgtl5000_1.enable();
|
||||||
|
// sgtl5000_1.volume(0.6);
|
||||||
#endif
|
#endif
|
||||||
AudioMemory(16);
|
|
||||||
mymixer.start();
|
mymixer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,8 +68,6 @@ static Channel chan[6] = {
|
||||||
volatile bool playing = false;
|
volatile bool playing = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void snd_Reset(void)
|
static void snd_Reset(void)
|
||||||
{
|
{
|
||||||
#ifndef CUSTOM_SND
|
#ifndef CUSTOM_SND
|
||||||
|
|
@ -90,12 +88,13 @@ static void snd_Reset(void)
|
||||||
|
|
||||||
|
|
||||||
#ifdef CUSTOM_SND
|
#ifdef CUSTOM_SND
|
||||||
extern "C" {
|
//extern "C" {
|
||||||
void SND_Process(void *sndbuffer, int sndn);
|
void SND_Process(void *sndbuffer, int sndn);
|
||||||
}
|
//}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void snd_Mixer(short * stream, int len )
|
|
||||||
|
FASTRUN void AudioPlaySystem::snd_Mixer(short * stream, int len )
|
||||||
{
|
{
|
||||||
if (playing)
|
if (playing)
|
||||||
{
|
{
|
||||||
|
|
@ -105,7 +104,6 @@ static void snd_Mixer(short * stream, int len )
|
||||||
int i;
|
int i;
|
||||||
long s;
|
long s;
|
||||||
len = len >> 1;
|
len = len >> 1;
|
||||||
|
|
||||||
short v0=chan[0].vol;
|
short v0=chan[0].vol;
|
||||||
short v1=chan[1].vol;
|
short v1=chan[1].vol;
|
||||||
short v2=chan[2].vol;
|
short v2=chan[2].vol;
|
||||||
|
|
@ -135,14 +133,14 @@ static void snd_Mixer(short * stream, int len )
|
||||||
|
|
||||||
void AudioPlaySystem::begin(void)
|
void AudioPlaySystem::begin(void)
|
||||||
{
|
{
|
||||||
//emu_printf("AudioPlaySystem constructor");
|
|
||||||
this->reset();
|
this->reset();
|
||||||
//setSampleParameters(CLOCKFREQ, SAMPLERATE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioPlaySystem::start(void)
|
void AudioPlaySystem::start(void)
|
||||||
{
|
{
|
||||||
//emu_printf("allocating sound buf");
|
#ifndef HAS_T4_VGA
|
||||||
|
AudioMemory(16);
|
||||||
|
#endif
|
||||||
playing = true;
|
playing = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -166,6 +164,7 @@ bool AudioPlaySystem::isPlaying(void)
|
||||||
return playing;
|
return playing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
void AudioPlaySystem::update(void) {
|
void AudioPlaySystem::update(void) {
|
||||||
audio_block_t *block;
|
audio_block_t *block;
|
||||||
|
|
||||||
|
|
@ -182,6 +181,7 @@ void AudioPlaySystem::update(void) {
|
||||||
transmit(block);
|
transmit(block);
|
||||||
release(block);
|
release(block);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void AudioPlaySystem::sound(int C, int F, int V) {
|
void AudioPlaySystem::sound(int C, int F, int V) {
|
||||||
#ifndef CUSTOM_SND
|
#ifndef CUSTOM_SND
|
||||||
|
|
@ -195,4 +195,3 @@ void AudioPlaySystem::sound(int C, int F, int V) {
|
||||||
void AudioPlaySystem::step(void) {
|
void AudioPlaySystem::step(void) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,12 @@
|
||||||
|
|
||||||
#ifdef HAS_SND
|
#ifdef HAS_SND
|
||||||
|
|
||||||
|
#include "platform_config.h"
|
||||||
|
|
||||||
|
//#undef HAS_T4_VGA // To force using Audio library!!
|
||||||
|
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
|
|
||||||
#include <Audio.h>
|
#include <Audio.h>
|
||||||
|
|
||||||
class AudioPlaySystem : public AudioStream
|
class AudioPlaySystem : public AudioStream
|
||||||
|
|
@ -21,8 +27,28 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void update(void);
|
virtual void update(void);
|
||||||
|
static void snd_Mixer(short * stream, int len );
|
||||||
|
};
|
||||||
|
|
||||||
|
#else
|
||||||
|
class AudioPlaySystem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AudioPlaySystem(void) { };
|
||||||
|
void begin(void);
|
||||||
|
void setSampleParameters(float clockfreq, float samplerate);
|
||||||
|
void reset(void);
|
||||||
|
void start(void);
|
||||||
|
void stop(void);
|
||||||
|
bool isPlaying(void);
|
||||||
|
void sound(int C, int F, int V);
|
||||||
|
void buzz(int size, int val);
|
||||||
|
void step(void);
|
||||||
|
static void snd_Mixer(short * stream, int len );
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -270,35 +270,33 @@ void loop(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAS_SND
|
#ifdef HAS_SND
|
||||||
|
|
||||||
#include <Audio.h>
|
|
||||||
#include "AudioPlaySystem.h"
|
#include "AudioPlaySystem.h"
|
||||||
|
|
||||||
AudioPlaySystem mymixer;
|
AudioPlaySystem mymixer;
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
|
#include <Audio.h>
|
||||||
#if defined(__IMXRT1052__) || defined(__IMXRT1062__)
|
#if defined(__IMXRT1052__) || defined(__IMXRT1062__)
|
||||||
#ifdef HAS_T4_VGA
|
//AudioOutputMQS mqs;
|
||||||
|
//AudioConnection patchCord9(mymixer, 0, mqs, 1);
|
||||||
AudioOutputI2S i2s1;
|
AudioOutputI2S i2s1;
|
||||||
AudioConnection patchCord8(mymixer, 0, i2s1, 0);
|
AudioConnection patchCord8(mymixer, 0, i2s1, 0);
|
||||||
AudioConnection patchCord9(mymixer, 0, i2s1, 1);
|
AudioConnection patchCord9(mymixer, 0, i2s1, 1);
|
||||||
AudioControlSGTL5000 sgtl5000_1;
|
AudioControlSGTL5000 sgtl5000_1;
|
||||||
#else
|
#else
|
||||||
AudioOutputMQS mqs;
|
|
||||||
AudioConnection patchCord9(mymixer, 0, mqs, 1);
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
AudioOutputAnalog dac1;
|
AudioOutputAnalog dac1;
|
||||||
AudioConnection patchCord1(mymixer, dac1);
|
AudioConnection patchCord1(mymixer, dac1);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
void emu_sndInit() {
|
void emu_sndInit() {
|
||||||
Serial.println("sound init");
|
Serial.println("sound init");
|
||||||
#ifdef HAS_T4_VGA
|
#ifdef HAS_T4_VGA
|
||||||
sgtl5000_1.enable();
|
tft.begin_audio(256, mymixer.snd_Mixer);
|
||||||
sgtl5000_1.volume(0.6);
|
// sgtl5000_1.enable();
|
||||||
|
// sgtl5000_1.volume(0.6);
|
||||||
#endif
|
#endif
|
||||||
AudioMemory(16);
|
|
||||||
mymixer.start();
|
mymixer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,8 +68,6 @@ static Channel chan[6] = {
|
||||||
volatile bool playing = false;
|
volatile bool playing = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void snd_Reset(void)
|
static void snd_Reset(void)
|
||||||
{
|
{
|
||||||
#ifndef CUSTOM_SND
|
#ifndef CUSTOM_SND
|
||||||
|
|
@ -90,12 +88,13 @@ static void snd_Reset(void)
|
||||||
|
|
||||||
|
|
||||||
#ifdef CUSTOM_SND
|
#ifdef CUSTOM_SND
|
||||||
extern "C" {
|
//extern "C" {
|
||||||
void SND_Process(void *sndbuffer, int sndn);
|
void SND_Process(void *sndbuffer, int sndn);
|
||||||
}
|
//}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void snd_Mixer(short * stream, int len )
|
|
||||||
|
FASTRUN void AudioPlaySystem::snd_Mixer(short * stream, int len )
|
||||||
{
|
{
|
||||||
if (playing)
|
if (playing)
|
||||||
{
|
{
|
||||||
|
|
@ -105,7 +104,6 @@ static void snd_Mixer(short * stream, int len )
|
||||||
int i;
|
int i;
|
||||||
long s;
|
long s;
|
||||||
len = len >> 1;
|
len = len >> 1;
|
||||||
|
|
||||||
short v0=chan[0].vol;
|
short v0=chan[0].vol;
|
||||||
short v1=chan[1].vol;
|
short v1=chan[1].vol;
|
||||||
short v2=chan[2].vol;
|
short v2=chan[2].vol;
|
||||||
|
|
@ -135,14 +133,14 @@ static void snd_Mixer(short * stream, int len )
|
||||||
|
|
||||||
void AudioPlaySystem::begin(void)
|
void AudioPlaySystem::begin(void)
|
||||||
{
|
{
|
||||||
//emu_printf("AudioPlaySystem constructor");
|
|
||||||
this->reset();
|
this->reset();
|
||||||
//setSampleParameters(CLOCKFREQ, SAMPLERATE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioPlaySystem::start(void)
|
void AudioPlaySystem::start(void)
|
||||||
{
|
{
|
||||||
//emu_printf("allocating sound buf");
|
#ifndef HAS_T4_VGA
|
||||||
|
AudioMemory(16);
|
||||||
|
#endif
|
||||||
playing = true;
|
playing = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -166,6 +164,7 @@ bool AudioPlaySystem::isPlaying(void)
|
||||||
return playing;
|
return playing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
void AudioPlaySystem::update(void) {
|
void AudioPlaySystem::update(void) {
|
||||||
audio_block_t *block;
|
audio_block_t *block;
|
||||||
|
|
||||||
|
|
@ -182,6 +181,7 @@ void AudioPlaySystem::update(void) {
|
||||||
transmit(block);
|
transmit(block);
|
||||||
release(block);
|
release(block);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void AudioPlaySystem::sound(int C, int F, int V) {
|
void AudioPlaySystem::sound(int C, int F, int V) {
|
||||||
#ifndef CUSTOM_SND
|
#ifndef CUSTOM_SND
|
||||||
|
|
@ -195,4 +195,3 @@ void AudioPlaySystem::sound(int C, int F, int V) {
|
||||||
void AudioPlaySystem::step(void) {
|
void AudioPlaySystem::step(void) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,12 @@
|
||||||
|
|
||||||
#ifdef HAS_SND
|
#ifdef HAS_SND
|
||||||
|
|
||||||
|
#include "platform_config.h"
|
||||||
|
|
||||||
|
//#undef HAS_T4_VGA // To force using Audio library!!
|
||||||
|
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
|
|
||||||
#include <Audio.h>
|
#include <Audio.h>
|
||||||
|
|
||||||
class AudioPlaySystem : public AudioStream
|
class AudioPlaySystem : public AudioStream
|
||||||
|
|
@ -21,8 +27,28 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void update(void);
|
virtual void update(void);
|
||||||
|
static void snd_Mixer(short * stream, int len );
|
||||||
|
};
|
||||||
|
|
||||||
|
#else
|
||||||
|
class AudioPlaySystem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AudioPlaySystem(void) { };
|
||||||
|
void begin(void);
|
||||||
|
void setSampleParameters(float clockfreq, float samplerate);
|
||||||
|
void reset(void);
|
||||||
|
void start(void);
|
||||||
|
void stop(void);
|
||||||
|
bool isPlaying(void);
|
||||||
|
void sound(int C, int F, int V);
|
||||||
|
void buzz(int size, int val);
|
||||||
|
void step(void);
|
||||||
|
static void snd_Mixer(short * stream, int len );
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -280,28 +280,31 @@ void loop(void)
|
||||||
|
|
||||||
#ifdef HAS_SND
|
#ifdef HAS_SND
|
||||||
|
|
||||||
#include <Audio.h>
|
|
||||||
#include "AudioPlaySystem.h"
|
#include "AudioPlaySystem.h"
|
||||||
|
|
||||||
AudioPlaySystem mymixer;
|
AudioPlaySystem mymixer;
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
|
#include <Audio.h>
|
||||||
#if defined(__IMXRT1052__) || defined(__IMXRT1062__)
|
#if defined(__IMXRT1052__) || defined(__IMXRT1062__)
|
||||||
#ifdef HAS_T4_VGA
|
//AudioOutputMQS mqs;
|
||||||
|
//AudioConnection patchCord9(mymixer, 0, mqs, 1);
|
||||||
AudioOutputI2S i2s1;
|
AudioOutputI2S i2s1;
|
||||||
AudioConnection patchCord8(mymixer, 0, i2s1, 0);
|
AudioConnection patchCord8(mymixer, 0, i2s1, 0);
|
||||||
AudioConnection patchCord9(mymixer, 0, i2s1, 1);
|
AudioConnection patchCord9(mymixer, 0, i2s1, 1);
|
||||||
AudioControlSGTL5000 sgtl5000_1;
|
AudioControlSGTL5000 sgtl5000_1;
|
||||||
#else
|
#else
|
||||||
AudioOutputMQS mqs;
|
|
||||||
AudioConnection patchCord9(mymixer, 0, mqs, 1);
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
AudioOutputAnalog dac1;
|
AudioOutputAnalog dac1;
|
||||||
AudioConnection patchCord1(mymixer, dac1);
|
AudioConnection patchCord1(mymixer, dac1);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
void emu_sndInit() {
|
void emu_sndInit() {
|
||||||
Serial.println("sound init");
|
Serial.println("sound init");
|
||||||
AudioMemory(16);
|
#ifdef HAS_T4_VGA
|
||||||
|
tft.begin_audio(256, mymixer.snd_Mixer);
|
||||||
|
// sgtl5000_1.enable();
|
||||||
|
// sgtl5000_1.volume(0.6);
|
||||||
|
#endif
|
||||||
mymixer.start();
|
mymixer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,9 +68,7 @@ static Channel chan[6] = {
|
||||||
volatile bool playing = false;
|
volatile bool playing = false;
|
||||||
|
|
||||||
|
|
||||||
|
static void snd_Reset(void)
|
||||||
|
|
||||||
PROGMEM static void snd_Reset(void)
|
|
||||||
{
|
{
|
||||||
#ifndef CUSTOM_SND
|
#ifndef CUSTOM_SND
|
||||||
chan[0].vol = 0;
|
chan[0].vol = 0;
|
||||||
|
|
@ -90,10 +88,13 @@ PROGMEM static void snd_Reset(void)
|
||||||
|
|
||||||
|
|
||||||
#ifdef CUSTOM_SND
|
#ifdef CUSTOM_SND
|
||||||
|
//extern "C" {
|
||||||
void SND_Process(void *sndbuffer, int sndn);
|
void SND_Process(void *sndbuffer, int sndn);
|
||||||
|
//}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PROGMEM static void snd_Mixer(short * stream, int len )
|
|
||||||
|
FASTRUN void AudioPlaySystem::snd_Mixer(short * stream, int len )
|
||||||
{
|
{
|
||||||
if (playing)
|
if (playing)
|
||||||
{
|
{
|
||||||
|
|
@ -103,7 +104,6 @@ PROGMEM static void snd_Mixer(short * stream, int len )
|
||||||
int i;
|
int i;
|
||||||
long s;
|
long s;
|
||||||
len = len >> 1;
|
len = len >> 1;
|
||||||
|
|
||||||
short v0=chan[0].vol;
|
short v0=chan[0].vol;
|
||||||
short v1=chan[1].vol;
|
short v1=chan[1].vol;
|
||||||
short v2=chan[2].vol;
|
short v2=chan[2].vol;
|
||||||
|
|
@ -131,40 +131,41 @@ PROGMEM static void snd_Mixer(short * stream, int len )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::begin(void)
|
void AudioPlaySystem::begin(void)
|
||||||
{
|
{
|
||||||
//emu_printf("AudioPlaySystem constructor");
|
|
||||||
this->reset();
|
this->reset();
|
||||||
setSampleParameters(CLOCKFREQ, SAMPLERATE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::start(void)
|
void AudioPlaySystem::start(void)
|
||||||
{
|
{
|
||||||
//emu_printf("allocating sound buf");
|
#ifndef HAS_T4_VGA
|
||||||
|
AudioMemory(16);
|
||||||
|
#endif
|
||||||
playing = true;
|
playing = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) {
|
void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) {
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::reset(void)
|
void AudioPlaySystem::reset(void)
|
||||||
{
|
{
|
||||||
snd_Reset();
|
snd_Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::stop(void)
|
void AudioPlaySystem::stop(void)
|
||||||
{
|
{
|
||||||
//__disable_irq();
|
//__disable_irq();
|
||||||
playing = false;
|
playing = false;
|
||||||
//__enable_irq();
|
//__enable_irq();
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM bool AudioPlaySystem::isPlaying(void)
|
bool AudioPlaySystem::isPlaying(void)
|
||||||
{
|
{
|
||||||
return playing;
|
return playing;
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::update(void) {
|
#ifndef HAS_T4_VGA
|
||||||
|
void AudioPlaySystem::update(void) {
|
||||||
audio_block_t *block;
|
audio_block_t *block;
|
||||||
|
|
||||||
// only update if we're playing
|
// only update if we're playing
|
||||||
|
|
@ -180,8 +181,9 @@ PROGMEM void AudioPlaySystem::update(void) {
|
||||||
transmit(block);
|
transmit(block);
|
||||||
release(block);
|
release(block);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::sound(int C, int F, int V) {
|
void AudioPlaySystem::sound(int C, int F, int V) {
|
||||||
#ifndef CUSTOM_SND
|
#ifndef CUSTOM_SND
|
||||||
if (C < 6) {
|
if (C < 6) {
|
||||||
chan[C].vol = V;
|
chan[C].vol = V;
|
||||||
|
|
@ -190,8 +192,6 @@ PROGMEM void AudioPlaySystem::sound(int C, int F, int V) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
PROGMEM void AudioPlaySystem::step(void) {
|
void AudioPlaySystem::step(void) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,12 @@
|
||||||
|
|
||||||
#ifdef HAS_SND
|
#ifdef HAS_SND
|
||||||
|
|
||||||
|
#include "platform_config.h"
|
||||||
|
|
||||||
|
//#undef HAS_T4_VGA // To force using Audio library!!
|
||||||
|
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
|
|
||||||
#include <Audio.h>
|
#include <Audio.h>
|
||||||
|
|
||||||
class AudioPlaySystem : public AudioStream
|
class AudioPlaySystem : public AudioStream
|
||||||
|
|
@ -21,9 +27,28 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void update(void);
|
virtual void update(void);
|
||||||
|
static void snd_Mixer(short * stream, int len );
|
||||||
|
};
|
||||||
|
|
||||||
|
#else
|
||||||
|
class AudioPlaySystem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AudioPlaySystem(void) { };
|
||||||
|
void begin(void);
|
||||||
|
void setSampleParameters(float clockfreq, float samplerate);
|
||||||
|
void reset(void);
|
||||||
|
void start(void);
|
||||||
|
void stop(void);
|
||||||
|
bool isPlaying(void);
|
||||||
|
void sound(int C, int F, int V);
|
||||||
|
void buzz(int size, int val);
|
||||||
|
void step(void);
|
||||||
|
static void snd_Mixer(short * stream, int len );
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,10 @@ extern "C" {
|
||||||
|
|
||||||
#ifdef HAS_T4_VGA
|
#ifdef HAS_T4_VGA
|
||||||
#include "vga_t_dma.h"
|
#include "vga_t_dma.h"
|
||||||
const vga_pixel deflogo[] = {
|
const int16_t deflogo[] = {
|
||||||
0,0
|
0,0
|
||||||
};
|
};
|
||||||
static const vga_pixel * logo = deflogo;
|
static const int16_t * logo = deflogo;
|
||||||
#else
|
#else
|
||||||
#include "tft_t_dma.h"
|
#include "tft_t_dma.h"
|
||||||
const uint16_t deflogo[] = {
|
const uint16_t deflogo[] = {
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,11 @@
|
||||||
|
|
||||||
//#define OLD_LAYOUT 1
|
//#define OLD_LAYOUT 1
|
||||||
#define HAS_T4_VGA 1
|
#define HAS_T4_VGA 1
|
||||||
|
//#define HIRES 1
|
||||||
|
|
||||||
//#define INVX 1
|
//#define INVX 1
|
||||||
#define INVY 1
|
#define INVY 1
|
||||||
//#define HAS_SND 1
|
#define HAS_SND 1
|
||||||
#define HAS_USBKEY 1
|
#define HAS_USBKEY 1
|
||||||
//#define HAS_I2CKBD 1
|
//#define HAS_I2CKBD 1
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -202,8 +202,12 @@ void * emu_LineBuffer(int line)
|
||||||
void setup() {
|
void setup() {
|
||||||
|
|
||||||
#ifdef HAS_T4_VGA
|
#ifdef HAS_T4_VGA
|
||||||
|
#ifdef HIRES
|
||||||
tft.begin(VGA_MODE_640x240);
|
tft.begin(VGA_MODE_640x240);
|
||||||
NVIC_SET_PRIORITY(IRQ_QTIMER3, 0);
|
#else
|
||||||
|
tft.begin(VGA_MODE_320x240);
|
||||||
|
#endif
|
||||||
|
//NVIC_SET_PRIORITY(IRQ_QTIMER3, 0);
|
||||||
#else
|
#else
|
||||||
tft.begin();
|
tft.begin();
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -274,28 +278,31 @@ void loop(void)
|
||||||
|
|
||||||
#ifdef HAS_SND
|
#ifdef HAS_SND
|
||||||
|
|
||||||
#include <Audio.h>
|
|
||||||
#include "AudioPlaySystem.h"
|
#include "AudioPlaySystem.h"
|
||||||
|
|
||||||
AudioPlaySystem mymixer;
|
AudioPlaySystem mymixer;
|
||||||
|
#ifndef HAS_T4_VGA
|
||||||
|
#include <Audio.h>
|
||||||
#if defined(__IMXRT1052__) || defined(__IMXRT1062__)
|
#if defined(__IMXRT1052__) || defined(__IMXRT1062__)
|
||||||
#ifdef HAS_T4_VGA
|
//AudioOutputMQS mqs;
|
||||||
|
//AudioConnection patchCord9(mymixer, 0, mqs, 1);
|
||||||
AudioOutputI2S i2s1;
|
AudioOutputI2S i2s1;
|
||||||
AudioConnection patchCord8(mymixer, 0, i2s1, 0);
|
AudioConnection patchCord8(mymixer, 0, i2s1, 0);
|
||||||
AudioConnection patchCord9(mymixer, 0, i2s1, 1);
|
AudioConnection patchCord9(mymixer, 0, i2s1, 1);
|
||||||
AudioControlSGTL5000 sgtl5000_1;
|
AudioControlSGTL5000 sgtl5000_1;
|
||||||
#else
|
#else
|
||||||
AudioOutputMQS mqs;
|
|
||||||
AudioConnection patchCord9(mymixer, 0, mqs, 1);
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
AudioOutputAnalog dac1;
|
AudioOutputAnalog dac1;
|
||||||
AudioConnection patchCord1(mymixer, dac1);
|
AudioConnection patchCord1(mymixer, dac1);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
void emu_sndInit() {
|
void emu_sndInit() {
|
||||||
Serial.println("sound init");
|
Serial.println("sound init");
|
||||||
AudioMemory(16);
|
#ifdef HAS_T4_VGA
|
||||||
|
tft.begin_audio(256, mymixer.snd_Mixer);
|
||||||
|
// sgtl5000_1.enable();
|
||||||
|
// sgtl5000_1.volume(0.6);
|
||||||
|
#endif
|
||||||
mymixer.start();
|
mymixer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,10 +57,14 @@ struct uae_prefs currprefs = {
|
||||||
/* gfx_width */ WIN_W,
|
/* gfx_width */ WIN_W,
|
||||||
/* gfx_height */ WIN_H,
|
/* gfx_height */ WIN_H,
|
||||||
#ifdef HAS_T4_VGA
|
#ifdef HAS_T4_VGA
|
||||||
|
#ifdef HIRES
|
||||||
/* gfx_lores */ 0,
|
/* gfx_lores */ 0,
|
||||||
#else
|
#else
|
||||||
/* gfx_lores */ 1,
|
/* gfx_lores */ 1,
|
||||||
#endif
|
#endif
|
||||||
|
#else
|
||||||
|
/* gfx_lores */ 1,
|
||||||
|
#endif
|
||||||
/* gfx_linedbl */ 0,
|
/* gfx_linedbl */ 0,
|
||||||
/* gfx_correct_aspect */ 0,
|
/* gfx_correct_aspect */ 0,
|
||||||
#ifdef HAS_T4_VGA
|
#ifdef HAS_T4_VGA
|
||||||
|
|
|
||||||
|
|
@ -15,9 +15,13 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HIRES
|
||||||
#define TFT_WIDTH 640 //320
|
#define TFT_WIDTH 640
|
||||||
#define TFT_REALWIDTH 640 //320
|
#define TFT_REALWIDTH 640
|
||||||
|
#else
|
||||||
|
#define TFT_WIDTH 320
|
||||||
|
#define TFT_REALWIDTH 320
|
||||||
|
#endif
|
||||||
|
|
||||||
#define TFT_HEIGHT 240
|
#define TFT_HEIGHT 240
|
||||||
#define TFT_REALHEIGHT 240
|
#define TFT_REALHEIGHT 240
|
||||||
|
|
@ -44,8 +48,8 @@ class TFT_T_DMA: public VGA_T4
|
||||||
void fillScreenNoDma(vga_pixel color) { clear(color); }
|
void fillScreenNoDma(vga_pixel color) { clear(color); }
|
||||||
void drawTextNoDma(int16_t x, int16_t y, const char * text, vga_pixel fgcolor, vga_pixel bgcolor, bool doublesize) { drawText(x,y,text,fgcolor,bgcolor,doublesize); }
|
void drawTextNoDma(int16_t x, int16_t y, const char * text, vga_pixel fgcolor, vga_pixel bgcolor, bool doublesize) { drawText(x,y,text,fgcolor,bgcolor,doublesize); }
|
||||||
void drawRectNoDma(int16_t x, int16_t y, int16_t w, int16_t h, vga_pixel color) { drawRect(x, y, w, h, color); }
|
void drawRectNoDma(int16_t x, int16_t y, int16_t w, int16_t h, vga_pixel color) { drawRect(x, y, w, h, color); }
|
||||||
void drawSpriteNoDma(int16_t x, int16_t y, const vga_pixel *bitmap) { drawSprite(x, y, bitmap); }
|
void drawSpriteNoDma(int16_t x, int16_t y, const int16_t *bitmap) { drawSprite(x, y, bitmap); }
|
||||||
void drawSpriteNoDma(int16_t x, int16_t y, const vga_pixel *bitmap, uint16_t croparx, uint16_t cropary, uint16_t croparw, uint16_t croparh) { drawSprite(x, y, bitmap, croparx, cropary, croparw, croparh); }
|
void drawSpriteNoDma(int16_t x, int16_t y, const int16_t *bitmap, uint16_t croparx, uint16_t cropary, uint16_t croparw, uint16_t croparh) { drawSprite(x, y, bitmap, croparx, cropary, croparw, croparh); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue