aboutsummaryrefslogtreecommitdiffstats
path: root/Projects
diff options
context:
space:
mode:
Diffstat (limited to 'Projects')
-rw-r--r--Projects/MIDIToneGenerator/Descriptors.c (renamed from Projects/Incomplete/MIDIToneGenerator/Descriptors.c)0
-rw-r--r--Projects/MIDIToneGenerator/Descriptors.h (renamed from Projects/Incomplete/MIDIToneGenerator/Descriptors.h)0
-rw-r--r--Projects/MIDIToneGenerator/MIDIToneGenerator.c (renamed from Projects/Incomplete/MIDIToneGenerator/MIDIToneGenerator.c)9
-rw-r--r--Projects/MIDIToneGenerator/MIDIToneGenerator.h (renamed from Projects/Incomplete/MIDIToneGenerator/MIDIToneGenerator.h)2
-rw-r--r--Projects/MIDIToneGenerator/MIDIToneGenerator.txt73
-rw-r--r--Projects/MIDIToneGenerator/makefile (renamed from Projects/Incomplete/MIDIToneGenerator/makefile)6
-rw-r--r--Projects/makefile3
7 files changed, 85 insertions, 8 deletions
diff --git a/Projects/Incomplete/MIDIToneGenerator/Descriptors.c b/Projects/MIDIToneGenerator/Descriptors.c
index 505ea4aef..505ea4aef 100644
--- a/Projects/Incomplete/MIDIToneGenerator/Descriptors.c
+++ b/Projects/MIDIToneGenerator/Descriptors.c
diff --git a/Projects/Incomplete/MIDIToneGenerator/Descriptors.h b/Projects/MIDIToneGenerator/Descriptors.h
index b56fb6ff6..b56fb6ff6 100644
--- a/Projects/Incomplete/MIDIToneGenerator/Descriptors.h
+++ b/Projects/MIDIToneGenerator/Descriptors.h
diff --git a/Projects/Incomplete/MIDIToneGenerator/MIDIToneGenerator.c b/Projects/MIDIToneGenerator/MIDIToneGenerator.c
index c8e06bed4..d55838494 100644
--- a/Projects/Incomplete/MIDIToneGenerator/MIDIToneGenerator.c
+++ b/Projects/MIDIToneGenerator/MIDIToneGenerator.c
@@ -109,7 +109,7 @@ int main(void)
LRUNoteStruct = &NoteData[i];
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 */
LRUNoteStruct = &NoteData[i];
@@ -161,9 +161,14 @@ ISR(TIMER0_COMPA_vect, ISR_BLOCK)
/* Sum together all the active notes to form a single sample */
for (uint8_t i = 0; i < MAX_SIMULTANEOUS_NOTES; i++)
{
+ /* A non-zero pitch indicates the note is active */
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;
}
}
diff --git a/Projects/Incomplete/MIDIToneGenerator/MIDIToneGenerator.h b/Projects/MIDIToneGenerator/MIDIToneGenerator.h
index 2936ca2c7..97f907755 100644
--- a/Projects/Incomplete/MIDIToneGenerator/MIDIToneGenerator.h
+++ b/Projects/MIDIToneGenerator/MIDIToneGenerator.h
@@ -95,7 +95,7 @@
uint8_t Pitch;
uint32_t TableIncrement;
uint32_t TablePosition;
- } DDSNoteData;
+ } DDSNoteData;
/* Function Prototypes: */
void SetupHardware(void);
diff --git a/Projects/MIDIToneGenerator/MIDIToneGenerator.txt b/Projects/MIDIToneGenerator/MIDIToneGenerator.txt
new file mode 100644
index 000000000..447ed7001
--- /dev/null
+++ b/Projects/MIDIToneGenerator/MIDIToneGenerator.txt
@@ -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>
+ */
+
diff --git a/Projects/Incomplete/MIDIToneGenerator/makefile b/Projects/MIDIToneGenerator/makefile
index 71507f5bb..a89cbb100 100644
--- a/Projects/Incomplete/MIDIToneGenerator/makefile
+++ b/Projects/MIDIToneGenerator/makefile
@@ -112,7 +112,7 @@ OBJDIR = .
# Path to the LUFA library
-LUFA_PATH = ../../../
+LUFA_PATH = ../../
# 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_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
include $(LUFA_PATH)/LUFA/makefile
diff --git a/Projects/makefile b/Projects/makefile
index 549887773..223896115 100644
--- a/Projects/makefile
+++ b/Projects/makefile
@@ -26,6 +26,9 @@ all:
$(MAKE) -C Magstripe clean
$(MAKE) -C Magstripe all
+ $(MAKE) -C MIDIToneGenerator clean
+ $(MAKE) -C MIDIToneGenerator all
+
$(MAKE) -C MissileLauncher clean
$(MAKE) -C MissileLauncher all
d='n511' href='#n511'>511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735