Added new completed MIDIToneGenerator project.

pull/1469/head
Dean Camera 14 years ago
parent b20d25854d
commit 8a7351c760

File diff suppressed because one or more lines are too long

@ -9,7 +9,7 @@
* \section Sec_ChangeLogXXXXXX Version XXXXXX * \section Sec_ChangeLogXXXXXX Version XXXXXX
* <b>New:</b> * <b>New:</b>
* - Core: * - Core:
* - None * - Added new MIDIToneGenerator project
* - Library Applications: * - Library Applications:
* - Added new incomplete MIDIToneGenerator project * - Added new incomplete MIDIToneGenerator project
* - Added ability to write protect Mass Storage disk write operations from the host OS * - Added ability to write protect Mass Storage disk write operations from the host OS
@ -25,7 +25,7 @@
* <b>Fixed:</b> * <b>Fixed:</b>
* - Core: * - Core:
* - Fixed broken USBFOO board drivers due to missing BOARD_USBFOO define * - Fixed broken USBFOO board drivers due to missing BOARD_USBFOO define
* - Fixed HID hpst class driver incorrectly binding to HID devices that do not have an OUT endpoint * - Fixed HID host class driver incorrectly binding to HID devices that do not have an OUT endpoint
* - Library Applications: * - Library Applications:
* - Fixed Benito project discarding incoming data from the USB virtual serial port when the USART is busy * - Fixed Benito project discarding incoming data from the USB virtual serial port when the USART is busy
* - Fixed broken DFU bootloader, added XPLAIN support for bootloader start when XCK jumpered to ground * - Fixed broken DFU bootloader, added XPLAIN support for bootloader start when XCK jumpered to ground

@ -102,6 +102,7 @@
* - <b>Benito</b> - Benito Board Arduino Programmer project * - <b>Benito</b> - Benito Board Arduino Programmer project
* - <b>LEDNotifier</b> - USB LED Notification project * - <b>LEDNotifier</b> - USB LED Notification project
* - <b>Magstripe</b> - Magnetic Stripe Card Reader project * - <b>Magstripe</b> - Magnetic Stripe Card Reader project
* - <b>MIDIToneGenerator</b> - MIDI Note Tone Generator project
* - <b>MissileLaucher</b> - Toy Missile Launcher Host project * - <b>MissileLaucher</b> - Toy Missile Launcher Host project
* - <b>RelayBoard</b> - Relay board controller, controllable via the "sismpctl" Linux application * - <b>RelayBoard</b> - Relay board controller, controllable via the "sismpctl" Linux application
* - <b>TempDataLogger</b> - Temperature Datalogging project, using the FatFS library * - <b>TempDataLogger</b> - Temperature Datalogging project, using the FatFS library

@ -109,7 +109,7 @@ int main(void)
LRUNoteStruct = &NoteData[i]; LRUNoteStruct = &NoteData[i];
break; break;
} }
else if (NoteData[i].LRUAge > LRUNoteStruct->LRUAge) else if (NoteData[i].LRUAge >= LRUNoteStruct->LRUAge)
{ {
/* If an older entry that the current entry has been found, prefer overwriting that one */ /* If an older entry that the current entry has been found, prefer overwriting that one */
LRUNoteStruct = &NoteData[i]; LRUNoteStruct = &NoteData[i];
@ -161,9 +161,14 @@ ISR(TIMER0_COMPA_vect, ISR_BLOCK)
/* Sum together all the active notes to form a single sample */ /* Sum together all the active notes to form a single sample */
for (uint8_t i = 0; i < MAX_SIMULTANEOUS_NOTES; i++) for (uint8_t i = 0; i < MAX_SIMULTANEOUS_NOTES; i++)
{ {
/* A non-zero pitch indicates the note is active */
if (NoteData[i].Pitch) if (NoteData[i].Pitch)
{ {
MixedSample += SineTable[NoteData[i].TablePosition >> 24]; /* Use the top 8 bits of the table position as the sample table index */
uint8_t TableIndex = ((uint8_t*)&NoteData[i].TablePosition)[3];
/* Add the new tone sample to the accumulator and increment the table position */
MixedSample += SineTable[TableIndex];
NoteData[i].TablePosition += NoteData[i].TableIncrement; NoteData[i].TablePosition += NoteData[i].TableIncrement;
} }
} }

@ -0,0 +1,73 @@
/** \file
*
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
/** \mainpage MIDI Tone Generator Project
*
* \section SSec_Compat Project Compatibility:
*
* The following list indicates what microcontrollers are compatible with this project.
*
* - Series 7 USB AVRs (AT90USBxxx7)
* - Series 6 USB AVRs (AT90USBxxx6)
* - Series 4 USB AVRs (ATMEGAxxU4)
*
* \section SSec_Info USB Information:
*
* The following table gives a rundown of the USB utilization of this project.
*
* <table>
* <tr>
* <td><b>USB Mode:</b></td>
* <td>Device</td>
* </tr>
* <tr>
* <td><b>USB Class:</b></td>
* <td>Audio Class</td>
* </tr>
* <tr>
* <td><b>USB Subclass:</b></td>
* <td>Standard Audio Device</td>
* </tr>
* <tr>
* <td><b>Relevant Standards:</b></td>
* <td>USBIF Audio Class Specification \n
* USB-MIDI Audio Class Extension Specification \n
* General MIDI Specification</td>
* </tr>
* <tr>
* <td><b>Usable Speeds:</b></td>
* <td>Full Speed Mode</td>
* </tr>
* </table>
*
* \section SSec_Description Project Description:
*
* MIDI note synthesiser project. This project implements a basic DDS frequency synthesiser, capable of producing 8-bit PWM sine
* waves of variable frequency. When attached to a USB host, this project will allow for multiple MIDI notes to be synthesised into
* audiable sound via PWM, using the notes sent to MIDI channel 1.
*
* Outgoing audio will output in 8-bit PWM onto the timer 3 output compare channel A. Decouple the audio output with a capacitor
* and attach to a speaker to hear the audio.
*
* \section SSec_Options Project Options
*
* The following defines can be found in this project, which can control the project behaviour when defined, or changed in value.
*
* <table>
* <tr>
* <td><b>Define Name:</b></td>
* <td><b>Location:</b></td>
* <td><b>Description:</b></td>
* </tr>
* <tr>
* <td>MAX_SIMULTANEOUS_NOTES</td>
* <td>MIDIToneGenerator.h</td>
* <td>Sets the maximum number of MIDI notes that can be generated simultaneously. More notes require more processing time,
* and thus a value that is too high will cause audiable sound distortion due to insufficient CPU time.</td>
* </tr>
* </table>
*/

@ -112,7 +112,7 @@ OBJDIR = .
# Path to the LUFA library # Path to the LUFA library
LUFA_PATH = ../../../ LUFA_PATH = ../../
# LUFA library compile-time options and predefined tokens # LUFA library compile-time options and predefined tokens
@ -122,10 +122,6 @@ LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
LUFA_OPTS += -D USE_FLASH_DESCRIPTORS LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)" LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
LUFA_OPTS += -D AUDIO_OUT_STEREO
#LUFA_OPTS += -D AUDIO_OUT_MONO
#LUFA_OPTS += -D AUDIO_OUT_PORTC
# Create the LUFA source path variables by including the LUFA root makefile # Create the LUFA source path variables by including the LUFA root makefile
include $(LUFA_PATH)/LUFA/makefile include $(LUFA_PATH)/LUFA/makefile

@ -26,6 +26,9 @@ all:
$(MAKE) -C Magstripe clean $(MAKE) -C Magstripe clean
$(MAKE) -C Magstripe all $(MAKE) -C Magstripe all
$(MAKE) -C MIDIToneGenerator clean
$(MAKE) -C MIDIToneGenerator all
$(MAKE) -C MissileLauncher clean $(MAKE) -C MissileLauncher clean
$(MAKE) -C MissileLauncher all $(MAKE) -C MissileLauncher all

Loading…
Cancel
Save